Specifications
Reviewing the C Source Code
7-4
■
While control_channel is enabled by the target via a call to
RTDX_enableInput, the other RTDX channels are not enabled from
this program. Instead, a host program described in the next section
enables these channels. This is because the slider control, which
uses the control_channel, is viewed as an integral part of the
application. By enabling this channel in the target program, you know
the channel is enabled while the application is running. In contrast,
the A2D and D2A channels are used to test the algorithm. Hence,
these channels are enabled and disabled by the host application.
#include <std.h>
#include <log.h>
#include <rtdx.h>
#include "target.h"
#define BUFSIZE 64
#define MINVOLUME 1
typedef Int sample; /* representation of a data sample from A2D */
/* Global declarations */
sample inp_buffer[BUFSIZE];
sample out_buffer[BUFSIZE];
Int volume = MINVOLUME; /* the scaling factor for volume control */
/* RTDX channels */
RTDX_CreateInputChannel(control_channel);
RTDX_CreateInputChannel(A2D_channel);
RTDX_CreateOutputChannel(D2A_channel);
/* Objects created by the Configuration Tool */
extern far LOG_Obj trace;
/*
* ======== main ========
*/
Void main()
{
sample *input = inp_buffer;
sample *output = out_buffer;
Uns size = BUFSIZE;
TARGET_INITIALIZE(); /* Enable RTDX interrupt */
LOG_printf(&trace,"hostio example started");
/* enable volume control input channel */
RTDX_enableInput(&control_channel);