rtx51-tiny关于os_wait函数的相关问题?
发布网友
发布时间:2022-04-20 08:48
我来回答
共1个回答
热心网友
时间:2023-07-05 01:44
通过单步调试,基本已经能确定是死在下面这段汇编代码里了,但是不知道为何,谁能解释一下?
代码:
os_switch_task1:
; next = current;
IF (TIMESHARING <> 0)
SETB?RTX_TS_DELAY; Delay Task Switching
ENDIF
MOVA,?RTX_CURRENTTASK
MOVR7,A
; while (1) {
RLA
ADDA,#?RTX?TASKSTATE?S+1
MOVR0,A
?C0001:
; if (++next == MAXTASKN+1) next = 0;
INC R7
INCR0
INCR0
IF (CPU_IDLE_CODE)
MOVA,R7
CJNEA,?RTX_CURRENTTASK,NoIDLE
JBC?RTX_ISR_SIG,NoIDLE
CPU_IDLE ; CPU sleep
NoIDLE:
ENDIF
CJNE R7,#?RTX_MAXTASKN+1,?C0003
MOVR7,#0
MOVR0,#?RTX?TASKSTATE?S+1
?C0003:
; if (STATE[next].st & K_READY) break;
MOV A,@R0
JNB ACC.B_READY,?C0001
; }