Stream I/O—Reading and Writing Streams
Streaming I/O and Device Drivers
7-9
Figure 7-3.
How SIO_get Works
In Figure 7-3, the device driver associated with stream fills a buffer as data
becomes available. At the same time, the application program is processing
the current buffer. When the application uses SIO_get to get the next buffer,
the new buffer that was filled by the input device is swapped for the buffer
passed in. This is accomplished by exchanging buffer pointers instead of
copying bufsize bytes of data, which would be very time consuming.
Therefore, the overhead of SIO_get is independent of the buffer size.
In each case, the actual physical buffer has been changed by SIO_get. The
important implication is that you must make sure that any references to the
buffer used in I/O are updated after each operation. Otherwise, you are
referencing an invalid buffer.
SIO_put uses the same exchange of pointers to swap buffers for an output
stream. SIO_issue and SIO_reclaim each move data in only one direction.
Therefore, an SIO_issue/SIO_reclaim pair result in the same swapping of
buffer pointers.
Note:
A single stream cannot be used by more than one task simultaneously.
That is, only a single task can call SIO_get/SIO_put or
SIO_issue/SIO_reclaim at once for each stream in your application.
SIO_get (stream, &bufp)
Free Buffer
Exchange
Full Buffer
Application
Program
Device
Driver
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 ...