Merged in masayuki2009/nuttx.nuttx/fix_efm32_i2c_timeout (pull request #312)

EFM32 I2C: Fix timeout calculation

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Masayuki Ishikawa 2017-04-06 22:59:34 +00:00 committed by Gregory Nutt
commit b4e01ecbf9
1 changed files with 2 additions and 2 deletions

View File

@ -553,7 +553,7 @@ static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
#ifdef CONFIG_EFM32_I2C_DYNTIMEO
abstime.tv_nsec += 1000 * efm32_i2c_tousecs(priv->msgc, priv->msgv);
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;
@ -561,7 +561,7 @@ static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
#elif CONFIG_EFM32_I2CTIMEOMS > 0
abstime.tv_nsec += CONFIG_EFM32_I2CTIMEOMS * 1000 * 1000;
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;