You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ra...@apache.org on 2020/08/25 05:17:31 UTC

[incubator-nuttx] branch master updated (4076674 -> 0b6cca9)

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

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


    from 4076674  doc: fix typo on contribution workflow
     new fa6bb54  nrf52 RTC: add event handling support
     new f5f07da  nxstyle fixes
     new 0b6cca9  nrf52_rtc: unify irq and evt enums

The 3 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/arm/src/nrf52/nrf52_rtc.c | 162 ++++++++++++++++++++++++++++++++++++-----
 arch/arm/src/nrf52/nrf52_rtc.h |  25 ++++---
 2 files changed, 158 insertions(+), 29 deletions(-)


[incubator-nuttx] 02/03: nxstyle fixes

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

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

commit f5f07da7e7f8e2f8f74083a52053cc8d7a904702
Author: Matias N <ma...@protobits.dev>
AuthorDate: Mon Aug 24 10:43:34 2020 -0300

    nxstyle fixes
---
 arch/arm/src/nrf52/nrf52_rtc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/nrf52/nrf52_rtc.c b/arch/arm/src/nrf52/nrf52_rtc.c
index d52da8f..9b5b01c 100644
--- a/arch/arm/src/nrf52/nrf52_rtc.c
+++ b/arch/arm/src/nrf52/nrf52_rtc.c
@@ -89,7 +89,8 @@ static int nrf52_rtc_disableint(FAR struct nrf52_rtc_dev_s *dev, uint8_t s);
 static int nrf52_rtc_checkint(FAR struct nrf52_rtc_dev_s *dev, uint8_t s);
 static int nrf52_rtc_ackint(FAR struct nrf52_rtc_dev_s *dev, uint8_t s);
 static int nrf52_rtc_enableevt(FAR struct nrf52_rtc_dev_s *dev, uint8_t evt);
-static int nrf52_rtc_disableevt(FAR struct nrf52_rtc_dev_s *dev, uint8_t evt);
+static int nrf52_rtc_disableevt(FAR struct nrf52_rtc_dev_s *dev,
+                                uint8_t evt);
 
 /****************************************************************************
  * Private Data


[incubator-nuttx] 01/03: nrf52 RTC: add event handling support

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

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

commit fa6bb5411de8695193eb44ddb11227ed47cd12e7
Author: Matias N <ma...@protobits.dev>
AuthorDate: Fri Jul 24 22:59:05 2020 -0300

    nrf52 RTC: add event handling support
---
 arch/arm/src/nrf52/nrf52_rtc.c | 125 ++++++++++++++++++++++++++++++++++++++++-
 arch/arm/src/nrf52/nrf52_rtc.h |  21 ++++++-
 2 files changed, 143 insertions(+), 3 deletions(-)

diff --git a/arch/arm/src/nrf52/nrf52_rtc.c b/arch/arm/src/nrf52/nrf52_rtc.c
index 51f9b99..d52da8f 100644
--- a/arch/arm/src/nrf52/nrf52_rtc.c
+++ b/arch/arm/src/nrf52/nrf52_rtc.c
@@ -68,6 +68,8 @@ static void nrf52_rtc_putreg(FAR struct nrf52_rtc_dev_s *dev,
 
 static uint32_t nrf52_rtc_irq2reg(FAR struct nrf52_rtc_dev_s *dev,
                                   uint8_t s);
+static uint32_t nrf52_rtc_evt2reg(FAR struct nrf52_rtc_dev_s *dev,
+                                  uint8_t evt);
 
 /* RTC operations ***********************************************************/
 
@@ -86,6 +88,8 @@ static int nrf52_rtc_enableint(FAR struct nrf52_rtc_dev_s *dev, uint8_t s);
 static int nrf52_rtc_disableint(FAR struct nrf52_rtc_dev_s *dev, uint8_t s);
 static int nrf52_rtc_checkint(FAR struct nrf52_rtc_dev_s *dev, uint8_t s);
 static int nrf52_rtc_ackint(FAR struct nrf52_rtc_dev_s *dev, uint8_t s);
+static int nrf52_rtc_enableevt(FAR struct nrf52_rtc_dev_s *dev, uint8_t evt);
+static int nrf52_rtc_disableevt(FAR struct nrf52_rtc_dev_s *dev, uint8_t evt);
 
 /****************************************************************************
  * Private Data
@@ -106,7 +110,9 @@ struct nrf52_rtc_ops_s nrf52_rtc_ops =
   .enableint  = nrf52_rtc_enableint,
   .disableint = nrf52_rtc_disableint,
   .checkint   = nrf52_rtc_checkint,
-  .ackint     = nrf52_rtc_ackint
+  .ackint     = nrf52_rtc_ackint,
+  .enableevt  = nrf52_rtc_enableevt,
+  .disableevt = nrf52_rtc_disableevt,
 };
 
 #ifdef CONFIG_NRF52_RTC0
@@ -189,7 +195,7 @@ static void nrf52_rtc_putreg(FAR struct nrf52_rtc_dev_s *dev,
  * Name: nrf52_rtc_irq2reg
  *
  * Description:
- *   Get the vaule of the interrupt register corresponding to the given
+ *   Get the value of the interrupt register corresponding to the given
  *   interrupt source
  *
  ****************************************************************************/
@@ -249,6 +255,69 @@ errout:
 }
 
 /****************************************************************************
+ * Name: nrf52_rtc_evt2reg
+ *
+ * Description:
+ *   Get the offset of the event register corresponding to the given event
+ *
+ ****************************************************************************/
+
+static uint32_t nrf52_rtc_evt2reg(FAR struct nrf52_rtc_dev_s *dev,
+                                  uint8_t evt)
+{
+  uint32_t regval;
+
+  switch (evt)
+    {
+      case NRF52_RTC_EVT_TICK:
+        {
+          regval = RTC_EVTEN_TICK;
+          break;
+        }
+
+      case NRF52_RTC_EVT_OVRFLW:
+        {
+          regval = RTC_EVTEN_OVRFLW;
+          break;
+        }
+
+      case NRF52_RTC_EVT_COMPARE0:
+        {
+          regval = RTC_EVTEN_COMPARE(0);
+          break;
+        }
+
+      case NRF52_RTC_EVT_COMPARE1:
+        {
+          regval = RTC_EVTEN_COMPARE(1);
+          break;
+        }
+
+      case NRF52_RTC_EVT_COMPARE2:
+        {
+          regval = RTC_EVTEN_COMPARE(2);
+          break;
+        }
+
+      case NRF52_RTC_EVT_COMPARE3:
+        {
+          regval = RTC_EVTEN_COMPARE(3);
+          break;
+        }
+
+      default:
+        {
+          rtcerr("ERROR: unsupported EVENT %d\n", evt);
+          regval = 0;
+          goto errout;
+        }
+    }
+
+errout:
+  return regval;
+}
+
+/****************************************************************************
  * Name: nrf52_rtc_start
  ****************************************************************************/
 
@@ -589,6 +658,58 @@ errout:
 }
 
 /****************************************************************************
+ * Name: nrf52_rtc_enableevt
+ ****************************************************************************/
+
+static int nrf52_rtc_enableevt(FAR struct nrf52_rtc_dev_s *dev, uint8_t evt)
+{
+  uint32_t regval = 0;
+  int      ret    = OK;
+
+  DEBUGASSERT(dev);
+
+  /* Get register value for given event */
+
+  regval = nrf52_rtc_evt2reg(dev, evt);
+  if (regval == 0)
+    {
+      ret = -EINVAL;
+      goto errout;
+    }
+
+  nrf52_rtc_putreg(dev, NRF52_RTC_EVTENSET_OFFSET, regval);
+
+errout:
+  return ret;
+}
+
+/****************************************************************************
+ * Name: nrf52_rtc_disableevt
+ ****************************************************************************/
+
+static int nrf52_rtc_disableevt(FAR struct nrf52_rtc_dev_s *dev, uint8_t evt)
+{
+  uint32_t regval = 0;
+  int      ret    = OK;
+
+  DEBUGASSERT(dev);
+
+  /* Get register value for given event */
+
+  regval = nrf52_rtc_evt2reg(dev, evt);
+  if (regval == 0)
+    {
+      ret = -EINVAL;
+      goto errout;
+    }
+
+  nrf52_rtc_putreg(dev, NRF52_RTC_EVTENCLR_OFFSET, regval);
+
+errout:
+  return ret;
+}
+
+/****************************************************************************
  * Public Functions
  ****************************************************************************/
 
diff --git a/arch/arm/src/nrf52/nrf52_rtc.h b/arch/arm/src/nrf52/nrf52_rtc.h
index 03dbb26..2b89c5a 100644
--- a/arch/arm/src/nrf52/nrf52_rtc.h
+++ b/arch/arm/src/nrf52/nrf52_rtc.h
@@ -42,11 +42,13 @@
 #define NRF52_RTC_SETCC(d, i, cc)         ((d)->ops->setcc(d, i, cc))
 #define NRF52_RTC_GETCC(d, i, cc)         ((d)->ops->setcc(d, i, cc))
 #define NRF52_RTC_SETPRE(d, pre)          ((d)->ops->setpre(d, pre))
-#define NRF52_RTC_SETISR(d, hnd, arg, s)  ((d)->ops->setisr(d, hnd, arg, s))
+#define NRF52_RTC_SETISR(d, hnd, arg)     ((d)->ops->setisr(d, hnd, arg))
 #define NRF52_RTC_ENABLEINT(d, s)         ((d)->ops->enableint(d, s))
 #define NRF52_RTC_DISABLEINT(d, s)        ((d)->ops->disableint(d, s))
 #define NRF52_RTC_CHECKINT(d, s)          ((d)->ops->checkint(d, s))
 #define NRF52_RTC_ACKINT(d, s)            ((d)->ops->ackint(d, s))
+#define NRF52_RTC_ENABLEEVT(d, s)         ((d)->ops->enableevt(d, s))
+#define NRF52_RTC_DISABLEEVT(d, s)        ((d)->ops->disableevt(d, s))
 
 /****************************************************************************
  * Public Types
@@ -74,6 +76,18 @@ enum nrf52_rtc_irq_e
   NRF52_RTC_INT_COMPARE3 = 5,
 };
 
+/* RTC Events */
+
+enum nrf52_rtc_evt_e
+{
+  NRF52_RTC_EVT_TICK     = 0,
+  NRF52_RTC_EVT_OVRFLW   = 1,
+  NRF52_RTC_EVT_COMPARE0 = 2,
+  NRF52_RTC_EVT_COMPARE1 = 3,
+  NRF52_RTC_EVT_COMPARE2 = 4,
+  NRF52_RTC_EVT_COMPARE3 = 5,
+};
+
 /* NRF52 RTC device */
 
 struct nrf52_rtc_dev_s
@@ -107,6 +121,11 @@ struct nrf52_rtc_ops_s
   CODE int (*disableint)(FAR struct nrf52_rtc_dev_s *dev, uint8_t source);
   CODE int (*checkint)(FAR struct nrf52_rtc_dev_s *dev, uint8_t source);
   CODE int (*ackint)(FAR struct nrf52_rtc_dev_s *dev, uint8_t source);
+
+  /* RTC events */
+
+  CODE int (*enableevt)(FAR struct nrf52_rtc_dev_s *dev, uint8_t evt);
+  CODE int (*disableevt)(FAR struct nrf52_rtc_dev_s *dev, uint8_t evt);
 };
 
 /****************************************************************************


[incubator-nuttx] 03/03: nrf52_rtc: unify irq and evt enums

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

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

commit 0b6cca920bd89a112a43f36d0a8c07c35c0ee2ea
Author: Matias N <ma...@protobits.dev>
AuthorDate: Mon Aug 24 14:19:41 2020 -0300

    nrf52_rtc: unify irq and evt enums
---
 arch/arm/src/nrf52/nrf52_rtc.c | 36 ++++++++++++++++++------------------
 arch/arm/src/nrf52/nrf52_rtc.h | 14 +-------------
 2 files changed, 19 insertions(+), 31 deletions(-)

diff --git a/arch/arm/src/nrf52/nrf52_rtc.c b/arch/arm/src/nrf52/nrf52_rtc.c
index 9b5b01c..4492296 100644
--- a/arch/arm/src/nrf52/nrf52_rtc.c
+++ b/arch/arm/src/nrf52/nrf52_rtc.c
@@ -207,37 +207,37 @@ static uint32_t nrf52_rtc_irq2reg(FAR struct nrf52_rtc_dev_s *dev, uint8_t s)
 
   switch (s)
     {
-      case NRF52_RTC_INT_TICK:
+      case NRF52_RTC_EVT_TICK:
         {
           regval = RTC_INT_TICK;
           break;
         }
 
-      case NRF52_RTC_INT_OVRFLW:
+      case NRF52_RTC_EVT_OVRFLW:
         {
           regval = RTC_INT_OVRFLW;
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE0:
+      case NRF52_RTC_EVT_COMPARE0:
         {
           regval = RTC_INT_COMPARE(0);
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE1:
+      case NRF52_RTC_EVT_COMPARE1:
         {
           regval = RTC_INT_COMPARE(1);
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE2:
+      case NRF52_RTC_EVT_COMPARE2:
         {
           regval = RTC_INT_COMPARE(2);
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE3:
+      case NRF52_RTC_EVT_COMPARE3:
         {
           regval = RTC_INT_COMPARE(3);
           break;
@@ -550,37 +550,37 @@ static int nrf52_rtc_checkint(FAR struct nrf52_rtc_dev_s *dev, uint8_t s)
 
   switch (s)
     {
-      case NRF52_RTC_INT_TICK:
+      case NRF52_RTC_EVT_TICK:
         {
           ret = nrf52_rtc_getreg(dev, NRF52_RTC_EVENTS_TICK_OFFSET);
           break;
         }
 
-      case NRF52_RTC_INT_OVRFLW:
+      case NRF52_RTC_EVT_OVRFLW:
         {
           ret = nrf52_rtc_getreg(dev, NRF52_RTC_EVENTS_OVRFLW_OFFSET);
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE0:
+      case NRF52_RTC_EVT_COMPARE0:
         {
           ret = nrf52_rtc_getreg(dev, NRF52_RTC_EVENTS_COMPARE_OFFSET(0));
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE1:
+      case NRF52_RTC_EVT_COMPARE1:
         {
           ret = nrf52_rtc_getreg(dev, NRF52_RTC_EVENTS_COMPARE_OFFSET(0));
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE2:
+      case NRF52_RTC_EVT_COMPARE2:
         {
           ret = nrf52_rtc_getreg(dev, NRF52_RTC_EVENTS_COMPARE_OFFSET(2));
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE3:
+      case NRF52_RTC_EVT_COMPARE3:
         {
           ret = nrf52_rtc_getreg(dev, NRF52_RTC_EVENTS_COMPARE_OFFSET(3));
           break;
@@ -610,37 +610,37 @@ static int nrf52_rtc_ackint(FAR struct nrf52_rtc_dev_s *dev, uint8_t s)
 
   switch (s)
     {
-      case NRF52_RTC_INT_TICK:
+      case NRF52_RTC_EVT_TICK:
         {
           nrf52_rtc_putreg(dev, NRF52_RTC_EVENTS_TICK_OFFSET, 0);
           break;
         }
 
-      case NRF52_RTC_INT_OVRFLW:
+      case NRF52_RTC_EVT_OVRFLW:
         {
           nrf52_rtc_putreg(dev, NRF52_RTC_EVENTS_OVRFLW_OFFSET, 0);
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE0:
+      case NRF52_RTC_EVT_COMPARE0:
         {
           nrf52_rtc_putreg(dev, NRF52_RTC_EVENTS_COMPARE_OFFSET(0), 0);
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE1:
+      case NRF52_RTC_EVT_COMPARE1:
         {
           nrf52_rtc_putreg(dev, NRF52_RTC_EVENTS_COMPARE_OFFSET(1), 0);
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE2:
+      case NRF52_RTC_EVT_COMPARE2:
         {
           nrf52_rtc_putreg(dev, NRF52_RTC_EVENTS_COMPARE_OFFSET(2), 0);
           break;
         }
 
-      case NRF52_RTC_INT_COMPARE3:
+      case NRF52_RTC_EVT_COMPARE3:
         {
           nrf52_rtc_putreg(dev, NRF52_RTC_EVENTS_COMPARE_OFFSET(3), 0);
           break;
diff --git a/arch/arm/src/nrf52/nrf52_rtc.h b/arch/arm/src/nrf52/nrf52_rtc.h
index 2b89c5a..17efd28 100644
--- a/arch/arm/src/nrf52/nrf52_rtc.h
+++ b/arch/arm/src/nrf52/nrf52_rtc.h
@@ -64,19 +64,7 @@ enum nrf52_rtc_cc_e
   NRF52_RTC_CC3 = 3,
 };
 
-/* RTC IRQ source */
-
-enum nrf52_rtc_irq_e
-{
-  NRF52_RTC_INT_TICK     = 0,
-  NRF52_RTC_INT_OVRFLW   = 1,
-  NRF52_RTC_INT_COMPARE0 = 2,
-  NRF52_RTC_INT_COMPARE1 = 3,
-  NRF52_RTC_INT_COMPARE2 = 4,
-  NRF52_RTC_INT_COMPARE3 = 5,
-};
-
-/* RTC Events */
+/* RTC Interrupts/Events */
 
 enum nrf52_rtc_evt_e
 {