/**
 * \brief   Sets up the EEPROM I2C interface
 *
 * \param   slaveAddr   Slave Address of the EEPROM
 *
 * \return  None.
 */
void EEPROMI2CSetUp(unsigned int slaveAddr)
{
    /* Configuring system clocks for I2C0 instance. */
    I2C0ModuleClkConfig();

    /* Performing Pin Multiplexing for I2C0. */
    I2C0PinMux();

    /* Put i2c in reset/disabled state */
    I2CMasterDisable(I2C_BASE_ADDR);

    I2CSoftReset(I2C_BASE_ADDR);

    /* Configure i2c bus speed to 100khz */
    I2CMasterInitExpClk(I2C_BASE_ADDR, 48000000, 24000000, 100000);

    /* Set i2c slave address */
    I2CMasterSlaveAddrSet(I2C_BASE_ADDR, slaveAddr);

    /* Disable all I2C interrupts */
    I2CMasterIntDisableEx(I2C_BASE_ADDR, 0xFFFFFFFF);

    /* Bring I2C module out of reset */
    I2CMasterEnable(I2C_BASE_ADDR);

    while(!I2CSystemStatusGet(I2C_BASE_ADDR));
}
示例#2
0
int main(void)
{
    /* Setup the MMU and do necessary MMU configurations. */
    MMUConfigAndEnable();

    /* Enable all levels of CACHE. */
    CacheEnable(CACHE_ALL);

    /* Initialize the UART console */
    ConsoleUtilsInit();

    /* Select the console type based on compile time check */
    ConsoleUtilsSetType(CONSOLE_UART);

    ConsoleUtilsPrintf("McASP Example Application. ");
    ConsoleUtilsPrintf("Please connect headphone/speaker to the LINE OUT");
    ConsoleUtilsPrintf(" of the EVM to listen to the audio tone.");

    /* Enable the module clock for I2C0 Instance. */
    I2C0ModuleClkConfig();

    /* Set up the pin mux for I2C0 instance. */
    I2CPinMuxSetup(0);

    /* Enable the module clock for McASP1 Instance. */
    McASP1ModuleClkConfig();

    /* Enable pin-mux for McASP1 instance. */
    McASP1PinMuxSetup();

    /* Enable the EDMA module clocks. */
    EDMAModuleClkConfig();

    /* Initialize the ARM Interrupt Controller.*/
    IntAINTCInit();

    /* Enable EDMA Interrupt. */
    EDMA3IntSetup(); 

    /* Enable McASP Interrupt. */
    McASPIntSetup();
  
    /* Initialize the I2C interface for the codec AIC31 */
    I2CCodecIfInit(I2C_INST_BASE, I2C_SLAVE_CODEC_AIC31);

    /* Enable the interrupts generation at global level */ 
    IntMasterIRQEnable();

    /* Configure the Codec for I2S mode */
    AudioCodecInit();

    /* Initialize the looping of tone. */
    ToneLoopInit(); 

    /* Start playing tone. */
    AudioTxActivate();

    while(1);
}
示例#3
0
static void SetupI2C(void)
{
    I2C0_BASE = vmm_find_iomap("SOC_I2C_0_REGS");

    /* Enable the clock for I2C0 */
    I2C0ModuleClkConfig();

    I2CPinMuxSetup(0);
    /* Put i2c in reset/disabled state */
    I2CMasterDisable(I2C0_BASE);
    /* Disable auto Idle functionality */
    I2CAutoIdleDisable(I2C0_BASE);
    /* Configure i2c bus speed to 100khz */
    I2CMasterInitExpClk(I2C0_BASE, 48000000, 12000000, 100000);
    /* Set i2c slave address */
    I2CMasterSlaveAddrSet(I2C0_BASE, I2C_SLAVE_ADDR);
    /* Bring I2C out of reset */
    I2CMasterEnable(I2C0_BASE);
}