/* 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;
    ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE));
    ulErr = HWREG(ulBase + I2C_O_MCS);
    if(ulErr & I2C_MCS_BUSY)
    {
        return(I2C_MASTER_ERR_NONE);
    }
    if(ulErr & (I2C_MCS_ERROR | I2C_MCS_ARBLST))
    {
        return(ulErr & (I2C_MCS_ARBLST | I2C_MCS_DATACK | I2C_MCS_ADRACK));
    }
    else
    {
        return(I2C_MASTER_ERR_NONE);
    }
}