GIO_new
2-130
The "optArgs" parameter is a pointer that may be used to pass device or
domain-specific arguments to the mini-driver. The contents at the
specified address are interpreted by the mini-driver in a device-specific
manner.
Use the "packetBuf[]" array to pass a list of IOM_Packet items. The
number of items should match the nPackets member of the GIO_Attrs
structure passed to the "attrs" parameter. GIO_new initializes these
IOM_Packet items.
The "syncObject" parameter is usually a SEM handle.
The "attrs" parameter is a pointer to a structure of type GIO_Attrs.
typedef struct GIO_Attrs {
Int nPackets; /* number of asynch I/O packets */
Uns timeout; /* for blocking calls (SYS_FOREVER) */
} GIO_Attrs;
If attrs is NULL, a default set of attributes is used. The default for
nPackets is 2. The default for timeout is SYS_FOREVER. GIO_new
initializes the packets, but does not allocate them.
GIO_new returns the non-NULL handle to the GIO_Obj when
initialization is successful. The handle returned by this call should be
used by the application in subsequent calls to GIO functions. Usually, this
is the same handle passed to GIO_new. However, GIO_new returns a
NULL handle if the device could not be initialized. For example, if a
device is opened in a mode not supported by the device, this call returns
a NULL handle.
A call to GIO_new results in a call to the mdCreateChan function of the
associated mini-driver.
Constraints and
Calling Context
❏
This function can be called only after the device has been loaded and
initialized.
Example
/* Initialize a device object */
output = GIO_new(&outObj, "/printf", IOM_OUTPUT,
&status, NULL, outPacketBuf, outSem, &attrs);