Chapter 2
C Language Reference
©
National Instruments Corporation
2-5
to. For example,
RT_INTEGER
can be redefined as
long int
if arithmetic
overflow becomes a problem on a given platform.
Target-Specific Utilities
Target-specific utilities (in
sa_utils.c
) perform hardware, application,
and C-specific tasks that are required for simulation and testing. They can
be modified to support the generated code on different target computers.
As furnished, these routines simulate I/O operations that would occur in
a simulation environment, using input files created using MATRIXx.
These files are intended to remain unmodified for use in comparing your
simulations with generated code outputs. However, for target-system usage
on your rapid prototyping or end-user system, these routines can be modified
or rewritten completely and recompiled for the target system. When you do
this, be sure to keep a copy of the
sa_utils.c
file or keep separate versions
of the files in separate directories.
There is no requirement that the file be named
sa_utils.c
; however, the
name you use must be specified at link time. Inside the file, the names of
the external variables, functions, and other references must be preserved.
As furnished for this release, the routines are written in C, but this is not
required. If you rewrite the routines, they should still be written in a
language that offers direct control of the I/O and interrupt hardware of the
target computer and can be linked to the object form of the generated C
program. Normally, these utilities need to be created only once for each
target computer. In general, a given set of target-specific utilities need only
be changed when the target hardware is modified. The routines are shown
in Table 2-4.
Table 2-4.
Target-Specific Utility Routines
Routine
Description
Enable( )
Unmask timer interrupt.
Disable( )
Mask timer interrupt.
Background( )
Background polling loop.
Error( ), fatalerr( )
Error handlers.
Implementation_Initialize( )
Initialize I/O hardware and
perform other
implementation-specific
initialization tasks.