Texas Instruments TMS320 User Manual page 265

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

Advertisement

Example 7-26. The Parameters of SIO_create
Example 7-27. The Dxx_Obj Structure
The device parameter points to an object of type DEV_Obj whose fields have
been initialized by SIO_create. name is the string remaining after the device
name has been matched by SIO_create using DEV_match.
Recall that SIO_create takes the parameters and is called as shown in
Example 7-26.
stream = SIO_create(name, mode, bufsize, attrs);
The name parameter passed to SIO_create is typically a string indicating the
device and an additional suffix, indicating some particular mode of operation
of the device. An analog-to-digital converter might have the base name /adc,
while the sampling frequency might be indicated by a tag such as 16 for 16
kHz. The complete name passed to SIO_create would be /adc16.
SIO_create identifies the device by using DEV_match to match the string
/adc against the list of configured devices. The string remainder 16 would be
passed to Dxx_open to set the ADC to the correct sampling frequency.
Dxx_open usually allocates a device-specific object that is used to maintain
the device state, as well as necessary semaphores. For a terminating device,
this object typically has two SEM_Handle semaphore handles. One is used
for synchronizing I/O operations (for example, SIO_get, SIO_put,
SIO_reclaim). The other handle is used with SIO_select to determine if a
device is ready. A device object would typically be defined as shown in
Example 7-27.
typedef struct Dxx_Obj {
SEM_Handle
SEM_Handle
`other device-specific fields`
} Dxx_obj, *Dxx_Handle;
Example 7-28 provides a template for Dxx_open, showing the function's
typical features for a terminating device.
sync;
/* synchronize I/O */
ready;
/* used with SIO_select() */
Streaming I/O and Device Drivers
Opening Devices
7-35

Advertisement

Table of Contents
loading

Table of Contents