11#ifndef FREERTOS_QUEUE_H
12#define FREERTOS_QUEUE_H
16#include "freertos/FreeRTOS.h"
22#define xQueueHandle QueueHandle_t
24typedef void* QueueHandle_t;
26QueueHandle_t xQueueGenericCreate (
const UBaseType_t uxQueueLength,
27 const UBaseType_t uxItemSize,
28 const uint8_t ucQueueType);
30QueueHandle_t xQueueCreateCountingSemaphore (
const UBaseType_t uxMaxCount,
31 const UBaseType_t uxInitialCount);
33void vQueueDelete (QueueHandle_t xQueue);
35BaseType_t xQueueReset (QueueHandle_t xQueue);
37BaseType_t xQueueGenericReceive (QueueHandle_t xQueue,
38 void *
const pvBuffer,
39 TickType_t xTicksToWait,
40 const BaseType_t xJustPeeking);
42BaseType_t xQueueGenericSend (QueueHandle_t xQueue,
43 const void *
const pvItemToQueue,
44 TickType_t xTicksToWait,
45 const BaseType_t xCopyPosition);
47BaseType_t xQueueReceiveFromISR (QueueHandle_t xQueue,
void *
const pvBuffer,
48 BaseType_t *
const pxHigherPriorityTaskWoken);
50BaseType_t xQueueGenericSendFromISR (QueueHandle_t xQueue,
51 const void *
const pvItemToQueue,
52 BaseType_t *
const pxHigherPriorityTaskWoken,
53 const BaseType_t xCopyPosition );
55BaseType_t xQueueGiveFromISR (QueueHandle_t xQueue,
56 BaseType_t *
const pxHigherPriorityTaskWoken);
58UBaseType_t uxQueueMessagesWaiting( QueueHandle_t xQueue );
75#define queueSEND_TO_BACK ( ( BaseType_t ) 0 )
76#define queueSEND_TO_FRONT ( ( BaseType_t ) 1 )
77#define queueOVERWRITE ( ( BaseType_t ) 2 )
79#define queueQUEUE_TYPE_BASE ( ( uint8_t ) 0U )
80#define queueQUEUE_TYPE_SET ( ( uint8_t ) 0U )
81#define queueQUEUE_TYPE_MUTEX ( ( uint8_t ) 1U )
82#define queueQUEUE_TYPE_COUNTING_SEMAPHORE ( ( uint8_t ) 2U )
83#define queueQUEUE_TYPE_BINARY_SEMAPHORE ( ( uint8_t ) 3U )
84#define queueQUEUE_TYPE_RECURSIVE_MUTEX ( ( uint8_t ) 4U )
86#define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
87#define errQUEUE_FULL ( ( BaseType_t ) 0 )
88#define errQUEUE_BLOCKED ( -4 )
89#define errQUEUE_YIELD ( -5 )
91#define xQueueCreate( uxQueueLength, uxItemSize ) \
92 xQueueGenericCreate( ( uxQueueLength ), ( uxItemSize ), ( queueQUEUE_TYPE_BASE ) )
94#define xQueueReceive( xQueue, pvBuffer, xTicksToWait ) \
95 xQueueGenericReceive( ( xQueue ), ( pvBuffer ), ( xTicksToWait ), \
98#define xQueueSend( xQueue, pvItemToQueue, xTicksToWait ) \
99 xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), \
102#define xQueueSendToBack( xQueue, pvItemToQueue, xTicksToWait ) \
103 xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), \
106#define xQueueSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) \
107 xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), \
108 ( pxHigherPriorityTaskWoken ), \
111#define xQueueSendToBackFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) \
112 xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), \
113 ( pxHigherPriorityTaskWoken ), \
116#define xQueueOverwriteFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) \
117 xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), \
118 ( pxHigherPriorityTaskWoken ), \