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/16 12:38:00 UTC

[GitHub] [mynewt-core] andrzej-kaczmarek opened a new pull request #2569: hw/mcu/cmac: Fix os_cputime and LLT wrap around handling

andrzej-kaczmarek opened a new pull request #2569:
URL: https://github.com/apache/mynewt-core/pull/2569


   os_cputime runs at 32768Hz but it uses LLT internally which runs at
   1MHz. This means both timers will wrap around at different time. This
   means after one of timers wraps around (os_cputime wraps earlier),
   calculations that use values converted between both timers will fail.
   
   To fix this we "manually" extend LLT value to 64-bit internally so it
   takes zillion of years before it wraps around. Also conversions from
   os_cputime (a.k.a. HAL) value to LLT value take os_cputime value wrap
   around into account and return proper 64-bit LLT value.


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



[GitHub] [mynewt-core] andrzej-kaczmarek merged pull request #2569: hw/mcu/cmac: Fix os_cputime and LLT wrap around handling

Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek merged pull request #2569:
URL: https://github.com/apache/mynewt-core/pull/2569


   


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



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

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2569:
URL: https://github.com/apache/mynewt-core/pull/2569#issuecomment-821510328


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


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



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2569: hw/mcu/cmac: Fix os_cputime and LLT wrap around handling

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2569:
URL: https://github.com/apache/mynewt-core/pull/2569#issuecomment-822376646


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


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



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

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2569:
URL: https://github.com/apache/mynewt-core/pull/2569#issuecomment-822376646


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


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



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2569: hw/mcu/cmac: Fix os_cputime and LLT wrap around handling

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2569:
URL: https://github.com/apache/mynewt-core/pull/2569#issuecomment-821510328


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


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



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

Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on pull request #2569:
URL: https://github.com/apache/mynewt-core/pull/2569#issuecomment-821160903


   this is different approach to https://github.com/apache/mynewt-core/pull/2561


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



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

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2569:
URL: https://github.com/apache/mynewt-core/pull/2569#issuecomment-823140960


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


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



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

Posted by GitBox <gi...@apache.org>.
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