Data Pipe Manager (PIP Module)
Input/Output Methods
6-11
5) When the application has finished reading all the data, the frame can be
returned to the pipe by calling PIP_free.
6) Calling PIP_free causes the notifyWriter function to run. This enables the
reader thread to notify the writer thread that there is a new empty frame
available in the pipe.
The code fragment in Example 6-2 demonstrates how to read data from a
pipe.
Example 6-2 Reading Data from a Pipe
6.4.3
Using a Pipe's Notify Functions
The reader or writer threads of a pipe can operate in a polled mode and
directly test the number of full or empty frames available before retrieving the
next full or empty frame. The examples in section 6.4.1,
, page 6-9, and section 6.4.2,
demonstrate this type of polled read and write operation.
When used to buffer real-time I/O streams written (read) by a hardware
peripheral, pipe objects often serve as a data channel between the HWI
routine triggered by the peripheral itself and the program function that
ultimately reads (writes) the data. In such situations, the application can
effectively synchronize itself with the underlying I/O stream by configuring the
pipe's notifyReader (notifyWriter) function to automatically post a software
interrupt that runs the reader (writer) function.
extern far PIP_Obj readerPipe; /* created statically */
reader()
{
Uns size;
Ptr addr;
if (PIP_getReaderNumFrames(&readerPipe) > 0) {
PIP_get(&readerPipe); /* get a full frame */
}
else {
return; /* There are no available full frames */
}
addr = PIP_getReaderAddr(&readerPipe);
size = PIP_getReaderSize(&readerPipe);
' read the data from the frame '
/* release the empty frame back to the pipe */
PIP_free(&readerPipe);
}
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 ...