Selecting Among Multiple Streams
Streaming I/O and Device Drivers
7-23
7.6 Selecting Among Multiple Streams
The SIO_select function allows a single DSP/BIOS task to wait until an I/O
operation can be performed on one or more of a set of SIO streams without
blocking. For example, this mechanism is useful in the following applications:
❏
Non-blocking I/O.
Real-time tasks that stream data to a slow device (for
example, a disk file) must ensure that SIO_put does not block.
❏
Multitasking.
In virtually any multitasking application there are daemon
tasks that route data from several sources. The SIO_select mechanism
allows a single task to handle all of these sources.
SIO_select is called with an array of streams, an array length, and a time-out
value. SIO_select blocks (if timeout is not 0) until one of the streams is ready
for I/O or the time-out expires. In either case, the mask returned by
SIO_select indicates which devices are ready for service (a 1 in bit j indicates
that streamtab[ j ] is ready) as shown in Example 7-13.
Example 7-13.
Indicating That a Stream is Ready
7.6.1
Programming Example
In Example 7-14, two streams are polled to see if an I/O operation will block.
Uns SIO_select(streamtab, nstreams, timeout)
SIO_Handle streamtab[]; /* stream table */
Uns nstreams; /* number of streams */
Uns timeout; /* return after this many */
/* system clock ticks */
Summary of Contents for TMS320 Series
Page 1: ...TMS320 DSP BIOS v5 40 User s Guide Literature Number SPRU423G April 2009 ...
Page 16: ...xvi ...
Page 152: ...Tasks 4 48 Figure 4 12 Trace from Example 4 7 ...
Page 168: ...Semaphores 4 64 Figure 4 14 Trace Results from Example 4 11 ...
Page 202: ...5 20 ...
Page 287: ...Index 9 Index Void 1 11 W words data memory 3 15 of code 1 5 wrapper function 2 29 ...
Page 288: ...Index 10 Index ...