Lines Matching refs:buf
60 struct net_buf *buf; in hci_ipc_cmd_recv() local
67 buf = bt_buf_get_tx(BT_BUF_CMD, K_NO_WAIT, hdr, sizeof(*hdr)); in hci_ipc_cmd_recv()
68 if (buf) { in hci_ipc_cmd_recv()
78 net_buf_unref(buf); in hci_ipc_cmd_recv()
82 if (remaining > net_buf_tailroom(buf)) { in hci_ipc_cmd_recv()
84 net_buf_unref(buf); in hci_ipc_cmd_recv()
89 net_buf_add_mem(buf, data, remaining); in hci_ipc_cmd_recv()
91 return buf; in hci_ipc_cmd_recv()
97 struct net_buf *buf; in hci_ipc_acl_recv() local
104 buf = bt_buf_get_tx(BT_BUF_ACL_OUT, K_NO_WAIT, hdr, sizeof(*hdr)); in hci_ipc_acl_recv()
105 if (buf) { in hci_ipc_acl_recv()
115 net_buf_unref(buf); in hci_ipc_acl_recv()
119 if (remaining > net_buf_tailroom(buf)) { in hci_ipc_acl_recv()
121 net_buf_unref(buf); in hci_ipc_acl_recv()
126 net_buf_add_mem(buf, data, remaining); in hci_ipc_acl_recv()
128 return buf; in hci_ipc_acl_recv()
134 struct net_buf *buf; in hci_ipc_iso_recv() local
141 buf = bt_buf_get_tx(BT_BUF_ISO_OUT, K_NO_WAIT, hdr, sizeof(*hdr)); in hci_ipc_iso_recv()
142 if (buf) { in hci_ipc_iso_recv()
152 net_buf_unref(buf); in hci_ipc_iso_recv()
156 if (remaining > net_buf_tailroom(buf)) { in hci_ipc_iso_recv()
158 net_buf_unref(buf); in hci_ipc_iso_recv()
163 net_buf_add_mem(buf, data, remaining); in hci_ipc_iso_recv()
165 return buf; in hci_ipc_iso_recv()
171 struct net_buf *buf = NULL; in hci_ipc_rx() local
181 buf = hci_ipc_cmd_recv(data, remaining); in hci_ipc_rx()
185 buf = hci_ipc_acl_recv(data, remaining); in hci_ipc_rx()
189 buf = hci_ipc_iso_recv(data, remaining); in hci_ipc_rx()
197 if (buf) { in hci_ipc_rx()
198 k_fifo_put(&tx_queue, buf); in hci_ipc_rx()
200 LOG_HEXDUMP_DBG(buf->data, buf->len, "Final net buffer:"); in hci_ipc_rx()
207 struct net_buf *buf; in tx_thread() local
211 buf = k_fifo_get(&tx_queue, K_FOREVER); in tx_thread()
213 err = bt_send(buf); in tx_thread()
216 net_buf_unref(buf); in tx_thread()
226 static void hci_ipc_send(struct net_buf *buf, bool is_fatal_err) in hci_ipc_send() argument
232 LOG_DBG("buf %p type %u len %u", buf, bt_buf_get_type(buf), buf->len); in hci_ipc_send()
234 LOG_HEXDUMP_DBG(buf->data, buf->len, "Controller buffer:"); in hci_ipc_send()
236 switch (bt_buf_get_type(buf)) { in hci_ipc_send()
247 LOG_ERR("Unknown type %u", bt_buf_get_type(buf)); in hci_ipc_send()
248 net_buf_unref(buf); in hci_ipc_send()
251 net_buf_push_u8(buf, pkt_indicator); in hci_ipc_send()
253 LOG_HEXDUMP_DBG(buf->data, buf->len, "Final HCI buffer:"); in hci_ipc_send()
256 ret = ipc_service_send(&hci_ept, buf->data, buf->len); in hci_ipc_send()
292 net_buf_unref(buf); in hci_ipc_send()
305 struct net_buf *buf; in bt_ctlr_assert_handle() local
307 buf = hci_vs_err_assert(file, line); in bt_ctlr_assert_handle()
308 if (buf != NULL) { in bt_ctlr_assert_handle()
310 hci_ipc_send(buf, HCI_FATAL_ERR_MSG); in bt_ctlr_assert_handle()
344 struct net_buf *buf; in k_sys_fatal_error_handler() local
346 buf = hci_vs_err_stack_frame(reason, esf); in k_sys_fatal_error_handler()
347 if (buf != NULL) { in k_sys_fatal_error_handler()
348 hci_ipc_send(buf, HCI_FATAL_ERR_MSG); in k_sys_fatal_error_handler()
424 struct net_buf *buf; in main() local
426 buf = k_fifo_get(&rx_queue, K_FOREVER); in main()
427 hci_ipc_send(buf, HCI_REGULAR_MSG); in main()