<< Chapter < Page Chapter >> Page >
  1. The CPU processes samples from one of the receive buffers, and stores the results in the correspondent transmit buffer.
  2. The EDMA reads and writes samples that belong to the next frame.

Frame #n

Frame #n+1

Double-Buffering Mechanism

The driver uses two EDMA channels. The first will read from a fixed location in the memory, which is the received data register (DRR) of the MCBSP port, to a buffer in the memory that will hold those samples. The second will write from a buffer in the memory to a fixed location that is the transmit register (DXR) of the MCBSP port.

Samples are send/received to/from the CODEC in an interleaved mode. The EDMA receive channel sorts the samples and place the samples of each channel placed in consecutive addresses in the data memory. A symmetric process occurs in the opposite direction. Figure 7 describes the process of receiving samples and Figure 8 describes the process of transmitting samples. Once a buffer is received/transmitted a Callback (please refer to section ) function is called, activating the signal processing procedures.

Receiving Samples
Transmitting Samples

The driver consists of 4 files:

  1. ”aic24_defs.h” – This file contains the definitions of the various registers of the TLV320AIC24.
  2. ”aic24.h” – Needed for the DSP configuration.
  3. ”aic24.c” – Contains the various initialization routines.
  4. “AIC24-C6713.cdb” - DSP-BIOS configuration file.

Those files should be integrated with a user file, explained in the next section.

The driver interface

The driver interface is implemented in the user defined file. This file consists of the main program and the callback processing function.

The “main” program

The driver allocates a handle to the chain of CODECs, initializes it and afterwards activates the components.

This file:

  1. Initializes the AIC24 handle. This is a structure that contains handles to the EDMA and to the MCBSP port. It also contains their configuration structures, pointers to user buffers (the data is read and written through them) and some more variables like the AIC24 register values, the current buffer etc. handle and the data is exchanged through a callback function. The function AIC24_Init Defaults initializes the handle with the values provided by user and some default values.
  2. Configures the TLV320AIC24 mode The CODEC can operate in DATAMODE or PROGRAMMING mode. We’ll use DATAMODE only. For a detailed explanation, please refer to the TLV320AIC24 datasheet. .
  3. n addition, the user needs to map the analog input/output ports to the channels in the SMARTDM/McBSP (Please refer to ).
  4. Run the AIC24_Start, the main function that:
  • Configures the McBSP
  • Activates the McBSP
  • Configures the AIC24 (through the McBSP).
  • Configures the EDMA
  • Activates the EDMA

The callback function

The user is required to create a callback function were the processing is implemented. This function receives pointers to two buffers as arguments; one buffer contains the latest information read from the CODECs, while the second will contain the data to be written to the CODECs. The callback function template is shown:

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, From matlab and simulink to real-time with ti dsp's. OpenStax CNX. Jun 08, 2009 Download for free at http://cnx.org/content/col10713/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'From matlab and simulink to real-time with ti dsp's' conversation and receive update notifications?

Ask