Skip to content

Commit

Permalink
Bluetooth: EDTT: Use bt_buf_tx_get to allocate buffers
Browse files Browse the repository at this point in the history
Instead of using its own buffer pool use one already available by
HCI_RAW which are accessible with bt_buf_tx_get.

Signed-off-by: Luiz Augusto von Dentz <[email protected]>
  • Loading branch information
Vudentz authored and jhedberg committed May 7, 2020
1 parent f9d1b7e commit f311684
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions tests/bluetooth/bsim_bt/edtt_ble_test_app/hci_test_app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ static void error_response(int error)
waiting_opcode = 0;
}

NET_BUF_POOL_FIXED_DEFINE(hci_cmd_pool, CONFIG_BT_HCI_CMD_COUNT,
BT_BUF_RX_SIZE, NULL);
NET_BUF_POOL_FIXED_DEFINE(hci_data_pool, CONFIG_BT_CTLR_TX_BUFFERS + 4,
BT_BUF_ACL_SIZE, NULL);

/**
* @brief Allocate buffer for HCI command and fill in opCode for the command
*/
Expand All @@ -81,12 +76,9 @@ static struct net_buf *hci_cmd_create(u16_t opcode, u8_t param_len)
struct bt_hci_cmd_hdr *hdr;
struct net_buf *buf;

buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER);
buf = bt_buf_get_tx(BT_BUF_CMD, K_FOREVER, NULL, 0);
__ASSERT_NO_MSG(buf);

net_buf_reserve(buf, CONFIG_BT_HCI_RESERVE);
bt_buf_set_type(buf, BT_BUF_CMD);

hdr = net_buf_add(buf, sizeof(*hdr));
hdr->opcode = sys_cpu_to_le16(opcode);
hdr->param_len = param_len;
Expand All @@ -102,12 +94,9 @@ static struct net_buf *acl_data_create(struct bt_hci_acl_hdr *le_hdr)
struct net_buf *buf;
struct bt_hci_acl_hdr *hdr;

buf = net_buf_alloc(&hci_data_pool, K_FOREVER);
buf = bt_buf_get_tx(BT_BUF_ACL_OUT, K_FOREVER, NULL, 0);
__ASSERT_NO_MSG(buf);

net_buf_reserve(buf, CONFIG_BT_HCI_RESERVE);
bt_buf_set_type(buf, BT_BUF_ACL_OUT);

hdr = net_buf_add(buf, sizeof(*hdr));
*hdr = *le_hdr;

Expand Down

0 comments on commit f311684

Please sign in to comment.