Stream I/O—Reading and Writing Streams
7-10
7.3.2
Example - Reading Input Buffers from a DGN Device
The program in Example 7-5 illustrates some of the basic SIO functions and
provides a straightforward example of reading from a stream. For a complete
description of the DGN software generator driver, see the DGN section in the
TMS320 DSP/BIOS API Reference Guide
for your platform.
The configuration template for Example 7-5 can be found in the siotest
directory of the DSP/BIOS distribution. A DGN device called sineWave is
used as a data generator to the SIO stream inputStream. The task
streamTask calls the function doStreaming to read the sine data from the
inputStream and prints it to the log buffer trace. The output for Example 7-5
appears as sine wave data in Figure 7-4.
Example 7-5.
Basic SIO Functions
/*
* ======== siotest1.c ========
* In this program a task reads data from a DGN sine device
* and prints the contents of the data buffers to a log buffer.
* The data exchange between the task and the device is done
* in a device independent fashion using the SIO module APIs.
*
* The stream in this example follows the SIO_STANDARD streaming
* model and is created statically.
*
*/
#include <std.h>
#include <log.h>
#include <sio.h>
#include <sys.h>
#include <tsk.h>
extern Int IDRAM1; /* MEM segment ID defined by Conf tool */
extern LOG_Obj trace; /* LOG object created with Conf tool */
extern SIO_Obj inputStream; /* SIO object created w Conf tool */
extern TSK_Obj streamTask; /* pre-created task */
SIO_Handle input = &inputStream; /* SIO handle used below */
Void doStreaming(Uns nloops); /* function for streamTask */
/*
* ======== main ========
*/
Void main()
{
LOG_printf(&trace, "Start SIO example #1");
}
/*
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 ...