Stackable Devices
Streaming I/O and Device Drivers 7-17
In Example 7-8, the virtual input device, /scale2/a2d, actually comprises a
stack of two devices, each named according to the prefix of the device name
specified in your configuration file.
❏ /scale2 designates a device that transforms a fixed-point data stream
produced by an underlying device (/a2d) into a stream of scaled fixed-
point values; and
❏ /a2d designates a device managed by the A/D-D/A device driver that
produces a stream of fixed-point input from an A/D converter.
The virtual output device, /mask2/d2a, likewise denotes a stack of two
devices. Figure 7-6 shows the flow of empty and full frames through these
virtual source and sink devices as the application program calls the SIO data
streaming functions.
Figure 7-6. The Flow of Empty and Full Frames
7.4.1 Example - SIO_create and Stacking Devices
Example 7-9, illustrates two tasks, sourceTask and sinkTask, that exchange
data through a pipe device.
sourceTask is a writer task that receives data from an input stream attached
to a DGN sine device and redirects the data to an output stream attached to
a DPI pipe device. The input stream also has a stacking device, scale, on top
of the DGN sine device. The data stream coming from sine is first processed
by the scale device (that multiplies each data point by a constant integer
value), before it is received by sourceTask.
sinkTask is a reader task that reads the data that sourceTask sent to the DPI
pipe device through an input stream, and redirects it to a DGN printData
device through an output stream.
/scale2
/a2d
/mask2
/d2a
Application
Program
SIO_get ( )
Source Device
Sink Device
SIO_put ( )