AM64x MCU+ SDK  10.00.00
enet_queue.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2020
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
47 #ifndef ENET_QUEUE_H_
48 #define ENET_QUEUE_H_
49 
50 /* ========================================================================== */
51 /* Include Files */
52 /* ========================================================================== */
53 
54 #include <stdint.h>
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 /* ========================================================================== */
61 /* Macros */
62 /* ========================================================================== */
63 
64 /* None */
65 
66 /* ========================================================================== */
67 /* Structures and Enums */
68 /* ========================================================================== */
69 
73 typedef struct EnetQ_Node_s
74 {
76  struct EnetQ_Node_s *next;
77 } EnetQ_Node;
78 
82 typedef struct EnetQ_s
83 {
85  uint32_t count;
86 
89 
92 
94  uint32_t magic;
95 } EnetQ;
96 
97 /* ========================================================================== */
98 /* Global Variables Declarations */
99 /* ========================================================================== */
100 
101 /* None */
102 
103 /* ========================================================================== */
104 /* Function Declarations */
105 /* ========================================================================== */
106 
115 
125 void EnetQueue_copyQ(EnetQ *dstQueue,
126  const EnetQ *srcQueue);
127 
137  EnetQ_Node *node);
138 
148  EnetQ_Node *node);
149 
161 
171 void EnetQueue_append(EnetQ *dstQueue,
172  EnetQ *srcQueue);
173 
184 
194 
195 /* ========================================================================== */
196 /* Deprecated Function Declarations */
197 /* ========================================================================== */
198 
199 /* None */
200 
201 /* ========================================================================== */
202 /* Static Function Definitions */
203 /* ========================================================================== */
204 
205 /* None */
206 
207 #ifdef __cplusplus
208 }
209 #endif
210 
211 #endif /* ENET_QUEUE_H_ */
212 
EnetQueue_enqHead
void EnetQueue_enqHead(EnetQ *queue, EnetQ_Node *node)
Enqueue a packet at head into the queue.
EnetQueue_initQ
void EnetQueue_initQ(EnetQ *queue)
Init queue.
EnetQueue_verifyQCount
void EnetQueue_verifyQCount(EnetQ *queue)
Checks queue corruption.
EnetQueue_append
void EnetQueue_append(EnetQ *dstQueue, EnetQ *srcQueue)
Append queue.
EnetQueue_getQCount
uint32_t EnetQueue_getQCount(EnetQ *queue)
Get queue count.
EnetQ::head
EnetQ_Node * head
Definition: enet_queue.h:88
EnetQ::count
uint32_t count
Definition: enet_queue.h:85
EnetQueue_deq
EnetQ_Node * EnetQueue_deq(EnetQ *queue)
Dequeue a packet from the queue.
EnetQ_Node
A generic node structure for a single link list.
Definition: enet_queue.h:74
EnetQueue_enq
void EnetQueue_enq(EnetQ *queue, EnetQ_Node *node)
Enqueue a packet into the queue.
EnetQ_Node::next
struct EnetQ_Node_s * next
Definition: enet_queue.h:76
queue
uint16_t queue
Definition: tisci_rm_ra.h:6
EnetQ::magic
uint32_t magic
Definition: enet_queue.h:94
EnetQueue_copyQ
void EnetQueue_copyQ(EnetQ *dstQueue, const EnetQ *srcQueue)
Copy queues.
EnetQ
Generic queue.
Definition: enet_queue.h:83
EnetQ::tail
EnetQ_Node * tail
Definition: enet_queue.h:91