Opening Devices
7-34
7.12 Opening Devices
Dxx_open opens a Dxx device and returns its status seen in Example 7-23:
Example 7-23. Opening a Device with Dxx_open
SIO_create calls Dxx_open to open a Dxx device as seen in Example 7-24.
Example 7-24. Opening an Input Terminating Device
This sequence of steps illustrates the opening process for an input-
terminating device:
1) Find string matching a prefix of /adc16 in DEV_devtab device table. The
associated DEV_Device structure contains driver function, device ID,
and device parameters.
2) Allocate DEV_Obj device object.
3) Assign bufsize, nbufs, segid, etc. fields in DEV_Obj from parameters and
SIO_Attrs passed to SIO_create.
4) Create todevice and fromdevice queues.
5) If opened for DEV_STANDARD streaming model, allocate attrs.nbufs
buffers of size BUFSIZE and put them on todevice queue.
6) Call Dxx_open with pointer to new DEV_Obj and remaining name string
using syntax as shown:
status - Dxx_open (device, "16")
7) Validate fields in DEV_Obj pointed to by device.
8) Parse string for additional parameters (for example, 16 kHz).
9) Allocate and initialize device-specific object.
10) Assign device-specific object to device
→object.
The arguments to Dxx_open are shown in Example 7-25.
Example 7-25. Arguments to Dxx_open
status = Dxx_open(device, name);
input = SIO_create("/adc16", SIO_INPUT, BUFSIZE, NULL)
DEV_Handle device; /* driver handle */
String name; /* device name */