VSF Documented
vsf_queue.h
Go to the documentation of this file.
1/****************************************************************************
2* Copyright 2020 by Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
3* *
4* Licensed under the Apache License, Version 2.0 (the "License"); *
5* you may not use this file except in compliance with the License. *
6* You may obtain a copy of the License at *
7* *
8* http://www.apache.org/licenses/LICENSE-2.0 *
9* *
10* Unless required by applicable law or agreed to in writing, software *
11* distributed under the License is distributed on an "AS IS" BASIS, *
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13* See the License for the specific language governing permissions and *
14* limitations under the License. *
15* *
16****************************************************************************/
17
18/*****************************************************************************
19 * Copyright(C)2009-2022 by VSF Team *
20 * *
21 * Licensed under the Apache License, Version 2.0 (the "License"); *
22 * you may not use this file except in compliance with the License. *
23 * You may obtain a copy of the License at *
24 * *
25 * http://www.apache.org/licenses/LICENSE-2.0 *
26 * *
27 * Unless required by applicable law or agreed to in writing, software *
28 * distributed under the License is distributed on an "AS IS" BASIS, *
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
30 * See the License for the specific language governing permissions and *
31 * limitations under the License. *
32 * *
33 ****************************************************************************/
34
35#ifndef __VSF_RING_BUFFER_H__
36#define __VSF_RING_BUFFER_H__
37
38/* example:
39
40 // 0. Include vsf header file
41 #include "vsf.h"
42
43 // 1. Declare the ring buffer
44 declare_vsf_rng_buf(<ring buffer name>);
45
46 // 2. Defining your ring buffer variable with specific type
47 def_vsf_rng_buf(<ring buffer name>, <item type>)
48
49 // 3. Implement your ring buffer with specific atom access protection macro:
50 implement_vsf_rng_buf(<ring buffer name>, <item type>, <atom access macro>)
51
52 NOTE: You can use vsf_interrupt_safe_simple for interrupt, use __vsf_sched_safe for
53 scheduler, use NO_RNG_BUF_PROTECT for no protection
54
55 // 4. Defining your ring buffer variable
56 VSF_CAL_NO_INIT static <ring buffer name> <ring buffer var>;
57
58 // 5. Initialise a ring buffer with specific ring buffer buffer
59 vsf_rng_buf_init( <ring buffer name>, <item type>, <address of ring buffer var>, <item count>);
60
61 // 6. If you want to initialise a ring buffer with a given buffer, use vsf_rng_buf_prepare
62 rather than vsf_rng_buf_init above:
63 vsf_rng_buf_prepare( <ring buffer name>,
64 <address of ring buffer var>,
65 <address of buffer>,
66 <size of ring buffer buffer> );
67
68 // 7. Use following macro for enqueue, dequeue and peek one item:
69 vsf_rng_buf_send( <ring buffer name>,
70 <address of ring buffer var>,
71 <Item>);
72 vsf_rng_buf_get( <ring buffer name>,
73 <address of ring buffer var>,
74 <address of item buffer>);
75 vsf_rng_buf_peek( <ring buffer name>,
76 <address of ring buffer var>,
77 <address of item pointer>);
78
79 NOTE: Peek returns a reference to existing data in the ring buffer, there is no copy access
80
81 // 8. Use following macro for enqueue, dequeue and peek multiple items:
82 vsf_rng_buf_send( <ring buffer name>,
83 <address of ring buffer var>,
84 <address of item buffer>,
85 <number of Items>);
86 vsf_rng_buf_get( <ring buffer name>,
87 <address of ring buffer var>,
88 <address of item buffer>,
89 <number of Items>);
90 vsf_rng_buf_peek( <ring buffer name>,
91 <address of ring buffer var>,
92 <address of item pointer>,
93 <number of Items>);
94
95 NOTE: Peek returns a reference to existing data in the ring buffer, there is no copy access
96
97 // 9. You can get the number of items within a ring buffer:
98 vsf_rng_buf_count( <ring buffer name>, <address of ring buffer var> )
99
100 // 10. You can get the number of peekable items withi a ring buffer
101 vsf_rng_buf_peekable_count( <ring buffer name>, <address of ring buffer var> )
102
103 // 11. You can reset the peek access
104 vsf_rng_buf_reset_peek( <ring buffer name>, <address of ring buffer var> )
105
106 // 12. You can also remove all peeked items from the queue
107 vsf_rng_buf_get_all_peeked( <ring buffer name>, <address of ring buffer var> )
108
109 Example:
110
111
112 declare_vsf_rng_buf(my_hword_queue_t)
113 def_vsf_rng_buf(my_hword_queue_t, uint16_t)
114
115 implement_vsf_rng_buf(my_hword_queue_t, uint16_t, NO_RNG_BUF_PROTECT)
116
117
118 void vsf_ring_buffer_example(void)
119 {
120 VSF_CAL_NO_INIT static my_hword_queue_t __queue;
121
122 static uint16_t __temp[] = { 0x1234, 0x5678 };
123 static uint16_t __item;
124
125 //VSF_CAL_NO_INIT static uint8_t s_chQueueBuffer[1024];
126 //vsf_rng_buf_prepare(my_hword_queue_t, &__queue, &s_chQueueBuffer, sizeof(s_chQueueBuffer));
127
128 vsf_rng_buf_init(my_hword_queue_t, uint16_t, &__queue, 32);
129
130 vsf_rng_buf_send(my_hword_queue_t, &__queue, 0x1234);
131
132
133 vsf_rng_buf_send(my_hword_queue_t, &__queue, __temp, dimof(__temp));
134
135 vsf_rng_buf_get(my_hword_queue_t, &__queue, __temp, dimof(__temp));
136 vsf_rng_buf_get(my_hword_queue_t, &__queue, &__item);
137
138 const uint16_t* item_ref_ptr = NULL;
139 vsf_rng_buf_peek(my_hword_queue_t, &__queue, &item_ref_ptr, 2);
140 vsf_rng_buf_peek(my_hword_queue_t, &__queue, &item_ref_ptr);
141 }
142
143 */
144
145/*============================ INCLUDES ======================================*/
146
151#define __PLOOC_CLASS_USE_STRICT_TEMPLATE__
152
153#if defined(__VSF_QUEUE_CLASS_IMPLEMENT)
154# define __PLOOC_CLASS_IMPLEMENT__
155# undef __VSF_QUEUE_CLASS_IMPLEMENT
156#elif defined(__VSF_QUEUE_CLASS_INHERIT__)
157# define __PLOOC_CLASS_INHERIT__
158# undef __VSF_QUEUE_CLASS_INHERIT__
159#endif
160
161#include "utilities/ooc_class.h"
162
163#ifdef __cplusplus
164extern "C" {
165#endif
166
167/*============================ MACROS ========================================*/
168/*============================ MACROFIED FUNCTIONS ===========================*/
169
170
171
172#define __declare_vsf_rng_buf(__name) \
173 typedef struct __name __name; \
174 typedef struct __name##_cfg_t __name##_cfg_t;
175#define declare_vsf_rng_buf(__name) __declare_vsf_rng_buf(__name)
176
177
178#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
179
180# define NO_RNG_BUF_PROTECT(__CODE) __CODE
181# define no_rng_buf_protect(__code) __code
182
183# define __def_vsf_rng_buf(__name, __type) \
184 struct __name { \
185 implement(vsf_rng_buf_t) \
186 __type *buffer_ptr; \
187 }; \
188 \
189 struct __name##_cfg_t { \
190 __type *buffer_ptr; \
191 uint16_t size; \
192 bool is_init_as_full; \
193 }; \
194 \
195extern \
196void __name##_init(__name* queue_ptr, __name##_cfg_t* cfg_ptr); \
197 \
198extern \
199bool __name##_send_one(__name* queue_ptr, __type item); \
200 \
201extern \
202bool __name##_get_one(__name* queue_ptr, __type* item_ptr); \
203 \
204VSF_CAL_SECTION(".text." #__name "_item_count") \
205extern \
206uint_fast16_t __name##_item_count(__name* queue_ptr); \
207 \
208VSF_CAL_SECTION(".text." #__name "_send_multiple") \
209extern \
210int32_t __name##_send_multiple(__name* queue_ptr, \
211 const __type* item_ptr, \
212 uint16_t count); \
213 \
214VSF_CAL_SECTION(".text." #__name "_get_multiple") \
215extern \
216int32_t __name##_get_multiple( __name* queue_ptr, \
217 __type* item_ptr, \
218 uint16_t count); \
219 \
220VSF_CAL_SECTION(".text." #__name "_peek_one") \
221extern \
222bool __name##_peek_one(__name* queue_ptr, const __type** item_pptr); \
223 \
224VSF_CAL_SECTION(".text." #__name "_reset_peek") \
225extern \
226void __name##_reset_peek(__name *queue_ptr); \
227 \
228VSF_CAL_SECTION(".text." #__name "_get_all_peeked") \
229extern \
230void __name##_get_all_peeked(__name *queue_ptr); \
231 \
232VSF_CAL_SECTION(".text." #__name "_item_count_peekable") \
233extern \
234uint_fast16_t __name##_item_count_peekable(__name* queue_ptr); \
235 \
236VSF_CAL_SECTION(".text." #__name "_peek_multiple") \
237extern \
238int32_t __name##_peek_multiple( __name* queue_ptr, \
239 const __type** item_pptr, \
240 uint16_t count);
241
242# define def_vsf_rng_buf(__name, __type) \
243 __def_vsf_rng_buf(__name, __type)
244
245#else
246# define NO_RNG_BUF_PROTECT(...) __VA_ARGS__
247# define no_rng_buf_protect(...) __VA_ARGS__
248
249# define __def_vsf_rng_buf(__name, __type, ...) \
250 struct __name { \
251 implement(vsf_rng_buf_t) \
252 __type *buffer_ptr; \
253 __VA_ARGS__ \
254 }; \
255 \
256 struct __name##_cfg_t { \
257 __type *buffer_ptr; \
258 uint16_t size; \
259 bool is_init_as_full; \
260 }; \
261 \
262extern \
263void __name##_init(__name* queue_ptr, __name##_cfg_t* cfg_ptr); \
264 \
265extern \
266bool __name##_send_one(__name* queue_ptr, __type item); \
267 \
268extern \
269bool __name##_get_one(__name* queue_ptr, __type* item_ptr); \
270 \
271VSF_CAL_SECTION(".text." #__name "_item_count") \
272extern \
273uint_fast16_t __name##_item_count(__name* queue_ptr); \
274 \
275VSF_CAL_SECTION(".text." #__name "_send_multiple") \
276extern \
277int32_t __name##_send_multiple(__name* queue_ptr, \
278 const __type* item_ptr, \
279 uint16_t count); \
280 \
281VSF_CAL_SECTION(".text." #__name "_get_multiple") \
282extern \
283int32_t __name##_get_multiple( __name* queue_ptr, \
284 __type* item_ptr, \
285 uint16_t count); \
286 \
287VSF_CAL_SECTION(".text." #__name "_peek_one") \
288extern \
289bool __name##_peek_one(__name* queue_ptr, const __type** item_pptr); \
290 \
291VSF_CAL_SECTION(".text." #__name "_reset_peek") \
292extern \
293void __name##_reset_peek(__name *queue_ptr); \
294 \
295VSF_CAL_SECTION(".text." #__name "_get_all_peeked") \
296extern \
297void __name##_get_all_peeked(__name *queue_ptr); \
298 \
299VSF_CAL_SECTION(".text." #__name "_item_count_peekable") \
300extern \
301uint_fast16_t __name##_item_count_peekable(__name* queue_ptr); \
302 \
303VSF_CAL_SECTION(".text." #__name "_peek_multiple") \
304extern \
305int32_t __name##_peek_multiple( __name* queue_ptr, \
306 const __type** item_pptr, \
307 uint16_t count);
308
309# define def_vsf_rng_buf(__name, __type, ...) \
310 __def_vsf_rng_buf(__name, __type, __VA_ARGS__)
311
312#endif
313
314#define __implement_vsf_rng_buf(__name, __type, __queue_protect) \
315void __name##_init(__name* queue_ptr, __name##_cfg_t* cfg_ptr) \
316{ \
317 VSF_ASSERT(NULL != queue_ptr && NULL != cfg_ptr); \
318 VSF_ASSERT(NULL != cfg_ptr->buffer_ptr); \
319 VSF_ASSERT(cfg_ptr->size >= sizeof(__type)); \
320 queue_ptr->buffer_ptr = cfg_ptr->buffer_ptr; \
321 __vsf_rng_buf_init_ex(&(queue_ptr->use_as__vsf_rng_buf_t), \
322 cfg_ptr->size / sizeof(__type), \
323 cfg_ptr->is_init_as_full); \
324} \
325 \
326bool __name##_send_one(__name *queue_ptr, __type item) \
327{ \
328 bool result = false; \
329 VSF_ASSERT(NULL != queue_ptr); \
330 __queue_protect( \
331 do { \
332 int32_t index = \
333 __vsf_rng_buf_send_one(&(queue_ptr->use_as__vsf_rng_buf_t)); \
334 if (index < 0) { \
335 break; \
336 } \
337 queue_ptr->buffer_ptr[index] = item; \
338 result = true; \
339 } while(0); \
340 ) \
341 \
342 return result; \
343} \
344 \
345bool __name##_get_one(__name * queue_ptr, __type *item_ptr) \
346{ \
347 bool result = false; \
348 VSF_ASSERT(NULL != queue_ptr); \
349 __queue_protect( \
350 do { \
351 int32_t index = \
352 __vsf_rng_buf_get_one(&(queue_ptr->use_as__vsf_rng_buf_t)); \
353 if (index < 0) { \
354 break; \
355 } \
356 if (NULL != item_ptr) { \
357 *item_ptr = queue_ptr->buffer_ptr[index]; \
358 } \
359 result = true; \
360 } while (0); \
361 ) \
362 \
363 return result; \
364} \
365 \
366VSF_CAL_SECTION(".text." #__name "_item_count") \
367uint_fast16_t __name##_item_count(__name * queue_ptr) \
368{ \
369 VSF_ASSERT(NULL != queue_ptr); \
370 return __vsf_rng_buf_item_count(&(queue_ptr->use_as__vsf_rng_buf_t)); \
371} \
372 \
373VSF_CAL_SECTION(".text." #__name "_send_multiple") \
374int32_t __name##_send_multiple( __name * queue_ptr, \
375 const __type*item_ptr, \
376 uint16_t count) \
377{ \
378 int32_t result = -1, index = 0; \
379 VSF_ASSERT(NULL != queue_ptr); \
380 __queue_protect( \
381 do { \
382 if (NULL == item_ptr || 0 == count) { \
383 break; \
384 } \
385 index = \
386 __vsf_rng_buf_send_multiple(&(queue_ptr->use_as__vsf_rng_buf_t),\
387 &count); \
388 if (index < 0) { \
389 break; \
390 } \
391 \
392 memcpy( &(queue_ptr->buffer_ptr[index]), \
393 item_ptr, \
394 count * sizeof(__type)); \
395 result = count; \
396 } while(0); \
397 ) \
398 return result; \
399} \
400 \
401VSF_CAL_SECTION(".text." #__name "_get_multiple") \
402int32_t __name##_get_multiple( __name * queue_ptr, \
403 __type* item_ptr, \
404 uint16_t count) \
405{ \
406 int32_t result = -1, index = 0; \
407 VSF_ASSERT(NULL != queue_ptr); \
408 __queue_protect( \
409 do { \
410 if (NULL == item_ptr || 0 == count) { \
411 break; \
412 } \
413 index = \
414 __vsf_rng_buf_get_multiple(&(queue_ptr->use_as__vsf_rng_buf_t), \
415 &count); \
416 if (index < 0) { \
417 break; \
418 } \
419 \
420 memcpy( item_ptr, \
421 &(queue_ptr->buffer_ptr[index]), \
422 count * sizeof(__type)); \
423 result = count; \
424 } while(0); \
425 ) \
426 return result; \
427} \
428 \
429VSF_CAL_SECTION(".text." #__name "_peek_one") \
430bool __name##_peek_one(__name *queue_ptr, const __type** item_pptr) \
431{ \
432 bool result = false; \
433 VSF_ASSERT(NULL != queue_ptr); \
434 __queue_protect( \
435 do { \
436 int32_t index = __vsf_rng_buf_peek_one( \
437 &(queue_ptr->use_as__vsf_rng_buf_t)); \
438 if (index < 0) { \
439 break; \
440 } \
441 if (NULL != item_pptr) { \
442 (*item_pptr) = (const __type*)&queue_ptr->buffer_ptr[index]; \
443 } \
444 result = true; \
445 } while (0); \
446 ) \
447 \
448 return result; \
449} \
450 \
451VSF_CAL_SECTION(".text." #__name "_reset_peek") \
452void __name##_reset_peek(__name *queue_ptr) \
453{ \
454 VSF_ASSERT(NULL != queue_ptr); \
455 __queue_protect( \
456 __vsf_rng_buf_reset_peek(&(queue_ptr->use_as__vsf_rng_buf_t)); \
457 ) \
458} \
459 \
460VSF_CAL_SECTION(".text." #__name "_get_all_peeked") \
461void __name##_get_all_peeked(__name *queue_ptr) \
462{ \
463 VSF_ASSERT(NULL != queue_ptr); \
464 __queue_protect( \
465 __vsf_rng_buf_get_all_peeked(&(queue_ptr->use_as__vsf_rng_buf_t)); \
466 ) \
467} \
468 \
469VSF_CAL_SECTION(".text." #__name "_item_count_peekable") \
470uint_fast16_t __name##_item_count_peekable(__name *queue_ptr) \
471{ \
472 VSF_ASSERT(NULL != queue_ptr); \
473 return __vsf_rng_buf_item_count_peekable(&queue_ptr->use_as__vsf_rng_buf_t);\
474} \
475 \
476VSF_CAL_SECTION(".text." #__name "_peek_multiple") \
477int32_t __name##_peek_multiple( __name * queue_ptr, \
478 const __type** item_pptr, \
479 uint16_t count) \
480{ \
481 int32_t result = -1, index = 0; \
482 VSF_ASSERT(NULL != queue_ptr); \
483 __queue_protect( \
484 do { \
485 if (NULL == item_pptr || 0 == count) { \
486 break; \
487 } \
488 index = \
489 __vsf_rng_buf_peek_multiple(&(queue_ptr->use_as__vsf_rng_buf_t),\
490 &count); \
491 if (index < 0) { \
492 break; \
493 } \
494 \
495/*memcpy(item_ptr, &(queue_ptr->buffer_ptr[index]), count * sizeof(__type));*/ \
496 (*item_pptr) = (const __type*)&(queue_ptr->buffer_ptr[index]); \
497 result = count; \
498 } while(0); \
499 ) \
500 return result; \
501}
502
503
504#define implement_vsf_rng_buf(__name, __type, __queue_protect) \
505 __implement_vsf_rng_buf(__name, __type, __queue_protect)
506
507
508#define __vsf_rng_buf_init(__name, __type, __qaddr, __item_count) \
509 do { \
510 VSF_CAL_NO_INIT static uint16_t __buffer[(__item_count)]; \
511 __name##_cfg_t cfg = { \
512 __buffer, \
513 sizeof(__buffer), \
514 }; \
515 __name##_init((__qaddr), & cfg); \
516 } while(0)
517
518#define vsf_rng_buf_init(__name, __type, __qaddr, __item_count) \
519 __vsf_rng_buf_init(__name, __type, (__qaddr), (__item_count))
520
521
522
523#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
524
525#define __vsf_rng_buf_prepare(__name, __qaddr, __buffer, __size) \
526 do { \
527 __name##_cfg_t cfg = {0}; \
528 cfg.buffer_ptr = (__buffer); \
529 cfg.size = (__size); \
530 __name##_init((__qaddr), & cfg); \
531 } while(0)
532
533# define vsf_rng_buf_prepare(__name, __qaddr, __buffer, __size) \
534 __vsf_rng_buf_prepare(__name, (__qaddr), (__buffer), (__size))
535#else
536
537# define __vsf_rng_buf_prepare(__name, __qaddr, __buffer, __size, ...) \
538 do { \
539 __name##_cfg_t cfg = { \
540 (__buffer), \
541 (__size), \
542 __VA_ARGS__ \
543 }; \
544 __name##_init((__qaddr), & cfg); \
545 } while(0)
546
547# define vsf_rng_buf_prepare(__name, __qaddr, __buffer, __size, ...) \
548 __vsf_rng_buf_prepare( __name, \
549 (__qaddr), \
550 (__buffer), \
551 (__size), \
552 __VA_ARGS__)
553#endif
554
555#define __vsf_rng_buf_send_1(__name, __qaddr, __item) \
556 __name##_send_one((__qaddr), __item)
557
558#define __vsf_rng_buf_send_2(__name, __qaddr, __buffer, __size) \
559 __name##_send_multiple((__qaddr), (__buffer), (__size))
560
561#define __vsf_rng_buf_get_1(__name, __qaddr, __item) \
562 __name##_get_one((__qaddr), __item)
563
564#define __vsf_rng_buf_get_2(__name, __qaddr, __buffer, __size) \
565 __name##_get_multiple((__qaddr), (__buffer), (__size))
566
567#define __vsf_rng_buf_peek_1(__name, __qaddr, __item) \
568 __name##_peek_one((__qaddr), __item)
569
570#define __vsf_rng_buf_peek_2(__name, __qaddr, __buffer, __size) \
571 __name##_peek_multiple((__qaddr), (__buffer), (__size))
572
573#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
574# define vsf_rng_buf_send(__name, __qaddr, ...) \
575 __PLOOC_EVAL(__VSF_RNG_BUF_SEND_, __VA_ARGS__) \
576 (__name, __qaddr, __VA_ARGS__)
577
578# define vsf_rng_buf_get(__name, __qaddr, ...) \
579 __PLOOC_EVAL(__vsf_rng_buf_get_, __VA_ARGS__) \
580 (__name, __qaddr, __VA_ARGS__)
581
582# define vsf_rng_buf_peek(__name, __qaddr, ...) \
583 __PLOOC_EVAL(__VSF_QUEUE_PEEK_, __VA_ARGS__) \
584 (__name, __qaddr, __VA_ARGS__)
585#endif
586
587#define vsf_rng_buf_send_one(__name, __qaddr, __item) \
588 __vsf_rng_buf_send_1(__name, (__qaddr), (__item))
589
590#define vsf_rng_buf_send_buf(__name, __qaddr, __buffer, __size) \
591 __vsf_rng_buf_send_2(__name, (__qaddr), (__buffer), (__size))
592
593#define vsf_rng_buf_get_one(__name, __qaddr, __item) \
594 __vsf_rng_buf_get_1(__name, (__qaddr), (__item))
595
596#define vsf_rng_buf_get_buf(__name, __qaddr, __buffer, __size) \
597 __vsf_rng_buf_get_2(__name, (__qaddr), (__buffer), (__size))
598
599#define __vsf_rng_buf_count(__name, __qaddr) \
600 __name##_item_count((__qaddr))
601#define vsf_rng_buf_count(__name, __qaddr) \
602 __vsf_rng_buf_count(__name, __qaddr)
603
604#define ____vsf_rng_buf_reset_peek(__name, __qaddr) \
605 __name##_reset_peek((__qaddr))
606#define vsf_rng_buf_reset_peek(__name, __qaddr) \
607 ____vsf_rng_buf_reset_peek(__name, __qaddr)
608
609#define ____vsf_rng_buf_get_all_peeked(__name, __qaddr) \
610 __name##_get_all_peeked((__qaddr))
611#define vsf_rng_buf_get_all_peeked(__name, __qaddr) \
612 ____vsf_rng_buf_get_all_peeked(__name, __qaddr)
613
614#define __vsf_rng_buf_peekable_count(__name, __qaddr) \
615 __name##_item_count_peekable((__qaddr))
616#define vsf_rng_buf_peekable_count(__name, __qaddr) \
617 __vsf_rng_buf_peekable_count(__name, __qaddr)
618
619/*============================ TYPES =========================================*/
620
621declare_class(vsf_rng_buf_t)
622
623def_class(vsf_rng_buf_t,
624
625 protected_member(
633)
634end_def_class(vsf_rng_buf_t)
635
636/*============================ GLOBAL VARIABLES ==============================*/
637/*============================ PROTOTYPES ====================================*/
638
639extern
640void __vsf_rng_buf_init_ex( vsf_rng_buf_t* obj_ptr,
643
644extern
645int32_t __vsf_rng_buf_send_one(vsf_rng_buf_t* obj_ptr);
646
647extern
648int32_t __vsf_rng_buf_get_one(vsf_rng_buf_t* obj_ptr);
649
650VSF_CAL_SECTION(".text.vsf.utilities.__vsf_rng_buf_send_multiple")
651extern
652int32_t __vsf_rng_buf_send_multiple(vsf_rng_buf_t* obj_ptr,
653 uint16_t* item_cnt_ptr);
654
655VSF_CAL_SECTION(".text.vsf.utilities.__vsf_rng_buf_get_multiple")
656extern
657int32_t __vsf_rng_buf_get_multiple( vsf_rng_buf_t* obj_ptr,
658 uint16_t* item_cnt_ptr);
659
660VSF_CAL_SECTION(".text.vsf.utilities.__vsf_rng_buf_item_count")
661extern
662uint_fast16_t __vsf_rng_buf_item_count(vsf_rng_buf_t* obj_ptr);
663
664VSF_CAL_SECTION(".text.vsf.utilities.__vsf_rng_buf_peek_one")
665extern
666int32_t __vsf_rng_buf_peek_one(vsf_rng_buf_t* obj_ptr);
667
669extern
670void __vsf_rng_buf_get_all_peeked(vsf_rng_buf_t* obj_ptr);
671
672VSF_CAL_SECTION(".text.vsf.utilities.__vsf_rng_buf_reset_peek")
673extern
674void __vsf_rng_buf_reset_peek(vsf_rng_buf_t* obj_ptr);
675
677extern
679
680VSF_CAL_SECTION(".text.vsf.utilities.__vsf_rng_buf_peek_multiple")
681extern
682int32_t __vsf_rng_buf_peek_multiple(vsf_rng_buf_t* obj_ptr,
683 uint16_t* item_cnt_ptr);
684
685
686#ifdef __cplusplus
687}
688#endif
689
690#endif
#define VSF_CAL_SECTION(__SEC)
Definition __compiler.h:181
unsigned short uint16_t
Definition stdint.h:7
int int32_t
Definition stdint.h:8
unsigned short uint_fast16_t
Definition stdint.h:25
def_class(vsf_stream_fifo_t, which(vsf_stream_tx_t TX;vsf_stream_rx_t RX;), private:vsf_slist_queue_t union { vsf_stream_fifo_cfg_t cfg;struct { vsf_stream_dat_rdy_evt_t tDataReadyEventHandling;vsf_stream_dat_drn_evt_t tDataDrainEventHandling;vsf_stream_status_t Status;#if !defined(VSF_PBUF_QUEUE_CFG_ATOM_ACCESS) vsf_protect_region_t *pregion;#endif };};) end_def_class(vsf_stream_fifo_t) extern vsf_err_t vsf_stream_fifo_init(vsf_stream_fifo_t *obj_ptr
void __vsf_rng_buf_init_ex(vsf_rng_buf_t *obj_ptr, uint_fast16_t buffer_item_cnt, bool is_init_as_full)
Definition vsf_queue.c:52
int32_t __vsf_rng_buf_peek_one(vsf_rng_buf_t *obj_ptr)
Definition vsf_queue.c:199
uint16_t length
Definition vsf_queue.h:632
void __vsf_rng_buf_get_all_peeked(vsf_rng_buf_t *obj_ptr)
Definition vsf_queue.c:232
uint16_t buffer_item_cnt
Definition vsf_queue.h:632
int32_t __vsf_rng_buf_peek_multiple(vsf_rng_buf_t *obj_ptr, uint16_t *item_cnt_ptr)
Definition vsf_queue.c:255
uint16_t peek
Definition vsf_queue.h:632
int32_t __vsf_rng_buf_send_multiple(vsf_rng_buf_t *obj_ptr, uint16_t *item_cnt_ptr)
Definition vsf_queue.c:122
uint_fast16_t bool is_init_as_full
Definition vsf_queue.h:642
end_def_class(vsf_rng_buf_t) extern void __vsf_rng_buf_init_ex(vsf_rng_buf_t *obj_ptr
uint16_t peek_cnt
Definition vsf_queue.h:632
uint_fast16_t __vsf_rng_buf_item_count(vsf_rng_buf_t *obj_ptr)
Definition vsf_queue.c:112
uint_fast16_t __vsf_rng_buf_item_count_peekable(vsf_rng_buf_t *obj_ptr)
Definition vsf_queue.c:244
declare_class(vsf_rng_buf_t) def_class(vsf_rng_buf_t
void __vsf_rng_buf_reset_peek(vsf_rng_buf_t *obj_ptr)
Definition vsf_queue.c:222
uint16_t tail
Definition vsf_queue.h:632
int32_t __vsf_rng_buf_get_multiple(vsf_rng_buf_t *obj_ptr, uint16_t *item_cnt_ptr)
Definition vsf_queue.c:159
int32_t __vsf_rng_buf_get_one(vsf_rng_buf_t *obj_ptr)
Definition vsf_queue.c:84
uint16_t head
Definition vsf_queue.h:632
int32_t __vsf_rng_buf_send_one(vsf_rng_buf_t *obj_ptr)
Definition vsf_queue.c:62