diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2017-02-01 12:59:11 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2017-02-05 22:39:25 +0200 |
commit | 743379c21fb064c5810adb094b49535a4597d9c3 (patch) | |
tree | 45cb85dde9151e7a0afd2b8a4c4aa4984e6352c9 /samples | |
parent | be139268b3f5e556f70567fd2d9e957f6fcf50fa (diff) |
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 <johan.hedberg@intel.com>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/bluetooth/hci_uart/src/main.c | 10 | ||||
-rw-r--r-- | samples/bluetooth/hci_usb/src/main.c | 10 |
2 files changed, 8 insertions, 12 deletions
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 <net/buf.h> #include <bluetooth/bluetooth.h> +#include <bluetooth/l2cap.h> #include <bluetooth/log.h> #include <bluetooth/hci.h> #include <bluetooth/buf.h> @@ -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 <net/buf.h> #include <bluetooth/buf.h> #include <bluetooth/hci_raw.h> +#include <bluetooth/l2cap.h> #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); |