You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2021/04/19 18:13:21 UTC

[GitHub] [mynewt-core] kasjer commented on a change in pull request #2569: hw/mcu/cmac: Fix os_cputime and LLT wrap around handling

kasjer commented on a change in pull request #2569:
URL: https://github.com/apache/mynewt-core/pull/2569#discussion_r616067639



##########
File path: hw/mcu/dialog/cmac/include/mcu/cmac_timer.h
##########
@@ -134,9 +171,13 @@ cmac_timer_disable_eq_hal_timer(void)
 static inline void
 cmac_timer_write_eq_hal_os_tick(uint64_t val)
 {
-    CMAC->CM_LL_TIMER1_36_10_EQ_Y_REG = val >> 10;
+    uint32_t val_hi;
+
+    val_hi = (val >> 10) & 0x7ffffff;
+
+    CMAC->CM_LL_TIMER1_36_10_EQ_Y_REG = val_hi;
 
-    if ((int32_t)((val >> 10) - cmac_timer_read_hi()) <= 0) {
+    if ((int32_t)((val_hi) - cmac_timer_read_hi()) <= 0) {

Review comment:
       extra () around val_hi

##########
File path: hw/mcu/dialog/cmac/include/mcu/cmac_timer.h
##########
@@ -27,9 +27,27 @@
 extern "C" {
 #endif
 
+/*
+ * Equals to LLT value after HAL timer wrapped around,
+ * i.e. os_cputime(0xffffffff "+1")
+ */
+#define CMAC_TIMER_LLT_AT_HAL_WRAP_AROUND_VAL   (0x1e84800000)
+
+#define CMAC_TIMER_HAL_GT(_t1, _t2)             ((int32_t)((_t1) - (_t2)) > 0)

Review comment:
       are those macros used for anything or are for future use?




-- 
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.

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