[Finsh] Add more command in msh

This commit is contained in:
Bernard Xiong 2014-01-05 14:57:58 +08:00
parent 053f579eeb
commit abdcd80dcd
4 changed files with 25 additions and 10 deletions

View File

@ -35,7 +35,8 @@ if rtconfig.CROSS_TOOL == 'keil':
else: else:
LINKFLAGS = '' LINKFLAGS = ''
src = src + msh_src if GetDepend('FINSH_USING_MSH'):
src = src + msh_src
if not GetDepend('FINSH_USING_MSH_ONLY'): if not GetDepend('FINSH_USING_MSH_ONLY'):
src = src + fsh_src src = src + fsh_src

View File

@ -77,6 +77,7 @@ long version(void)
return 0; return 0;
} }
FINSH_FUNCTION_EXPORT(version, show RT-Thread version information); FINSH_FUNCTION_EXPORT(version, show RT-Thread version information);
MSH_CMD_EXPORT(version, show RT-Thread version information);
extern struct rt_object_information rt_object_container[]; extern struct rt_object_information rt_object_container[];
@ -117,6 +118,7 @@ long list_thread(void)
return _list_thread(&rt_object_container[RT_Object_Class_Thread].object_list); return _list_thread(&rt_object_container[RT_Object_Class_Thread].object_list);
} }
FINSH_FUNCTION_EXPORT(list_thread, list thread); FINSH_FUNCTION_EXPORT(list_thread, list thread);
MSH_CMD_EXPORT(list_thread, list thread);
static void show_wait_queue(struct rt_list_node *list) static void show_wait_queue(struct rt_list_node *list)
{ {
@ -171,7 +173,8 @@ long list_sem(void)
{ {
return _list_sem(&rt_object_container[RT_Object_Class_Semaphore].object_list); return _list_sem(&rt_object_container[RT_Object_Class_Semaphore].object_list);
} }
FINSH_FUNCTION_EXPORT(list_sem, list semaphone in system) FINSH_FUNCTION_EXPORT(list_sem, list semaphone in system);
MSH_CMD_EXPORT(list_sem, list semaphore in system);
#endif #endif
#ifdef RT_USING_EVENT #ifdef RT_USING_EVENT
@ -209,7 +212,8 @@ long list_event(void)
{ {
return _list_event(&rt_object_container[RT_Object_Class_Event].object_list); return _list_event(&rt_object_container[RT_Object_Class_Event].object_list);
} }
FINSH_FUNCTION_EXPORT(list_event, list event in system) FINSH_FUNCTION_EXPORT(list_event, list event in system);
MSH_CMD_EXPORT(list_event, list event in system);
#endif #endif
#ifdef RT_USING_MUTEX #ifdef RT_USING_MUTEX
@ -239,7 +243,8 @@ long list_mutex(void)
{ {
return _list_mutex(&rt_object_container[RT_Object_Class_Mutex].object_list); return _list_mutex(&rt_object_container[RT_Object_Class_Mutex].object_list);
} }
FINSH_FUNCTION_EXPORT(list_mutex, list mutex in system) FINSH_FUNCTION_EXPORT(list_mutex, list mutex in system);
MSH_CMD_EXPORT(list_mutex, list mutex in system);
#endif #endif
#ifdef RT_USING_MAILBOX #ifdef RT_USING_MAILBOX
@ -282,7 +287,8 @@ long list_mailbox(void)
{ {
return _list_mailbox(&rt_object_container[RT_Object_Class_MailBox].object_list); return _list_mailbox(&rt_object_container[RT_Object_Class_MailBox].object_list);
} }
FINSH_FUNCTION_EXPORT(list_mailbox, list mail box in system) FINSH_FUNCTION_EXPORT(list_mailbox, list mail box in system);
MSH_CMD_EXPORT(list_mailbox, list mail box in system);
#endif #endif
#ifdef RT_USING_MESSAGEQUEUE #ifdef RT_USING_MESSAGEQUEUE
@ -323,7 +329,8 @@ long list_msgqueue(void)
{ {
return _list_msgqueue(&rt_object_container[RT_Object_Class_MessageQueue].object_list); return _list_msgqueue(&rt_object_container[RT_Object_Class_MessageQueue].object_list);
} }
FINSH_FUNCTION_EXPORT(list_msgqueue, list message queue in system) FINSH_FUNCTION_EXPORT(list_msgqueue, list message queue in system);
MSH_CMD_EXPORT(list_msgqueue, list message queue in system);
#endif #endif
#ifdef RT_USING_MEMHEAP #ifdef RT_USING_MEMHEAP
@ -353,7 +360,8 @@ long list_memheap(void)
{ {
return _list_memheap(&rt_object_container[RT_Object_Class_MemHeap].object_list); return _list_memheap(&rt_object_container[RT_Object_Class_MemHeap].object_list);
} }
FINSH_FUNCTION_EXPORT(list_memheap, list memory heap in system) FINSH_FUNCTION_EXPORT(list_memheap, list memory heap in system);
MSH_CMD_EXPORT(list_memheap, list memory heap in system);
#endif #endif
#ifdef RT_USING_MEMPOOL #ifdef RT_USING_MEMPOOL
@ -399,6 +407,7 @@ long list_mempool(void)
return _list_mempool(&rt_object_container[RT_Object_Class_MemPool].object_list); return _list_mempool(&rt_object_container[RT_Object_Class_MemPool].object_list);
} }
FINSH_FUNCTION_EXPORT(list_mempool, list memory pool in system) FINSH_FUNCTION_EXPORT(list_mempool, list memory pool in system)
MSH_CMD_EXPORT(list_mempool, list memory pool in system);
#endif #endif
static long _list_timer(struct rt_list_node *list) static long _list_timer(struct rt_list_node *list)
@ -431,7 +440,8 @@ long list_timer(void)
{ {
return _list_timer(&rt_object_container[RT_Object_Class_Timer].object_list); return _list_timer(&rt_object_container[RT_Object_Class_Timer].object_list);
} }
FINSH_FUNCTION_EXPORT(list_timer, list timer in system) FINSH_FUNCTION_EXPORT(list_timer, list timer in system);
MSH_CMD_EXPORT(list_timer, list timer in system);
#ifdef RT_USING_DEVICE #ifdef RT_USING_DEVICE
static long _list_device(struct rt_list_node *list) static long _list_device(struct rt_list_node *list)
@ -481,7 +491,8 @@ long list_device(void)
{ {
return _list_device(&rt_object_container[RT_Object_Class_Device].object_list); return _list_device(&rt_object_container[RT_Object_Class_Device].object_list);
} }
FINSH_FUNCTION_EXPORT(list_device, list device in system) FINSH_FUNCTION_EXPORT(list_device, list device in system);
MSH_CMD_EXPORT(list_device, list device in system);
#endif #endif
#ifdef RT_USING_MODULE #ifdef RT_USING_MODULE

View File

@ -344,8 +344,12 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
* @param command the name of command. * @param command the name of command.
* @param desc the description of command, which will show in help. * @param desc the description of command, which will show in help.
*/ */
#ifdef FINSH_USING_MSH
#define MSH_CMD_EXPORT(command, desc) \ #define MSH_CMD_EXPORT(command, desc) \
FINSH_FUNCTION_EXPORT_CMD(command, __cmd_##command, desc) FINSH_FUNCTION_EXPORT_CMD(command, __cmd_##command, desc)
#else
#define MSH_CMD_EXPORT(command, desc)
#endif
struct finsh_token struct finsh_token
{ {

View File

@ -187,7 +187,6 @@ int cmd_ps(int argc, char** argv)
return 0; return 0;
} }
FINSH_FUNCTION_EXPORT_ALIAS(cmd_ps, __cmd_ps, List threads in the system.); FINSH_FUNCTION_EXPORT_ALIAS(cmd_ps, __cmd_ps, List threads in the system.);
FINSH_FUNCTION_EXPORT_ALIAS(cmd_ps, __cmd_i, List threads in the system.);
int cmd_time(int argc, char** argv) int cmd_time(int argc, char** argv)
{ {