xiaoxiang781216 commented on code in PR #6226:
URL: https://github.com/apache/incubator-nuttx/pull/6226#discussion_r872981511
##########
arch/risc-v/src/esp32c3/esp32c3_i2c.c:
##########
@@ -793,27 +793,9 @@ static void esp32c3_i2c_reset_fsmc(struct
esp32c3_i2c_priv_s *priv)
#ifndef CONFIG_I2C_POLLED
static int esp32c3_i2c_sem_waitdone(struct esp32c3_i2c_priv_s *priv)
{
- int ret;
- struct timespec abstime;
-
- clock_gettime(CLOCK_REALTIME, &abstime);
-
-#if CONFIG_ESP32C3_I2CTIMEOSEC > 0
- abstime.tv_sec += CONFIG_ESP32C3_I2CTIMEOSEC;
-#endif
-
-#if CONFIG_ESP32C3_I2CTIMEOMS > 0
- abstime.tv_nsec += CONFIG_ESP32C3_I2CTIMEOMS * NSEC_PER_MSEC;
- if (abstime.tv_nsec >= 1000 * NSEC_PER_MSEC)
- {
- abstime.tv_sec++;
- abstime.tv_nsec -= 1000 * NSEC_PER_MSEC;
- }
-#endif
-
- ret = nxsem_timedwait_uninterruptible(&priv->sem_isr, &abstime);
-
- return ret;
+ return nxsem_tickwait_uninterruptible(&priv->sem_isr,
+ SEC2TICK(CONFIG_ESP32C3_I2CTIMEOSEC) +
+ MSEC2TICK(CONFIG_ESP32C3_I2CTIMEOMS));
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]