/* Checks whether the specified I2C flag is set or not.  */
FlagStatus I2C_GetFlagStatus(I2C_TypeDef *i2c, u32 flag)
/* Checks whether the specified I2C flag is set or not.  */
FlagStatus I2C_GetFlagStatus(I2C_TypeDef *i2c, u32 flag)
{
    if (flag & 0x8000)
        return ((i2c->IC_STATUS & flag) ? SET : RESET);
    if ((flag == I2C_FLAG_RX_FULL) && (I2C_CMD_DIR == 0)) {
        i2c->IC_DATA_CMD = I2C_DR_CMD;
        I2C_CMD_DIR       = 1;
    }
    return (((i2c->IC_RAW_INTR_STAT & flag)) ? SET : RESET);
}