This is an automated email from the ASF dual-hosted git repository.
rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
The following commit(s) were added to refs/heads/master by this push:
new c8de4cc3 nimble/ll: Update ticks conversions for MCUs with idiv support
c8de4cc3 is described below
commit c8de4cc348d3f865017d151759d38156b4449715
Author: Andrzej Kaczmarek <[email protected]>
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);