User`s guide

Host Channel Manager (HST Module)
6-14
Example 6-5 Reading Data Through a Host Channel
Each host channel can specify a data notification function to be performed
when a frame of data for an input channel (or free space for an output
channel) is available. This function is triggered when the host writes or reads
a frame of data.
HST channels treat files as 16- or 32-bit words of raw data, depending on the
platform. The format of the data is application-specific, and you should verify
that the host and the target agree on the data format and ordering. For
example, if you are reading 32-bit integers from the host, you need to make
sure the host file contains the data in the correct byte order. Other than
correct byte order, there are no special format or data type requirements for
data to be transferred between the host and the target.
While you are developing a program, you can use HST objects to simulate
data flow and to test changes made to canned data by program algorithms.
During early development, especially when testing signal processing
algorithms, the program would explicitly use input channels to access data
sets from a file for input for the algorithm and would use output channels to
record algorithm output. The data saved to a file with the output host channel
can be compared with expected results to detect algorithm errors. Later in the
program development cycle, when the algorithm appears sound, you can
change the HST objects to PIP objects communicating with other threads or
I/O drivers for production hardware.
extern far HST_Obj input;
readFromHost()
{
PIP_Obj *pipe;
Uns size;
Ptr addr;
pipe = HST_getpipe(&input) /* get a pointer to the host
channel's pipe object */
PIP_get(pipe); /* get a full frame from the
host */
size = PIP_getReaderSize(pipe);
addr = PIP_getReaderAddr(pipe);
' read data from frame '
PIP_free(pipe); /* release empty frame to the host */
}