1
1
/*
2
- * Copyright 2022, UNSW (ABN 57 195 873 179)
2
+ * Copyright 2022, UNSW
3
3
*
4
4
* SPDX-License-Identifier: BSD-2-Clause
5
5
*/
6
6
7
- #pragma once
7
+ #pragma once
8
8
9
9
#include <stdint.h>
10
10
#include <stddef.h>
@@ -46,7 +46,7 @@ typedef struct ring_handle {
46
46
* @param used pointer to 'used' ring in shared memory.
47
47
* @param notify function pointer used to notify the other user.
48
48
* @param buffer_init 1 indicates the read and write indices in shared memory need to be initialised.
49
- * 0 inidicates they do not. Only one side of the shared memory regions needs to do this.
49
+ * 0 inidicates they do not. Only one side of the shared memory regions needs to do this.
50
50
*/
51
51
void ring_init (ring_handle_t * ring , ring_buffer_t * avail , ring_buffer_t * used , notify_fn notify , int buffer_init );
52
52
@@ -57,7 +57,7 @@ void ring_init(ring_handle_t *ring, ring_buffer_t *avail, ring_buffer_t *used, n
57
57
*
58
58
* @return true indicates the buffer is empty, false otherwise.
59
59
*/
60
- static inline int ring_empty (ring_buffer_t * ring )
60
+ static inline int ring_empty (ring_buffer_t * ring )
61
61
{
62
62
return !((ring -> write_idx - ring -> read_idx ) % CONFIG_LIB_SHARED_RINGBUFFER_DESC_COUNT );
63
63
}
@@ -91,7 +91,7 @@ static inline void notify(ring_handle_t *ring)
91
91
* @param ring Ring buffer to enqueue into.
92
92
* @param buffer address into shared memory where data is stored.
93
93
* @param len length of data inside the buffer above.
94
- * @param cookie optional pointer to data required on dequeueing.
94
+ * @param cookie optional pointer to data required on dequeueing.
95
95
*
96
96
* @return -1 when ring is empty, 0 on success.
97
97
*/
@@ -118,7 +118,7 @@ static inline int enqueue(ring_buffer_t *ring, uintptr_t buffer, unsigned int le
118
118
* @param ring Ring buffer to Dequeue from.
119
119
* @param buffer pointer to the address of where to store buffer address.
120
120
* @param len pointer to variable to store length of data dequeueing.
121
- * @param cookie pointer optional pointer to data required on dequeueing.
121
+ * @param cookie pointer optional pointer to data required on dequeueing.
122
122
*
123
123
* @return -1 when ring is empty, 0 on success.
124
124
*/
@@ -141,16 +141,16 @@ static inline int dequeue(ring_buffer_t *ring, uintptr_t *addr, unsigned int *le
141
141
142
142
/**
143
143
* Enqueue an element into an available ring buffer.
144
- * This indicates the buffer address parameter is currently available for use.
144
+ * This indicates the buffer address parameter is currently available for use.
145
145
*
146
146
* @param ring Ring handle to enqueue into.
147
147
* @param buffer address into shared memory where data is stored.
148
148
* @param len length of data inside the buffer above.
149
- * @param cookie optional pointer to data required on dequeueing.
149
+ * @param cookie optional pointer to data required on dequeueing.
150
150
*
151
151
* @return -1 when ring is empty, 0 on success.
152
152
*/
153
- static inline int enqueue_avail (ring_handle_t * ring , uintptr_t addr , unsigned int len , void * cookie )
153
+ static inline int enqueue_avail (ring_handle_t * ring , uintptr_t addr , unsigned int len , void * cookie )
154
154
{
155
155
return enqueue (ring -> avail_ring , addr , len , cookie );
156
156
}
@@ -162,11 +162,11 @@ static inline int enqueue_avail(ring_handle_t *ring, uintptr_t addr, unsigned in
162
162
* @param ring Ring handle to enqueue into.
163
163
* @param buffer address into shared memory where data is stored.
164
164
* @param len length of data inside the buffer above.
165
- * @param cookie optional pointer to data required on dequeueing.
165
+ * @param cookie optional pointer to data required on dequeueing.
166
166
*
167
167
* @return -1 when ring is empty, 0 on success.
168
168
*/
169
- static inline int enqueue_used (ring_handle_t * ring , uintptr_t addr , unsigned int len , void * cookie )
169
+ static inline int enqueue_used (ring_handle_t * ring , uintptr_t addr , unsigned int len , void * cookie )
170
170
{
171
171
return enqueue (ring -> used_ring , addr , len , cookie );
172
172
}
@@ -177,7 +177,7 @@ static inline int enqueue_used(ring_handle_t *ring, uintptr_t addr, unsigned int
177
177
* @param ring Ring handle to dequeue from.
178
178
* @param buffer pointer to the address of where to store buffer address.
179
179
* @param len pointer to variable to store length of data dequeueing.
180
- * @param cookie pointer optional pointer to data required on dequeueing.
180
+ * @param cookie pointer optional pointer to data required on dequeueing.
181
181
*
182
182
* @return -1 when ring is empty, 0 on success.
183
183
*/
@@ -192,7 +192,7 @@ static inline int dequeue_avail(ring_handle_t *ring, uintptr_t *addr, unsigned i
192
192
* @param ring Ring handle to dequeue from.
193
193
* @param buffer pointer to the address of where to store buffer address.
194
194
* @param len pointer to variable to store length of data dequeueing.
195
- * @param cookie pointer optional pointer to data required on dequeueing.
195
+ * @param cookie pointer optional pointer to data required on dequeueing.
196
196
*
197
197
* @return -1 when ring is empty, 0 on success.
198
198
*/
@@ -204,7 +204,7 @@ static inline int dequeue_used(ring_handle_t *ring, uintptr_t *addr, unsigned in
204
204
/**
205
205
* Dequeue an element from a ring buffer.
206
206
* This function is intended for use by the driver, to collect a pointer
207
- * into this structure to be passed around as a cookie.
207
+ * into this structure to be passed around as a cookie.
208
208
*
209
209
* @param ring Ring buffer to dequeue from.
210
210
* @param addr pointer to the address of where to store buffer address.
@@ -230,4 +230,4 @@ static int driver_dequeue(ring_buffer_t *ring, uintptr_t *addr, unsigned int *le
230
230
ring -> read_idx ++ ;
231
231
232
232
return 0 ;
233
- }
233
+ }
0 commit comments