From abdcd80dcd76e4f2230b0c9411c0aa4c640268b8 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sun, 5 Jan 2014 14:57:58 +0800 Subject: [PATCH] [Finsh] Add more command in msh --- components/finsh/SConscript | 3 ++- components/finsh/cmd.c | 27 +++++++++++++++++++-------- components/finsh/finsh.h | 4 ++++ components/finsh/msh_cmd.c | 1 - 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/components/finsh/SConscript b/components/finsh/SConscript index 80c53bfc6..edb52eb35 100644 --- a/components/finsh/SConscript +++ b/components/finsh/SConscript @@ -35,7 +35,8 @@ if rtconfig.CROSS_TOOL == 'keil': else: LINKFLAGS = '' -src = src + msh_src +if GetDepend('FINSH_USING_MSH'): + src = src + msh_src if not GetDepend('FINSH_USING_MSH_ONLY'): src = src + fsh_src diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index 2a8a88425..061345227 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -77,6 +77,7 @@ long version(void) return 0; } 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[]; @@ -117,6 +118,7 @@ long list_thread(void) return _list_thread(&rt_object_container[RT_Object_Class_Thread].object_list); } FINSH_FUNCTION_EXPORT(list_thread, list thread); +MSH_CMD_EXPORT(list_thread, list thread); 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); } -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 #ifdef RT_USING_EVENT @@ -209,7 +212,8 @@ long list_event(void) { 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 #ifdef RT_USING_MUTEX @@ -239,7 +243,8 @@ long list_mutex(void) { 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 #ifdef RT_USING_MAILBOX @@ -282,7 +287,8 @@ long list_mailbox(void) { 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 #ifdef RT_USING_MESSAGEQUEUE @@ -323,7 +329,8 @@ long list_msgqueue(void) { 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 #ifdef RT_USING_MEMHEAP @@ -353,7 +360,8 @@ long list_memheap(void) { 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 #ifdef RT_USING_MEMPOOL @@ -399,6 +407,7 @@ long list_mempool(void) return _list_mempool(&rt_object_container[RT_Object_Class_MemPool].object_list); } FINSH_FUNCTION_EXPORT(list_mempool, list memory pool in system) +MSH_CMD_EXPORT(list_mempool, list memory pool in system); #endif 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); } -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 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); } -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 #ifdef RT_USING_MODULE diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h index fb06cd557..cf7ee0580 100644 --- a/components/finsh/finsh.h +++ b/components/finsh/finsh.h @@ -344,8 +344,12 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name); * @param command the name of command. * @param desc the description of command, which will show in help. */ +#ifdef FINSH_USING_MSH #define MSH_CMD_EXPORT(command, desc) \ FINSH_FUNCTION_EXPORT_CMD(command, __cmd_##command, desc) +#else +#define MSH_CMD_EXPORT(command, desc) +#endif struct finsh_token { diff --git a/components/finsh/msh_cmd.c b/components/finsh/msh_cmd.c index cc0f6e140..a5a5b79f1 100644 --- a/components/finsh/msh_cmd.c +++ b/components/finsh/msh_cmd.c @@ -187,7 +187,6 @@ int cmd_ps(int argc, char** argv) return 0; } 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) { -- GitLab