Lines Matching full:buf
23 #include <zephyr/bluetooth/buf.h>
57 struct net_buf *buf; in hci_ipc_cmd_recv() local
64 buf = bt_buf_get_tx(BT_BUF_CMD, K_NO_WAIT, hdr, sizeof(*hdr)); in hci_ipc_cmd_recv()
65 if (buf) { in hci_ipc_cmd_recv()
75 net_buf_unref(buf); in hci_ipc_cmd_recv()
79 if (remaining > net_buf_tailroom(buf)) { in hci_ipc_cmd_recv()
81 net_buf_unref(buf); in hci_ipc_cmd_recv()
86 net_buf_add_mem(buf, data, remaining); in hci_ipc_cmd_recv()
88 return buf; in hci_ipc_cmd_recv()
94 struct net_buf *buf; in hci_ipc_acl_recv() local
101 buf = bt_buf_get_tx(BT_BUF_ACL_OUT, K_NO_WAIT, hdr, sizeof(*hdr)); in hci_ipc_acl_recv()
102 if (buf) { in hci_ipc_acl_recv()
112 net_buf_unref(buf); in hci_ipc_acl_recv()
116 if (remaining > net_buf_tailroom(buf)) { in hci_ipc_acl_recv()
118 net_buf_unref(buf); in hci_ipc_acl_recv()
123 net_buf_add_mem(buf, data, remaining); in hci_ipc_acl_recv()
125 return buf; in hci_ipc_acl_recv()
131 struct net_buf *buf; in hci_ipc_iso_recv() local
138 buf = bt_buf_get_tx(BT_BUF_ISO_OUT, K_NO_WAIT, hdr, sizeof(*hdr)); in hci_ipc_iso_recv()
139 if (buf) { in hci_ipc_iso_recv()
149 net_buf_unref(buf); in hci_ipc_iso_recv()
153 if (remaining > net_buf_tailroom(buf)) { in hci_ipc_iso_recv()
155 net_buf_unref(buf); in hci_ipc_iso_recv()
160 net_buf_add_mem(buf, data, remaining); in hci_ipc_iso_recv()
162 return buf; in hci_ipc_iso_recv()
168 struct net_buf *buf = NULL; in hci_ipc_rx() local
178 buf = hci_ipc_cmd_recv(data, remaining); in hci_ipc_rx()
182 buf = hci_ipc_acl_recv(data, remaining); in hci_ipc_rx()
186 buf = hci_ipc_iso_recv(data, remaining); in hci_ipc_rx()
194 if (buf) { in hci_ipc_rx()
195 k_fifo_put(&tx_queue, buf); in hci_ipc_rx()
197 LOG_HEXDUMP_DBG(buf->data, buf->len, "Final net buffer:"); in hci_ipc_rx()
204 struct net_buf *buf; in tx_thread() local
208 buf = k_fifo_get(&tx_queue, K_FOREVER); in tx_thread()
210 err = bt_send(buf); in tx_thread()
213 net_buf_unref(buf); in tx_thread()
223 static void hci_ipc_send(struct net_buf *buf, bool is_fatal_err) in hci_ipc_send() argument
229 LOG_DBG("buf %p type %u len %u", buf, bt_buf_get_type(buf), buf->len); in hci_ipc_send()
231 LOG_HEXDUMP_DBG(buf->data, buf->len, "Controller buffer:"); in hci_ipc_send()
233 switch (bt_buf_get_type(buf)) { in hci_ipc_send()
244 LOG_ERR("Unknown type %u", bt_buf_get_type(buf)); in hci_ipc_send()
245 net_buf_unref(buf); in hci_ipc_send()
248 net_buf_push_u8(buf, pkt_indicator); in hci_ipc_send()
250 LOG_HEXDUMP_DBG(buf->data, buf->len, "Final HCI buffer:"); in hci_ipc_send()
253 ret = ipc_service_send(&hci_ept, buf->data, buf->len); in hci_ipc_send()
289 net_buf_unref(buf); in hci_ipc_send()
302 struct net_buf *buf; in bt_ctlr_assert_handle() local
304 buf = hci_vs_err_assert(file, line); in bt_ctlr_assert_handle()
305 if (buf != NULL) { in bt_ctlr_assert_handle()
307 hci_ipc_send(buf, HCI_FATAL_ERR_MSG); in bt_ctlr_assert_handle()
341 struct net_buf *buf; in k_sys_fatal_error_handler() local
343 buf = hci_vs_err_stack_frame(reason, esf); in k_sys_fatal_error_handler()
344 if (buf != NULL) { in k_sys_fatal_error_handler()
345 hci_ipc_send(buf, HCI_FATAL_ERR_MSG); in k_sys_fatal_error_handler()
421 struct net_buf *buf; in main() local
423 buf = k_fifo_get(&rx_queue, K_FOREVER); in main()
424 hci_ipc_send(buf, HCI_REGULAR_MSG); in main()