You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/09/16 12:00:19 UTC

[GitHub] [incubator-nuttx] gustavonihei opened a new pull request #4558: [ESP32][ESP32-C3] Reduce the 10 second semaphore timeout on I2C

gustavonihei opened a new pull request #4558:
URL: https://github.com/apache/incubator-nuttx/pull/4558


   ## Summary
   This PR intends to reduce the 10 seconds semaphore timeout on the I2C drivers of ESP32 and ESP32-C3.
   
   ## Impact
   ESP32 and ESP32-C3 configs using the I2C controller.
   
   ## Testing
   `esp32-wrover-kit:lcd1602`
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] saramonteiro commented on a change in pull request #4558: [ESP32][ESP32-C3] Reduce the 10 second semaphore timeout on I2C

Posted by GitBox <gi...@apache.org>.
saramonteiro commented on a change in pull request #4558:
URL: https://github.com/apache/incubator-nuttx/pull/4558#discussion_r710073420



##########
File path: arch/risc-v/src/esp32c3/esp32c3_i2c.c
##########
@@ -799,8 +799,18 @@ static int esp32c3_i2c_sem_waitdone(struct esp32c3_i2c_priv_s *priv)
 
   clock_gettime(CLOCK_REALTIME, &abstime);
 
-  abstime.tv_sec += 10;
-  abstime.tv_nsec += 0;
+#if CONFIG_ESP32C3_I2CTIMEOSEC > 0
+  abstime.tv_sec += CONFIG_ESP32C3_I2CTIMEOSEC;
+#endif
+
+#if CONFIG_ESP32C3_I2CTIMEOMS > 0
+  abstime.tv_nsec += CONFIG_ESP32C3_I2CTIMEOMS * 1000 * 1000;
+  if (abstime.tv_nsec >= 1000 * 1000 * 1000)
+    {
+      abstime.tv_sec++;
+      abstime.tv_nsec -= 1000 * 1000 * 1000;
+    }
+#endif

Review comment:
       @gustavonihei one suggestion here:
   Replace 1000 * 1000 by `NSEC_PER_MSEC`
   and 1000 * 1000 * 1000 by `NSEC_PER_SEC`
   See these macros at `nuttx/include/nuttx/clock.h`
   and bellow




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] saramonteiro commented on a change in pull request #4558: [ESP32][ESP32-C3] Reduce the 10 second semaphore timeout on I2C

Posted by GitBox <gi...@apache.org>.
saramonteiro commented on a change in pull request #4558:
URL: https://github.com/apache/incubator-nuttx/pull/4558#discussion_r710073420



##########
File path: arch/risc-v/src/esp32c3/esp32c3_i2c.c
##########
@@ -799,8 +799,18 @@ static int esp32c3_i2c_sem_waitdone(struct esp32c3_i2c_priv_s *priv)
 
   clock_gettime(CLOCK_REALTIME, &abstime);
 
-  abstime.tv_sec += 10;
-  abstime.tv_nsec += 0;
+#if CONFIG_ESP32C3_I2CTIMEOSEC > 0
+  abstime.tv_sec += CONFIG_ESP32C3_I2CTIMEOSEC;
+#endif
+
+#if CONFIG_ESP32C3_I2CTIMEOMS > 0
+  abstime.tv_nsec += CONFIG_ESP32C3_I2CTIMEOMS * 1000 * 1000;
+  if (abstime.tv_nsec >= 1000 * 1000 * 1000)
+    {
+      abstime.tv_sec++;
+      abstime.tv_nsec -= 1000 * 1000 * 1000;
+    }
+#endif

Review comment:
       @gustavonihei one suggestion here and bellow:
   Replace 1000 * 1000 by `NSEC_PER_MSEC`
   and 1000 * 1000 * 1000 by `NSEC_PER_SEC`
   See these macros at `nuttx/include/nuttx/clock.h`
   




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #4558: [ESP32][ESP32-C3] Reduce the 10 second semaphore timeout on I2C

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4558:
URL: https://github.com/apache/incubator-nuttx/pull/4558#discussion_r710077224



##########
File path: arch/risc-v/src/esp32c3/esp32c3_i2c.c
##########
@@ -799,8 +799,18 @@ static int esp32c3_i2c_sem_waitdone(struct esp32c3_i2c_priv_s *priv)
 
   clock_gettime(CLOCK_REALTIME, &abstime);
 
-  abstime.tv_sec += 10;
-  abstime.tv_nsec += 0;
+#if CONFIG_ESP32C3_I2CTIMEOSEC > 0
+  abstime.tv_sec += CONFIG_ESP32C3_I2CTIMEOSEC;
+#endif
+
+#if CONFIG_ESP32C3_I2CTIMEOMS > 0
+  abstime.tv_nsec += CONFIG_ESP32C3_I2CTIMEOMS * 1000 * 1000;
+  if (abstime.tv_nsec >= 1000 * 1000 * 1000)
+    {
+      abstime.tv_sec++;
+      abstime.tv_nsec -= 1000 * 1000 * 1000;
+    }
+#endif

Review comment:
       Nice suggestion, fixed! Thanks!




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] saramonteiro merged pull request #4558: [ESP32][ESP32-C3] Reduce the 10 second semaphore timeout on I2C

Posted by GitBox <gi...@apache.org>.
saramonteiro merged pull request #4558:
URL: https://github.com/apache/incubator-nuttx/pull/4558


   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] saramonteiro commented on a change in pull request #4558: [ESP32][ESP32-C3] Reduce the 10 second semaphore timeout on I2C

Posted by GitBox <gi...@apache.org>.
saramonteiro commented on a change in pull request #4558:
URL: https://github.com/apache/incubator-nuttx/pull/4558#discussion_r710073420



##########
File path: arch/risc-v/src/esp32c3/esp32c3_i2c.c
##########
@@ -799,8 +799,18 @@ static int esp32c3_i2c_sem_waitdone(struct esp32c3_i2c_priv_s *priv)
 
   clock_gettime(CLOCK_REALTIME, &abstime);
 
-  abstime.tv_sec += 10;
-  abstime.tv_nsec += 0;
+#if CONFIG_ESP32C3_I2CTIMEOSEC > 0
+  abstime.tv_sec += CONFIG_ESP32C3_I2CTIMEOSEC;
+#endif
+
+#if CONFIG_ESP32C3_I2CTIMEOMS > 0
+  abstime.tv_nsec += CONFIG_ESP32C3_I2CTIMEOMS * 1000 * 1000;
+  if (abstime.tv_nsec >= 1000 * 1000 * 1000)
+    {
+      abstime.tv_sec++;
+      abstime.tv_nsec -= 1000 * 1000 * 1000;
+    }
+#endif

Review comment:
       @gustavonihei one suggestion here:
   Replace 1000 * 1000 by `NSEC_PER_MSEC`
   and 1000 * 1000 * 1000 by `NSEC_PER_SEC`
   See these macros at `nuttx/include/nuttx/clock.h`




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org