Coma FW-C2800 User's Guide Page 235

  • Download
  • Add to my manuals
  • Print
  • Page
    / 276
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 234
Stackable Devices
7-16
7.4 Stackable Devices
The capabilities of the SIO module play an important role in fostering device-
independence within DSP/BIOS in that logical devices insulate your
application programs from the details of designating a particular device. For
example, /dac is a logical device name that does not imply any particular DAC
hardware. The device-naming convention adds another dimension to device-
independent I/O that is unique to DSP/BIOS—the ability to use a single name
to denote a stack of devices.
Note:
By stacking certain data streaming or message passing devices atop one
another, you can create virtual I/O devices that further insulate your
applications from the underlying system hardware.
Consider, as an example, a program implementing an algorithm that inputs
and outputs a stream of fixed-point data using a pair of A/D-D/A converters.
However, the A/D-D/A device can take only the 14 most significant bits of
data, and the other two bits have to be 0 if you want to scale up the input data.
Instead of cluttering the program with excess code for data conversion and
buffering to satisfy the algorithm’s needs, we can open a pair of virtual
devices that implicitly perform a series of transformations on the data
produced and consumed by the underlying real devices as shown in
Example 7-8.
Example 7-8. Opening a Pair of Virtual Devices
SIO_Handle input;
SIO_Handle output;
Ptr buf;
Int n;
buf = MEM_alloc(0, MAXSIZE, 0);
input = SIO_create("/scale2/a2d", SIO_INPUT, MAXSIZE, NULL);
output = SIO_create("/mask2/d2a", SIO_OUTPUT, MAXSIZE, NULL);
while (n = SIO_get(input, &buf)) {
`apply algorithm to contents of buf`
SIO_put(output, &buf, n);
}
SIO_delete(input);
SIO_delete(output);
Page view 234
1 2 ... 230 231 232 233 234 235 236 237 238 239 240 ... 275 276

Comments to this Manuals

No comments