Skip to content

Commit eccf032

Browse files
author
Johan Hedberg
committed
Merge bluetooth branch into master
- New SPI HCI driver for ST BlueNRG modules - More memory optimizations through TX buffer pool consolidation - Refactoring to take advantage of new IS_ENABLED() macro - Fixes to LE L2CAP Credit-based Flow Control - Various smaller fixes & enhancements here and there ---------------------------------------------------------------- Arkadiusz Lichwa (2): Bluetooth: UUID: Fix format specifier in 128-UUID Bluetooth: ATT: Fix redundant sys_slist call Arun Jagadish (1): Bluetooth: AVDTP: Added params to AVDTP Request structure Carles Cufi (1): bluetooth: hci_core: Fix conn params validity check Jaganath Kanakkassery (1): Bluetooth: RFCOMM: Implement Aggregate Flow Control Johan Hedberg (21): Bluetooth: Consolidate most outgoing ACL TX buffers into a single pool Bluetooth: Use the controller bt_rand() whenever possible Bluetooth: Controller: Rename hci_le_rand to bt_rand Bluetooth: hci_uart: Remove redundant idle & ISR stack size values Bluetooth: Remove unused bt_hci_driver_unregister() API Bluetooth: Add missing documentation to HCI driver APIs Bluetooth: GATT: Fix missing connection address comparison Bluetooth: ATT: Add new error code from CSSv7 Bluetooth: Prefer struct bt_le_conn_param over individual values Bluetooth: Add documentation for connection callbacks Bluetooth: Remove ACL details from BT_BUF_RX_SIZE Bluetooth: L2CAP: Remove RECV_RESERVE from BT_L2CAP_RX_MTU Bluetooth: Introduce a new connection parameter request callback Bluetooth: Take advantage of IS_ENABLED macro for BT_DBG Bluetooth: Add __printf_like annotation for bt_log Bluetooth: drivers/nble: Remove bogus BT_DBG manipulation Bluetooth: hci_core: Take advantage of IS_ENABLED whenever possible Bluetooth: conn: Take advantage of IS_ENABLED whenever possible Bluetooth: L2CAP: Take advantage of IS_ENABLED whenever possible Bluetooth: SMP: Take advantage of IS_ENABLED whenever possible Bluetooth: Don't select TinyCrypt RNG for combined builds Lee Jones (5): pinmux/stm32l4: Add support for STM32L SPI1 and SPI3 pinmux/nucleo_l476rg: Define pinmuxing for SPI1 and SPI3 Bluetooth: Add HCI SPI driver Bluetooth: samples/beacon: Print message at start of sample Bluetooth: Kconfig: Specify stack size for Bluetooth SPI Luiz Augusto von Dentz (4): Bluetooth: L2CAP: Fix using CONFIG_BLUETOOTH_RX_BUF_LEN as MTU Bluetooth: IPSP: Reuse buffer fragments instead of copying Bluetooth: L2CAP: Make sure state is correctly updated Bluetooth: L2CAP: Fix always using RX_BUF_COUNT as initial credits Sathish Narasimman (1): Bluetooth: AT: Rename enum at_cmd_type elements drivers/bluetooth/hci/Kconfig | 81 +++ drivers/bluetooth/hci/Makefile | 1 + drivers/bluetooth/hci/h4.c | 8 +- drivers/bluetooth/hci/h5.c | 8 +- drivers/bluetooth/hci/spi.c | 351 ++++++++++++ drivers/bluetooth/nble/conn.c | 8 +- drivers/bluetooth/nble/gap.c | 13 +- drivers/bluetooth/nble/gatt.c | 8 +- drivers/bluetooth/nble/rpc_deserialize.c | 27 +- drivers/bluetooth/nble/rpc_serialize.c | 5 - drivers/bluetooth/nble/smp.c | 3 +- drivers/bluetooth/nble/uart.c | 6 +- drivers/bluetooth/nrf51_pm.c | 1 + .../pinmux/stm32/pinmux_board_nucleo_l476rg.c | 12 + drivers/pinmux/stm32/pinmux_stm32l4x.h | 10 + include/bluetooth/att.h | 1 + include/bluetooth/buf.h | 1 - include/bluetooth/conn.h | 81 ++- include/bluetooth/l2cap.h | 2 + include/bluetooth/log.h | 40 +- include/drivers/bluetooth/hci_driver.h | 106 +++- samples/bluetooth/beacon/src/main.c | 2 + samples/bluetooth/hci_uart/nrf5.conf | 2 - samples/bluetooth/ipsp/src/main.c | 35 +- subsys/bluetooth/controller/hal/nrf5/rand.c | 2 +- subsys/bluetooth/controller/hal/rand.h | 2 +- subsys/bluetooth/controller/hci/hci.c | 4 +- subsys/bluetooth/controller/hci/hci_driver.c | 18 +- subsys/bluetooth/controller/hci/hci_internal.h | 1 - subsys/bluetooth/controller/ll/ctrl.c | 1 + subsys/bluetooth/host/Kconfig | 63 ++- subsys/bluetooth/host/a2dp.c | 7 +- subsys/bluetooth/host/at.c | 38 +- subsys/bluetooth/host/at.h | 10 +- subsys/bluetooth/host/att.c | 65 +-- subsys/bluetooth/host/att_internal.h | 6 + subsys/bluetooth/host/avdtp.c | 24 +- subsys/bluetooth/host/avdtp_internal.h | 10 +- subsys/bluetooth/host/conn.c | 157 +++--- subsys/bluetooth/host/conn_internal.h | 4 +- subsys/bluetooth/host/gatt.c | 12 +- subsys/bluetooth/host/hci_core.c | 504 +++++++++--------- subsys/bluetooth/host/hci_core.h | 5 +- subsys/bluetooth/host/hci_ecc.c | 11 +- subsys/bluetooth/host/hci_raw.c | 8 +- subsys/bluetooth/host/hfp_hf.c | 6 +- subsys/bluetooth/host/keys.c | 6 +- subsys/bluetooth/host/keys.h | 4 - subsys/bluetooth/host/keys_br.c | 6 +- subsys/bluetooth/host/l2cap.c | 108 ++-- subsys/bluetooth/host/l2cap_br.c | 32 +- subsys/bluetooth/host/l2cap_internal.h | 8 +- subsys/bluetooth/host/log.c | 2 - subsys/bluetooth/host/monitor.c | 1 - subsys/bluetooth/host/rfcomm.c | 148 ++++- subsys/bluetooth/host/rfcomm_internal.h | 15 + subsys/bluetooth/host/sdp.c | 6 +- subsys/bluetooth/host/smp.c | 211 ++++---- subsys/bluetooth/host/smp_null.c | 7 +- subsys/bluetooth/host/storage.c | 1 + subsys/bluetooth/host/uuid.c | 2 +- tests/bluetooth/shell/arduino_101.conf | 2 +- tests/bluetooth/shell/prj.conf | 2 +- 63 files changed, 1479 insertions(+), 852 deletions(-) create mode 100644 drivers/bluetooth/hci/spi.c Change-Id: Ic11028e1f02636a48d95cbe03735af37cea94e25 Signed-off-by: Johan Hedberg <[email protected]>
2 parents 033b5e9 + 1f35d47 commit eccf032

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1479
-852
lines changed

drivers/bluetooth/hci/Kconfig

+81
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ config BLUETOOTH_H5
4848
Bluetooth three-wire (H:5) UART driver. Implementation of HCI
4949
Three-Wire UART Transport Layer.
5050

51+
config BLUETOOTH_SPI
52+
bool "SPI HCI"
53+
select SPI
54+
help
55+
Supports Bluetooth ICs using SPI as the communication protocol.
56+
HCI packets are sent and received as single Byte transferrs,
57+
prepended after a known header. Headers may vary per device, so
58+
additional platform specific knowlege may need to be added as
59+
devices are. Current driver supports; ST X-NUCLEO BLE series.
60+
5161
config BLUETOOTH_NO_DRIVER
5262
bool "No default HCI driver"
5363
help
@@ -73,6 +83,17 @@ config BLUETOOTH_UART_ON_DEV_NAME
7383
This option specifies the name of UART device to be used
7484
for Bluetooth.
7585

86+
config BLUETOOTH_SPI_DEV_NAME
87+
string "Device Name of SPI Device for Bluetooth"
88+
default "SPI_0"
89+
depends on BLUETOOTH_SPI
90+
help
91+
This option specifies the name of SPI device to be used for Bluetooth.
92+
On the controller side, this SPI device is used to encapsulate the
93+
RAW HCI frames to send further up the stack. On the BLE stack side,
94+
this device is used to reply back with HCI frames that are sent over
95+
the air.
96+
7697
# Headroom that the driver needs for sending and receiving buffers.
7798
# Add a new 'default' entry for each new driver.
7899

@@ -84,6 +105,7 @@ config BLUETOOTH_HCI_SEND_RESERVE
84105
default 0
85106
default 0 if BLUETOOTH_H4
86107
default 1 if BLUETOOTH_H5
108+
default 1 if BLUETOOTH_SPI
87109

88110
# Needed headroom for incoming buffers (from controller)
89111
config BLUETOOTH_HCI_RECV_RESERVE
@@ -93,3 +115,62 @@ config BLUETOOTH_HCI_RECV_RESERVE
93115
default 0
94116
default 0 if BLUETOOTH_H4
95117
default 0 if BLUETOOTH_H5
118+
119+
if BLUETOOTH_SPI
120+
121+
config BLUETOOTH_SPI_CHIP_SELECT_DEV_NAME
122+
string "Chip Select (CS) line driver name"
123+
help
124+
This option specifies the name of GPIO driver controlling
125+
the Chip Select (CS) line.
126+
127+
config BLUETOOTH_SPI_IRQ_DEV_NAME
128+
string "IRQ line driver name"
129+
help
130+
This option specifies the name of GPIO driver controlling
131+
the chip's IRQ line.
132+
133+
config BLUETOOTH_SPI_RESET_DEV_NAME
134+
string "Reset line driver name"
135+
help
136+
This option specifies the name of GPIO driver controlling
137+
the chip's Reset line.
138+
139+
config BLUETOOTH_SPI_CHIP_SELECT_PIN
140+
int "SPI Chip Select (CS) line number"
141+
help
142+
This option specifies the Chip Select (CS) line number on the SPI
143+
device
144+
145+
config BLUETOOTH_SPI_IRQ_PIN
146+
int "SPI IRQ line number"
147+
help
148+
This option specifies the Reset line number on the SPI device
149+
150+
config BLUETOOTH_SPI_RESET_PIN
151+
int "SPI Reset line number"
152+
help
153+
This option specifies the Reset line number on the SPI device
154+
155+
config BLUETOOTH_SPI_RX_BUFFER_SIZE
156+
int "Receive buffer length"
157+
default 96
158+
help
159+
This option specifies the size of the RX buffer. Try to keep this
160+
as small as possible, since it's stored on the stack.
161+
162+
config BLUETOOTH_SPI_TX_BUFFER_SIZE
163+
int "Transmit buffer length"
164+
default 64
165+
help
166+
This option specifies the size of the TX buffer. Try to keep this
167+
as small as possible, since it's stored on the stack.
168+
169+
config BLUETOOTH_SPI_MAX_CLK_FREQ
170+
int "Maximum clock frequency for the HCI SPI interface"
171+
default 5000000
172+
help
173+
This option specifies the maximum clock rate the HCI SPI
174+
interface is capable of running at.
175+
176+
endif # BLUETOOTH_SPI

drivers/bluetooth/hci/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
obj-$(CONFIG_BLUETOOTH_H4) += h4.o
22
obj-$(CONFIG_BLUETOOTH_H5) += h5.o
3+
obj-$(CONFIG_BLUETOOTH_SPI) += spi.o

drivers/bluetooth/hci/h4.c

+2-6
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,14 @@
2828
#include <misc/byteorder.h>
2929
#include <string.h>
3030

31-
#include <bluetooth/bluetooth.h>
31+
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
3232
#include <bluetooth/log.h>
33+
#include <bluetooth/bluetooth.h>
3334
#include <bluetooth/hci.h>
3435
#include <bluetooth/hci_driver.h>
3536

3637
#include "../util.h"
3738

38-
#if !defined(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
39-
#undef BT_DBG
40-
#define BT_DBG(fmt, ...)
41-
#endif
42-
4339
#if defined(CONFIG_BLUETOOTH_NRF51_PM)
4440
#include "../nrf51_pm.h"
4541
#endif

drivers/bluetooth/hci/h5.c

+2-6
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,14 @@
3030
#include <misc/printk.h>
3131
#include <string.h>
3232

33-
#include <bluetooth/bluetooth.h>
33+
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
3434
#include <bluetooth/log.h>
35+
#include <bluetooth/bluetooth.h>
3536
#include <bluetooth/hci.h>
3637
#include <bluetooth/hci_driver.h>
3738

3839
#include "../util.h"
3940

40-
#if !defined(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
41-
#undef BT_DBG
42-
#define BT_DBG(fmt, ...)
43-
#endif
44-
4541
static BT_STACK_NOINIT(tx_stack, 256);
4642
static BT_STACK_NOINIT(rx_stack, 256);
4743

0 commit comments

Comments
 (0)