AN2108 Freescale Semiconductor / Motorola, AN2108 Datasheet - Page 27

no-image

AN2108

Manufacturer Part Number
AN2108
Description
AN2108 Programming the DSP56307/DSP56311 EFCOP in C Using Taskings Tool Suite
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
6.4 Residu Function from the GSM EFR/AMR Vocoders
6.4.1 Implementation
To illustrate the use of the EFCOP in a vocoder environment, this section describes the implementation of
the Residu() function from the GSM EFR and AMR transcoders.
described in Eq. (1) that filters L 16-bit data samples (L is typically equal to 40) through a FIR filter with N
16-bit coefficients (N is typically equal to 11). For each value of k, (0
have 32-bit precision. Once all N coefficients and the corresponding data samples are multiplied and
accumulated, the 32-bit result is rounded to 16 bits to form y(k).
GSM vocoders such as EFR and AMR use 16-bit fixed point arithmetic, and the output data must be in
bit-exact agreement with pre-defined test sequences. Therefore, in this example, the EFCOP is configured
to conform to these requirements while processing the data.
The Residu function that is performed on the EFCOP can also be performed on the DSP56300 core by
defining the DSP_CORE symbol within
an ETSI test vector and is stored into an array, input[]. Both the DSP56300 core and the EFCOP use this
input array. After the data is filtered, the filtered signals are stored in the array’s core_output[] and
efcop_output[], respectively. These results are in turn written to the
out\efcop_24.cod
Because of the 16-bit data requirements, this application must be compiled in 16-bit arithmetic mode.
However, you can still access all the memory range (using the 24-bit addressing) using the compiler
option: EDE/C Compiler Options/Project Options/Code Generation/16 bit arithmetic, 24 bit address. This
requirement modifies the way the DMA initialization is made. Effectively, from the two previous
examples, some registers are directly accessed using a union:
This assignment is “out of range” since the constant is a 24-bit value, so this value is truncated and
compiled into the following:
The most significant byte is lost. Note that x:<<$FFFFEC is the memory-mapped address of the DCR0
register. Losing the two most significant digits is equivalent in this case to wrongly setting the counter
register for DMA channel 0. There are several solutions to get round this issue. The simplest is to “force”
this assignment by replacing what the compiler sees as a register use of DCR0 into an assembly instruction
as:
As a result, the DSP data registers are avoided, and the full 24-bit value is therefore transferred to DCR0.
Alternatively, casting in C can be used to force the compiler to treat the value written to DCR0 as a pointer
(24-bit) rather than as a 16-bit integer:
10.The C Code for this example (
DCR0.I = 0x94AA04; /* DMA Ch0 Control Register */.
_asm(“movep#$94AA04,x:<<$FFFFEC).
*((int* _X *)0xFFFFEC) = (int*)0x94AA04;
files. Figure 15 shows the implementation flow.
Programming the DSP56307/DSP56311 EFCOP in C
Freescale Semiconductor, Inc.
For More Information On This Product,
movep #$AA04,x:<<$FFFFEC
run_resu.c
Go to: www.freescale.com
run_resu.c
) is listed in Appendix C.
. The input data in the
/* C language version
10
Residu() is an FIR filtering routine as
out\core_24.cod
k < L), the intermediate outputs
tvecs\resu_24.inp
Application Examples
and
*/
file is
27

Related parts for AN2108