Io_iaccess (acquire semaphore), Io_iaccess_wait (acquire semaphore and wait) – Echelon Neuron User Manual
Page 180

Registers Affected: None
Example:
This example increments 300.
pushd #d’300 ; (44, 1)
call _inc16 ; (45, 1)
io_iaccess (Acquire Semaphore)
This function is only available for Series 5000 and 6000 chips. The function
acquires the system synchronization semaphore and returns after the semaphore
has been successfully acquired, allowing synchronized access to shared resources
from interrupts and application code.
The function takes no arguments and always succeeds, but the time taken until
the function returns varies, subject to the state of the semaphore when calling
this function.
The Series 5000 and 6000 chips support one single, binary, semaphore. Multiple
calls to this function can lead to deadlock. Use io_irelease to release the
semaphore.
Stack Transformation: ( -- )
Location: Far
Registers Affected: None
Example:
This example acquires the semaphore, then modifies a global variable, then
releases the semaphore.
import io_iaccess, io_irelease
...
; ( data -- )
callf io_iaccess
; ( data -- )
pop globalVar
; ( -- )
callf io_irelease
; ( -- )
io_iaccess_wait (Acquire Semaphore and Wait)
This function is only available for Series 5000 and 6000 chips. This function is
identical to the io_iaccess() function, except that it is designed for NodeBuilder
debug targets. This function updates the watchdog timer in addition to acquiring
the system synchronization semaphore. This function logs a system error if
interrupt tasks run in the APP processor.
If an interrupt trigger condition is met while the application is halted at a
breakpoint within a lock construct (the Neuron C __lock{ } keyword or code
bounded by the io_iaccess() and io_irelease functions), and the interrupt task
tries to enter a lock, the Neuron Chip or Smart Transceiver watchdog timer times
out, and the device resets. Use the io_iaccess_wait() function to avoid the
170
System-Provided Functions