的堆栈指针sp 的值,改成优先级最高的就绪态任务的堆栈指针的值,然后将该任务的状态字由非运行态“false”,改为运行态“true”,然后 执行中断返回指令rti 以开始运行这个任务。以下是详细代码: void osstarthighrdy(void) { ostaskswhook(); //调用钩子函数 asm{ ldx ostcbcur // 加载ostcbcur 的地址到 x lds 0,x //把ostcbstrptr 载入堆栈指针 sp ldaa osrunning inca // srunning = true staa osrunning rti } } 3.2.4 任务级任务切换函数osctxsw()和中断级任务切换函数osintctxsw() 任务级的切换是通过执行软中断指令来实现的。osctxsw()实际上就是软中断服务子程序,软中断服务子程序的向量地址指向osctxsw()。如果当前任务调用μc/os-ii 提供的功能函数,并使更高优先级任务进入了就绪状态,则μc/os-ii
le program to show how to use macros (adg). mlist on ; show macro expansions in listing data equ $4000 ; start of memory desired for data storagecode equ $6000 ; start of memory desired for code storageadder macro ldaa \1 ; load from first location adda \2 ; add in from second location staa \3 ; store to third location endm org datanum1 dc.b $10 ; allocate first location, init. to $10num2 dc.b $20 ; allocate secon
asm nop;}void main(void) { /* put your own code here */ enableinterrupts; counter=0x00; delay(); asm{ ldab #1; stab refdv; ldab #2; stab synr; wait: brclr crgflg , #$08,*; bset clksel , #$80; sci0init: ldaa #$0c8; staa sci0cr2 ldd #$009c; std sci0bd; nop; } asm nop; sci0drl = 0x55; while (sci0sr1_tc==0) ; delay(); asm nop; for(;;) {} /* wait forever */}