Commit 3bb5644c authored by Johan Hedberg's avatar Johan Hedberg
Browse files

Merge bluetooth branch into master



Main changes:

 - ECC HCI command support for controller-only build
 - L2CAP fixes
 - Fixes to thread stack usage
 - Other minor cleanups & fixes

----------------------------------------------------------------
Arun Jagadish (1):
      Bluetooth: AVDTP: SEP Definition

Carles Cufi (3):
      Bluetooth: Controller: Implement ECC commands
      Bluetooth: Controller: Fix local LE supported features bitmap
      Bluetooth: hci_uart: Fix init order in hci_uart bootup

Jaganath Kanakkassery (2):
      Bluetooth: RFCOMM: Handle security for outgoing DLCs
      Bluetooth: RFCOMM: Remove send DM from drop()

Johan Hedberg (2):
      Bluetooth: Fix coding style issues in LE address helper functions
      Bluetooth: Controller: Make use of min() convenience macro

Luiz Augusto von Dentz (2):
      Bluetooth: L2CAP: Fix segmentation
      Bluetooth: L2CAP: Fix possibly reading past the end of buffer

Szymon Janc (7):
      Bluetooth: GATT: Fix primary service discovery response
      Bluetooth: Simplify ncmd handling
      Bluetooth: Account K_THREAD_SIZEOF in BT_STACK macros
      Bluetooth: Fix missing prototype config
      Bluetooth: L2CAP: Fix set but not used variables
      Bluetooth: samples/hci_uart: Use proper stack declaration
      Bluetooth: Make bt_send stack requirements a Kconfig option

Vinayak Chettimada (2):
      Bluetooth: hci_uart: reduce configured stack sizes
      Bluetooth: Controller: Fix DLE to check supported rx length

 include/bluetooth/avdtp.h                      | 55 ++++++++++++++++++++++++
 include/bluetooth/log.h                        |  7 ++-
 samples/bluetooth/hci_uart/microbit.conf       |  9 ++--
 samples/bluetooth/hci_uart/nrf5.conf           | 10 +++--
 samples/bluetooth/hci_uart/src/main.c          | 14 +++---
 subsys/bluetooth/controller/hci/hci.c          | 11 +++--
 subsys/bluetooth/controller/hci/hci_driver.c   | 25 +++++++++++
 subsys/bluetooth/controller/hci/hci_internal.h |  2 +-
 subsys/bluetooth/controller/ll/ctrl.c          | 17 ++++----
 subsys/bluetooth/controller/ll/ctrl.h          | 12 +++---
 subsys/bluetooth/host/Kconfig                  | 25 ++++++++---
 subsys/bluetooth/host/avdtp.c                  | 30 +++++++++++++
 subsys/bluetooth/host/avdtp_internal.h         |  9 ++++
 subsys/bluetooth/host/conn_internal.h          |  2 +-
 subsys/bluetooth/host/gatt.c                   |  5 +++
 subsys/bluetooth/host/hci_core.c               | 42 +++++-------------
 subsys/bluetooth/host/hci_core.h               | 17 +++-----
 subsys/bluetooth/host/hci_ecc.c                | 20 +++++++--
 subsys/bluetooth/host/hci_raw.c                | 10 +++--
 subsys/bluetooth/host/hci_raw_internal.h       | 34 +++++++++++++++
 subsys/bluetooth/host/l2cap.c                  | 14 +++---
 subsys/bluetooth/host/rfcomm.c                 | 48 +++++++++++++++------
 22 files changed, 307 insertions(+), 111 deletions(-)
 create mode 100644 include/bluetooth/avdtp.h
 create mode 100644 subsys/bluetooth/host/hci_raw_internal.h

Change-Id: I1ae288678e02e81cf7f2c0d2806af831bad58716
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parents 5f1c6ee2 299216b2
Loading
Loading
Loading
Loading
+55 −0
Original line number Diff line number Diff line
/** @file
 * @brief Audio/Video Distribution Transport Protocol header.
 */

/*
 * Copyright (c) 2015-2016 Intel Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef __BT_AVDTP_H
#define __BT_AVDTP_H

#ifdef __cplusplus
extern "C" {
#endif

/** @brief AVDTP SEID Information */
struct bt_avdtp_seid_info {
	/** Stream End Point ID */
	uint8_t id:6;
	/** End Point usage status */
	uint8_t inuse:1;
	/** Reserved */
	uint8_t rfa0:1;
	/** Media-type of the End Point */
	uint8_t media_type:4;
	/** TSEP of the End Point */
	uint8_t tsep:1;
	/** Reserved */
	uint8_t rfa1:3;
} __packed;

/** @brief AVDTP Local SEP*/
struct bt_avdtp_seid_lsep {
	/** Stream End Point information */
	struct bt_avdtp_seid_info sep;
	/** Pointer to next local Stream End Point structure */
	struct bt_avdtp_seid_lsep *next;
};

#ifdef __cplusplus
}
#endif

#endif /* __BT_AVDTP_H */
+5 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#define __BT_LOG_H

#include <sections.h>
#include <offsets.h>
#include <zephyr.h>

#ifdef __cplusplus
@@ -81,9 +82,11 @@ void bt_log(int prio, const char *fmt, ...);
			}

#define BT_STACK(name, size) \
		char __stack name[(size) + BT_STACK_DEBUG_EXTRA]
		char __stack name[(size) + K_THREAD_SIZEOF + \
				  BT_STACK_DEBUG_EXTRA]
#define BT_STACK_NOINIT(name, size) \
		char __noinit __stack name[(size) + BT_STACK_DEBUG_EXTRA]
		char __noinit __stack name[(size) + K_THREAD_SIZEOF + \
					   BT_STACK_DEBUG_EXTRA]

#if defined(CONFIG_BLUETOOTH_DEBUG)
const char *bt_hex(const void *buf, size_t len);
+6 −3
Original line number Diff line number Diff line
@@ -4,8 +4,11 @@ CONFIG_UART_CONSOLE=n
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_HCI_RAW=y
CONFIG_BLUETOOTH_MAX_CONN=16
CONFIG_UART_NRF5_BAUD_RATE=115200
CONFIG_UART_NRF5_FLOW_CONTROL=n
CONFIG_MAIN_STACK_SIZE=512
CONFIG_IDLE_STACK_SIZE=256
CONFIG_ISR_STACK_SIZE=512
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_HCI_RAW=y
CONFIG_BLUETOOTH_MAX_CONN=20
+7 −3
Original line number Diff line number Diff line
@@ -4,9 +4,13 @@ CONFIG_UART_CONSOLE=n
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_HCI_RAW=y
CONFIG_BLUETOOTH_MAX_CONN=16
CONFIG_UART_NRF5_BAUD_RATE=1000000
CONFIG_UART_NRF5_FLOW_CONTROL=y
CONFIG_MAIN_STACK_SIZE=512
CONFIG_IDLE_STACK_SIZE=256
CONFIG_ISR_STACK_SIZE=512
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_HCI_RAW=y
CONFIG_BLUETOOTH_MAX_CONN=20
CONFIG_BLUETOOTH_CONTROLLER_ASSERT_HANDLER=y
CONFIG_BLUETOOTH_TINYCRYPT_ECC=y
+8 −6
Original line number Diff line number Diff line
@@ -32,14 +32,13 @@

#include <net/buf.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/log.h>
#include <bluetooth/hci.h>
#include <bluetooth/buf.h>
#include <bluetooth/hci_raw.h>

static struct device *hci_uart_dev;

#define STACK_SIZE 1024
static uint8_t tx_thread_stack[STACK_SIZE];
static BT_STACK_NOINIT(tx_thread_stack, CONFIG_BLUETOOTH_HCI_SEND_STACK);

/* HCI command buffers */
#define CMD_BUF_SIZE (CONFIG_BLUETOOTH_HCI_SEND_RESERVE + \
@@ -369,10 +368,13 @@ void main(void)
	k_fifo_init(&tx_queue);
	k_fifo_init(&rx_queue);

	k_thread_spawn(tx_thread_stack, STACK_SIZE, tx_thread, NULL, NULL,
		       NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);

	/* Enable the raw interface, this will in turn open the HCI driver */
	bt_enable_raw(&rx_queue);
	/* Spawn the TX thread and start feeding commands and data to the
	 * controller
	 */
	k_thread_spawn(tx_thread_stack, sizeof(tx_thread_stack), tx_thread,
		       NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);

	while (1) {
		struct net_buf *buf;
Loading