From 9f7e1ba96c0e0aeda5b2d28347d39aaf30d71011 Mon Sep 17 00:00:00 2001 From: pav1 Date: Fri, 25 Jan 2019 16:42:06 +0100 Subject: [PATCH 01/23] DRGN-11180: Deselect nRF5 Clock controller if BT_LL_NRFXLIB enabled The default nRF5 Clock controller can't be used when ble_controller is nabled (BT_LL_NRFXLIB). The choice is added to solve this. Signed-off-by: Pavel Vasilyev --- drivers/clock_control/CMakeLists.txt | 2 +- drivers/clock_control/Kconfig.nrf5 | 28 +++++++++++++++++++------ drivers/timer/Kconfig | 1 - soc/arm/nordic_nrf/nrf52/Kconfig.series | 6 +++--- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index e7ef3af5ecc..975398c0e5a 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -1,7 +1,7 @@ zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_BEETLE beetle_clock_control.c) zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_CCM clock_control_mcux_ccm.c) zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_SIM clock_control_mcux_sim.c) -zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF5 nrf5_power_clock.c) +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF5_DEFAULT nrf5_power_clock.c) zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_QUARK_SE quark_se_clock_control.c) if(CONFIG_CLOCK_CONTROL_STM32_CUBE) diff --git a/drivers/clock_control/Kconfig.nrf5 b/drivers/clock_control/Kconfig.nrf5 index 506f33d9cf6..a72c75e2de7 100644 --- a/drivers/clock_control/Kconfig.nrf5 +++ b/drivers/clock_control/Kconfig.nrf5 @@ -5,11 +5,26 @@ # SPDX-License-Identifier: Apache-2.0 menuconfig CLOCK_CONTROL_NRF5 - bool "NRF5 Clock controller support" - depends on SOC_COMPATIBLE_NRF + bool "NRF5 Clock controller support" + depends on SOC_COMPATIBLE_NRF + select CLOCK_CONTROL_NRF5_IMPL + help + Enable support for the Nordic Semiconductor nRF5x series SoC clock + driver. + +choice CLOCK_CONTROL_NRF5_IMPL + bool + prompt "nRF5 Clock controller implementation" + default CLOCK_CONTROL_NRF5_DEFAULT + +config CLOCK_CONTROL_NRF5_DEFAULT + bool "Default NRF5 Clock controller support" + depends on BT_LL_SW help - Enable support for the Nordic Semiconductor nRF5x series SoC clock - driver. + Enable default implementation of the Nordic Semiconductor nRF5x + series SoC clock driver. + +endchoice if CLOCK_CONTROL_NRF5 @@ -28,7 +43,7 @@ config CLOCK_CONTROL_NRF5_K32SRC_DRV_NAME string "NRF5 32KHz clock device name" default "clk_k32src" -choice +choice CLOCK_CONTROL_NR5_SOURCE prompt "32KHz clock source" default CLOCK_CONTROL_NRF5_K32SRC_XTAL @@ -49,7 +64,7 @@ config CLOCK_CONTROL_NRF5_K32SRC_BLOCKING initially start running and automatically switch to crystal when ready. -choice +choice CLOCK_CONTROL_NR5_ACCURACY prompt "32KHz clock accuracy" default CLOCK_CONTROL_NRF5_K32SRC_500PPM if CLOCK_CONTROL_NRF5_K32SRC_RC default CLOCK_CONTROL_NRF5_K32SRC_20PPM @@ -81,3 +96,4 @@ config CLOCK_CONTROL_NRF5_K32SRC_20PPM endchoice endif # CLOCK_CONTROL_NRF5 + diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index 437e3ff9604..e1c830ed0e5 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -152,7 +152,6 @@ config ALTERA_AVALON_TIMER config NRF_RTC_TIMER bool "nRF Real Time Counter (NRF_RTC1) Timer" default y - depends on CLOCK_CONTROL_NRF5 select TICKLESS_CAPABLE help This module implements a kernel device driver for the nRF Real Time diff --git a/soc/arm/nordic_nrf/nrf52/Kconfig.series b/soc/arm/nordic_nrf/nrf52/Kconfig.series index ad95fc72bba..71a3feb84ae 100644 --- a/soc/arm/nordic_nrf/nrf52/Kconfig.series +++ b/soc/arm/nordic_nrf/nrf52/Kconfig.series @@ -12,8 +12,8 @@ config SOC_SERIES_NRF52X select CPU_HAS_ARM_MPU select SOC_FAMILY_NRF select NRF_RTC_TIMER - select CLOCK_CONTROL - select CLOCK_CONTROL_NRF5 + select CLOCK_CONTROL + select CLOCK_CONTROL_NRF5 select SYS_POWER_LOW_POWER_STATE_SUPPORTED select SYS_POWER_STATE_CPU_LPS_SUPPORTED select SYS_POWER_STATE_CPU_LPS_1_SUPPORTED @@ -24,4 +24,4 @@ config SOC_SERIES_NRF52X select HAS_NRFX select HAS_SEGGER_RTT help - Enable support for NRF52 MCU series + Enable support for NRF52 MCU series From 22fff8d35ce663b5ef7e427236f8920643bbde76 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Fri, 1 Feb 2019 09:17:33 +0100 Subject: [PATCH 02/23] Make Entropy nRF5 driver optional Signed-off-by: Pavel Vasilyev --- drivers/entropy/Kconfig.nrf5 | 12 +++++-- samples/drivers/entropy/src/main.c | 52 ++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/drivers/entropy/Kconfig.nrf5 b/drivers/entropy/Kconfig.nrf5 index b02a49ffaee..fe674b0c7ef 100644 --- a/drivers/entropy/Kconfig.nrf5 +++ b/drivers/entropy/Kconfig.nrf5 @@ -5,6 +5,16 @@ # # SPDX-License-Identifier: Apache-2.0 +choice ENTROPY_NRF5_RNG_IMPL + bool "nRF5 RNG driver implementation" + depends on ENTROPY_GENERATOR + depends on SOC_COMPATIBLE_NRF + default ENTROPY_NRF5_RNG + +endchoice + +if ENTROPY_NRF5_RNG + menuconfig ENTROPY_NRF5_RNG bool "nRF5 RNG driver" depends on ENTROPY_GENERATOR @@ -15,8 +25,6 @@ menuconfig ENTROPY_NRF5_RNG generator, based on internal thermal noise, that provides a random 8-bit value to the host when read. -if ENTROPY_NRF5_RNG - config ENTROPY_NRF5_BIAS_CORRECTION bool "Enable bias correction (uniform distribution)" depends on ENTROPY_NRF5_RNG diff --git a/samples/drivers/entropy/src/main.c b/samples/drivers/entropy/src/main.c index 460f2abf844..3cc05bb8773 100644 --- a/samples/drivers/entropy/src/main.c +++ b/samples/drivers/entropy/src/main.c @@ -7,6 +7,46 @@ #include #include #include +#include +#include +#include + +static void my_isr(void *param) +{ + printf("Inside interrupt\n"); + + struct device *dev = param; + + for (size_t j = 0; j < 5; j++) { +#define BUFFER_LENGTH 10 + u8_t buffer[BUFFER_LENGTH] = {0}; + int r; + + /* The BUFFER_LENGTH-1 is used so the driver will not + * write the last byte of the buffer. If that last + * byte is not 0 on return it means the driver wrote + * outside the passed buffer, and that should never + * happen. + */ + r = entropy_get_entropy_isr(dev, buffer, BUFFER_LENGTH-1, ENTROPY_BUSYWAIT); +// if (!r) { +// printf("entropy_get_entropy_isr failed: %d\n", r); +// break; +// } + + if (buffer[BUFFER_LENGTH-1] != 0) { + printf("entropy_get_entropy_isr buffer overflow\n"); + } + + for (int i = 0; i < BUFFER_LENGTH-1; i++) { + printf(" 0x%02x", buffer[i]); + } + + printf("\n"); + +// k_sleep(1000); + } +} void main(void) { @@ -20,9 +60,18 @@ void main(void) return; } + irq_connect_dynamic(QDEC_IRQn, 4 /*CONFIG_ENTROPY_NRF5_PRI*/, my_isr, dev, 0); + irq_enable(QDEC_IRQn); + + printf("entropy device is %p, name is %s\n", dev, dev->config->name); + while(1) { + k_sleep(1000); + NVIC_SetPendingIRQ(QDEC_IRQn); + } + while (1) { #define BUFFER_LENGTH 10 u8_t buffer[BUFFER_LENGTH] = {0}; @@ -51,5 +100,8 @@ void main(void) printf("\n"); k_sleep(1000); + +// NVIC_SetPendingIRQ(QDEC_IRQn); } } + From 3614d2f0a97c9b889e25ca040b71d1ebf7ad9f6e Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Fri, 1 Feb 2019 12:31:16 +0100 Subject: [PATCH 03/23] Make choice of implementation of nRF5 Entropy driver Signed-off-by: Pavel Vasilyev --- drivers/entropy/CMakeLists.txt | 2 +- drivers/entropy/Kconfig.nrf5 | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index 5e1a321a758..2218481f2fd 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -3,7 +3,7 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_ENTROPY_ESP32_RNG entropy_esp32.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_MCUX_RNGA entropy_mcux_rnga.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_MCUX_TRNG entropy_mcux_trng.c) -zephyr_library_sources_ifdef(CONFIG_ENTROPY_NRF5_RNG entropy_nrf5.c) +zephyr_library_sources_ifdef(CONFIG_ENTROPY_NRF5_RNG_DEFAULT entropy_nrf5.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_SAM_RNG entropy_sam.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_STM32_RNG entropy_stm32.c) zephyr_library_sources_ifdef(CONFIG_FAKE_ENTROPY_NATIVE_POSIX fake_entropy_native_posix.c) diff --git a/drivers/entropy/Kconfig.nrf5 b/drivers/entropy/Kconfig.nrf5 index fe674b0c7ef..ca5ee6523a0 100644 --- a/drivers/entropy/Kconfig.nrf5 +++ b/drivers/entropy/Kconfig.nrf5 @@ -5,26 +5,33 @@ # # SPDX-License-Identifier: Apache-2.0 -choice ENTROPY_NRF5_RNG_IMPL - bool "nRF5 RNG driver implementation" - depends on ENTROPY_GENERATOR - depends on SOC_COMPATIBLE_NRF - default ENTROPY_NRF5_RNG - -endchoice - -if ENTROPY_NRF5_RNG - menuconfig ENTROPY_NRF5_RNG bool "nRF5 RNG driver" depends on ENTROPY_GENERATOR depends on SOC_COMPATIBLE_NRF - select ENTROPY_HAS_DRIVER + select ENTROPY_NRF5_RNG_IMPL help This option enables the RNG peripheral, which is a random number generator, based on internal thermal noise, that provides a random 8-bit value to the host when read. +if ENTROPY_NRF5_RNG + +choice ENTROPY_NRF5_RNG_IMPL + bool "nRF5 RNG driver implementation" + default ENTROPY_NRF5_RNG_DEFAULT + help + Choose the driver implementation + +config ENTROPY_NRF5_RNG_DEFAULT + bool "Default nRF5 RNG driver implementation" + depends on BT_LL_SW + select ENTROPY_HAS_DRIVER + +endchoice + +if ENTROPY_NRF5_RNG_DEFAULT + config ENTROPY_NRF5_BIAS_CORRECTION bool "Enable bias correction (uniform distribution)" depends on ENTROPY_NRF5_RNG @@ -69,10 +76,10 @@ config ENTROPY_NRF5_ISR_THRESHOLD buffer goes below this number hardware entropy generation will be started. +endif #ENTROPY_NRF5_RNG_DEFAULT config ENTROPY_NRF5_PRI int "RNG interrupt priority" - depends on ENTROPY_NRF5_RNG range 0 2 if SOC_SERIES_NRF51X range 0 5 if SOC_COMPATIBLE_NRF52X default 2 if SOC_SERIES_NRF51X From 812188386c957e87ad5c32b07a77cf58877d24eb Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Fri, 1 Feb 2019 13:21:53 +0100 Subject: [PATCH 04/23] Put nRF5 Clock driver options under sublist of options Signed-off-by: Pavel Vasilyev --- drivers/clock_control/Kconfig.nrf5 | 31 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/clock_control/Kconfig.nrf5 b/drivers/clock_control/Kconfig.nrf5 index a72c75e2de7..28a307d2179 100644 --- a/drivers/clock_control/Kconfig.nrf5 +++ b/drivers/clock_control/Kconfig.nrf5 @@ -5,29 +5,27 @@ # SPDX-License-Identifier: Apache-2.0 menuconfig CLOCK_CONTROL_NRF5 - bool "NRF5 Clock controller support" - depends on SOC_COMPATIBLE_NRF - select CLOCK_CONTROL_NRF5_IMPL - help - Enable support for the Nordic Semiconductor nRF5x series SoC clock - driver. + bool "NRF5 Clock controller support" + depends on SOC_COMPATIBLE_NRF + select CLOCK_CONTROL_NRF5_IMPL + help + Enable support for the Nordic Semiconductor nRF5x series SoC clock + driver. + +if CLOCK_CONTROL_NRF5 choice CLOCK_CONTROL_NRF5_IMPL - bool - prompt "nRF5 Clock controller implementation" - default CLOCK_CONTROL_NRF5_DEFAULT + bool "nRF5 Clock controller implementation" + default CLOCK_CONTROL_NRF5_DEFAULT + help + Choose the driver implementation config CLOCK_CONTROL_NRF5_DEFAULT - bool "Default NRF5 Clock controller support" - depends on BT_LL_SW - help - Enable default implementation of the Nordic Semiconductor nRF5x - series SoC clock driver. + bool "Default NRF5 Clock controller support" + depends on BT_LL_SW endchoice -if CLOCK_CONTROL_NRF5 - config CLOCK_CONTROL_NRF5_IRQ_PRIORITY int "Power Clock Interrupt Priority" range 0 7 @@ -96,4 +94,3 @@ config CLOCK_CONTROL_NRF5_K32SRC_20PPM endchoice endif # CLOCK_CONTROL_NRF5 - From ca58cbad076d0f8717d65c9ce96c23fac5818759 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 4 Feb 2019 15:32:59 +0100 Subject: [PATCH 05/23] Get back entropy sample Signed-off-by: Pavel Vasilyev --- samples/drivers/entropy/src/main.c | 54 +----------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/samples/drivers/entropy/src/main.c b/samples/drivers/entropy/src/main.c index 3cc05bb8773..5812a321bf3 100644 --- a/samples/drivers/entropy/src/main.c +++ b/samples/drivers/entropy/src/main.c @@ -7,46 +7,6 @@ #include #include #include -#include -#include -#include - -static void my_isr(void *param) -{ - printf("Inside interrupt\n"); - - struct device *dev = param; - - for (size_t j = 0; j < 5; j++) { -#define BUFFER_LENGTH 10 - u8_t buffer[BUFFER_LENGTH] = {0}; - int r; - - /* The BUFFER_LENGTH-1 is used so the driver will not - * write the last byte of the buffer. If that last - * byte is not 0 on return it means the driver wrote - * outside the passed buffer, and that should never - * happen. - */ - r = entropy_get_entropy_isr(dev, buffer, BUFFER_LENGTH-1, ENTROPY_BUSYWAIT); -// if (!r) { -// printf("entropy_get_entropy_isr failed: %d\n", r); -// break; -// } - - if (buffer[BUFFER_LENGTH-1] != 0) { - printf("entropy_get_entropy_isr buffer overflow\n"); - } - - for (int i = 0; i < BUFFER_LENGTH-1; i++) { - printf(" 0x%02x", buffer[i]); - } - - printf("\n"); - -// k_sleep(1000); - } -} void main(void) { @@ -60,17 +20,8 @@ void main(void) return; } - irq_connect_dynamic(QDEC_IRQn, 4 /*CONFIG_ENTROPY_NRF5_PRI*/, my_isr, dev, 0); - irq_enable(QDEC_IRQn); - - printf("entropy device is %p, name is %s\n", - dev, dev->config->name); - - while(1) { - k_sleep(1000); - NVIC_SetPendingIRQ(QDEC_IRQn); - } + dev, dev->config->name); while (1) { #define BUFFER_LENGTH 10 @@ -100,8 +51,5 @@ void main(void) printf("\n"); k_sleep(1000); - -// NVIC_SetPendingIRQ(QDEC_IRQn); } } - From fc5393f531ee8d7ec9f0712058df065fce5ead54 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 4 Feb 2019 16:01:49 +0100 Subject: [PATCH 06/23] Apply uncrustify Signed-off-by: Pavel Vasilyev --- samples/drivers/entropy/src/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/drivers/entropy/src/main.c b/samples/drivers/entropy/src/main.c index 5812a321bf3..a77d8a05132 100644 --- a/samples/drivers/entropy/src/main.c +++ b/samples/drivers/entropy/src/main.c @@ -21,11 +21,11 @@ void main(void) } printf("entropy device is %p, name is %s\n", - dev, dev->config->name); + dev, dev->config->name); while (1) { #define BUFFER_LENGTH 10 - u8_t buffer[BUFFER_LENGTH] = {0}; + u8_t buffer[BUFFER_LENGTH] = { 0 }; int r; /* The BUFFER_LENGTH-1 is used so the driver will not @@ -34,17 +34,17 @@ void main(void) * outside the passed buffer, and that should never * happen. */ - r = entropy_get_entropy(dev, buffer, BUFFER_LENGTH-1); + r = entropy_get_entropy(dev, buffer, BUFFER_LENGTH - 1); if (r) { printf("entropy_get_entropy failed: %d\n", r); break; } - if (buffer[BUFFER_LENGTH-1] != 0) { + if (buffer[BUFFER_LENGTH - 1] != 0) { printf("entropy_get_entropy buffer overflow\n"); } - for (int i = 0; i < BUFFER_LENGTH-1; i++) { + for (int i = 0; i < BUFFER_LENGTH - 1; i++) { printf(" 0x%02x", buffer[i]); } From 0e903945b616c6992e7b56446fe65bad2e3ee8ec Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 4 Feb 2019 19:50:34 +0100 Subject: [PATCH 07/23] Avoid the error when library has no sources This is an ugly, but easy way to avoid the error when entropy driver requires sources, but they are located in the next repo. Signed-off-by: Pavel Vasilyev --- drivers/entropy/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index 2218481f2fd..8c8d93bea41 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -1,3 +1,11 @@ +if (CONFIG_ENTROPY_ESP32_RNG OR + CONFIG_ENTROPY_MCUX_RNGA OR + CONFIG_ENTROPY_MCUX_TRNG OR + CONFIG_ENTROPY_NRF5_RNG_DEFAULT OR + CONFIG_ENTROPY_SAM_RNG OR + CONFIG_ENTROPY_STM32_RNG OR + CONFIG_FAKE_ENTROPY_NATIVE_POSIX OR + CONFIG_USERSPACE) zephyr_library() zephyr_library_sources_ifdef(CONFIG_ENTROPY_ESP32_RNG entropy_esp32.c) @@ -8,3 +16,5 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_SAM_RNG entropy_sam.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_STM32_RNG entropy_stm32.c) zephyr_library_sources_ifdef(CONFIG_FAKE_ENTROPY_NATIVE_POSIX fake_entropy_native_posix.c) zephyr_library_sources_ifdef(CONFIG_USERSPACE entropy_handlers.c) + +endif() From 7b545dc567468d928bb141bce31a750a34616c9d Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 6 Feb 2019 13:39:37 +0100 Subject: [PATCH 08/23] Restore entropy main.c example Signed-off-by: Pavel Vasilyev --- samples/drivers/entropy/src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/drivers/entropy/src/main.c b/samples/drivers/entropy/src/main.c index a77d8a05132..460f2abf844 100644 --- a/samples/drivers/entropy/src/main.c +++ b/samples/drivers/entropy/src/main.c @@ -25,7 +25,7 @@ void main(void) while (1) { #define BUFFER_LENGTH 10 - u8_t buffer[BUFFER_LENGTH] = { 0 }; + u8_t buffer[BUFFER_LENGTH] = {0}; int r; /* The BUFFER_LENGTH-1 is used so the driver will not @@ -34,17 +34,17 @@ void main(void) * outside the passed buffer, and that should never * happen. */ - r = entropy_get_entropy(dev, buffer, BUFFER_LENGTH - 1); + r = entropy_get_entropy(dev, buffer, BUFFER_LENGTH-1); if (r) { printf("entropy_get_entropy failed: %d\n", r); break; } - if (buffer[BUFFER_LENGTH - 1] != 0) { + if (buffer[BUFFER_LENGTH-1] != 0) { printf("entropy_get_entropy buffer overflow\n"); } - for (int i = 0; i < BUFFER_LENGTH - 1; i++) { + for (int i = 0; i < BUFFER_LENGTH-1; i++) { printf(" 0x%02x", buffer[i]); } From ee36d7003bd2a912475f6266d9170f78eacc8a96 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 6 Feb 2019 15:30:15 +0100 Subject: [PATCH 09/23] Use zephyr_sources_ifdef instead of zephyr_library_sources_ifdef Better way to avoid the problem when library has no sources Signed-off-by: Pavel Vasilyev --- drivers/entropy/CMakeLists.txt | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index 8c8d93bea41..e496623f647 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -1,20 +1,8 @@ -if (CONFIG_ENTROPY_ESP32_RNG OR - CONFIG_ENTROPY_MCUX_RNGA OR - CONFIG_ENTROPY_MCUX_TRNG OR - CONFIG_ENTROPY_NRF5_RNG_DEFAULT OR - CONFIG_ENTROPY_SAM_RNG OR - CONFIG_ENTROPY_STM32_RNG OR - CONFIG_FAKE_ENTROPY_NATIVE_POSIX OR - CONFIG_USERSPACE) -zephyr_library() - -zephyr_library_sources_ifdef(CONFIG_ENTROPY_ESP32_RNG entropy_esp32.c) -zephyr_library_sources_ifdef(CONFIG_ENTROPY_MCUX_RNGA entropy_mcux_rnga.c) -zephyr_library_sources_ifdef(CONFIG_ENTROPY_MCUX_TRNG entropy_mcux_trng.c) -zephyr_library_sources_ifdef(CONFIG_ENTROPY_NRF5_RNG_DEFAULT entropy_nrf5.c) -zephyr_library_sources_ifdef(CONFIG_ENTROPY_SAM_RNG entropy_sam.c) -zephyr_library_sources_ifdef(CONFIG_ENTROPY_STM32_RNG entropy_stm32.c) -zephyr_library_sources_ifdef(CONFIG_FAKE_ENTROPY_NATIVE_POSIX fake_entropy_native_posix.c) -zephyr_library_sources_ifdef(CONFIG_USERSPACE entropy_handlers.c) - -endif() +zephyr_sources_ifdef(CONFIG_ENTROPY_ESP32_RNG entropy_esp32.c) +zephyr_sources_ifdef(CONFIG_ENTROPY_MCUX_RNGA entropy_mcux_rnga.c) +zephyr_sources_ifdef(CONFIG_ENTROPY_MCUX_TRNG entropy_mcux_trng.c) +zephyr_sources_ifdef(CONFIG_ENTROPY_NRF5_RNG_DEFAULT entropy_nrf5.c) +zephyr_sources_ifdef(CONFIG_ENTROPY_SAM_RNG entropy_sam.c) +zephyr_sources_ifdef(CONFIG_ENTROPY_STM32_RNG entropy_stm32.c) +zephyr_sources_ifdef(CONFIG_FAKE_ENTROPY_NATIVE_POSIX fake_entropy_native_posix.c) +zephyr_sources_ifdef(CONFIG_USERSPACE entropy_handlers.c) From 7d4f7775360a2cc8f0da16c546aab610412d3d0a Mon Sep 17 00:00:00 2001 From: Thomas Stenersen Date: Mon, 11 Feb 2019 14:38:12 +0100 Subject: [PATCH 10/23] net: remove l2 kconfig circular dependencies - Change NET_L2_BT to use `depends on` instead of `select`. - Depend on `FLASH_HAS_*` defines instead of `FLASH_*` Signed-off-by: Thomas Stenersen --- subsys/net/l2/Kconfig | 10 +++++----- subsys/net/l2/openthread/Kconfig | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/subsys/net/l2/Kconfig b/subsys/net/l2/Kconfig index a53da98e745..1187159be87 100644 --- a/subsys/net/l2/Kconfig +++ b/subsys/net/l2/Kconfig @@ -16,11 +16,11 @@ config NET_L2_DUMMY config NET_L2_BT bool "Enable Bluetooth support" depends on NET_IPV6 - select BT - select BT_PERIPHERAL - select BT_CENTRAL - select BT_SMP - select BT_L2CAP_DYNAMIC_CHANNEL + depends on BT + depends on BT_PERIPHERAL + depends on BT_CENTRAL + depends on BT_SMP + depends on BT_L2CAP_DYNAMIC_CHANNEL select NET_6LO help Enable Bluetooth driver that send and receives IPv6 packets, diff --git a/subsys/net/l2/openthread/Kconfig b/subsys/net/l2/openthread/Kconfig index 698c9e78c0d..e19abdd3843 100644 --- a/subsys/net/l2/openthread/Kconfig +++ b/subsys/net/l2/openthread/Kconfig @@ -11,8 +11,8 @@ # menuconfig NET_L2_OPENTHREAD bool "OpenThread L2" - depends on FLASH - depends on FLASH_PAGE_LAYOUT + depends on FLASH_HAS_DRIVER_ENABLED + depends on FLASH_HAS_PAGE_LAYOUT depends on CPLUSPLUS depends on REBOOT select OPENTHREAD_PLAT From d05c9e53d2a07af73d1c68be88a9f9b12d38678c Mon Sep 17 00:00:00 2001 From: Thomas Stenersen Date: Mon, 11 Feb 2019 14:43:21 +0100 Subject: [PATCH 11/23] drivers: add `FLASH_NRF_DRIVER` kconfig choice The nrfxlib BLE controller needs its own flash driver, adding the `FLASH_NRF_DRIVER` choice allows configuring the driver properly from the nRF Connect repo. Signed-off-by: Thomas Stenersen --- drivers/flash/Kconfig | 9 ++++++++- soc/arm/nordic_nrf/Kconfig.defconfig | 3 --- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index b610c581d70..a83fc32b233 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -44,9 +44,14 @@ config FLASH_PAGE_LAYOUT help Enables API for retrieving the layout of flash memory pages. +choice FLASH_NRF_DRIVER + prompt "Nordic Semiconductor flash driver" + bool + default SOC_FLASH_NRF if !BT_LL_NRFXLIB + config SOC_FLASH_NRF bool "Nordic Semiconductor nRF flash driver" - depends on SOC_FAMILY_NRF + depends on SOC_FAMILY_NRF && !BT_LL_NRFXLIB select FLASH_HAS_PAGE_LAYOUT select FLASH_HAS_DRIVER_ENABLED help @@ -59,6 +64,8 @@ config SOC_FLASH_NRF_RADIO_SYNC help Enable synchronization between flash memory driver and radio. +endchoice # FLASH_NRF_DRIVER + config SOC_FLASH_MCUX bool "MCUX flash shim driver" depends on HAS_MCUX diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index b7650cb2e50..2ec5242ab0b 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -28,9 +28,6 @@ endif # GPIO if FLASH -config SOC_FLASH_NRF - default y - endif # FLASH if ENTROPY_GENERATOR From f4a8689fbb567cc9f0407f0e472c5a370897297a Mon Sep 17 00:00:00 2001 From: Thomas Stenersen Date: Thu, 14 Feb 2019 13:09:41 +0100 Subject: [PATCH 12/23] drivers: Allow clock control to be configured out-of-source Signed-off-by: Thomas Stenersen --- drivers/clock_control/CMakeLists.txt | 2 +- drivers/clock_control/Kconfig | 11 ++++++++++- drivers/clock_control/Kconfig.nrf5 | 13 ------------- soc/arm/nordic_nrf/nrf52/Kconfig.series | 1 - 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index 975398c0e5a..e7ef3af5ecc 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -1,7 +1,7 @@ zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_BEETLE beetle_clock_control.c) zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_CCM clock_control_mcux_ccm.c) zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_SIM clock_control_mcux_sim.c) -zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF5_DEFAULT nrf5_power_clock.c) +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF5 nrf5_power_clock.c) zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_QUARK_SE quark_se_clock_control.c) if(CONFIG_CLOCK_CONTROL_STM32_CUBE) diff --git a/drivers/clock_control/Kconfig b/drivers/clock_control/Kconfig index e565c7c2acf..eda00510dd4 100644 --- a/drivers/clock_control/Kconfig +++ b/drivers/clock_control/Kconfig @@ -9,6 +9,14 @@ # # Clock controller drivers # + +config CLOCK_CONTROL_HAS_SUBSYS_DRIVER + bool + default false + help + This option can be enabled by an external library if it + needs to take control over the clock controller. + menuconfig CLOCK_CONTROL bool "Hardware clock controller support" help @@ -23,6 +31,7 @@ module = CLOCK_CONTROL module-str = clock control source "subsys/logging/Kconfig.template.log_config" +if !CLOCK_CONTROL_HAS_SUBSYS_DRIVER source "drivers/clock_control/Kconfig.nrf5" source "drivers/clock_control/Kconfig.quark_se" @@ -34,5 +43,5 @@ source "drivers/clock_control/Kconfig.beetle" source "drivers/clock_control/Kconfig.mcux_ccm" source "drivers/clock_control/Kconfig.mcux_sim" - +endif # !CLOCK_CONTROL_HAS_SUBSYS_DRIVER endif # CLOCK_CONTROL diff --git a/drivers/clock_control/Kconfig.nrf5 b/drivers/clock_control/Kconfig.nrf5 index 28a307d2179..f85e508d62e 100644 --- a/drivers/clock_control/Kconfig.nrf5 +++ b/drivers/clock_control/Kconfig.nrf5 @@ -7,25 +7,12 @@ menuconfig CLOCK_CONTROL_NRF5 bool "NRF5 Clock controller support" depends on SOC_COMPATIBLE_NRF - select CLOCK_CONTROL_NRF5_IMPL help Enable support for the Nordic Semiconductor nRF5x series SoC clock driver. if CLOCK_CONTROL_NRF5 -choice CLOCK_CONTROL_NRF5_IMPL - bool "nRF5 Clock controller implementation" - default CLOCK_CONTROL_NRF5_DEFAULT - help - Choose the driver implementation - -config CLOCK_CONTROL_NRF5_DEFAULT - bool "Default NRF5 Clock controller support" - depends on BT_LL_SW - -endchoice - config CLOCK_CONTROL_NRF5_IRQ_PRIORITY int "Power Clock Interrupt Priority" range 0 7 diff --git a/soc/arm/nordic_nrf/nrf52/Kconfig.series b/soc/arm/nordic_nrf/nrf52/Kconfig.series index 71a3feb84ae..b6aebb2097c 100644 --- a/soc/arm/nordic_nrf/nrf52/Kconfig.series +++ b/soc/arm/nordic_nrf/nrf52/Kconfig.series @@ -13,7 +13,6 @@ config SOC_SERIES_NRF52X select SOC_FAMILY_NRF select NRF_RTC_TIMER select CLOCK_CONTROL - select CLOCK_CONTROL_NRF5 select SYS_POWER_LOW_POWER_STATE_SUPPORTED select SYS_POWER_STATE_CPU_LPS_SUPPORTED select SYS_POWER_STATE_CPU_LPS_1_SUPPORTED From 2ee3c90bb913e0fcd9ba30976c6bfd3b32688482 Mon Sep 17 00:00:00 2001 From: Thomas Stenersen Date: Thu, 14 Feb 2019 13:11:07 +0100 Subject: [PATCH 13/23] drivers: Allow entropy driver to be configured out-of-source Signed-off-by: Thomas Stenersen --- drivers/entropy/CMakeLists.txt | 2 +- drivers/entropy/Kconfig | 11 ++++++++++- drivers/entropy/Kconfig.nrf5 | 23 +---------------------- soc/arm/nordic_nrf/Kconfig.defconfig | 7 ------- 4 files changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index e496623f647..381a68dc3fd 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -1,7 +1,7 @@ zephyr_sources_ifdef(CONFIG_ENTROPY_ESP32_RNG entropy_esp32.c) zephyr_sources_ifdef(CONFIG_ENTROPY_MCUX_RNGA entropy_mcux_rnga.c) zephyr_sources_ifdef(CONFIG_ENTROPY_MCUX_TRNG entropy_mcux_trng.c) -zephyr_sources_ifdef(CONFIG_ENTROPY_NRF5_RNG_DEFAULT entropy_nrf5.c) +zephyr_sources_ifdef(CONFIG_ENTROPY_NRF5_RNG entropy_nrf5.c) zephyr_sources_ifdef(CONFIG_ENTROPY_SAM_RNG entropy_sam.c) zephyr_sources_ifdef(CONFIG_ENTROPY_STM32_RNG entropy_stm32.c) zephyr_sources_ifdef(CONFIG_FAKE_ENTROPY_NATIVE_POSIX fake_entropy_native_posix.c) diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index ca0803f7249..27f70972229 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -6,19 +6,28 @@ # SPDX-License-Identifier: Apache-2.0 # +config ENTROPY_HAS_SUBSYS_DRIVER + bool + default false + help + This option can be enabled by an external library if it + needs to take control over the entropy driver. + menuconfig ENTROPY_GENERATOR bool "Entropy Drivers" help Include entropy drivers in system config. -if ENTROPY_GENERATOR +if ENTROPY_GENERATOR +if !ENTROPY_HAS_SUBSYS_DRIVER source "drivers/entropy/Kconfig.mcux" source "drivers/entropy/Kconfig.stm32" source "drivers/entropy/Kconfig.esp32" source "drivers/entropy/Kconfig.nrf5" source "drivers/entropy/Kconfig.sam" source "drivers/entropy/Kconfig.native_posix" +endif config ENTROPY_HAS_DRIVER bool diff --git a/drivers/entropy/Kconfig.nrf5 b/drivers/entropy/Kconfig.nrf5 index ca5ee6523a0..80125646d5c 100644 --- a/drivers/entropy/Kconfig.nrf5 +++ b/drivers/entropy/Kconfig.nrf5 @@ -9,29 +9,12 @@ menuconfig ENTROPY_NRF5_RNG bool "nRF5 RNG driver" depends on ENTROPY_GENERATOR depends on SOC_COMPATIBLE_NRF - select ENTROPY_NRF5_RNG_IMPL + select ENTROPY_HAS_DRIVER help This option enables the RNG peripheral, which is a random number generator, based on internal thermal noise, that provides a random 8-bit value to the host when read. -if ENTROPY_NRF5_RNG - -choice ENTROPY_NRF5_RNG_IMPL - bool "nRF5 RNG driver implementation" - default ENTROPY_NRF5_RNG_DEFAULT - help - Choose the driver implementation - -config ENTROPY_NRF5_RNG_DEFAULT - bool "Default nRF5 RNG driver implementation" - depends on BT_LL_SW - select ENTROPY_HAS_DRIVER - -endchoice - -if ENTROPY_NRF5_RNG_DEFAULT - config ENTROPY_NRF5_BIAS_CORRECTION bool "Enable bias correction (uniform distribution)" depends on ENTROPY_NRF5_RNG @@ -76,8 +59,6 @@ config ENTROPY_NRF5_ISR_THRESHOLD buffer goes below this number hardware entropy generation will be started. -endif #ENTROPY_NRF5_RNG_DEFAULT - config ENTROPY_NRF5_PRI int "RNG interrupt priority" range 0 2 if SOC_SERIES_NRF51X @@ -86,5 +67,3 @@ config ENTROPY_NRF5_PRI default 5 if SOC_COMPATIBLE_NRF52X help nRF5X RNG IRQ priority. - -endif #ENTROPY_NRF5_RNG diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index 2ec5242ab0b..29f81398c44 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -30,11 +30,4 @@ if FLASH endif # FLASH -if ENTROPY_GENERATOR - -config ENTROPY_NRF5_RNG - default y - -endif # ENTROPY_GENERATOR - endif # SOC_FAMILY_NRF From 7ce49fb6c131011a205637c792c1a3ed20a4fbc3 Mon Sep 17 00:00:00 2001 From: Thomas Stenersen Date: Thu, 14 Feb 2019 13:12:17 +0100 Subject: [PATCH 14/23] drivers: Allow flash driver to be configured out-of-source Signed-off-by: Thomas Stenersen --- drivers/flash/Kconfig | 17 ++++++++++------- soc/arm/nordic_nrf/Kconfig.defconfig | 4 ---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index a83fc32b233..dc2635bda55 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -20,6 +20,13 @@ config FLASH_HAS_PAGE_LAYOUT This option is enabled when the SoC flash driver supports retrieving the layout of flash memory pages. +config FLASH_HAS_SUBSYS_DRIVER + bool + default false + help + This option can be enabled by an external library if it + needs to take control over the flash memory peripheral. + menuconfig FLASH bool "Flash hardware support" help @@ -44,14 +51,11 @@ config FLASH_PAGE_LAYOUT help Enables API for retrieving the layout of flash memory pages. -choice FLASH_NRF_DRIVER - prompt "Nordic Semiconductor flash driver" - bool - default SOC_FLASH_NRF if !BT_LL_NRFXLIB +if !FLASH_HAS_SUBSYS_DRIVER config SOC_FLASH_NRF bool "Nordic Semiconductor nRF flash driver" - depends on SOC_FAMILY_NRF && !BT_LL_NRFXLIB + depends on SOC_FAMILY_NRF select FLASH_HAS_PAGE_LAYOUT select FLASH_HAS_DRIVER_ENABLED help @@ -64,8 +68,6 @@ config SOC_FLASH_NRF_RADIO_SYNC help Enable synchronization between flash memory driver and radio. -endchoice # FLASH_NRF_DRIVER - config SOC_FLASH_MCUX bool "MCUX flash shim driver" depends on HAS_MCUX @@ -106,4 +108,5 @@ source "drivers/flash/Kconfig.sam" source "drivers/flash/Kconfig.w25qxxdv" +endif # FLASH_HAS_SUBSYS_DRIVER endif diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index 29f81398c44..08220d6a108 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -26,8 +26,4 @@ config GPIO_NRFX endif # GPIO -if FLASH - -endif # FLASH - endif # SOC_FAMILY_NRF From 1f15e81509ffa0870c143ccecdb2a189f4c2ed31 Mon Sep 17 00:00:00 2001 From: Thomas Stenersen Date: Thu, 14 Feb 2019 14:46:29 +0100 Subject: [PATCH 15/23] drivers: make nrf5 clock control driver default=y Signed-off-by: Thomas Stenersen --- drivers/clock_control/Kconfig.nrf5 | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clock_control/Kconfig.nrf5 b/drivers/clock_control/Kconfig.nrf5 index f85e508d62e..92a3d514907 100644 --- a/drivers/clock_control/Kconfig.nrf5 +++ b/drivers/clock_control/Kconfig.nrf5 @@ -7,6 +7,7 @@ menuconfig CLOCK_CONTROL_NRF5 bool "NRF5 Clock controller support" depends on SOC_COMPATIBLE_NRF + default y help Enable support for the Nordic Semiconductor nRF5x series SoC clock driver. From b27db02c27f51125293fb2d0b8c44b0706ff4a64 Mon Sep 17 00:00:00 2001 From: Thomas Stenersen Date: Fri, 15 Feb 2019 08:34:05 +0100 Subject: [PATCH 16/23] drivers: flash: make nrf5 driver default on Signed-off-by: Thomas Stenersen --- drivers/flash/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index dc2635bda55..f6e80268d13 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -22,7 +22,7 @@ config FLASH_HAS_PAGE_LAYOUT config FLASH_HAS_SUBSYS_DRIVER bool - default false + default n help This option can be enabled by an external library if it needs to take control over the flash memory peripheral. @@ -56,6 +56,7 @@ if !FLASH_HAS_SUBSYS_DRIVER config SOC_FLASH_NRF bool "Nordic Semiconductor nRF flash driver" depends on SOC_FAMILY_NRF + default y select FLASH_HAS_PAGE_LAYOUT select FLASH_HAS_DRIVER_ENABLED help From 0a5f36ca403c6eafcfc27e6374af6a3eead9c2ed Mon Sep 17 00:00:00 2001 From: Thomas Stenersen Date: Fri, 15 Feb 2019 08:40:53 +0100 Subject: [PATCH 17/23] fs: don't force select FLASH_PAGE_LAYOUT from fs Signed-off-by: Thomas Stenersen --- subsys/fs/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/fs/Kconfig b/subsys/fs/Kconfig index de3691455fa..2eb51a6cbe1 100644 --- a/subsys/fs/Kconfig +++ b/subsys/fs/Kconfig @@ -37,7 +37,7 @@ config FAT_FILESYSTEM_ELM config FILE_SYSTEM_NFFS bool "NFFS file system support" - select FLASH_PAGE_LAYOUT + depends on FLASH_PAGE_LAYOUT select FS_FLASH_STORAGE_PARTITION help Enables NFFS file system support. From 31b3cbd741d75b08d4e9320aefb69760da77e505 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Fri, 15 Feb 2019 17:48:28 +0100 Subject: [PATCH 18/23] Move BT_HCI_VS out of common/Kconfig to configure it from controller Select BT_HCI_VS_CUSTOM to switch off Zephyr's Vendor Specific HCI commands if they are not supported by custom Link Layer Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/Kconfig | 33 +++++++++++++++++++++++++++++++++ subsys/bluetooth/common/Kconfig | 27 --------------------------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 8c93f3fc18a..9290c5e0cf2 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -173,6 +173,39 @@ source "subsys/bluetooth/common/Kconfig" source "subsys/bluetooth/host/Kconfig" source "subsys/bluetooth/controller/Kconfig" source "subsys/bluetooth/shell/Kconfig" + +config BT_HCI_VS_CUSTOM + bool + default n + +config BT_HCI_VS + bool "Zephyr HCI Vendor-Specific Commands" + depends on !BT_HCI_VS_CUSTOM + default y + help + Enable support for the Zephyr HCI Vendor-Specific Commands in the + Host and/or Controller. This enables Set Version Information, + Supported Commands, Supported Features vendor commands. + +config BT_HCI_VS_EXT + bool "Zephyr HCI Vendor-Specific Extensions" + depends on BT_HCI_VS + default y + help + Enable support for the Zephyr HCI Vendor-Specific Extensions in the + Host and/or Controller. This enables Write BD_ADDR, Read Build Info, + Read Static Addresses and Read Key Hierarchy Roots vendor commands. + +config BT_HCI_VS_EXT_DETECT + bool "Use heuristics to guess HCI vendor extensions support in advance" + depends on BT_HCI_VS_EXT && !BT_CTLR + default y if BOARD_QEMU_X86 || BOARD_QEMU_CORTEX_M3 || BOARD_NATIVE_POSIX + help + Use some heuristics to try to guess in advance whether the controller + supports the HCI vendor extensions in advance, in order to prevent + sending vendor commands to controller which may interpret them in + completely different ways. + endif # BT_HCI endif # BT diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index dc924edf1b1..da5f47b6479 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -8,33 +8,6 @@ if BT_HCI -config BT_HCI_VS - bool "Zephyr HCI Vendor-Specific Commands" - default y - help - Enable support for the Zephyr HCI Vendor-Specific Commands in the - Host and/or Controller. This enables Set Version Information, - Supported Commands, Supported Features vendor commands. - -config BT_HCI_VS_EXT - bool "Zephyr HCI Vendor-Specific Extensions" - depends on BT_HCI_VS - default y - help - Enable support for the Zephyr HCI Vendor-Specific Extensions in the - Host and/or Controller. This enables Write BD_ADDR, Read Build Info, - Read Static Addresses and Read Key Hierarchy Roots vendor commands. - -config BT_HCI_VS_EXT_DETECT - bool "Use heuristics to guess HCI vendor extensions support in advance" - depends on BT_HCI_VS_EXT && !BT_CTLR - default y if BOARD_QEMU_X86 || BOARD_QEMU_CORTEX_M3 || BOARD_NATIVE_POSIX - help - Use some heuristics to try to guess in advance whether the controller - supports the HCI vendor extensions in advance, in order to prevent - sending vendor commands to controller which may interpret them in - completely different ways. - config BT_RPA # Virtual/hidden option bool From 8e496b319c0c9c45262e123d06a8555df3498163 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 18 Feb 2019 15:21:05 +0100 Subject: [PATCH 19/23] Use BT_LL_HAS_VS_COMMANDS instead of BT_HCI_VS_CUSTOM Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/Kconfig | 12 +++++++----- subsys/bluetooth/controller/Kconfig | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 9290c5e0cf2..51a7252678a 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -174,14 +174,16 @@ source "subsys/bluetooth/host/Kconfig" source "subsys/bluetooth/controller/Kconfig" source "subsys/bluetooth/shell/Kconfig" -config BT_HCI_VS_CUSTOM - bool - default n +config BT_LL_HAS_VS_COMMANDS + bool + help + This option can be enabled by an external library if it + supports the Zephyr HCI Vendor-Specific Commands. config BT_HCI_VS bool "Zephyr HCI Vendor-Specific Commands" - depends on !BT_HCI_VS_CUSTOM - default y + depends on BT_LL_HAS_VS_COMMANDS + default y help Enable support for the Zephyr HCI Vendor-Specific Commands in the Host and/or Controller. This enables Set Version Information, diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 069be9c20e2..5f4cc9e7832 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -23,6 +23,7 @@ choice BT_LL_CHOICE config BT_LL_SW bool "Software-based BLE Link Layer" select BT_RECV_IS_RX_THREAD + select BT_LL_HAS_VS_COMMANDS select ENTROPY_GENERATOR select ENTROPY_NRF5_RNG if SOC_COMPATIBLE_NRF select ENTROPY_NRF5_BIAS_CORRECTION if SOC_COMPATIBLE_NRF From 38f6ed345c1e4fd8269cee3429e772cbf34a1d69 Mon Sep 17 00:00:00 2001 From: Thomas Stenersen Date: Tue, 19 Feb 2019 10:47:35 +0100 Subject: [PATCH 20/23] bluetooth: host: Use default HCI stack size if no BT_LL_SW Increase the default BT_HCI_TX_STACK_SIZE and make it user configurable. If there is a BT_CTRL controller out-of-tree with different requirements to the stack size, the default is at least sufficiently high and it's user configurable. Signed-off-by: Thomas Stenersen --- subsys/bluetooth/host/Kconfig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 947d9cb6a13..899e8ac7d67 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -48,16 +48,18 @@ config BT_RX_BUF_LEN (4 bytes) and the ACL header (also 4 bytes) which yields 73 bytes. config BT_HCI_TX_STACK_SIZE + # NOTE: By _not_ having a prompt here, Kconfig will fall back on + # the default value if none of the other values are set. int default 512 if BT_H4 default 512 if BT_H5 default 416 if BT_SPI - default 940 if BT_CTLR && NO_OPTIMIZATIONS - default 640 if BT_CTLR + default 940 if BT_CTLR && (BT_LL_SW || BT_LL_SW_SPLIT) && NO_OPTIMIZATIONS + default 640 if BT_CTLR && (BT_LL_SW || BT_LL_SW_SPLIT) default 512 if BT_USERCHAN # Even if no driver is selected the following default is still # needed e.g. for unit tests. - default 512 + default 1024 help Stack size needed for executing bt_send with specified driver From 504ce6aea0be14089b827ecec79217003661e84d Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 20 Feb 2019 09:20:39 +0100 Subject: [PATCH 21/23] Rename BT_LL_HAS_VS_COMMANDS with BT_HAS_HCI_VS Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/Kconfig | 4 ++-- subsys/bluetooth/controller/Kconfig | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 51a7252678a..19af559f901 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -174,7 +174,7 @@ source "subsys/bluetooth/host/Kconfig" source "subsys/bluetooth/controller/Kconfig" source "subsys/bluetooth/shell/Kconfig" -config BT_LL_HAS_VS_COMMANDS +config BT_HAS_HCI_VS bool help This option can be enabled by an external library if it @@ -182,7 +182,7 @@ config BT_LL_HAS_VS_COMMANDS config BT_HCI_VS bool "Zephyr HCI Vendor-Specific Commands" - depends on BT_LL_HAS_VS_COMMANDS + depends on BT_HAS_HCI_VS default y help Enable support for the Zephyr HCI Vendor-Specific Commands in the diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 5f4cc9e7832..9ae3f530d17 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -23,7 +23,7 @@ choice BT_LL_CHOICE config BT_LL_SW bool "Software-based BLE Link Layer" select BT_RECV_IS_RX_THREAD - select BT_LL_HAS_VS_COMMANDS + select BT_HAS_HCI_VS select ENTROPY_GENERATOR select ENTROPY_NRF5_RNG if SOC_COMPATIBLE_NRF select ENTROPY_NRF5_BIAS_CORRECTION if SOC_COMPATIBLE_NRF From f034c51bed9d34e43215e39f358d8316de6be334 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 20 Feb 2019 09:22:17 +0100 Subject: [PATCH 22/23] Use tabs indents Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/Kconfig | 2 +- subsys/bluetooth/controller/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 19af559f901..289674fa709 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -182,7 +182,7 @@ config BT_HAS_HCI_VS config BT_HCI_VS bool "Zephyr HCI Vendor-Specific Commands" - depends on BT_HAS_HCI_VS + depends on BT_HAS_HCI_VS default y help Enable support for the Zephyr HCI Vendor-Specific Commands in the diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 9ae3f530d17..638aad56d52 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -23,7 +23,7 @@ choice BT_LL_CHOICE config BT_LL_SW bool "Software-based BLE Link Layer" select BT_RECV_IS_RX_THREAD - select BT_HAS_HCI_VS + select BT_HAS_HCI_VS select ENTROPY_GENERATOR select ENTROPY_NRF5_RNG if SOC_COMPATIBLE_NRF select ENTROPY_NRF5_BIAS_CORRECTION if SOC_COMPATIBLE_NRF From 758e71ba9a4e2d055d2199b36b73914721947845 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 20 Feb 2019 09:24:04 +0100 Subject: [PATCH 23/23] Add Events to BT_HAS_HCI_VS config Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 289674fa709..6a9579cf51f 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -178,7 +178,7 @@ config BT_HAS_HCI_VS bool help This option can be enabled by an external library if it - supports the Zephyr HCI Vendor-Specific Commands. + supports the Zephyr HCI Vendor-Specific Commands and Events. config BT_HCI_VS bool "Zephyr HCI Vendor-Specific Commands"