From 743379c21fb064c5810adb094b49535a4597d9c3 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 1 Feb 2017 12:59:11 +0200 Subject: Bluetooth: Kconfig: Merge headroom reserve variables into a single one A subsequent patch will start reusing HCI command buffers for receiving the response, so the distinction of received vs sent data headroom would just make the code unnecessarily complex. Instead, just merge these two variable into a single one. Change-Id: I31d846331939f1a2270df7ed0c75112825e16493 Signed-off-by: Johan Hedberg --- samples/bluetooth/hci_uart/src/main.c | 10 ++++------ samples/bluetooth/hci_usb/src/main.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'samples') diff --git a/samples/bluetooth/hci_uart/src/main.c b/samples/bluetooth/hci_uart/src/main.c index 39fdafd13..3924fd42d 100644 --- a/samples/bluetooth/hci_uart/src/main.c +++ b/samples/bluetooth/hci_uart/src/main.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -31,8 +32,7 @@ static struct device *hci_uart_dev; static BT_STACK_NOINIT(tx_thread_stack, CONFIG_BLUETOOTH_HCI_TX_STACK_SIZE); /* HCI command buffers */ -#define CMD_BUF_SIZE (CONFIG_BLUETOOTH_HCI_SEND_RESERVE + \ - sizeof(struct bt_hci_cmd_hdr) + \ +#define CMD_BUF_SIZE (CONFIG_BLUETOOTH_HCI_RESERVE + BT_HCI_CMD_HDR_SIZE + \ CONFIG_BLUETOOTH_MAX_CMD_LEN) NET_BUF_POOL_DEFINE(cmd_tx_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT, CMD_BUF_SIZE, @@ -40,10 +40,8 @@ NET_BUF_POOL_DEFINE(cmd_tx_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT, CMD_BUF_SIZE, #define BT_L2CAP_MTU 65 /* 64-byte public key + opcode */ /** Data size needed for ACL buffers */ -#define BT_BUF_ACL_SIZE (CONFIG_BLUETOOTH_HCI_RECV_RESERVE + \ - sizeof(struct bt_hci_acl_hdr) + \ - 4 /* L2CAP header size */ + \ - BT_L2CAP_MTU) +#define BT_BUF_ACL_SIZE (CONFIG_BLUETOOTH_HCI_RESERVE + BT_HCI_ACL_HDR_SIZE + \ + BT_L2CAP_HDR_SIZE + BT_L2CAP_MTU) #if defined(CONFIG_BLUETOOTH_CONTROLLER_TX_BUFFERS) #define TX_BUF_COUNT CONFIG_BLUETOOTH_CONTROLLER_TX_BUFFERS diff --git a/samples/bluetooth/hci_usb/src/main.c b/samples/bluetooth/hci_usb/src/main.c index bea2cd2b0..1a4d51da7 100644 --- a/samples/bluetooth/hci_usb/src/main.c +++ b/samples/bluetooth/hci_usb/src/main.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "usb_device.h" #include "usb_common.h" @@ -74,8 +75,7 @@ static struct device *btusb_dev; static K_FIFO_DEFINE(rx_queue); /* HCI command buffers */ -#define CMD_BUF_SIZE (CONFIG_BLUETOOTH_HCI_SEND_RESERVE + \ - sizeof(struct bt_hci_cmd_hdr) + \ +#define CMD_BUF_SIZE (CONFIG_BLUETOOTH_HCI_RESERVE + BT_HCI_CMD_HDR_SIZE + \ CONFIG_BLUETOOTH_MAX_CMD_LEN) NET_BUF_POOL_DEFINE(tx_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT, CMD_BUF_SIZE, @@ -83,10 +83,8 @@ NET_BUF_POOL_DEFINE(tx_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT, CMD_BUF_SIZE, #define BT_L2CAP_MTU 64 /** Data size needed for ACL buffers */ -#define BT_BUF_ACL_SIZE (CONFIG_BLUETOOTH_HCI_RECV_RESERVE + \ - sizeof(struct bt_hci_acl_hdr) + \ - 4 /* L2CAP header size */ + \ - BT_L2CAP_MTU) +#define BT_BUF_ACL_SIZE (CONFIG_BLUETOOTH_HCI_RESERVE + BT_HCI_ACL_HDR_SIZE + \ + BT_L2CAP_HDR_SIZE + BT_L2CAP_MTU) NET_BUF_POOL_DEFINE(acl_tx_pool, 2, BT_BUF_ACL_SIZE, sizeof(uint8_t), NULL); -- cgit v1.2.3