DEV Module
2-60
Constants, Types, and
Structures
#define DEV_INPUT 0
#define DEV_OUTPUT 1
typedef struct DEV_Frame { /* frame object */
QUE_Elem link; /* queue link */
Ptr addr; /* buffer address */
size_t size; /* buffer size */
Arg misc; /* reserved for driver */
Arg arg; /* user argument */
Uns cmd; /* mini-driver command */
Int status; /* status of command */
} DEV_Frame;
typedef struct DEV_Obj { /* device object */
QUE_Handle todevice; /* downstream frames here */
QUE_Handle fromdevice; /* upstream frames here */
size_t bufsize; /* buffer size */
Uns nbufs; /* number of buffers */
Int segid; /* buffer segment ID */
Int mode; /* DEV_INPUT/DEV_OUTPUT */
#if (defined(_54_) && defined(_FAR_MODE))
|| defined(_55_)
LgInt devid; /* device ID */
#else
Int devid; /* device ID */
#endif
Ptr params; /* device parameters */
Ptr object; /* ptr to dev instance obj */
DEV_Fxns fxns; /* driver functions */
Uns timeout; /* SIO_reclaim timeout value */
Uns align; /* buffer alignment */
DEV_Callback *callback; /* pointer to callback */
} DEV_Obj;
typedef struct DEV_Fxns { /* driver function table */
Int (*close)( DEV_Handle );
Int (*ctrl)( DEV_Handle, Uns, Arg );
Int (*idle)( DEV_Handle, Bool );
Int (*issue)( DEV_Handle );
Int (*open)( DEV_Handle, String );
Bool (*ready)( DEV_Handle, SEM_Handle );
size_t (*reclaim)( DEV_Handle );
} DEV_Fxns;
typedef struct DEV_Callback {
Fxn fxn; /* function */
Arg arg0; /* argument 0 */
Arg arg1; /* argument 1 */
} DEV_Callback;