Texas Instruments TMS320 User Manual page 239

Dsp/bios v5.40
Hide thumbs Also See for TMS320:
Table of Contents

Advertisement

Figure 7-3. How SIO_get Works
Application
Program
SIO_get (stream, &bufp)
Free Buffer
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.
Stream I/O—Reading and Writing Streams
Exchange
Streaming I/O and Device Drivers
Device
Driver
Full Buffer
7-9

Advertisement

Table of Contents
loading

Table of Contents