32#ifndef RT_USING_IDLE_HOOK
33#define RT_USING_IDLE_HOOK
37#ifndef IDLE_THREAD_STACK_SIZE
38#if defined (RT_USING_IDLE_HOOK) || defined(RT_USING_HEAP)
39#define IDLE_THREAD_STACK_SIZE 256
41#define IDLE_THREAD_STACK_SIZE 128
45#define _CPUS_NR RT_CPUS_NR
51#ifdef RT_USING_IDLE_HOOK
52#ifndef RT_IDLE_HOOK_LIST_SIZE
53#define RT_IDLE_HOOK_LIST_SIZE 4
80 if (idle_hook_list[i] ==
RT_NULL)
82 idle_hook_list[i] = hook;
111 if (idle_hook_list[i] == hook)
126static void idle_thread_entry(
void *parameter)
134 rt_hw_secondary_cpu_idle_exec();
141#ifdef RT_USING_IDLE_HOOK
143 void (*idle_hook)(void);
147 idle_hook = idle_hook_list[i];
155#if !defined(RT_USING_SMP) && !defined(RT_USING_SMART)
160 void rt_system_power_manager(
void);
161 rt_system_power_manager();
175 char idle_thread_name[RT_NAME_MAX];
178#ifdef RT_USING_IDLE_HOOK
185 rt_snprintf(idle_thread_name, RT_NAME_MAX,
"tidle%d", i);
195 &idle_thread_stack[i][0],
196 sizeof(idle_thread_stack[i]),
197 RT_THREAD_PRIORITY_MAX - 1,
struct rt_cpu * rt_cpu_index(int index)
This fucntion will return the cpu object corresponding to index.
void rt_defunct_execute(void)
This function will perform system background job when system idle.
rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock)
This function will disable the local interrupt and then lock the spinlock, will lock the thread sched...
void rt_spin_lock_init(struct rt_spinlock *lock)
Initialize a static spinlock object.
void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level)
This function will unlock the spinlock and then restore current cpu interrupt status,...
rt_err_t rt_thread_startup(rt_thread_t thread)
This function will start a thread and put it to system ready queue.
#define RT_THREAD_CTRL_BIND_CPU
rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
This function will control thread behaviors according to control command.
rt_err_t rt_thread_idle_sethook(void(*hook)(void))
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)
This function will initialize a thread. It's used to initialize a static thread object.
struct rt_thread * rt_thread_t
rt_thread_t rt_thread_idle_gethandler(void)
This function will get the handler of the idle thread.
void rt_thread_idle_init(void)
This function will initialize idle thread, then start it.
rt_err_t rt_thread_idle_delhook(void(*hook)(void))
delete the idle hook on hook list.
rt_align(RT_ALIGN_SIZE)
This function sets a hook function to idle thread loop. When the system performs idle loop,...
#define RT_IDLE_HOOK_LIST_SIZE
#define IDLE_THREAD_STACK_SIZE
struct rt_thread * idle_thread