The ENTER EXIT the priority of short duration in R0 CRITICAL code, that how to ensure the CRITICAL region between the code does not use R0, is there not a problem if you use the
CodePudding user response:
Assembly code you see there is a corresponding C function prototype,uint32_t ulSetInterruptMask (void);
Void vClearInterruptMask (uint32_t ulMask);
UlSetInterruptMask has a return value, the return value is passed through R0, call ulSetInterruptMask when need to save the return value, and then restored, R0 of critical region is a free use,
Uint32_t saved;
Saved=ulSetInterruptMask ();//enter the critical section, the current interrupt state is saved to the saved
//critical region code, you can use the R0,
VClearInterruptMask (saved);//exit the critical section, restore the interrupted status save