Skip to content

Commit 811b371

Browse files
author
Anas Nashif
committed
Merge "Merge bluetooth branch into master"
2 parents 9888bc8 + eccf032 commit 811b371

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)