SWI_disable
Application Program Interface
2-435
C Interface
Syntax
SWI_disable();
Parameters
Void
Return Value
Void
Reentrant
yes
Description
SWI_disable and SWI_enable control software interrupt processing.
SWI_disable disables all other SWI functions from running until
SWI_enable is called. Hardware interrupts can still run.
SWI_disable and SWI_enable let you ensure that statements that must
be performed together during critical processing are not interrupted. In
the following example, the critical section is not preempted by any SWIs.
SWI_disable();
`critical section`
SWI_enable();
You can also use SWI_disable and SWI_enable to post several SWIs
and have them performed in priority order. See the following example.
SWI_disable calls can be nested. The number of nesting levels is stored
internally. SWI handling is not reenabled until SWI_enable has been
called as many times as SWI_disable.
Constraints and
Calling Context
❏
The calls to HWI_enter and HWI_exit required in any HWIs that
schedule SWIs automatically disable and reenable SWI handling.
You should not call SWI_disable or SWI_enable within a HWI.
❏
SWI_disable cannot be called from the program’s main() function.
❏
Do not call SWI_enable when SWIs are already enabled. If you do, a
subsequent call to SWI_disable does not disable SWI processing.
Example
/* ======== postEm ======== */
Void postEm
{
SWI_disable
()
;
SWI_post(&encoderSwi);
SWI_andn(©Swi, mask);
SWI_dec(&strikeoutSwi);
SWI_enable
()
;
}
See Also
SWI_disable
Disable software interrupts