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);
}
}
}
Содержание TMS320 Series
Страница 1: ...TMS320 DSP BIOS v5 40 User s Guide Literature Number SPRU423G April 2009 ...
Страница 16: ...xvi ...
Страница 152: ...Tasks 4 48 Figure 4 12 Trace from Example 4 7 ...
Страница 168: ...Semaphores 4 64 Figure 4 14 Trace Results from Example 4 11 ...
Страница 202: ...5 20 ...
Страница 287: ...Index 9 Index Void 1 11 W words data memory 3 15 of code 1 5 wrapper function 2 29 ...
Страница 288: ...Index 10 Index ...