h6. [[Portable]] h6(. » [[Portable SWI Calls|SWI Calls]] h6((. » Portable_Idle h2. Portable_Idle h5. (SWI &42FC6) |_<^{width:4em}. Entry | | |<^. - |<^. | |_<^{width:4em}. Exit | | |<^. - |<^. | h4. Use The purpose of this call is to put the CPU into a low-power idle state until an IRQ or FIQ interrupt is pending. It implements functionality equivalent to the ARMv7 'WFI' instruction. h4. Notes SWI [[Portable_ReadFeatures]] can be used to determine if this call is available. It's important to realise that Portable_Idle will function as intended even if IRQs/FIQs are disabled on entry. Therefore, to wait for a specific interrupt (or interrupt driven event), it's recommended to use the following procedure: # Disable interrupts # Check if the event has occurred. If so, re-enable interrupts and exit # Call Portable_Idle # Re-enable interrupts # Call the interrupt delay routine returned by [[OS_PlatformFeatures 0]] to ensure the pending interrupt has been handled # Go to 1 Keeping IRQs disabled for steps 2 and 3 avoids a race condition where the event may fire after you've checked to see if it's fired, but before the CPU is able to go to sleep. If IRQs were enabled and the race condition occurred then the CPU would go to sleep for no reason. At best this will reduce the responsiveness of your code, at worst it will deadlock the system (e.g. if there are no other regular IRQs) h4. See also * [[Portable_ReadFeatures]] * [[OS_PlatformFeatures 0]]