Merge branch 'dev_ck_v2.1_feature_enhancement1052' into 'dev_ck_v2.1'
ushell first commit-feature_enhancement#1025 See merge request ucp/driver/ucp4008_platform_arm!20
This commit is contained in:
commit
a20ae806a1
@ -66,7 +66,7 @@
|
|||||||
#define UCP_PRINT_TICK(fmt, args...)
|
#define UCP_PRINT_TICK(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define UCP_PRINT_SHELL(fmt, args...) printf("[SHELL:]" fmt, ##args)
|
#define UCP_PRINT_SHELL(fmt, args...)
|
||||||
|
|
||||||
extern void osp_log_output(unsigned char level, const char *fmt, ...);
|
extern void osp_log_output(unsigned char level, const char *fmt, ...);
|
||||||
|
|
||||||
|
@ -14,9 +14,11 @@ int32_t serve_main(void);
|
|||||||
|
|
||||||
int32_t osp_net_shell_init(void);
|
int32_t osp_net_shell_init(void);
|
||||||
int32_t osp_net_shell_main(Osp_Msg_Head *pMsg);
|
int32_t osp_net_shell_main(Osp_Msg_Head *pMsg);
|
||||||
int32_t osp_net_shell_out(Osp_Msg_Head *pMsg);
|
int32_t osp_net_shell_out(char *pMsg, uint32_t len);
|
||||||
int32_t osp_del_udp(int32_t udpid);
|
int32_t osp_del_udp(int32_t udpid);
|
||||||
int32_t osp_net_msg_main(Osp_Msg_Head *pMsg);
|
int32_t osp_net_msg_main(Osp_Msg_Head *pMsg);
|
||||||
|
void osp_net_shell_proc();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,7 +145,7 @@ void osp_local_shell_out_main(Osp_Msg_Head *pMsg)
|
|||||||
osp_print(MSG_HEAD_TO_COMM(pMsg), MSG_DADA_LEN(pMsg));
|
osp_print(MSG_HEAD_TO_COMM(pMsg), MSG_DADA_LEN(pMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
osp_net_shell_out(pMsg);
|
//osp_net_shell_out(pMsg);
|
||||||
|
|
||||||
osp_free_msg(pMsg);
|
osp_free_msg(pMsg);
|
||||||
}
|
}
|
||||||
|
@ -534,7 +534,9 @@ int32_t osp_dump_phy_mem(uint64_t phy_addr, uint32_t len, uint64_t tmp_addr)
|
|||||||
uint32_t *mem_vir_addr,*temp_vir_addr;
|
uint32_t *mem_vir_addr,*temp_vir_addr;
|
||||||
uint32_t i,j;
|
uint32_t i,j;
|
||||||
int32_t display_fd = 1;
|
int32_t display_fd = 1;
|
||||||
|
uint32_t u32_len = 0;
|
||||||
|
char pbuf[4096];
|
||||||
|
|
||||||
if(OSP_DISPLAY_MAX_LEN < len)
|
if(OSP_DISPLAY_MAX_LEN < len)
|
||||||
{
|
{
|
||||||
return OSP_ERROR;
|
return OSP_ERROR;
|
||||||
@ -560,19 +562,26 @@ int32_t osp_dump_phy_mem(uint64_t phy_addr, uint32_t len, uint64_t tmp_addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
temp_vir_addr = mem_vir_addr + (addr_offset >> 2);
|
temp_vir_addr = mem_vir_addr + (addr_offset >> 2);
|
||||||
|
u32_len += sprintf(pbuf +u32_len,"\n");
|
||||||
|
|
||||||
for(i = 0; i < len; i += 16)
|
for(i = 0; i < len; i += 16)
|
||||||
{//不足16字节也显示4个字
|
{
|
||||||
printf("0x%016lx: ",tmp_addr + i);
|
//不足16字节也显示4个字
|
||||||
|
//printf("0x%016lx: ",tmp_addr + i);
|
||||||
|
u32_len += sprintf(pbuf +u32_len,"0x%016lx: ",tmp_addr + i);
|
||||||
|
|
||||||
for(j = 0; j < 4; j++)
|
for(j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
printf("0x%08x ",*temp_vir_addr++);
|
//printf("0x%08x ",*temp_vir_addr++);
|
||||||
|
u32_len += sprintf(pbuf +u32_len,"0x%08x ",*temp_vir_addr++);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
u32_len += sprintf(pbuf +u32_len,"\n");
|
||||||
|
//printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
osp_net_shell_out(pbuf, u32_len);
|
||||||
|
|
||||||
munmap((void*)mem_vir_addr,(OSP_DISPLAY_PAGE_LEN << 1));
|
munmap((void*)mem_vir_addr,(OSP_DISPLAY_PAGE_LEN << 1));
|
||||||
close(display_fd);
|
close(display_fd);
|
||||||
|
|
||||||
|
@ -336,7 +336,8 @@ OSP_STATUS osp_update_log(uint32_t len, uint32_t logid, uint32_t msg_type)
|
|||||||
|
|
||||||
void osp_log_output(unsigned char level, const char *fmt, ...)
|
void osp_log_output(unsigned char level, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char acstr[256] = {0};
|
uint32_t u32str_len = 0;
|
||||||
|
char acstr[256] = {0};
|
||||||
va_list st_va_list;
|
va_list st_va_list;
|
||||||
|
|
||||||
if (level > guc_print_level)
|
if (level > guc_print_level)
|
||||||
@ -345,10 +346,11 @@ void osp_log_output(unsigned char level, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
va_start(st_va_list, fmt);
|
va_start(st_va_list, fmt);
|
||||||
vsprintf((char *)acstr, fmt, st_va_list);
|
u32str_len = vsprintf((char *)acstr, fmt, st_va_list);
|
||||||
va_end(st_va_list);
|
va_end(st_va_list);
|
||||||
|
|
||||||
printf("%s", acstr);
|
printf("%s", acstr);
|
||||||
|
osp_net_shell_out(acstr, u32str_len);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define MAX_CMD_LEN (150) /*the max length of a shell command */
|
#define MAX_CMD_LEN (150) /*the max length of a shell command */
|
||||||
|
#define NET_SHELL_RX_PORT 33091
|
||||||
|
|
||||||
typedef struct tag_Osp_Net_Shell_Head
|
typedef struct tag_Osp_Net_Shell_Head
|
||||||
{
|
{
|
||||||
@ -42,7 +43,10 @@ uint32_t net_shell_res = 0;
|
|||||||
|
|
||||||
OSP_UDP_TASK_DATA udp_shell_rx_task = {OSP_NETSHELL_RX_PORT, 1, };
|
OSP_UDP_TASK_DATA udp_shell_rx_task = {OSP_NETSHELL_RX_PORT, 1, };
|
||||||
|
|
||||||
|
int32_t g32_sock_serverfd = 0;
|
||||||
|
char g_abuf[4096];
|
||||||
|
socklen_t addrlen = sizeof(struct sockaddr);
|
||||||
|
struct sockaddr_in SrcAddr;
|
||||||
|
|
||||||
|
|
||||||
int32_t osp_local_shell_main(char *szCmdNow)
|
int32_t osp_local_shell_main(char *szCmdNow)
|
||||||
@ -50,7 +54,7 @@ int32_t osp_local_shell_main(char *szCmdNow)
|
|||||||
struct termios nt;
|
struct termios nt;
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
char shellbuf[MAX_CMD_LEN] = {0};
|
char shellbuf[MAX_CMD_LEN] = {0};
|
||||||
char buf[4096] = {0};
|
//char buf[4096] = {0};
|
||||||
|
|
||||||
tcgetattr(STDIN_FILENO, &saveterm);
|
tcgetattr(STDIN_FILENO, &saveterm);
|
||||||
nt = saveterm;
|
nt = saveterm;
|
||||||
@ -73,6 +77,7 @@ int32_t osp_local_shell_main(char *szCmdNow)
|
|||||||
|
|
||||||
if (OSP_ERROR == ret)
|
if (OSP_ERROR == ret)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
sprintf(shellbuf + strlen(shellbuf), "%s", " > remeotelocalfile");
|
sprintf(shellbuf + strlen(shellbuf), "%s", " > remeotelocalfile");
|
||||||
system(shellbuf);
|
system(shellbuf);
|
||||||
{
|
{
|
||||||
@ -84,7 +89,7 @@ int32_t osp_local_shell_main(char *szCmdNow)
|
|||||||
osp_debug_out(CMD_DEBUG_LEVEL, "%s", buf);
|
osp_debug_out(CMD_DEBUG_LEVEL, "%s", buf);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(arg);
|
free(arg);
|
||||||
@ -137,11 +142,34 @@ int32_t osp_enable_net_shell_with_port(int32_t port)
|
|||||||
|
|
||||||
|
|
||||||
int32_t osp_net_shell_init(void)
|
int32_t osp_net_shell_init(void)
|
||||||
{
|
{
|
||||||
osp_suspend_task(CURRENT_TASKID);
|
int32_t ret = 0;
|
||||||
return 0;
|
int32_t opt = 1;
|
||||||
|
|
||||||
|
g32_sock_serverfd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
if (g32_sock_serverfd == OSP_ERROR) {
|
||||||
|
perror("socket");
|
||||||
|
return OSP_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&SrcAddr, 0, sizeof(SrcAddr));
|
||||||
|
SrcAddr.sin_family = AF_INET;
|
||||||
|
SrcAddr.sin_port = htons(NET_SHELL_RX_PORT);
|
||||||
|
SrcAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||||
|
|
||||||
|
setsockopt(g32_sock_serverfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
|
||||||
|
|
||||||
|
ret = bind(g32_sock_serverfd, (struct sockaddr *)&SrcAddr, addrlen);
|
||||||
|
if (ret == OSP_ERROR) {
|
||||||
|
perror("bind");
|
||||||
|
//close(g32_sock_serverfd);
|
||||||
|
return OSP_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OSP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t osp_net_msg_main(Osp_Msg_Head *pMsg)
|
int32_t osp_net_msg_main(Osp_Msg_Head *pMsg)
|
||||||
{
|
{
|
||||||
struct in_addr addr1;
|
struct in_addr addr1;
|
||||||
@ -237,41 +265,37 @@ uint32_t osp_get_net_shell_rev(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t osp_net_shell_out(Osp_Msg_Head *pMsg)
|
int32_t osp_net_shell_out(char *pMsg, uint32_t len)
|
||||||
{
|
{
|
||||||
Osp_Msg_Head *pMsgN;
|
int32_t i32Len;
|
||||||
int32_t len;
|
|
||||||
Osp_Net_Shell_Head *pShell;
|
i32Len = sendto(g32_sock_serverfd, pMsg, len, 0, (struct sockaddr *)&SrcAddr, sizeof(struct sockaddr_in));
|
||||||
|
if (i32Len != len)
|
||||||
if ((NULL == pMsg) || (-1 == net_shell_txudp_id))
|
|
||||||
{
|
{
|
||||||
return -1;
|
return OSP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = pMsg->MsgSize + MSG_HEAD_SIZE + NET_SHELL_HEAD_SIZE;
|
return OSP_OK;
|
||||||
|
}
|
||||||
pMsgN = osp_alloc_msg(len);
|
|
||||||
if (NULL != pMsgN)
|
void osp_net_shell_proc()
|
||||||
|
{
|
||||||
|
int32_t len = 0;
|
||||||
|
|
||||||
|
len = recvfrom(g32_sock_serverfd, &g_abuf, 4096, 0, (struct sockaddr *)&SrcAddr, &addrlen);
|
||||||
|
if (len <= 0)
|
||||||
{
|
{
|
||||||
memcpy((char *)pMsgN, (char *)pMsg, MSG_HEAD_SIZE);
|
//perror("recvfrom");
|
||||||
pMsgN->MsgType = OSP_SHELL_TYPE;
|
return;;
|
||||||
|
|
||||||
pShell = (Osp_Net_Shell_Head *)(pMsgN+1);
|
|
||||||
pShell->ip = 0;
|
|
||||||
pShell->port =0;
|
|
||||||
pShell->res = osp_get_net_shell_rev();
|
|
||||||
|
|
||||||
memcpy((char *)pMsgN + MSG_HEAD_SIZE + NET_SHELL_HEAD_SIZE, (char *)pMsg + MSG_HEAD_SIZE, len);
|
|
||||||
|
|
||||||
osp_udp_send((char *)(pMsgN), len, net_shell_txudp_id);
|
|
||||||
osp_free_msg(pMsgN);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
|
osp_local_shell_main((char *)&g_abuf);
|
||||||
|
|
||||||
|
memset((void *)g_abuf, 0, 4096);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,10 +67,10 @@ OSP_CMD_RTN ospCmdRtnTbl[MAX_CMD_NUM] =
|
|||||||
{"oam", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_set_oam, "set arm oam level", 1},
|
{"oam", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_set_oam, "set arm oam level", 1},
|
||||||
//{"x", (OSP_FUNCPTR)osp_shell_mem_wrapper, (OSP_FUNCPTR)osp_shell_dis_mem, "x num addr: show addr memory(length is num)", 2},
|
//{"x", (OSP_FUNCPTR)osp_shell_mem_wrapper, (OSP_FUNCPTR)osp_shell_dis_mem, "x num addr: show addr memory(length is num)", 2},
|
||||||
//{"s", (OSP_FUNCPTR)osp_shell_mem_wrapper, (OSP_FUNCPTR)osp_shell_set_mem, "s addr val: set addr memory(length is 4)", 2},
|
//{"s", (OSP_FUNCPTR)osp_shell_mem_wrapper, (OSP_FUNCPTR)osp_shell_set_mem, "s addr val: set addr memory(length is 4)", 2},
|
||||||
{"phym", (OSP_FUNCPTR)osp_shell_mem_wrapper, (OSP_FUNCPTR)osp_display_phy_mem, "show phy mempry info", 2},
|
//{"phym", (OSP_FUNCPTR)osp_shell_mem_wrapper, (OSP_FUNCPTR)osp_display_phy_mem, "show phy mempry info", 2},
|
||||||
//{"c", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_tsk_diag_cnt, "show Task Diag Cnt", 1},
|
//{"c", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_tsk_diag_cnt, "show Task Diag Cnt", 1},
|
||||||
{"net", (OSP_FUNCPTR)osp_show_udp, NULL, "show net info", 0},
|
{"net", (OSP_FUNCPTR)osp_show_udp, NULL, "show net info", 0},
|
||||||
{"sw", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_swqueue_info, "show arm print level", 0},
|
//{"sw", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_swqueue_info, "show arm print level", 0},
|
||||||
{"level", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_set_print_level, "set arm print level", 1},
|
{"level", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_set_print_level, "set arm print level", 1},
|
||||||
{"slevel", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_print_level, "show arm print level", 0},
|
{"slevel", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_print_level, "show arm print level", 0},
|
||||||
{"dump", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_dump_proc, "dump ddr mem", 4},
|
{"dump", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_dump_proc, "dump ddr mem", 4},
|
||||||
@ -196,7 +196,12 @@ void help(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UCP_PRINT_SHELL("%s\n", buf);
|
|
||||||
|
UCP_PRINT_SHELL("%s\n", buf);
|
||||||
|
|
||||||
|
osp_net_shell_out((char *)buf, len);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -494,21 +499,17 @@ int32_t osp_execcmd(void)
|
|||||||
{
|
{
|
||||||
if (ospCmdRtnTbl[i].argnum != nCmdField-1)
|
if (ospCmdRtnTbl[i].argnum != nCmdField-1)
|
||||||
{
|
{
|
||||||
UCP_PRINT_ERROR("input wrong argnum should be %d\n", ospCmdRtnTbl[i].argnum);
|
UCP_PRINT_ERROR("input wrong argnum should be %d\n", ospCmdRtnTbl[i].argnum);
|
||||||
return OSP_ERROR;
|
return OSP_ERROR;
|
||||||
}
|
}
|
||||||
if(osp_is_ape_cmd(ospCmdRtnTbl[i].cmd))/*ape²àÃüÁî*/
|
if(osp_is_ape_cmd(ospCmdRtnTbl[i].cmd))/*ape²àÃüÁî*/
|
||||||
{
|
{
|
||||||
memcpy(gac_cmd, ospCmdRtnTbl[i].cmd, strlen(ospCmdRtnTbl[i].cmd));
|
memcpy(gac_cmd, ospCmdRtnTbl[i].cmd, strlen(ospCmdRtnTbl[i].cmd));
|
||||||
UCP_PRINT_SHELL("i:%u gac_cmd:%s ospCmdRtnTbl[i].cmd:%s\n", i, gac_cmd, ospCmdRtnTbl[i].cmd);
|
|
||||||
ret = (*ospCmdRtnTbl[i].wrapper)(&arg[1], nCmdField-1, ospCmdRtnTbl[i].routine);
|
ret = (*ospCmdRtnTbl[i].wrapper)(&arg[1], nCmdField-1, ospCmdRtnTbl[i].routine);
|
||||||
memset(gac_cmd, 0, sizeof(gac_cmd));
|
memset(gac_cmd, 0, sizeof(gac_cmd));
|
||||||
|
|
||||||
return (OSP_OK);
|
return (OSP_OK);
|
||||||
}
|
}
|
||||||
ret = (*ospCmdRtnTbl[i].wrapper)(&arg[1], nCmdField-1, ospCmdRtnTbl[i].routine);
|
ret = (*ospCmdRtnTbl[i].wrapper)(&arg[1], nCmdField-1, ospCmdRtnTbl[i].routine);
|
||||||
sprintf(shellOut, "\r\nvalue = %d = 0x%X\r\n", ret, ret);
|
|
||||||
osp_set_outstr(shellOut);
|
|
||||||
|
|
||||||
return (OSP_OK);
|
return (OSP_OK);
|
||||||
}
|
}
|
||||||
@ -525,7 +526,6 @@ int32_t osp_execcmd(void)
|
|||||||
if(osp_is_ape_cmd(ospCmdRtnTblExt[i].cmd))/*ape²àÃüÁî*/
|
if(osp_is_ape_cmd(ospCmdRtnTblExt[i].cmd))/*ape²àÃüÁî*/
|
||||||
{
|
{
|
||||||
memcpy(gac_cmd, ospCmdRtnTblExt[i].cmd, strlen(ospCmdRtnTblExt[i].cmd));
|
memcpy(gac_cmd, ospCmdRtnTblExt[i].cmd, strlen(ospCmdRtnTblExt[i].cmd));
|
||||||
UCP_PRINT_LOG("i:%u gac_cmd:%s ospCmdRtnTblExt[i].cmd:%s\n", i, gac_cmd, ospCmdRtnTblExt[i].cmd);
|
|
||||||
ret = (*ospCmdRtnTblExt[i].wrapper)(&arg[1], nCmdField-1, ospCmdRtnTblExt[i].routine);
|
ret = (*ospCmdRtnTblExt[i].wrapper)(&arg[1], nCmdField-1, ospCmdRtnTblExt[i].routine);
|
||||||
memset(gac_cmd, 0, sizeof(gac_cmd));
|
memset(gac_cmd, 0, sizeof(gac_cmd));
|
||||||
|
|
||||||
@ -533,8 +533,7 @@ int32_t osp_execcmd(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = (*ospCmdRtnTblExt[i].wrapper)(&arg[1], nCmdField - 1, ospCmdRtnTblExt[i].routine);
|
ret = (*ospCmdRtnTblExt[i].wrapper)(&arg[1], nCmdField - 1, ospCmdRtnTblExt[i].routine);
|
||||||
sprintf(shellOut, "\r\nvalue = %d = 0x%X\r\n", ret, ret);
|
|
||||||
osp_set_outstr(shellOut);
|
|
||||||
return (OSP_OK);
|
return (OSP_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1153,8 +1152,14 @@ void osp_set_print_level(uint8_t ucLevel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void osp_show_print_level()
|
void osp_show_print_level()
|
||||||
{
|
{
|
||||||
UCP_PRINT_SHELL("arm print level:0x%x\n", guc_print_level);
|
char pbuf[64];
|
||||||
|
uint32_t len = 0;
|
||||||
|
|
||||||
|
len = sprintf(pbuf,"arm print level:0x%x\n", guc_print_level);
|
||||||
|
//UCP_PRINT_SHELL("%s\n", pbuf);
|
||||||
|
|
||||||
|
osp_net_shell_out((char *)&pbuf, len);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1408,7 +1413,8 @@ void osp_ape_shell_proc(osp_sw_msg_info_t *pMsg)
|
|||||||
{
|
{
|
||||||
case UCP4008_OSP_SHELL:
|
case UCP4008_OSP_SHELL:
|
||||||
case UCP4008_OSP_SHELL_ECHO:
|
case UCP4008_OSP_SHELL_ECHO:
|
||||||
write(STDOUT_FILENO, pMsg->i8Data, SPU_SHELL_MSG_DADA_LEN(pMsg));
|
//write(STDOUT_FILENO, pMsg->i8Data, SPU_SHELL_MSG_DADA_LEN(pMsg));
|
||||||
|
osp_net_shell_out((char *)pMsg->i8Data, SPU_SHELL_MSG_DADA_LEN(pMsg));
|
||||||
break;
|
break;
|
||||||
case UCP4008_OSP_SHELL_REG:
|
case UCP4008_OSP_SHELL_REG:
|
||||||
osp_cmd_insert_proc(pMsg);
|
osp_cmd_insert_proc(pMsg);
|
||||||
@ -1539,15 +1545,20 @@ uint32_t rev_shell_log_data(uint32_t port_id,uint32_t queue_num,uint32_t el_ind,
|
|||||||
void osp_show_queue_ul_info()
|
void osp_show_queue_ul_info()
|
||||||
{
|
{
|
||||||
PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt();
|
PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt();
|
||||||
uint8_t i,j;
|
uint8_t i,j;
|
||||||
|
uint32_t len = 0;
|
||||||
|
char pbuf[2048];
|
||||||
|
|
||||||
printf("inst_id\tque_id\t\ttype_id\t\talloc\t\tape_tx_num\t\tarm_rx_num\n\r");
|
len = sprintf(pbuf,"\ninst_id\tque_id\t\ttype_id\t\talloc\t\tape_tx_num\t\tarm_rx_num\n\r");
|
||||||
|
|
||||||
for (i = 0; i < MAX_INSTANCE_NUM; i++) {
|
for (i = 0; i < MAX_INSTANCE_NUM; i++) {
|
||||||
for (j = 0; j < UCP4008_TRAFFIC_MAX_NUM; j++) {
|
for (j = 0; j < UCP4008_TRAFFIC_MAX_NUM; j++) {
|
||||||
printf("%d %d\t\t%-4d\t\t%4d\t\t%4d\t\t\t%4d\n", i, j, pPetSmLocalMgt->pQueueCfg[i][j]->handler.type_id, pPetSmLocalMgt->pUlQueue[i][j]->alloc, pPetSmLocalMgt->pUlQueue[i][j]->in, pPetSmLocalMgt->pUlQueue[i][j]->out);
|
len += sprintf(pbuf +len,"%d %d\t\t%-4d\t\t%4d\t\t%4d\t\t\t%4d\n", i, j, pPetSmLocalMgt->pQueueCfg[i][j]->handler.type_id, pPetSmLocalMgt->pUlQueue[i][j]->alloc, pPetSmLocalMgt->pUlQueue[i][j]->in, pPetSmLocalMgt->pUlQueue[i][j]->out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//printf("%s", pbuf);
|
||||||
|
osp_net_shell_out(pbuf, len);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1556,15 +1567,20 @@ void osp_show_queue_dl_info()
|
|||||||
{
|
{
|
||||||
PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt();
|
PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt();
|
||||||
uint8_t i,j;
|
uint8_t i,j;
|
||||||
|
uint32_t len = 0;
|
||||||
|
char pbuf[2048];
|
||||||
|
|
||||||
printf("inst_id\tque_id\t\ttype_id\t\talloc\t\tarm_tx_num\t\tape_rx_num\n\r");
|
len = sprintf(pbuf,"\ninst_id\tque_id\t\ttype_id\t\talloc\t\tarm_tx_num\t\tape_rx_num\n\r");
|
||||||
|
|
||||||
for (i = 0; i < MAX_INSTANCE_NUM; i++) {
|
for (i = 0; i < MAX_INSTANCE_NUM; i++) {
|
||||||
for (j = 0; j < UCP4008_TRAFFIC_MAX_NUM; j++) {
|
for (j = 0; j < UCP4008_TRAFFIC_MAX_NUM; j++) {
|
||||||
printf("%d %d\t\t%-4d\t\t%4d\t\t%4d\t\t\t%4d\n", i, j, pPetSmLocalMgt->pQueueCfg[i][j]->handler.type_id, pPetSmLocalMgt->pDlQueue[i][j]->alloc, pPetSmLocalMgt->pDlQueue[i][j]->in, pPetSmLocalMgt->pDlQueue[i][j]->out);
|
len += sprintf(pbuf +len, "%d %d\t\t%-4d\t\t%4d\t\t%4d\t\t\t%4d\n", i, j, pPetSmLocalMgt->pQueueCfg[i][j]->handler.type_id, pPetSmLocalMgt->pDlQueue[i][j]->alloc, pPetSmLocalMgt->pDlQueue[i][j]->in, pPetSmLocalMgt->pDlQueue[i][j]->out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//printf("%s", pbuf);
|
||||||
|
osp_net_shell_out(pbuf, len);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1612,9 +1628,15 @@ int8_t osp_server_cfg(uint8_t *ip, uint32_t ulport)
|
|||||||
|
|
||||||
void osp_server_cfg_show()
|
void osp_server_cfg_show()
|
||||||
{
|
{
|
||||||
UCP_PRINT_SHELL("ip:%s\nport:%u\napelog:%u\narmlog:%u\nlogpath:%s\n", \
|
uint32_t len = 0;
|
||||||
|
char pbuf[2048];
|
||||||
|
|
||||||
|
len = sprintf(pbuf,"ip:%s\nport:%u\napelog:%u\narmlog:%u\nlogpath:%s\n", \
|
||||||
gst_server_log.ip, gst_server_log.ulport, g_ulApeLogMode, g_ulArmLogMode, gst_server_log.path);
|
gst_server_log.ip, gst_server_log.ulport, g_ulApeLogMode, g_ulArmLogMode, gst_server_log.path);
|
||||||
|
|
||||||
|
//printf("%s", pbuf);
|
||||||
|
osp_net_shell_out(pbuf, len);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ void *osp_find_sym(char *pName)
|
|||||||
handle = dlopen(g_OspSoPath, RTLD_NOW);
|
handle = dlopen(g_OspSoPath, RTLD_NOW);
|
||||||
if (NULL == handle)
|
if (NULL == handle)
|
||||||
{
|
{
|
||||||
UCP_PRINT_ERROR("%s %s \r\n", g_OspSoPath, strerror(errno));
|
//UCP_PRINT_ERROR("%s %s \r\n", g_OspSoPath, strerror(errno));
|
||||||
//osp_debug_out_with_time(ERR_DEBUG_LEVEL, "%s %s \r\n", g_OspSoPath, strerror(errno));
|
//osp_debug_out_with_time(ERR_DEBUG_LEVEL, "%s %s \r\n", g_OspSoPath, strerror(errno));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -465,7 +465,7 @@ void osp_show_task_info(void)
|
|||||||
pbuf = malloc(10 * 1024);
|
pbuf = malloc(10 * 1024);
|
||||||
osp_assert(pbuf != NULL);
|
osp_assert(pbuf != NULL);
|
||||||
|
|
||||||
len = sprintf(pbuf, "%-8s%-8s%-16s%-12s%-12s%-12s%-12s%-12s%-12s%-12s%-12s%-12s%-12s%-12s\n",
|
len = sprintf(pbuf, "\n%-8s%-8s%-16s%-12s%-12s%-12s%-12s%-12s%-12s%-12s%-12s%-12s%-12s%-12s\n",
|
||||||
"Id", "OsId", "Name", "state", "Run", "MsgRx", "MsgTx", "Cpu-Pri", "Type",
|
"Id", "OsId", "Name", "state", "Run", "MsgRx", "MsgTx", "Cpu-Pri", "Type",
|
||||||
"MsgAlloc", "LogMsgAlloc", "MsgFree", "MemAlloc", "MemFree");
|
"MsgAlloc", "LogMsgAlloc", "MsgFree", "MemAlloc", "MemFree");
|
||||||
for (i = 0; i < OSP_MAX_TASK; i++)
|
for (i = 0; i < OSP_MAX_TASK; i++)
|
||||||
@ -494,8 +494,11 @@ void osp_show_task_info(void)
|
|||||||
}
|
}
|
||||||
for (p = pbuf; p < pbuf + len; p += (MAX_DBGINFO_LEN - 1))
|
for (p = pbuf; p < pbuf + len; p += (MAX_DBGINFO_LEN - 1))
|
||||||
{
|
{
|
||||||
printf("%s", p);
|
//printf("%s", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
osp_net_shell_out(pbuf, len);
|
||||||
|
|
||||||
free(pbuf);
|
free(pbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,11 +545,11 @@ int32_t osp_set_taskcpu(uint8_t cpu, uint8_t pri)
|
|||||||
task_reg_tabl[0].MsgType = OSP_PROCESS_MSG;
|
task_reg_tabl[0].MsgType = OSP_PROCESS_MSG;
|
||||||
|
|
||||||
memset(&task_reg_tabl[1], 0, sizeof(OSP_TASKMSG_REG));
|
memset(&task_reg_tabl[1], 0, sizeof(OSP_TASKMSG_REG));
|
||||||
task_reg_tabl[1].TaskId = localshellin;
|
task_reg_tabl[1].TaskId = ospnetshellrx;
|
||||||
strcpy((void *)&task_reg_tabl[1].TaskName,"localshellin");
|
strcpy((void *)&task_reg_tabl[1].TaskName,"ospnetshellrx");
|
||||||
task_reg_tabl[1].TaskPri = RT_NOMSG_PRI(90);
|
task_reg_tabl[1].TaskPri = RT_NOMSG_PRI(90);
|
||||||
task_reg_tabl[1].Init = NULL;
|
task_reg_tabl[1].Init = (OSP_FUNCPTR)osp_net_shell_init;
|
||||||
task_reg_tabl[1].MainLoop = (OSP_FUNCPTR)osp_shell_main;
|
task_reg_tabl[1].MainLoop = (OSP_FUNCPTR)osp_net_shell_proc;
|
||||||
task_reg_tabl[1].Cpu = cpu;
|
task_reg_tabl[1].Cpu = cpu;
|
||||||
task_reg_tabl[1].MsgType = OSP_OTHER_MSG;
|
task_reg_tabl[1].MsgType = OSP_OTHER_MSG;
|
||||||
|
|
||||||
|
@ -357,6 +357,8 @@ void osp_show_udp(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
osp_net_shell_out(buf, len);
|
||||||
|
|
||||||
UCP_PRINT_SHELL("%s\n", buf);
|
UCP_PRINT_SHELL("%s\n", buf);
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,17 @@
|
|||||||
// -FHDR------------------------------------------------------------
|
// -FHDR------------------------------------------------------------
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include "typedef.h"
|
#include "typedef.h"
|
||||||
#include "msg_transfer_layer.h"
|
#include "msg_transfer_layer.h"
|
||||||
#include "ucp_handshake.h"
|
#include "ucp_handshake.h"
|
||||||
@ -28,6 +35,8 @@
|
|||||||
#include "ospShell.h"
|
#include "ospShell.h"
|
||||||
#include "ospLog.h"
|
#include "ospLog.h"
|
||||||
#include "ospDump.h"
|
#include "ospDump.h"
|
||||||
|
#include "osp.h"
|
||||||
|
|
||||||
|
|
||||||
#define SPU_OAM_BASE_DELAY_SET_REQ 0x200 // 0x200
|
#define SPU_OAM_BASE_DELAY_SET_REQ 0x200 // 0x200
|
||||||
#define SPU_OAM_BASE_DELAY_SET_RSP 0x201
|
#define SPU_OAM_BASE_DELAY_SET_RSP 0x201
|
||||||
@ -105,25 +114,22 @@ uint32_t rx_callback_oam_spu(const char* buf,uint32_t payloadSize)
|
|||||||
break;
|
break;
|
||||||
case SPU_OAM_BASE_DELAY_SET_RSP:
|
case SPU_OAM_BASE_DELAY_SET_RSP:
|
||||||
oam_base_delay_set_rsp_ptr = (SpuOamBaseDelaySetRsp_t *)(buf+sizeof(OamMsgTransferHeader_t));
|
oam_base_delay_set_rsp_ptr = (SpuOamBaseDelaySetRsp_t *)(buf+sizeof(OamMsgTransferHeader_t));
|
||||||
UCP_PRINT_SHELL("cellIndex:%d u8result:%u u8fiber_port:%u\n", \
|
printf("cellIndex:%d u8result:%u u8fiber_port:%u\n", \
|
||||||
header_ptr->cellIndex,\
|
header_ptr->cellIndex,\
|
||||||
oam_base_delay_set_rsp_ptr->u8result, \
|
oam_base_delay_set_rsp_ptr->u8result, \
|
||||||
oam_base_delay_set_rsp_ptr->u8fiber_port);
|
oam_base_delay_set_rsp_ptr->u8fiber_port);
|
||||||
//memset((void *)buf, 0, payloadSize);
|
|
||||||
break;
|
break;
|
||||||
case SPU_OAM_BASE_DELAY_QRY_RSP:
|
case SPU_OAM_BASE_DELAY_QRY_RSP:
|
||||||
oam_base_delay_qry_rsp_ptr = (SpuOamBaseDelayQryRsp_t *)(buf+sizeof(OamMsgTransferHeader_t));
|
oam_base_delay_qry_rsp_ptr = (SpuOamBaseDelayQryRsp_t *)(buf+sizeof(OamMsgTransferHeader_t));
|
||||||
UCP_PRINT_SHELL("u8fiber_port:%u u8result:%u u32dl_frame_offset:0x%x u32ul_frame_offset:0x%x\n", \
|
printf("u8fiber_port:%u u8result:%u u32dl_frame_offset:0x%x u32ul_frame_offset:0x%x\n", \
|
||||||
oam_base_delay_qry_rsp_ptr->u8fiber_port, oam_base_delay_qry_rsp_ptr->u8result, \
|
oam_base_delay_qry_rsp_ptr->u8fiber_port, oam_base_delay_qry_rsp_ptr->u8result, \
|
||||||
oam_base_delay_qry_rsp_ptr->u32dl_frame_offset, oam_base_delay_qry_rsp_ptr->u32ul_frame_offset);
|
oam_base_delay_qry_rsp_ptr->u32dl_frame_offset, oam_base_delay_qry_rsp_ptr->u32ul_frame_offset);
|
||||||
//memset((void *)buf, 0, payloadSize);
|
|
||||||
break;
|
break;
|
||||||
case SPU_OAM_FIBER_DELAY_QRY_RSP:
|
case SPU_OAM_FIBER_DELAY_QRY_RSP:
|
||||||
oam_fiber_delay_qry_rsp_ptr = (SpuOamFiberDelayQryRsp_t *)(buf+sizeof(OamMsgTransferHeader_t));
|
oam_fiber_delay_qry_rsp_ptr = (SpuOamFiberDelayQryRsp_t *)(buf+sizeof(OamMsgTransferHeader_t));
|
||||||
UCP_PRINT_SHELL("u8fiber_port:%u u8result:%u u8rsv[0]:%d u8rsv[1]:%d u32t14_val:0x%x\n", \
|
printf("u8fiber_port:%u u8result:%u u8rsv[0]:%d u8rsv[1]:%d u32t14_val:0x%x\n", \
|
||||||
oam_fiber_delay_qry_rsp_ptr->u8fiber_port, oam_fiber_delay_qry_rsp_ptr->u8result, \
|
oam_fiber_delay_qry_rsp_ptr->u8fiber_port, oam_fiber_delay_qry_rsp_ptr->u8result, \
|
||||||
oam_fiber_delay_qry_rsp_ptr->u8rsv[0], oam_fiber_delay_qry_rsp_ptr->u8rsv[1], oam_fiber_delay_qry_rsp_ptr->u32t14_val);
|
oam_fiber_delay_qry_rsp_ptr->u8rsv[0], oam_fiber_delay_qry_rsp_ptr->u8rsv[1], oam_fiber_delay_qry_rsp_ptr->u32t14_val);
|
||||||
//memset((void *)buf, 0, payloadSize);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user