diff --git a/include/bluetooth/hci_raw.h b/include/bluetooth/hci_raw.h index 02f8908e8589..34df366dc160 100644 --- a/include/bluetooth/hci_raw.h +++ b/include/bluetooth/hci_raw.h @@ -52,7 +52,7 @@ int bt_send(struct net_buf *buf); * * @return Zero on success or (negative) error code otherwise. */ -int bt_enable_raw(struct nano_fifo *rx_queue); +int bt_enable_raw(struct k_fifo *rx_queue); #ifdef __cplusplus } diff --git a/include/bluetooth/rfcomm.h b/include/bluetooth/rfcomm.h index 5470f817cf4e..f4ec1a736efa 100644 --- a/include/bluetooth/rfcomm.h +++ b/include/bluetooth/rfcomm.h @@ -85,7 +85,7 @@ typedef enum bt_rfcomm_role { /** @brief RFCOMM DLC structure. */ struct bt_rfcomm_dlc { /* Queue for outgoing data */ - struct nano_fifo tx_queue; + struct k_fifo tx_queue; /** TX credits */ struct k_sem tx_credits; @@ -171,7 +171,7 @@ int bt_rfcomm_dlc_send(struct bt_rfcomm_dlc *dlc, struct net_buf *buf); * * @return New buffer. */ -struct net_buf *bt_rfcomm_create_pdu(struct nano_fifo *fifo); +struct net_buf *bt_rfcomm_create_pdu(struct k_fifo *fifo); #ifdef __cplusplus } diff --git a/samples/bluetooth/hci_uart/src/main.c b/samples/bluetooth/hci_uart/src/main.c index 160c131a5f6f..96ae91a42546 100644 --- a/samples/bluetooth/hci_uart/src/main.c +++ b/samples/bluetooth/hci_uart/src/main.c @@ -46,7 +46,7 @@ static uint8_t tx_fiber_stack[STACK_SIZE]; sizeof(struct bt_hci_cmd_hdr) + \ CONFIG_BLUETOOTH_MAX_CMD_LEN) -static struct nano_fifo avail_cmd_tx; +static struct k_fifo avail_cmd_tx; static NET_BUF_POOL(cmd_tx_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT, CMD_BUF_SIZE, &avail_cmd_tx, NULL, BT_BUF_USER_DATA_MIN); @@ -63,11 +63,12 @@ static NET_BUF_POOL(cmd_tx_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT, CMD_BUF_SIZE, #define TX_BUF_COUNT 6 #endif -static struct nano_fifo avail_acl_tx; +static struct k_fifo avail_acl_tx; + static NET_BUF_POOL(acl_tx_pool, TX_BUF_COUNT, BT_BUF_ACL_SIZE, &avail_acl_tx, NULL, BT_BUF_USER_DATA_MIN); -static struct nano_fifo tx_queue; +static struct k_fifo tx_queue; #define H4_CMD 0x01 #define H4_ACL 0x02 @@ -356,7 +357,7 @@ DEVICE_INIT(hci_uart, "hci_uart", &hci_uart_init, NULL, NULL, void main(void) { /* incoming events and data from the controller */ - static struct nano_fifo rx_queue; + static struct k_fifo rx_queue; int err; SYS_LOG_DBG("Start"); @@ -365,8 +366,8 @@ void main(void) net_buf_pool_init(cmd_tx_pool); net_buf_pool_init(acl_tx_pool); /* Initialize the FIFOs */ - nano_fifo_init(&tx_queue); - nano_fifo_init(&rx_queue); + k_fifo_init(&tx_queue); + k_fifo_init(&rx_queue); task_fiber_start(tx_fiber_stack, STACK_SIZE, (nano_fiber_entry_t)tx_fiber, 0, 0, 7, 0); diff --git a/samples/bluetooth/hci_usb/src/main.c b/samples/bluetooth/hci_usb/src/main.c index e408eb2bc204..26f626abc742 100644 --- a/samples/bluetooth/hci_usb/src/main.c +++ b/samples/bluetooth/hci_usb/src/main.c @@ -81,14 +81,14 @@ static struct device *btusb_dev; #define DEV_DATA(dev) \ ((struct btusb_dev_data_t * const)(dev)->driver_data) -static struct nano_fifo rx_queue; +static struct k_fifo rx_queue; /* HCI command buffers */ #define CMD_BUF_SIZE (CONFIG_BLUETOOTH_HCI_SEND_RESERVE + \ sizeof(struct bt_hci_cmd_hdr) + \ CONFIG_BLUETOOTH_MAX_CMD_LEN) -static struct nano_fifo avail_tx; +static struct k_fifo avail_tx; static NET_BUF_POOL(tx_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT, CMD_BUF_SIZE, &avail_tx, NULL, sizeof(uint8_t)); @@ -99,7 +99,7 @@ static NET_BUF_POOL(tx_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT, CMD_BUF_SIZE, 4 /* L2CAP header size */ + \ BT_L2CAP_MTU) -static struct nano_fifo avail_acl_tx; +static struct k_fifo avail_acl_tx; static NET_BUF_POOL(acl_tx_pool, 2, BT_BUF_ACL_SIZE, &avail_acl_tx, NULL, sizeof(uint8_t)); @@ -697,7 +697,7 @@ void main(void) /* Initialize the buffer pools */ net_buf_pool_init(tx_pool); net_buf_pool_init(acl_tx_pool); - nano_fifo_init(&rx_queue); + k_fifo_init(&rx_queue); bt_enable_raw(&rx_queue); diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 79f34c917b20..558130e67e02 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -68,7 +68,7 @@ struct bt_attr_data { }; /* Pool for incoming ATT packets, MTU is 23 */ -static struct nano_fifo prep_data; +static struct k_fifo prep_data; static NET_BUF_POOL(prep_pool, CONFIG_BLUETOOTH_ATT_PREPARE_COUNT, CONFIG_BLUETOOTH_ATT_MTU, &prep_data, NULL, sizeof(struct bt_attr_data)); @@ -82,7 +82,7 @@ struct bt_att { sys_slist_t reqs; struct nano_delayed_work timeout_work; #if CONFIG_BLUETOOTH_ATT_PREPARE_COUNT > 0 - struct nano_fifo prep_queue; + struct k_fifo prep_queue; #endif }; @@ -91,7 +91,7 @@ static struct bt_att bt_req_pool[CONFIG_BLUETOOTH_MAX_CONN]; /* * Pool for outgoing ATT requests packets. */ -static struct nano_fifo req_data; +static struct k_fifo req_data; static NET_BUF_POOL(req_pool, CONFIG_BLUETOOTH_ATT_REQ_COUNT, BT_L2CAP_BUF_SIZE(CONFIG_BLUETOOTH_ATT_MTU), &req_data, NULL, BT_BUF_USER_DATA_MIN); @@ -102,7 +102,7 @@ static NET_BUF_POOL(req_pool, CONFIG_BLUETOOTH_ATT_REQ_COUNT, * may only be freed after a response is received which would never happen if * the RX fiber is waiting a buffer causing a deadlock. */ -static struct nano_fifo rsp_data; +static struct k_fifo rsp_data; static NET_BUF_POOL(rsp_pool, 1, BT_L2CAP_BUF_SIZE(CONFIG_BLUETOOTH_ATT_MTU), &rsp_data, NULL, BT_BUF_USER_DATA_MIN); @@ -1285,7 +1285,7 @@ static uint8_t att_prep_write_rsp(struct bt_att *att, uint16_t handle, } /* Store buffer in the outstanding queue */ - nano_fifo_put(&att->prep_queue, data.buf); + k_fifo_put(&att->prep_queue, data.buf); /* Generate response */ data.buf = bt_att_create_pdu(conn, BT_ATT_OP_PREPARE_WRITE_RSP, 0); @@ -1332,7 +1332,7 @@ static uint8_t att_exec_write_rsp(struct bt_att *att, uint8_t flags) struct net_buf *buf; uint8_t err = 0; - while ((buf = nano_fifo_get(&att->prep_queue, TICKS_NONE))) { + while ((buf = k_fifo_get(&att->prep_queue, K_NO_WAIT))) { struct bt_attr_data *data = net_buf_user_data(buf); /* Just discard the data if an error was set */ @@ -1816,7 +1816,7 @@ static void att_reset(struct bt_att *att) struct net_buf *buf; /* Discard queued buffers */ - while ((buf = nano_fifo_get(&att->prep_queue, TICKS_NONE))) { + while ((buf = k_fifo_get(&att->prep_queue, K_NO_WAIT))) { net_buf_unref(buf); } #endif @@ -1874,7 +1874,7 @@ static void bt_att_connected(struct bt_l2cap_chan *chan) BT_DBG("chan %p cid 0x%04x", ch, ch->tx.cid); #if CONFIG_BLUETOOTH_ATT_PREPARE_COUNT > 0 - nano_fifo_init(&att->prep_queue); + k_fifo_init(&att->prep_queue); #endif ch->tx.mtu = BT_ATT_DEFAULT_LE_MTU; diff --git a/subsys/bluetooth/host/avdtp.c b/subsys/bluetooth/host/avdtp.c index 40a499be6892..59154bf4b0c5 100644 --- a/subsys/bluetooth/host/avdtp.c +++ b/subsys/bluetooth/host/avdtp.c @@ -40,7 +40,7 @@ #define CONFIG_BLUETOOTH_AVDTP_CONN CONFIG_BLUETOOTH_MAX_CONN /* Pool for outgoing BR/EDR signaling packets, min MTU is 48 */ -static struct nano_fifo avdtp_sig; +static struct k_fifo avdtp_sig; static NET_BUF_POOL(avdtp_sig_pool, CONFIG_BLUETOOTH_AVDTP_CONN, BT_AVDTP_BUF_SIZE(BT_AVDTP_MIN_MTU), &avdtp_sig, NULL, BT_BUF_USER_DATA_MIN); diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index afc923eec4e5..6563760d091b 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -45,12 +45,12 @@ #endif /* Pool for outgoing ACL fragments */ -static struct nano_fifo frag_buf; +static struct k_fifo frag_buf; static NET_BUF_POOL(frag_pool, 1, BT_L2CAP_BUF_SIZE(23), &frag_buf, NULL, BT_BUF_USER_DATA_MIN); /* Pool for dummy buffers to wake up the tx fibers */ -static struct nano_fifo dummy; +static struct k_fifo dummy; static NET_BUF_POOL(dummy_pool, CONFIG_BLUETOOTH_MAX_CONN, 0, &dummy, NULL, 0); /* How long until we cancel HCI_LE_Create_Connection */ @@ -1112,7 +1112,7 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state) /* Actions needed for entering the new state */ switch (conn->state) { case BT_CONN_CONNECTED: - nano_fifo_init(&conn->tx_queue); + k_fifo_init(&conn->tx_queue); fiber_start(conn->stack, sizeof(conn->stack), conn_tx_fiber, (int)bt_conn_ref(conn), 0, 7, 0); @@ -1555,7 +1555,7 @@ int bt_conn_le_conn_update(struct bt_conn *conn, return bt_hci_cmd_send(BT_HCI_OP_LE_CONN_UPDATE, buf); } -struct net_buf *bt_conn_create_pdu(struct nano_fifo *fifo, size_t reserve) +struct net_buf *bt_conn_create_pdu(struct k_fifo *fifo, size_t reserve) { size_t head_reserve = reserve + sizeof(struct bt_hci_acl_hdr) + CONFIG_BLUETOOTH_HCI_SEND_RESERVE; diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index f33382d9b1b4..2859289fada4 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -94,7 +94,7 @@ struct bt_conn { struct net_buf *rx; /* Queue for outgoing ACL data */ - struct nano_fifo tx_queue; + struct k_fifo tx_queue; /* L2CAP channels */ void *channels; @@ -179,7 +179,7 @@ void bt_conn_security_changed(struct bt_conn *conn); #endif /* CONFIG_BLUETOOTH_SMP || CONFIG_BLUETOOTH_BREDR */ /* Prepare a PDU to be sent over a connection */ -struct net_buf *bt_conn_create_pdu(struct nano_fifo *fifo, size_t reserve); +struct net_buf *bt_conn_create_pdu(struct k_fifo *fifo, size_t reserve); /* Initialize connection management */ int bt_conn_init(void); diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 7cfa5d12a349..b62916f5c1e3 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -108,13 +108,13 @@ struct acl_data { #define CMD_BUF_SIZE (CONFIG_BLUETOOTH_HCI_SEND_RESERVE + \ sizeof(struct bt_hci_cmd_hdr) + \ CONFIG_BLUETOOTH_MAX_CMD_LEN) -static struct nano_fifo avail_hci_cmd; +static struct k_fifo avail_hci_cmd; static NET_BUF_POOL(hci_cmd_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT, CMD_BUF_SIZE, &avail_hci_cmd, NULL, sizeof(struct cmd_data)); #if defined(CONFIG_BLUETOOTH_HOST_BUFFERS) /* HCI event buffers */ -static struct nano_fifo avail_hci_evt; +static struct k_fifo avail_hci_evt; static NET_BUF_POOL(hci_evt_pool, CONFIG_BLUETOOTH_HCI_EVT_COUNT, BT_BUF_EVT_SIZE, &avail_hci_evt, NULL, BT_BUF_USER_DATA_MIN); @@ -124,7 +124,7 @@ static NET_BUF_POOL(hci_evt_pool, CONFIG_BLUETOOTH_HCI_EVT_COUNT, * Complete Packets) if running low on buffers. Buffers from this pool are not * allowed to be passed to RX fiber and must be returned from bt_recv(). */ -static struct nano_fifo avail_prio_hci_evt; +static struct k_fifo avail_prio_hci_evt; static NET_BUF_POOL(hci_evt_prio_pool, 1, BT_BUF_EVT_SIZE, &avail_prio_hci_evt, NULL, BT_BUF_USER_DATA_MIN); @@ -141,7 +141,7 @@ static void report_completed_packet(struct net_buf *buf) uint16_t handle = acl(buf)->handle; struct bt_hci_handle_count *hc; - nano_fifo_put(buf->free, buf); + k_fifo_put(buf->free, buf); /* Do nothing if controller to host flow control is not supported */ if (!(bt_dev.supported_commands[10] & 0x20)) { @@ -167,7 +167,7 @@ static void report_completed_packet(struct net_buf *buf) bt_hci_cmd_send(BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS, buf); } -static struct nano_fifo avail_acl_in; +static struct k_fifo avail_acl_in; static NET_BUF_POOL(acl_in_pool, CONFIG_BLUETOOTH_ACL_IN_COUNT, BT_BUF_ACL_IN_SIZE, &avail_acl_in, report_completed_packet, sizeof(struct acl_data)); @@ -3655,12 +3655,12 @@ int bt_enable(bt_ready_cb_t cb) #endif /* !CONFIG_BLUETOOTH_WAIT_NOP */ /* TX fiber */ - nano_fifo_init(&bt_dev.cmd_tx_queue); + k_fifo_init(&bt_dev.cmd_tx_queue); fiber_start(cmd_tx_fiber_stack, sizeof(cmd_tx_fiber_stack), (nano_fiber_entry_t)hci_cmd_tx_fiber, 0, 0, 7, 0); /* RX fiber */ - nano_fifo_init(&bt_dev.rx_queue); + k_fifo_init(&bt_dev.rx_queue); fiber_start(rx_fiber_stack, sizeof(rx_fiber_stack), (nano_fiber_entry_t)hci_rx_fiber, (int)cb, 0, 7, 0); diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index 2f96b364fda4..126aa504be25 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -110,16 +110,16 @@ struct bt_dev { struct net_buf *sent_cmd; /* Queue for incoming HCI events & ACL data */ - struct nano_fifo rx_queue; + struct k_fifo rx_queue; /* Queue for high priority HCI events which may unlock waiters * in other fibers. Such events include Number of Completed * Packets, as well as the Command Complete/Status events. */ - struct nano_fifo rx_prio_queue; + struct k_fifo rx_prio_queue; /* Queue for outgoing HCI commands */ - struct nano_fifo cmd_tx_queue; + struct k_fifo cmd_tx_queue; /* Registered HCI driver */ struct bt_hci_driver *drv; diff --git a/subsys/bluetooth/host/hci_ecc.c b/subsys/bluetooth/host/hci_ecc.c index 7bbb06e03c32..0ecc9587ab6f 100644 --- a/subsys/bluetooth/host/hci_ecc.c +++ b/subsys/bluetooth/host/hci_ecc.c @@ -55,7 +55,7 @@ static const uint8_t debug_public_key[64] = { }; #endif -static struct nano_fifo ecc_queue; +static struct k_fifo ecc_queue; static bool ecc_queue_ready; static int (*drv_send)(struct net_buf *buf); static uint32_t private_key[8]; @@ -210,7 +210,7 @@ static void ecc_queue_init(void) mask = irq_lock(); if (!ecc_queue_ready) { - nano_fifo_init(&ecc_queue); + k_fifo_init(&ecc_queue); ecc_queue_ready = true; } @@ -224,7 +224,7 @@ static void ecc_task(void) while (true) { struct net_buf *buf; - buf = nano_task_fifo_get(&ecc_queue, TICKS_UNLIMITED); + buf = k_fifo_get(&ecc_queue, K_FOREVER); switch (bt_hci_get_cmd_opcode(buf)) { case BT_HCI_OP_LE_P256_PUBLIC_KEY: diff --git a/subsys/bluetooth/host/hci_raw.c b/subsys/bluetooth/host/hci_raw.c index b19fdb5073ea..35a173927496 100644 --- a/subsys/bluetooth/host/hci_raw.c +++ b/subsys/bluetooth/host/hci_raw.c @@ -24,16 +24,16 @@ #include "monitor.h" -static struct nano_fifo *raw_rx; +static struct k_fifo *raw_rx; /* ACL incoming buffers */ -static struct nano_fifo avail_acl_in; +static struct k_fifo avail_acl_in; static NET_BUF_POOL(acl_in_pool, CONFIG_BLUETOOTH_ACL_IN_COUNT, BT_BUF_ACL_IN_SIZE, &avail_acl_in, NULL, sizeof(uint8_t)); /* HCI event buffers */ -static struct nano_fifo avail_hci_evt; +static struct k_fifo avail_hci_evt; static NET_BUF_POOL(hci_evt_pool, CONFIG_BLUETOOTH_HCI_EVT_COUNT, BT_BUF_EVT_SIZE, &avail_hci_evt, NULL, sizeof(uint8_t)); @@ -113,7 +113,7 @@ int bt_send(struct net_buf *buf) return bt_dev.drv->send(buf); } -int bt_enable_raw(struct nano_fifo *rx_queue) +int bt_enable_raw(struct k_fifo *rx_queue) { struct bt_hci_driver *drv = bt_dev.drv; int err; diff --git a/subsys/bluetooth/host/hfp_hf.c b/subsys/bluetooth/host/hfp_hf.c index dc7422f711c3..fd129dcbe178 100644 --- a/subsys/bluetooth/host/hfp_hf.c +++ b/subsys/bluetooth/host/hfp_hf.c @@ -39,7 +39,7 @@ struct bt_hfp_hf_cb *bt_hf; -static struct nano_fifo hf_fifo; +static struct k_fifo hf_fifo; static NET_BUF_POOL(hf_pool, CONFIG_BLUETOOTH_MAX_CONN + 1, BT_RFCOMM_BUF_SIZE(BLUETOOTH_HF_CLIENT_MAX_PDU), &hf_fifo, NULL, BT_BUF_USER_DATA_MIN); diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index a6a99d463dcd..461db9d5fe86 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -80,14 +80,14 @@ static struct bt_l2cap_server *servers; #endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */ /* Pool for outgoing LE signaling packets, MTU is 23 */ -static struct nano_fifo le_sig; +static struct k_fifo le_sig; static NET_BUF_POOL(le_sig_pool, CONFIG_BLUETOOTH_MAX_CONN, BT_L2CAP_BUF_SIZE(L2CAP_LE_MIN_MTU), &le_sig, NULL, BT_BUF_USER_DATA_MIN); #if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) /* Pool for outgoing LE data packets, MTU is 23 */ -static struct nano_fifo le_data; +static struct k_fifo le_data; static NET_BUF_POOL(le_data_pool, CONFIG_BLUETOOTH_MAX_CONN, BT_L2CAP_BUF_SIZE(BT_L2CAP_MAX_LE_MPS), &le_data, NULL, BT_BUF_USER_DATA_MIN); @@ -506,7 +506,7 @@ void bt_l2cap_encrypt_change(struct bt_conn *conn, uint8_t hci_status) } } -struct net_buf *bt_l2cap_create_pdu(struct nano_fifo *fifo, size_t reserve) +struct net_buf *bt_l2cap_create_pdu(struct k_fifo *fifo, size_t reserve) { return bt_conn_create_pdu(fifo, sizeof(struct bt_l2cap_hdr) + reserve); } diff --git a/subsys/bluetooth/host/l2cap_br.c b/subsys/bluetooth/host/l2cap_br.c index 0846eeac03c1..e00aa52219f3 100644 --- a/subsys/bluetooth/host/l2cap_br.c +++ b/subsys/bluetooth/host/l2cap_br.c @@ -102,7 +102,7 @@ static struct bt_l2cap_server *br_servers; static struct bt_l2cap_fixed_chan *br_fixed_channels; /* Pool for outgoing BR/EDR signaling packets, min MTU is 48 */ -static struct nano_fifo br_sig; +static struct k_fifo br_sig; static NET_BUF_POOL(br_sig_pool, CONFIG_BLUETOOTH_MAX_CONN, BT_L2CAP_BUF_SIZE(L2CAP_BR_MIN_MTU), &br_sig, NULL, BT_BUF_USER_DATA_MIN); diff --git a/subsys/bluetooth/host/l2cap_internal.h b/subsys/bluetooth/host/l2cap_internal.h index d751775e0b4c..13665da455f5 100644 --- a/subsys/bluetooth/host/l2cap_internal.h +++ b/subsys/bluetooth/host/l2cap_internal.h @@ -249,7 +249,7 @@ void bt_l2cap_chan_set_state(struct bt_l2cap_chan *chan, void bt_l2cap_encrypt_change(struct bt_conn *conn, uint8_t hci_status); /* Prepare an L2CAP PDU to be sent over a connection */ -struct net_buf *bt_l2cap_create_pdu(struct nano_fifo *fifo, size_t reserve); +struct net_buf *bt_l2cap_create_pdu(struct k_fifo *fifo, size_t reserve); /* Send L2CAP PDU over a connection */ void bt_l2cap_send(struct bt_conn *conn, uint16_t cid, struct net_buf *buf); diff --git a/subsys/bluetooth/host/rfcomm.c b/subsys/bluetooth/host/rfcomm.c index 4920290140b7..3c0419bc4899 100644 --- a/subsys/bluetooth/host/rfcomm.c +++ b/subsys/bluetooth/host/rfcomm.c @@ -54,13 +54,13 @@ static struct bt_rfcomm_server *servers; /* Pool for outgoing RFCOMM control packets, min MTU is 23 */ -static struct nano_fifo rfcomm_session; +static struct k_fifo rfcomm_session; static NET_BUF_POOL(rfcomm_session_pool, CONFIG_BLUETOOTH_MAX_CONN, BT_RFCOMM_BUF_SIZE(RFCOMM_MIN_MTU), &rfcomm_session, NULL, BT_BUF_USER_DATA_MIN); /* Pool for dummy buffers to wake up the tx fibers */ -static struct nano_fifo dummy; +static struct k_fifo dummy; static NET_BUF_POOL(dummy_pool, CONFIG_BLUETOOTH_MAX_CONN, 0, &dummy, NULL, 0); #define RFCOMM_SESSION(_ch) CONTAINER_OF(_ch, \ @@ -307,7 +307,7 @@ static void rfcomm_session_disconnected(struct bt_rfcomm_session *session) session->dlcs = NULL; } -struct net_buf *bt_rfcomm_create_pdu(struct nano_fifo *fifo) +struct net_buf *bt_rfcomm_create_pdu(struct k_fifo *fifo) { /* Length in RFCOMM header can be 2 bytes depending on length of user * data @@ -564,7 +564,7 @@ static void rfcomm_dlc_connected(struct bt_rfcomm_dlc *dlc) rfcomm_send_msc(dlc, BT_RFCOMM_MSG_CMD_CR); - nano_fifo_init(&dlc->tx_queue); + k_fifo_init(&dlc->tx_queue); fiber_start(dlc->stack, sizeof(dlc->stack), rfcomm_dlc_tx_fiber, (int)dlc, 0, 7, 0); diff --git a/subsys/bluetooth/host/sdp.c b/subsys/bluetooth/host/sdp.c index c8fd801e0840..d608fc63e96a 100644 --- a/subsys/bluetooth/host/sdp.c +++ b/subsys/bluetooth/host/sdp.c @@ -44,7 +44,7 @@ struct bt_sdp { struct bt_l2cap_br_chan chan; - struct nano_fifo partial_resp_queue; + struct k_fifo partial_resp_queue; /* TODO: Allow more than one pending request */ }; @@ -54,7 +54,7 @@ static uint8_t num_services; static struct bt_sdp bt_sdp_pool[CONFIG_BLUETOOTH_MAX_CONN]; /* Pool for outgoing SDP packets */ -static struct nano_fifo sdp_buf; +static struct k_fifo sdp_buf; static NET_BUF_POOL(sdp_pool, CONFIG_BLUETOOTH_MAX_CONN, BT_L2CAP_BUF_SIZE(SDP_MTU), &sdp_buf, NULL, BT_BUF_USER_DATA_MIN); @@ -77,7 +77,7 @@ static void bt_sdp_connected(struct bt_l2cap_chan *chan) BT_DBG("chan %p cid 0x%04x", ch, ch->tx.cid); - nano_fifo_init(&sdp->partial_resp_queue); + k_fifo_init(&sdp->partial_resp_queue); ch->tx.mtu = SDP_MTU; ch->rx.mtu = SDP_MTU; diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 2b80dc611ad0..319f63126952 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -240,7 +240,7 @@ static struct bt_smp_br bt_smp_br_pool[CONFIG_BLUETOOTH_MAX_CONN]; #endif /* CONFIG_BLUETOOTH_BREDR */ /* Pool for outgoing LE signaling packets, MTU is 65 */ -static struct nano_fifo smp_buf; +static struct k_fifo smp_buf; static NET_BUF_POOL(smp_pool, CONFIG_BLUETOOTH_MAX_CONN, BT_L2CAP_BUF_SIZE(65), &smp_buf, NULL, BT_BUF_USER_DATA_MIN); diff --git a/subsys/bluetooth/host/smp_null.c b/subsys/bluetooth/host/smp_null.c index ecb4294c36b9..08fb8c7ee8e4 100644 --- a/subsys/bluetooth/host/smp_null.c +++ b/subsys/bluetooth/host/smp_null.c @@ -38,7 +38,7 @@ static struct bt_l2cap_le_chan bt_smp_pool[CONFIG_BLUETOOTH_MAX_CONN]; /* Pool for outgoing SMP signaling packets, MTU is 23 */ -static struct nano_fifo smp_buf; +static struct k_fifo smp_buf; static NET_BUF_POOL(smp_pool, CONFIG_BLUETOOTH_MAX_CONN, BT_L2CAP_BUF_SIZE(23), &smp_buf, NULL, BT_BUF_USER_DATA_MIN); diff --git a/tests/bluetooth/shell/src/main.c b/tests/bluetooth/shell/src/main.c index 4d399ff834bc..8d94546bbe44 100644 --- a/tests/bluetooth/shell/src/main.c +++ b/tests/bluetooth/shell/src/main.c @@ -57,12 +57,12 @@ static bt_addr_le_t id_addr; /* Connection context for BR/EDR legacy pairing in sec mode 3 */ static struct bt_conn *pairing_conn; -static struct nano_fifo data_fifo; +static struct k_fifo data_fifo; static NET_BUF_POOL(data_pool, 1, DATA_MTU, &data_fifo, NULL, BT_BUF_USER_DATA_MIN); #if defined(CONFIG_BLUETOOTH_BREDR) -static struct nano_fifo data_bredr_fifo; +static struct k_fifo data_bredr_fifo; static NET_BUF_POOL(data_bredr_pool, 1, DATA_BREDR_MTU, &data_bredr_fifo, NULL, BT_BUF_USER_DATA_MIN); diff --git a/tests/bluetooth/tester/src/bttester.c b/tests/bluetooth/tester/src/bttester.c index 465aea802731..ffad1c8f73ca 100644 --- a/tests/bluetooth/tester/src/bttester.c +++ b/tests/bluetooth/tester/src/bttester.c @@ -34,8 +34,8 @@ static char __stack stack[STACKSIZE]; #define CMD_QUEUED 2 static uint8_t cmd_buf[CMD_QUEUED * BTP_MTU]; -static struct nano_fifo cmds_queue; -static struct nano_fifo avail_queue; +static struct k_fifo cmds_queue; +static struct k_fifo avail_queue; static void supported_commands(uint8_t *data, uint16_t len) { @@ -132,7 +132,7 @@ static void cmd_handler(int arg1, int arg2) struct btp_hdr *cmd; uint16_t len; - cmd = nano_fiber_fifo_get(&cmds_queue, TICKS_UNLIMITED); + cmd = k_fifo_get(&cmds_queue, TICKS_UNLIMITED); len = sys_le16_to_cpu(cmd->len); @@ -189,14 +189,14 @@ static uint8_t *recv_cb(uint8_t *buf, size_t *off) return buf; } - new_buf = nano_fifo_get(&avail_queue, TICKS_NONE); + new_buf = k_fifo_get(&avail_queue, K_NO_WAIT); if (!new_buf) { SYS_LOG_ERR("BT tester: RX overflow"); *off = 0; return buf; } - nano_fifo_put(&cmds_queue, buf); + k_fifo_put(&cmds_queue, buf); *off = 0; return new_buf; @@ -206,16 +206,16 @@ void tester_init(void) { int i; - nano_fifo_init(&cmds_queue); - nano_fifo_init(&avail_queue); + k_fifo_init(&cmds_queue); + k_fifo_init(&avail_queue); for (i = 0; i < CMD_QUEUED; i++) { - nano_fifo_put(&avail_queue, &cmd_buf[i * BTP_MTU]); + k_fifo_put(&avail_queue, &cmd_buf[i * BTP_MTU]); } task_fiber_start(stack, STACKSIZE, cmd_handler, 0, 0, 7, 0); - uart_pipe_register(nano_fifo_get(&avail_queue, TICKS_NONE), + uart_pipe_register(k_fifo_get(&avail_queue, K_NO_WAIT), BTP_MTU, recv_cb); tester_send(BTP_SERVICE_ID_CORE, CORE_EV_IUT_READY, BTP_INDEX_NONE, diff --git a/tests/bluetooth/tester/src/gatt.c b/tests/bluetooth/tester/src/gatt.c index 03163f69745e..704b40010a41 100644 --- a/tests/bluetooth/tester/src/gatt.c +++ b/tests/bluetooth/tester/src/gatt.c @@ -62,7 +62,7 @@ static struct bt_gatt_attr server_db[SERVER_MAX_ATTRIBUTES]; static struct net_buf *server_buf; -static struct nano_fifo server_fifo; +static struct k_fifo server_fifo; static NET_BUF_POOL(server_pool, 1, SERVER_BUF_SIZE, &server_fifo, NULL, 0); static uint8_t attr_count; diff --git a/tests/bluetooth/tester/src/l2cap.c b/tests/bluetooth/tester/src/l2cap.c index 26e6ef1f6082..10ceaba06dbe 100644 --- a/tests/bluetooth/tester/src/l2cap.c +++ b/tests/bluetooth/tester/src/l2cap.c @@ -28,7 +28,7 @@ #define CHANNELS 2 #define SERVERS 1 -static struct nano_fifo data_fifo; +static struct k_fifo data_fifo; static NET_BUF_POOL(data_pool, 1, DATA_MTU, &data_fifo, NULL, BT_BUF_USER_DATA_MIN);