You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by da...@apache.org on 2019/12/21 10:56:11 UTC

[incubator-nuttx] 03/05: imxrt:lpi2c ensure that on an error status reflects it.

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

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

commit 0050ba9ac7e4cfef2b3a0f7a8d8b03c9774447ed
Author: David Sidrane <Da...@NscDg.com>
AuthorDate: Thu Dec 12 16:27:21 2019 -0800

    imxrt:lpi2c ensure that on an error status reflects it.
    
       After an error the STOP detect was overwriting the
       previous error status.
---
 arch/arm/src/imxrt/imxrt_lpi2c.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/imxrt/imxrt_lpi2c.c b/arch/arm/src/imxrt/imxrt_lpi2c.c
index 11a523a..2a90c16 100644
--- a/arch/arm/src/imxrt/imxrt_lpi2c.c
+++ b/arch/arm/src/imxrt/imxrt_lpi2c.c
@@ -1364,6 +1364,10 @@ static int imxrt_lpi2c_isr_process(struct imxrt_lpi2c_priv_s *priv)
 #ifndef CONFIG_I2C_POLLED
           if (priv->intstate == INTSTATE_WAITING)
             {
+              /* Update Status once at the end */
+
+              priv->status = status;
+
               /* inform the thread that transfer is complete
                * and wake it up
                */
@@ -1372,6 +1376,7 @@ static int imxrt_lpi2c_isr_process(struct imxrt_lpi2c_priv_s *priv)
               priv->intstate = INTSTATE_DONE;
             }
 #else
+          priv->status = status;
           priv->intstate = INTSTATE_DONE;
 #endif
           /* Mark that this transaction stopped */
@@ -1412,6 +1417,10 @@ static int imxrt_lpi2c_isr_process(struct imxrt_lpi2c_priv_s *priv)
 #ifndef CONFIG_I2C_POLLED
           if (priv->intstate == INTSTATE_WAITING)
             {
+              /* Update Status once at the end */
+
+              priv->status = status;
+
               /* inform the thread that transfer is complete
                * and wake it up
                */
@@ -1420,11 +1429,11 @@ static int imxrt_lpi2c_isr_process(struct imxrt_lpi2c_priv_s *priv)
               priv->intstate = INTSTATE_DONE;
             }
 #else
+          priv->status = status;
           priv->intstate = INTSTATE_DONE;
 #endif
     }
 
-  priv->status = status;
   return OK;
 }