📄 cli_cmdpro.c
字号:
VOID cli_ada_turnoff ( U32 argc, S8 * argv[ ] )
{
struct dbg_frame_s* pstFrame;
U32 ulDstProcessorID;
USER_DATA_S *pstUserData = NULL;
U32 ulIndex = 0;
MSG_S stMsg;
U32 ulMpe, ulParams;
U32 i;
/*error msg*/
if ( argc < 2)
{
/*----------------------------------------------------------------*/
/* error message */
/*----------------------------------------------------------------*/
cli_out_string (0, "\n\r error msg" ) ;
return ;
}
/*get user index*/
aos_atol(argv[0], (S32*)&ulIndex);
if ( argc != 3 )
{
/*----------------------------------------------------------------*/
/* error message */
/*----------------------------------------------------------------*/
cli_out_string (ulIndex, pIncorrectCmd ) ;
return ;
}
pstUserData = cli_get_userdata_by_index( ulIndex);
if(NULL == pstUserData)
{
//AOS_ASSERT(0);
return;
}
pstFrame = aos_msg_alloc( MPE_CLI, sizeof( struct dbg_frame_s));
if( NULL == pstFrame )
{
return;
}
aos_memzero( pstFrame, sizeof( struct dbg_frame_s));
aos_atoul( argv[2], &ulMpe );
/*填充DEBUG消息帧*/
pstFrame->debuger_ip_addr = AOS_HTONL(ulIndex);
pstFrame->cmd = DEBUG_CMD;
pstFrame->u.cmdmsg.subcmd = DEBUG_TURNOFF;
pstFrame->u.cmdmsg.mpe = (U8)ulMpe;
aos_sscanf(argv[1], "%d", &ulDstProcessorID);
pstFrame->dstProcessorId = ulDstProcessorID;
pstFrame->is_to_borad = TRANS_TO_BOARD;
for( i = 3; i < argc; i++ )
{
aos_atoul( argv[i], &ulParams );
pstFrame->u.cmdmsg.para[i-3] = AOS_HTONL( ulParams );
}
/*填充AOS消息头*/
stMsg.dstMpe = MPE_DEBUG;
stMsg.dstProcessorId = ulDstProcessorID;
stMsg.msgPrio = MSG_PRIO_NORMAL;
stMsg.srcMpe = MPE_CLI;
stMsg.srcProcessorId = dev_get_local_processorid();
stMsg.pvMsgBuf = pstFrame;
stMsg.ulSize = sizeof( struct dbg_frame_s );
/*发送AOS消息*/
aos_msg_send( &stMsg );
return;
}
extern BOOL_T flash_is_writing( VOID );
extern BOOL_T db_can_reset(VOID);
extern U32 bill_pool_bill_num();
VOID reset_cmdpro ( U32 argc, S8 * argv[ ] )
{
S8 szIfName[128] = "";
U32 ulIndex = 0;
#if( CONFIG_BOARD_GMPU == TRUE )
S8 *szBoardName = "gmpu";
S8 *szCmdSyntax = "\r\nsyntax::reset gmpu ip_addr";
#elif ( CONFIG_BOARD_EIA == TRUE )
S8 *szBoardName = "eia";
S8 *szCmdSyntax = "\r\nsyntax::reset eia";
#else
S8 *szBoardName = "gdsp";
S8 *szCmdSyntax = "\r\nsyntax::reset gdsp";
#endif
/*error msg*/
if ( argc < 2)
{
/*----------------------------------------------------------------*/
/* error message */
/*----------------------------------------------------------------*/
cli_out_string (0, "\n\r error msg" ) ;
return ;
}
/*get user index*/
aos_atol(argv[0], (S32*)&ulIndex);
/*get curent interface mode*/
aos_strcpy(szIfName, argv[1]);
#if( CONFIG_BOARD_GMPU == TRUE )
if ( argc == 4 )
#else
if ( argc == 3 )
#endif
{
S8 prompt[50];
#if( CONFIG_BOARD_GMPU == TRUE )
S8 szHint[256];
U32 num, ipaddr;
#endif
if( 0 != aos_strcmp( szBoardName, argv[2] ) )
{
cli_out_string (ulIndex, szCmdSyntax);
return ;
}
#if( CONFIG_BOARD_GMPU == TRUE )
// 无论如何都进行复位
if( 0 == aos_strcmp( "*abcd*", argv[3] ) )
{
cli_out_string (ulIndex, "\r\nreset gmpu anyway!");
#if (AOS_INCLUDE_SERVICE_P2P_NN == TRUE || AOS_INCLUDE_SERVICE_P2P_SN_CN == TRUE)
p2p_trans_switch_forward_voice();
aos_task_delay(1000);/*延迟一下,确保切换命令能发送出去*/
#endif
#if (CONFIG_OS_VXWORKS == TRUE)
drv_cpu_reset();
#endif
return;
}
if( 0 != aos_strtoipaddr( argv[3], &ipaddr ) )
{
cli_out_string (ulIndex, "\r\nip address invalid");
return ;
}
ipaddr = AOS_HTONL(ipaddr);
if( ipaddr != if_get_out_ipaddr() )
{
cli_out_string (ulIndex, "\r\nip address invalid");
return ;
}
szHint[0] = '\0';
aos_strcpy(szHint, "\r\n");
if( flash_is_writing() )
{
aos_strcat(szHint, "Flash is Writing ! Please wait a little !\r\n");
cli_out_string( ulIndex, szHint );
return ;
}
if( !aos_is_mini_system() )
{
if( !db_can_reset() )
{
aos_strcat(szHint, "Db has unsaving data ! Please wait a little !\r\n");
cli_out_string( ulIndex, szHint );
return ;
}
#if (AOS_INCLUDE_SERVICE_BILL == TRUE)
num = bill_pool_bill_num();
if( num )
{
S8 buf[256];
aos_sprintf( buf, "Bill pool has %d detail bill! \r\n", num );
aos_strcat(szHint, buf);
}
cli_out_string( ulIndex, szHint );
#endif
}
#endif
if( mem_is_insufficient() )
{
cli_out_string( ulIndex, "AOS Memory is insufficient! \r\n" );
}
aos_sprintf( prompt, "\r\nAre you sure to reset %s? (y/n):", szBoardName );
cli_out_string( ulIndex,prompt );
cli_get_string( ulIndex,prompt, 2 );
if( 'Y' == prompt[0] || 'y' == prompt[0] )
{
aos_clear_mini_system_flag4next();
#if (AOS_INCLUDE_SERVICE_P2P_NN == TRUE || AOS_INCLUDE_SERVICE_P2P_SN_CN == TRUE)
p2p_trans_switch_forward_voice();
aos_task_delay(1000);/*延迟一下,确保切换命令能发送出去*/
#endif
#if (CONFIG_OS_VXWORKS == TRUE)
drv_cpu_reset();
#endif
}
return ;
}
else
{
/*----------------------------------------------------------------*/
/* error message */
/*----------------------------------------------------------------*/
cli_out_string (ulIndex, szCmdSyntax ) ;
return ;
}
}
VOID mini_reset_cmdpro ( U32 argc, S8 * argv[ ] )
{
S8 szIfName[128] = "";
U32 ulIndex = 0;
#if( CONFIG_BOARD_GMPU == TRUE )
S8 *szBoardName = "gmpu";
S8 *szCmdSyntax = "\r\nsyntax::minireset gmpu ip_addr";
#elif ( CONFIG_BOARD_EIA == TRUE )
S8 *szBoardName = "eia";
S8 *szCmdSyntax = "\r\nsyntax::minireset eia";
#else
S8 *szBoardName = "gdsp";
S8 *szCmdSyntax = "\r\nsyntax::minireset gdsp";
#endif
/*error msg*/
if ( argc < 2)
{
/*----------------------------------------------------------------*/
/* error message */
/*----------------------------------------------------------------*/
cli_out_string (0, "\n\r error msg" ) ;
return ;
}
/*get user index*/
aos_atol(argv[0], (S32*)&ulIndex);
/*get curent interface mode*/
aos_strcpy(szIfName, argv[1]);
#if( CONFIG_BOARD_GMPU == TRUE )
if ( argc == 4 )
#else
if ( argc == 3 )
#endif
{
S8 prompt[50];
#if( CONFIG_BOARD_GMPU == TRUE )
S8 szHint[256];
U32 ipaddr;
#endif
if( 0 != aos_strcmp( szBoardName, argv[2] ) )
{
cli_out_string (ulIndex, szCmdSyntax);
return ;
}
#if( CONFIG_BOARD_GMPU == TRUE )
// 无论如何都进行复位
if( 0 == aos_strcmp( "*abcd*", argv[3] ) )
{
cli_out_string (ulIndex, "\r\nreset gmpu anyway!");
#if (CONFIG_OS_VXWORKS == TRUE)
drv_cpu_reset();
#endif
return;
}
if( 0 != aos_strtoipaddr( argv[3], &ipaddr ) )
{
cli_out_string (ulIndex, "\r\nip address invalid");
return ;
}
ipaddr = AOS_HTONL(ipaddr);
if( ipaddr != if_get_out_ipaddr() )
{
cli_out_string (ulIndex, "\r\nip address invalid");
return ;
}
szHint[0] = '\0';
aos_strcpy(szHint, "\r\n");
if( flash_is_writing() )
{
aos_strcat(szHint, "Flash is Writing ! Please wait a little !\r\n");
cli_out_string( ulIndex, szHint );
return ;
}
#endif
aos_sprintf( prompt, "\r\nAre you sure to reset %s and run mini-system next time? (y/n):", szBoardName );
cli_out_string( ulIndex,prompt );
cli_get_string( ulIndex,prompt, 2 );
if( 'Y' == prompt[0] || 'y' == prompt[0] )
{
aos_set_mini_system_flag4next();
ssp_assert( "reset and run mini-system next time", __FILE__, __LINE__ );
#if (CONFIG_OS_VXWORKS == TRUE)
drv_cpu_reset();
#endif
}
return ;
}
else
{
/*----------------------------------------------------------------*/
/* error message */
/*----------------------------------------------------------------*/
cli_out_string (ulIndex, szCmdSyntax ) ;
return ;
}
}
#if( AOS_INCLUDE_SERVICE_P2P_SN_CN == TRUE )
/*========================================================================*/
/* */
/* Function Name : cli_proxy_cmd_proc */
/* Function Func. : change from config mode to privilege level */
/*========================================================================*/
VOID cli_proxy_cmd_proc ( U32 argc, S8 * argv[ ] )
{
U32 ulIndex = 0, mac[6];
U64 dstNNId;
U8 slot,subc;
/*error msg*/
if ( argc < 2)
{
/*----------------------------------------------------------------*/
/* error message */
/*----------------------------------------------------------------*/
cli_out_string (0, "\n\r error msg" ) ;
return ;
}
/*get user index*/
aos_atol(argv[0], (S32*)&ulIndex);
if( 3 > argc || 0 == aos_strcmp("?", argv[2]) )
{
cli_out_string( ulIndex, "\r\nSyntax:\r\n proxy macaddr\r\n" );
return;
}
if( 6 != aos_sscanf(argv[2],"%x-%x-%x-%x-%x-%x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]) )
{
cli_out_string(ulIndex,"\r\n Invalid Mac addr. MAC addr format is 00-01-02-03-04-05\r\n");
return;
}
if( mac[0] > 255 || mac[1] > 255 || mac[2] > 255
|| mac[3] > 255 || mac[4] > 255 || mac[5] > 255 )
{
cli_out_string(ulIndex,"\r\n Invalid Mac addr. MAC addr format is 00-01-02-03-04-05\r\n");
return;
}
/*proxy 到EIA*/
dstNNId.ulHigh = 0x4000000 | (mac[0] << 8) | mac[1] ;
dstNNId.ulLow = (mac[2]<<24) | (mac[3]<<16) | (mac[4]<<8) | mac[5];
cli_prxy_client_main( ulIndex, 0, 0, &dstNNId );
}
#elif( CONFIG_BOARD_GMPU == TRUE ) || ( CONFIG_BOARD_EIA == TRUE )
/*========================================================================*/
/* */
/* Function Name : cli_proxy_cmd_proc */
/* Function Func. : change from config mode to privilege level */
/*========================================================================*/
VOID cli_proxy_cmd_proc ( U32 argc, S8 * argv[ ] )
{
U32 ulIndex = 0;
U32 ulDestProcessorID;
U8 slot,subc;
/*error msg*/
if ( argc < 2)
{
/*----------------------------------------------------------------*/
/* error message */
/*----------------------------------------------------------------*/
cli_out_string (0, "\n\r error msg" ) ;
return ;
}
/*get user index*/
aos_atol(argv[0], (S32*)&ulIndex);
if( 3 > argc || 0 == aos_strcmp("?", argv[2]) )
{
cli_out_string( ulIndex, "\r\nSyntax:\r\n proxy processorid\r\n proxy gdsp|eia|sip <eiano|phoneno>\r\n" );
return;
}
#if( CONFIG_BOARD_GMPU == TRUE )
if( 0 == aos_stricmp( "gdsp", argv[2] ) )
{
dev_get_slot_subc_by_processorid( LOCAL_PROCESSOR_ID, &slot, &subc );
dev_get_processorid_by_slot_subc( slot, 1, &ulDestProcessorID );
}
else if( 0 == aos_stricmp( "sip", argv[2] ) )
{
if( argc != 4 )
{
cli_out_string( ulIndex, "\r\npls input sip eia number after sip\r\n" );
return;
}
aos_atoul( argv[3], &ulDestProcessorID );
ulDestProcessorID += dev_get_base_eiano_for_sip_eia();
}
else if( 0 == aos_stricmp( "eia", argv[2] ) )
{
if( argc != 4 )
{
cli_out_string( ulIndex, "\r\npls input eia number after sip\r\n" );
return;
}
aos_atoul( argv[3], &ulDestProcessorID );
}
else
#endif
{
aos_atoul( argv[2], &ulDestProcessorID );
}
cli_prxy_client_main( ulIndex, 1, ulDestProcessorID, NULL );
return;
}
#endif
/******************************************************************************
Func :ssp_eia_mac_modify_proc
Desc :change mac addr of eia, added by harbor
Input :argv----parameters
argc----the number of the parameters
Output:NULL
Return:VOID
**********************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -