Texas Instruments TMS320C64X Security Camera User Manual


 
Using DSPLIB
2-4
2.2.2 Calling a DSPLIB Function From C
In addition to correctly installing the DSPLIB software, follow these steps to
include a DSPLIB function in the code:
- Include the function header file corresponding to the DSPLIB function
- Link the code with dsp64plus.lib
- Use a correct linker command file for the platform used.
The examples in the DSP\Examples folder show how to use the DSPLIB in a
Code Composer Studio C envirionment.
2.2.3 Calling a DSP Function From Assembly
The C64x+ DSPLIB functions were written to be used from C. Calling the
functions from assembly language source code is possible as long as the
calling function conforms to the Texas Instruments C64x+ C compiler calling
conventions. For more information, see Section 8 (Runtime Environment) of
TMS320C6000 Optimizing C Compiler User’s Guide (SPRU187).
2.2.4 DSPLIB Testing − Allowable Error
DSPLIB is tested under the Code Composer Studio environment against a
reference C implementation. You can expect identical results between
Reference C implementation and its Assembly implementation when using
test routines that focus on fixed-point type results. The test routines that deal
with floating points typically allow an error margin of 0.000001 when
comparing the results of reference C code and DSPLIB assembly code.
2.2.5 DSPLIB Overflow and Scaling Issues
The DSPLIB functions implement the same functionality of the reference C
code. You must conform to the range requirements specified in the API
function, and in addition, restrict the input range so that the outputs do not
overflow.
In FFT functions, twiddle factors are generated with a fixed scale factor; i.e.,
32767(=2
15−1
) for all 16-bit FFT functions, 1073741823(=2
30−1
) for
DSP_fft32x32s, 2147483647(=2
31−1
) for all other 32-bit FFT functions.
Twiddle factors cannot be scaled further to not scale input data. Because
DSP_fft16x16r and DSP_fft32x32s perform scaling by 2 at each radix-4 stage,
the input data must be scaled by 2
(log2(nx)−cei[log4(nx)−1])
to completely prevent
overflow. In all other FFT functions, the input data must be scaled by 2
(log2(nx))
because no scaling is done by the functions.
Using DSPLIB