Data Pipe Manager (PIP Module)
Input/Output Methods
6-9
There are no special format or data type requirements for the data to be
transferred by a pipe.
The DSP/BIOS online help describes data pipe objects and their parameters.
See
PIP Module
in the
TMS320 DSP/BIOS API Reference Guide
for your
platform for information on the PIP module API.
6.4.1
Writing Data to a Pipe
The steps that a program should perform to write data to a pipe are as follows:
1) A function should first check the number of empty frames available to be
filled with data. To do this, the program must check the return value of
PIP_getWriterNumFrames. This function call returns the number of
empty frames in a pipe object.
2) If the number of empty frames is greater than 0, the function then calls
PIP_alloc to get an empty frame from the pipe.
3) Before returning from the PIP_alloc call, DSP/BIOS checks whether
there are additional empty frames available in the pipe. If so, the
notifyWriter function is called at this time.
4) Once PIP_alloc returns, the empty frame can be used by the application
code to store data. To do this the function needs to know the frame's start
address and its size. The API function PIP_getWriterAddr returns the
address of the beginning of the allocated frame. The API function
PIP_getWriterSize returns the number of words that can be written to the
frame. (The default value for an empty frame is the configured frame
size.)
5) When the frame is full of data, it can be returned to the pipe. If the number
of words written to the frame is less than the frame size, the function can
specify this by calling the PIP_setWriterSize function. Afterwards, call
PIP_put to return the data to the pipe.
6) Calling PIP_put causes the notifyReader function to run. This enables the
writer thread to notify the reader thread that there is data available in the
pipe to be read.
The code fragment in Figure 6-1 demonstrates how to write data to a pipe.
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 ...