/*
** Function to configure the codec for I2S mode
*/
static void AIC31I2SConfigure(void)
{
    volatile unsigned int delay = 0xFFF;

    AIC31Reset(SOC_I2C_0_REGS);
    while(delay--);

    /* Configure the data format and sampling rate */
    AIC31DataConfig(SOC_I2C_0_REGS, AIC31_DATATYPE_I2S, SLOT_SIZE, 0);
    AIC31SampleRateConfig(SOC_I2C_0_REGS, AIC31_MODE_BOTH, SAMPLING_RATE);

    /* Initialize both ADC and DAC */
    AIC31ADCInit(SOC_I2C_0_REGS);
    AIC31DACInit(SOC_I2C_0_REGS);
}
Esempio n. 2
0
/*
** Function to initialize the audio codec
*/
static void AudioCodecInit(void)
{
    volatile unsigned int delay = 0xFFF;

    /* Initialize the I2C interface for the codec AIC31 */
    I2CMasterSlaveAddrSet(I2C_INST_BASE, I2C_SLAVE_CODEC_AIC31);

    AIC31Reset(I2C_INST_BASE);
    while(delay--);

    /* Configure the data format and sampling rate */
    AIC31DataConfig(I2C_INST_BASE, AIC31_DATATYPE_I2S, TONE_SLOT_SIZE, 0);
    AIC31SampleRateConfig(I2C_INST_BASE, AIC31_MODE_BOTH, TONE_SAMPLE_RATE);

    /* Initialize both ADC and DAC */
    AIC31ADCInit(I2C_INST_BASE);
    AIC31DACInit(I2C_INST_BASE);
}