RISC OS Open
Safeguarding the past, present and future of RISC OS for everyone
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

Portable_Idle

Portable
» SWI Calls
» Portable_Idle

Portable_Idle

(SWI &42FC6)
Entry  
-
Exit  
-

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.

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:

  1. Disable interrupts
  2. Check if the event has occurred. If so, re-enable interrupts and exit
  3. Call Portable_Idle
  4. Re-enable interrupts
  5. Call the interrupt delay routine returned by OS_PlatformFeatures 0 to ensure the pending interrupt has been handled
  6. 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)

See also

  • Portable_ReadFeatures
  • OS_PlatformFeatures 0
Revised on March 12, 2015 11:06:00 by Jeffrey Lee (213) (5.148.5.244)
Edit | Back in time (4 revisions) | See changes | History | Views: Print | Source | Linked from: Portable Feature Matrix, Portable SWI Calls, Portable_ReadFeatures, OS_PlatformFeatures 34 Flags

Search the Wiki

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys