📄 idle.c.svn-base
字号:
/* * File : idle.c * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2006, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://openlab.rt-thread.com/license/LICENSE * * Change Logs: * Date Author Notes * 2006-03-23 Bernard the first version */#include <rtthread.h>static struct rt_thread idle;static rt_uint8 rt_thread_stack[256];
#ifdef RT_USING_HOOK/** * @addtogroup Hook *//*@{*/static void (*rt_thread_idle_hook)();/** * This function will set a hook function to idle thread loop. * * @param hook the specified hook function * * @note the hook function must be simple and never be blocked or suspend. */void rt_thread_idle_sethook(void (*hook)()){ rt_thread_idle_hook = hook;}/*@}*/
#endifstatic void rt_thread_idle_entry(void* parameter){ while (1) {#ifdef RT_USING_HOOK /* if there is an idle thread hook */ if (rt_thread_idle_hook != RT_NULL) rt_thread_idle_hook();#endif /* nothing */ ; }}/** * @addtogroup SystemInit *//*@{*//** * This function will initialize idle thread, then start it. * * @note this function must be invoked when system init. */void rt_thread_idle_init(){ /* init thread */ rt_thread_init(&idle, "tidle", rt_thread_idle_entry, RT_NULL, &rt_thread_stack[0], sizeof(rt_thread_stack), RT_THREAD_PRIORITY_MAX - 1, 64); /* startup */ rt_thread_startup(&idle);}/*@}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -