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 2024/07/31 09:45:15 UTC

(mynewt-nimble) branch ll-ticks-idiv-conv created (now b96dbb70)

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

andk pushed a change to branch ll-ticks-idiv-conv
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


      at b96dbb70 nimble/ll: Update ticks conversions for MCUs with idiv support

This branch includes the following new commits:

     new b96dbb70 nimble/ll: Update ticks conversions for MCUs with idiv support

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



(mynewt-nimble) 01/01: nimble/ll: Update ticks conversions for MCUs with idiv support

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

andk pushed a commit to branch ll-ticks-idiv-conv
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit b96dbb709173d88fcae7e2c24cf64854230ffaf8
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Jul 31 11:05:22 2024 +0200

    nimble/ll: Update ticks conversions for MCUs with idiv support
    
    We can use simple calculations for MCUs that support idiv. This has also
    larger range of allowed values on uint32_t values.
---
 nimble/controller/include/controller/ble_ll_tmr.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/nimble/controller/include/controller/ble_ll_tmr.h b/nimble/controller/include/controller/ble_ll_tmr.h
index 2d79427b..bf625038 100644
--- a/nimble/controller/include/controller/ble_ll_tmr.h
+++ b/nimble/controller/include/controller/ble_ll_tmr.h
@@ -64,9 +64,17 @@ ble_ll_tmr_u2t(uint32_t usecs)
     return usecs / 32;
 #endif
 #if MYNEWT_VAL(OS_CPUTIME_FREQ) == 32768
+#if __ARM_FEATURE_IDIV
+    if (usecs < 131072) {
+        return (usecs * 32768) / 1000000;
+    } else {
+        return ((uint64_t)usecs * 32768) / 1000000;
+    }
+#else
     if (usecs <= 31249) {
         return (usecs * 137439) / 4194304;
     }
+#endif
 #endif
 
     return os_cputime_usecs_to_ticks(usecs);