diff --git a/src/cpu.c b/src/cpu.c index a7d56ba999..fc1fed5a06 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -11,13 +11,13 @@ #include #ifdef RT_USING_SMP -static struct rt_cpu rt_cpus[RT_CPUS_NR]; +static struct rt_cpu _cpus[RT_CPUS_NR]; rt_hw_spinlock_t _cpus_lock; /* * disable scheduler */ -static void rt_preempt_disable(void) +static void _cpu_preempt_disable(void) { register rt_base_t level; struct rt_thread *current_thread; @@ -42,7 +42,7 @@ static void rt_preempt_disable(void) /* * enable scheduler */ -static void rt_preempt_enable(void) +static void _cpu_preempt_enable(void) { register rt_base_t level; struct rt_thread *current_thread; @@ -73,7 +73,7 @@ RTM_EXPORT(rt_spin_lock_init) void rt_spin_lock(struct rt_spinlock *lock) { - rt_preempt_disable(); + _cpu_preempt_disable(); rt_hw_spin_lock(&lock->lock); } RTM_EXPORT(rt_spin_lock) @@ -81,7 +81,7 @@ RTM_EXPORT(rt_spin_lock) void rt_spin_unlock(struct rt_spinlock *lock) { rt_hw_spin_unlock(&lock->lock); - rt_preempt_enable(); + _cpu_preempt_enable(); } RTM_EXPORT(rt_spin_unlock) @@ -89,7 +89,7 @@ rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock) { unsigned long level; - rt_preempt_disable(); + _cpu_preempt_disable(); level = rt_hw_local_irq_disable(); rt_hw_spin_lock(&lock->lock); @@ -103,7 +103,7 @@ void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level) rt_hw_spin_unlock(&lock->lock); rt_hw_local_irq_enable(level); - rt_preempt_enable(); + _cpu_preempt_enable(); } RTM_EXPORT(rt_spin_unlock_irqrestore) @@ -112,12 +112,12 @@ RTM_EXPORT(rt_spin_unlock_irqrestore) */ struct rt_cpu *rt_cpu_self(void) { - return &rt_cpus[rt_hw_cpu_id()]; + return &_cpus[rt_hw_cpu_id()]; } struct rt_cpu *rt_cpu_index(int index) { - return &rt_cpus[index]; + return &_cpus[index]; } /** diff --git a/src/object.c b/src/object.c index ff96037c52..718b0aa5b2 100644 --- a/src/object.c +++ b/src/object.c @@ -23,7 +23,7 @@ #endif /* RT_USING_MODULE */ /* - * define object_info for the number of rt_object_container items. + * define object_info for the number of _object_container items. */ enum rt_object_info_type { @@ -60,8 +60,9 @@ enum rt_object_info_type }; #define _OBJ_CONTAINER_LIST_INIT(c) \ - {&(rt_object_container[c].object_list), &(rt_object_container[c].object_list)} -static struct rt_object_information rt_object_container[RT_Object_Info_Unknown] = + {&(_object_container[c].object_list), &(_object_container[c].object_list)} + +static struct rt_object_information _object_container[RT_Object_Info_Unknown] = { /* initialize object container - thread */ {RT_Object_Class_Thread, _OBJ_CONTAINER_LIST_INIT(RT_Object_Info_Thread), sizeof(struct rt_thread)}, @@ -211,7 +212,7 @@ rt_object_get_information(enum rt_object_class_type type) int index; for (index = 0; index < RT_Object_Info_Unknown; index ++) - if (rt_object_container[index].type == type) return &rt_object_container[index]; + if (_object_container[index].type == type) return &_object_container[index]; return RT_NULL; } diff --git a/src/signal.c b/src/signal.c index bb7706d9ef..c5ae2a709a 100644 --- a/src/signal.c +++ b/src/signal.c @@ -35,7 +35,7 @@ struct siginfo_node struct rt_slist_node list; }; -static struct rt_mempool *_rt_siginfo_pool; +static struct rt_mempool *_siginfo_pool; static void _signal_deliver(rt_thread_t tid); void rt_thread_handle_sig(rt_bool_t clean_state); @@ -538,7 +538,7 @@ int rt_thread_kill(rt_thread_t tid, int sig) } rt_hw_interrupt_enable(level); - si_node = (struct siginfo_node *) rt_mp_alloc(_rt_siginfo_pool, 0); + si_node = (struct siginfo_node *) rt_mp_alloc(_siginfo_pool, 0); if (si_node) { rt_slist_init(&(si_node->list)); @@ -576,8 +576,8 @@ int rt_thread_kill(rt_thread_t tid, int sig) int rt_system_signal_init(void) { - _rt_siginfo_pool = rt_mp_create("signal", RT_SIG_INFO_MAX, sizeof(struct siginfo_node)); - if (_rt_siginfo_pool == RT_NULL) + _siginfo_pool = rt_mp_create("signal", RT_SIG_INFO_MAX, sizeof(struct siginfo_node)); + if (_siginfo_pool == RT_NULL) { LOG_E("create memory pool for signal info failed."); RT_ASSERT(0); diff --git a/src/thread.c b/src/thread.c index 60e6ab91d1..7e0c10bfef 100644 --- a/src/thread.c +++ b/src/thread.c @@ -77,7 +77,7 @@ void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread)) #endif /* RT_USING_HOOK */ /* must be invoke witch rt_hw_interrupt_disable */ -static void _rt_thread_cleanup_execute(rt_thread_t thread) +static void _thread_cleanup_execute(rt_thread_t thread) { register rt_base_t level; #ifdef RT_USING_MODULE @@ -101,7 +101,7 @@ static void _rt_thread_cleanup_execute(rt_thread_t thread) rt_hw_interrupt_enable(level); } -static void _rt_thread_exit(void) +static void _thread_exit(void) { struct rt_thread *thread; register rt_base_t level; @@ -112,7 +112,7 @@ static void _rt_thread_exit(void) /* disable interrupt */ level = rt_hw_interrupt_disable(); - _rt_thread_cleanup_execute(thread); + _thread_cleanup_execute(thread); /* remove from schedule */ rt_schedule_remove_thread(thread); @@ -139,14 +139,14 @@ static void _rt_thread_exit(void) rt_hw_interrupt_enable(level); } -static rt_err_t _rt_thread_init(struct rt_thread *thread, - const char *name, - void (*entry)(void *parameter), - void *parameter, - void *stack_start, - rt_uint32_t stack_size, - rt_uint8_t priority, - rt_uint32_t tick) +static rt_err_t _thread_init(struct rt_thread *thread, + const char *name, + void (*entry)(void *parameter), + void *parameter, + void *stack_start, + rt_uint32_t stack_size, + rt_uint8_t priority, + rt_uint32_t tick) { /* init thread list */ rt_list_init(&(thread->tlist)); @@ -163,11 +163,11 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread, #ifdef ARCH_CPU_STACK_GROWS_UPWARD thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter, (void *)((char *)thread->stack_addr), - (void *)_rt_thread_exit); + (void *)_thread_exit); #else thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter, (rt_uint8_t *)((char *)thread->stack_addr + thread->stack_size - sizeof(rt_ubase_t)), - (void *)_rt_thread_exit); + (void *)_thread_exit); #endif /* ARCH_CPU_STACK_GROWS_UPWARD */ /* priority init */ @@ -274,14 +274,14 @@ rt_err_t rt_thread_init(struct rt_thread *thread, /* initialize thread object */ rt_object_init((rt_object_t)thread, RT_Object_Class_Thread, name); - return _rt_thread_init(thread, - name, - entry, - parameter, - stack_start, - stack_size, - priority, - tick); + return _thread_init(thread, + name, + entry, + parameter, + stack_start, + stack_size, + priority, + tick); } RTM_EXPORT(rt_thread_init); @@ -376,7 +376,7 @@ rt_err_t rt_thread_detach(rt_thread_t thread) rt_schedule_remove_thread(thread); } - _rt_thread_cleanup_execute(thread); + _thread_cleanup_execute(thread); /* release thread timer */ rt_timer_detach(&(thread->thread_timer)); @@ -440,7 +440,7 @@ rt_thread_t rt_thread_create(const char *name, return RT_NULL; } - _rt_thread_init(thread, + _thread_init(thread, name, entry, parameter, @@ -479,7 +479,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread) rt_schedule_remove_thread(thread); } - _rt_thread_cleanup_execute(thread); + _thread_cleanup_execute(thread); /* release thread timer */ rt_timer_detach(&(thread->thread_timer));