前言:
當我們使用嵌入式linux 進行開發時,kernel 跑起來之後,我們希望能通過串口(標准輸入、輸出),在應用程序正在運行的過程中,進行一些調試工作,例如,對CPU一些寄存進行調整,以觀測調整以後的結果,並且,當我們無法把我們的應用程序放在後台運行,那麼我們就需要實現一個基礎的控制台。
下文中的控制台,雖然簡單,但完備的支持 上 下 左 右 backspace del 常用控制台操作,使用 上 下 鍵可以浏覽已經輸入過的命令(類似 doskey 這樣的功能),支持 光標 左右移動 修改命令
一般我們在 main 函數最後 都會做 while(TRUE) sleep(1000) 這樣 阻塞住主線程,用這個控制台的實現,替換這個過程,則應用程序可增加控制台應用功能,各部分的具體實現如下:
調用代碼(main.c):
- #include <stdio.h>
- #include "app_console.h"
-
- int main(int argc, char *argv[])
- {
- // 之前的應用代碼
- ....
- ....
- ....
- App_Console_Start();
- return 0;
- }
控制台頭文件(app_console.h)
- #ifndef __APP_CONSOLE_H__
- #define __APP_CONSOLE_H__
-
- #ifdef __cplusplus
- extern "C"
- {
- #endif
-
- #include "type_def.h"
-
- void App_Console_Start();
-
-
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
控制台C文件(app_console.c)
- #include "app_console.h"
- #include "ctype.h"
- #include "unistd.h"
- #include "app_test.h"
-
- // 說明
- // read write 使用的是 POSIX 的標准文件讀寫函數
- // unistd.h 包含了 STDIN_FILENO 等文件描述符的定義
- // ctype.h 包含了 isprint 函數的聲明
- // 經過仔細考慮,決定不支持 ESC 鍵,因為ESC 鍵的鍵值為 0x1b 與 上下左右的鍵值重復
- // 但可以考慮按2下ESC清除本行輸入
- // 對不可打印字符的處理僅限於以下已經列出的宏定義
-
- // change:
- // 放棄對 double ESC 的支持,因為可能出現按了 ESC 又按了 方向鍵 的情況
- // 則用戶輸入編碼為 '/x1b' '/x1b' '[' 'A' (按了ESC 又按了上鍵)
-
- // change:
- // 為了將應用與控制台應用剝離,則將 #define MAX_CMD_LEN 512 房到 app_test.h 中定義
- // 二維數組作為參數進行傳遞時,需要明確第二個維度的大小,否則編譯器無法正確定位地址
-
-
-
-
- #define KEY_BACKSPACE '/x08' // back space
- #define KEY_DEL '/x7F' // del
- #define KEY_ENTER '/x0A' // 回車
-
- // 以下為 0x1b 開頭的鍵值
- //#define KEY_DOUBLEESC "/x1B/x1B"// ESC
- //#define KEY_ARROW_UP "/x1B[A" // 上
- //#define KEY_ARROW_DOWN "/x1B[B" // 下
- //#define KEY_ARROW_LEFT "/x1B[D" // 左
- //#define KEY_ARROW_RIGHT "/x1B[C" // 右
-
- typedef enum
- {
- WKS_WAIT,
- WKS_RECV1B,
- WKS_UDLR,
- }T_WaitKeyState;
-
- #define MAX_CMD_HISTORY 32
- #define MAX_PAR_COUNT 16
-
- static char szPrompt[] = {"TR_Console> "};
-
- static T_WaitKeyState waitKeyState = WKS_WAIT;
- static char szCmdHistory[MAX_CMD_HISTORY][MAX_CMD_LEN];
- static char szCmdNow[MAX_CMD_LEN] = {0};
-
- static UINT32 nCmdIndex = 0;
- static UINT32 nCmdCursor = 0;
- static UINT32 nCmdInputCount = 0;
- static UINT32 nCmdInputCursor = 0;
-
- static void App_Console_ParseCmd(const char* pCmd);
-
- static UINT32 App_Console_ReadInput(char *input)
- {
- U32 nRead=0;
- struct pollfd p;
- struct termio term,term_old;
-
- /* Get control of the terminal */
- ioctl(STDIN_FILENO,TCGETA,(void *)&term);
- term_old = term;
- term.c_lflag &= ~ICANON;
- term.c_lflag &= ~ECHO;
- ioctl(STDIN_FILENO,TCSETAW,(void *)&term);
-
- /* Get event we want to know */
- p.fd = STDIN_FILENO;
- p.events = POLLIN;
-
- /* If we receive one thing, get the byte now */
- if (poll(&p,1,-1)>0)
- {
- if (p.revents==POLLIN)
- {
- nRead=read(STDIN_FILENO,input,1);
- }
- }
- /* Purge the byte */
- /* tcflush(0,TCIOFLUSH); */
- /* Leave control */
- ioctl(STDIN_FILENO,TCSETAW,(void *)&term_old);
- return(nRead);
- }
-
- static void App_Console_BSChar()
- {
- char szTemp[3];
- szTemp[0] = '/b';
- szTemp[1] = ' ';
- szTemp[2] = '/b';
- write(STDOUT_FILENO,szTemp,3);
- }
-
- static void App_Console_OnPrintChar(char input)
- {
- if(nCmdInputCount == MAX_CMD_LEN) return;
-
- if(nCmdInputCursor < nCmdInputCount) // 光標不在末尾
- {
- char szTemp[MAX_CMD_LEN] = {0};
- char* pCmd = szCmdNow;
- int nBackCount = nCmdInputCount-nCmdInputCursor;
- szTemp[0] = input;
- memcpy(&szTemp[1],&pCmd[nCmdInputCursor],nBackCount);
- write(STDOUT_FILENO,szTemp,nBackCount+1);
- memcpy(&pCmd[nCmdInputCursor],&szTemp,nBackCount+1);
-
- memset(szTemp,'/b',nBackCount);
- write(STDOUT_FILENO,szTemp,nBackCount);
- }
- else
- {
- write(STDOUT_FILENO,&input,1);
- szCmdNow[nCmdInputCount] = input;
- }
-
- nCmdInputCursor++;
- nCmdInputCount++;
- }
-
- static void App_Console_OnBackspace()
- {
- if(nCmdInputCursor > 0)
- {
- if(nCmdInputCursor == nCmdInputCount) // 光標在末尾
- App_Console_BSChar();
- else// 光標不在末尾
- {
- char szTemp[MAX_CMD_LEN] = {0};
- char* pCmd = szCmdNow;
- int nBackCount = nCmdInputCount-nCmdInputCursor;
- szTemp[0] = '/b';
- memcpy(&szTemp[1],&pCmd[nCmdInputCursor],nBackCount);
- szTemp[nBackCount+1] = ' ';
- write(STDOUT_FILENO,szTemp,nBackCount+2);
- memcpy(&pCmd[nCmdInputCursor-1],&szTemp[1],nBackCount);
-
- memset(szTemp,'/b',nBackCount+1);
- write(STDOUT_FILENO,szTemp,nBackCount+1);
- }
- nCmdInputCount --;
- nCmdInputCursor--;
- }
- }
-
- static void App_Console_OnDel()
- {
- if(nCmdInputCursor < nCmdInputCount) // 光標不在末尾
- {
- char szTemp[MAX_CMD_LEN] = {0};
- char* pCmd = szCmdNow;
-
- int nBackCount = nCmdInputCount-nCmdInputCursor-1;
- memcpy(szTemp,&pCmd[nCmdInputCursor+1],nBackCount);
- szTemp[nBackCount] = ' ';
- write(STDOUT_FILENO,szTemp,nBackCount+1);
- memcpy(&pCmd[nCmdInputCursor],szTemp,nBackCount);
-
- memset(szTemp,'/b',nBackCount+1);
- write(STDOUT_FILENO,szTemp,nBackCount+1);
- nCmdInputCount--;
- }
- }
-
- static void App_Console_OnDoubleEsc()
- {
- if(nCmdInputCount > 0)
- {
- char* pCmd = szCmdNow;
-
- // 將光標移動到最末尾
- while(nCmdInputCursor < nCmdInputCount)
- {
- write(STDOUT_FILENO,&pCmd[nCmdInputCursor],1);
- nCmdInputCursor++;
- }
-
- // 清除所有輸入的數據
- int i=0;
- for(i=0;i<nCmdInputCount;i++) App_Console_BSChar();
- nCmdInputCount = 0;
- nCmdInputCursor = 0;
- }
- }
-
- static void App_Console_OnUp()
- {
- if(nCmdCursor == 0) return;
- nCmdCursor --;
-
- // 清除掉現在所有的輸入
- App_Console_OnDoubleEsc();
-
- char* pCmdHistory = &szCmdHistory[nCmdCursor][0];
- memcpy(szCmdNow,pCmdHistory,MAX_CMD_LEN);
- nCmdInputCount = strlen(szCmdNow);
- nCmdInputCursor= nCmdInputCount;
- write(STDOUT_FILENO,szCmdNow,nCmdInputCount);
- }
-
- static void App_Console_OnDown()
- {
- if(nCmdCursor >= (nCmdIndex-1)) return;
- nCmdCursor ++;
-
- // 清除掉現在所有的輸入
- App_Console_OnDoubleEsc();
-
- char* pCmdHistory = &szCmdHistory[nCmdCursor][0];
- memcpy(szCmdNow,pCmdHistory,MAX_CMD_LEN);
- nCmdInputCount = strlen(szCmdNow);
- nCmdInputCursor= nCmdInputCount;
- write(STDOUT_FILENO,szCmdNow,nCmdInputCount);
-
- }
-
- static void App_Console_OnLeft()
- {
- if(nCmdInputCursor > 0)
- {
- char c = '/b';
- write(STDOUT_FILENO,&c,1);
- nCmdInputCursor--;
- }
- }
-
- static void App_Console_OnRight()
- {
- if(nCmdInputCursor < nCmdInputCount)
- {
- char* pCmd = szCmdNow;
- char c = pCmd[nCmdInputCursor];
- write(STDOUT_FILENO,&c,1);
- nCmdInputCursor++;
- }
- }
-
- static void App_Console_OnEnter()
- {
- szCmdNow[nCmdInputCount] = '/0';
- char szTemp[] = {"/r/n"};
- write(STDOUT_FILENO,szTemp,strlen(szTemp));
- nCmdInputCount = 0;
- nCmdInputCursor = 0;
-
- if(strlen(szCmdNow) == 0) return;
-
- if(nCmdIndex == MAX_CMD_HISTORY) // 命令隊列滿了,移動
- {
- char szTempCmd[MAX_CMD_HISTORY][MAX_CMD_LEN];
- memcpy(szTempCmd,&szCmdHistory[1][0],MAX_CMD_LEN*(MAX_CMD_HISTORY-1));
- memcpy(szCmdHistory,szTempCmd,MAX_CMD_LEN*(MAX_CMD_HISTORY-1));
- nCmdIndex = MAX_CMD_HISTORY-1;
- nCmdCursor = nCmdIndex;
- }
-
-
- memcpy(szCmdHistory[nCmdIndex],szCmdNow,MAX_CMD_LEN);
-
- nCmdIndex++;
- nCmdCursor = nCmdIndex;
-
- // 解析命令
- App_Console_ParseCmd(szCmdNow);
- }
-
- static void App_Console_CmdLoop()
- {
- BOOL bGetEnter = FALSE;
- while(TRUE)
- {
- // 讀取一個console輸入
- UINT32 nReturn = 0;
- char input;
- nReturn = App_Console_ReadInput (&input);
- if(nReturn > 0)
- {
- switch(waitKeyState)
- {
- case WKS_WAIT :
- if(isprint(input))// 可打印字符
- App_Console_OnPrintChar(input);
- else
- {
- if(input == KEY_BACKSPACE)
- App_Console_OnBackspace();
- else if(input == KEY_DEL)
- App_Console_OnDel();
- else if(input == KEY_ENTER)
- {
- App_Console_OnEnter();
- bGetEnter = TRUE;
- }
- else if(input == '/x1b')
- waitKeyState = WKS_RECV1B;
- else
- waitKeyState = WKS_WAIT;
- }
- break;
- case WKS_RECV1B:
- if(input == '/x1b') // 按了ESC 又按了方向鍵,或者是 ESC
- {
- //App_Console_OnDoubleEsc();
- waitKeyState = WKS_RECV1B;
- }
- else
-
- if(input == '[') //可能為 上下左右 4個鍵
- waitKeyState = WKS_UDLR;
- else//下面的情況為 按了 ESC 鍵之後,按了其他的鍵的處理
- {
- if(isprint(input)) App_Console_OnPrintChar(input);
- waitKeyState = WKS_WAIT;
- }
- break;
- case WKS_UDLR:
- if(input == 'A')// 上
- App_Console_OnUp();
- else if(input == 'B')// 下
- App_Console_OnDown();
- else if(input == 'D')// 左
- App_Console_OnLeft();
- else if(input == 'C')// 右
- App_Console_OnRight();
- else
- {
- if(isprint(input)) App_Console_OnPrintChar(input);
- }
- waitKeyState = WKS_WAIT;
- break;
- default:
- break;
- }
- }
-
- if(bGetEnter)
- {
- break;
- }
- }
- }
-
- void App_Console_Start()
- {
- // 清空 sdtout 緩沖
- fflush(stdout);
- fflush(stdin);
-
- char szTemp[] = {"/r/nStart TR Console.../r/n/r/n"};
- write(STDOUT_FILENO,szTemp,strlen(szTemp));
-
- while(TRUE)
- {
- write(STDOUT_FILENO,szPrompt,strlen(szPrompt));
- App_Console_CmdLoop();
- }
- }
-
- // 解析命令
- static void App_Console_ParseCmd(const char* pCmd)
- {
- int length = strlen(pCmd);
-
- // 全部轉小寫
- int i=0;
- char szTempCmd[MAX_CMD_LEN];
- for (i=0; i < length; i++) szTempCmd[i] = tolower(pCmd[i]);
-
-
- // 將輸入的命令各個 part 分開
- char szPart[MAX_PAR_COUNT][MAX_CMD_LEN];
- int nPartCount = 0;
- int nPartCursor = 0;
- int nCmdCursor = 0;
- memset(szPart,0,sizeof(szPart));
-
- while(TRUE)
- {
- if(nCmdCursor == length)
- {
- if(nPartCursor > 0)
- {
- nPartCount++;
- nPartCursor = 0;
- }
- break;
- }
-
- if( (szTempCmd[nCmdCursor] == ',') || (szTempCmd[nCmdCursor] == ' ') ) // part 分割符
- {
- szPart[nPartCount][nPartCursor] = '/0';
-
- nPartCount++;
- nPartCursor = 0;
- }
- else
- {
- szPart[nPartCount][nPartCursor] = szTempCmd[nCmdCursor];
- nPartCursor++;
- }
- nCmdCursor++;
- }
- App_Test_OnCmd(szPart,nPartCount);
- }
命令實現頭文件(app_test.h)
view plaincopy to clipboardprint?
- #ifndef __APP_TEST_H__
- #define __APP_TEST_H__
-
- #ifdef __cplusplus
- extern "C"
- {
- #endif
-
- #include "type_def.h"
-
- #define MAX_CMD_LEN 512
-
- void App_Test_OnCmd(char szPart[][MAX_CMD_LEN],int nPartCount);
-
-
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
命令實現c文件(app_test.c)
view plaincopy to clipboardprint?
- #include "app_test.h"
- #include "stapp_main.h"
- #include "app_qam.h"
- #include "api_av.h"
- #include "api_video.h"
- #include "api_audio.h"
- #include "api_pcr.h"
-
- static void App_Test_OnHelp();
- static void App_Test_OnWriteReg8(char szPart[][MAX_CMD_LEN],int nPartCount);
- static void App_Test_OnReadReg8(char szPart[][MAX_CMD_LEN],int nPartCount);
- static void App_Test_OnQamConnect(char szPart[][MAX_CMD_LEN],int nPartCount);
- static void App_Test_OnAVPlayMpeg(char szPart[][MAX_CMD_LEN],int nPartCount);
- static void App_Test_OnAVStop();
- static void App_Test_OnVolumeSet(char szPart[][MAX_CMD_LEN],int nPartCount);
- static void App_Test_OnMute();
- static void App_Test_OnUnmute();
- static void App_Test_OnDENCRegDum();
- static void App_Test_OnDENCRegSet(char szPart[][MAX_CMD_LEN],int nPartCount);
-
- void App_Test_OnCmd(char szPart[][MAX_CMD_LEN],int nPartCount)
- {
- // 這裡處理私有的命令
-
- if(nPartCount == 0) return;
-
- if( strcmp(szPart[0],"help") == 0)
- {
- App_Test_OnHelp();
- }
- else if( strcmp(szPart[0],"writereg8") == 0)
- {
- if(nPartCount > 2) App_Test_OnWriteReg8(szPart,nPartCount);
- }
- else if( strcmp(szPart[0],"readreg8") == 0)
- {
- if(nPartCount > 1) App_Test_OnReadReg8(szPart,nPartCount);
- }
- else if( strcmp(szPart[0],"qamconnect") == 0)
- {
- if(nPartCount > 1) App_Test_OnQamConnect(szPart,nPartCount);
- }
- else if( strcmp(szPart[0],"avplaympeg") == 0)
- {
- if(nPartCount > 1) App_Test_OnAVPlayMpeg(szPart,nPartCount);
- }
- else if( strcmp(szPart[0],"avstop") == 0)
- {
- App_Test_OnAVStop();
- }
- else if( strcmp(szPart[0],"volumeset") == 0)
- {
- if(nPartCount > 1) App_Test_OnVolumeSet(szPart,nPartCount);
- }
- else if( strcmp(szPart[0],"mute") == 0)
- {
- App_Test_OnMute();
- }
- else if( strcmp(szPart[0],"unmute") == 0)
- {
- App_Test_OnUnmute();
- }
- else if( strcmp(szPart[0],"dencregdump") == 0)
- {
- App_Test_OnDENCRegDum();
- }
- else if( strcmp(szPart[0],"dencregset") == 0)
- {
- if(nPartCount > 1) App_Test_OnDENCRegSet(szPart,nPartCount);
- }
-
- }
-
- static void App_Test_OnHelp()
- {
- printf("**************************************************************/n");
- printf("* Help PARAM MUST 0 MAX 0 Eg. help/n");
- printf("* WriteReg8 PARAM MUST 2 MAX 2 Eg. WriteReg8 0x1920C114 128/n");
- printf("* ReadReg8 PARAM MUST 1 MAX 1 Eg. ReadReg8 0x1920C114/n");
- printf("* QamConnect PARAM MUST 1 MAX 3 Eg. QamConnect 546000/n");
- printf("* AVPlayMpeg PARAM MUST 1 MAX 3 Eg. AVPlayMpeg 64 63 32/n");
- printf("* AVStop PARAM MUST 0 MAX 0 Eg. AVStop/n");
- printf("* VolumeSet PARAM MUST 1 MAX 1 Eg. VolumeSet 63/n");
- printf("* Mute PARAM MUST 0 MAX 0 Eg. Mute/n");
- printf("* Unmute PARAM MUST 0 MAX 0 Eg. Unmute/n");
- printf("* DENCRegDump PARAM MUST 0 MAX 0 Eg. DENCRegDump/n");
- printf("* DENCRegSet PARAM MUST 1 MAX 1 Eg. DENCRegSet 1/n");
- printf("*************************************************************/n");
-
- }
-
- static void App_Test_OnWriteReg8(char szPart[][MAX_CMD_LEN],int nPartCount)
- {
- char* pAddress = &szPart[1][0];
- char* pValue = &szPart[2][0];
-
- DWORD dwAddress = 0;
- UINT8 nValue = atoi(pValue);
-
- sscanf(pAddress,"0x%08x",&dwAddress);
-
- SYS_WriteRegDev8(dwAddress,nValue);
- }
-
- static void App_Test_OnQamConnect(char szPart[][MAX_CMD_LEN],int nPartCount)
- {
- char* pFreq = &szPart[1][0];
- UINT32 nFreq = atoi(pFreq);
- UINT32 nSymbolRate = 6875;
- T_DMD_Modulation nQAMMode = QAM_64;
- if(nPartCount > 2)
- {
- char* pSymbolRate = &szPart[2][0];
- nSymbolRate = atoi(pSymbolRate);
- }
-
- if(nPartCount > 3)
- {
- char* pQAMMode = &szPart[3][0];
- nQAMMode = atoi(pQAMMode);
- }
-
- App_Qam_Locking(TRUE,nFreq,nSymbolRate,nQAMMode);
- }
-
-
- static void App_Test_OnAVPlayMpeg(char szPart[][MAX_CMD_LEN],int nPartCount)
- {
- UINT16 nVideoPid = 0xFFFF;
- UINT16 nAudioPid = 0xFFFF;
- UINT16 nPcrPid = 0xFFFF;
-
-
- char* pAudioPid = &szPart[1][0];
- nAudioPid = atoi(pAudioPid);
-
-
- if(nPartCount > 2)
- {
- char* pVideoPid = &szPart[2][0];
- nVideoPid = atoi(pVideoPid);
- }
-
- if(nPartCount > 3)
- {
- char* pPcr = &szPart[3][0];
- nPcrPid = atoi(pPcr);
- }
-
- Api_Av_Stop();
- Api_Av_Start(nAudioPid,STREAMTYPE_MP2A,nVideoPid,STREAMTYPE_MP2V,nPcrPid);
- }
-
- static void App_Test_OnVolumeSet(char szPart[][MAX_CMD_LEN],int nPartCount)
- {
- UINT16 nVolume = 0;
- char* pVolume = &szPart[1][0];
- nVolume = atoi(pVolume);
-
- Api_Audio_Volume_Set(nVolume);
- }
-
- static void App_Test_OnMute()
- {
- Api_Audio_Mute();
- }
-
- static void App_Test_OnUnmute()
- {
- Api_Audio_Unmute();
- }
-
- static void App_Test_OnAVStop()
- {
- Api_Av_Stop();
- }
-
- static void App_Test_OnDENCRegDum()
- {
- printf("* Brightness 0x1920C114 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C114));
- printf("* Contrast 0x1920C118 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C118));
- printf("* Saturation 0x1920C11c value is 0x%02x/n",SYS_ReadRegDev8(0x1920C11c));
-
- printf("* CHROMA_COEF0 0x1920C120 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C120));
- printf("* CHROMA_COEF1 0x1920C124 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C124));
- printf("* CHROMA_COEF2 0x1920C128 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C128));
- printf("* CHROMA_COEF3 0x1920C12c value is 0x%02x/n",SYS_ReadRegDev8(0x1920C12c));
- printf("* CHROMA_COEF4 0x1920C130 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C130));
- printf("* CHROMA_COEF5 0x1920C134 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C134));
- printf("* CHROMA_COEF6 0x1920C138 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C138));
- printf("* CHROMA_COEF7 0x1920C13c value is 0x%02x/n",SYS_ReadRegDev8(0x1920C13c));
- printf("* CHROMA_COEF8 0x1920C140 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C140));
-
- printf("* LUM_COEF0 0x1920C148 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C148));
- printf("* LUM_COEF1 0x1920C14c value is 0x%02x/n",SYS_ReadRegDev8(0x1920C14c));
- printf("* LUM_COEF2 0x1920C150 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C150));
- printf("* LUM_COEF3 0x1920C154 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C154));
- printf("* LUM_COEF4 0x1920C158 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C158));
- printf("* LUM_COEF5 0x1920C15c value is 0x%02x/n",SYS_ReadRegDev8(0x1920C15c));
- printf("* LUM_COEF6 0x1920C160 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C160));
- printf("* LUM_COEF7 0x1920C164 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C164));
- printf("* LUM_COEF8 0x1920C168 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C168));
- printf("* LUM_COEF9 0x1920C16c value is 0x%02x/n",SYS_ReadRegDev8(0x1920C16c));
-
- printf("* CFG9 0x1920C144 value is 0x%02x/n",SYS_ReadRegDev8(0x1920C144));
-
- }
-
- static void App_Test_OnDENCRegSet(char szPart[][MAX_CMD_LEN],int nPartCount)
- {
- UINT16 nScheme = 1;
- char* pScheme = &szPart[1][0];
- nScheme = atoi(pScheme);
-
- switch(nScheme)
- {
- case 1:
-
- break;
- case 2:
-
- break;
- case 3:
-
- break;
- case 4:
-
- break;
- default:
- break;
- }
-
- }
-
- static void App_Test_OnReadReg8(char szPart[][MAX_CMD_LEN],int nPartCount)
- {
- char* pAddress = &szPart[1][0];
- DWORD dwAddress = 0;
-
- sscanf(pAddress,"0x%08x",&dwAddress);
- printf("* 0x%08x value is 0x%02x/n",dwAddress,SYS_ReadRegDev8(dwAddress));
- }