GIO_create
Application Program Interface
2-125
C Interface
Syntax
gioChan = GIO_create(name, mode, *status, chanParams, *attrs)
Parameters
String
name
/* name of the device to open */
Int
mode
/* mode in which the device is to be opened */
Int
*status
/* address to place driver return status */
Ptr
chanParams /* optional */
GIO_Attrs
*attrs
/* pointer to a GIO_Attrs structure */
Return Value
GIO_Handle gioChan;
/* handle to an instance of the device */
Description
An application calls GIO_create to create a GIO_Obj object and open a
communication channel. This function initializes the I/O channel and
opens the lower-level device driver channel. The GIO_create call also
creates the synchronization objects it uses and stores them in the
GIO_Obj object.
The name argument is the name specified for the device when it was
created in the configuration or at runtime.
The mode argument specifies the mode in which the device is to be
opened. This may be IOM_INPUT, IOM_OUTPUT, or IOM_INOUT.
If the status returned by the device is non-NULL, a status value is placed
at the address specified by the status parameter.
The chanParams 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.
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.
The GIO_create call allocates a list of IOM_Packet items as specified by
the nPackets member of the GIO_Attrs structure and stores them in the
GIO_Obj object it creates.
GIO_create
Allocate and initialize a GIO object