/* Calculate Cumulative Clock low Time-out of SMBus active period.  */
void I2C_SMBusClockLoTimeout(I2C_T *i2c, uint32_t ms, uint32_t u32Pclk)
/* Calculate Cumulative Clock low Time-out of SMBus active period.  */
void I2C_SMBusClockLoTimeout(I2C_T *i2c, uint32_t ms, uint32_t u32Pclk)
{
    uint32_t u32Div, u32Pclk_kHz;
    i2c->BUSCTL &= ~I2C_BUSCTL_TIDLE_Msk;
    i2c->TOCTL &= ~I2C_TOCTL_TOCEN_Msk;
    u32Pclk_kHz = u32Pclk / 1000U;
    u32Div = ((ms * u32Pclk_kHz) / (16U * 1024U)) - 1U;
    if(u32Div <= 0xFFU)
    {
        i2c->CLKTOUT = u32Div;
    }
    else
    {
        i2c->TOCTL |= I2C_TOCTL_TOCEN_Msk;
        i2c->CLKTOUT = (((ms * u32Pclk_kHz) / (16U * 1024U * 4U)) - 1U) & 0xFFU;
    }
}