Skip to content

Commit

Permalink
Merge "Merge bluetooth branch into master"
Browse files Browse the repository at this point in the history
  • Loading branch information
Anas Nashif committed Jan 19, 2017
2 parents 9888bc8 + eccf032 commit 811b371
Show file tree
Hide file tree
Showing 63 changed files with 1,479 additions and 852 deletions.
81 changes: 81 additions & 0 deletions drivers/bluetooth/hci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ config BLUETOOTH_H5
Bluetooth three-wire (H:5) UART driver. Implementation of HCI
Three-Wire UART Transport Layer.

config BLUETOOTH_SPI
bool "SPI HCI"
select SPI
help
Supports Bluetooth ICs using SPI as the communication protocol.
HCI packets are sent and received as single Byte transferrs,
prepended after a known header. Headers may vary per device, so
additional platform specific knowlege may need to be added as
devices are. Current driver supports; ST X-NUCLEO BLE series.

config BLUETOOTH_NO_DRIVER
bool "No default HCI driver"
help
Expand All @@ -73,6 +83,17 @@ config BLUETOOTH_UART_ON_DEV_NAME
This option specifies the name of UART device to be used
for Bluetooth.

config BLUETOOTH_SPI_DEV_NAME
string "Device Name of SPI Device for Bluetooth"
default "SPI_0"
depends on BLUETOOTH_SPI
help
This option specifies the name of SPI device to be used for Bluetooth.
On the controller side, this SPI device is used to encapsulate the
RAW HCI frames to send further up the stack. On the BLE stack side,
this device is used to reply back with HCI frames that are sent over
the air.

# Headroom that the driver needs for sending and receiving buffers.
# Add a new 'default' entry for each new driver.

Expand All @@ -84,6 +105,7 @@ config BLUETOOTH_HCI_SEND_RESERVE
default 0
default 0 if BLUETOOTH_H4
default 1 if BLUETOOTH_H5
default 1 if BLUETOOTH_SPI

# Needed headroom for incoming buffers (from controller)
config BLUETOOTH_HCI_RECV_RESERVE
Expand All @@ -93,3 +115,62 @@ config BLUETOOTH_HCI_RECV_RESERVE
default 0
default 0 if BLUETOOTH_H4
default 0 if BLUETOOTH_H5

if BLUETOOTH_SPI

config BLUETOOTH_SPI_CHIP_SELECT_DEV_NAME
string "Chip Select (CS) line driver name"
help
This option specifies the name of GPIO driver controlling
the Chip Select (CS) line.

config BLUETOOTH_SPI_IRQ_DEV_NAME
string "IRQ line driver name"
help
This option specifies the name of GPIO driver controlling
the chip's IRQ line.

config BLUETOOTH_SPI_RESET_DEV_NAME
string "Reset line driver name"
help
This option specifies the name of GPIO driver controlling
the chip's Reset line.

config BLUETOOTH_SPI_CHIP_SELECT_PIN
int "SPI Chip Select (CS) line number"
help
This option specifies the Chip Select (CS) line number on the SPI
device

config BLUETOOTH_SPI_IRQ_PIN
int "SPI IRQ line number"
help
This option specifies the Reset line number on the SPI device

config BLUETOOTH_SPI_RESET_PIN
int "SPI Reset line number"
help
This option specifies the Reset line number on the SPI device

config BLUETOOTH_SPI_RX_BUFFER_SIZE
int "Receive buffer length"
default 96
help
This option specifies the size of the RX buffer. Try to keep this
as small as possible, since it's stored on the stack.

config BLUETOOTH_SPI_TX_BUFFER_SIZE
int "Transmit buffer length"
default 64
help
This option specifies the size of the TX buffer. Try to keep this
as small as possible, since it's stored on the stack.

config BLUETOOTH_SPI_MAX_CLK_FREQ
int "Maximum clock frequency for the HCI SPI interface"
default 5000000
help
This option specifies the maximum clock rate the HCI SPI
interface is capable of running at.

endif # BLUETOOTH_SPI
1 change: 1 addition & 0 deletions drivers/bluetooth/hci/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
obj-$(CONFIG_BLUETOOTH_H4) += h4.o
obj-$(CONFIG_BLUETOOTH_H5) += h5.o
obj-$(CONFIG_BLUETOOTH_SPI) += spi.o
8 changes: 2 additions & 6 deletions drivers/bluetooth/hci/h4.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,14 @@
#include <misc/byteorder.h>
#include <string.h>

#include <bluetooth/bluetooth.h>
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
#include <bluetooth/log.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_driver.h>

#include "../util.h"

#if !defined(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
#undef BT_DBG
#define BT_DBG(fmt, ...)
#endif

#if defined(CONFIG_BLUETOOTH_NRF51_PM)
#include "../nrf51_pm.h"
#endif
Expand Down
8 changes: 2 additions & 6 deletions drivers/bluetooth/hci/h5.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@
#include <misc/printk.h>
#include <string.h>

#include <bluetooth/bluetooth.h>
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
#include <bluetooth/log.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_driver.h>

#include "../util.h"

#if !defined(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
#undef BT_DBG
#define BT_DBG(fmt, ...)
#endif

static BT_STACK_NOINIT(tx_stack, 256);
static BT_STACK_NOINIT(rx_stack, 256);

Expand Down
Loading

0 comments on commit 811b371

Please sign in to comment.