SWI_create
Application Program Interface
2-431
C Interface
Syntax
swi = SWI_create(attrs);
Parameters
SWI_Attrs
*attrs;
/* pointer to swi attributes */
Return Value
SWI_Handle swi;
/* handle for new swi object */
Description
SWI_create creates a new SWI object. If successful, SWI_create returns
the handle of the new SWI object. If unsuccessful, SWI_create returns
NULL unless it aborts. For example, SWI_create can abort if it directly or
indirectly calls SYS_error, and SYS_error is configured to abort.
The attrs parameter, which can be either NULL or a pointer to a structure
that contains attributes for the object to be created, facilitates setting the
SWI object’s attributes. The SWI object’s attributes are specified through
a structure of type SWI_attrs defined as follows:
struct SWI_Attrs {
SWI_Fxn fxn;
Arg arg0;
Arg arg1;
Int priority;
Uns mailbox;
};
If attrs is NULL, the new SWI object is assigned the following default
attributes.
SWI_Attrs SWI_ATTRS = { /* Default attribute values */
(SWI_Fxn)FXN_F_nop, /* SWI function */
0, /* arg0 */
0, /* arg1 */
1, /* priority */
0 /* mailbox */
};
The fxn attribute, which is the address of the SWI function, serves as the
entry point of the software interrupt service routine.
The arg0 and arg1 attributes specify the arguments passed to the SWI
function, fxn.
The priority attribute specifies the SWI object’s execution priority and
must range from 0 to 14. The highest level is SWI_MAXPRI (14). The
lowest is SWI_MINPRI (0). The priority level of 0 is reserved for the
KNL_swi object, which runs the task scheduler.
SWI_create
Create a software interrupt