CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
queue.h File Reference

FreeRTOS queue compatibility APIs. More...

#include "FreeRTOS.h"
#include <queue.h>

Go to the source code of this file.

Macros

#define errQUEUE_EMPTY   pdFALSE
#define errQUEUE_FULL   pdFALSE

Typedefs

typedef struct MessageQueueQueueHandle_t
 Queue handle.

Functions

static BaseType_t xQueueReceive (QueueHandle_t queueHandle, void *buffer, TickType_t waitTicks)
 Receive a message on a queue.
static BaseType_t xQueueSendToBack (QueueHandle_t queueHandle, const void *buffer, TickType_t waitTicks)
 Send a message to the queue.
static BaseType_t xQueueSendToBackFromISR (QueueHandle_t queueHandle, const void *buffer, BaseType_t *pxHigherPriorityTaskWoken)
 Send a message to the queue from an ISR.
static QueueHandle_t xQueueCreate (UBaseType_t uxQueueLength, UBaseType_t uxItemSize)
 Create a queue that can store uxQueueLength messages of size uxItemSize.
static void vQueueDelete (QueueHandle_t xQueue)
 Delete a queue.
static UBaseType_t uxQueueMessagesWaiting (const QueueHandle_t xQueue)
 Return the number of messages waiting in a queue.

Detailed Description

FreeRTOS queue compatibility APIs.

This file defines the compatibility wrappers for FreeRTOS's queue APIs. This is intended for porting code from FreeRTOS and should not be used in new CHERIoT software. The functions in this file wrap the APIs exposed in queue.h. These are implemented in the message_queue_library library and, if used across a trust boundary, the message_queue compartment, which must be linked to the final firmware image.

Definition in file queue.h.

Macro Definition Documentation

◆ errQUEUE_EMPTY

#define errQUEUE_EMPTY   pdFALSE

Definition at line 17 of file queue.h.

◆ errQUEUE_FULL

#define errQUEUE_FULL   pdFALSE

Definition at line 18 of file queue.h.

Typedef Documentation

◆ QueueHandle_t

typedef struct MessageQueue* QueueHandle_t

Queue handle.

This is used to reference queues in the API functions.

Definition at line 23 of file queue.h.

Function Documentation

◆ uxQueueMessagesWaiting()

UBaseType_t uxQueueMessagesWaiting ( const QueueHandle_t xQueue)
inlinestatic

Return the number of messages waiting in a queue.

Note: This is inherently racy and should not be used for anything other than debugging.

Definition at line 113 of file queue.h.

References queue_items_remaining().

◆ vQueueDelete()

void vQueueDelete ( QueueHandle_t xQueue)
inlinestatic

Delete a queue.

This frees the memory associated with the queue.

Definition at line 102 of file queue.h.

References queue_destroy().

◆ xQueueCreate()

QueueHandle_t xQueueCreate ( UBaseType_t uxQueueLength,
UBaseType_t uxItemSize )
inlinestatic

Create a queue that can store uxQueueLength messages of size uxItemSize.

Returns NULL if queue creation failed, false otherwise.

Definition at line 88 of file queue.h.

References queue_create(), and UnlimitedTimeout.

◆ xQueueReceive()

BaseType_t xQueueReceive ( QueueHandle_t queueHandle,
void * buffer,
TickType_t waitTicks )
inlinestatic

Receive a message on a queue.

The message is received into buffer, which must be large enough to accommodate a message of the size passed to xQueueCreate. This blocks for up to waitTicks ticks if the queue is empty.

Returns pdPASS if a message was received, or errQUEUE_EMPTY if the queue is empty and no message arrived (or was not collected by another higher-priority thread) for the duration of the call.

Definition at line 36 of file queue.h.

References pdPASS, and queue_receive().

◆ xQueueSendToBack()

BaseType_t xQueueSendToBack ( QueueHandle_t queueHandle,
const void * buffer,
TickType_t waitTicks )
inlinestatic

Send a message to the queue.

Blocks for up to waitTicks ticks if the queue is full. The message is copied from buffer which must be large enough to accommodate a message of the size passed to xQueueCreate.

returns pdPASS if the message was sent, or errQUEUE_FULL if the queue remained full for the duration of the call.

Definition at line 54 of file queue.h.

References pdPASS, and queue_send().

Referenced by xQueueSendToBackFromISR().

◆ xQueueSendToBackFromISR()

BaseType_t xQueueSendToBackFromISR ( QueueHandle_t queueHandle,
const void * buffer,
BaseType_t * pxHigherPriorityTaskWoken )
inlinestatic

Send a message to the queue from an ISR.

We do not allow running code from ISRs and so this behaves like a non-blocking xQueueSendToBack.

The pxHigherPriorityTaskWoken parameter is used to return whether a yield is necessary. A yield is never necessary in this implementation and so this is unconditionally given a value of pdFALSE.

Definition at line 75 of file queue.h.

References pdFALSE, and xQueueSendToBack().