Texas Instruments TMS320 User Manual page 250

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

Advertisement

Stackable Devices
Example 7.9. Data Exchange Through a Pipe Device (continued)
*
======== main ========
*/
Void main()
{
LOG_printf(&trace, "Start SIO example #5");
}
/*
*
======== source ========
*
This function forms the body of the sourceTask TSK thread.
*/
Void source(Uns nloops)
{
SIO_Handle input = &inStreamSrc;
SIO_Handle output = &outStreamSrc;
/* Do I/O */
doStreaming(input, output, nloops);
}
/*
*
======== sink ========
*
This function forms the body of the sinkTask TSK thread.
*/
Void sink(Uns nloops)
{
SIO_Handle input = &inStreamSink;
SIO_Handle output = &outStreamSink;
/* Do I/O */
doStreaming(input, output, nloops);
LOG_printf(&trace, "End SIO example #5");
}
/*
*
======== doStreaming ========
*
I/O function for the sink and source tasks.
*/
static Void doStreaming(SIO_Handle input, SIO_Handle output, Uns nloops)
{
Ptr
Int
if (SIO_staticbuf(input, &buf) == 0){
}
for (i = 0; i < nloops; i++) {
}
}
7-20
buf;
i, nbytes;
SYS_abort("Eror reading buffer %d", i);
if ((nbytes = SIO_get (input, &buf)) <0) {
SYS_abort ("Error reading buffer %d", i);
}
if (SIO_put (output, &buf, nbytes) <0) {
SYS_abort ("Error writing buffer %d", i);
}
The output for Example 7-9 is scaled sine wave data as in Figure 7-7.

Advertisement

Table of Contents
loading

Table of Contents