From 638978ac8863e8102bb53e7232613834743bf3d8 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Thu, 17 Oct 2019 14:01:40 +0200 Subject: [PATCH] nimble/ll: Move PHY checks to drivers ble_phy.h should be hardware agnostic, let's move PHY checks to drivers instead. --- nimble/controller/include/controller/ble_phy.h | 8 -------- nimble/drivers/nrf51/src/ble_phy.c | 8 ++++++++ nimble/drivers/nrf52/src/ble_phy.c | 6 ++++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/nimble/controller/include/controller/ble_phy.h b/nimble/controller/include/controller/ble_phy.h index dd5250cef..ddfa99a4d 100644 --- a/nimble/controller/include/controller/ble_phy.h +++ b/nimble/controller/include/controller/ble_phy.h @@ -26,14 +26,6 @@ extern "C" { #endif -#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_2M_PHY) && !(MYNEWT_VAL(BSP_NRF52) || MYNEWT_VAL(BSP_NRF52840)) -#error LE 2M PHY can only be enabled on nRF52xxx -#endif - -#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY) && !MYNEWT_VAL(BSP_NRF52840) -#error LE Coded PHY can only be enabled on nRF52840 -#endif - /* Forward declarations */ struct os_mbuf; diff --git a/nimble/drivers/nrf51/src/ble_phy.c b/nimble/drivers/nrf51/src/ble_phy.c index 7a3b76146..7c2ad8201 100644 --- a/nimble/drivers/nrf51/src/ble_phy.c +++ b/nimble/drivers/nrf51/src/ble_phy.c @@ -37,6 +37,14 @@ #include "core_cm0.h" #endif +#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_2M_PHY) +#error LE 2M PHY cannot be enabled on nRF51 +#endif + +#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY) +#error LE Coded PHY cannot be enabled on nRF51 +#endif + /* XXX: 4) Make sure RF is higher priority interrupt than schedule */ /* diff --git a/nimble/drivers/nrf52/src/ble_phy.c b/nimble/drivers/nrf52/src/ble_phy.c index 4d41d1772..a5f2e3f30 100644 --- a/nimble/drivers/nrf52/src/ble_phy.c +++ b/nimble/drivers/nrf52/src/ble_phy.c @@ -38,6 +38,12 @@ #include "core_cm4.h" #endif +#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY) +#if !MYNEWT_VAL_CHOICE(MCU_TARGET, nRF52840) && !MYNEWT_VAL_CHOICE(MCU_TARGET, nRF52811) +#error LE Coded PHY can only be enabled on nRF52811 or nRF52840 +#endif +#endif + /* * NOTE: This code uses a couple of PPI channels so care should be taken when * using PPI somewhere else.