Stackable Devices
Streaming I/O and Device Drivers
7-19
Example 7-9.
Data Exchange Through a Pipe Device
/*
* ======== siotest5.c ========
* In this program two tasks are created that exchange data
* through a pipe device. The source task reads sine wave data
* from a DGN device through a DTR device stacked on the sine
* device, and then writes it to a pipe device. The sink task
* reads the data from the pipe device and writes it to the
* printData DGN device. The data exchange between the tasks
* and the devices is done in a device independent fashion
* using the SIO module APIs.
*
* The streams in this example follow the SIO_STANDARD streaming
* model and are created statically.
*/
#include <std.h>
#include <dtr.h>
#include <log.h>
#include <mem.h>
#include <sio.h>
#include <sys.h>
#include <tsk.h>
#define BUFSIZE 128
#ifdef _62_
#define SegId IDRAM
extern Int IDRAM; /* MEM segment ID defined with conf tool */
#endif
#ifdef _55_
#define SegId DATA
extern Int DATA; /* MEM segment ID defined with conf tool */
#endif
extern LOG_Obj trace; /* LOG object created with conf tool */
extern TSK_Obj sourceTask; /* TSK thread objects created via conf tool */
extern TSK_Obj sinkTask;
extern SIO_Obj inStreamSrc; /* SIO streams created via conf tool */
extern SIO_Obj outStreamSrc;
extern SIO_Obj inStreamSink;
extern SIO_Obj outStreamSink;
/* Parameters for the stacking device "/scale" */
DTR_Params DTR_PRMS = {
20, /* Scaling factor */
NULL,
NULL
};
Void source(Uns nloops); /* function body for sourceTask above */
Void sink(Uns nloops); /* function body for sinkTask above */
static Void doStreaming(SIO_Handle input, SIO_Handle output, Uns nloops);
/*
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 ...