提交 8b53609f 编写于 作者: mysterywolf's avatar mysterywolf

[kernel] 补充endif后缀注释(3)

上级 e019a57f
...@@ -74,7 +74,7 @@ void rt_mem_set_tag(void *ptr, const char *name) ...@@ -74,7 +74,7 @@ void rt_mem_set_tag(void *ptr, const char *name)
rt_memheap_setname(item, name); rt_memheap_setname(item, name);
} }
} }
#endif #endif /* RT_USING_MEMTRACE */
/* /*
* The initialized memory pool will be: * The initialized memory pool will be:
...@@ -127,7 +127,7 @@ rt_err_t rt_memheap_init(struct rt_memheap *memheap, ...@@ -127,7 +127,7 @@ rt_err_t rt_memheap_init(struct rt_memheap *memheap,
#ifdef RT_USING_MEMTRACE #ifdef RT_USING_MEMTRACE
rt_memset(item->owner_thread_name, ' ', sizeof(item->owner_thread_name)); rt_memset(item->owner_thread_name, ' ', sizeof(item->owner_thread_name));
#endif #endif /* RT_USING_MEMTRACE */
item->next = (struct rt_memheap_item *) item->next = (struct rt_memheap_item *)
((rt_uint8_t *)item + memheap->available_size + RT_MEMHEAP_SIZE); ((rt_uint8_t *)item + memheap->available_size + RT_MEMHEAP_SIZE);
...@@ -252,7 +252,7 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size) ...@@ -252,7 +252,7 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size)
#ifdef RT_USING_MEMTRACE #ifdef RT_USING_MEMTRACE
rt_memset(new_ptr->owner_thread_name, ' ', sizeof(new_ptr->owner_thread_name)); rt_memset(new_ptr->owner_thread_name, ' ', sizeof(new_ptr->owner_thread_name));
#endif #endif /* RT_USING_MEMTRACE */
/* break down the block list */ /* break down the block list */
new_ptr->prev = header_ptr; new_ptr->prev = header_ptr;
...@@ -310,7 +310,7 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size) ...@@ -310,7 +310,7 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size)
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()->name, sizeof(header_ptr->owner_thread_name));
else else
rt_memcpy(header_ptr->owner_thread_name, "NONE", sizeof(header_ptr->owner_thread_name)); rt_memcpy(header_ptr->owner_thread_name, "NONE", sizeof(header_ptr->owner_thread_name));
#endif #endif /* RT_USING_MEMTRACE */
/* release lock */ /* release lock */
rt_sem_release(&(heap->lock)); rt_sem_release(&(heap->lock));
...@@ -439,7 +439,7 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize) ...@@ -439,7 +439,7 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize)
#ifdef RT_USING_MEMTRACE #ifdef RT_USING_MEMTRACE
rt_memset(next_ptr->owner_thread_name, ' ', sizeof(next_ptr->owner_thread_name)); rt_memset(next_ptr->owner_thread_name, ' ', sizeof(next_ptr->owner_thread_name));
#endif #endif /* RT_USING_MEMTRACE */
next_ptr->prev = header_ptr; next_ptr->prev = header_ptr;
next_ptr->next = header_ptr->next; next_ptr->next = header_ptr->next;
...@@ -507,7 +507,7 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize) ...@@ -507,7 +507,7 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize)
#ifdef RT_USING_MEMTRACE #ifdef RT_USING_MEMTRACE
rt_memset(new_ptr->owner_thread_name, ' ', sizeof(new_ptr->owner_thread_name)); rt_memset(new_ptr->owner_thread_name, ' ', sizeof(new_ptr->owner_thread_name));
#endif #endif /* RT_USING_MEMTRACE */
/* break down the block list */ /* break down the block list */
new_ptr->prev = header_ptr; new_ptr->prev = header_ptr;
...@@ -660,7 +660,7 @@ void rt_memheap_free(void *ptr) ...@@ -660,7 +660,7 @@ void rt_memheap_free(void *ptr)
#ifdef RT_USING_MEMTRACE #ifdef RT_USING_MEMTRACE
rt_memset(header_ptr->owner_thread_name, ' ', sizeof(header_ptr->owner_thread_name)); rt_memset(header_ptr->owner_thread_name, ' ', sizeof(header_ptr->owner_thread_name));
#endif #endif /* RT_USING_MEMTRACE */
/* release lock */ /* release lock */
rt_sem_release(&(heap->lock)); rt_sem_release(&(heap->lock));
...@@ -750,7 +750,7 @@ int memheaptrace(void) ...@@ -750,7 +750,7 @@ int memheaptrace(void)
return 0; return 0;
} }
MSH_CMD_EXPORT(memheaptrace, dump memory trace information); MSH_CMD_EXPORT(memheaptrace, dump memory trace information);
#endif #endif /* RT_USING_FINSH */
#ifdef RT_USING_MEMHEAP_AS_HEAP #ifdef RT_USING_MEMHEAP_AS_HEAP
static struct rt_memheap _heap; static struct rt_memheap _heap;
...@@ -816,7 +816,7 @@ void *rt_malloc(rt_size_t size) ...@@ -816,7 +816,7 @@ void *rt_malloc(rt_size_t size)
RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("malloc => 0x%08x : %d", ptr, size)); RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("malloc => 0x%08x : %d", ptr, size));
} }
#endif #endif /* RT_USING_MEMTRACE */
return ptr; return ptr;
} }
...@@ -882,7 +882,7 @@ void *rt_realloc(void *rmem, rt_size_t newsize) ...@@ -882,7 +882,7 @@ void *rt_realloc(void *rmem, rt_size_t newsize)
RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("realloc => 0x%08x : %d", RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("realloc => 0x%08x : %d",
new_ptr, newsize)); new_ptr, newsize));
} }
#endif #endif /* RT_USING_MEMTRACE */
return new_ptr; return new_ptr;
} }
...@@ -912,7 +912,7 @@ void *rt_calloc(rt_size_t count, rt_size_t size) ...@@ -912,7 +912,7 @@ void *rt_calloc(rt_size_t count, rt_size_t size)
RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("calloc => 0x%08x : %d", RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("calloc => 0x%08x : %d",
ptr, count * size)); ptr, count * size));
} }
#endif #endif /* RT_USING_MEMTRACE */
return ptr; return ptr;
} }
...@@ -932,7 +932,7 @@ void rt_memory_info(rt_uint32_t *total, ...@@ -932,7 +932,7 @@ void rt_memory_info(rt_uint32_t *total,
*max_used = _heap.max_used_size; *max_used = _heap.max_used_size;
} }
#endif #endif /* RT_USING_MEMHEAP_AS_HEAP */
#ifdef RT_USING_MEMTRACE #ifdef RT_USING_MEMTRACE
...@@ -1004,8 +1004,8 @@ void memtrace_heap() ...@@ -1004,8 +1004,8 @@ void memtrace_heap()
#ifdef RT_USING_FINSH #ifdef RT_USING_FINSH
#include <finsh.h> #include <finsh.h>
MSH_CMD_EXPORT(memtrace_heap, dump memory trace for heap); MSH_CMD_EXPORT(memtrace_heap, dump memory trace for heap);
#endif /* end of RT_USING_FINSH */ #endif /* RT_USING_FINSH */
#endif /* end of RT_USING_MEMTRACE */ #endif /* RT_USING_MEMTRACE */
#endif /* end of RT_USING_MEMHEAP */ #endif /* RT_USING_MEMHEAP */
...@@ -54,7 +54,7 @@ void rt_mp_free_sethook(void (*hook)(struct rt_mempool *mp, void *block)) ...@@ -54,7 +54,7 @@ void rt_mp_free_sethook(void (*hook)(struct rt_mempool *mp, void *block))
} }
/**@}*/ /**@}*/
#endif #endif /* RT_USING_HOOK */
/** /**
* @addtogroup MM * @addtogroup MM
...@@ -290,7 +290,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp) ...@@ -290,7 +290,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp)
return RT_EOK; return RT_EOK;
} }
RTM_EXPORT(rt_mp_delete); RTM_EXPORT(rt_mp_delete);
#endif #endif /* RT_USING_HEAP */
/** /**
* This function will allocate a block from memory pool * This function will allocate a block from memory pool
...@@ -451,5 +451,4 @@ RTM_EXPORT(rt_mp_free); ...@@ -451,5 +451,4 @@ RTM_EXPORT(rt_mp_free);
/**@}*/ /**@}*/
#endif #endif /* RT_USING_MEMPOOL */
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#ifdef RT_USING_MODULE #ifdef RT_USING_MODULE
#include <dlmodule.h> #include <dlmodule.h>
#endif #endif /* RT_USING_MODULE */
/* /*
* define object_info for the number of rt_object_container items. * define object_info for the number of rt_object_container items.
...@@ -189,7 +189,7 @@ void rt_object_put_sethook(void (*hook)(struct rt_object *object)) ...@@ -189,7 +189,7 @@ void rt_object_put_sethook(void (*hook)(struct rt_object *object))
} }
/**@}*/ /**@}*/
#endif #endif /* RT_USING_HOOK */
/** /**
* @addtogroup KernelObject * @addtogroup KernelObject
...@@ -305,7 +305,7 @@ void rt_object_init(struct rt_object *object, ...@@ -305,7 +305,7 @@ void rt_object_init(struct rt_object *object,
struct rt_object_information *information; struct rt_object_information *information;
#ifdef RT_USING_MODULE #ifdef RT_USING_MODULE
struct rt_dlmodule *module = dlmodule_self(); struct rt_dlmodule *module = dlmodule_self();
#endif #endif /* RT_USING_MODULE */
/* get object information */ /* get object information */
information = rt_object_get_information(type); information = rt_object_get_information(type);
...@@ -349,7 +349,7 @@ void rt_object_init(struct rt_object *object, ...@@ -349,7 +349,7 @@ void rt_object_init(struct rt_object *object,
object->module_id = (void *)module; object->module_id = (void *)module;
} }
else else
#endif #endif /* RT_USING_MODULE */
{ {
/* insert object into information object list */ /* insert object into information object list */
rt_list_insert_after(&(information->object_list), &(object->list)); rt_list_insert_after(&(information->object_list), &(object->list));
...@@ -403,7 +403,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name) ...@@ -403,7 +403,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
struct rt_object_information *information; struct rt_object_information *information;
#ifdef RT_USING_MODULE #ifdef RT_USING_MODULE
struct rt_dlmodule *module = dlmodule_self(); struct rt_dlmodule *module = dlmodule_self();
#endif #endif /* RT_USING_MODULE */
RT_DEBUG_NOT_IN_INTERRUPT; RT_DEBUG_NOT_IN_INTERRUPT;
...@@ -444,7 +444,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name) ...@@ -444,7 +444,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
object->module_id = (void *)module; object->module_id = (void *)module;
} }
else else
#endif #endif /* RT_USING_MODULE */
{ {
/* insert object into information object list */ /* insert object into information object list */
rt_list_insert_after(&(information->object_list), &(object->list)); rt_list_insert_after(&(information->object_list), &(object->list));
...@@ -487,7 +487,7 @@ void rt_object_delete(rt_object_t object) ...@@ -487,7 +487,7 @@ void rt_object_delete(rt_object_t object)
/* free the memory of object */ /* free the memory of object */
RT_KERNEL_FREE(object); RT_KERNEL_FREE(object);
} }
#endif #endif /* RT_USING_HEAP */
/** /**
* This function will judge the object is system object or not. * This function will judge the object is system object or not.
......
...@@ -38,14 +38,14 @@ rt_uint32_t rt_thread_ready_priority_group; ...@@ -38,14 +38,14 @@ rt_uint32_t rt_thread_ready_priority_group;
#if RT_THREAD_PRIORITY_MAX > 32 #if RT_THREAD_PRIORITY_MAX > 32
/* Maximum priority level, 256 */ /* Maximum priority level, 256 */
rt_uint8_t rt_thread_ready_table[32]; rt_uint8_t rt_thread_ready_table[32];
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
#ifndef RT_USING_SMP #ifndef RT_USING_SMP
extern volatile rt_uint8_t rt_interrupt_nest; extern volatile rt_uint8_t rt_interrupt_nest;
static rt_int16_t rt_scheduler_lock_nest; static rt_int16_t rt_scheduler_lock_nest;
struct rt_thread *rt_current_thread = RT_NULL; struct rt_thread *rt_current_thread = RT_NULL;
rt_uint8_t rt_current_priority; rt_uint8_t rt_current_priority;
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
rt_list_t rt_thread_defunct; rt_list_t rt_thread_defunct;
...@@ -71,18 +71,18 @@ rt_scheduler_sethook(void (*hook)(struct rt_thread *from, struct rt_thread *to)) ...@@ -71,18 +71,18 @@ rt_scheduler_sethook(void (*hook)(struct rt_thread *from, struct rt_thread *to))
} }
/**@}*/ /**@}*/
#endif #endif /* RT_USING_HOOK */
#ifdef RT_USING_OVERFLOW_CHECK #ifdef RT_USING_OVERFLOW_CHECK
static void _rt_scheduler_stack_check(struct rt_thread *thread) static void _rt_scheduler_stack_check(struct rt_thread *thread)
{ {
RT_ASSERT(thread != RT_NULL); RT_ASSERT(thread != RT_NULL);
#if defined(ARCH_CPU_STACK_GROWS_UPWARD) #ifdef ARCH_CPU_STACK_GROWS_UPWARD
if (*((rt_uint8_t *)((rt_ubase_t)thread->stack_addr + thread->stack_size - 1)) != '#' || if (*((rt_uint8_t *)((rt_ubase_t)thread->stack_addr + thread->stack_size - 1)) != '#' ||
#else #else
if (*((rt_uint8_t *)thread->stack_addr) != '#' || if (*((rt_uint8_t *)thread->stack_addr) != '#' ||
#endif #endif /* ARCH_CPU_STACK_GROWS_UPWARD */
(rt_ubase_t)thread->sp <= (rt_ubase_t)thread->stack_addr || (rt_ubase_t)thread->sp <= (rt_ubase_t)thread->stack_addr ||
(rt_ubase_t)thread->sp > (rt_ubase_t)thread->sp >
(rt_ubase_t)thread->stack_addr + (rt_ubase_t)thread->stack_size) (rt_ubase_t)thread->stack_addr + (rt_ubase_t)thread->stack_size)
...@@ -94,7 +94,7 @@ static void _rt_scheduler_stack_check(struct rt_thread *thread) ...@@ -94,7 +94,7 @@ static void _rt_scheduler_stack_check(struct rt_thread *thread)
level = rt_hw_interrupt_disable(); level = rt_hw_interrupt_disable();
while (level); while (level);
} }
#if defined(ARCH_CPU_STACK_GROWS_UPWARD) #ifdef ARCH_CPU_STACK_GROWS_UPWARD
else if ((rt_ubase_t)thread->sp > ((rt_ubase_t)thread->stack_addr + thread->stack_size)) 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", rt_kprintf("warning: %s stack is close to the top of stack address.\n",
...@@ -106,9 +106,9 @@ static void _rt_scheduler_stack_check(struct rt_thread *thread) ...@@ -106,9 +106,9 @@ static void _rt_scheduler_stack_check(struct rt_thread *thread)
rt_kprintf("warning: %s stack is close to end of stack address.\n", rt_kprintf("warning: %s stack is close to end of stack address.\n",
thread->name); thread->name);
} }
#endif #endif /* ARCH_CPU_STACK_GROWS_UPWARD */
} }
#endif #endif /* RT_USING_OVERFLOW_CHECK */
/* /*
* get the highest priority thread in ready queue * get the highest priority thread in ready queue
...@@ -129,7 +129,7 @@ static struct rt_thread* _get_highest_priority_thread(rt_ubase_t *highest_prio) ...@@ -129,7 +129,7 @@ static struct rt_thread* _get_highest_priority_thread(rt_ubase_t *highest_prio)
#else #else
highest_ready_priority = __rt_ffs(rt_thread_ready_priority_group) - 1; highest_ready_priority = __rt_ffs(rt_thread_ready_priority_group) - 1;
local_highest_ready_priority = __rt_ffs(pcpu->priority_group) - 1; local_highest_ready_priority = __rt_ffs(pcpu->priority_group) - 1;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
/* get highest ready priority thread */ /* get highest ready priority thread */
if (highest_ready_priority < local_highest_ready_priority) if (highest_ready_priority < local_highest_ready_priority)
...@@ -162,7 +162,7 @@ static struct rt_thread* _get_highest_priority_thread(rt_ubase_t *highest_prio) ...@@ -162,7 +162,7 @@ static struct rt_thread* _get_highest_priority_thread(rt_ubase_t *highest_prio)
highest_ready_priority = (number << 3) + __rt_ffs(rt_thread_ready_table[number]) - 1; highest_ready_priority = (number << 3) + __rt_ffs(rt_thread_ready_table[number]) - 1;
#else #else
highest_ready_priority = __rt_ffs(rt_thread_ready_priority_group) - 1; highest_ready_priority = __rt_ffs(rt_thread_ready_priority_group) - 1;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
/* get highest ready priority thread */ /* get highest ready priority thread */
highest_priority_thread = rt_list_entry(rt_thread_priority_table[highest_ready_priority].next, highest_priority_thread = rt_list_entry(rt_thread_priority_table[highest_ready_priority].next,
...@@ -173,7 +173,7 @@ static struct rt_thread* _get_highest_priority_thread(rt_ubase_t *highest_prio) ...@@ -173,7 +173,7 @@ static struct rt_thread* _get_highest_priority_thread(rt_ubase_t *highest_prio)
return highest_priority_thread; return highest_priority_thread;
} }
#endif #endif /* RT_USING_SMP */
/** /**
* @ingroup SystemInit * @ingroup SystemInit
...@@ -183,12 +183,12 @@ void rt_system_scheduler_init(void) ...@@ -183,12 +183,12 @@ void rt_system_scheduler_init(void)
{ {
#ifdef RT_USING_SMP #ifdef RT_USING_SMP
int cpu; int cpu;
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
register rt_base_t offset; register rt_base_t offset;
#ifndef RT_USING_SMP #ifndef RT_USING_SMP
rt_scheduler_lock_nest = 0; rt_scheduler_lock_nest = 0;
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("start scheduler: max priority 0x%02x\n", RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("start scheduler: max priority 0x%02x\n",
RT_THREAD_PRIORITY_MAX)); RT_THREAD_PRIORITY_MAX));
...@@ -213,9 +213,9 @@ void rt_system_scheduler_init(void) ...@@ -213,9 +213,9 @@ void rt_system_scheduler_init(void)
#if RT_THREAD_PRIORITY_MAX > 32 #if RT_THREAD_PRIORITY_MAX > 32
rt_memset(pcpu->ready_table, 0, sizeof(pcpu->ready_table)); rt_memset(pcpu->ready_table, 0, sizeof(pcpu->ready_table));
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
} }
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
/* initialize ready priority group */ /* initialize ready priority group */
rt_thread_ready_priority_group = 0; rt_thread_ready_priority_group = 0;
...@@ -223,7 +223,7 @@ void rt_system_scheduler_init(void) ...@@ -223,7 +223,7 @@ void rt_system_scheduler_init(void)
#if RT_THREAD_PRIORITY_MAX > 32 #if RT_THREAD_PRIORITY_MAX > 32
/* initialize ready table */ /* initialize ready table */
rt_memset(rt_thread_ready_table, 0, sizeof(rt_thread_ready_table)); rt_memset(rt_thread_ready_table, 0, sizeof(rt_thread_ready_table));
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
/* initialize thread defunct */ /* initialize thread defunct */
rt_list_init(&rt_thread_defunct); rt_list_init(&rt_thread_defunct);
...@@ -245,7 +245,7 @@ void rt_system_scheduler_start(void) ...@@ -245,7 +245,7 @@ void rt_system_scheduler_start(void)
to_thread->oncpu = rt_hw_cpu_id(); to_thread->oncpu = rt_hw_cpu_id();
#else #else
rt_current_thread = to_thread; rt_current_thread = to_thread;
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
rt_schedule_remove_thread(to_thread); rt_schedule_remove_thread(to_thread);
to_thread->stat = RT_THREAD_RUNNING; to_thread->stat = RT_THREAD_RUNNING;
...@@ -255,7 +255,7 @@ void rt_system_scheduler_start(void) ...@@ -255,7 +255,7 @@ void rt_system_scheduler_start(void)
rt_hw_context_switch_to((rt_ubase_t)&to_thread->sp, to_thread); rt_hw_context_switch_to((rt_ubase_t)&to_thread->sp, to_thread);
#else #else
rt_hw_context_switch_to((rt_ubase_t)&to_thread->sp); rt_hw_context_switch_to((rt_ubase_t)&to_thread->sp);
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
/* never come back */ /* never come back */
} }
...@@ -319,7 +319,7 @@ void rt_schedule(void) ...@@ -319,7 +319,7 @@ void rt_schedule(void)
rt_thread_resume(current_thread); rt_thread_resume(current_thread);
} }
} }
#endif #endif /* RT_USING_SIGNALS */
if (current_thread->scheduler_lock_nest == 1) /* whether lock scheduler */ if (current_thread->scheduler_lock_nest == 1) /* whether lock scheduler */
{ {
...@@ -367,7 +367,7 @@ void rt_schedule(void) ...@@ -367,7 +367,7 @@ void rt_schedule(void)
#ifdef RT_USING_OVERFLOW_CHECK #ifdef RT_USING_OVERFLOW_CHECK
_rt_scheduler_stack_check(to_thread); _rt_scheduler_stack_check(to_thread);
#endif #endif /* RT_USING_OVERFLOW_CHECK */
rt_hw_context_switch((rt_ubase_t)&current_thread->sp, rt_hw_context_switch((rt_ubase_t)&current_thread->sp,
(rt_ubase_t)&to_thread->sp, to_thread); (rt_ubase_t)&to_thread->sp, to_thread);
...@@ -396,7 +396,7 @@ void rt_schedule(void) ...@@ -396,7 +396,7 @@ void rt_schedule(void)
{ {
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
} }
#endif #endif /* RT_USING_SIGNALS */
__exit: __exit:
return ; return ;
...@@ -472,7 +472,7 @@ void rt_schedule(void) ...@@ -472,7 +472,7 @@ void rt_schedule(void)
#ifdef RT_USING_OVERFLOW_CHECK #ifdef RT_USING_OVERFLOW_CHECK
_rt_scheduler_stack_check(to_thread); _rt_scheduler_stack_check(to_thread);
#endif #endif /* RT_USING_OVERFLOW_CHECK */
if (rt_interrupt_nest == 0) if (rt_interrupt_nest == 0)
{ {
...@@ -502,7 +502,7 @@ void rt_schedule(void) ...@@ -502,7 +502,7 @@ void rt_schedule(void)
{ {
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
} }
#endif #endif /* RT_USING_SIGNALS */
goto __exit; goto __exit;
} }
else else
...@@ -527,7 +527,7 @@ void rt_schedule(void) ...@@ -527,7 +527,7 @@ void rt_schedule(void)
__exit: __exit:
return; return;
} }
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
/** /**
* This function checks if a scheduling is needed after IRQ context. If yes, * This function checks if a scheduling is needed after IRQ context. If yes,
...@@ -559,7 +559,7 @@ void rt_scheduler_do_irq_switch(void *context) ...@@ -559,7 +559,7 @@ void rt_scheduler_do_irq_switch(void *context)
rt_thread_resume(current_thread); rt_thread_resume(current_thread);
} }
} }
#endif #endif /* RT_USING_SIGNALS */
if (pcpu->irq_switch_flag == 0) if (pcpu->irq_switch_flag == 0)
{ {
...@@ -608,7 +608,7 @@ void rt_scheduler_do_irq_switch(void *context) ...@@ -608,7 +608,7 @@ void rt_scheduler_do_irq_switch(void *context)
#ifdef RT_USING_OVERFLOW_CHECK #ifdef RT_USING_OVERFLOW_CHECK
_rt_scheduler_stack_check(to_thread); _rt_scheduler_stack_check(to_thread);
#endif #endif /* RT_USING_OVERFLOW_CHECK */
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("switch in interrupt\n")); RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("switch in interrupt\n"));
current_thread->cpus_lock_nest--; current_thread->cpus_lock_nest--;
...@@ -621,7 +621,7 @@ void rt_scheduler_do_irq_switch(void *context) ...@@ -621,7 +621,7 @@ void rt_scheduler_do_irq_switch(void *context)
} }
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
} }
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
/* /*
* This function will insert a thread to system ready queue. The state of * This function will insert a thread to system ready queue. The state of
...@@ -661,7 +661,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread) ...@@ -661,7 +661,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
{ {
#if RT_THREAD_PRIORITY_MAX > 32 #if RT_THREAD_PRIORITY_MAX > 32
rt_thread_ready_table[thread->number] |= thread->high_mask; rt_thread_ready_table[thread->number] |= thread->high_mask;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
rt_thread_ready_priority_group |= thread->number_mask; rt_thread_ready_priority_group |= thread->number_mask;
rt_list_insert_before(&(rt_thread_priority_table[thread->current_priority]), rt_list_insert_before(&(rt_thread_priority_table[thread->current_priority]),
...@@ -675,7 +675,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread) ...@@ -675,7 +675,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
#if RT_THREAD_PRIORITY_MAX > 32 #if RT_THREAD_PRIORITY_MAX > 32
pcpu->ready_table[thread->number] |= thread->high_mask; pcpu->ready_table[thread->number] |= thread->high_mask;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
pcpu->priority_group |= thread->number_mask; pcpu->priority_group |= thread->number_mask;
rt_list_insert_before(&(rt_cpu_index(bind_cpu)->priority_table[thread->current_priority]), rt_list_insert_before(&(rt_cpu_index(bind_cpu)->priority_table[thread->current_priority]),
...@@ -724,14 +724,14 @@ void rt_schedule_insert_thread(struct rt_thread *thread) ...@@ -724,14 +724,14 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
/* set priority mask */ /* set priority mask */
#if RT_THREAD_PRIORITY_MAX > 32 #if RT_THREAD_PRIORITY_MAX > 32
rt_thread_ready_table[thread->number] |= thread->high_mask; rt_thread_ready_table[thread->number] |= thread->high_mask;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
rt_thread_ready_priority_group |= thread->number_mask; rt_thread_ready_priority_group |= thread->number_mask;
__exit: __exit:
/* enable interrupt */ /* enable interrupt */
rt_hw_interrupt_enable(temp); rt_hw_interrupt_enable(temp);
} }
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
/* /*
* This function will remove a thread from system ready queue. * This function will remove a thread from system ready queue.
...@@ -768,7 +768,7 @@ void rt_schedule_remove_thread(struct rt_thread *thread) ...@@ -768,7 +768,7 @@ void rt_schedule_remove_thread(struct rt_thread *thread)
} }
#else #else
rt_thread_ready_priority_group &= ~thread->number_mask; rt_thread_ready_priority_group &= ~thread->number_mask;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
} }
} }
else else
...@@ -785,7 +785,7 @@ void rt_schedule_remove_thread(struct rt_thread *thread) ...@@ -785,7 +785,7 @@ void rt_schedule_remove_thread(struct rt_thread *thread)
} }
#else #else
pcpu->priority_group &= ~thread->number_mask; pcpu->priority_group &= ~thread->number_mask;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
} }
} }
...@@ -818,13 +818,13 @@ void rt_schedule_remove_thread(struct rt_thread *thread) ...@@ -818,13 +818,13 @@ void rt_schedule_remove_thread(struct rt_thread *thread)
} }
#else #else
rt_thread_ready_priority_group &= ~thread->number_mask; rt_thread_ready_priority_group &= ~thread->number_mask;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
} }
/* enable interrupt */ /* enable interrupt */
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
} }
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
/** /**
* This function will lock the thread scheduler. * This function will lock the thread scheduler.
...@@ -885,7 +885,7 @@ void rt_enter_critical(void) ...@@ -885,7 +885,7 @@ void rt_enter_critical(void)
/* enable interrupt */ /* enable interrupt */
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
} }
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
RTM_EXPORT(rt_enter_critical); RTM_EXPORT(rt_enter_critical);
/** /**
...@@ -959,7 +959,7 @@ void rt_exit_critical(void) ...@@ -959,7 +959,7 @@ void rt_exit_critical(void)
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
} }
} }
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
RTM_EXPORT(rt_exit_critical); RTM_EXPORT(rt_exit_critical);
/** /**
...@@ -975,7 +975,7 @@ rt_uint16_t rt_critical_level(void) ...@@ -975,7 +975,7 @@ rt_uint16_t rt_critical_level(void)
return current_thread->critical_lock_nest; return current_thread->critical_lock_nest;
#else #else
return rt_scheduler_lock_nest; return rt_scheduler_lock_nest;
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
} }
RTM_EXPORT(rt_critical_level); RTM_EXPORT(rt_critical_level);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#ifndef RT_SIG_INFO_MAX #ifndef RT_SIG_INFO_MAX
#define RT_SIG_INFO_MAX 32 #define RT_SIG_INFO_MAX 32
#endif #endif /* RT_SIG_INFO_MAX */
#define DBG_TAG "SIGN" #define DBG_TAG "SIGN"
#define DBG_LVL DBG_WARNING #define DBG_LVL DBG_WARNING
...@@ -67,7 +67,7 @@ static void _signal_entry(void *parameter) ...@@ -67,7 +67,7 @@ static void _signal_entry(void *parameter)
/* return to thread */ /* return to thread */
tid->sp = tid->sig_ret; tid->sp = tid->sig_ret;
tid->sig_ret = RT_NULL; tid->sig_ret = RT_NULL;
#endif #endif /* RT_USING_SMP */
LOG_D("switch back to: 0x%08x\n", tid->sp); LOG_D("switch back to: 0x%08x\n", tid->sp);
tid->stat &= ~RT_THREAD_STAT_SIGNAL; tid->stat &= ~RT_THREAD_STAT_SIGNAL;
...@@ -76,7 +76,7 @@ static void _signal_entry(void *parameter) ...@@ -76,7 +76,7 @@ static void _signal_entry(void *parameter)
rt_hw_context_switch_to((rt_base_t)&parameter, tid); rt_hw_context_switch_to((rt_base_t)&parameter, tid);
#else #else
rt_hw_context_switch_to((rt_ubase_t)&(tid->sp)); rt_hw_context_switch_to((rt_ubase_t)&(tid->sp));
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
} }
/* /*
...@@ -153,7 +153,7 @@ static void _signal_deliver(rt_thread_t tid) ...@@ -153,7 +153,7 @@ static void _signal_deliver(rt_thread_t tid)
tid->sig_ret = tid->sp; tid->sig_ret = tid->sp;
tid->sp = rt_hw_stack_init((void *)_signal_entry, RT_NULL, tid->sp = rt_hw_stack_init((void *)_signal_entry, RT_NULL,
(void *)((char *)tid->sig_ret - 32), RT_NULL); (void *)((char *)tid->sig_ret - 32), RT_NULL);
#endif #endif /* RT_USING_SMP */
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
LOG_D("signal stack pointer @ 0x%08x", tid->sp); LOG_D("signal stack pointer @ 0x%08x", tid->sp);
...@@ -204,7 +204,7 @@ void *rt_signal_check(void* context) ...@@ -204,7 +204,7 @@ void *rt_signal_check(void* context)
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
return context; return context;
} }
#endif #endif /* RT_USING_SMP */
rt_sighandler_t rt_signal_install(int signo, rt_sighandler_t handler) rt_sighandler_t rt_signal_install(int signo, rt_sighandler_t handler)
{ {
...@@ -586,4 +586,4 @@ int rt_system_signal_init(void) ...@@ -586,4 +586,4 @@ int rt_system_signal_init(void)
return 0; return 0;
} }
#endif #endif /* RT_USING_SIGNALS */
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
/* some statistical variable */ /* some statistical variable */
#ifdef RT_MEM_STATS #ifdef RT_MEM_STATS
static rt_size_t used_mem, max_mem; static rt_size_t used_mem, max_mem;
#endif #endif /* RT_MEM_STATS */
#ifdef RT_USING_HOOK #ifdef RT_USING_HOOK
static void (*rt_malloc_hook)(void *ptr, rt_size_t size); static void (*rt_malloc_hook)(void *ptr, rt_size_t size);
...@@ -99,7 +99,7 @@ RTM_EXPORT(rt_free_sethook); ...@@ -99,7 +99,7 @@ RTM_EXPORT(rt_free_sethook);
/**@}*/ /**@}*/
#endif #endif /* RT_USING_HOOK */
/* /*
* slab allocator implementation * slab allocator implementation
...@@ -516,7 +516,7 @@ void *rt_malloc(rt_size_t size) ...@@ -516,7 +516,7 @@ void *rt_malloc(rt_size_t size)
used_mem += size; used_mem += size;
if (used_mem > max_mem) if (used_mem > max_mem)
max_mem = used_mem; max_mem = used_mem;
#endif #endif /* RT_MEM_STATS */
goto done; goto done;
} }
...@@ -571,7 +571,7 @@ void *rt_malloc(rt_size_t size) ...@@ -571,7 +571,7 @@ void *rt_malloc(rt_size_t size)
used_mem += z->z_chunksize; used_mem += z->z_chunksize;
if (used_mem > max_mem) if (used_mem > max_mem)
max_mem = used_mem; max_mem = used_mem;
#endif #endif /* RT_MEM_STATS */
goto done; goto done;
} }
...@@ -655,7 +655,7 @@ void *rt_malloc(rt_size_t size) ...@@ -655,7 +655,7 @@ void *rt_malloc(rt_size_t size)
used_mem += z->z_chunksize; used_mem += z->z_chunksize;
if (used_mem > max_mem) if (used_mem > max_mem)
max_mem = used_mem; max_mem = used_mem;
#endif #endif /* RT_MEM_STATS */
} }
done: done:
...@@ -790,7 +790,7 @@ void rt_free(void *ptr) ...@@ -790,7 +790,7 @@ void rt_free(void *ptr)
(rt_ubase_t)addr, (rt_ubase_t)addr,
((rt_ubase_t)(addr) - heap_start) >> RT_MM_PAGE_BITS)); ((rt_ubase_t)(addr) - heap_start) >> RT_MM_PAGE_BITS));
} }
#endif #endif /* RT_DEBUG_SLAB */
kup = btokup((rt_ubase_t)ptr & ~RT_MM_PAGE_MASK); kup = btokup((rt_ubase_t)ptr & ~RT_MM_PAGE_MASK);
/* release large allocation */ /* release large allocation */
...@@ -806,7 +806,7 @@ void rt_free(void *ptr) ...@@ -806,7 +806,7 @@ void rt_free(void *ptr)
#ifdef RT_MEM_STATS #ifdef RT_MEM_STATS
used_mem -= size * RT_MM_PAGE_SIZE; used_mem -= size * RT_MM_PAGE_SIZE;
#endif #endif /* RT_MEM_STATS */
rt_sem_release(&heap_sem); rt_sem_release(&heap_sem);
RT_DEBUG_LOG(RT_DEBUG_SLAB, RT_DEBUG_LOG(RT_DEBUG_SLAB,
...@@ -833,7 +833,7 @@ void rt_free(void *ptr) ...@@ -833,7 +833,7 @@ void rt_free(void *ptr)
#ifdef RT_MEM_STATS #ifdef RT_MEM_STATS
used_mem -= z->z_chunksize; used_mem -= z->z_chunksize;
#endif #endif /* RT_MEM_STATS */
/* /*
* Bump the number of free chunks. If it becomes non-zero the zone * Bump the number of free chunks. If it becomes non-zero the zone
...@@ -929,9 +929,9 @@ void list_mem(void) ...@@ -929,9 +929,9 @@ void list_mem(void)
rt_kprintf("maximum allocated memory: %d\n", max_mem); rt_kprintf("maximum allocated memory: %d\n", max_mem);
} }
FINSH_FUNCTION_EXPORT(list_mem, list memory usage information) FINSH_FUNCTION_EXPORT(list_mem, list memory usage information)
#endif #endif /* RT_USING_FINSH */
#endif #endif /* RT_MEM_STATS */
/**@}*/ /**@}*/
#endif #endif /* defined (RT_USING_HEAP) && defined (RT_USING_SLAB) */
...@@ -76,7 +76,7 @@ void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread)) ...@@ -76,7 +76,7 @@ void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread))
rt_thread_inited_hook = hook; rt_thread_inited_hook = hook;
} }
#endif #endif /* RT_USING_HOOK */
/* must be invoke witch rt_hw_interrupt_disable */ /* must be invoke witch rt_hw_interrupt_disable */
static void _rt_thread_cleanup_execute(rt_thread_t thread) static void _rt_thread_cleanup_execute(rt_thread_t thread)
...@@ -84,7 +84,7 @@ static void _rt_thread_cleanup_execute(rt_thread_t thread) ...@@ -84,7 +84,7 @@ static void _rt_thread_cleanup_execute(rt_thread_t thread)
register rt_base_t level; register rt_base_t level;
#ifdef RT_USING_MODULE #ifdef RT_USING_MODULE
struct rt_dlmodule *module = RT_NULL; struct rt_dlmodule *module = RT_NULL;
#endif #endif /* RT_USING_MODULE */
level = rt_hw_interrupt_disable(); level = rt_hw_interrupt_disable();
#ifdef RT_USING_MODULE #ifdef RT_USING_MODULE
module = (struct rt_dlmodule*)thread->module_id; module = (struct rt_dlmodule*)thread->module_id;
...@@ -92,14 +92,14 @@ static void _rt_thread_cleanup_execute(rt_thread_t thread) ...@@ -92,14 +92,14 @@ static void _rt_thread_cleanup_execute(rt_thread_t thread)
{ {
dlmodule_destroy(module); dlmodule_destroy(module);
} }
#endif #endif /* RT_USING_MODULE */
/* invoke thread cleanup */ /* invoke thread cleanup */
if (thread->cleanup != RT_NULL) if (thread->cleanup != RT_NULL)
thread->cleanup(thread); thread->cleanup(thread);
#ifdef RT_USING_SIGNALS #ifdef RT_USING_SIGNALS
rt_thread_free_sig(thread); rt_thread_free_sig(thread);
#endif #endif /* RT_USING_SIGNALS */
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
} }
...@@ -170,7 +170,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread, ...@@ -170,7 +170,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter, 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)), (rt_uint8_t *)((char *)thread->stack_addr + thread->stack_size - sizeof(rt_ubase_t)),
(void *)_rt_thread_exit); (void *)_rt_thread_exit);
#endif #endif /* ARCH_CPU_STACK_GROWS_UPWARD */
/* priority init */ /* priority init */
RT_ASSERT(priority < RT_THREAD_PRIORITY_MAX); RT_ASSERT(priority < RT_THREAD_PRIORITY_MAX);
...@@ -181,7 +181,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread, ...@@ -181,7 +181,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
#if RT_THREAD_PRIORITY_MAX > 32 #if RT_THREAD_PRIORITY_MAX > 32
thread->number = 0; thread->number = 0;
thread->high_mask = 0; thread->high_mask = 0;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
/* tick init */ /* tick init */
thread->init_tick = tick; thread->init_tick = tick;
...@@ -200,7 +200,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread, ...@@ -200,7 +200,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
thread->scheduler_lock_nest = 0; thread->scheduler_lock_nest = 0;
thread->cpus_lock_nest = 0; thread->cpus_lock_nest = 0;
thread->critical_lock_nest = 0; thread->critical_lock_nest = 0;
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
/* initialize cleanup function and user data */ /* initialize cleanup function and user data */
thread->cleanup = 0; thread->cleanup = 0;
...@@ -221,14 +221,14 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread, ...@@ -221,14 +221,14 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
#ifndef RT_USING_SMP #ifndef RT_USING_SMP
thread->sig_ret = RT_NULL; thread->sig_ret = RT_NULL;
#endif #endif /* RT_USING_SMP */
thread->sig_vectors = RT_NULL; thread->sig_vectors = RT_NULL;
thread->si_list = RT_NULL; thread->si_list = RT_NULL;
#endif #endif /* RT_USING_SIGNALS */
#ifdef RT_USING_LWP #ifdef RT_USING_LWP
thread->lwp = RT_NULL; thread->lwp = RT_NULL;
#endif #endif /* RT_USING_LWP */
RT_OBJECT_HOOK_CALL(rt_thread_inited_hook, (thread)); RT_OBJECT_HOOK_CALL(rt_thread_inited_hook, (thread));
...@@ -302,7 +302,7 @@ rt_thread_t rt_thread_self(void) ...@@ -302,7 +302,7 @@ rt_thread_t rt_thread_self(void)
extern rt_thread_t rt_current_thread; extern rt_thread_t rt_current_thread;
return rt_current_thread; return rt_current_thread;
#endif #endif /* RT_USING_SMP */
} }
RTM_EXPORT(rt_thread_self); RTM_EXPORT(rt_thread_self);
...@@ -330,7 +330,7 @@ rt_err_t rt_thread_startup(rt_thread_t thread) ...@@ -330,7 +330,7 @@ rt_err_t rt_thread_startup(rt_thread_t thread)
thread->high_mask = 1L << (thread->current_priority & 0x07); /* 3bit */ thread->high_mask = 1L << (thread->current_priority & 0x07); /* 3bit */
#else #else
thread->number_mask = 1L << thread->current_priority; thread->number_mask = 1L << thread->current_priority;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
RT_DEBUG_LOG(RT_DEBUG_THREAD, ("startup a thread:%s with priority:%d\n", RT_DEBUG_LOG(RT_DEBUG_THREAD, ("startup a thread:%s with priority:%d\n",
thread->name, thread->init_priority)); thread->name, thread->init_priority));
...@@ -492,7 +492,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread) ...@@ -492,7 +492,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
return RT_EOK; return RT_EOK;
} }
RTM_EXPORT(rt_thread_delete); RTM_EXPORT(rt_thread_delete);
#endif #endif /* RT_USING_HEAP */
/** /**
* This function will let current thread yield processor, and scheduler will * This function will let current thread yield processor, and scheduler will
...@@ -690,7 +690,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg) ...@@ -690,7 +690,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */ thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */
#else #else
thread->number_mask = 1 << thread->current_priority; thread->number_mask = 1 << thread->current_priority;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
/* insert thread to schedule queue again */ /* insert thread to schedule queue again */
rt_schedule_insert_thread(thread); rt_schedule_insert_thread(thread);
...@@ -706,7 +706,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg) ...@@ -706,7 +706,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */ thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */
#else #else
thread->number_mask = 1 << thread->current_priority; thread->number_mask = 1 << thread->current_priority;
#endif #endif /* RT_THREAD_PRIORITY_MAX > 32 */
} }
/* enable interrupt */ /* enable interrupt */
...@@ -732,7 +732,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg) ...@@ -732,7 +732,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
{ {
rt_err = rt_thread_delete(thread); rt_err = rt_thread_delete(thread);
} }
#endif #endif /* RT_USING_HEAP */
rt_schedule(); rt_schedule();
return rt_err; return rt_err;
} }
...@@ -752,7 +752,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg) ...@@ -752,7 +752,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
thread->bind_cpu = cpu > RT_CPUS_NR? RT_CPUS_NR : cpu; thread->bind_cpu = cpu > RT_CPUS_NR? RT_CPUS_NR : cpu;
break; break;
} }
#endif /*RT_USING_SMP*/ #endif /* RT_USING_SMP */
default: default:
break; break;
......
...@@ -31,11 +31,11 @@ static rt_list_t rt_timer_list[RT_TIMER_SKIP_LIST_LEVEL]; ...@@ -31,11 +31,11 @@ static rt_list_t rt_timer_list[RT_TIMER_SKIP_LIST_LEVEL];
#ifndef RT_TIMER_THREAD_STACK_SIZE #ifndef RT_TIMER_THREAD_STACK_SIZE
#define RT_TIMER_THREAD_STACK_SIZE 512 #define RT_TIMER_THREAD_STACK_SIZE 512
#endif #endif /* RT_TIMER_THREAD_STACK_SIZE */
#ifndef RT_TIMER_THREAD_PRIO #ifndef RT_TIMER_THREAD_PRIO
#define RT_TIMER_THREAD_PRIO 0 #define RT_TIMER_THREAD_PRIO 0
#endif #endif /* RT_TIMER_THREAD_PRIO */
/* soft timer status */ /* soft timer status */
static rt_uint8_t soft_timer_status = RT_SOFT_TIMER_IDLE; static rt_uint8_t soft_timer_status = RT_SOFT_TIMER_IDLE;
...@@ -44,7 +44,7 @@ static rt_list_t rt_soft_timer_list[RT_TIMER_SKIP_LIST_LEVEL]; ...@@ -44,7 +44,7 @@ static rt_list_t rt_soft_timer_list[RT_TIMER_SKIP_LIST_LEVEL];
static struct rt_thread timer_thread; static struct rt_thread timer_thread;
ALIGN(RT_ALIGN_SIZE) ALIGN(RT_ALIGN_SIZE)
static rt_uint8_t timer_thread_stack[RT_TIMER_THREAD_STACK_SIZE]; static rt_uint8_t timer_thread_stack[RT_TIMER_THREAD_STACK_SIZE];
#endif #endif /* RT_USING_TIMER_SOFT */
#ifdef RT_USING_HOOK #ifdef RT_USING_HOOK
extern void (*rt_object_take_hook)(struct rt_object *object); extern void (*rt_object_take_hook)(struct rt_object *object);
...@@ -81,7 +81,7 @@ void rt_timer_exit_sethook(void (*hook)(struct rt_timer *timer)) ...@@ -81,7 +81,7 @@ void rt_timer_exit_sethook(void (*hook)(struct rt_timer *timer))
} }
/**@}*/ /**@}*/
#endif #endif /* RT_USING_HOOK */
static void _rt_timer_init(rt_timer_t timer, static void _rt_timer_init(rt_timer_t timer,
void (*timeout)(void *parameter), void (*timeout)(void *parameter),
...@@ -171,7 +171,7 @@ void rt_timer_dump(rt_list_t timer_heads[]) ...@@ -171,7 +171,7 @@ void rt_timer_dump(rt_list_t timer_heads[])
} }
rt_kprintf("\n"); rt_kprintf("\n");
} }
#endif #endif /* RT_DEBUG_TIMER */
/** /**
* @addtogroup Clock * @addtogroup Clock
...@@ -303,7 +303,7 @@ rt_err_t rt_timer_delete(rt_timer_t timer) ...@@ -303,7 +303,7 @@ rt_err_t rt_timer_delete(rt_timer_t timer)
return RT_EOK; return RT_EOK;
} }
RTM_EXPORT(rt_timer_delete); RTM_EXPORT(rt_timer_delete);
#endif #endif /* RT_USING_HEAP */
/** /**
* This function will start the timer * This function will start the timer
...@@ -348,7 +348,7 @@ rt_err_t rt_timer_start(rt_timer_t timer) ...@@ -348,7 +348,7 @@ rt_err_t rt_timer_start(rt_timer_t timer)
timer_list = rt_soft_timer_list; timer_list = rt_soft_timer_list;
} }
else else
#endif #endif /* RT_USING_TIMER_SOFT */
{ {
/* insert timer to system timer list */ /* insert timer to system timer list */
timer_list = rt_timer_list; timer_list = rt_timer_list;
...@@ -422,7 +422,7 @@ rt_err_t rt_timer_start(rt_timer_t timer) ...@@ -422,7 +422,7 @@ rt_err_t rt_timer_start(rt_timer_t timer)
rt_schedule(); rt_schedule();
} }
} }
#endif #endif /* RT_USING_TIMER_SOFT */
return RT_EOK; return RT_EOK;
} }
...@@ -718,7 +718,7 @@ static void rt_thread_timer_entry(void *parameter) ...@@ -718,7 +718,7 @@ static void rt_thread_timer_entry(void *parameter)
rt_soft_timer_check(); rt_soft_timer_check();
} }
} }
#endif #endif /* RT_USING_TIMER_SOFT */
/** /**
* @ingroup SystemInit * @ingroup SystemInit
...@@ -764,7 +764,7 @@ void rt_system_timer_thread_init(void) ...@@ -764,7 +764,7 @@ void rt_system_timer_thread_init(void)
/* startup */ /* startup */
rt_thread_startup(&timer_thread); rt_thread_startup(&timer_thread);
#endif #endif /* RT_USING_TIMER_SOFT */
} }
/**@}*/ /**@}*/
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册