diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 156a786512f..b8269d130b9 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -510,6 +510,12 @@ config BT_CTLR_SMI_TX help Enable support for Bluetooth 5.0 SMI TX in the Controller. +config BT_CTLR_SMI_TX_SETTING + bool "Stable modulation index - Transmitter as setting" + depends on BT_CTLR_SMI_TX && BT_CTLR_SETTINGS + help + Enable support for Bluetooth 5.0 SMI TX through a system setting. + if BT_LL_SW_SPLIT || BT_LL_SW_LEGACY config BT_CTLR_ADVANCED_FEATURES diff --git a/subsys/bluetooth/controller/include/ll_feat.h b/subsys/bluetooth/controller/include/ll_feat.h index 16ab9c1f4a5..376aea0aecd 100644 --- a/subsys/bluetooth/controller/include/ll_feat.h +++ b/subsys/bluetooth/controller/include/ll_feat.h @@ -91,7 +91,12 @@ #endif /* !CONFIG_BT_CTLR_SMI_RX */ #if defined(CONFIG_BT_CTLR_SMI_TX) +#if defined(CONFIG_BT_CTLR_SMI_TX_SETTING) +#define LL_FEAT_BIT_SMI_TX (ll_settings_smi_tx() ? \ + BIT64(BT_LE_FEAT_BIT_SMI_TX) : 0) +#else /* !CONFIG_BT_CTLR_SMI_TX_SETTING */ #define LL_FEAT_BIT_SMI_TX BIT64(BT_LE_FEAT_BIT_SMI_TX) +#endif /* !CONFIG_BT_CTLR_SMI_TX_SETTING */ #else /* !CONFIG_BT_CTLR_SMI_TX */ #define LL_FEAT_BIT_SMI_TX 0 #endif /* !CONFIG_BT_CTLR_SMI_TX */ diff --git a/subsys/bluetooth/controller/include/ll_settings.h b/subsys/bluetooth/controller/include/ll_settings.h index d1416033806..db1f8383696 100644 --- a/subsys/bluetooth/controller/include/ll_settings.h +++ b/subsys/bluetooth/controller/include/ll_settings.h @@ -21,3 +21,5 @@ static inline u16_t ll_settings_subversion_number(void) } #endif /* CONFIG_BT_CTLR_VERSION_SETTINGS */ + +bool ll_settings_smi_tx(void); diff --git a/subsys/bluetooth/controller/ll_sw/ll.c b/subsys/bluetooth/controller/ll_sw/ll.c index 392c824fcdb..07d3e7d5e3c 100644 --- a/subsys/bluetooth/controller/ll_sw/ll.c +++ b/subsys/bluetooth/controller/ll_sw/ll.c @@ -39,6 +39,7 @@ #include "ll.h" #include "ll_feat.h" #include "ll_filter.h" +#include "ll_settings.h" /* Global singletons */ diff --git a/subsys/bluetooth/controller/ll_sw/ll_settings.c b/subsys/bluetooth/controller/ll_sw/ll_settings.c index 99500bf5ea8..5a10cd95224 100644 --- a/subsys/bluetooth/controller/ll_sw/ll_settings.c +++ b/subsys/bluetooth/controller/ll_sw/ll_settings.c @@ -32,6 +32,17 @@ u16_t ll_settings_subversion_number(void) #endif /* CONFIG_BT_CTLR_VERSION_SETTINGS */ +#if defined(CONFIG_BT_CTLR_SMI_TX_SETTING) + +static u8_t smi_tx; + +bool ll_settings_smi_tx(void) +{ + return smi_tx; +} + +#endif /* CONFIG_BT_CTLR_SMI_TX_SETTING */ + static int ctlr_set(const char *name, size_t len_rd, settings_read_cb read_cb, void *store) { @@ -63,6 +74,19 @@ static int ctlr_set(const char *name, size_t len_rd, } #endif /* CONFIG_BT_CTLR_VERSION_SETTINGS */ +#if defined(CONFIG_BT_CTLR_SMI_TX_SETTING) + if (!strncmp(name, "smi_tx", nlen)) { + len = read_cb(store, &smi_tx, sizeof(smi_tx)); + if (len < 0) { + BT_ERR("Failed to read SMI TX flag from storage" + " (err %d)", len); + } else { + BT_DBG("SMI TX flag set to %04x", smi_tx); + } + return 0; + } +#endif /* CONFIG_BT_CTLR_SMI_TX_SETTING */ + return 0; } diff --git a/subsys/bluetooth/controller/ll_sw/ull.c b/subsys/bluetooth/controller/ll_sw/ull.c index 7feffc7845c..1d800fa6df3 100644 --- a/subsys/bluetooth/controller/ll_sw/ull.c +++ b/subsys/bluetooth/controller/ll_sw/ull.c @@ -32,6 +32,7 @@ #include "pdu.h" #include "ll.h" #include "ll_feat.h" +#include "ll_settings.h" #include "lll.h" #include "lll_adv.h" #include "lll_scan.h" diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv.c b/subsys/bluetooth/controller/ll_sw/ull_adv.c index c3adb5cf6d4..6f78a7ab8d0 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv.c @@ -24,6 +24,7 @@ #include "pdu.h" #include "ll.h" #include "ll_feat.h" +#include "ll_settings.h" #include "lll.h" #include "lll_vendor.h" #include "lll_clock.h" diff --git a/subsys/bluetooth/controller/ll_sw/ull_master.c b/subsys/bluetooth/controller/ll_sw/ull_master.c index 0bc1d03f6d9..17234040c89 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_master.c +++ b/subsys/bluetooth/controller/ll_sw/ull_master.c @@ -21,6 +21,7 @@ #include "pdu.h" #include "ll.h" #include "ll_feat.h" +#include "ll_settings.h" #include "lll.h" #include "lll_vendor.h"