mirror of
https://gitee.com/cosyos/cosyos.git
synced 2026-08-18 00:58:59 +08:00
64 lines
1.8 KiB
C
64 lines
1.8 KiB
C
/**************************************************************************//**
|
||
* @item CosyOS-III Kernel
|
||
* @file os_sysidle.c
|
||
* @brief 系统空闲任务(Sysidle)
|
||
* @author 迟凯峰
|
||
* @version v3.0.0
|
||
* @date 2026.07.21
|
||
******************************************************************************/
|
||
|
||
#include "os_var.h"
|
||
#include "os_api.h"
|
||
#include "sv_create.h"
|
||
#include "sv_task.h"
|
||
#include "ur_api.h"
|
||
|
||
/**
|
||
\brief 系统空闲任务
|
||
\param[in] 任务名称 Sysidle
|
||
\param[in] 任务优先级 0
|
||
\param[in] 任务栈大小 SYSCFG_STACKSIZE_SYSIDLE
|
||
\param[in] 安全运行时 0
|
||
\param[in] 任务名称文本<br>
|
||
遗产模式:"Sysidle"<br>
|
||
标准/兼容模式:[中文:"系统空闲",英文:"Sysidle"]
|
||
\return 无
|
||
*/
|
||
#if (SYSCFG_DEBUG_LANGUAGE == 0)
|
||
#define _taskname "Sysidle"
|
||
#else
|
||
#define _taskname "\xCF\xB5\xCD\xB3\xBF\xD5\xCF\xD0" /*!< "系统空闲" */
|
||
#endif
|
||
uCreateTask(Sysidle, 0, SYSCFG_STACKSIZE_SYSIDLE, 0, _taskname)
|
||
{
|
||
void idle_hook(void);
|
||
while(true){
|
||
#if (SYSCFG_SOFTRTC == __ENABLED__)
|
||
static s_u8_t _RTC_MEM_ year = 0xFF;
|
||
if(year != s_rtc.year){
|
||
year = s_rtc.year;
|
||
s_month2day = year ? ((year & 3) ? 28 : 29) : ((s_rtc.yeah & 3) ? 28 : 29);
|
||
}
|
||
#endif
|
||
#if (SYSCFG_SAFERUNTIME == __ENABLED__)
|
||
s_timeout_sign = false;
|
||
#endif
|
||
#if (SYSCFG_IDLEHOOK == __ENABLED__)
|
||
idle_hook();
|
||
#endif
|
||
#if (SYSCFG_DEBUGGING == __ENABLED__) && (MCUCFG_TASKSTACK_MODE & __MSP__)
|
||
if(true){
|
||
m_stacklen_t len = mMainStack_Check();
|
||
if(m_stacklen_max < len){
|
||
m_stacklen_max = len;
|
||
}
|
||
}
|
||
#endif
|
||
#if (SYSCFG_LOWPOWERMODE == __ENABLED__)
|
||
mCosyOS_IDLE();
|
||
#endif
|
||
OS_NOP(4);
|
||
}
|
||
}
|
||
#undef _taskname
|