Skip to content

Commit

Permalink
Merge bluetooth branch into master
Browse files Browse the repository at this point in the history
 - 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 <johan.hedberg@intel.com>
  • Loading branch information
Johan Hedberg committed Jan 18, 2017
2 parents 033b5e9 + 1f35d47 commit eccf032
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 eccf032

Please sign in to comment.