mirror of
https://gitee.com/cosyos/cosyos.git
synced 2026-10-06 04:59:34 +08:00
@@ -0,0 +1,30 @@
|
||||
/**************************************************************************//**
|
||||
* @item CosyOS-III Kernel
|
||||
* @file CosyOS.H
|
||||
* @brief 系统链接头文件
|
||||
* @details 用户的各个c文件中应包含此文件。
|
||||
* @author 迟凯峰
|
||||
* @version v3.1.2
|
||||
* @date 2026.09.06
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __COSYOS_H
|
||||
#define __COSYOS_H
|
||||
|
||||
#define COSYOS3_VERSION "v3.1.2"
|
||||
|
||||
#include "os_var.h"
|
||||
#include "os_api.h"
|
||||
#include "sv_com.h"
|
||||
#include "sv_create.h"
|
||||
#include "sv_int_fifo.h"
|
||||
#include "sv_int_loc.h"
|
||||
#include "sv_pend.h"
|
||||
#include "sv_task.h"
|
||||
#include "sv_tick.h"
|
||||
#include "os_main.h"
|
||||
#include "ur_eapi.h"
|
||||
#include "ur_api.h"
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
/**************************************************************************//**
|
||||
* @item CosyOS-III Kernel
|
||||
* @file os_starter.c
|
||||
* @brief 任务启动器(Starter)
|
||||
* @author 迟凯峰
|
||||
* @version v3.1.2
|
||||
* @date 2026.09.06
|
||||
******************************************************************************/
|
||||
|
||||
#include "os_var.h"
|
||||
#include "os_api.h"
|
||||
#include "sv_com.h"
|
||||
#include "sv_create.h"
|
||||
#include "sv_task.h"
|
||||
#include "ur_api.h"
|
||||
|
||||
/**
|
||||
\brief 任务启动器
|
||||
\param[in] 任务名称 Starter
|
||||
\param[in] 任务优先级 SYSCFG_TASKPRIORITY - (SYSCFG_DEBUGGING ? 3 : 1)
|
||||
\param[in] 任务栈大小 SYSCFG_STACKSIZE_STARTER
|
||||
\param[in] 安全运行时 0
|
||||
\param[in] 任务名称标识<br>
|
||||
遗产模式:"Starter"<br>
|
||||
标准/兼容模式:[中文:"任务启动器",英文:"Starter"]
|
||||
\return 无
|
||||
*/
|
||||
#if (SYSCFG_DEBUG_LANGUAGE == 0)
|
||||
#define _taskname "Starter"
|
||||
#elif (SYSCFG_DEBUG_ENCODING == 0)
|
||||
#define _taskname "任务启动器"
|
||||
#else
|
||||
#define _taskname "\xC8\xCE\xCE\xF1\xC6\xF4\xB6\xAF\xC6\xF7"
|
||||
#endif
|
||||
sCat2Str
|
||||
(
|
||||
SYSCFG_STARTERCREATE,
|
||||
CreateTask(Starter, SYSCFG_TASKPRIORITY - (SYSCFG_DEBUGGING ? 3 : 1), SYSCFG_STACKSIZE_STARTER, 0, _taskname)
|
||||
)
|
||||
{
|
||||
// uScheduleLock();
|
||||
if(true){
|
||||
uExtTask(Sysidle);
|
||||
uStartTask_Ready(Sysidle);
|
||||
}
|
||||
#if (OS_TIMINTTOTAL > 0 || OS_TIMQRYTOTAL > 0)
|
||||
if(true){
|
||||
s_u8_t i;
|
||||
#if (OS_TIMINTTOTAL > 0)
|
||||
i = OS_TIMINTTOTAL;
|
||||
while(i--){
|
||||
if(s_timint_handle[i]->hookortask){
|
||||
sStartTask_TimInt(i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if (OS_TIMQRYTOTAL > 0)
|
||||
i = OS_TIMQRYTOTAL;
|
||||
while(i--){
|
||||
if(s_timqry_handle[i]->hookortask){
|
||||
sStartTask_TimQry(i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
// uScheduleUnlock();
|
||||
if(true){
|
||||
void start_hook(void);
|
||||
start_hook();
|
||||
}
|
||||
uDeleteTasking();
|
||||
}
|
||||
#undef _taskname
|
||||
@@ -0,0 +1,65 @@
|
||||
/**************************************************************************//**
|
||||
* @item CosyOS-III Kernel
|
||||
* @file os_sysidle.c
|
||||
* @brief 系统空闲任务(Sysidle)
|
||||
* @author 迟凯峰
|
||||
* @version v3.1.2
|
||||
* @date 2026.09.06
|
||||
******************************************************************************/
|
||||
|
||||
#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"
|
||||
#elif (SYSCFG_DEBUG_ENCODING == 0)
|
||||
#define _taskname "系统空闲"
|
||||
#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
|
||||
File diff suppressed because it is too large
Load Diff
+2120
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user