1 /*
2  * Copyright (c) 2020 Demant
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 struct ull_tx_q {
8 	uint8_t pause_data; /* Data pause state of the tx queue */
9 
10 	sys_slist_t tx_list; /* Data and control node_tx list */
11 	sys_slist_t data_list; /* Data node_tx wait list */
12 };
13 
14 /* Forward declaration of node_tx */
15 struct node_tx;
16 
17 /**
18  * @brief Initialize a tx queue.
19  *
20  * @param ull_tx_q Address of tx queue.
21  */
22 void ull_tx_q_init(struct ull_tx_q *queue);
23 
24 /**
25  * @brief Pause the data path of a tx queue.
26  *
27  * @param ull_tx_q Address of tx queue.
28  */
29 void ull_tx_q_pause_data(struct ull_tx_q *queue);
30 
31 /**
32  * @brief Resume the data path of a tx queue
33  *
34  * @param ull_tx_q Address of tx queue.
35  */
36 void ull_tx_q_resume_data(struct ull_tx_q *queue);
37 
38 /**
39  * @brief Enqueue a tx node in the data path of a tx queue
40  *
41  * @param ull_tx_q Address of tx queue.
42  * @param tx Address of tx node to enqueue.
43  */
44 void ull_tx_q_enqueue_data(struct ull_tx_q *queue, struct node_tx *tx);
45 
46 /**
47  * @brief Enqueue a tx node in the control path of a tx queue
48  *
49  * @param ull_tx_q Address of tx queue.
50  * @param tx Address of tx node to enqueue.
51  */
52 void ull_tx_q_enqueue_ctrl(struct ull_tx_q *queue, struct node_tx *tx);
53 
54 /**
55  * @brief Peek head tx node of tx queue.
56  *
57  * @param ull_tx_q Address of tx queue.
58  *
59  * @return Head tx node of the tx queue.
60  */
61 struct node_tx *ull_tx_q_peek(struct ull_tx_q *queue);
62 
63 /**
64  * @brief Dequeue a tx node from a tx queue.
65  *
66  * @param ull_tx_q Address of tx queue.
67  *
68  * @return Head tx node of the tx queue.
69  */
70 struct node_tx *ull_tx_q_dequeue(struct ull_tx_q *queue);
71