初级会员
- 积分
- 50
- 金钱
- 50
- 注册时间
- 2012-11-23
- 在线时间
- 0 小时
|
发表于 2012-11-24 23:54:51
|
显示全部楼层
回复【15楼】Pony279:
---------------------------------
原来这样啊,,谢谢你的提点啊,感激不尽
能否顺便帮我看一下,我这几个有没有问题,,唉,汇编的东西真麻烦,哈哈,
__asm void endSV_Handler(void)
{
IMPORT CURRENT_TCB
IMPORT READY_LIST
MRS R0, RIMASK
CPSID I
ALIGN
MRS R1, SP
VSTMFD R1!, {D8 - D15}
STMFD R1!, {R4 - R11}
LDR R2, =CURRENT_TCB
LDR R12,[R2]
STR R1, [R12]
LDR R1, =READY_LIST
LDR R1, [R1]
LDR R3, [R1]
LDMFD R3!, {R4 - R11}
IF {FPU} != "SoftVFP"
VLDMFD R3!, {D8 - D15}
ENDIF
STR R1, [R2]
MSR PSP, R3
;//---------------------------------------------------------------------------------------
MSR PRIMASK, R0
ISB
ORR LR, LR, #0x04
BX LR
}
//-------------------------------------------------------------------------------------------------------------------------
__asm void CPU_JUMP_TO_FIRST_TASK(void)
{
LDR R1, =CURRENT_TCB
LDR R1, [R1]
LDR R1, [R1]
ALIGN
BL __cpp(CPU_GET_STACK_FRAME_TOP_OFFSET)
ADD R2, R1, R0
MSR PSP, R2
BL __cpp(CPU_GET_R0_IN_STACK_OFFSET)
ADD R2, R1, R0
LDR R0, [R2, #0]
LDR LR, [R2, #20]
LDR R3, [R2, #24]
LDR R2, [R2, #28]
ALIGN
MSR APSR, R2
MRS R2, CONTROL
ORR R2, R2, #2
MSR CONTROL, R2
ISB
CPSIE I
BX R3
}
__asm unsigned int CPU_MUTEX_LOCK(unsigned int *MUTEX)
{
LDREX R1, [R0]
DMB
CBNZ R1, LOCK_FAIL
MOV R1, #1
STREX R2, R1, [R0]
DMB
CBNZ R1, LOCK_FAIL
MOV R0, #1
BX LR
LOCK_FAIL
MOV R0, #0
BX LR
}
__asm unsigned int CPU_IRQ_ENABLE(void){
MRS R0, RIMASK
CPSIE I
BX LR
}
__asm unsigned int CPU_IRQ_DISABLE(void){
MRS R0, RIMASK
CPSID I
BX LR
}
__asm void CPU_IRQ_RESTORE(unsigned int IRQ_BAK){
MSR PRIMASK, R0
BX LR
}
这些部分是参考一些书和网上找的资料的,现在系统用起来没发现什么大问题,可以帮我看看吗? |
|