SYS/BIOS  7.00
Queue.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Texas Instruments Incorporated - http://www.ti.com
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the 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 "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
172 /*
173  * ======== Queue.h ========
174  */
175 
176 #ifndef ti_sysbios_knl_Queue__include
177 #define ti_sysbios_knl_Queue__include
178 
179 /* BIOS 6.x compatibility, use -Dxdc_std__include to disable */
181 #include <xdc/std.h>
184 #include <stdbool.h>
185 #include <stddef.h>
186 #include <stdint.h>
187 
189 
190 /* @cond NODOC */
191 #define ti_sysbios_knl_Queue_long_names
192 #include "Queue_defs.h"
195 #ifdef __cplusplus
196 extern "C" {
197 #endif
198 
204 typedef struct Queue_Elem {
210  struct Queue_Elem *volatile next;
216  struct Queue_Elem *volatile prev;
217 } Queue_Elem;
218 
220 typedef Queue_Struct Queue_Object;
221 typedef Queue_Struct *Queue_Handle;
222 
223 typedef struct {
228  uint32_t dummy; /* to make IAR happy */
230 } Queue_Params;
231 
233 extern void Queue_Instance_init(Queue_Object *obj, const Queue_Params *prms);
246 extern Queue_Handle Queue_create(const Queue_Params *prms, Error_Block *eb);
247 
260 extern Queue_Handle Queue_construct(Queue_Struct *obj, const Queue_Params *prms);
261 
271 extern void Queue_delete(Queue_Handle *queue);
272 
280 extern void Queue_destruct(Queue_Struct *obj);
281 
293 extern void Queue_Params_init(Queue_Params *prms);
294 
307 extern void Queue_elemClear(Queue_Elem *qelem);
317 extern void Queue_insert(Queue_Elem *qelem, Queue_Elem *elem);
318 
331 extern void * Queue_next(Queue_Elem *qelem);
332 
345 extern void * Queue_prev(Queue_Elem *qelem);
346 
355 extern void Queue_remove(Queue_Elem *qelem);
356 
366 extern bool Queue_isQueued(Queue_Elem *qelem);
396 extern void * Queue_dequeue(Queue_Handle queue);
397 
405 extern bool Queue_empty(Queue_Handle queue);
406 
413 extern void Queue_enqueue(Queue_Handle queue, Queue_Elem *elem);
414 
435 extern void * Queue_get(Queue_Handle queue);
436 
456 extern void * Queue_getTail(Queue_Handle queue);
457 
476 extern void * Queue_head(Queue_Handle queue);
477 
484 extern void Queue_put(Queue_Handle queue, Queue_Elem *elem);
485 
492 extern void Queue_putHead(Queue_Handle queue, Queue_Elem *elem);
493 
495 static inline Queue_Handle Queue_handle(Queue_Struct *str)
496 {
497  return ((Queue_Handle)str);
498 }
499 
500 static inline Queue_Struct * Queue_struct(Queue_Handle handle)
501 {
502  return ((Queue_Struct *)handle);
503 }
506 #ifdef __cplusplus
507 }
508 #endif
509 #endif /* ti_sysbios_knl_Queue__include */
510 
511 /* @cond NODOC */
512 #undef ti_sysbios_knl_Queue_long_names
513 #include "Queue_defs.h"
void Queue_Params_init(Queue_Params *prms)
Initialize the Queue_Params structure with default values.
bool Queue_empty(Queue_Handle queue)
Test for an empty queue.
void Queue_put(Queue_Handle queue, Queue_Elem *elem)
Put element at end of queue (atomically).
Queue_Handle Queue_create(const Queue_Params *prms, Error_Block *eb)
Create a Queue object.
void Queue_insert(Queue_Elem *qelem, Queue_Elem *elem)
Insert elem in the queue in front of qelem.
struct Queue_Elem Queue_Elem
Opaque queue element.
Opaque queue element.
Definition: Queue.h:204
void Queue_remove(Queue_Elem *qelem)
Remove qelem from middle of queue (non-atomically).
Runtime error manager.
Queue_Elem Queue_Struct
Definition: Queue.h:219
void * Queue_prev(Queue_Elem *qelem)
Return previous element in queue (non-atomically).
void * Queue_get(Queue_Handle queue)
Get element from front of queue (atomically).
Definition: Queue.h:223
Error block.
Definition: Error.h:152
void * Queue_head(Queue_Handle queue)
Return element at front of queue. (atomically)
void Queue_destruct(Queue_Struct *obj)
Destruct a queue.
void * Queue_dequeue(Queue_Handle queue)
Remove the element from the front of queue and return elem (non- atomically).
void Queue_delete(Queue_Handle *queue)
Delete a queue.
struct Queue_Elem *volatile next
Opaque queue element.
Definition: Queue.h:210
struct Queue_Elem *volatile prev
Opaque queue element.
Definition: Queue.h:216
Queue_Struct * Queue_Handle
Definition: Queue.h:221
void Queue_putHead(Queue_Handle queue, Queue_Elem *elem)
Put element at the front of the queue (atomically).
Queue_Handle Queue_construct(Queue_Struct *obj, const Queue_Params *prms)
Construct a queue.
Queue_Struct Queue_Object
Definition: Queue.h:220
void * Queue_next(Queue_Elem *qelem)
Return next element in queue (non-atomically).
void Queue_enqueue(Queue_Handle queue, Queue_Elem *elem)
Insert at end of queue (non-atomically).
void * Queue_getTail(Queue_Handle queue)
Get the element at the end of the queue (atomically).
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale