/* Enables or disables the specified I2C DMA requests.  */
void I2C_DMACmd(I2C_TypeDef *i2c, FunctionalState state)
/* Enables or disables the specified I2C DMA requests.  */
void I2C_DMACmd(I2C_TypeDef *i2c, FunctionalState state)
{
    if (state) {
        if (I2C_DMA_DIR == TDMAE_SET)
            i2c->IC_DMA_CR |= TDMAE_SET;
        else
            i2c->IC_DMA_CR |= RDMAE_SET;
    }
    else
        i2c->IC_DMA_CR &= ~(I2C_DMA_RXEN | I2C_DMA_TXEN);
}