/* Gets the error status of the I2C Master module. */
unsigned long I2CMasterError(unsigned long ulBase)
/* Gets the error status of the I2C Master module. */
unsigned long I2CMasterError(unsigned long ulBase)
{
    unsigned long ulStatus;
    xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE)));
    ulStatus = (xHWREGB(ulBase + I2C_STATUS));
    if((ulStatus & I2C_STATUS_RXAK))
    {
        return xI2C_MASTER_ERR_ADDR_ACK;
    }
    if((ulStatus & I2C_STATUS_RXAK))
    {
        return xI2C_MASTER_ERR_DATA_ACK;
    }
    if((ulStatus & I2C_STATUS_ARBL))
    {
        return xI2C_MASTER_ERR_ARB_LOST;
    }
    return xI2C_MASTER_ERR_NONE;
}