- UID
- 167468
- 性别
- 男
|
我的CPU用的是S12DT256.移植不成功。连空任务都跑不起来。我想问题出在两个函数里。
void *OSTaskStkInit (void (*task)(void *pd), void *pdata, void *ptos, INT16U opt)
{
INT16U *wstk;
INT8U *bstk;
opt = opt; /* 'opt' is not used, prevent wating */
wstk = (INT16U *)ptos; /* Load stack pointer */
*--wstk = (INT16U)pdata; /* Simulate call to function with argument */
*--wstk = (INT16U)task;
*--wstk = (INT16U)task; /* Put pointer to task on top of stack */
*--wstk = (INT16U)0x2233; /* Y Register */
*--wstk = (INT16U)0x1122; /* X Register */
*--wstk = (INT16U)0xBBAA; /* D Register */
bstk = (INT8U *)wstk; /* Convert WORD ptr to BYTE ptr to set CCR */
*--bstk = 0x80; /* CCR Register (Disable STOP instruction) */
return ((void *)bstk); /* Return pointer to new top-of-stack */
}
和这个函数
void OSStartHighRdy(void)
{
OSTaskSwHook(); // Call Hook function
asm{
// Load the value pointed by OSTCBCur to sp
ldaa OSRunning
inca
staa OSRunning
ldx OSTCBCur // Load the value in OSTCBCur or the TCB's address to x
lds 0,x
nop
rti
}
//有经验的朋友给指点下,看看是不是我的函数不对,谢谢了!
}
|
|