HWI_disable
Application Program Interface
2-159
C Interface
Syntax
oldST1 = HWI_disable();
Parameters
Void
Return Value
Uns oldST1;
Reentrant
yes
Description
HWI_disable disables hardware interrupts by setting the intm bit in the
status register. Call HWI_disable before a portion of a function that needs
to run without interruption. When critical processing is complete, call
HWI_restore or HWI_enable to reenable hardware interrupts.
Interrupts that occur while interrupts are disabled are postponed until
interrupts are reenabled. However, if the same type of interrupt occurs
several times while interrupts are disabled, the interrupt’s function is
executed only once when interrupts are reenabled.
A context switch can occur when calling HWI_enable or HWI_restore if
an enabled interrupt occurred while interrupts are disabled.
HWI_disable may be called from main(). However, since HWI interrupts
are already disabled in main(), such a call has no effect.
Example
old = HWI_disable
()
;
'do some critical operation'
HWI_restore(old);
See Also
HWI_enable
HWI_restore
SWI_disable
SWI_enable
HWI_disable
Disable hardware interrupts