Specifications

Reviewing the C Source Code
Connecting to I/O Devices
7-3
7.2 Reviewing the C Source Code
The example in this chapter simulates a DSP application that digitizes an
audio signal, adjusts its volume, and produces an analog output at the
adjusted volume.
For simplicity, no actual device is used to send and receive analog data in this
example. Instead, the example tests the algorithm using host-generated
digital data. Input and output data and volume control are transferred
between the host and the target using RTDX.
A Visual Basic application running on the host uses RTDX to generate the
input signal and display the input and output signals. This application allows
developers to test the algorithm without stopping the target. Similar methods
can be used to create display controls for real-time testing of other
applications. You examine the Visual Basic application in section 7.3, page
7-6.
1) Double-click on the hostio.c file in the Project View to see the source
code.
2) Notice the following aspects of this example:
Three RTDX channels are declared globally. The first input channel
controls the volume. The second input channel receives the input
signal from the host. The output channel sends the output signal from
the target to the host. (Input and output channels are named from the
perspective of the target application: input channels receive data
from the host, and output channels send data to the host.)
The call to RTDX_channelBusy returns FALSE if the channel is not
currently waiting for input. This indicates that the data has arrived and
can be read. As in Chapter 6, the call to RTDX_readNB is
non-blocking; it returns control to the DSP application without waiting
to receive the data from the host. The data is delivered
asynchronously when the host client writes it to the control_channel.
Calls to RTDX_Poll are used to communicate with the underlying
RTDX layer to read and write data.
The call to RTDX_read waits for data if the channel is enabled.
The call to RTDX_write writes the contents of the buffer to the output
RTDX channel if the channel is enabled.