|
@@ -33,10 +33,10 @@
|
|
|
|
|
|
#include <rthw.h>
|
|
|
#include <rtthread.h>
|
|
|
+#include <string.h>
|
|
|
|
|
|
#ifdef RT_USING_FINSH
|
|
|
-
|
|
|
-#include "finsh.h"
|
|
|
+#include <finsh.h>
|
|
|
|
|
|
#define LIST_FIND_OBJ_NR 8
|
|
|
|
|
@@ -46,7 +46,7 @@ long hello(void)
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(hello, say hello world);
|
|
|
+MSH_CMD_EXPORT(hello, say hello world);
|
|
|
|
|
|
static long clear(void)
|
|
|
{
|
|
@@ -54,8 +54,7 @@ static long clear(void)
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(clear,clear the terminal screen);
|
|
|
-MSH_CMD_EXPORT(clear,clear the terminal screen);
|
|
|
+MSH_CMD_EXPORT(clear, clear the terminal screen);
|
|
|
|
|
|
extern void rt_show_version(void);
|
|
|
long version(void)
|
|
@@ -64,8 +63,7 @@ long version(void)
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(version, show RT-Thread version information);
|
|
|
-MSH_CMD_EXPORT(version, show RT-Thread version information);
|
|
|
+MSH_CMD_EXPORT(version, show RT - Thread version information);
|
|
|
|
|
|
rt_inline void object_split(int len)
|
|
|
{
|
|
@@ -166,20 +164,22 @@ long list_thread(void)
|
|
|
rt_ubase_t level;
|
|
|
list_get_next_t find_arg;
|
|
|
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
|
|
|
- rt_list_t *next = (rt_list_t*)RT_NULL;
|
|
|
+ rt_list_t *next = (rt_list_t *)RT_NULL;
|
|
|
const char *item_title = "thread";
|
|
|
int maxlen;
|
|
|
|
|
|
- list_find_init(&find_arg, RT_Object_Class_Thread, obj_list, sizeof(obj_list)/sizeof(obj_list[0]));
|
|
|
+ list_find_init(&find_arg, RT_Object_Class_Thread, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
|
|
|
|
|
|
maxlen = RT_NAME_MAX;
|
|
|
|
|
|
#ifdef RT_USING_SMP
|
|
|
- rt_kprintf("%-*.s cpu bind pri status sp stack size max used left tick error\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " --- ---- --- ------- ---------- ---------- ------ ---------- ---\n");
|
|
|
+ rt_kprintf("%-*.s cpu bind pri status sp stack size max used left tick error\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" --- ---- --- ------- ---------- ---------- ------ ---------- ---\n");
|
|
|
#else
|
|
|
- rt_kprintf("%-*.s pri status sp stack size max used left tick error\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " --- ------- ---------- ---------- ------ ---------- ---\n");
|
|
|
+ rt_kprintf("%-*.s pri status sp stack size max used left tick error\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" --- ------- ---------- ---------- ------ ---------- ---\n");
|
|
|
#endif /*RT_USING_SMP*/
|
|
|
|
|
|
do
|
|
@@ -201,10 +201,10 @@ long list_thread(void)
|
|
|
continue;
|
|
|
}
|
|
|
/* copy info */
|
|
|
- memcpy(&thread_info, obj, sizeof thread_info);
|
|
|
+ rt_memcpy(&thread_info, obj, sizeof thread_info);
|
|
|
rt_hw_interrupt_enable(level);
|
|
|
|
|
|
- thread = (struct rt_thread*)obj;
|
|
|
+ thread = (struct rt_thread *)obj;
|
|
|
{
|
|
|
rt_uint8_t stat;
|
|
|
rt_uint8_t *ptr;
|
|
@@ -230,32 +230,31 @@ long list_thread(void)
|
|
|
while (*ptr == '#')ptr --;
|
|
|
|
|
|
rt_kprintf(" 0x%08x 0x%08x %02d%% 0x%08x %03d\n",
|
|
|
- ((rt_ubase_t)thread->sp - (rt_ubase_t)thread->stack_addr),
|
|
|
- thread->stack_size,
|
|
|
- ((rt_ubase_t)ptr - (rt_ubase_t)thread->stack_addr) * 100 / thread->stack_size,
|
|
|
- thread->remaining_tick,
|
|
|
- thread->error);
|
|
|
+ ((rt_ubase_t)thread->sp - (rt_ubase_t)thread->stack_addr),
|
|
|
+ thread->stack_size,
|
|
|
+ ((rt_ubase_t)ptr - (rt_ubase_t)thread->stack_addr) * 100 / thread->stack_size,
|
|
|
+ thread->remaining_tick,
|
|
|
+ thread->error);
|
|
|
#else
|
|
|
ptr = (rt_uint8_t *)thread->stack_addr;
|
|
|
while (*ptr == '#')ptr ++;
|
|
|
|
|
|
rt_kprintf(" 0x%08x 0x%08x %02d%% 0x%08x %03d\n",
|
|
|
- thread->stack_size + ((rt_ubase_t)thread->stack_addr - (rt_ubase_t)thread->sp),
|
|
|
- thread->stack_size,
|
|
|
- (thread->stack_size - ((rt_ubase_t) ptr - (rt_ubase_t) thread->stack_addr)) * 100
|
|
|
- / thread->stack_size,
|
|
|
- thread->remaining_tick,
|
|
|
- thread->error);
|
|
|
+ thread->stack_size + ((rt_ubase_t)thread->stack_addr - (rt_ubase_t)thread->sp),
|
|
|
+ thread->stack_size,
|
|
|
+ (thread->stack_size - ((rt_ubase_t) ptr - (rt_ubase_t) thread->stack_addr)) * 100
|
|
|
+ / thread->stack_size,
|
|
|
+ thread->remaining_tick,
|
|
|
+ thread->error);
|
|
|
#endif
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- while (next != (rt_list_t*)RT_NULL);
|
|
|
+ while (next != (rt_list_t *)RT_NULL);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list_thread, list thread);
|
|
|
MSH_CMD_EXPORT(list_thread, list thread);
|
|
|
|
|
|
static void show_wait_queue(struct rt_list_node *list)
|
|
@@ -266,7 +265,7 @@ static void show_wait_queue(struct rt_list_node *list)
|
|
|
for (node = list->next; node != list; node = node->next)
|
|
|
{
|
|
|
thread = rt_list_entry(node, struct rt_thread, tlist);
|
|
|
- rt_kprintf("%s", thread->name);
|
|
|
+ rt_kprintf("%.*s", RT_NAME_MAX, thread->name);
|
|
|
|
|
|
if (node->next != list)
|
|
|
rt_kprintf("/");
|
|
@@ -279,17 +278,18 @@ long list_sem(void)
|
|
|
rt_ubase_t level;
|
|
|
list_get_next_t find_arg;
|
|
|
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
|
|
|
- rt_list_t *next = (rt_list_t*)RT_NULL;
|
|
|
+ rt_list_t *next = (rt_list_t *)RT_NULL;
|
|
|
|
|
|
int maxlen;
|
|
|
const char *item_title = "semaphore";
|
|
|
|
|
|
- list_find_init(&find_arg, RT_Object_Class_Semaphore, obj_list, sizeof(obj_list)/sizeof(obj_list[0]));
|
|
|
+ list_find_init(&find_arg, RT_Object_Class_Semaphore, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
|
|
|
|
|
|
maxlen = RT_NAME_MAX;
|
|
|
|
|
|
- rt_kprintf("%-*.s v suspend thread\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " --- --------------\n");
|
|
|
+ rt_kprintf("%-*.s v suspend thread\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" --- --------------\n");
|
|
|
|
|
|
do
|
|
|
{
|
|
@@ -310,33 +310,32 @@ long list_sem(void)
|
|
|
}
|
|
|
rt_hw_interrupt_enable(level);
|
|
|
|
|
|
- sem = (struct rt_semaphore*)obj;
|
|
|
+ sem = (struct rt_semaphore *)obj;
|
|
|
if (!rt_list_isempty(&sem->parent.suspend_thread))
|
|
|
{
|
|
|
rt_kprintf("%-*.*s %03d %d:",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- sem->parent.parent.name,
|
|
|
- sem->value,
|
|
|
- rt_list_len(&sem->parent.suspend_thread));
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ sem->parent.parent.name,
|
|
|
+ sem->value,
|
|
|
+ rt_list_len(&sem->parent.suspend_thread));
|
|
|
show_wait_queue(&(sem->parent.suspend_thread));
|
|
|
rt_kprintf("\n");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
rt_kprintf("%-*.*s %03d %d\n",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- sem->parent.parent.name,
|
|
|
- sem->value,
|
|
|
- rt_list_len(&sem->parent.suspend_thread));
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ sem->parent.parent.name,
|
|
|
+ sem->value,
|
|
|
+ rt_list_len(&sem->parent.suspend_thread));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- while (next != (rt_list_t*)RT_NULL);
|
|
|
+ while (next != (rt_list_t *)RT_NULL);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list_sem, list semaphore in system);
|
|
|
MSH_CMD_EXPORT(list_sem, list semaphore in system);
|
|
|
#endif
|
|
|
|
|
@@ -346,17 +345,18 @@ long list_event(void)
|
|
|
rt_ubase_t level;
|
|
|
list_get_next_t find_arg;
|
|
|
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
|
|
|
- rt_list_t *next = (rt_list_t*)RT_NULL;
|
|
|
+ rt_list_t *next = (rt_list_t *)RT_NULL;
|
|
|
|
|
|
int maxlen;
|
|
|
const char *item_title = "event";
|
|
|
|
|
|
- list_find_init(&find_arg, RT_Object_Class_Event, obj_list, sizeof(obj_list)/sizeof(obj_list[0]));
|
|
|
+ list_find_init(&find_arg, RT_Object_Class_Event, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
|
|
|
|
|
|
maxlen = RT_NAME_MAX;
|
|
|
|
|
|
- rt_kprintf("%-*.s set suspend thread\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " ---------- --------------\n");
|
|
|
+ rt_kprintf("%-*.s set suspend thread\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" ---------- --------------\n");
|
|
|
|
|
|
do
|
|
|
{
|
|
@@ -382,26 +382,25 @@ long list_event(void)
|
|
|
if (!rt_list_isempty(&e->parent.suspend_thread))
|
|
|
{
|
|
|
rt_kprintf("%-*.*s 0x%08x %03d:",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- e->parent.parent.name,
|
|
|
- e->set,
|
|
|
- rt_list_len(&e->parent.suspend_thread));
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ e->parent.parent.name,
|
|
|
+ e->set,
|
|
|
+ rt_list_len(&e->parent.suspend_thread));
|
|
|
show_wait_queue(&(e->parent.suspend_thread));
|
|
|
rt_kprintf("\n");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
rt_kprintf("%-*.*s 0x%08x 0\n",
|
|
|
- maxlen, RT_NAME_MAX, e->parent.parent.name, e->set);
|
|
|
+ maxlen, RT_NAME_MAX, e->parent.parent.name, e->set);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- while (next != (rt_list_t*)RT_NULL);
|
|
|
+ while (next != (rt_list_t *)RT_NULL);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list_event, list event in system);
|
|
|
MSH_CMD_EXPORT(list_event, list event in system);
|
|
|
#endif
|
|
|
|
|
@@ -411,17 +410,18 @@ long list_mutex(void)
|
|
|
rt_ubase_t level;
|
|
|
list_get_next_t find_arg;
|
|
|
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
|
|
|
- rt_list_t *next = (rt_list_t*)RT_NULL;
|
|
|
+ rt_list_t *next = (rt_list_t *)RT_NULL;
|
|
|
|
|
|
int maxlen;
|
|
|
const char *item_title = "mutex";
|
|
|
|
|
|
- list_find_init(&find_arg, RT_Object_Class_Mutex, obj_list, sizeof(obj_list)/sizeof(obj_list[0]));
|
|
|
+ list_find_init(&find_arg, RT_Object_Class_Mutex, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
|
|
|
|
|
|
maxlen = RT_NAME_MAX;
|
|
|
|
|
|
- rt_kprintf("%-*.s owner hold suspend thread\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " -------- ---- --------------\n");
|
|
|
+ rt_kprintf("%-*.s owner hold suspend thread\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" -------- ---- --------------\n");
|
|
|
|
|
|
do
|
|
|
{
|
|
@@ -445,21 +445,20 @@ long list_mutex(void)
|
|
|
|
|
|
m = (struct rt_mutex *)obj;
|
|
|
rt_kprintf("%-*.*s %-8.*s %04d %d\n",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- m->parent.parent.name,
|
|
|
- RT_NAME_MAX,
|
|
|
- m->owner->name,
|
|
|
- m->hold,
|
|
|
- rt_list_len(&m->parent.suspend_thread));
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ m->parent.parent.name,
|
|
|
+ RT_NAME_MAX,
|
|
|
+ m->owner->name,
|
|
|
+ m->hold,
|
|
|
+ rt_list_len(&m->parent.suspend_thread));
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- while (next != (rt_list_t*)RT_NULL);
|
|
|
+ while (next != (rt_list_t *)RT_NULL);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list_mutex, list mutex in system);
|
|
|
MSH_CMD_EXPORT(list_mutex, list mutex in system);
|
|
|
#endif
|
|
|
|
|
@@ -469,17 +468,18 @@ long list_mailbox(void)
|
|
|
rt_ubase_t level;
|
|
|
list_get_next_t find_arg;
|
|
|
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
|
|
|
- rt_list_t *next = (rt_list_t*)RT_NULL;
|
|
|
+ rt_list_t *next = (rt_list_t *)RT_NULL;
|
|
|
|
|
|
int maxlen;
|
|
|
const char *item_title = "mailbox";
|
|
|
|
|
|
- list_find_init(&find_arg, RT_Object_Class_MailBox, obj_list, sizeof(obj_list)/sizeof(obj_list[0]));
|
|
|
+ list_find_init(&find_arg, RT_Object_Class_MailBox, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
|
|
|
|
|
|
maxlen = RT_NAME_MAX;
|
|
|
|
|
|
- rt_kprintf("%-*.s entry size suspend thread\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " ---- ---- --------------\n");
|
|
|
+ rt_kprintf("%-*.s entry size suspend thread\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" ---- ---- --------------\n");
|
|
|
|
|
|
do
|
|
|
{
|
|
@@ -505,32 +505,31 @@ long list_mailbox(void)
|
|
|
if (!rt_list_isempty(&m->parent.suspend_thread))
|
|
|
{
|
|
|
rt_kprintf("%-*.*s %04d %04d %d:",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- m->parent.parent.name,
|
|
|
- m->entry,
|
|
|
- m->size,
|
|
|
- rt_list_len(&m->parent.suspend_thread));
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ m->parent.parent.name,
|
|
|
+ m->entry,
|
|
|
+ m->size,
|
|
|
+ rt_list_len(&m->parent.suspend_thread));
|
|
|
show_wait_queue(&(m->parent.suspend_thread));
|
|
|
rt_kprintf("\n");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
rt_kprintf("%-*.*s %04d %04d %d\n",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- m->parent.parent.name,
|
|
|
- m->entry,
|
|
|
- m->size,
|
|
|
- rt_list_len(&m->parent.suspend_thread));
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ m->parent.parent.name,
|
|
|
+ m->entry,
|
|
|
+ m->size,
|
|
|
+ rt_list_len(&m->parent.suspend_thread));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- while (next != (rt_list_t*)RT_NULL);
|
|
|
+ while (next != (rt_list_t *)RT_NULL);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list_mailbox, list mail box in system);
|
|
|
MSH_CMD_EXPORT(list_mailbox, list mail box in system);
|
|
|
#endif
|
|
|
|
|
@@ -540,17 +539,18 @@ long list_msgqueue(void)
|
|
|
rt_ubase_t level;
|
|
|
list_get_next_t find_arg;
|
|
|
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
|
|
|
- rt_list_t *next = (rt_list_t*)RT_NULL;
|
|
|
+ rt_list_t *next = (rt_list_t *)RT_NULL;
|
|
|
|
|
|
int maxlen;
|
|
|
const char *item_title = "msgqueue";
|
|
|
|
|
|
- list_find_init(&find_arg, RT_Object_Class_MessageQueue, obj_list, sizeof(obj_list)/sizeof(obj_list[0]));
|
|
|
+ list_find_init(&find_arg, RT_Object_Class_MessageQueue, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
|
|
|
|
|
|
maxlen = RT_NAME_MAX;
|
|
|
|
|
|
- rt_kprintf("%-*.s entry suspend thread\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " ---- --------------\n");
|
|
|
+ rt_kprintf("%-*.s entry suspend thread\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" ---- --------------\n");
|
|
|
do
|
|
|
{
|
|
|
next = list_get_next(next, &find_arg);
|
|
@@ -575,29 +575,28 @@ long list_msgqueue(void)
|
|
|
if (!rt_list_isempty(&m->parent.suspend_thread))
|
|
|
{
|
|
|
rt_kprintf("%-*.*s %04d %d:",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- m->parent.parent.name,
|
|
|
- m->entry,
|
|
|
- rt_list_len(&m->parent.suspend_thread));
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ m->parent.parent.name,
|
|
|
+ m->entry,
|
|
|
+ rt_list_len(&m->parent.suspend_thread));
|
|
|
show_wait_queue(&(m->parent.suspend_thread));
|
|
|
rt_kprintf("\n");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
rt_kprintf("%-*.*s %04d %d\n",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- m->parent.parent.name,
|
|
|
- m->entry,
|
|
|
- rt_list_len(&m->parent.suspend_thread));
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ m->parent.parent.name,
|
|
|
+ m->entry,
|
|
|
+ rt_list_len(&m->parent.suspend_thread));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- while (next != (rt_list_t*)RT_NULL);
|
|
|
+ while (next != (rt_list_t *)RT_NULL);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list_msgqueue, list message queue in system);
|
|
|
MSH_CMD_EXPORT(list_msgqueue, list message queue in system);
|
|
|
#endif
|
|
|
|
|
@@ -607,17 +606,18 @@ long list_memheap(void)
|
|
|
rt_ubase_t level;
|
|
|
list_get_next_t find_arg;
|
|
|
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
|
|
|
- rt_list_t *next = (rt_list_t*)RT_NULL;
|
|
|
+ rt_list_t *next = (rt_list_t *)RT_NULL;
|
|
|
|
|
|
int maxlen;
|
|
|
const char *item_title = "memheap";
|
|
|
|
|
|
- list_find_init(&find_arg, RT_Object_Class_MemHeap, obj_list, sizeof(obj_list)/sizeof(obj_list[0]));
|
|
|
+ list_find_init(&find_arg, RT_Object_Class_MemHeap, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
|
|
|
|
|
|
maxlen = RT_NAME_MAX;
|
|
|
|
|
|
- rt_kprintf("%-*.s pool size max used size available size\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " ---------- ------------- --------------\n");
|
|
|
+ rt_kprintf("%-*.s pool size max used size available size\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" ---------- ------------- --------------\n");
|
|
|
do
|
|
|
{
|
|
|
next = list_get_next(next, &find_arg);
|
|
@@ -641,20 +641,19 @@ long list_memheap(void)
|
|
|
mh = (struct rt_memheap *)obj;
|
|
|
|
|
|
rt_kprintf("%-*.*s %-010d %-013d %-05d\n",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- mh->parent.name,
|
|
|
- mh->pool_size,
|
|
|
- mh->max_used_size,
|
|
|
- mh->available_size);
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ mh->parent.name,
|
|
|
+ mh->pool_size,
|
|
|
+ mh->max_used_size,
|
|
|
+ mh->available_size);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- while (next != (rt_list_t*)RT_NULL);
|
|
|
+ while (next != (rt_list_t *)RT_NULL);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list_memheap, list memory heap in system);
|
|
|
MSH_CMD_EXPORT(list_memheap, list memory heap in system);
|
|
|
#endif
|
|
|
|
|
@@ -664,17 +663,18 @@ long list_mempool(void)
|
|
|
rt_ubase_t level;
|
|
|
list_get_next_t find_arg;
|
|
|
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
|
|
|
- rt_list_t *next = (rt_list_t*)RT_NULL;
|
|
|
+ rt_list_t *next = (rt_list_t *)RT_NULL;
|
|
|
|
|
|
int maxlen;
|
|
|
const char *item_title = "mempool";
|
|
|
|
|
|
- list_find_init(&find_arg, RT_Object_Class_MemPool, obj_list, sizeof(obj_list)/sizeof(obj_list[0]));
|
|
|
+ list_find_init(&find_arg, RT_Object_Class_MemPool, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
|
|
|
|
|
|
maxlen = RT_NAME_MAX;
|
|
|
|
|
|
- rt_kprintf("%-*.s block total free suspend thread\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " ---- ---- ---- --------------\n");
|
|
|
+ rt_kprintf("%-*.s block total free suspend thread\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" ---- ---- ---- --------------\n");
|
|
|
do
|
|
|
{
|
|
|
next = list_get_next(next, &find_arg);
|
|
@@ -708,33 +708,32 @@ long list_mempool(void)
|
|
|
if (suspend_thread_count > 0)
|
|
|
{
|
|
|
rt_kprintf("%-*.*s %04d %04d %04d %d:",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- mp->parent.name,
|
|
|
- mp->block_size,
|
|
|
- mp->block_total_count,
|
|
|
- mp->block_free_count,
|
|
|
- suspend_thread_count);
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ mp->parent.name,
|
|
|
+ mp->block_size,
|
|
|
+ mp->block_total_count,
|
|
|
+ mp->block_free_count,
|
|
|
+ suspend_thread_count);
|
|
|
show_wait_queue(&(mp->suspend_thread));
|
|
|
rt_kprintf("\n");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
rt_kprintf("%-*.*s %04d %04d %04d %d\n",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- mp->parent.name,
|
|
|
- mp->block_size,
|
|
|
- mp->block_total_count,
|
|
|
- mp->block_free_count,
|
|
|
- suspend_thread_count);
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ mp->parent.name,
|
|
|
+ mp->block_size,
|
|
|
+ mp->block_total_count,
|
|
|
+ mp->block_free_count,
|
|
|
+ suspend_thread_count);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- while (next != (rt_list_t*)RT_NULL);
|
|
|
+ while (next != (rt_list_t *)RT_NULL);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list_mempool, list memory pool in system)
|
|
|
MSH_CMD_EXPORT(list_mempool, list memory pool in system);
|
|
|
#endif
|
|
|
|
|
@@ -743,18 +742,20 @@ long list_timer(void)
|
|
|
rt_ubase_t level;
|
|
|
list_get_next_t find_arg;
|
|
|
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
|
|
|
- rt_list_t *next = (rt_list_t*)RT_NULL;
|
|
|
+ rt_list_t *next = (rt_list_t *)RT_NULL;
|
|
|
|
|
|
int maxlen;
|
|
|
const char *item_title = "timer";
|
|
|
|
|
|
- list_find_init(&find_arg, RT_Object_Class_Timer, obj_list, sizeof(obj_list)/sizeof(obj_list[0]));
|
|
|
+ list_find_init(&find_arg, RT_Object_Class_Timer, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
|
|
|
|
|
|
maxlen = RT_NAME_MAX;
|
|
|
|
|
|
- rt_kprintf("%-*.s periodic timeout flag\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " ---------- ---------- -----------\n");
|
|
|
- do {
|
|
|
+ rt_kprintf("%-*.s periodic timeout flag\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" ---------- ---------- -----------\n");
|
|
|
+ do
|
|
|
+ {
|
|
|
next = list_get_next(next, &find_arg);
|
|
|
{
|
|
|
int i;
|
|
@@ -775,10 +776,10 @@ long list_timer(void)
|
|
|
|
|
|
timer = (struct rt_timer *)obj;
|
|
|
rt_kprintf("%-*.*s 0x%08x 0x%08x ",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- timer->parent.name,
|
|
|
- timer->init_tick,
|
|
|
- timer->timeout_tick);
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ timer->parent.name,
|
|
|
+ timer->init_tick,
|
|
|
+ timer->timeout_tick);
|
|
|
if (timer->parent.flag & RT_TIMER_FLAG_ACTIVATED)
|
|
|
rt_kprintf("activated\n");
|
|
|
else
|
|
@@ -787,13 +788,12 @@ long list_timer(void)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- while (next != (rt_list_t*)RT_NULL);
|
|
|
+ while (next != (rt_list_t *)RT_NULL);
|
|
|
|
|
|
rt_kprintf("current tick:0x%08x\n", rt_tick_get());
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list_timer, list timer in system);
|
|
|
MSH_CMD_EXPORT(list_timer, list timer in system);
|
|
|
|
|
|
#ifdef RT_USING_DEVICE
|
|
@@ -831,17 +831,18 @@ long list_device(void)
|
|
|
rt_ubase_t level;
|
|
|
list_get_next_t find_arg;
|
|
|
rt_list_t *obj_list[LIST_FIND_OBJ_NR];
|
|
|
- rt_list_t *next = (rt_list_t*)RT_NULL;
|
|
|
+ rt_list_t *next = (rt_list_t *)RT_NULL;
|
|
|
|
|
|
int maxlen;
|
|
|
const char *item_title = "device";
|
|
|
|
|
|
- list_find_init(&find_arg, RT_Object_Class_Device, obj_list, sizeof(obj_list)/sizeof(obj_list[0]));
|
|
|
+ list_find_init(&find_arg, RT_Object_Class_Device, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
|
|
|
|
|
|
maxlen = RT_NAME_MAX;
|
|
|
|
|
|
- rt_kprintf("%-*.s type ref count\n", maxlen, item_title); object_split(maxlen);
|
|
|
- rt_kprintf( " -------------------- ----------\n");
|
|
|
+ rt_kprintf("%-*.s type ref count\n", maxlen, item_title);
|
|
|
+ object_split(maxlen);
|
|
|
+ rt_kprintf(" -------------------- ----------\n");
|
|
|
do
|
|
|
{
|
|
|
next = list_get_next(next, &find_arg);
|
|
@@ -864,31 +865,25 @@ long list_device(void)
|
|
|
|
|
|
device = (struct rt_device *)obj;
|
|
|
rt_kprintf("%-*.*s %-20s %-8d\n",
|
|
|
- maxlen, RT_NAME_MAX,
|
|
|
- device->parent.name,
|
|
|
- (device->type <= RT_Device_Class_Unknown) ?
|
|
|
- device_type_str[device->type] :
|
|
|
- device_type_str[RT_Device_Class_Unknown],
|
|
|
- device->ref_count);
|
|
|
+ maxlen, RT_NAME_MAX,
|
|
|
+ device->parent.name,
|
|
|
+ (device->type <= RT_Device_Class_Unknown) ?
|
|
|
+ device_type_str[device->type] :
|
|
|
+ device_type_str[RT_Device_Class_Unknown],
|
|
|
+ device->ref_count);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- while (next != (rt_list_t*)RT_NULL);
|
|
|
+ while (next != (rt_list_t *)RT_NULL);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list_device, list device in system);
|
|
|
MSH_CMD_EXPORT(list_device, list device in system);
|
|
|
#endif
|
|
|
|
|
|
long list(void)
|
|
|
{
|
|
|
-#ifndef FINSH_USING_MSH_ONLY
|
|
|
- struct finsh_syscall_item *syscall_item;
|
|
|
- struct finsh_sysvar_item *sysvar_item;
|
|
|
-#endif
|
|
|
-
|
|
|
rt_kprintf("--Function List:\n");
|
|
|
{
|
|
|
struct finsh_syscall *index;
|
|
@@ -907,247 +902,8 @@ long list(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#ifndef FINSH_USING_MSH_ONLY
|
|
|
- /* list syscall list */
|
|
|
- syscall_item = global_syscall_list;
|
|
|
- while (syscall_item != NULL)
|
|
|
- {
|
|
|
- rt_kprintf("[l] %s\n", syscall_item->syscall.name);
|
|
|
- syscall_item = syscall_item->next;
|
|
|
- }
|
|
|
-
|
|
|
- rt_kprintf("--Variable List:\n");
|
|
|
- {
|
|
|
- struct finsh_sysvar *index;
|
|
|
- for (index = _sysvar_table_begin;
|
|
|
- index < _sysvar_table_end;
|
|
|
- FINSH_NEXT_SYSVAR(index))
|
|
|
- {
|
|
|
-#ifdef FINSH_USING_DESCRIPTION
|
|
|
- rt_kprintf("%-16s -- %s\n", index->name, index->desc);
|
|
|
-#else
|
|
|
- rt_kprintf("%s\n", index->name);
|
|
|
-#endif
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- sysvar_item = global_sysvar_list;
|
|
|
- while (sysvar_item != NULL)
|
|
|
- {
|
|
|
- rt_kprintf("[l] %s\n", sysvar_item->sysvar.name);
|
|
|
- sysvar_item = sysvar_item->next;
|
|
|
- }
|
|
|
-#endif
|
|
|
-
|
|
|
return 0;
|
|
|
}
|
|
|
-FINSH_FUNCTION_EXPORT(list, list all symbol in system)
|
|
|
-
|
|
|
-#ifndef FINSH_USING_MSH_ONLY
|
|
|
-static int str_is_prefix(const char *prefix, const char *str)
|
|
|
-{
|
|
|
- while ((*prefix) && (*prefix == *str))
|
|
|
- {
|
|
|
- prefix ++;
|
|
|
- str ++;
|
|
|
- }
|
|
|
-
|
|
|
- if (*prefix == 0)
|
|
|
- return 0;
|
|
|
-
|
|
|
- return -1;
|
|
|
-}
|
|
|
-
|
|
|
-static int str_common(const char *str1, const char *str2)
|
|
|
-{
|
|
|
- const char *str = str1;
|
|
|
-
|
|
|
- while ((*str != 0) && (*str2 != 0) && (*str == *str2))
|
|
|
- {
|
|
|
- str ++;
|
|
|
- str2 ++;
|
|
|
- }
|
|
|
-
|
|
|
- return (str - str1);
|
|
|
-}
|
|
|
-
|
|
|
-void list_prefix(char *prefix)
|
|
|
-{
|
|
|
- struct finsh_syscall_item *syscall_item;
|
|
|
- struct finsh_sysvar_item *sysvar_item;
|
|
|
- rt_uint16_t func_cnt, var_cnt;
|
|
|
- int length, min_length;
|
|
|
- const char *name_ptr;
|
|
|
-
|
|
|
- func_cnt = 0;
|
|
|
- var_cnt = 0;
|
|
|
- min_length = 0;
|
|
|
- name_ptr = RT_NULL;
|
|
|
-
|
|
|
- /* checks in system function call */
|
|
|
- {
|
|
|
- struct finsh_syscall *index;
|
|
|
- for (index = _syscall_table_begin;
|
|
|
- index < _syscall_table_end;
|
|
|
- FINSH_NEXT_SYSCALL(index))
|
|
|
- {
|
|
|
- /* skip internal command */
|
|
|
- if (str_is_prefix("__", index->name) == 0) continue;
|
|
|
-
|
|
|
- if (str_is_prefix(prefix, index->name) == 0)
|
|
|
- {
|
|
|
- if (func_cnt == 0)
|
|
|
- {
|
|
|
- rt_kprintf("--function:\n");
|
|
|
-
|
|
|
- if (*prefix != 0)
|
|
|
- {
|
|
|
- /* set name_ptr */
|
|
|
- name_ptr = index->name;
|
|
|
-
|
|
|
- /* set initial length */
|
|
|
- min_length = strlen(name_ptr);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- func_cnt ++;
|
|
|
-
|
|
|
- if (*prefix != 0)
|
|
|
- {
|
|
|
- length = str_common(name_ptr, index->name);
|
|
|
- if (length < min_length)
|
|
|
- min_length = length;
|
|
|
- }
|
|
|
-
|
|
|
-#ifdef FINSH_USING_DESCRIPTION
|
|
|
- rt_kprintf("%-16s -- %s\n", index->name, index->desc);
|
|
|
-#else
|
|
|
- rt_kprintf("%s\n", index->name);
|
|
|
-#endif
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /* checks in dynamic system function call */
|
|
|
- syscall_item = global_syscall_list;
|
|
|
- while (syscall_item != NULL)
|
|
|
- {
|
|
|
- if (str_is_prefix(prefix, syscall_item->syscall.name) == 0)
|
|
|
- {
|
|
|
- if (func_cnt == 0)
|
|
|
- {
|
|
|
- rt_kprintf("--function:\n");
|
|
|
- if (*prefix != 0 && name_ptr == NULL)
|
|
|
- {
|
|
|
- /* set name_ptr */
|
|
|
- name_ptr = syscall_item->syscall.name;
|
|
|
-
|
|
|
- /* set initial length */
|
|
|
- min_length = strlen(name_ptr);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- func_cnt ++;
|
|
|
-
|
|
|
- if (*prefix != 0)
|
|
|
- {
|
|
|
- length = str_common(name_ptr, syscall_item->syscall.name);
|
|
|
- if (length < min_length)
|
|
|
- min_length = length;
|
|
|
- }
|
|
|
-
|
|
|
- rt_kprintf("[l] %s\n", syscall_item->syscall.name);
|
|
|
- }
|
|
|
- syscall_item = syscall_item->next;
|
|
|
- }
|
|
|
-
|
|
|
- /* checks in system variable */
|
|
|
- {
|
|
|
- struct finsh_sysvar *index;
|
|
|
- for (index = _sysvar_table_begin;
|
|
|
- index < _sysvar_table_end;
|
|
|
- FINSH_NEXT_SYSVAR(index))
|
|
|
- {
|
|
|
- if (str_is_prefix(prefix, index->name) == 0)
|
|
|
- {
|
|
|
- if (var_cnt == 0)
|
|
|
- {
|
|
|
- rt_kprintf("--variable:\n");
|
|
|
-
|
|
|
- if (*prefix != 0 && name_ptr == NULL)
|
|
|
- {
|
|
|
- /* set name_ptr */
|
|
|
- name_ptr = index->name;
|
|
|
-
|
|
|
- /* set initial length */
|
|
|
- min_length = strlen(name_ptr);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var_cnt ++;
|
|
|
-
|
|
|
- if (*prefix != 0)
|
|
|
- {
|
|
|
- length = str_common(name_ptr, index->name);
|
|
|
- if (length < min_length)
|
|
|
- min_length = length;
|
|
|
- }
|
|
|
-
|
|
|
-#ifdef FINSH_USING_DESCRIPTION
|
|
|
- rt_kprintf("%-16s -- %s\n", index->name, index->desc);
|
|
|
-#else
|
|
|
- rt_kprintf("%s\n", index->name);
|
|
|
-#endif
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /* checks in dynamic system variable */
|
|
|
- sysvar_item = global_sysvar_list;
|
|
|
- while (sysvar_item != NULL)
|
|
|
- {
|
|
|
- if (str_is_prefix(prefix, sysvar_item->sysvar.name) == 0)
|
|
|
- {
|
|
|
- if (var_cnt == 0)
|
|
|
- {
|
|
|
- rt_kprintf("--variable:\n");
|
|
|
- if (*prefix != 0 && name_ptr == NULL)
|
|
|
- {
|
|
|
- /* set name_ptr */
|
|
|
- name_ptr = sysvar_item->sysvar.name;
|
|
|
-
|
|
|
- /* set initial length */
|
|
|
- min_length = strlen(name_ptr);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var_cnt ++;
|
|
|
-
|
|
|
- if (*prefix != 0)
|
|
|
- {
|
|
|
- length = str_common(name_ptr, sysvar_item->sysvar.name);
|
|
|
- if (length < min_length)
|
|
|
- min_length = length;
|
|
|
- }
|
|
|
-
|
|
|
- rt_kprintf("[v] %s\n", sysvar_item->sysvar.name);
|
|
|
- }
|
|
|
- sysvar_item = sysvar_item->next;
|
|
|
- }
|
|
|
-
|
|
|
- /* only one matched */
|
|
|
- if (name_ptr != NULL)
|
|
|
- {
|
|
|
- rt_strncpy(prefix, name_ptr, min_length);
|
|
|
- }
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
-#if defined(FINSH_USING_SYMTAB) && !defined(FINSH_USING_MSH_ONLY)
|
|
|
-static int dummy = 0;
|
|
|
-FINSH_VAR_EXPORT(dummy, finsh_type_int, dummy variable for finsh)
|
|
|
-#endif
|
|
|
+MSH_CMD_EXPORT(list, list all symbol in system)
|
|
|
|
|
|
#endif /* RT_USING_FINSH */
|
|
|
-
|