《ucos-汇编程序(3页).doc》由会员分享,可在线阅读,更多相关《ucos-汇编程序(3页).doc(3页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、-ucos-汇编程序-第 3 页IMPORT OSRunning IMPORT OSPrioCurIMPORT OSPrioHighRdyIMPORT OSTCBCurIMPORT OSTCBHighRdyIMPORT OSIntNestingIMPORT OSIntExitIMPORT OSTaskSwHookEXPORT OSStartHighRdy EXPORT OSCtxSwEXPORT OSIntCtxSwEXPORT OS_CPU_SR_Save EXPORT OS_CPU_SR_Restore EXPORT PendSV_HandlerAREA |.text|, CODE, RE
2、ADONLY THUMB REQUIRE8 PRESERVE8 NVIC_INT_CTRL EQU 0xE000ED04 NVIC_SYSPRI4 EQU 0xE000ED22 NVIC_PENDSV_PRI EQU 0xFF NVIC_PENDSVSET EQU 0x10000000 OS_CPU_SR_Save MRS R0, PRIMASK CPSID I BX LR OS_CPU_SR_Restore MSR PRIMASK, R0 BX LROSStartHighRdy LDR R0, =NVIC_SYSPRI4 LDR R1, =NVIC_PENDSV_PRI STRB R1, R
3、0 MOV R0, #0 MSR PSP, R0 LDR R0, =OSRunning MOV R1, #1 STRB R1, R0 LDR R0, =NVIC_INT_CTRL LDR R1, =NVIC_PENDSVSET STR R1, R0 CPSIE I OSStartHang B OSStartHang OSCtxSw LDR R0, =NVIC_INT_CTRL LDR R1, =NVIC_PENDSVSET STR R1, R0 BX LROSIntCtxSw LDR R0, =NVIC_INT_CTRL LDR R1, =NVIC_PENDSVSET STR R1, R0 B
4、X LRPendSV_Handler CPSID I MRS R0, PSP CBZ R0, PendSV_Handler_Nosave SUBS R0, R0, #0x20 STM R0, R4-R11 LDR R1, =OSTCBCur LDR R1, R1 STR R0, R1 PendSV_Handler_Nosave PUSH R14 LDR R0, =OSTaskSwHook BLX R0 POP R14 LDR R0, =OSPrioCur LDR R1, =OSPrioHighRdy LDRB R2, R1 STRB R2, R0 LDR R0, =OSTCBCur LDR R1, =OSTCBHighRdy LDR R2, R1 STR R2, R0 LDR R0, R2 LDM R0, R4-R11 ADDS R0, R0, #0x20 MSR PSP, R0 ORR LR, LR, #0x04 CPSIE I BX LR end