You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by sa...@apache.org on 2021/09/16 17:07:33 UTC

[incubator-nuttx] branch master updated (3b2aea2 -> 52cea55)

This is an automated email from the ASF dual-hosted git repository.

sara pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 3b2aea2  sched/irq/irq_csection.c: Fix typos and correct some comments.
     new b33ccd0  xtensa/esp32: Make the semaphore timeout on I2C configurable
     new 52cea55  risc-v/esp32c3: Make the semaphore timeout on I2C configurable

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/risc-v/src/esp32c3/Kconfig       |  8 ++++++++
 arch/risc-v/src/esp32c3/esp32c3_i2c.c | 14 ++++++++++++--
 arch/xtensa/src/esp32/Kconfig         |  8 ++++++++
 arch/xtensa/src/esp32/esp32_i2c.c     | 14 ++++++++++++--
 4 files changed, 40 insertions(+), 4 deletions(-)

[incubator-nuttx] 02/02: risc-v/esp32c3: Make the semaphore timeout on I2C configurable

Posted by sa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sara pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 52cea558af6e7dfa41cbfc616ff209ccb36c1276
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Wed Sep 15 16:29:50 2021 -0300

    risc-v/esp32c3: Make the semaphore timeout on I2C configurable
    
    Signed-off-by: Gustavo Henrique Nihei <gu...@espressif.com>
---
 arch/risc-v/src/esp32c3/Kconfig       |  8 ++++++++
 arch/risc-v/src/esp32c3/esp32c3_i2c.c | 14 ++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/risc-v/src/esp32c3/Kconfig b/arch/risc-v/src/esp32c3/Kconfig
index 30126a6..f91e39d 100644
--- a/arch/risc-v/src/esp32c3/Kconfig
+++ b/arch/risc-v/src/esp32c3/Kconfig
@@ -375,6 +375,14 @@ config ESP32C3_I2C0_SDAPIN
 
 endif # ESP32C3_I2C0
 
+config ESP32C3_I2CTIMEOSEC
+	int "Timeout seconds"
+	default 0
+
+config ESP32C3_I2CTIMEOMS
+	int "Timeout milliseconds"
+	default 500
+
 endmenu # I2C configuration
 
 menu "SPI configuration"
diff --git a/arch/risc-v/src/esp32c3/esp32c3_i2c.c b/arch/risc-v/src/esp32c3/esp32c3_i2c.c
index 8807703..3617382 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_i2c.c
+++ b/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 * 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);
 

[incubator-nuttx] 01/02: xtensa/esp32: Make the semaphore timeout on I2C configurable

Posted by sa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sara pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit b33ccd01cfae2c4f5cc9c6ccf46130c0fc51758f
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Wed Sep 15 16:28:11 2021 -0300

    xtensa/esp32: Make the semaphore timeout on I2C configurable
    
    Signed-off-by: Gustavo Henrique Nihei <gu...@espressif.com>
---
 arch/xtensa/src/esp32/Kconfig     |  8 ++++++++
 arch/xtensa/src/esp32/esp32_i2c.c | 14 ++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/xtensa/src/esp32/Kconfig b/arch/xtensa/src/esp32/Kconfig
index 6d3669c..a5ecd7b 100644
--- a/arch/xtensa/src/esp32/Kconfig
+++ b/arch/xtensa/src/esp32/Kconfig
@@ -728,6 +728,14 @@ config ESP32_I2C1_SDAPIN
 
 endif # ESP32_I2C1
 
+config ESP32_I2CTIMEOSEC
+	int "Timeout seconds"
+	default 0
+
+config ESP32_I2CTIMEOMS
+	int "Timeout milliseconds"
+	default 500
+
 endmenu # I2C configuration
 
 menu "SPI configuration"
diff --git a/arch/xtensa/src/esp32/esp32_i2c.c b/arch/xtensa/src/esp32/esp32_i2c.c
index 0353862..6d0d9dc2 100644
--- a/arch/xtensa/src/esp32/esp32_i2c.c
+++ b/arch/xtensa/src/esp32/esp32_i2c.c
@@ -727,8 +727,18 @@ static int esp32_i2c_sem_waitdone(FAR struct esp32_i2c_priv_s *priv)
 
   clock_gettime(CLOCK_REALTIME, &abstime);
 
-  abstime.tv_sec += 10;
-  abstime.tv_nsec += 0;
+#if CONFIG_ESP32_I2CTIMEOSEC > 0
+  abstime.tv_sec += CONFIG_ESP32_I2CTIMEOSEC;
+#endif
+
+#if CONFIG_ESP32_I2CTIMEOMS > 0
+  abstime.tv_nsec += CONFIG_ESP32_I2CTIMEOMS * NSEC_PER_MSEC;
+  if (abstime.tv_nsec >= 1000 * NSEC_PER_MSEC)
+    {
+      abstime.tv_sec++;
+      abstime.tv_nsec -= 1000 * NSEC_PER_MSEC;
+    }
+#endif
 
   /* Wait on ISR semaphore */