Real-Time I/O
7-40
Figure 7-29 is a template for Dxx_issue for a typical terminating device.
Example 7-29. Template for Dxx_issue for a Typical Terminating Device
A call to Dxx_issue starts the device for the appropriate mode, either
DEV_INPUT or DEV_OUTPUT. Once the device is known to be started,
Dxx_issue simply returns. The actual data handling is performed by an HWI.
Figure 7-30 is a template for Dxx_reclaim for a typical terminating device.
Example 7-30. Template for Dxx_reclaim for a Typical Terminating Device
A call to Dxx_reclaim waits for the HWI to place a frame on the
device->fromdevice queue, then returns.
Dxx_reclaim calls SEM_pend with the timeout value specified at the time the
stream is created (either statically or with SIO_create) with this value. If the
timeout expires before a buffer becomes available, Dxx_reclaim returns
SYS_ETIMEOUT. In this situation, SIO_reclaim does not attempt to get
anything from the device->fromdevice queue. SIO_reclaim returns
SYS_ETIMEOUT, and does not return a buffer.
/*
* ======== Dxx_issue ========
*/
Int Dxx_issue(DEV_Handle device)
{
Dxx_Handle objptr = (Dxx_Handle) device->object;
if ( `device is not operating in correct mode` ) {
`start the device for correct mode`
}
return (SYS_OK);
}
/*
* ======== Dxx_reclaim ========
*/
Int Dxx_reclaim(DEV_Handle device)
{
Dxx_Handle objptr = (Dxx_Handle) device->object;
if (SEM_pend(objptr->sync, device->timeout)) {
return (SYS_OK);
}
else { /* SEM_pend() timed out */
return (SYS_ETIMEOUT);
}
}