FreeCalypso > hg > fc-selenite
comparison src/g23m-aci/gdd_dio/gdd_dio_queue.h @ 1:d393cd9bb723
src/g23m-*: initial import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 15 Jul 2018 04:40:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:b6a5e36de839 | 1:d393cd9bb723 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | File : gdd_dio_queue.h | |
4 +----------------------------------------------------------------------------- | |
5 | Copyright 2002 Texas Instruments Berlin, AG | |
6 | All rights reserved. | |
7 | | |
8 | This file is confidential and a trade secret of Texas | |
9 | Instruments Berlin, AG | |
10 | The receipt of or possession of this file does not convey | |
11 | any rights to reproduce or disclose its contents or to | |
12 | manufacture, use, or sell anything it may describe, in | |
13 | whole, or in part, without the specific written consent of | |
14 | Texas Instruments Berlin, AG. | |
15 +----------------------------------------------------------------------------- | |
16 | Purpose : Definitions for gdd_dio_queue.c | |
17 +----------------------------------------------------------------------------- | |
18 */ | |
19 | |
20 #ifndef GDD_DIO_QUEUE_H | |
21 #define GDD_DIO_QUEUE_H | |
22 | |
23 /*==== INCLUDES =============================================================*/ | |
24 | |
25 #include "gdd.h" | |
26 | |
27 #include "p_dio.h" | |
28 | |
29 | |
30 /*==== DEFINITIONS ==========================================================*/ | |
31 | |
32 /** | |
33 * Maximum numbers of simultaneous DIO buffers provided by PSI. | |
34 * Might be increased at one stage in the future. | |
35 */ | |
36 #define GDD_MAX_DIO_BUF 2 | |
37 | |
38 /** | |
39 * Definition of buffer queue | |
40 */ | |
41 typedef struct | |
42 { | |
43 T_dio_buffer * elems[GDD_MAX_DIO_BUF]; | |
44 U16 next_in; | |
45 U16 next_out; | |
46 } T_GDD_BUF_QUEUE; | |
47 | |
48 | |
49 /*==== EXPORTS ===============================================================*/ | |
50 | |
51 /* | |
52 +------------------------------------------------------------------------------ | |
53 | Function : gdd_dio_queue_clear | |
54 +------------------------------------------------------------------------------ | |
55 | Description : Clear a queue | |
56 | | |
57 | Parameters : queue - pointer to queue to be cleared | |
58 | | |
59 +------------------------------------------------------------------------------ | |
60 */ | |
61 EXTERN void gdd_dio_queue_clear(T_GDD_BUF_QUEUE *queue); | |
62 | |
63 | |
64 /* | |
65 +------------------------------------------------------------------------------ | |
66 | Function : gdd_dio_queue_is_empty | |
67 +------------------------------------------------------------------------------ | |
68 | Description : Check if a queue is empty | |
69 | | |
70 | Parameters : queue - pointer to queue to be checked | |
71 | | |
72 | Return : TRUE if queue is empty, FALSE otherwise | |
73 +------------------------------------------------------------------------------ | |
74 */ | |
75 EXTERN BOOL gdd_dio_queue_is_empty(const T_GDD_BUF_QUEUE *queue); | |
76 | |
77 | |
78 /* | |
79 +------------------------------------------------------------------------------ | |
80 | Function : gdd_dio_queue_is_full | |
81 +------------------------------------------------------------------------------ | |
82 | Description : Check if a queue is full | |
83 | | |
84 | Parameters : queue - pointer to queue to be checked | |
85 | | |
86 | Return : TRUE if queue is full, FALSE otherwise | |
87 +------------------------------------------------------------------------------ | |
88 */ | |
89 EXTERN BOOL gdd_dio_queue_is_full(const T_GDD_BUF_QUEUE *queue); | |
90 | |
91 | |
92 /* | |
93 +------------------------------------------------------------------------------ | |
94 | Function : gdd_dio_enqueue | |
95 +------------------------------------------------------------------------------ | |
96 | Description : Enqueue an item into the queue | |
97 | | |
98 | Parameters : elem - item to be enqueued | |
99 | queue - pointer to queue to be modified | |
100 | pos - to return the position of the enqueued item | |
101 | | |
102 | Return : TRUE if item is enqueued, FALSE if the queue is already full | |
103 +------------------------------------------------------------------------------ | |
104 */ | |
105 EXTERN BOOL gdd_dio_enqueue(T_dio_buffer *elem, T_GDD_BUF_QUEUE *queue, /*out*/U16 *pos); | |
106 | |
107 | |
108 /* | |
109 +------------------------------------------------------------------------------ | |
110 | Function : gdd_dio_dequeue | |
111 +------------------------------------------------------------------------------ | |
112 | Description : Dequeue an item into the queue | |
113 | | |
114 | Parameters : queue - pointer to queue to be modified | |
115 | elem - to return the dequeued item | |
116 | | |
117 | Return : TRUE if item is dequeued, FALSE if the queue is empty | |
118 +------------------------------------------------------------------------------ | |
119 */ | |
120 EXTERN BOOL gdd_dio_dequeue(T_GDD_BUF_QUEUE *queue, /*out*/T_dio_buffer **elem); | |
121 | |
122 /* | |
123 +------------------------------------------------------------------------------ | |
124 | Function : gdd_dio_queue_peek_next_for_dequeue | |
125 +------------------------------------------------------------------------------ | |
126 | Description : Retrieves the element that is next to dequeue without actually | |
127 | dequeuing it. | |
128 | | |
129 | Parameters : queue - pointer to queue | |
130 | pos - position of element | |
131 | elem - to output element value | |
132 | | |
133 | Return : TRUE if item is available, FALSE if the queue is empty | |
134 +------------------------------------------------------------------------------ | |
135 */ | |
136 EXTERN BOOL gdd_dio_queue_peek_next_for_dequeue | |
137 (const T_GDD_BUF_QUEUE *queue, T_dio_buffer **elem); | |
138 | |
139 /* | |
140 +------------------------------------------------------------------------------ | |
141 | Function : gdd_dio_queue_peek | |
142 +------------------------------------------------------------------------------ | |
143 | Description : Retrieve element at specified position | |
144 | | |
145 | Parameters : queue - pointer to queue | |
146 | pos - position of element | |
147 | elem - to output element value | |
148 | | |
149 | Attention : This function does not do bounds checking | |
150 +------------------------------------------------------------------------------ | |
151 */ | |
152 EXTERN void gdd_dio_queue_peek(const T_GDD_BUF_QUEUE *queue, U16 pos, /*out*/T_dio_buffer **elem); | |
153 | |
154 #endif /* !GDD_DIO_QUEUE_H */ | |
155 |