AN2274 Freescale Semiconductor / Motorola, AN2274 Datasheet - Page 8

no-image

AN2274

Manufacturer Part Number
AN2274
Description
Generic Tone Generation on the StarCore SC140 Core
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Tone Generator Implementation
TONE_COMPONENT parameters are described at the beginning of this section. The TONE_GENERIC structure
is not persistent, so the fsl_tone_gen_init function does not save pointers to any part of this structure. After
fsl_tone_gen_init returns, the software copies any information that is needed in the channel-dependent
structure gen_channel.
2.4 Implementation Constraints
The implementation constraints apply to both tone initialization and tone generation.
2.4.1 Tone Initialization
The coefficients for all frequencies are calculated with a cosine polynomial approximation during the initialization
routine, which restricts the coefficient precision to 14 bits. We tested the error introduced by this method with
MATLAB simulations and found the error to be within the one percent tolerance required by ITU-T standards. We
decreased the full-scale level to 0x7FC0 (instead of 0x7FFF) to avoid saturation. The impact of such an “under-
level” is negligible after A- or µ-law encoding stages [4]. This 0 dB level can be considered as a full scale one. Half
scale tones are often preferred.
The initialization is divided into two parts:
Each time new samples are produced, the number of sound and silence samples is updated in fsl_tone_gen.
Instead of generating the samples for two tones with frequencies f1 and f2 and then modulating them, tones with
frequencies f1+f2 and f1-f2 are initialized, scaled by 1/2 and added. This saves processing load, measured in
millions of cycles per second (MCPS), and avoids generating low-frequency tones, which are difficult to generate
with 16-bit precision. The current version of this module does not implement modulation with carrier (such as
standard AM modulation). A third frequency component can be added at the expense of increased MCPS.
2.4.2 Tone Generation
The SC140 multiple ALU architecture allows simultaneous generation of samples for both frequencies. The
performance is optimal with two frequencies because required data can be loaded and updated in a single clock
cycle: four fractional moves for the four previous samples and two fractional moves for the two coefficients.
To reduce MCPS, blocks of eight samples are generated. Furthermore, duration times are given in ms (number of
samples is 8*(duration time)) so that eight samples are generated as grouped bursts. Each component includes a
silence duration after a sound period. If a property of the tone must be changed without prior silence, the silence
duration must be set to zero at the end of the previous component.
If a frequency level is 63 (–63 dBm0), the initial filter states are initialized with zeroes so that no samples are
generated for this frequency. If a single frequency is generated with the modulation flag set, the result is silence.
When a continuous tone must be generated, it is better to repeat a component with a long sound_duration because
8
tone_component_count. Number of components in the cycle.
tone_component[5]. An array that contains the description of every component.
Creating a GEN_CHANNEL structure in conformance with the user's requirements, computing
coefficients and duration for each component and copying any information needed after
fsl_tone_gen_init returns.
Updating the channel-dependent structure for every new component using the fill_component_param
function, which updates the initial samples (x(-2) and x(-1)).
Generic Tone Generation on the StarCore™ SC140/SC1400 Cores, Rev. 1
Freescale Semiconductor

Related parts for AN2274