最近在学习ucos,并在mc9s12xdg128上移植跑了几个任务。看了《用XGATE协处理器提高μC/OS-II的实时性》文章,也想用XGATE协处理器来实现ucos时钟节拍,由于文章说得不太清楚,所以自己摸索着做,但调试时出现了点运行,程序就跑飞的现象。[font]010哪位大侠知道原因,望指教,谢谢!在xgate.cxgate文件中的RTI中断程序如下: interrupt void RTI_Handler(int data) { CRGFLG |= 0x80; asm { LOOP1: SSEM #2 BCC LOOP1 } tcb_x = (volatile OS_TCB *)((int)OSTCBList+0xC000); //任务C if (tcb_x->OSTCBDly != 0) { if (--(tcb_x->OSTCBDly) == 0) { if ((tcb_x->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { OSRdyGrp |= tcb_x->OSTCBBitY; OSRdyTbl[tcb_x->OSTCBY] |= tcb_x->OSTCBBitX; count++; } else { tcb_x->OSTCBDly = 1; } } } //任务B tcb_x = (volatile OS_TCB *)((int)tcb_x-0x0023);//(volatile OS_TCB *)((int)(tcb_x->OSTCBNext)+0xc000); //屏蔽下面这段,程序可以切换任务C和A, //只要加上下面这段,点运行程序就飞了,不知什么原因, /* if (tcb_x->OSTCBDly != 0) { if (--(tcb_x->OSTCBDly) == 0) { if ((tcb_x->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { OSRdyGrp |= tcb_x->OSTCBBitY; OSRdyTbl[tcb_x->OSTCBY] |= tcb_x->OSTCBBitX; count++; } else { tcb_x->OSTCBDly = 1; } } } */ //任务A tcb_x = (volatile OS_TCB *)((int)tcb_x-0x0023);//(volatile OS_TCB *)((int)(tcb_y->OSTCBNext)+0xc000); //本来是在这里用while语句遍历链表的,但不行,点运行程序就飞了。 //所以我试着拆开,看问题出在哪,见上面文字 ,还有在这里观测到的当前任务OSTCBCur老是空闲任务,不解,,, // while (tcb_x->OSTCBPrio != OS_IDLE_PRIO) // { if (tcb_x->OSTCBDly != 0) { if (--(tcb_x->OSTCBDly) == 0) { if ((tcb_x->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { OSRdyGrp |= tcb_x->OSTCBBitY; OSRdyTbl[tcb_x->OSTCBY] |= tcb_x->OSTCBBitX; count++; } else { tcb_x->OSTCBDly = 1; } } } // dly = *(INT16U *)((int)tcb_x + 0x001A); // prio=*(INT8U *)((int)tcb_x + 0x001D); //} asm CSEM #2;
asm SIF; }
[此贴子已经被作者于2009-8-11 8:49:02编辑过] |