You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2020/11/12 18:31:05 UTC

[mynewt-core] branch master updated (5a8171e -> 34e1e49)

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

andk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


    from 5a8171e  Merge pull request #2398 from agross-korg/tlv-update
     new c470a8d  hw/mcu/cmac: Use shared data lock for LP clock frequency update
     new 34e1e49  hw/mcu/cmac: Recalculate sleep time on request

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:
 hw/mcu/dialog/cmac/src/cmac_isr.c   | 13 +++++++++++++
 hw/mcu/dialog/cmac/src/cmac_priv.h  |  1 +
 hw/mcu/dialog/cmac/src/cmac_sleep.c | 12 ++++++++----
 hw/mcu/dialog/cmac/src/cmac_timer.c |  8 ++++++--
 4 files changed, 28 insertions(+), 6 deletions(-)


[mynewt-core] 01/02: hw/mcu/cmac: Use shared data lock for LP clock frequency update

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

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit c470a8d5bd9248c03bcf0f0a3ec7e54b47668009
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Oct 7 14:54:32 2020 +0200

    hw/mcu/cmac: Use shared data lock for LP clock frequency update
---
 hw/mcu/dialog/cmac/src/cmac_timer.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/dialog/cmac/src/cmac_timer.c b/hw/mcu/dialog/cmac/src/cmac_timer.c
index aca5b17..ce23c1a 100644
--- a/hw/mcu/dialog/cmac/src/cmac_timer.c
+++ b/hw/mcu/dialog/cmac/src/cmac_timer.c
@@ -367,11 +367,15 @@ cmac_timer_slp_disable(uint32_t exp_ticks)
 bool
 cmac_timer_slp_update(void)
 {
-    if (g_cmac_shared_data.lp_clock_freq == g_cmac_timer_slp.freq) {
+    uint32_t lp_clock_freq;
+
+    lp_clock_freq = g_cmac_shared_data.lp_clock_freq;
+
+    if (lp_clock_freq == g_cmac_timer_slp.freq) {
         return false;
     }
 
-    g_cmac_timer_slp.freq = g_cmac_shared_data.lp_clock_freq;
+    g_cmac_timer_slp.freq = lp_clock_freq;
 
 #if !MYNEWT_VAL(MCU_SLP_TIMER_32K_ONLY)
     if (g_cmac_timer_slp.freq) {


[mynewt-core] 02/02: hw/mcu/cmac: Recalculate sleep time on request

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

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 34e1e49f6dd05b327460577829d562110ecaf72d
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Oct 7 16:46:55 2020 +0200

    hw/mcu/cmac: Recalculate sleep time on request
    
    M33 can wakeup CMAC when LP clock frequency is updated and we can use
    this wakeup to recalculate sleep time instantly, no need to check every
    time we want to go to sleep whether this needs recalculation.
---
 hw/mcu/dialog/cmac/src/cmac_isr.c   | 13 +++++++++++++
 hw/mcu/dialog/cmac/src/cmac_priv.h  |  1 +
 hw/mcu/dialog/cmac/src/cmac_sleep.c | 12 ++++++++----
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/hw/mcu/dialog/cmac/src/cmac_isr.c b/hw/mcu/dialog/cmac/src/cmac_isr.c
index 135626b..91876c7 100644
--- a/hw/mcu/dialog/cmac/src/cmac_isr.c
+++ b/hw/mcu/dialog/cmac/src/cmac_isr.c
@@ -20,14 +20,27 @@
 #include "mcu/mcu.h"
 #include "mcu/cmac_pdc.h"
 #include "cmac_driver/cmac_shared.h"
+#include "cmac_priv.h"
 #include "CMAC.h"
 
 void
 SYS2CMAC_IRQHandler(void)
 {
+    uint16_t pending_ops;
+
     if (CMAC->CM_EXC_STAT_REG & CMAC_CM_EXC_STAT_REG_EXC_SYS2CMAC_Msk) {
+        cmac_shared_lock();
+        pending_ops = g_cmac_shared_data.pending_ops;
+        g_cmac_shared_data.pending_ops = 0;
+        cmac_shared_unlock();
+
         cmac_mbox_read();
         cmac_rand_read();
+
+        if (pending_ops & CMAC_PENDING_OP_LP_CLK) {
+            cmac_sleep_recalculate();
+        }
+
         CMAC->CM_EXC_STAT_REG = CMAC_CM_EXC_STAT_REG_EXC_SYS2CMAC_Msk;
     }
 
diff --git a/hw/mcu/dialog/cmac/src/cmac_priv.h b/hw/mcu/dialog/cmac/src/cmac_priv.h
index dfad04e..45edf43 100644
--- a/hw/mcu/dialog/cmac/src/cmac_priv.h
+++ b/hw/mcu/dialog/cmac/src/cmac_priv.h
@@ -30,6 +30,7 @@ extern "C" {
 extern int8_t g_cmac_pdc_cmac2sys;
 
 void cmac_sleep(void);
+void cmac_sleep_recalculate(void);
 
 #ifdef __cplusplus
 }
diff --git a/hw/mcu/dialog/cmac/src/cmac_sleep.c b/hw/mcu/dialog/cmac/src/cmac_sleep.c
index 6fdcd81..5a97099 100644
--- a/hw/mcu/dialog/cmac/src/cmac_sleep.c
+++ b/hw/mcu/dialog/cmac/src/cmac_sleep.c
@@ -198,6 +198,14 @@ cmac_sleep_calculate_wakeup_time(void)
 }
 
 void
+cmac_sleep_recalculate(void)
+{
+    if (cmac_timer_slp_update()) {
+        cmac_sleep_calculate_wakeup_time();
+    }
+}
+
+void
 cmac_sleep(void)
 {
     bool switch_to_slp;
@@ -214,10 +222,6 @@ cmac_sleep(void)
 
     cmac_pdc_ack_all();
 
-    if (cmac_timer_slp_update()) {
-        cmac_sleep_calculate_wakeup_time();
-    }
-
     wakeup_at = cmac_timer_next_at();
 
     /*