Texas Instruments TMS320 User Manual page 272

Dsp/bios v5.40
Hide thumbs Also See for TMS320:
Table of Contents

Advertisement

Closing Devices
Example 7.31. Closing a Device (continued)
7-42
/*
* Don't simply SEM_reset the count here. There is a
* possibility that the HWI had just completed working on a
* buffer just before we checked, and we don't want to mess
* up the semaphore count.
*/
while (post_count > 0) {
SEM_post(objptr->sync);
post_count--;
}
}
else {
/* dev->mode = DEV_INPUT or flush was requested */
`stop the device`
/*
* do standard idling, place all frames in fromdevice
* queue
*/
while (!QUE_empty(device->todevice)) {
QUE_put(device->fromdevice,
QUE_get(device->todevice));
SEM_post(objptr->sync);
}
}
return (SYS_OK);
}
The arguments to Dxx_idle are:
DEV_Handle
device;
Bool
flush;
The device parameter is, as usual, a pointer to a DEV_Obj for this instance
of the device. flush is a boolean parameter that indicates what to do with any
pending data while returning the device to its initial state.
For a device in input mode, all pending data is always thrown away, since
there is no way to force a task to retrieve data from a device. Therefore, the
flush parameter has no effect on a device opened for input.
For a device opened for output, however, the flush parameter is significant. If
flush is TRUE, any pending data is thrown away. If flush is FALSE, the
Dxx_idle function does not return until all pending data has been rendered.
/* driver handle */
/* flush indicator */

Advertisement

Table of Contents
loading

Table of Contents