Skip to content

Commit

Permalink
Bluetooth: Kconfig: Restructure for a more logical hierarchy
Browse files Browse the repository at this point in the history
Restructure the Bluetooth options more logically.

- Both host and controller are now behind the same high level
  CONFIG_BLUETOOTH.

- Selecting controller support disables other HCI driver selection, so
  the controller isn't in the same list as HCI drivers any more.

- Under the top-level there's a "Custom stack" option, which when
  enabled opens up the option of choosing CONFIG_NBLE.

There are various other cleanups and simplifications in this patch as
well, since splitting these up would have been fairly tricky while
making sure all test cases still build.

Change-Id: I5bb715cb9d20201cb8b72fbd149c8a09a4b2d7d2
Signed-off-by: Johan Hedberg <[email protected]>
  • Loading branch information
Johan Hedberg committed Nov 11, 2016
1 parent 1c40b96 commit c583a9f
Show file tree
Hide file tree
Showing 71 changed files with 95 additions and 148 deletions.
6 changes: 5 additions & 1 deletion drivers/bluetooth/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ if BLUETOOTH

menu "Bluetooth Drivers"

if BLUETOOTH_HCI
source "drivers/bluetooth/hci/Kconfig"
endif

if BLUETOOTH_CUSTOM
source "drivers/bluetooth/nble/Kconfig"
endif

config BLUETOOTH_NRF51_PM
bool "nRF51 Power Management [EXPERIMENTAL]"
Expand All @@ -37,7 +41,7 @@ config BLUETOOTH_NRF51_PM

config BLUETOOTH_WAIT_NOP
bool "Wait for \"NOP\" Command Complete event during init"
depends on BLUETOOTH_STACK_HCI || BLUETOOTH_STACK_HCI_RAW
depends on BLUETOOTH_HCI
help
Some controllers emit a Command Complete event for the NOP
opcode to indicate that they're ready to receive commands.
Expand Down
18 changes: 7 additions & 11 deletions drivers/bluetooth/hci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
# limitations under the License.
#

if BLUETOOTH_STACK_HCI || BLUETOOTH_STACK_HCI_RAW

comment "Bluetooth HCI Driver Options"

# Controller support is an HCI driver in itself, so these HCI driver
# options are only applicable if controller support hasn't been enabled.
if !BLUETOOTH_CONTROLLER

config BLUETOOTH_UART
bool
default n
Expand Down Expand Up @@ -48,12 +50,6 @@ config BLUETOOTH_H5
Bluetooth three-wire (H:5) UART driver. Implementation of HCI
Three-Wire UART Transport Layer.

config BLUETOOTH_CONTROLLER
bool "Controller"
select BLUETOOTH_HOST_BUFFERS
help
Enables support for SoC native controller implementation.

config BLUETOOTH_NO_DRIVER
bool "No default HCI driver"
help
Expand All @@ -62,6 +58,8 @@ config BLUETOOTH_NO_DRIVER

endchoice

endif # !BLUETOOTH_CONTROLLER

config BLUETOOTH_HOST_BUFFERS
bool "Host managed incoming data buffers"
default n
Expand All @@ -76,7 +74,7 @@ config BLUETOOTH_HOST_BUFFERS

config BLUETOOTH_DEBUG_HCI_DRIVER
bool "Bluetooth HCI driver debug"
depends on BLUETOOTH_DEBUG && (BLUETOOTH_UART || BLUETOOTH_CONTROLLER)
depends on BLUETOOTH_DEBUG
default n
help
This option enables debug support for the chosen
Expand Down Expand Up @@ -110,5 +108,3 @@ config BLUETOOTH_HCI_RECV_RESERVE
default 0
default 0 if BLUETOOTH_H4
default 0 if BLUETOOTH_H5

endif # BLUETOOTH_STACK_HCI || BLUETOOTH_STACK_HCI_RAW
17 changes: 5 additions & 12 deletions drivers/bluetooth/nble/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@
#

config NBLE
bool "Support for custom Nordic Semiconductor BLE protocol"
default y if BLUETOOTH_STACK_NBLE
default n
select BLUETOOTH_PERIPHERAL
select BLUETOOTH_CENTRAL
select BLUETOOTH_GATT_CLIENT
select BLUETOOTH_SMP
bool "Support for custom non-HCI nRF51 firmware"
select UART_INTERRUPT_DRIVEN
select NANO_TIMEOUTS
select NET_BUF
depends on SERIAL
depends on BLUETOOTH_STACK_NBLE
help
Enables support for using Nordic Semiconductor nRF51 Bluetooth
LE chips with a custom firmware. The API for this is a subset of
Expand All @@ -43,11 +36,11 @@ config NBLE
if NBLE
config BLUETOOTH_PERIPHERAL
bool
default n
default y

config BLUETOOTH_CENTRAL
bool
default n
default y

config BLUETOOTH_ATT_PREPARE_COUNT
int "Number of ATT prepare write buffers"
Expand All @@ -59,11 +52,11 @@ config BLUETOOTH_ATT_PREPARE_COUNT

config BLUETOOTH_GATT_CLIENT
bool
default n
default y

config BLUETOOTH_SMP
bool
default n
default y

config BLUETOOTH_MAX_CONN
int
Expand Down
1 change: 0 additions & 1 deletion samples/bluetooth/beacon/prj.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
2 changes: 1 addition & 1 deletion samples/bluetooth/beacon/prj_nble.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_NBLE=y
CONFIG_BLUETOOTH_CUSTOM=y
CONFIG_NBLE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
1 change: 0 additions & 1 deletion samples/bluetooth/central/prj.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_CENTRAL=y
1 change: 0 additions & 1 deletion samples/bluetooth/central_hr/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
CONFIG_BLUETOOTH_CENTRAL=y
CONFIG_BLUETOOTH_SMP=y
Expand Down
1 change: 0 additions & 1 deletion samples/bluetooth/eddystone/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
CONFIG_BLUETOOTH_PERIPHERAL=y
CONFIG_BLUETOOTH_GATT_DYNAMIC_DB=y
2 changes: 1 addition & 1 deletion samples/bluetooth/eddystone/prj_nble.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_NBLE=y
CONFIG_BLUETOOTH_CUSTOM=y
CONFIG_NBLE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
2 changes: 1 addition & 1 deletion samples/bluetooth/hci_uart/generic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_HCI_RAW=y
CONFIG_BLUETOOTH_HCI_RAW=y
2 changes: 1 addition & 1 deletion samples/bluetooth/hci_uart/nrf5.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_HCI_RAW=y
CONFIG_BLUETOOTH_HCI_RAW=y
CONFIG_BLUETOOTH_MAX_CONN=16
CONFIG_BLUETOOTH_CONTROLLER_RX_BUFFERS=4
CONFIG_BLUETOOTH_CONTROLLER_TX_BUFFERS=4
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/hci_usb/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ CONFIG_USB_DEVICE_STACK=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_HCI_RAW=y
CONFIG_BLUETOOTH_HCI_RAW=y
1 change: 0 additions & 1 deletion samples/bluetooth/peripheral/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
CONFIG_BLUETOOTH_SMP=y
CONFIG_BLUETOOTH_SIGNING=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/peripheral/prj_nble.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_NBLE=y
CONFIG_BLUETOOTH_CUSTOM=y
CONFIG_NBLE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
CONFIG_BLUETOOTH_ATT_PREPARE_COUNT=2
2 changes: 1 addition & 1 deletion samples/bluetooth/peripheral_csc/prj_nble.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CONFIG_MINIMAL_LIBC_EXTENDED=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_NBLE=y
CONFIG_BLUETOOTH_CUSTOM=y
CONFIG_NBLE=y
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
1 change: 0 additions & 1 deletion samples/bluetooth/peripheral_dis/prj.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_PERIPHERAL=y
CONFIG_BLUETOOTH_GATT_DYNAMIC_DB=y
1 change: 0 additions & 1 deletion samples/bluetooth/peripheral_esp/prj.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_PERIPHERAL=y
CONFIG_BLUETOOTH_GATT_DYNAMIC_DB=y
CONFIG_BLUETOOTH_SMP=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/peripheral_esp/prj_nble.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_NBLE=y
CONFIG_BLUETOOTH_CUSTOM=y
CONFIG_NBLE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
1 change: 0 additions & 1 deletion samples/bluetooth/peripheral_hids/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
CONFIG_BLUETOOTH_SMP=y
CONFIG_BLUETOOTH_PERIPHERAL=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/peripheral_hids/prj_nble.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_NBLE=y
CONFIG_BLUETOOTH_CUSTOM=y
CONFIG_NBLE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
1 change: 0 additions & 1 deletion samples/bluetooth/peripheral_hr/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
CONFIG_BLUETOOTH_SMP=y
CONFIG_BLUETOOTH_PERIPHERAL=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/peripheral_hr/prj_nble.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_NBLE=y
CONFIG_BLUETOOTH_CUSTOM=y
CONFIG_NBLE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
1 change: 0 additions & 1 deletion samples/bluetooth/peripheral_sc_only/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_PERIPHERAL=y
CONFIG_BLUETOOTH_SMP=y
CONFIG_BLUETOOTH_SMP_SC_ONLY=y
Expand Down
2 changes: 1 addition & 1 deletion samples/environmental_sensing/x86/prj_nble.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ CONFIG_IPM_CONSOLE_SENDER=y
CONFIG_NANO_TIMEOUTS=y
CONFIG_TIMESLICE_SIZE=1
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_STACK_NBLE=y
CONFIG_BLUETOOTH_CUSTOM=y
CONFIG_NBLE=y
1 change: 0 additions & 1 deletion samples/environmental_sensing/x86/prj_nimble.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ CONFIG_IPM_CONSOLE_SENDER=y
CONFIG_NANO_TIMEOUTS=y
CONFIG_TIMESLICE_SIZE=1
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_PERIPHERAL=y
CONFIG_BLUETOOTH_GATT_DYNAMIC_DB=y
CONFIG_GPIO=y
Expand Down
1 change: 0 additions & 1 deletion samples/net/echo_client/prj_bt.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
CONFIG_BLUETOOTH_SMP=y
CONFIG_BLUETOOTH_SIGNING=y
Expand Down
1 change: 0 additions & 1 deletion samples/net/echo_server/prj_bt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
CONFIG_BLUETOOTH_DEBUG_L2CAP=y
CONFIG_BLUETOOTH_SMP=y
Expand Down
1 change: 0 additions & 1 deletion samples/net/trickle-legacy/prj_bt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_LE=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
CONFIG_BLUETOOTH_DEBUG_L2CAP=y
CONFIG_BLUETOOTH_SMP=y
Expand Down
43 changes: 43 additions & 0 deletions subsys/bluetooth/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,49 @@
# limitations under the License.
#

menuconfig BLUETOOTH
bool "Bluetooth support"
default n
select NANO_TIMEOUTS
select NET_BUF
help
This option enables Bluetooth support.

if BLUETOOTH

choice
prompt "Bluetooth Stack Selection"
default BLUETOOTH_HCI
help
Select the Bluetooth stack to compile.

config BLUETOOTH_HCI
bool "HCI-based"
help
HCI-based stack with optional host & controller parts and an
HCI driver in between.

config BLUETOOTH_CUSTOM
bool "Custom"
help
Select a custom, non-HCI based stack. If you're not sure what
this is, you probably want the HCI-based stack instead.

endchoice

if BLUETOOTH_HCI

config BLUETOOTH_CONTROLLER
bool "Bluetooth Controller"
select BLUETOOTH_HOST_BUFFERS
help
Enables support for SoC native controller implementation.

source "subsys/bluetooth/host/Kconfig"

if BLUETOOTH_CONTROLLER
source "subsys/bluetooth/controller/Kconfig"
endif

endif # BLUETOOTH_HCI
endif # BLUETOOTH
2 changes: 1 addition & 1 deletion subsys/bluetooth/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
obj-$(CONFIG_BLUETOOTH) += host/
obj-$(CONFIG_BLUETOOTH_HCI) += host/
obj-$(CONFIG_BLUETOOTH_CONTROLLER) += controller/
2 changes: 1 addition & 1 deletion subsys/bluetooth/controller/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ config BLUETOOTH_CONTROLLER_RX_STACK_SIZE

config BLUETOOTH_CONTROLLER_ASSERT_HANDLER
bool "Bluetooth Controller Assertion Handler"
depends on BLUETOOTH_STACK_HCI_RAW
depends on BLUETOOTH_HCI_RAW
help
This option enables an application-defined sink for the
controller assertion mechanism. This must be defined in
Expand Down
Loading

0 comments on commit c583a9f

Please sign in to comment.