[kernel] 将rt_thread结构体改为显式继承rt_object (#7131)
This commit is contained in:
parent
8a52e65013
commit
93f3cb30e4
|
@ -87,7 +87,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
@ -139,7 +139,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
@ -167,7 +167,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -281,7 +281,7 @@ void exception_isr(void)
|
|||
|
||||
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
|
||||
rt_console_set_device(RT_NULL);
|
||||
rt_kprintf(stack_info, rt_thread_self()->sp, rt_thread_self()->name);
|
||||
rt_kprintf(stack_info, rt_thread_self()->sp, rt_thread_self()->parent.name);
|
||||
#endif
|
||||
|
||||
while (1);
|
||||
|
|
|
@ -54,7 +54,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
@ -92,7 +92,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
@ -128,7 +128,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -253,9 +253,9 @@ void rt_hw_hard_fault_exception(struct exception_stack_frame *contex)
|
|||
|
||||
#ifdef RT_USING_SMP
|
||||
rt_thread_t rt_current_thread = rt_thread_self();
|
||||
rt_kprintf("hard fault on cpu : %d on thread: %s\n", rt_current_thread->oncpu, rt_current_thread->name);
|
||||
rt_kprintf("hard fault on cpu : %d on thread: %s\n", rt_current_thread->oncpu, rt_current_thread->parent.name);
|
||||
#else
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->parent.name);
|
||||
#endif
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -143,7 +143,7 @@ rt_module_t rt_module_self(void)
|
|||
return RT_NULL;
|
||||
|
||||
/* return current module */
|
||||
return (rt_module_t)tid->module_id;
|
||||
return (rt_module_t)tid->parent.module_id;
|
||||
}
|
||||
RTM_EXPORT(rt_module_self);
|
||||
|
||||
|
@ -319,7 +319,7 @@ rt_module_t rt_module_open(const char *path)
|
|||
module->module_entry));
|
||||
|
||||
/* set module id */
|
||||
module->module_thread->module_id = (void *)module;
|
||||
module->module_thread->parent.module_id = (void *)module;
|
||||
module->parent.flag = RT_MODULE_FLAG_WITHENTRY;
|
||||
|
||||
/* startup module thread */
|
||||
|
@ -520,11 +520,11 @@ rt_module_t rt_module_exec_cmd(const char *path, const char* cmd_line, int line_
|
|||
2048, RT_THREAD_PRIORITY_MAX - 2, 10);
|
||||
|
||||
/* set module id */
|
||||
module->module_thread->module_id = (void *)module;
|
||||
module->module_thread->parent.module_id = (void *)module;
|
||||
module->parent.flag = RT_MODULE_FLAG_WITHENTRY;
|
||||
|
||||
/* startup module thread */
|
||||
rt_thread_startup(module->module_thread);
|
||||
rt_thread_startup(module->parent.module_thread);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -26,9 +26,9 @@ static void thread1_entry(void* parameter)
|
|||
while (1)
|
||||
{
|
||||
rt_sem_release(&sem2);
|
||||
rt_kprintf("thread1..: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("thread1..: %s\n", rt_thread_self()->parent.name);
|
||||
rt_sem_take(&sem1, RT_WAITING_FOREVER);
|
||||
rt_kprintf("get semaphore: %s!\n", rt_thread_self()->name);
|
||||
rt_kprintf("thread1..: %s\n", rt_thread_self()->parent.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ static void thread2_entry(void* parameter)
|
|||
while (1)
|
||||
{
|
||||
rt_sem_take(&sem2, RT_WAITING_FOREVER);
|
||||
rt_kprintf("thread2--->: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("thread2--->: %s\n", rt_thread_self()->parent.name);
|
||||
rt_sem_release(&sem1);
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ static void thread1_entry(void* parameter)
|
|||
rt_uint32_t count = 0;
|
||||
while (1)
|
||||
{
|
||||
rt_kprintf("%s: count = %d\n", rt_thread_self()->name, count ++);
|
||||
rt_kprintf("%s: count = %d\n", rt_thread_self()->parent.name, count ++);
|
||||
|
||||
rt_thread_delay(10);
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ static void _thread_inited_hook(rt_thread_t thread)
|
|||
if ((stk_start + stack_size) >= TASK_STACK_USING_MEM_UPPER_RANGE)
|
||||
{
|
||||
rt_kprintf("thread[%s] stack only between 0x%08x and 0x%08x, please use rt_create_thread()!!\n",
|
||||
thread->name, TASK_STACK_USING_MEM_LOWER_RANGE, TASK_STACK_USING_MEM_UPPER_RANGE);
|
||||
thread->parent.name, TASK_STACK_USING_MEM_LOWER_RANGE, TASK_STACK_USING_MEM_UPPER_RANGE);
|
||||
}
|
||||
RT_ASSERT((stk_start + stack_size) < TASK_STACK_USING_MEM_UPPER_RANGE);
|
||||
}
|
||||
|
|
|
@ -204,12 +204,12 @@ long list_thread(void)
|
|||
|
||||
#ifdef RT_USING_SMP
|
||||
if (thread->oncpu != RT_CPU_DETACHED)
|
||||
rt_kprintf("%-*.*s %3d %3d %4d ", maxlen, RT_NAME_MAX, thread->name, thread->oncpu, thread->bind_cpu, thread->current_priority);
|
||||
rt_kprintf("%-*.*s %3d %3d %4d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->oncpu, thread->bind_cpu, thread->current_priority);
|
||||
else
|
||||
rt_kprintf("%-*.*s N/A %3d %4d ", maxlen, RT_NAME_MAX, thread->name, thread->bind_cpu, thread->current_priority);
|
||||
rt_kprintf("%-*.*s N/A %3d %4d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->bind_cpu, thread->current_priority);
|
||||
|
||||
#else
|
||||
rt_kprintf("%-*.*s %3d ", maxlen, RT_NAME_MAX, thread->name, thread->current_priority);
|
||||
rt_kprintf("%-*.*s %3d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->current_priority);
|
||||
#endif /*RT_USING_SMP*/
|
||||
stat = (thread->stat & RT_THREAD_STAT_MASK);
|
||||
if (stat == RT_THREAD_READY) rt_kprintf(" ready ");
|
||||
|
@ -256,7 +256,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", RT_NAME_MAX, thread->name);
|
||||
rt_kprintf("%.*s", RT_NAME_MAX, thread->parent.name);
|
||||
|
||||
if (node->next != list)
|
||||
rt_kprintf("/");
|
||||
|
@ -439,7 +439,7 @@ long list_mutex(void)
|
|||
maxlen, RT_NAME_MAX,
|
||||
m->parent.parent.name,
|
||||
RT_NAME_MAX,
|
||||
m->owner->name,
|
||||
m->owner->parent.name,
|
||||
m->hold,
|
||||
m->priority,
|
||||
rt_list_len(&m->parent.suspend_thread));
|
||||
|
@ -452,7 +452,7 @@ long list_mutex(void)
|
|||
maxlen, RT_NAME_MAX,
|
||||
m->parent.parent.name,
|
||||
RT_NAME_MAX,
|
||||
m->owner->name,
|
||||
m->owner->parent.name,
|
||||
m->hold,
|
||||
m->priority,
|
||||
rt_list_len(&m->parent.suspend_thread));
|
||||
|
|
|
@ -20,7 +20,7 @@ void __rt_libc_exit(int status)
|
|||
|
||||
if (self != RT_NULL)
|
||||
{
|
||||
LOG_W("thread:%s exit:%d!", self->name, status);
|
||||
LOG_W("thread:%s exit:%d!", self->parent.name, status);
|
||||
#ifdef RT_USING_PTHREADS
|
||||
if(self->pthread_data != RT_NULL)
|
||||
{
|
||||
|
|
|
@ -197,7 +197,7 @@ struct rt_dlmodule *dlmodule_create(void)
|
|||
|
||||
void dlmodule_destroy_subthread(struct rt_dlmodule *module, rt_thread_t thread)
|
||||
{
|
||||
RT_ASSERT(thread->module_id == module);
|
||||
RT_ASSERT(thread->parent.module_id== module);
|
||||
|
||||
/* lock scheduler to prevent scheduling in cleanup function. */
|
||||
rt_enter_critical();
|
||||
|
@ -225,7 +225,7 @@ void dlmodule_destroy_subthread(struct rt_dlmodule *module, rt_thread_t thread)
|
|||
rt_thread_free_sig(thread);
|
||||
#endif
|
||||
|
||||
if (thread->type & RT_Object_Class_Static)
|
||||
if (thread->parent.type & RT_Object_Class_Static)
|
||||
{
|
||||
/* detach object */
|
||||
rt_object_detach((rt_object_t)thread);
|
||||
|
@ -409,7 +409,7 @@ struct rt_dlmodule *dlmodule_self(void)
|
|||
tid = rt_thread_self();
|
||||
if (tid)
|
||||
{
|
||||
ret = (struct rt_dlmodule*) tid->module_id;
|
||||
ret = (struct rt_dlmodule*) tid->parent.module_id;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -555,7 +555,7 @@ struct rt_dlmodule* dlmodule_exec(const char* pgname, const char* cmd, int cmd_s
|
|||
module->stack_size, module->priority, 10);
|
||||
if (tid)
|
||||
{
|
||||
tid->module_id = module;
|
||||
tid->parent.module_id= module;
|
||||
module->main_thread = tid;
|
||||
|
||||
rt_thread_startup(tid);
|
||||
|
@ -732,7 +732,7 @@ struct rt_dlmodule* dlmodule_exec_custom(const char* pgname, const char* cmd, in
|
|||
module->stack_size, module->priority, 10);
|
||||
if (tid)
|
||||
{
|
||||
tid->module_id = module;
|
||||
tid->parent.module_id= module;
|
||||
module->main_thread = tid;
|
||||
|
||||
rt_thread_startup(tid);
|
||||
|
|
|
@ -48,7 +48,7 @@ int arch_expand_user_stack(void *addr)
|
|||
else /* map failed, send signal SIGSEGV */
|
||||
{
|
||||
#ifdef RT_USING_SIGNALS
|
||||
dbg_log(DBG_ERROR, "[fault] thread %s mapped addr %p failed!\n", rt_thread_self()->name, addr);
|
||||
dbg_log(DBG_ERROR, "[fault] thread %s mapped addr %p failed!\n", rt_thread_self()->parent.name, addr);
|
||||
lwp_thread_kill(rt_thread_self(), SIGSEGV);
|
||||
ret = 1; /* return 1, will return back to intr, then check exit */
|
||||
#endif
|
||||
|
@ -57,7 +57,7 @@ int arch_expand_user_stack(void *addr)
|
|||
else /* not stack, send signal SIGSEGV */
|
||||
{
|
||||
#ifdef RT_USING_SIGNALS
|
||||
dbg_log(DBG_ERROR, "[fault] thread %s access unmapped addr %p!\n", rt_thread_self()->name, addr);
|
||||
dbg_log(DBG_ERROR, "[fault] thread %s access unmapped addr %p!\n", rt_thread_self()->parent.name, addr);
|
||||
lwp_thread_kill(rt_thread_self(), SIGSEGV);
|
||||
ret = 1; /* return 1, will return back to intr, then check exit */
|
||||
#endif
|
||||
|
|
|
@ -1034,7 +1034,7 @@ void lwp_cleanup(struct rt_thread *tid)
|
|||
return;
|
||||
}
|
||||
|
||||
LOG_I("cleanup thread: %s, stack_addr: %08X", tid->name, tid->stack_addr);
|
||||
LOG_I("cleanup thread: %s, stack_addr: %08X", tid->parent.name, tid->stack_addr);
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
lwp = (struct rt_lwp *)tid->lwp;
|
||||
|
|
|
@ -709,11 +709,11 @@ static void print_thread_info(struct rt_thread* thread, int maxlen)
|
|||
|
||||
#ifdef RT_USING_SMP
|
||||
if (thread->oncpu != RT_CPU_DETACHED)
|
||||
rt_kprintf("%-*.*s %3d %3d ", maxlen, RT_NAME_MAX, thread->name, thread->oncpu, thread->current_priority);
|
||||
rt_kprintf("%-*.*s %3d %3d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->oncpu, thread->current_priority);
|
||||
else
|
||||
rt_kprintf("%-*.*s N/A %3d ", maxlen, RT_NAME_MAX, thread->name, thread->current_priority);
|
||||
rt_kprintf("%-*.*s N/A %3d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->current_priority);
|
||||
#else
|
||||
rt_kprintf("%-*.*s %3d ", maxlen, RT_NAME_MAX, thread->name, thread->current_priority);
|
||||
rt_kprintf("%-*.*s %3d ", maxlen, RT_NAME_MAX, thread->parent.name, thread->current_priority);
|
||||
#endif /*RT_USING_SMP*/
|
||||
|
||||
stat = (thread->stat & RT_THREAD_STAT_MASK);
|
||||
|
@ -787,7 +787,7 @@ long list_process(void)
|
|||
|
||||
thread = threads[index];
|
||||
level = rt_hw_interrupt_disable();
|
||||
if ((thread->type & ~RT_Object_Class_Static) != RT_Object_Class_Thread)
|
||||
if ((thread->parent.type & ~RT_Object_Class_Static) != RT_Object_Class_Thread)
|
||||
{
|
||||
rt_hw_interrupt_enable(level);
|
||||
continue;
|
||||
|
|
|
@ -1525,7 +1525,7 @@ long _sys_clone(void *arg[])
|
|||
goto fail;
|
||||
}
|
||||
|
||||
thread = rt_thread_create(self->name,
|
||||
thread = rt_thread_create(self->parent.name,
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
self->stack_size,
|
||||
|
@ -1713,7 +1713,7 @@ sysret_t _sys_fork(void)
|
|||
/* create thread */
|
||||
self_thread = rt_thread_self();
|
||||
|
||||
thread = rt_thread_create(self_thread->name,
|
||||
thread = rt_thread_create(self_thread->parent.name,
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
self_thread->stack_size,
|
||||
|
@ -2361,7 +2361,7 @@ sysret_t sys_execve(const char *path, char *const argv[], char *const envp[])
|
|||
/* load ok, now set thread name and swap the data of lwp and new_lwp */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
rt_strncpy(thread->name, run_name + last_backslash, RT_NAME_MAX);
|
||||
rt_strncpy(thread->parent.name, run_name + last_backslash, RT_NAME_MAX);
|
||||
|
||||
rt_pages_free(page, 0);
|
||||
|
||||
|
@ -2420,7 +2420,7 @@ rt_err_t sys_thread_delete(rt_thread_t thread)
|
|||
#else
|
||||
rt_err_t ret = 0;
|
||||
|
||||
if(thread->type != RT_Object_Class_Thread)
|
||||
if(thread->parent.type != RT_Object_Class_Thread)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
goto __exit;
|
||||
|
|
|
@ -525,7 +525,7 @@ void sys_arch_unprotect(sys_prot_t pval)
|
|||
void sys_arch_assert(const char *file, int line)
|
||||
{
|
||||
rt_kprintf("\nAssertion: %d in %s, thread %s\n",
|
||||
line, file, rt_thread_self()->name);
|
||||
line, file, rt_thread_self()->parent.name);
|
||||
RT_ASSERT(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ rt_weak rt_size_t syslog_formater(char *log_buf, int level, const char *tag, rt_
|
|||
/* is not in interrupt context */
|
||||
if (rt_interrupt_get_nest() == 0)
|
||||
{
|
||||
log_len += ulog_strcpy(log_len, log_buf + log_len, rt_thread_self()->name);
|
||||
log_len += ulog_strcpy(log_len, log_buf + log_len, rt_thread_self()->parent.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -352,7 +352,7 @@ rt_weak rt_size_t ulog_head_formater(char *log_buf, rt_uint32_t level, const cha
|
|||
const char *thread_name = "N/A";
|
||||
if (rt_thread_self())
|
||||
{
|
||||
thread_name = rt_thread_self()->name;
|
||||
thread_name = rt_thread_self()->parent.name;
|
||||
}
|
||||
name_len = rt_strnlen(thread_name, RT_NAME_MAX);
|
||||
rt_strncpy(log_buf + log_len, thread_name, name_len);
|
||||
|
|
|
@ -46,7 +46,7 @@ void rt_wm_que_dump(struct rt_watermark_queue *wg)
|
|||
thread = rt_list_entry(wg->suspended_threads.next,
|
||||
struct rt_thread,
|
||||
tlist);
|
||||
rt_kprintf(" %.*s", RT_NAME_MAX, thread->name);
|
||||
rt_kprintf(" %.*s", RT_NAME_MAX, thread->parent.name);
|
||||
}
|
||||
rt_kprintf("\n");
|
||||
}
|
||||
|
|
|
@ -744,24 +744,7 @@ struct rt_user_context
|
|||
*/
|
||||
struct rt_thread
|
||||
{
|
||||
/* rt object */
|
||||
#if RT_NAME_MAX > 0
|
||||
char name[RT_NAME_MAX]; /**< dynamic name of kernel object */
|
||||
#else
|
||||
const char *name; /**< static name of kernel object */
|
||||
#endif /* RT_NAME_MAX > 0 */
|
||||
rt_uint8_t type; /**< type of object */
|
||||
rt_uint8_t flags; /**< thread's flags */
|
||||
|
||||
#ifdef RT_USING_MODULE
|
||||
void *module_id; /**< id of application module */
|
||||
#endif /* RT_USING_MODULE */
|
||||
|
||||
#ifdef RT_USING_SMART
|
||||
int lwp_ref_count; /**< ref count for lwp */
|
||||
#endif /* RT_USING_SMART */
|
||||
|
||||
rt_list_t list; /**< the object list */
|
||||
struct rt_object parent;
|
||||
rt_list_t tlist; /**< the thread list */
|
||||
|
||||
/* stack point and entry */
|
||||
|
|
|
@ -289,7 +289,7 @@ void rt_hw_trap_exception(struct rt_hw_exp_stack *regs)
|
|||
#endif
|
||||
process_exception(esr, regs->pc);
|
||||
rt_hw_show_register(regs);
|
||||
rt_kprintf("current: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("current: %s\n", rt_thread_self()->parent.name);
|
||||
#ifdef RT_USING_LWP
|
||||
check_user_fault(regs, 0, "user fault");
|
||||
#endif
|
||||
|
@ -304,7 +304,7 @@ void rt_hw_trap_serror(struct rt_hw_exp_stack *regs)
|
|||
{
|
||||
rt_kprintf("SError\n");
|
||||
rt_hw_show_register(regs);
|
||||
rt_kprintf("current: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("current: %s\n", rt_thread_self()->parent.name);
|
||||
#ifdef RT_USING_FINSH
|
||||
list_thread();
|
||||
#endif
|
||||
|
|
|
@ -41,7 +41,7 @@ void rt_hw_trap_fiq(void)
|
|||
extern struct rt_thread* rt_current_thread;
|
||||
void rt_hw_trap_abort(void)
|
||||
{
|
||||
rt_kprintf("Abort occured!!! Thread [%s] suspended.\n",rt_current_thread->name);
|
||||
rt_kprintf("Abort occured!!! Thread [%s] suspended.\n",rt_current_thread->parent.name);
|
||||
rt_thread_suspend(rt_current_thread);
|
||||
rt_schedule();
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
@ -103,7 +103,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
@ -131,7 +131,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -88,7 +88,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
@ -140,7 +140,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread - %.*s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
@ -168,7 +168,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread - %.*s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -108,7 +108,7 @@ void rt_hw_hard_fault_exception(struct exception_stack_frame *contex)
|
|||
rt_kprintf("r01: 0x%08x\n", contex->r1);
|
||||
rt_kprintf("r00: 0x%08x\n", contex->r0);
|
||||
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -109,7 +109,7 @@ void rt_hw_hard_fault_exception(struct exception_stack_frame *contex)
|
|||
rt_kprintf("r01: 0x%08x\n", contex->r1);
|
||||
rt_kprintf("r00: 0x%08x\n", contex->r0);
|
||||
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -325,7 +325,7 @@ void rt_hw_hard_fault_exception(struct exception_info * exception_info)
|
|||
|
||||
if(exception_info->exc_return & (1 << 2) )
|
||||
{
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -462,7 +462,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
|
|||
|
||||
if (exception_info->exc_return & (1 << 2))
|
||||
{
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -405,7 +405,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
|
|||
|
||||
if (exception_info->exc_return & (1 << 2))
|
||||
{
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -404,7 +404,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
|
|||
|
||||
if (exception_info->exc_return & (1 << 2))
|
||||
{
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -50,7 +50,7 @@ void rt_hw_trap_udef(struct rt_hw_exp_stack *regs)
|
|||
rt_kprintf("undefined instruction\n");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
|||
rt_kprintf("undefined instruction\n");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ void rt_hw_trap_swi(struct rt_hw_register *regs)
|
|||
rt_kprintf("software interrupt\n");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
|||
rt_kprintf("prefetch abort\n");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
|||
rt_kprintf("Data Abort ");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
|
|||
rt_kprintf("not used\n");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
@ -94,7 +94,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
@ -115,7 +115,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
|
|
@ -53,7 +53,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
|
@ -89,7 +89,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
|
@ -108,7 +108,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
|
|
|
@ -388,7 +388,7 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc, uintptr_t * sp)
|
|||
rt_kprintf("\n");
|
||||
print_stack_frame(sp);
|
||||
rt_kprintf("exception pc => 0x%08x\n", epc);
|
||||
rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->name);
|
||||
rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->parent.name);
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
#endif
|
||||
|
|
|
@ -131,7 +131,7 @@ extern struct rt_thread *rt_current_thread;
|
|||
|
||||
static char *_get_elf_name(size_t sepc)
|
||||
{
|
||||
return IN_USERSPACE ? rt_current_thread->name : "rtthread.elf";
|
||||
return IN_USERSPACE ? rt_current_thread->parent.name : "rtthread.elf";
|
||||
}
|
||||
|
||||
#endif /* RT_USING_SMART */
|
||||
|
|
|
@ -220,7 +220,7 @@ void handle_user(rt_size_t scause, rt_size_t stval, rt_size_t sepc, struct rt_hw
|
|||
|
||||
rt_hw_backtrace((uint32_t *)sp->s0_fp, sepc);
|
||||
|
||||
LOG_E("User Fault, killing thread: %s", rt_thread_self()->name);
|
||||
LOG_E("User Fault, killing thread: %s", rt_thread_self()->parent.name);
|
||||
|
||||
EXIT_TRAP;
|
||||
sys_exit(-1);
|
||||
|
@ -332,7 +332,7 @@ void handle_trap(rt_size_t scause, rt_size_t stval, rt_size_t sepc, struct rt_hw
|
|||
rt_kprintf("scause:0x%p,stval:0x%p,sepc:0x%p\n", scause, stval, sepc);
|
||||
dump_regs(sp);
|
||||
rt_kprintf("--------------Thread list--------------\n");
|
||||
rt_kprintf("current thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("current thread: %s\n", rt_thread_self()->parent.name);
|
||||
|
||||
extern struct rt_thread *rt_current_thread;
|
||||
rt_kprintf("--------------Backtrace--------------\n");
|
||||
|
|
|
@ -131,7 +131,7 @@ extern struct rt_thread *rt_current_thread;
|
|||
|
||||
static char *_get_elf_name(size_t sepc)
|
||||
{
|
||||
return IN_USERSPACE ? rt_current_thread->name : "rtthread.elf";
|
||||
return IN_USERSPACE ? rt_current_thread->parent.name : "rtthread.elf";
|
||||
}
|
||||
|
||||
#endif /* RT_USING_SMART */
|
||||
|
|
|
@ -217,7 +217,7 @@ void handle_user(rt_size_t scause, rt_size_t stval, rt_size_t sepc, struct rt_hw
|
|||
|
||||
rt_hw_backtrace((uint32_t *)sp->s0_fp, sepc);
|
||||
|
||||
LOG_E("User Fault, killing thread: %s", rt_thread_self()->name);
|
||||
LOG_E("User Fault, killing thread: %s", rt_thread_self()->parent.name);
|
||||
|
||||
EXIT_TRAP;
|
||||
sys_exit(-1);
|
||||
|
@ -344,7 +344,7 @@ void handle_trap(rt_size_t scause, rt_size_t stval, rt_size_t sepc, struct rt_hw
|
|||
rt_kprintf("scause:0x%p,stval:0x%p,sepc:0x%p\n", scause, stval, sepc);
|
||||
dump_regs(sp);
|
||||
rt_kprintf("--------------Thread list--------------\n");
|
||||
rt_kprintf("current thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("current thread: %s\n", rt_thread_self()->parent.name);
|
||||
|
||||
extern struct rt_thread *rt_current_thread;
|
||||
rt_kprintf("--------------Backtrace--------------\n");
|
||||
|
|
|
@ -126,7 +126,7 @@ void rt_hw_hard_fault_exception(struct stack_frame* exception_contex)
|
|||
rt_kprintf("acchi: 0x%08x\n", exception_contex->ACCHI);
|
||||
rt_kprintf("acclo: 0x%08x\n", exception_contex->ACCLO);
|
||||
}
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->parent.name);
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
#endif
|
||||
|
|
|
@ -163,11 +163,11 @@ static void *thread_run(void *parameter)
|
|||
|
||||
tid = rt_thread_self();
|
||||
TRACE("pid <%08x> tid <%s> starts...\n", (unsigned int)(thread->pthread),
|
||||
tid->name);
|
||||
tid->parent.name);
|
||||
thread->rtthread = tid;
|
||||
thread->task(thread->para);
|
||||
TRACE("pid <%08x> tid <%s> exit...\n", (unsigned int)(thread->pthread),
|
||||
tid->name);
|
||||
tid->parent.name);
|
||||
thread->exit();
|
||||
|
||||
/*TODO:
|
||||
|
|
|
@ -147,7 +147,7 @@ static DWORD WINAPI thread_run( LPVOID lpThreadParameter )
|
|||
rt_thread_t tid = rt_thread_self();
|
||||
win_thread_t *pWinThread = (win_thread_t *)lpThreadParameter;
|
||||
|
||||
SetThreadName(GetCurrentThreadId(), tid->name);
|
||||
SetThreadName(GetCurrentThreadId(), tid->parent.name);
|
||||
|
||||
pWinThread->Entry(pWinThread->Param);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ void rt_hw_trap_extn(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("extn instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
|
@ -89,7 +89,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
|
@ -108,7 +108,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
|||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
|
|
|
@ -207,7 +207,7 @@ static void rt_defunct_execute(void)
|
|||
break;
|
||||
}
|
||||
#ifdef RT_USING_MODULE
|
||||
module = (struct rt_dlmodule*)thread->module_id;
|
||||
module = (struct rt_dlmodule*)thread->parent.module_id;
|
||||
if (module)
|
||||
{
|
||||
dlmodule_destroy(module);
|
||||
|
|
36
src/ipc.c
36
src/ipc.c
|
@ -209,7 +209,7 @@ rt_inline rt_err_t _ipc_list_resume(rt_list_t *list)
|
|||
|
||||
thread->error = RT_EOK;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("resume thread:%s\n", thread->name));
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("resume thread:%s\n", thread->parent.name));
|
||||
|
||||
/* resume it */
|
||||
rt_thread_resume(thread);
|
||||
|
@ -509,8 +509,8 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag)
|
|||
level = rt_hw_interrupt_disable();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("thread %s take sem:%s, which value is: %d\n",
|
||||
rt_thread_self()->name,
|
||||
((struct rt_object *)sem)->name,
|
||||
rt_thread_self()->parent.name,
|
||||
sem->parent.parent.name,
|
||||
sem->value));
|
||||
|
||||
if (sem->value > 0)
|
||||
|
@ -542,8 +542,7 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag)
|
|||
/* reset thread error number */
|
||||
thread->error = -RT_EINTR;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("sem take: suspend thread - %s\n",
|
||||
thread->name));
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("sem take: suspend thread - %s\n", thread->parent.name));
|
||||
|
||||
/* suspend thread */
|
||||
ret = _ipc_list_suspend(&(sem->parent.suspend_thread),
|
||||
|
@ -559,8 +558,7 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag)
|
|||
/* has waiting time, start thread timer */
|
||||
if (timeout > 0)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n",
|
||||
thread->name));
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n", thread->parent.name));
|
||||
|
||||
/* reset the timeout of thread timer and start it */
|
||||
rt_timer_control(&(thread->thread_timer),
|
||||
|
@ -655,8 +653,8 @@ rt_err_t rt_sem_release(rt_sem_t sem)
|
|||
level = rt_hw_interrupt_disable();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("thread %s releases sem:%s, which value is: %d\n",
|
||||
rt_thread_self()->name,
|
||||
((struct rt_object *)sem)->name,
|
||||
rt_thread_self()->parent.name,
|
||||
sem->parent.parent.name,
|
||||
sem->value));
|
||||
|
||||
if (!rt_list_isempty(&sem->parent.suspend_thread))
|
||||
|
@ -789,7 +787,7 @@ rt_inline void _thread_update_priority(struct rt_thread *thread, rt_uint8_t prio
|
|||
{
|
||||
rt_err_t ret;
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC,
|
||||
("thread:%s priority -> %d\n", thread->name, priority));
|
||||
("thread:%s priority -> %d\n", thread->parent.name, priority));
|
||||
|
||||
/* change priority of the thread */
|
||||
rt_thread_control(thread,
|
||||
|
@ -1182,7 +1180,7 @@ static rt_err_t _rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout, int suspend
|
|||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC,
|
||||
("mutex_take: current thread %s, hold: %d\n",
|
||||
thread->name, mutex->hold));
|
||||
thread->parent.name, mutex->hold));
|
||||
|
||||
/* reset thread error */
|
||||
thread->error = RT_EOK;
|
||||
|
@ -1239,7 +1237,7 @@ static rt_err_t _rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout, int suspend
|
|||
|
||||
/* mutex is unavailable, push to suspend list */
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mutex_take: suspend thread: %s\n",
|
||||
thread->name));
|
||||
thread->parent.name));
|
||||
|
||||
/* suspend current thread */
|
||||
ret = _ipc_list_suspend(&(mutex->parent.suspend_thread),
|
||||
|
@ -1270,7 +1268,7 @@ static rt_err_t _rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout, int suspend
|
|||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC,
|
||||
("mutex_take: start the timer of thread:%s\n",
|
||||
thread->name));
|
||||
thread->parent.name));
|
||||
|
||||
/* reset the timeout of thread timer and start it */
|
||||
rt_timer_control(&(thread->thread_timer),
|
||||
|
@ -1424,7 +1422,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
|
|||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC,
|
||||
("mutex_release:current thread %s, hold: %d\n",
|
||||
thread->name, mutex->hold));
|
||||
thread->parent.name, mutex->hold));
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(mutex->parent.parent)));
|
||||
|
||||
|
@ -1471,7 +1469,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
|
|||
tlist);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mutex_release: resume thread: %s\n",
|
||||
next_thread->name));
|
||||
next_thread->parent.name));
|
||||
|
||||
/* remove the thread from the suspended list of mutex */
|
||||
rt_list_remove(&(next_thread->tlist));
|
||||
|
@ -2418,7 +2416,7 @@ static rt_err_t _rt_mb_send_wait(rt_mailbox_t mb,
|
|||
tick_delta = rt_tick_get();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mb_send_wait: start timer of thread:%s\n",
|
||||
thread->name));
|
||||
thread->parent.name));
|
||||
|
||||
/* reset the timeout of thread timer and start it */
|
||||
rt_timer_control(&(thread->thread_timer),
|
||||
|
@ -2712,7 +2710,7 @@ static rt_err_t _rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeo
|
|||
tick_delta = rt_tick_get();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mb_recv: start timer of thread:%s\n",
|
||||
thread->name));
|
||||
thread->parent.name));
|
||||
|
||||
/* reset the timeout of thread timer and start it */
|
||||
rt_timer_control(&(thread->thread_timer),
|
||||
|
@ -3259,7 +3257,7 @@ static rt_err_t _rt_mq_send_wait(rt_mq_t mq,
|
|||
tick_delta = rt_tick_get();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mq_send_wait: start timer of thread:%s\n",
|
||||
thread->name));
|
||||
thread->parent.name));
|
||||
|
||||
/* reset the timeout of thread timer and start it */
|
||||
rt_timer_control(&(thread->thread_timer),
|
||||
|
@ -3614,7 +3612,7 @@ static rt_err_t _rt_mq_recv(rt_mq_t mq,
|
|||
tick_delta = rt_tick_get();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n",
|
||||
thread->name));
|
||||
thread->parent.name));
|
||||
|
||||
/* reset the timeout of thread timer and start it */
|
||||
rt_timer_control(&(thread->thread_timer),
|
||||
|
|
|
@ -375,7 +375,7 @@ void *rt_smem_alloc(rt_smem_t m, rt_size_t size)
|
|||
mem->pool_ptr = MEM_USED();
|
||||
#ifdef RT_USING_MEMTRACE
|
||||
if (rt_thread_self())
|
||||
rt_smem_setname(mem, rt_thread_self()->name);
|
||||
rt_smem_setname(mem, rt_thread_self()->parent.name);
|
||||
else
|
||||
rt_smem_setname(mem, "NONE");
|
||||
#endif /* RT_USING_MEMTRACE */
|
||||
|
|
|
@ -312,7 +312,7 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size)
|
|||
|
||||
#ifdef RT_USING_MEMTRACE
|
||||
if (rt_thread_self())
|
||||
rt_memcpy(header_ptr->owner_thread_name, rt_thread_self()->name, sizeof(header_ptr->owner_thread_name));
|
||||
rt_memcpy(header_ptr->owner_thread_name, rt_thread_self()->parent.name, sizeof(header_ptr->owner_thread_name));
|
||||
else
|
||||
rt_memcpy(header_ptr->owner_thread_name, "NONE", sizeof(header_ptr->owner_thread_name));
|
||||
#endif /* RT_USING_MEMTRACE */
|
||||
|
|
|
@ -112,7 +112,7 @@ static void _scheduler_stack_check(struct rt_thread *thread)
|
|||
{
|
||||
rt_base_t level;
|
||||
|
||||
rt_kprintf("thread:%s stack overflow\n", thread->name);
|
||||
rt_kprintf("thread:%s stack overflow\n", thread->parent.name);
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
while (level);
|
||||
|
@ -121,13 +121,13 @@ static void _scheduler_stack_check(struct rt_thread *thread)
|
|||
else if ((rt_ubase_t)thread->sp > ((rt_ubase_t)thread->stack_addr + thread->stack_size))
|
||||
{
|
||||
rt_kprintf("warning: %s stack is close to the top of stack address.\n",
|
||||
thread->name);
|
||||
thread->parent.name);
|
||||
}
|
||||
#else
|
||||
else if ((rt_ubase_t)thread->sp <= ((rt_ubase_t)thread->stack_addr + 32))
|
||||
{
|
||||
rt_kprintf("warning: %s stack is close to end of stack address.\n",
|
||||
thread->name);
|
||||
thread->parent.name);
|
||||
}
|
||||
#endif /* ARCH_CPU_STACK_GROWS_UPWARD */
|
||||
}
|
||||
|
@ -349,8 +349,8 @@ void rt_schedule(void)
|
|||
"thread:%.*s(sp:0x%08x), "
|
||||
"from thread:%.*s(sp: 0x%08x)\n",
|
||||
pcpu->irq_nest, highest_ready_priority,
|
||||
RT_NAME_MAX, to_thread->name, to_thread->sp,
|
||||
RT_NAME_MAX, current_thread->name, current_thread->sp));
|
||||
RT_NAME_MAX, to_thread->parent.name, to_thread->sp,
|
||||
RT_NAME_MAX, current_thread->parent.name, current_thread->sp));
|
||||
|
||||
#ifdef RT_USING_OVERFLOW_CHECK
|
||||
_scheduler_stack_check(to_thread);
|
||||
|
@ -584,7 +584,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
|
|||
}
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("insert thread[%.*s], the priority: %d\n",
|
||||
RT_NAME_MAX, thread->name, thread->current_priority));
|
||||
RT_NAME_MAX, thread->parent.name, thread->current_priority));
|
||||
|
||||
__exit:
|
||||
/* enable interrupt */
|
||||
|
@ -608,7 +608,7 @@ void rt_schedule_remove_thread(struct rt_thread *thread)
|
|||
level = rt_hw_interrupt_disable();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("remove thread[%.*s], the priority: %d\n",
|
||||
RT_NAME_MAX, thread->name,
|
||||
RT_NAME_MAX, thread->parent.name,
|
||||
thread->current_priority));
|
||||
|
||||
/* remove thread from ready list */
|
||||
|
|
|
@ -117,7 +117,7 @@ static void _scheduler_stack_check(struct rt_thread *thread)
|
|||
{
|
||||
rt_base_t level;
|
||||
|
||||
rt_kprintf("thread:%s stack overflow\n", thread->name);
|
||||
rt_kprintf("thread:%s stack overflow\n", thread->parent.name);
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
while (level);
|
||||
|
@ -126,13 +126,13 @@ static void _scheduler_stack_check(struct rt_thread *thread)
|
|||
else if ((rt_ubase_t)thread->sp > ((rt_ubase_t)thread->stack_addr + thread->stack_size))
|
||||
{
|
||||
rt_kprintf("warning: %s stack is close to the top of stack address.\n",
|
||||
thread->name);
|
||||
thread->parent.name);
|
||||
}
|
||||
#else
|
||||
else if ((rt_ubase_t)thread->sp <= ((rt_ubase_t)thread->stack_addr + 32))
|
||||
{
|
||||
rt_kprintf("warning: %s stack is close to end of stack address.\n",
|
||||
thread->name);
|
||||
thread->parent.name);
|
||||
}
|
||||
#endif /* ARCH_CPU_STACK_GROWS_UPWARD */
|
||||
}
|
||||
|
@ -281,8 +281,8 @@ void rt_schedule(void)
|
|||
"thread:%.*s(sp:0x%08x), "
|
||||
"from thread:%.*s(sp: 0x%08x)\n",
|
||||
rt_interrupt_nest, highest_ready_priority,
|
||||
RT_NAME_MAX, to_thread->name, to_thread->sp,
|
||||
RT_NAME_MAX, from_thread->name, from_thread->sp));
|
||||
RT_NAME_MAX, to_thread->parent.name, to_thread->sp,
|
||||
RT_NAME_MAX, from_thread->parent.name, from_thread->sp));
|
||||
|
||||
#ifdef RT_USING_OVERFLOW_CHECK
|
||||
_scheduler_stack_check(to_thread);
|
||||
|
@ -384,7 +384,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
|
|||
}
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("insert thread[%.*s], the priority: %d\n",
|
||||
RT_NAME_MAX, thread->name, thread->current_priority));
|
||||
RT_NAME_MAX, thread->parent.name, thread->current_priority));
|
||||
|
||||
/* set priority mask */
|
||||
#if RT_THREAD_PRIORITY_MAX > 32
|
||||
|
@ -414,7 +414,7 @@ void rt_schedule_remove_thread(struct rt_thread *thread)
|
|||
level = rt_hw_interrupt_disable();
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("remove thread[%.*s], the priority: %d\n",
|
||||
RT_NAME_MAX, thread->name,
|
||||
RT_NAME_MAX, thread->parent.name,
|
||||
thread->current_priority));
|
||||
|
||||
/* remove thread from ready list */
|
||||
|
|
10
src/thread.c
10
src/thread.c
|
@ -237,7 +237,7 @@ static rt_err_t _thread_init(struct rt_thread *thread,
|
|||
|
||||
/* initialize thread timer */
|
||||
rt_timer_init(&(thread->thread_timer),
|
||||
thread->name,
|
||||
thread->parent.name,
|
||||
_thread_timeout,
|
||||
thread,
|
||||
0,
|
||||
|
@ -274,7 +274,7 @@ static rt_err_t _thread_init(struct rt_thread *thread,
|
|||
#endif /* RT_USING_PTHREADS */
|
||||
|
||||
#ifdef RT_USING_MODULE
|
||||
thread->module_id = 0;
|
||||
thread->parent.module_id = 0;
|
||||
#endif /* RT_USING_MODULE */
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_thread_inited_hook, (thread));
|
||||
|
@ -386,7 +386,7 @@ rt_err_t rt_thread_startup(rt_thread_t thread)
|
|||
#endif /* RT_THREAD_PRIORITY_MAX > 32 */
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_THREAD, ("startup a thread:%s with priority:%d\n",
|
||||
thread->name, thread->current_priority));
|
||||
thread->parent.name, thread->current_priority));
|
||||
/* change thread stat */
|
||||
thread->stat = RT_THREAD_SUSPEND;
|
||||
/* then resume it */
|
||||
|
@ -983,7 +983,7 @@ rt_err_t rt_thread_suspend_with_flag(rt_thread_t thread, int suspend_flag)
|
|||
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
|
||||
RT_ASSERT(thread == rt_thread_self());
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread suspend: %s\n", thread->name));
|
||||
RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread suspend: %s\n", thread->parent.name));
|
||||
|
||||
stat = thread->stat & RT_THREAD_STAT_MASK;
|
||||
if ((stat != RT_THREAD_READY) && (stat != RT_THREAD_RUNNING))
|
||||
|
@ -1046,7 +1046,7 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
|
|||
RT_ASSERT(thread != RT_NULL);
|
||||
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread resume: %s\n", thread->name));
|
||||
RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread resume: %s\n", thread->parent.name));
|
||||
|
||||
if ((thread->stat & RT_THREAD_SUSPEND_MASK) != RT_THREAD_SUSPEND_MASK)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue