www.pudn.com > uCOSV262.rar > OS_CPU_C.c


#ifndef  OS_MASTER_FILE 
#include "includes.h" 
#endif 
 
OS_STK *OSTaskStkInit(void(*task)(void *pd),void* ppdata,OS_STK *ptos,INT16U opt) KCREENTRANT	 
{ 
	OS_STK *stk; 
 
    ppdata = ppdata; 
    opt    = opt;                               //opt没被用到,保留此语句防止告警产生     
    stk    = (OS_STK *)ptos;                    //用户堆栈最低有效地址 
    *stk++ = 15;                                //用户堆栈长度 
    *stk++ = (INT16U)task & 0xFF;               //任务地址低8位 
    *stk++ = (INT16U)task >> 8;                 //任务地址高8位     
    *stk++ = 0x00;                              //PSW 
    *stk++ = 0x0A;                              //ACC 
    *stk++ = 0x0B;                              //B 
    *stk++ = 0x00;                              //DPL 
    *stk++ = 0x00;                              //DPH 
    *stk++ = 0x00;                              //R0 
    *stk++ = 0x01;                              //R1 
    *stk++ = 0x02;                              //R2 
    *stk++ = 0x03;                              //R3 
    *stk++ = 0x04;                              //R4 
    *stk++ = 0x05;                              //R5 
    *stk++ = 0x06;                              //R6 
    *stk++ = 0x07;                              //R7 
                                                //不用保存SP,任务切换时根据用户堆栈长度计算得出。     
   *stk++ = (INT16U) (ptos+MaxStkSize) >> 8;   //?C_XBP 仿真堆栈指针高8位 
   *stk++ = (INT16U) (ptos+MaxStkSize) & 0xFF; //?C_XBP 仿真堆栈指针低8位 
	return ((OS_STK *)ptos); 
} 
 
 
void OSTaskCreateHook(OS_TCB *ptcb)	KCREENTRANT	  
{ 
    ptcb = ptcb; 
} 
 
void OSTaskDelHook(OS_TCB *ptcb) KCREENTRANT	   
{ 
    ptcb = ptcb; 
} 
 
void OSTaskSwHook(void) KCREENTRANT   
{ 
 
} 
 
void OSTaskIdleHook(void) KCREENTRANT	  
{ 
 
} 
void OSTaskStatHook(void)  KCREENTRANT	 
{ 
 
} 
 
void OSTimeTickHook(void) KCREENTRANT	  
{ 
 
} 
 
void OSInitHookBegin(void)KCREENTRANT		   
{ 
 
} 
  
void OSInitHookEnd(void) KCREENTRANT	  
{ 
 
} 
 
void OSTCBInitHook(OS_TCB *ptcb) KCREENTRANT	  
{ 
  ptcb = ptcb; 
}