[kernel]补充endif后缀注释
This commit is contained in:
parent
5c8625c8ef
commit
24b4b6cbb9
|
@ -24,7 +24,7 @@
|
||||||
#define rt_tick rt_cpu_index(0)->tick
|
#define rt_tick rt_cpu_index(0)->tick
|
||||||
#else
|
#else
|
||||||
static volatile rt_tick_t rt_tick = 0;
|
static volatile rt_tick_t rt_tick = 0;
|
||||||
#endif
|
#endif /* RT_USING_SMP */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup Clock
|
* @addtogroup Clock
|
||||||
|
@ -72,7 +72,7 @@ void rt_tick_increase(void)
|
||||||
rt_cpu_self()->tick ++;
|
rt_cpu_self()->tick ++;
|
||||||
#else
|
#else
|
||||||
++ rt_tick;
|
++ rt_tick;
|
||||||
#endif
|
#endif /* RT_USING_SMP */
|
||||||
|
|
||||||
/* check time slice */
|
/* check time slice */
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
|
@ -138,7 +138,7 @@ RT_WEAK rt_tick_t rt_tick_get_millisecond(void)
|
||||||
#warning "rt-thread cannot provide a correct 1ms-based tick any longer,\
|
#warning "rt-thread cannot provide a correct 1ms-based tick any longer,\
|
||||||
please redefine this function in another file by using a high-precision hard-timer."
|
please redefine this function in another file by using a high-precision hard-timer."
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif /* 1000 % RT_TICK_PER_SECOND == 0u */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
|
@ -23,11 +23,11 @@
|
||||||
#ifdef RT_USING_USER_MAIN
|
#ifdef RT_USING_USER_MAIN
|
||||||
#ifndef RT_MAIN_THREAD_STACK_SIZE
|
#ifndef RT_MAIN_THREAD_STACK_SIZE
|
||||||
#define RT_MAIN_THREAD_STACK_SIZE 2048
|
#define RT_MAIN_THREAD_STACK_SIZE 2048
|
||||||
#endif
|
#endif /* RT_MAIN_THREAD_STACK_SIZE */
|
||||||
#ifndef RT_MAIN_THREAD_PRIORITY
|
#ifndef RT_MAIN_THREAD_PRIORITY
|
||||||
#define RT_MAIN_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX / 3)
|
#define RT_MAIN_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX / 3)
|
||||||
#endif
|
#endif /* RT_MAIN_THREAD_PRIORITY */
|
||||||
#endif
|
#endif /* RT_USING_USER_MAIN */
|
||||||
|
|
||||||
#ifdef RT_USING_COMPONENTS_INIT
|
#ifdef RT_USING_COMPONENTS_INIT
|
||||||
/*
|
/*
|
||||||
|
@ -98,7 +98,7 @@ void rt_components_board_init(void)
|
||||||
{
|
{
|
||||||
(*fn_ptr)();
|
(*fn_ptr)();
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* RT_DEBUG_INIT */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,7 +124,7 @@ void rt_components_init(void)
|
||||||
{
|
{
|
||||||
(*fn_ptr)();
|
(*fn_ptr)();
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* RT_DEBUG_INIT */
|
||||||
}
|
}
|
||||||
#endif /* RT_USING_COMPONENTS_INIT */
|
#endif /* RT_USING_COMPONENTS_INIT */
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ int entry(void)
|
||||||
ALIGN(8)
|
ALIGN(8)
|
||||||
static rt_uint8_t main_stack[RT_MAIN_THREAD_STACK_SIZE];
|
static rt_uint8_t main_stack[RT_MAIN_THREAD_STACK_SIZE];
|
||||||
struct rt_thread main_thread;
|
struct rt_thread main_thread;
|
||||||
#endif
|
#endif /* RT_USING_HEAP */
|
||||||
|
|
||||||
/* the system main thread */
|
/* the system main thread */
|
||||||
void main_thread_entry(void *parameter)
|
void main_thread_entry(void *parameter)
|
||||||
|
@ -177,11 +177,11 @@ void main_thread_entry(void *parameter)
|
||||||
#ifdef RT_USING_COMPONENTS_INIT
|
#ifdef RT_USING_COMPONENTS_INIT
|
||||||
/* RT-Thread components initialization */
|
/* RT-Thread components initialization */
|
||||||
rt_components_init();
|
rt_components_init();
|
||||||
#endif
|
#endif /* RT_USING_COMPONENTS_INIT */
|
||||||
|
|
||||||
#ifdef RT_USING_SMP
|
#ifdef RT_USING_SMP
|
||||||
rt_hw_secondary_cpu_up();
|
rt_hw_secondary_cpu_up();
|
||||||
#endif
|
#endif /* RT_USING_SMP */
|
||||||
/* invoke system main function */
|
/* invoke system main function */
|
||||||
#if defined(__CC_ARM) || defined(__CLANG_ARM)
|
#if defined(__CC_ARM) || defined(__CLANG_ARM)
|
||||||
{
|
{
|
||||||
|
@ -211,7 +211,7 @@ void rt_application_init(void)
|
||||||
|
|
||||||
/* if not define RT_USING_HEAP, using to eliminate the warning */
|
/* if not define RT_USING_HEAP, using to eliminate the warning */
|
||||||
(void)result;
|
(void)result;
|
||||||
#endif
|
#endif /* RT_USING_HEAP */
|
||||||
|
|
||||||
rt_thread_startup(tid);
|
rt_thread_startup(tid);
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ int rtthread_startup(void)
|
||||||
#ifdef RT_USING_SIGNALS
|
#ifdef RT_USING_SIGNALS
|
||||||
/* signal system initialization */
|
/* signal system initialization */
|
||||||
rt_system_signal_init();
|
rt_system_signal_init();
|
||||||
#endif
|
#endif /* RT_USING_SIGNALS */
|
||||||
|
|
||||||
/* create init_thread */
|
/* create init_thread */
|
||||||
rt_application_init();
|
rt_application_init();
|
||||||
|
@ -258,4 +258,4 @@ int rtthread_startup(void)
|
||||||
/* never reach here */
|
/* never reach here */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* RT_USING_USER_MAIN */
|
||||||
|
|
|
@ -185,4 +185,4 @@ void rt_cpus_lock_status_restore(struct rt_thread *thread)
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_cpus_lock_status_restore);
|
RTM_EXPORT(rt_cpus_lock_status_restore);
|
||||||
|
|
||||||
#endif
|
#endif /* RT_USING_SMP */
|
||||||
|
|
14
src/device.c
14
src/device.c
|
@ -16,9 +16,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#if defined(RT_USING_POSIX)
|
#ifdef RT_USING_POSIX
|
||||||
#include <rtdevice.h> /* for wqueue_init */
|
#include <rtdevice.h> /* for wqueue_init */
|
||||||
#endif
|
#endif /* RT_USING_POSIX */
|
||||||
|
|
||||||
#ifdef RT_USING_DEVICE
|
#ifdef RT_USING_DEVICE
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
#define device_read (dev->read)
|
#define device_read (dev->read)
|
||||||
#define device_write (dev->write)
|
#define device_write (dev->write)
|
||||||
#define device_control (dev->control)
|
#define device_control (dev->control)
|
||||||
#endif
|
#endif /* RT_USING_DEVICE_OPS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function registers a device driver with specified name.
|
* This function registers a device driver with specified name.
|
||||||
|
@ -62,10 +62,10 @@ rt_err_t rt_device_register(rt_device_t dev,
|
||||||
dev->ref_count = 0;
|
dev->ref_count = 0;
|
||||||
dev->open_flag = 0;
|
dev->open_flag = 0;
|
||||||
|
|
||||||
#if defined(RT_USING_POSIX)
|
#ifdef RT_USING_POSIX
|
||||||
dev->fops = RT_NULL;
|
dev->fops = RT_NULL;
|
||||||
rt_wqueue_init(&(dev->wait_queue));
|
rt_wqueue_init(&(dev->wait_queue));
|
||||||
#endif
|
#endif /* RT_USING_POSIX */
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ void rt_device_destroy(rt_device_t dev)
|
||||||
rt_free(dev);
|
rt_free(dev);
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_device_destroy);
|
RTM_EXPORT(rt_device_destroy);
|
||||||
#endif
|
#endif /* RT_USING_HEAP */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will initialize the specified device
|
* This function will initialize the specified device
|
||||||
|
@ -434,4 +434,4 @@ rt_device_set_tx_complete(rt_device_t dev,
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_device_set_tx_complete);
|
RTM_EXPORT(rt_device_set_tx_complete);
|
||||||
|
|
||||||
#endif
|
#endif /* RT_USING_DEVICE */
|
||||||
|
|
32
src/idle.c
32
src/idle.c
|
@ -22,27 +22,27 @@
|
||||||
|
|
||||||
#ifdef RT_USING_MODULE
|
#ifdef RT_USING_MODULE
|
||||||
#include <dlmodule.h>
|
#include <dlmodule.h>
|
||||||
#endif
|
#endif /* RT_USING_MODULE */
|
||||||
|
|
||||||
#if defined (RT_USING_HOOK)
|
#ifdef RT_USING_HOOK
|
||||||
#ifndef RT_USING_IDLE_HOOK
|
#ifndef RT_USING_IDLE_HOOK
|
||||||
#define RT_USING_IDLE_HOOK
|
#define RT_USING_IDLE_HOOK
|
||||||
#endif
|
#endif /* RT_USING_IDLE_HOOK */
|
||||||
#endif
|
#endif /* RT_USING_HOOK */
|
||||||
|
|
||||||
#ifndef IDLE_THREAD_STACK_SIZE
|
#ifndef IDLE_THREAD_STACK_SIZE
|
||||||
#if defined (RT_USING_IDLE_HOOK) || defined(RT_USING_HEAP)
|
#if defined (RT_USING_IDLE_HOOK) || defined(RT_USING_HEAP)
|
||||||
#define IDLE_THREAD_STACK_SIZE 256
|
#define IDLE_THREAD_STACK_SIZE 256
|
||||||
#else
|
#else
|
||||||
#define IDLE_THREAD_STACK_SIZE 128
|
#define IDLE_THREAD_STACK_SIZE 128
|
||||||
#endif
|
#endif /* (RT_USING_IDLE_HOOK) || defined(RT_USING_HEAP) */
|
||||||
#endif
|
#endif /* IDLE_THREAD_STACK_SIZE */
|
||||||
|
|
||||||
#ifdef RT_USING_SMP
|
#ifdef RT_USING_SMP
|
||||||
#define _CPUS_NR RT_CPUS_NR
|
#define _CPUS_NR RT_CPUS_NR
|
||||||
#else
|
#else
|
||||||
#define _CPUS_NR 1
|
#define _CPUS_NR 1
|
||||||
#endif
|
#endif /* RT_USING_SMP */
|
||||||
|
|
||||||
extern rt_list_t rt_thread_defunct;
|
extern rt_list_t rt_thread_defunct;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ static rt_uint8_t rt_thread_stack[_CPUS_NR][IDLE_THREAD_STACK_SIZE];
|
||||||
#ifdef RT_USING_IDLE_HOOK
|
#ifdef RT_USING_IDLE_HOOK
|
||||||
#ifndef RT_IDLE_HOOK_LIST_SIZE
|
#ifndef RT_IDLE_HOOK_LIST_SIZE
|
||||||
#define RT_IDLE_HOOK_LIST_SIZE 4
|
#define RT_IDLE_HOOK_LIST_SIZE 4
|
||||||
#endif
|
#endif /* RT_IDLE_HOOK_LIST_SIZE */
|
||||||
|
|
||||||
static void (*idle_hook_list[RT_IDLE_HOOK_LIST_SIZE])(void);
|
static void (*idle_hook_list[RT_IDLE_HOOK_LIST_SIZE])(void);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ rt_err_t rt_thread_idle_delhook(void (*hook)(void))
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* RT_USING_IDLE_HOOK */
|
||||||
|
|
||||||
#ifdef RT_USING_HEAP
|
#ifdef RT_USING_HEAP
|
||||||
/* Return whether there is defunctional thread to be deleted. */
|
/* Return whether there is defunctional thread to be deleted. */
|
||||||
|
@ -141,7 +141,7 @@ rt_inline int _has_defunct_thread(void)
|
||||||
|
|
||||||
return l->next != l;
|
return l->next != l;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* RT_USING_HEAP */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup Thread
|
* @ingroup Thread
|
||||||
|
@ -182,7 +182,7 @@ void rt_thread_idle_excute(void)
|
||||||
rt_object_delete((rt_object_t)thread);
|
rt_object_delete((rt_object_t)thread);
|
||||||
rt_hw_interrupt_enable(lock);
|
rt_hw_interrupt_enable(lock);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* RT_USING_HEAP */
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void rt_system_power_manager(void);
|
extern void rt_system_power_manager(void);
|
||||||
|
@ -196,7 +196,7 @@ static void rt_thread_idle_entry(void *parameter)
|
||||||
rt_hw_secondary_cpu_idle_exec();
|
rt_hw_secondary_cpu_idle_exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* RT_USING_SMP */
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -212,12 +212,12 @@ static void rt_thread_idle_entry(void *parameter)
|
||||||
idle_hook();
|
idle_hook();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* RT_USING_IDLE_HOOK */
|
||||||
|
|
||||||
rt_thread_idle_excute();
|
rt_thread_idle_excute();
|
||||||
#ifdef RT_USING_PM
|
#ifdef RT_USING_PM
|
||||||
rt_system_power_manager();
|
rt_system_power_manager();
|
||||||
#endif
|
#endif /* RT_USING_PM */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ void rt_thread_idle_init(void)
|
||||||
32);
|
32);
|
||||||
#ifdef RT_USING_SMP
|
#ifdef RT_USING_SMP
|
||||||
rt_thread_control(&idle[i], RT_THREAD_CTRL_BIND_CPU, (void*)i);
|
rt_thread_control(&idle[i], RT_THREAD_CTRL_BIND_CPU, (void*)i);
|
||||||
#endif
|
#endif /* RT_USING_SMP */
|
||||||
/* startup */
|
/* startup */
|
||||||
rt_thread_startup(&idle[i]);
|
rt_thread_startup(&idle[i]);
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ rt_thread_t rt_thread_idle_gethandler(void)
|
||||||
register int id = rt_hw_cpu_id();
|
register int id = rt_hw_cpu_id();
|
||||||
#else
|
#else
|
||||||
register int id = 0;
|
register int id = 0;
|
||||||
#endif
|
#endif /* RT_USING_SMP */
|
||||||
|
|
||||||
return (rt_thread_t)(&idle[id]);
|
return (rt_thread_t)(&idle[id]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue