#define OS_CRITICAL_METHOD 3 #if OS_CRITICAL_METHOD == 3 #if OS_CPU_INT_DIS_MEAS_EN > 0 #define OS_ENTER_CRITICAL() {cpu_sr = OS_CPU_SR_Save(); OS_CPU_IntDisMeasStart();} #define OS_EXIT_CRITICAL() {OS_CPU_IntDisMeasStop(); OS_CPU_SR_Restore(cpu_sr);} #else #define OS_ENTER_CRITICAL() {cpu_sr = OS_CPU_SR_Save();} #define OS_EXIT_CRITICAL() {OS_CPU_SR_Restore(cpu_sr);} #endif #endif ********************************************************** ********************************************************** #if OS_CRITICAL_METHOD == 3 __arm OS_CPU_SR OS_CPU_SR_Save(void); __arm void OS_CPU_SR_Restore(OS_CPU_SR cpu_sr); #endif ********************************************************** ********************************************************** OS_CPU_SR_Save MRS R0, CPSR ; Set IRQ and FIQ bits in CPSR to disable all interrupts. ORR R1, R0, #OS_CPU_ARM_CONTROL_INT_DIS MSR CPSR_c, R1 BX LR ; Disabled, return the original CPSR contents in R0.
OS_CPU_SR_Restore MSR CPSR_c, R0 BX LR
以上是uc/OS网站上一段移植到arm的程序,请教: 1,为什么在disable all interrupts. 和OS_CPU_SR_Restore 中最后一行都有BX LR ? 在这种情况下程序返回到那里去? 2,cpu_sr = OS_CPU_SR_Save(); 中OS_CPU_SR_Save()是如何带回一个值返回给cpu_sr的? 谢谢!!!!
|