优化shell代码,节省1.9kIM空间
This commit is contained in:
parent
9db24f9df1
commit
28a226e4a4
@ -21,21 +21,9 @@
|
||||
typedef int (*shell_cmd_routine)(int argc ,char **argv);
|
||||
typedef unsigned long (*OSP_FUNCPTR)();
|
||||
|
||||
typedef struct keyword{
|
||||
char key_name[NAME_LEN];
|
||||
shell_cmd_routine command;
|
||||
}key_word_t;
|
||||
|
||||
|
||||
typedef struct shell_word
|
||||
{
|
||||
int key_index;
|
||||
key_word_t keyword_unit[60];
|
||||
}osp_shell_t;
|
||||
|
||||
typedef struct tagOspCmdRtn
|
||||
{
|
||||
char cmd[64];
|
||||
char cmd[32];
|
||||
OSP_FUNCPTR wrapper;
|
||||
OSP_FUNCPTR routine;
|
||||
/*char descption[128];*/
|
||||
@ -74,8 +62,6 @@ void spu_reget_cmd();
|
||||
|
||||
extern int32_t get_core_id();
|
||||
extern void osp_show_task_info(void);
|
||||
extern void osp_putc(char ch);
|
||||
extern int osp_getcnew(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -14,21 +14,9 @@ OSP_CMD_EXT gastCmdExt[MAX_EXT_CMD_NUM];
|
||||
int ospCmdRtnExtNum =0;
|
||||
uint32_t gu32_osp_shell_task_cnt = 0;
|
||||
uint32_t gu32_osp_shell_task_rev = 0;
|
||||
uint32_t g_ulsendcount = 0;
|
||||
char seps[]=" ,\t\n\"";
|
||||
uint32_t g_core_id = 0;
|
||||
|
||||
uint32_t SHELL_CMD_NUM_EXT = 0;
|
||||
static char szPrompt[] = {"-> "};
|
||||
|
||||
static T_WaitKeyState waitKeyState = WKS_WAIT;
|
||||
static char szCmdHistory[MAX_CMD_HISTORY][MAX_CMD_LEN];
|
||||
static char szCmdNow[MAX_CMD_LEN] = {0};
|
||||
|
||||
static unsigned long nCmdIndex = 0;
|
||||
static unsigned long nCmdCursor = 0;
|
||||
static unsigned long nCmdInputCount = 0;
|
||||
static unsigned long nCmdInputCursor = 0;
|
||||
|
||||
static uint32_t argval[10] = {0};
|
||||
static char argchar[10][32] = {0};
|
||||
@ -37,18 +25,11 @@ static char shellOut[64] ={0};
|
||||
|
||||
OSP_CMD_RTN ospCmdRtnTbl[] =
|
||||
{
|
||||
//{"level_ape", (OSP_FUNCPTR)spu_shell_wrapper, (OSP_FUNCPTR)spu_set_log_level},
|
||||
{"recmd_ape", (OSP_FUNCPTR)spu_shell_wrapper, (OSP_FUNCPTR)spu_reget_cmd},
|
||||
{"intr_ape", (OSP_FUNCPTR)spu_shell_wrapper, (OSP_FUNCPTR)spu_csu_int_cnt},
|
||||
//{"csu_stop_ape", (OSP_FUNCPTR)spu_shell_wrapper,(OSP_FUNCPTR)spu_csu_stop_cfg},
|
||||
//{"i_ape", (OSP_FUNCPTR)osp_show_task_info, NULL},
|
||||
//{"re_ape", (OSP_FUNCPTR)spu_insert_cmd_ext_test, NULL},
|
||||
};
|
||||
|
||||
int SHELL_CMD_NUM = SHELL_NELEMENTS(ospCmdRtnTbl);
|
||||
int cmdMatched = 0;
|
||||
char cmdMatchBuf[SHELL_NELEMENTS(ospCmdRtnTbl)][MAX_CMD_LEN + 10] = {0};
|
||||
char cmdShowBuf[MAX_CMD_LEN*SHELL_NELEMENTS(ospCmdRtnTbl)] = {0};
|
||||
static int nCmdField;
|
||||
static int maxCmdField=10;
|
||||
static char *g_parg[32]={0};
|
||||
@ -59,32 +40,14 @@ void *spu_find_sym(char * addr)
|
||||
return addr;
|
||||
}
|
||||
|
||||
int spu_isprint( int ch )
|
||||
{
|
||||
|
||||
return (unsigned int)(ch - ' ') < 127u - ' ';
|
||||
|
||||
}
|
||||
|
||||
int spu_isdigit( int ch )
|
||||
{
|
||||
|
||||
return (unsigned int)(ch - '0') < 10u;
|
||||
|
||||
}
|
||||
static void write(int fd, char *buf, int len)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<len; i++)
|
||||
osp_putc(buf[i]);
|
||||
}
|
||||
|
||||
|
||||
int spu_insert_cmd(char *name, OSP_FUNCPTR pfunc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void spu_insert_cmd_ext(char *name, OSP_FUNCPTR pfunc, char *desc, uint32_t argnum)
|
||||
{
|
||||
uint32_t num = 0;
|
||||
@ -197,20 +160,6 @@ void set_out_str(char *out)
|
||||
//UCP_PRINT_LOG("%s", out);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* set_prompt - set prompt string to console
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
void set_prompt()
|
||||
{
|
||||
UCP_PRINT_LOG("%s", szPrompt);
|
||||
}
|
||||
|
||||
int spu_shell_symo(char **arg, int len)
|
||||
{
|
||||
int i;
|
||||
@ -240,9 +189,6 @@ int spu_shell_symo(char **arg, int len)
|
||||
{
|
||||
func_ret = func(argval[1], argval[2], argval[3], argval[4],
|
||||
argval[5], argval[6], argval[7], argval[8], argval[9]);
|
||||
//set_out_str(shellOut);
|
||||
/*结果发送到arm*/
|
||||
// osp_msg_transfer_send(UCP4008_OSP_SHELL, shellOut, sizeof(shellOut));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -281,33 +227,6 @@ int spu_shell_wrapper(char **arg, int len, OSP_FUNCPTR func)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* get_full_cmd_match - get matched command name list
|
||||
* input:
|
||||
* pCmd : the prefix of a command
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
int get_full_cmd_match( char* pCmd )
|
||||
{
|
||||
int index;
|
||||
char* pMatch;
|
||||
|
||||
for ( index = 0; index < SHELL_NELEMENTS( ospCmdRtnTbl ); index++ )
|
||||
{
|
||||
pMatch = strstr( ospCmdRtnTbl[index].cmd, pCmd );
|
||||
if ( ( pMatch != NULL ) && ( pMatch == ospCmdRtnTbl[index].cmd ) )
|
||||
{
|
||||
strcpy( cmdMatchBuf[cmdMatched], ospCmdRtnTbl[index].cmd );
|
||||
cmdMatched++;
|
||||
}
|
||||
}
|
||||
return cmdMatched;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* get_cmd_arg - split command to params,then save to array arg
|
||||
* input:
|
||||
@ -398,441 +317,6 @@ int exec_cmd(void)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_write_bs - delete a character of command line
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
void shell_write_bs()
|
||||
{
|
||||
char szTemp[3];
|
||||
szTemp[0] = '\b';
|
||||
szTemp[1] = ' ';
|
||||
szTemp[2] = '\b';
|
||||
write(STDOUT_FILENO,szTemp,3);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_deal_input - handle keypress
|
||||
* input:
|
||||
* input: input key code
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
void shell_deal_input(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++;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_deal_backspace - handle key 'Backspace'
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
void shell_deal_backspace()
|
||||
{
|
||||
if(nCmdInputCursor > 0)
|
||||
{
|
||||
if(nCmdInputCursor == nCmdInputCount) //cursor at the end
|
||||
shell_write_bs();
|
||||
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--;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_deal_delete - handle key 'Delete'
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
void shell_deal_delete()
|
||||
{
|
||||
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--;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_deal_double_esc - clear command line
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
void shell_deal_double_esc()
|
||||
{
|
||||
if(nCmdInputCount > 0)
|
||||
{
|
||||
char* pCmd = szCmdNow;
|
||||
|
||||
//move to end
|
||||
while(nCmdInputCursor < nCmdInputCount)
|
||||
{
|
||||
write(STDOUT_FILENO,&pCmd[nCmdInputCursor],1);
|
||||
nCmdInputCursor++;
|
||||
}
|
||||
|
||||
//clear all inputs
|
||||
int i=0;
|
||||
for(i=0;i<nCmdInputCount;i++)
|
||||
shell_write_bs();
|
||||
nCmdInputCount = 0;
|
||||
nCmdInputCursor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_deal_up_key - handle key 'up'
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
void shell_deal_up_key()
|
||||
{
|
||||
if(nCmdCursor == 0)
|
||||
return;
|
||||
|
||||
nCmdCursor --;
|
||||
|
||||
//clear all inputs
|
||||
shell_deal_double_esc();
|
||||
|
||||
char* pCmdHistory = &szCmdHistory[nCmdCursor][0];
|
||||
memcpy(szCmdNow,pCmdHistory,MAX_CMD_LEN);
|
||||
nCmdInputCount = strlen(szCmdNow);
|
||||
nCmdInputCursor= nCmdInputCount;
|
||||
write(STDOUT_FILENO,szCmdNow,nCmdInputCount);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_deal_down_key - handle key 'down'
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
void shell_deal_down_key()
|
||||
{
|
||||
if(nCmdCursor >= (nCmdIndex-1)) return;
|
||||
nCmdCursor ++;
|
||||
|
||||
//clear all inputs
|
||||
shell_deal_double_esc();
|
||||
|
||||
char* pCmdHistory = &szCmdHistory[nCmdCursor][0];
|
||||
memcpy(szCmdNow,pCmdHistory,MAX_CMD_LEN);
|
||||
nCmdInputCount = strlen(szCmdNow);
|
||||
nCmdInputCursor= nCmdInputCount;
|
||||
write(STDOUT_FILENO,szCmdNow,nCmdInputCount);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_deal_left_key - handle key 'left'
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
void shell_deal_left_key()
|
||||
{
|
||||
if(nCmdInputCursor > 0)
|
||||
{
|
||||
char c = '\b';
|
||||
write(STDOUT_FILENO,&c,1);
|
||||
nCmdInputCursor--;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_deal_right_key - handle key 'right'
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
void shell_deal_right_key()
|
||||
{
|
||||
if(nCmdInputCursor < nCmdInputCount)
|
||||
{
|
||||
char* pCmd = szCmdNow;
|
||||
char c = pCmd[nCmdInputCursor];
|
||||
write(STDOUT_FILENO,&c,1);
|
||||
nCmdInputCursor++;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_deal_enter_key - handle key 'Enter'
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
void shell_deal_enter_key()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* shell_deal_tab - handle key 'tab'
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
void shell_deal_tab()
|
||||
{
|
||||
int matchNum;
|
||||
int matchIndex;
|
||||
int lenDiff;
|
||||
int cmdBufLen = 0;
|
||||
char cmdPre[MAX_CMD_LEN] = {0};
|
||||
|
||||
cmdBufLen = nCmdInputCursor;
|
||||
szCmdNow[cmdBufLen] = '\0';
|
||||
|
||||
strcpy(cmdPre, szCmdNow);
|
||||
matchNum = get_full_cmd_match(cmdPre);
|
||||
|
||||
memset(cmdShowBuf, 0, sizeof(cmdShowBuf));
|
||||
if (matchNum == 1)
|
||||
{
|
||||
strcpy(cmdShowBuf, cmdMatchBuf[0]);
|
||||
|
||||
lenDiff = strlen(cmdShowBuf)-strlen(cmdPre);
|
||||
write(STDOUT_FILENO, &cmdShowBuf[cmdBufLen], lenDiff);
|
||||
|
||||
strcpy(szCmdNow, cmdShowBuf);
|
||||
nCmdInputCursor += lenDiff;
|
||||
nCmdInputCount += lenDiff;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(cmdShowBuf, "\r\n");
|
||||
|
||||
for (matchIndex = 0; matchIndex < matchNum; matchIndex++)
|
||||
{
|
||||
strcat(cmdShowBuf, cmdMatchBuf[matchIndex]);
|
||||
strcat(cmdShowBuf, " ");
|
||||
if ((matchIndex+1)%4 == 0)
|
||||
{
|
||||
strcat(cmdShowBuf, "\r\n");
|
||||
}
|
||||
}
|
||||
strcat(cmdShowBuf, "\r\n");
|
||||
strcat(cmdShowBuf, szPrompt);
|
||||
strcat(cmdShowBuf, szCmdNow);
|
||||
set_out_str(cmdShowBuf);
|
||||
}
|
||||
memset(cmdMatchBuf, 0, sizeof(cmdMatchBuf) );
|
||||
cmdMatched = 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* shell_get_line - read whole command line string
|
||||
* input:
|
||||
* none
|
||||
* return
|
||||
* none
|
||||
*/
|
||||
|
||||
int shell_get_line()
|
||||
{
|
||||
int bGetEnter = 0;
|
||||
while(1)
|
||||
{
|
||||
char input;
|
||||
int ret;
|
||||
|
||||
// input = osp_getc();
|
||||
#if 1
|
||||
ret = osp_getcnew();
|
||||
if(-1 == ret)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
input = ret;
|
||||
}
|
||||
#endif
|
||||
switch(waitKeyState)
|
||||
{
|
||||
case WKS_WAIT :
|
||||
if(spu_isprint(input))
|
||||
shell_deal_input(input);
|
||||
else
|
||||
{
|
||||
if(input == '\t')
|
||||
{
|
||||
shell_deal_tab();
|
||||
}
|
||||
else if(input == KEY_BACKSPACE)
|
||||
{
|
||||
shell_deal_backspace();
|
||||
}
|
||||
else if(input == KEY_ENTER)
|
||||
{
|
||||
shell_deal_enter_key();
|
||||
bGetEnter = 1;
|
||||
}
|
||||
else if(input == '\x1b')
|
||||
waitKeyState = WKS_RECV1B;
|
||||
else
|
||||
waitKeyState = WKS_WAIT;
|
||||
}
|
||||
break;
|
||||
|
||||
case WKS_RECV1B:
|
||||
if(input == '\x1b')
|
||||
{
|
||||
shell_deal_double_esc();
|
||||
waitKeyState = WKS_RECV1B;
|
||||
}
|
||||
else if(input == '[') //maybe "up/down/left/right"
|
||||
{
|
||||
waitKeyState = WKS_UDLR;
|
||||
}
|
||||
else //after pressing 'ESC'
|
||||
{
|
||||
if(spu_isprint(input))
|
||||
shell_deal_input(input);
|
||||
waitKeyState = WKS_WAIT;
|
||||
}
|
||||
break;
|
||||
|
||||
case WKS_UDLR:
|
||||
if(input == 'A') //up
|
||||
shell_deal_up_key();
|
||||
else if(input == 'B') //down
|
||||
shell_deal_down_key();
|
||||
else if(input == 'D') //left
|
||||
shell_deal_left_key();
|
||||
else if(input == 'C') //right
|
||||
shell_deal_right_key();
|
||||
else if(input == 51) //maybe key 'delete'
|
||||
{
|
||||
waitKeyState = WKS_DEL;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(spu_isprint(input))
|
||||
shell_deal_input(input);
|
||||
}
|
||||
waitKeyState = WKS_WAIT;
|
||||
break;
|
||||
|
||||
case WKS_DEL:
|
||||
if(input == 126)
|
||||
shell_deal_delete();
|
||||
else
|
||||
{
|
||||
if(spu_isprint(input))
|
||||
shell_deal_input(input);
|
||||
}
|
||||
waitKeyState = WKS_WAIT;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(bGetEnter)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void spu_csu_int_cnt(void)
|
||||
{
|
||||
char pbuf[2048];
|
||||
@ -881,71 +365,6 @@ void spu_csu_stop_cfg(uint8_t ucstop, uint8_t ucadvance)
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void spu_shellinfo_to_arm(char* pbuf, int ulLen, uint8_t u8PktType)
|
||||
{
|
||||
uint16_t u16offset = SPU_SW_MSG_INFO_SIZE;
|
||||
int32_t i32core_id = get_core_id();
|
||||
uint8_t ret = 0;
|
||||
uint8_t u8flag = 0;
|
||||
int8_t *pi8buf = NULL;
|
||||
uint8_t u8shell_index = i32core_id + 24;
|
||||
spu_sw_msg_info_t stMsgHead;
|
||||
spu_sw_msg_info_t * pstsw_msg_info = NULL;
|
||||
|
||||
if (NULL == pbuf)
|
||||
{
|
||||
UCP_PRINT_ERROR("spu_shellinfo_to_arm pbuf is null\n");
|
||||
return;
|
||||
}
|
||||
|
||||
do{
|
||||
|
||||
pi8buf = spu_sw_mem_malloc(u8shell_index);
|
||||
if (NULL == pi8buf)
|
||||
{
|
||||
UCP_PRINT_ERROR("spu_shellinfo_to_arm call spu_sw_mem_malloc return null\n");
|
||||
return ;
|
||||
}
|
||||
|
||||
memcpy_ucp(pi8buf, pbuf, ulLen);
|
||||
|
||||
stMsgHead.u8PktType = u8PktType;
|
||||
stMsgHead.u16DataLen = ulLen+SPU_SW_MSG_INFO_SIZE;
|
||||
stMsgHead.u8CoreId = (uint8_t)i32core_id;
|
||||
|
||||
if(stMsgHead.u16DataLen > SHELL_MAX_LEN_OF_PKG)
|
||||
{
|
||||
pi8buf = pi8buf + u8flag*SHELL_MAX_LEN_OF_PKG;
|
||||
stMsgHead.u16DataLen -= SHELL_MAX_LEN_OF_PKG;
|
||||
u8flag++;
|
||||
}
|
||||
else
|
||||
{
|
||||
pi8buf = pi8buf + u8flag*SHELL_MAX_LEN_OF_PKG;
|
||||
u8flag = 0;
|
||||
}
|
||||
|
||||
UCP_PRINT_ERROR("spu_shellinfo_to_arm u8flag:%u\n", u8flag);
|
||||
UCP_PRINT_ERROR("spu_shellinfo_to_arm u8PktType:%u u16DataLen:%u\n", stMsgHead.u8PktType, stMsgHead.u16DataLen);
|
||||
|
||||
pstsw_msg_info = (spu_sw_msg_info_t *)(pi8buf - u16offset);
|
||||
memcpy_ucp((void *)pstsw_msg_info, (void *)&stMsgHead, u16offset);
|
||||
|
||||
ret = spu_sw_enque(u8shell_index++, pi8buf);
|
||||
if (0 != ret)
|
||||
{
|
||||
UCP_PRINT_ERROR("spu_shellinfo_to_arm ret:%u\n", ret);
|
||||
return ;
|
||||
}
|
||||
|
||||
}while(0 < u8flag);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void spu_shellinfo_to_arm(char* pbuf, int ulLen, uint8_t u8PktType)
|
||||
{
|
||||
spu_sw_msg_info_t stMsgHead;
|
||||
|
Loading…
x
Reference in New Issue
Block a user