Specifications
D
evice Driver Programming
17-30
Parameters
dev_desc the identifier for the device to or from which the asynchronous I/O operation
is being performed. This identifier is allocated on a call to the driver’s open
routine.
req_id the request identifier of the asynchronous I/O operation for which the process
is waiting. This identifier is allocated by the driver if a pointer is supplied on a
call to the driver’s aread or awrite routine.
count a pointer to the location to which the number of bytes transferred by the
specified I/O operation is returned
Return Value
The driver’s await routine returns EUD_NOERROR when the specified asynchronous I/O
operation has been completed.
Example specification and pseudo code for a user-level driver’s await routine are
presented as follows:
int
dev_await(dev_desc, req_id, count)
int dev_desc;
int req_id;
int *count;
{
Get I/O request data structure associated with the req_id.
IF interrupts not enabled THEN return an error code.
LOOP WHILE I/O not done or error has not occurred
block until wakened by interrupt.
ENDLOOP
Get transfer count from request data structure and
place it in the count parameter.
Free I/O request data structure.
Return success status.
}
Control Functions 17
The driver’s control functions allow a user process to control a device in ways that are
specific to the device. Some of the control functions of the user-level device driver for the
DR11W emulator, for example, allow a user process to set or obtain the value of the DMA
transfer mode associated with a particular dr11w, send a GO signal to the attached device
and enable DMA transfers, or query the values of the registers associated with a particular
dr11w.