Texas Instruments TMS320 User Manual page 215

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

Advertisement

Example 6-3 Using PIP_alloc
Example 6-4 Using PIP_get
6.4.4.1 Avoiding Recursion Problems
/* correct */
PIP_alloc();
...
PIP_put();
...
PIP_alloc();
...
PIP_put();
Similarly when PIP_get is called, the reader counter is decreased by one. A
full frame is removed from the reader list and the reader frame descriptor is
updated with the information from this frame. When the application calls
PIP_free after reading the frame, the writer counter is increased by one, and
the reader frame descriptor is used by DSP/BIOS to add the new empty frame
to the pipe's writer list. Hence, every call to PIP_get must be followed by a call
to PIP_free before PIP_get can be called again as shown in Example 6-4.
The pipe I/O mechanism does not allow consecutive PIP_get calls. Doing so
would overwrite previous descriptor information and produce undetermined
results.
/* correct */
PIP_get();
...
PIP_free();
...
PIP_get();
...
PIP_free();
Care should be applied when a pipe's notify function calls PIP APIs for the
same pipe.
Consider the following example: A pipe's notifyReader function calls PIP_get
for the same pipe. The pipe's reader is an HWI routine. The pipe's writer is an
SWI routine. Hence the reader has higher priority than the writer. (Calling
PIP_get from the notifyReader in this situation can make sense because this
allows the application to get the next full buffer ready to be used by the
reader—the HWI routine—as soon as it is available and before the hardware
interrupt is triggered again.)
Data Pipe Manager (PIP Module)
/* error! */
PIP_alloc();
...
PIP_alloc();
...
PIP_put();
...
PIP_put();
/* error! */
PIP_get();
...
PIP_get();
...
PIP_free();
...
PIP_free();
Input/Output Methods
6-13

Advertisement

Table of Contents
loading

Table of Contents