/* Gets the error status of the I2C Master module. */
unsigned long I2CMasterErr(unsigned long ulBase)
/* Gets the error status of the I2C Master module. */
unsigned long I2CMasterErr(unsigned long ulBase)
{
    unsigned long ulErr;
    xASSERT((ulBase == I2C1_BASE) || (ulBase == I2C2_BASE));
    ulErr = xHWREG(ulBase + I2C_SR1);
    if(ulErr & (I2C_SR1_ARLO | I2C_SR1_AF | I2C_SR1_BERR))
    {
        return(ulErr & (I2C_SR1_ARLO | I2C_SR1_AF | I2C_SR1_BERR));
    }
    else
    {
        return(I2C_MASTER_ERR_NONE);
    }
}