pkg/nimble: have RIOT always initialize nimble timers

This commit is contained in:
Francisco Molina 2021-07-07 11:27:54 +02:00
parent fe22ba428d
commit ba3567ade6
3 changed files with 20 additions and 5 deletions

View File

@ -105,6 +105,21 @@ void nimble_riot_init(void)
int res;
(void)res;
#if !IS_USED(MODULE_MYNEWT_CORE) && IS_ACTIVE(NIMBLE_CFG_CONTROLLER)
/* in mynewt-nimble and uwb-core OS_CPUTIMER_TIMER_NUM == 5 is NRF_RTC0,
for nimble this must be used for the BLE stack and must go through
mynewt timer initialization for it to work properly. The RTC frequency
should be set to the highest possible value so, 32768Hz */
assert(MYNEWT_VAL_OS_CPUTIME_TIMER_NUM == 5);
assert(MYNEWT_VAL_OS_CPUTIME_FREQ == 32768);
int rc = hal_timer_init(MYNEWT_VAL_OS_CPUTIME_TIMER_NUM, NULL);
assert(rc == 0);
rc = hal_timer_config(MYNEWT_VAL_OS_CPUTIME_TIMER_NUM,
MYNEWT_VAL_OS_CPUTIME_FREQ);
assert(rc == 0);
(void)rc;
#endif
/* and finally initialize and run the host */
thread_create(_stack_host, sizeof(_stack_host),
NIMBLE_HOST_PRIO,

View File

@ -1,21 +1,21 @@
From 395209627ba495309098459173d40d490f680b8b Mon Sep 17 00:00:00 2001
From e9728411aeed6c614b1f27bccd8f2c70bef9f560 Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Mon, 19 Apr 2021 15:47:49 +0200
Subject: [PATCH] porting/nimble/src/nimble_port: riot initializes timers
Subject: [PATCH 1/2] porting/nimble/src/nimble_port: riot initializes timers
---
porting/nimble/src/nimble_port.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/porting/nimble/src/nimble_port.c b/porting/nimble/src/nimble_port.c
index 484e3799..139179e1 100644
index 484e3799..d4824d0b 100644
--- a/porting/nimble/src/nimble_port.c
+++ b/porting/nimble/src/nimble_port.c
@@ -45,8 +45,10 @@ nimble_port_init(void)
#if NIMBLE_CFG_CONTROLLER
ble_hci_ram_init();
+#ifndef MODULE_MYNEWT_CORE
+#ifndef RIOT_VERSION
hal_timer_init(5, NULL);
os_cputime_init(32768);
+#endif

View File

@ -1,4 +1,4 @@
From 40012b6fad9772cb38547abff42149b7ce1ca8d1 Mon Sep 17 00:00:00 2001
From 679179258e4e505d065dd64c9130ee1e3369f0c4 Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Mon, 5 Jul 2021 14:38:12 +0200
Subject: [PATCH 2/2] porting/npl/riot: add namespaced syscfg symlink