Stream I/O—Reading and Writing Streams
7-8
Example 7-4.
Implementing the Issue/Reclaim Streaming Model
If no buffer is available, the stream will block the task until the buffer becomes
available or the stream’s timeout has elapsed.
At a basic level, the most obvious difference between the standard and
Issue/Reclaim models is that the Issue/Reclaim model separates the
notification of a buffer’s arrival (SIO_issue) and the waiting for a buffer to
become available (SIO_reclaim). So, an SIO_issue/SIO_reclaim pair
provides the same buffer exchange as calling SIO_get or SIO_put.
The Issue/Reclaim streaming model provides greater flexibility by allowing
the stream client to control the number of outstanding buffers at runtime. A
client can send multiple buffers to a stream, without blocking, by using
SIO_issue. The buffers are returned, at the client’s request, by calling
SIO_reclaim. This allows the client to choose how deep to buffer a device and
when to block and wait for a buffer.
The Issue/Reclaim streaming model also provides greater determinism in
buffer management by guaranteeing that the client’s buffers are returned in
the order that they were issued. This allows a client to use memory from any
source for streaming. For example, if a DSP/BIOS task receives a large
buffer, that task can pass the buffer to the stream in small pieces—simply by
advancing a pointer through the larger buffer and calling SIO_issue for each
piece. This works because each piece of the buffer is guaranteed to come
back in the same order it was sent.
7.3.1
Buffer Exchange
An important part of the streaming model in DSP/BIOS is buffer exchange. To
provide efficient I/O operations with a low amount of overhead, DSP/BIOS
avoids copying data from one place to another during certain I/O operations.
Instead, DSP/BIOS uses SIO_get, SIO_put, SIO_issue, and SIO_reclaim to
move buffer pointers to and from the device. Figure 7-3 shows a conceptual
view of how SIO_get works.
Int SIO_issue(stream, pbuf, nbytes, arg)
SIO_Handle stream;
Ptr pbuf;
Uns nbytes;
Arg arg;
Int SIO_reclaim(stream, bufp, parg)
SIO_Handle stream;
Ptr *bufp;
Arg *parg;
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 ...