ringbuf.h
1 /*
2  * Copyright (C) 2022 Gunar Schorcht
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  *
8  * FreeRTOS to RIOT-OS adaption module for source code compatibility
9  *
10  * At the moment this header file is empty and exists only to avoid
11  * compilation errors for files of the ESP-IDF that include `ringbuf.h`,
12  * such as `uart.h` even if they do not need definitions from `ringbuf.h`.
13  */
14 
15 #ifndef FREERTOS_RINGBUF_H
16 #define FREERTOS_RINGBUF_H
17 
18 #ifndef DOXYGEN
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #define RINGBUF_TYPE_NOSPLIT 0
25 #define RINGBUF_TYPE_BYTEBUF 2
26 
27 typedef unsigned RingbufferType_t;
28 typedef void * RingbufHandle_t;
29 
30 RingbufHandle_t xRingbufferCreate(size_t xBufferSize, RingbufferType_t xBufferType);
31 
32 void vRingbufferDelete(RingbufHandle_t xRingbuffer);
33 
34 void *xRingbufferReceiveUpTo(RingbufHandle_t xRingbuffer,
35  size_t *pxItemSize,
36  TickType_t xTicksToWait,
37  size_t xMaxSize);
38 
39 BaseType_t xRingbufferSendFromISR(RingbufHandle_t xRingbuffer,
40  const void *pvItem,
41  size_t xItemSize,
42  BaseType_t *pxHigherPriorityTaskWoken);
43 
44 void *xRingbufferReceiveUpToFromISR(RingbufHandle_t xRingbuffer,
45  size_t *pxItemSize, size_t xMaxSize);
46 
47 void *xRingbufferReceiveFromISR(RingbufHandle_t xRingbuffer, size_t *pxItemSize);
48 
49 void vRingbufferReturnItemFromISR(RingbufHandle_t xRingbuffer, void *pvItem,
50  BaseType_t *pxHigherPriorityTaskWoken);
51 
52 #ifdef __cplusplus
53 }
54 #endif
55 
56 #endif /* DOXYGEN */
57 #endif /* FREERTOS_RINGBUF_H */