AN2113 Freescale Semiconductor / Motorola, AN2113 Datasheet - Page 16

no-image

AN2113

Manufacturer Part Number
AN2113
Description
AN2113 Multichannel Voice Coding System on the RTXC Operating System
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Software Description
16
7.3 Voice Coders
7.3.1 Double Buffering
This section discusses two key features of the voice coder: the double buffering mechanism for rapidly
moving data and the wrappers for integrating the voice coder software into a system.
Our demonstration code contains a double-buffer mechanism, also known as “ping-pong buffers.” Two
separate buffer pairs are defined for each channel. Pointers and flags for the various buffers are maintained
in the CHANNEL_CONFIGURATION C structure described in Section 6.2, Application Software, on page
12. Each channel uses four frame buffers so that one buffer can receive data while another buffer is
processed. The third frame buffer stores the processed output, and the fourth contains the data being
transmitted. When the receive frame buffer is full, the base pointers to the receive (*rx_fbuff_base)
and input (*in_fbuff_base) frame buffers are swapped. Similarly, when the transmit frame buffer is
empty, the base pointers to the output (*out_fbuff_base) and transmit (*tx_fbuff_base) frame
buffers are swapped. The assumption is that the processing for each channel data stream completes by the
time the buffers need to swapped.
Associated with each double-buffer structure is a flag that indicates whether the receive buffer is full
(rx_fbuff_full) and another to indicate whether the transmit buffer is empty (tx_fbuff_empty).
The rx_fbuff_ptr pointer in the data structure is an index to indicate the location in the receive buffer
to be loaded with the next data input. The tx_fbuff_ptr pointer in the data structure is an index to
indicate the location in the transmit buffer of the data to be transmitted next. When the base pointers to the
receive buffer and the transmit buffer are swapped (that is, the receive buffer is full and the transmit buffer
is empty), the rx_fbuff_ptr and tx_fbuff_ptr index pointers are initialized to zero. Figure 12
shows the double buffer mechanism.
2. Read from transmit buffer
1. ESSI Tx Event
TX_buff
Freescale Semiconductor, Inc.
Figure 11. ESSI Data Receive Mechanism
For More Information On This Product,
Multichannel Voice Coding System
Go to: www.freescale.com
ESSI Tx
ESSI
ISR
3. Write Audio Data Output

Related parts for AN2113