GIO_new
Application Program Interface
2-129
C Interface
Syntax
gioChan = GIO_new(gioChan, name, mode, *status, optArgs,
packetBuf[], syncObject, *attrs);
Parameters
GIO_Handle gioChan
/* Handle to GIO Obj */
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
optArgs
/* optional args to mdCreateChan */
IOM_packet packetBuf[]
/* to be initialized to zero */
Ptr
syncObject
/* sync Object */
GIO_Attrs
*attrs
/* pointer to a GIO_Attrs structure */
Return Value
GIO_Handle gioChan;
/* handle to the initialized GIO object */
Description
An application calls GIO_new to initialize 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_new call
does not
allocate any memory. It requires pre-allocated memory.
The "gioChan" parameter is a handle to a structure of type GIO_Obj that
your program has declared. GIO_new initializes this structure.
typedef struct GIO_Obj {
IOM_Fxns *fxns; /* ptr to function table */
Uns mode; /* create mode */
Uns timeout; /* timeout for blocking */
IOM_Packet syncPacket; /* for synchronous use */
QUE_Obj freeList; /* frames for asynch I/O */
Ptr syncObj; /* ptr to synchro. obj */
Ptr mdChan; /* ptr to channel obj */
} GIO_Obj, *GIO_Handle;
The "name" parameter is the name previously specified for the device. It
is used to find a matching name in the device table.
The "mode" parameter 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.
GIO_new
Initialize a GIO object with pre-allocated memory