RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
idle.c 文件参考
#include <rthw.h>
#include <rtthread.h>
#include <dlmodule.h>
+ idle.c 的引用(Include)关系图:

浏览该文件的源代码.

宏定义

#define RT_USING_IDLE_HOOK
 
#define IDLE_THREAD_STACK_SIZE   256
 
#define _CPUS_NR   RT_CPUS_NR
 
#define RT_IDLE_HOOK_LIST_SIZE   4
 

函数

 rt_align (RT_ALIGN_SIZE)
 
rt_err_t rt_thread_idle_delhook (void(*hook)(void))
 
void rt_thread_idle_init (void)
 
rt_thread_t rt_thread_idle_gethandler (void)
 

宏定义说明

◆ RT_USING_IDLE_HOOK

#define RT_USING_IDLE_HOOK

在文件 idle.c33 行定义.

◆ IDLE_THREAD_STACK_SIZE

#define IDLE_THREAD_STACK_SIZE   256

在文件 idle.c39 行定义.

◆ _CPUS_NR

#define _CPUS_NR   RT_CPUS_NR

在文件 idle.c45 行定义.

◆ RT_IDLE_HOOK_LIST_SIZE

#define RT_IDLE_HOOK_LIST_SIZE   4

函数说明

◆ rt_align()

rt_align ( RT_ALIGN_SIZE )

This function sets a hook function to idle thread loop. When the system performs idle loop, this hook function should be invoked.

参数
hookthe specified hook function.
返回
RT_EOK: set OK. -RT_EFULL: hook list is full.
注解
the hook function must be simple and never be blocked or suspend.

在文件 idle.c48 行定义.

71{
72 rt_size_t i;
73 rt_err_t ret = -RT_EFULL;
74 rt_base_t level;
75
76 level = rt_spin_lock_irqsave(&_hook_spinlock);
77
78 for (i = 0; i < RT_IDLE_HOOK_LIST_SIZE; i++)
79 {
80 if (idle_hook_list[i] == RT_NULL)
81 {
82 idle_hook_list[i] = hook;
83 ret = RT_EOK;
84 break;
85 }
86 }
87
88 rt_spin_unlock_irqrestore(&_hook_spinlock, level);
89
90 return ret;
91}
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_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level)
This function will unlock the spinlock and then restore current cpu interrupt status,...
#define RT_IDLE_HOOK_LIST_SIZE
rt_int32_t rt_base_t
rt_base_t rt_err_t
rt_ubase_t rt_size_t
#define RT_NULL

引用了 _CPUS_NR, IDLE_THREAD_STACK_SIZE, RT_IDLE_HOOK_LIST_SIZE , 以及 RT_NULL.