EasyManua.ls Logo

Texas Instruments TMS320

Texas Instruments TMS320
288 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Stackable Devices
7-20
Example 7.9. Data Exchange Through a Pipe Device (continued)
The output for Example 7-9 is scaled sine wave data as in Figure 7-7.
* ======== 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 buf;
Int i, nbytes;
if (SIO_staticbuf(input, &buf) == 0){
SYS_abort("Eror reading buffer %d", i);
}
for (i = 0; i < nloops; 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);
}
}
}

Table of Contents

Other manuals for Texas Instruments TMS320

Related product manuals