Disabling Interrupts
CPU_CRITICAL_ENTER()
calls CPU_SR_Save()
. CPU_SR_Save()
is a function typically written in assembly language that saves the current interrupt disable status and then disables interrupts. The saved interrupt disable status is returned to the caller and in fact, it is stored onto the caller’s stack in a variable called “cpu_sr
”.
CPU_CRITICAL_EXIT()
maps to CPU_SR_Restore()
. CPU_SR_Restore()
is passed the value of the saved “cpu_sr
” variable to re-establish interrupts the way they were prior to calling CPU_CRITICAL_ENTER()
.