AM261x MCU+ SDK: dwc_queue.h Source File

| AM261x MCU+ SDK 26.00.00 |

dwc_queue.h
Go to the documentation of this file.
1
6 /*
7 * Copyright (C) 2025 Texas Instruments Incorporated
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the
19 * distribution.
20 *
21 * Neither the name of Texas Instruments Incorporated nor the names of
22 * its contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
39 #ifndef _DWC_QUEUE_NORTOS_H_
40 #define _DWC_QUEUE_NORTOS_H_
41
42 #include <stdint.h>
43 #include <stdbool.h>
44 #include <stdlib.h>
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 #define DWC_QUEUE_SIZE (8U)
51
57 typedef struct {
58 uint32_t buffer[DWC_QUEUE_SIZE];
59 uint16_t front;
60 uint16_t rear;
61 }dwc_queue_t;
62
63 void dwc_queueInit(dwc_queue_t *queue);
64 bool dwc_queuePut(dwc_queue_t *queue, uint32_t data);
65 bool dwc_queueGet(dwc_queue_t *queue, uint32_t *data);
66
67
68 #ifdef __cplusplus
69 }
70 #endif
71
72 #endif /* _DWC_QUEUE_NORTOS_H_ */
dwc_queueInit
void dwc_queueInit(dwc_queue_t *queue)
This routine initializes the queue.
Definition: dwc_queue.c:51
dwc_queue_t::rear
uint16_t rear
Definition: dwc_queue.h:60
dwc_queueGet
bool dwc_queueGet(dwc_queue_t *queue, uint32_t *data)
This routine retrieves an elements from the queue.
Definition: dwc_queue.c:92
DWC_QUEUE_SIZE
#define DWC_QUEUE_SIZE
Definition: dwc_queue.h:50
dwc_queue_t::front
uint16_t front
Definition: dwc_queue.h:59
dwc_queuePut
bool dwc_queuePut(dwc_queue_t *queue, uint32_t data)
This routine adds an element to the queue.
Definition: dwc_queue.c:66
dwc_queue_t
A structure representing a queue for managing data.
Definition: dwc_queue.h:57