Site Index
   Home
   File Upload
Google

Transfer Site
Main Site

EVM5502 AIC23 Module

The codec module include file evm5502_aic23.h contains constant definitions for the handles and AIC23 register offsets. Please view it to see what definitions are available.

The following list summarizes the AIC23 Codec API in terms of its function calls:

Function Description
EVM5502_AIC23_openCodec Allocate an identifying handle for an instance of a codec
EVM5502_AIC23_closeCodec Release a codec handle
EVM5502_AIC23_config Set parameters on codec registers
EVM5502_AIC23_read16 Read 16 bits from the codec data stream
EVM5502_AIC23_write16 Write 16 bit value to the codec data stream
EVM5502_AIC23_rset Set the value of a codec control register
EVM5502_AIC23_rget Return the value of a codec register
EVM5502_AIC23_outGain Set the codec output gain
EVM5502_AIC23_loopback Enable/disable the codec loop-back mode
EVM5502_AIC23_mute Enable/disable the codec mute mode
EVM5502_AIC23_powerDown Enable/disable the codec power down modes
EVM5502_AIC23_setFreq Set the codec sample rate

EVM5502_AIC23_openCodec()

Description
Initialize the AIC23 codec module and perform codec setup. Must be called before any other AIC23 functions.

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
EVM5502_AIC23_CodecHandle EVM5502_AIC23_openCodec(int id, EVM5502_AIC23_Config *Config)

Parameters
id - Specifies which codec to use, on the EVM5502, id = 0.
Config - Pointer to structure containing codec register values. The function will initialize the codec registers with the values in the structure.

Return Value
Handle for the codec on success, the CSL constant INV (equal to 1) on fail. The only failure condition is if either of the codec McBSP are already in use.

Example

/* Codec configuration settings */
EVM5502_AIC23_Config config = {
  0x0017, // 0 EVM5502_AIC23_LEFTINVOL  Left line input volume
  0x0017, // 1 EVM5502_AIC23_RIGHTINVOL Right line input volume
  0x00d8, // 2 EVM5502_AIC23_LEFTHPVOL  Left headphone volume
  0x00d8, // 3 EVM5502_AIC23_RIGHTHPVOL Right headphone volume
  0x0011, // 4 EVM5502_AIC23_ANAPATH    Analog audio path CTRL
  0x0000, // 5 EVM5502_AIC23_DIGPATH    Digital audio path CTRL
  0x0000, // 6 EVM5502_AIC23_POWERDOWN  Power down control
  0x0043, // 7 EVM5502_AIC23_DIGIF      Digital audio INTF format
  0x0081, // 8 EVM5502_AIC23_SAMPLERATE Sample rate control
  0x0001  // 9 EVM5502_AIC23_DIGACT     Digital INTF activation
};

/* Open codec with default settings */
EVM5502_AIC23_CodecHandle hCodec;
hCodec = EVM5502_AIC23_openCodec(0, &config);

EVM5502_AIC23_closeCodec()

Description
Close the AIC23 codec

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_AIC23_closeCodec( EVM5502_AIC23_CodecHandle hCodec )

Parameters
hCodec - Codec handle

Return Value
None

Example

    /* Close the AIC23 Codec */
    EVM5502_AIC23_closeCodec( hCodec )

EVM5502_AIC23_config()

Description
Change the codec configuration. Use to set volume, enable mute, etc.

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_AIC23_config( EVM5502_AIC23_CodecHandle hCodec, EVM5502_AIC23_Config *Config )

Parameters
hCodec - Codec handle
config - Pointer to structure containing codec register values. The function will initialize the codec registers with the values in the structure.

Return Value
None

Example

/* AIC23 codec settings 
 * each entry below represents an AIC23 register */ 
EVM5502_AIC23_Config config = {
  0x0017, // 0 EVM5502_AIC23_LEFTINVOL  Left line input volume
  0x0017, // 1 EVM5502_AIC23_RIGHTINVOL Right line input volume
  0x00d8, // 2 EVM5502_AIC23_LEFTHPVOL  Left headphone volume
  0x00d8, // 3 EVM5502_AIC23_RIGHTHPVOL Right headphone volume
  0x0011, // 4 EVM5502_AIC23_ANAPATH    Analog audio path CTRL
  0x0000, // 5 EVM5502_AIC23_DIGPATH    Digital audio path CTRL
  0x0000, // 6 EVM5502_AIC23_POWERDOWN  Power down control
  0x0043, // 7 EVM5502_AIC23_DIGIF      Digital audio INTF format
  0x0081, // 8 EVM5502_AIC23_SAMPLERATE Sample rate control
  0x0001  // 9 EVM5502_AIC23_DIGACT     Digital INTF activation
};

/* Configure codec with defaults 
 * except mute bit set( bit 3 of reg 5 ) */
EVM5502_AIC23_config( hCodec, &config );

EVM5502_AIC23_read16()

Description
Read a 16-bit signed value from the codec data port

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
Uint16 EVM5502_AIC23_read16( EVM5502_AIC23_CodecHandle hCodec, Int16 *val )

Parameters
hCodec - Codec handle
val - Address of 16-bit variable to receive codec data

Return Value
TRUE Data written successfully.
FALSE Data port is busy.

Example

    Uint16 data;
    /* Read 16 bits of codec data, 
     * loop to retry if data port is busy */
    while(!EVM5502_AIC23_read16(hCodec, &data));

EVM5502_AIC23_write16()

Description
Write a 16-bit signed value to the codec data port

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
EVM5502_AIC23_write16( EVM5502_AIC23_CodecHandle hCodec, Int16 val )

Parameters
hCodec - Codec handle
val - 16-bit value signed to write to codec

Return Value
TRUE Data written successfully.
FALSE Data port is busy.

Example

    Uint16 data;
    data = 0x1234;

    /* Write 0x1234 to the codec, 
     * loop to retry if data port is busy */
    while(!EVM5502_AIC23_write16(hCodec, data));

EVM5502_AIC23_rset()

Description
Set the value of a codec control register

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_AIC23_rset( EVM5502_AIC23_CodecHandle hCodec, Uint16 regnum, Uint16 regval )

Parameters
hCodec - Codec handle
regnum - Which codec register to set
regval - Value to set the register to

Return Value
None

Example

    /* Set codec left and right gain to 0x79 */
    EVM5502_AIC23_rset(hCodec, 2, 0x79);
    EVM5502_AIC23_rset(hCodec, 3, 0x79);

EVM5502_AIC23_rget()

Description
Return the value of a codec register

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
Uint16 EVM5502_AIC23_rget( EVM5502_AIC23_CodecHandle hCodec, Uint16 regnum )

Parameters
hCodec - Codec handle
regnum - Which codec register to read

Return Value
16-bit register value

Example

    Uint16 value;
    /* Read codec register 1 */
    value = EVM5502_AIC23_rget(hCodec, 1);

EVM5502_AIC23_outGain()

Description
Set the codec output gain. The gain is a 7 bit value that corresponds directly to the 7-bit gain field in the codec registers 2 and 3.

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_AIC23_outGain( EVM5502_AIC23_CodecHandle hCodec, Uint16 outGain )

Parameters
hCodec - Codec handle
outGain - Codec gain, 0 = lowest output, 0x7f = highest output

Return Value
None

Example

    /* Set output gain to 0x79 */
    EVM5502_AIC23_outGain( hCodec, 0x79 );

EVM5502_AIC23_loopback()

Description
Enable/disable the codec loopback mode. Loopback mode forces the codec to copy its input directly to its output. It is the opposite of a loopback cable that would copy the output back the input.

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_AIC23_loopback( EVM5502_AIC23_CodecHandle hCodec, Uint16 mode )

Parameters
hCodec - Codec handle
mode - Loopback mode enable (TRUE) or disable (FALSE)

Return Value
None

Example

    /* Enable codec loop back mode */
    EVM5502_AIC23_loopback( hCodec, 1 );

EVM5502_AIC23_mute()

Description
Enable/disable codec mute mode

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_AIC23_mute( EVM5502_AIC23_CodecHandle hCodec, Uint16 mode )

Parameters
hCodec - Codec handle
mode - Codec mute enable (TRUE) or disable (FALSE)

Return Value
None

Example

    /* Disable codec mute mode. */
    EVM5502_AIC23_mute( hCodec, FALSE );

EVM5502_AIC23_powerDown()

Description
Enable/disable the codec powerdown modes.

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_AIC23_powerDown( EVM5502_AIC23_CodecHandle hCodec, Uint16 sect )

Parameters
hCodec - Codec handle
sect - Bitmap of which sections to enable powerdown mode. Matches bits in the AIC23 Power Down Control register. Powerdown modes for a particular codec section are enabled if its corresponding bit is 1. Writing 0 as sect turns disables all powerdown modes (all sections are on).

Return Value
None

Example

    /* Enable the ADC power down mode. */
    EVM5502_AIC23_powerDown( hCodec, 0x04 );

EVM5502_AIC23_setFreq()

Description
Set the codec sample rate frequency

Required Headers
evm5502.h
evm5502_aic23.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_AIC23_setFreq( EVM5502_AIC23_CodecHandle hCodec, Uint32 freq )

Parameters
hCodec - Codec handle
freq - Sample rate of the codec clock. Can be one of the following, default is 48KHz, If an invalid frequency is entered no change will be made

    EVM5502_AIC23_FREQ_8KHZ     = 8,000 Hz
    EVM5502_AIC23_FREQ_16KHZ    = 16,000 Hz
    EVM5502_AIC23_FREQ_24KHZ    = 24,000 Hz
    EVM5502_AIC23_FREQ_32KHZ    = 32,000 Hz
    EVM5502_AIC23_FREQ_44KHZ    = 44,000 Hz
    EVM5502_AIC23_FREQ_48KHZ    = 48,000 Hz
    EVM5502_AIC23_FREQ_96KHZ    = 96,000 Hz

Return Value
None

Example

    /* Set codec frequency to 48kHz */
    EVM5502_AIC23_setFreq( hCodec, EVM5502_AIC23_FREQ_48KHZ );
©Copyright 2002-2011 Spectrum Digital, Inc. All Rights Reserved.