Platform/ECM3532/M3/hw/csp/ecm3532/m3/csp/src/eta_csp_i2c.c
/***************************************************************************/
/**
 *
 * EtaCspI2cInit - Initialize the I2C module.
 *
 *  @param iNum the I2C number.
 *  @param iClockSpeed the I2C clock speed
 * @return The result.
 *
 ******************************************************************************/
Initialize the I2C module.
@param iNum the I2C number.
@param iClockSpeed the I2C clock speed
@return The result.
Initialize the I2C module . @param iNum the I2C number . @param iClockSpeed the I2C clock speed @return The result .
tEtaStatus
EtaCspI2cInit(tI2cNum iNum, tI2cClk iClockSpeed)
{
    tEtaStatus iResult;
    iResult = EtaCspI2cSpeedConfig(iNum, iClockSpeed);
    if(iResult != eEtaSuccess)
    {
        return(iResult);
    }
    REGN_W2(iNum, I2C_CONFIG, STALL_IF_RXFULL, 1, HOLD_AT_ACK, 1);
    REGN_M1(iNum, I2C_CONFIG2, SOFT_RST, 1);
    REGN_M1(iNum, I2C_CONFIG2, SOFT_RST, 0);
     I2C setup.
#ifdef ETA_CSP_I2C_DEBUG
    ETA_DIAGS_PRINTF("Configuring I2C0 to %dHz.\r\n", iClockSpeed);
#endif
    EtaCspI2cDonePoll(iNum);
    EtaCspI2cTxReadyPoll(iNum);
     Clear the Line from any aborted previous command.
#ifdef ETA_CSP_I2C_DEBUG
    ETA_DIAGS_PRINTF("Clearing the line\r\n");
#endif
    EtaCspI2cLineClear(iNum);
     Return the result.
    return(iResult);
}
tEtaStatus EtaCspI2cInit ( tI2cNum iNum , tI2cClk iClockSpeed ) { tEtaStatus iResult ; iResult = EtaCspI2cSpeedConfig ( iNum , iClockSpeed ) ; if ( iResult != eEtaSuccess ) { return ( iResult ) ; } REGN_W2 ( iNum , I2C_CONFIG , STALL_IF_RXFULL , 1 , HOLD_AT_ACK , 1 ) ; REGN_M1 ( iNum , I2C_CONFIG2 , SOFT_RST , 1 ) ; REGN_M1 ( iNum , I2C_CONFIG2 , SOFT_RST , 0 ) ; #ifdef ETA_CSP_I2C_DEBUG ETA_DIAGS_PRINTF ( " \r \n " , iClockSpeed ) ; #endif EtaCspI2cDonePoll ( iNum ) ; EtaCspI2cTxReadyPoll ( iNum ) ; #ifdef ETA_CSP_I2C_DEBUG ETA_DIAGS_PRINTF ( " \r \n " ) ; #endif EtaCspI2cLineClear ( iNum ) ; return ( iResult ) ; }
EtaCspI2cInit - Initialize the I2C module.
EtaCspI2cInit - Initialize the I2C module .
// // I2C setup. // // // Clear the Line from any aborted previous command. // // // Return the result. //