Merge branch 'dev_ck_v2.1_feature#1646' into 'dev_ck_v2.1'
去掉ape侧命令_ape限制 See merge request ucp/driver/ucp4008_platform_arm!51
This commit is contained in:
commit
ac618f4a50
@ -1 +1 @@
|
||||
Subproject commit 81b543d4ec66acdde54865eec21a3b3a863520fe
|
||||
Subproject commit 070f58c7578fa8a9797cc4fdee51d9d0477ef5c9
|
@ -111,6 +111,8 @@ void osp_show_info_by_coreid(osp_sw_msg_info_t *pMsg);
|
||||
void osp_set_oam(uint8_t ucOam);
|
||||
void osp_ushell_output(const char *fmt, ...);
|
||||
void osp_ushell_test();
|
||||
void osp_ape_cmd_show();
|
||||
void osp_arm_cmd_show();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -286,7 +286,7 @@ void osp_net_shell_proc()
|
||||
if (len <= 0)
|
||||
{
|
||||
//perror("recvfrom");
|
||||
return;;
|
||||
return;
|
||||
}
|
||||
|
||||
osp_local_shell_main((char *)&g_abuf);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/mman.h>
|
||||
#include "osp.h"
|
||||
#include "ospShell.h"
|
||||
#include "ospDbg.h"
|
||||
@ -53,8 +54,11 @@ extern void *gpsw_que_share_mem;
|
||||
|
||||
struct termios saveterm;
|
||||
|
||||
OSP_CMD_RTN ospApeCmdRtnTbl[MAX_CMD_NUM];
|
||||
OSP_CMD_RTN *ospCmdRtnTblExt = NULL;
|
||||
lx_sem_t *ospCmdInsertSem = NULL;
|
||||
lx_sem_t *ospApeCmdInsertSem = NULL;
|
||||
|
||||
void osp_mem_show(char *addr , uint32_t ulLen);
|
||||
|
||||
void help(void);
|
||||
@ -64,9 +68,7 @@ OSP_CMD_RTN ospCmdRtnTbl[MAX_CMD_NUM] =
|
||||
{"?", (OSP_FUNCPTR)help, NULL, },
|
||||
{"i", (OSP_FUNCPTR)osp_show_task_info, NULL,"show alltask info", 0},
|
||||
{"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},
|
||||
//{"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},
|
||||
//{"sw", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_swqueue_info, "show arm print level", 0},
|
||||
{"net", (OSP_FUNCPTR)osp_show_udp, NULL, "show net info", 0},
|
||||
@ -93,15 +95,17 @@ OSP_CMD_RTN ospCmdRtnTbl[MAX_CMD_NUM] =
|
||||
{"recmd_ape", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_reget_ape_cmd, "get ape cmd again", 0},
|
||||
{"intr_ape", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_ape_csu_int_cnt, "show intr info", 0},
|
||||
{"hb", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)get_heartbeat_status, "test heartbeat", 0},
|
||||
|
||||
{"apecmd", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_ape_cmd_show, "show ape register cmd", 0},
|
||||
{"armcmd", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_arm_cmd_show, "show arm register cmd", 0},
|
||||
//{"level_ape", (OSP_FUNCPTR)osp_shell_wrapper,(OSP_FUNCPTR)osp_ape_set_log_level, "set ape log level", 1},
|
||||
//{"csu_stop_ape", (OSP_FUNCPTR)osp_shell_wrapper,(OSP_FUNCPTR)osp_ape_csu_stop_cfg, "set csu start or stop", 2},
|
||||
//{"i_ape", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_ape_taskinfo, "show ape task info", 0},
|
||||
};
|
||||
|
||||
|
||||
int32_t SHELL_CMD_NUM = OSP_NELEMENTS(ospCmdRtnTbl);
|
||||
int32_t SHELL_CMD_NUM_EXT = 0;
|
||||
|
||||
uint32_t g_u32ApeShellCmdNum = 0;
|
||||
|
||||
#define KEY_BACKSPACE '\b' // back space
|
||||
#define KEY_BACKSPACE1 127 // back space
|
||||
@ -199,6 +203,15 @@ void help(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_CMD_NUM; i++)
|
||||
{
|
||||
if (ospApeCmdRtnTbl[i].cmd[0] != 0)
|
||||
{
|
||||
len += sprintf(buf + len, "%-16s%s\n", ospApeCmdRtnTbl[i].cmd, ospApeCmdRtnTbl[i].descption);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
UCP_PRINT_SHELL("%s\n", buf);
|
||||
|
||||
osp_net_shell_out((char *)buf, len);
|
||||
@ -494,7 +507,7 @@ int32_t osp_execcmd(void)
|
||||
|
||||
if (nCmdField > 0)
|
||||
{
|
||||
/*±¾µØÃüÁî*/
|
||||
/*本地命令数组*/
|
||||
for (i = 0; i < SHELL_CMD_NUM; i++)
|
||||
{
|
||||
if (strcmp(ospCmdRtnTbl[i].cmd, arg[0]) == 0)
|
||||
@ -504,37 +517,44 @@ int32_t osp_execcmd(void)
|
||||
UCP_PRINT_ERROR("input wrong argnum should be %d\n", ospCmdRtnTbl[i].argnum);
|
||||
return OSP_ERROR;
|
||||
}
|
||||
if(osp_is_ape_cmd(ospCmdRtnTbl[i].cmd))/*ape²àÃüÁî*/
|
||||
{
|
||||
memcpy(gac_cmd, ospCmdRtnTbl[i].cmd, strlen(ospCmdRtnTbl[i].cmd));
|
||||
ret = (*ospCmdRtnTbl[i].wrapper)(&arg[1], nCmdField-1, ospCmdRtnTbl[i].routine);
|
||||
memset(gac_cmd, 0, sizeof(gac_cmd));
|
||||
return (OSP_OK);
|
||||
}
|
||||
|
||||
ret = (*ospCmdRtnTbl[i].wrapper)(&arg[1], nCmdField-1, ospCmdRtnTbl[i].routine);
|
||||
|
||||
return (OSP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
/*arm侧动态注册命令*/
|
||||
for (i = 0; i < SHELL_CMD_NUM_EXT; i++)
|
||||
{
|
||||
if (strcmp(ospCmdRtnTblExt[i].cmd, arg[0]) == 0)
|
||||
{
|
||||
if (ospCmdRtnTblExt[i].argnum != nCmdField-1)
|
||||
{
|
||||
UCP_PRINT_ERROR("input wrong argnum should be %d\n", ospCmdRtnTblExt[i].argnum);
|
||||
UCP_PRINT_ERROR("arm cmd:%s input wrong argnum should be %d\n", ospCmdRtnTblExt[i].cmd, ospCmdRtnTblExt[i].argnum);
|
||||
return OSP_ERROR;
|
||||
}
|
||||
if(osp_is_ape_cmd(ospCmdRtnTblExt[i].cmd))/*ape²àÃüÁî*/
|
||||
{
|
||||
memcpy(gac_cmd, ospCmdRtnTblExt[i].cmd, strlen(ospCmdRtnTblExt[i].cmd));
|
||||
|
||||
ret = (*ospCmdRtnTblExt[i].wrapper)(&arg[1], nCmdField - 1, ospCmdRtnTblExt[i].routine);
|
||||
memset(gac_cmd, 0, sizeof(gac_cmd));
|
||||
|
||||
return (OSP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
ret = (*ospCmdRtnTblExt[i].wrapper)(&arg[1], nCmdField - 1, ospCmdRtnTblExt[i].routine);
|
||||
/*ape侧动态注册命令*/
|
||||
for (i = 0; i < g_u32ApeShellCmdNum; i++)
|
||||
{
|
||||
if (strcmp(ospApeCmdRtnTbl[i].cmd, arg[0]) == 0)
|
||||
{
|
||||
if (ospApeCmdRtnTbl[i].argnum != nCmdField-1)
|
||||
{
|
||||
UCP_PRINT_ERROR("ape cmd:%s input wrong argnum should be %d\n", ospApeCmdRtnTbl[i].cmd, ospApeCmdRtnTbl[i].argnum);
|
||||
return OSP_ERROR;
|
||||
}
|
||||
|
||||
memcpy(gac_cmd, ospApeCmdRtnTbl[i].cmd, strlen(ospApeCmdRtnTbl[i].cmd));
|
||||
ret = (*ospApeCmdRtnTbl[i].wrapper)(&arg[1], nCmdField-1, ospApeCmdRtnTbl[i].routine);
|
||||
memset(gac_cmd, 0, sizeof(gac_cmd));
|
||||
|
||||
return (OSP_OK);
|
||||
}
|
||||
@ -989,11 +1009,29 @@ int32_t osp_insert_cmd(char *name, OSP_FUNCPTR pfunc, char *desc, uint32_t argnu
|
||||
return OSP_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_EXT_CMD_NUM; i++)
|
||||
{
|
||||
if (strcmp(ospCmdRtnTbl[i].cmd, name) == 0)
|
||||
{
|
||||
UCP_PRINT_ERROR("arm cmd i:%u cmd:%s has exist name:%s", i, ospCmdRtnTbl[i].cmd, name);
|
||||
return OSP_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_EXT_CMD_NUM; i++)
|
||||
{
|
||||
if (strcmp(ospCmdRtnTblExt[i].cmd, name) == 0)
|
||||
{
|
||||
UCP_PRINT_ERROR("osp_insert_cmd i:%u cmd:%s has exist name:%s", i, ospCmdRtnTblExt[i].cmd, name);
|
||||
UCP_PRINT_ERROR("arm insert cmd i:%u cmd:%s has exist name:%s", i, ospCmdRtnTblExt[i].cmd, name);
|
||||
return OSP_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_EXT_CMD_NUM; i++)
|
||||
{
|
||||
if (strcmp(ospApeCmdRtnTbl[i].cmd, name) == 0)
|
||||
{
|
||||
UCP_PRINT_ERROR("ape cmd i:%u cmd:%s has exist name:%s", i, ospApeCmdRtnTbl[i].cmd, name);
|
||||
return OSP_ERROR;
|
||||
}
|
||||
}
|
||||
@ -1033,18 +1071,20 @@ int32_t osp_shell_init(void)
|
||||
|
||||
ospCmdRtnTblExt = (OSP_CMD_RTN *)osp_get_init_mem(sizeof(OSP_CMD_RTN) * MAX_EXT_CMD_NUM);
|
||||
ospCmdInsertSem = (lx_sem_t *)osp_get_init_mem(sizeof(lx_sem_t));
|
||||
|
||||
ospApeCmdInsertSem = (lx_sem_t *)osp_get_init_mem(sizeof(lx_sem_t));
|
||||
|
||||
if (0 == g_ProcessId)
|
||||
{
|
||||
memset(ospCmdRtnTblExt, 0, sizeof(OSP_CMD_RTN) *MAX_EXT_CMD_NUM);
|
||||
memset(ospApeCmdInsertSem, 0, sizeof(OSP_CMD_RTN) *MAX_EXT_CMD_NUM);
|
||||
osp_semsm_create(ospCmdInsertSem);
|
||||
osp_semsm_create(ospApeCmdInsertSem);
|
||||
}
|
||||
|
||||
/*配置文件读取server ip ,port*/
|
||||
osp_server_get();
|
||||
|
||||
osp_insert_cmd("test", (OSP_FUNCPTR)osp_ushell_test, "test", 0);
|
||||
osp_insert_cmd("test", (OSP_FUNCPTR)osp_ushell_test, "arm insert test", 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1158,10 +1198,9 @@ void osp_set_arm_log_mode(uint8_t ucIsNet)
|
||||
|
||||
void osp_reget_ape_cmd()
|
||||
{
|
||||
UCP_PRINT_SHELL("osp_reget_ape_cmd cmd:%s\n", gac_cmd);
|
||||
SHELL_CMD_NUM_EXT = 0;
|
||||
g_u32ApeShellCmdNum = 0;
|
||||
|
||||
osp_ape_msg_send((char *)gac_cmd);
|
||||
osp_ape_msg_send((char *)"recmd_ape");
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1261,9 +1300,10 @@ void osp_ape_csu_stop_cfg(uint8_t ucstop, uint8_t ucadvance)
|
||||
|
||||
void osp_ape_csu_int_cnt()
|
||||
{
|
||||
UCP_PRINT_LOG("osp_show_ape_taskinfo cmd:%s\n", gac_cmd);
|
||||
|
||||
osp_ape_msg_send((char *)gac_cmd);
|
||||
UCP_PRINT_LOG("osp_ape_csu_int_cnt intr_ape\n");
|
||||
|
||||
osp_ape_msg_send((char *)"intr_ape");
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1306,6 +1346,7 @@ void osp_ape_msg_send(char *pcmd)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void osp_cmd_register(OSP_CMD_EXT *pCmdExt)
|
||||
{
|
||||
uint32_t num = 0;
|
||||
@ -1313,29 +1354,83 @@ void osp_cmd_register(OSP_CMD_EXT *pCmdExt)
|
||||
|
||||
if (NULL == pCmdExt)
|
||||
{
|
||||
UCP_PRINT_ERROR("osp_cmd_register pCmdExt is null");
|
||||
return;
|
||||
}
|
||||
|
||||
UCP_PRINT_LOG("osp_cmd_register ape cmd:%s", pCmdExt->cmd);
|
||||
|
||||
for (i = 0; i < MAX_EXT_CMD_NUM; i++)
|
||||
{
|
||||
if (strcmp(ospCmdRtnTbl[i].cmd, pCmdExt->cmd) == 0)
|
||||
{
|
||||
UCP_PRINT_LOG("osp_cmd_register arm cmd i:%u cmd:%s has exist name:%s", i, ospCmdRtnTbl[i].cmd, pCmdExt->cmd);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
for(i =0; i <SHELL_CMD_NUM_EXT; i++)
|
||||
{
|
||||
if (0 == strcmp(ospCmdRtnTblExt[i].cmd, pCmdExt->cmd))
|
||||
{
|
||||
UCP_PRINT_LOG("osp_cmd_register cmd:%s has exist name:%s", i, ospCmdRtnTblExt[i].cmd, pCmdExt->cmd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
num = SHELL_CMD_NUM_EXT;
|
||||
for(i =0; i <g_u32ApeShellCmdNum; i++)
|
||||
{
|
||||
if (0 == strcmp(ospApeCmdRtnTbl[i].cmd, pCmdExt->cmd))
|
||||
{
|
||||
UCP_PRINT_LOG("osp_cmd_register ape cmd:%s has exist name:%s", ospApeCmdRtnTbl[i].cmd, pCmdExt->cmd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(ospCmdRtnTblExt[num].cmd, pCmdExt->cmd);
|
||||
num = g_u32ApeShellCmdNum;
|
||||
|
||||
ospCmdRtnTblExt[num].wrapper = (OSP_FUNCPTR)osp_ape_shell_wrapper;
|
||||
ospCmdRtnTblExt[num].argnum = pCmdExt->argnum;
|
||||
strcpy(ospApeCmdRtnTbl[num].cmd, pCmdExt->cmd);
|
||||
ospApeCmdRtnTbl[num].wrapper = (OSP_FUNCPTR)osp_ape_shell_wrapper;
|
||||
ospApeCmdRtnTbl[num].argnum = pCmdExt->argnum;
|
||||
|
||||
SHELL_CMD_NUM_EXT++;
|
||||
g_u32ApeShellCmdNum++;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void osp_ape_cmd_show()
|
||||
{
|
||||
uint8_t i = 0;
|
||||
uint32_t len = 0;
|
||||
char pbuf[2048];
|
||||
|
||||
for(i = 0; i < g_u32ApeShellCmdNum; i++)
|
||||
{
|
||||
len += sprintf(pbuf +len,"cmd:%s argnum:%u\n", ospApeCmdRtnTbl[i].cmd, ospApeCmdRtnTbl[i].argnum);
|
||||
}
|
||||
|
||||
osp_net_shell_out(pbuf, len);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void osp_arm_cmd_show()
|
||||
{
|
||||
uint8_t i = 0;
|
||||
uint32_t len = 0;
|
||||
char pbuf[2048];
|
||||
|
||||
for(i = 0; i < SHELL_CMD_NUM_EXT; i++)
|
||||
{
|
||||
len += sprintf(pbuf +len,"cmd:%s argnum:%u\n", ospCmdRtnTblExt[i].cmd, ospCmdRtnTblExt[i].argnum);
|
||||
}
|
||||
|
||||
osp_net_shell_out(pbuf, len);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void osp_cmd_insert_proc(Osp_Ape_Msg_Head *pMsg)
|
||||
{
|
||||
@ -1380,7 +1475,7 @@ void osp_cmd_insert_proc(osp_sw_msg_info_t *pMsg)
|
||||
return;
|
||||
}
|
||||
|
||||
osp_sem_take(ospCmdInsertSem, -1);
|
||||
osp_sem_take(ospApeCmdInsertSem, -1);
|
||||
|
||||
pbuf = SPU_SHELL_MSG_HEAD_TO_COMM(pMsg);
|
||||
ulLen = SPU_SHELL_MSG_DADA_LEN(pMsg);
|
||||
@ -1405,7 +1500,7 @@ void osp_cmd_insert_proc(osp_sw_msg_info_t *pMsg)
|
||||
break;
|
||||
}
|
||||
|
||||
osp_sem_give(ospCmdInsertSem);
|
||||
osp_sem_give(ospApeCmdInsertSem);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1863,6 +1958,7 @@ void osp_set_clk_mode(clk_flag_e pseudo_flag)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void osp_show_swqueue_info()
|
||||
{
|
||||
uint8_t i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user