我在s3c2440上移植ucos时出现中断后任务不能切换的问题,请教一下
代码如下:
OSTickISR
stmfd sp!,{r0-r3}
mov r1,sp
add sp,sp,#16 ;pop r0-r3
sub r2,lr,#4 ;get pc in svc mode
mrs r3, spsr ;get cpsr in svc mode
msr cpsr_c,#(NOINT|SVCMODE) ;switch to SVC mode
stmfd sp!,{r2}
stmfd sp!,{lr}
stmfd sp!,{r4-r12}
ldmfd r1!,{r4-r7}
stmfd sp!,{r4-r7}
stmfd sp!,{r3}
mrs r4, spsr
stmfd sp!,{r4}
;bl OSIntEnter
ldr r0, =OSIntNesting
ldrb r1, [r0]
add r1, r1,#1
strb r1, [r0]
cmp r1, #1
bne ISR1
bl OSTest2Hook
ldr r4, =OSTCBCur
ldr r5, [r4]
str sp, [r5]
ISR1
ldr r0, =SRCPND
mov r1, #BIT_TIMER4
str r1, [r0]
ldr r0, =INTPND
ldr r1,[r0]
str r1, [r0]
bl OSTimeTick
bl OSIntExit
bl OSTest1Hook
ldmfd sp!,r4
msr spsr_cxsf, r4
ldmfd sp!,{r4}
msr cpsr_cxsf, r4
ldmfd sp!,{r0-r12,lr,pc}
OSIntCtxSw
;call user definable OSTaskSwHook()
bl OSTaskSwHook
;OSPrioCur = OSPrioHighRdy
ldr r4 , =OSPrioCur
ldr r5 , =OSPrioHighRdy
ldrb r5 , [r5]
strb r5 , [r4]
;OSTCBCur = OSTCBHighRdy
ldr r4 , =OSTCBCur
ldr r5 , =OSTCBHighRdy
ldr r5 , [r5]
str r5 , [r4]
;stack pointer = OSTCBHighRdy->OSTCBStkPtr
ldr r4 , =OSTCBHighRdy
ldr r4 , [r4]
ldr sp , [r4]
;restore tasks mode registers
ldmfd sp!,{r4}
msr spsr_cxsf, r4
ldmfd sp!,{r4}
msr cpsr_cxsf, r4
;return in new task context
ldmfd sp!,{r0-r12,lr,pc} |