📄 os_cpu_c.c
字号:
#define OS_CPU_GLOBALS
#include "uCOS_II.H"
OS_STK *OSTaskStkInit (void (*task)(void *pd), void *pdata, OS_STK *ptos, INT16U opt)
{
OS_STK *pSoftStk, *pHardStk;
INT16U tmp;
opt = opt;
pSoftStk = (INT8U *)ptos;
pHardStk = (INT8U *)(ptos - OS_TASK_STK_SIZE + OS_TASK_HARD_STK_SIZE);
tmp = (INT16U) task; //get function address
*pHardStk -- = (INT8U)tmp;
*pHardStk -- = (INT8U)(tmp >> 8);
*pSoftStk -- = (INT8U)0x00;
*pSoftStk -- = (INT8U)0x01;
*pSoftStk -- = (INT8U)0x02;
*pSoftStk -- = (INT8U)0x03;
*pSoftStk -- = (INT8U)0x04;
*pSoftStk -- = (INT8U)0x05;
*pSoftStk -- = (INT8U)0x06;
*pSoftStk -- = (INT8U)0x07;
*pSoftStk -- = (INT8U)0x08;
*pSoftStk -- = (INT8U)0x09;
*pSoftStk -- = (INT8U)0x10;
*pSoftStk -- = (INT8U)0x11;
*pSoftStk -- = (INT8U)0x12;
*pSoftStk -- = (INT8U)0x13;
*pSoftStk -- = (INT8U)tmp; //0x14;
*pSoftStk -- = (INT8U)(tmp >> 8); //0x15
tmp = (INT16U)pdata; //get parameter address, because parameter type is undef
*pSoftStk -- = (INT8U)tmp; //0x16;
*pSoftStk -- = (INT8U)(tmp >> 8); //0x17;
*pSoftStk -- = (INT8U)0x18;
*pSoftStk -- = (INT8U)0x19;
*pSoftStk -- = (INT8U)0x20;
*pSoftStk -- = (INT8U)0x21;
*pSoftStk -- = (INT8U)0x22;
*pSoftStk -- = (INT8U)0x23;
*pSoftStk -- = (INT8U)0x24;
*pSoftStk -- = (INT8U)0x25;
*pSoftStk -- = (INT8U)0x26;
*pSoftStk -- = (INT8U)0x27;
*pSoftStk -- = (INT8U)0x30;
*pSoftStk -- = (INT8U)0x31;
*pSoftStk -- = (INT8U)0x80; //enable interrupt//sreg
tmp = (INT16U)pHardStk;
*pSoftStk-- = (INT8U)(tmp >> 8); // SPH
*pSoftStk = (INT8U) tmp; // SPL
return ((void *)pSoftStk);
}
#if OS_CPU_HOOKS_EN
#if OS_VERSION > 203
void OSInitHookBegin (void)
{
}
#endif
#if OS_VERSION > 203
void OSInitHookEnd (void)
{
}
#endif
void OSTaskCreateHook (OS_TCB *ptcb)
{
ptcb = ptcb; /* Prevent compiler warning */
}
void OSTaskDelHook (OS_TCB *ptcb)
{
ptcb = ptcb; /* Prevent compiler warning */
}
void OSTaskSwHook (void)
{
}
void OSTaskStatHook (void)
{
}
#if OS_VERSION > 203
void OSTCBInitHook (OS_TCB *ptcb)
{
ptcb = ptcb; /* Prevent Compiler warning */
}
#endif
void OSTimeTickHook (void)
{
}
#if OS_VERSION >= 251
void OSTaskIdleHook (void)
{
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -