drivers/nrf51: generalize to other OSes than mynewt

This commit is contained in:
Alexandre Abadie
2019-04-29 11:48:31 +02:00
committed by Andrzej Kaczmarek
parent 8b45120e11
commit 976bb8f84b
2 changed files with 17 additions and 1 deletions
+10
View File
@@ -27,7 +27,13 @@
#include "nimble/nimble_opt.h"
#include "nrfx.h"
#include "controller/ble_hw.h"
#if MYNEWT
#include "mcu/cmsis_nvic.h"
#else
#include "core_cm0.h"
#include <nimble/nimble_npl_os.h>
#endif
#include "os/os_trace_api.h"
/* Total number of resolving list elements */
#define BLE_HW_RESOLV_LIST_SIZE (16)
@@ -314,7 +320,11 @@ ble_hw_rng_init(ble_rng_isr_cb_t cb, int bias)
/* If we were passed a function pointer we need to enable the interrupt */
if (cb != NULL) {
NVIC_SetPriority(RNG_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
#if MYNEWT
NVIC_SetVector(RNG_IRQn, (uint32_t)ble_rng_isr);
#else
ble_npl_hw_set_isr(RNG_IRQn, ble_rng_isr);
#endif
NVIC_EnableIRQ(RNG_IRQn);
g_ble_rng_isr_cb = cb;
}
+7 -1
View File
@@ -23,7 +23,6 @@
#include "syscfg/syscfg.h"
#include "os/os.h"
#include "ble/xcvr.h"
#include "mcu/cmsis_nvic.h"
#include "nimble/ble.h"
#include "nimble/nimble_opt.h"
#include "controller/ble_phy.h"
@@ -33,6 +32,9 @@
#if MYNEWT
#include "mcu/nrf51_clock.h"
#include "mcu/cmsis_nvic.h"
#else
#include "core_cm0.h"
#endif
/* XXX: 4) Make sure RF is higher priority interrupt than schedule */
@@ -907,7 +909,11 @@ ble_phy_init(void)
/* Set isr in vector table and enable interrupt */
NVIC_SetPriority(RADIO_IRQn, 0);
#if MYNEWT
NVIC_SetVector(RADIO_IRQn, (uint32_t)ble_phy_isr);
#else
ble_npl_hw_set_isr(RADIO_IRQn, ble_phy_isr);
#endif
NVIC_EnableIRQ(RADIO_IRQn);
/* Register phy statistics */