📄 os_cpu_c.c
字号:
#define OS_CPU_GLOBALS
//=======================================================================
// header file
#include "includes.h"
//=======================================================================
// system SP Start address
INT8U data STKStart;
INT8U data TickTimeInit;
//=======================================================================
OSTaskStkInit
(
void (*task)(void *pd), // point to function
void *pdato,
OS_STK *pbos,
INT16U opt
)reentrant
{
OS_STK *stk;
stk = pbos;
//simulated hardware stack
*stk++ = 0x12;
*stk++ = ((INT16U)task & 0x00FF);//* PCL
*stk++ = ((INT16U)task >> 8); //* PCH
*stk++ = 0x00; //* PSW
*stk++ = 0x0a; //* ACC
*stk++ = 0x0b; //* B
*stk++ = 0x00; //* DPH
*stk++ = 0x00; //* DPL
*stk++ = 0x00; //* R0
*stk++ = (OS_STK)((INT16U)pdato); //* R1:pointer of parameter-LSB
*stk++ = (OS_STK)((INT16U)pdato>>8);//* R2:pointer of parameter-MSB
*stk++ = 0x00; //* R3 R3:type of pointer
*stk++ = 0x04; //* R4
*stk++ = 0x05; //* R5
*stk++ = 0x06; //* R6
*stk++ = 0x07; //* R7
*stk++ = 0xFF; //* ?C_IBP
*stk++ = (OS_STK)(opt>>8); //* Pointer of Simulated stack's top
*stk++ = (OS_STK)(opt&0xFF);
//simulated software stack
stk=(OS_STK xdata *)opt;
*stk = 0x01; //* Zero length of simulated stack
}
//=======================================================================
void TimeTickConfig(void)
{
TickTimeInit = OS_TICK_TIME;
TMOD &= 0xf0;
TMOD |= 0x01;
TH0 = 0x3c;
TH0 = 0xb0;
TR0 = 1;
ET0 = 1;
}
//-----------------------------------------------------------------------
void TickTime(void)
{
TickTimeInit = OS_TICK_TIME;
}
//-----------------------------------------------------------------------
//=======================================================================
#if USE_Pre_ExternInt0
void ExternInt0(void)
{
}
#endif
//-----------------------------------------------------------------------
#if USE_Pre_ExternInt1
void ExternInt1(void)
{
}
#endif
//-----------------------------------------------------------------------
#if USE_Pre_TimeInt1
void Time1Int(void)
{
}
#endif
//-----------------------------------------------------------------------
#if USE_Pre_SeryInt
void SeryInt(void)
{
}
#endif
//=======================================================================
void OSTCBSWHook(void)
{
OSTCBCur = OSTCBHighRdy;
OSPrioCur = OSPrioHighRdy;
}
//-----------------------------------------------------------------------
void OSTickISRHook(void)
{
}
//-----------------------------------------------------------------------
void OSTaskSwHook (void)
{
;
}
//-----------------------------------------------------------------------
void OSTimeTickHook (void)reentrant
{
}
//-----------------------------------------------------------------------
void OSTaskCreateHook (OS_TCB *ptcb)reentrant
{
ptcb = ptcb;
}
//=======================================================================
#if OS_CPU_HOOKS_EN
//--------------------------------------------
void OSInitHookBegin (void)
{
}
//--------------------------------------------
void OSInitHookEnd (void)
{
}
//--------------------------------------------
void OSTaskDelHook (OS_TCB *ptcb)
{
ptcb = ptcb;
}
//--------------------------------------------
void OSTaskStatHook (void)
{
}
//--------------------------------------------
void OSTCBInitHook (OS_TCB *ptcb)
{
ptcb = ptcb;
}
//--------------------------------------------
void OSRunningTrue(void)
{
OSRunning=TRUE;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -