Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

static queue set

Posted by filo123 on June 30, 2018

I want to use a statically allocated queue set (yes - I know that there are other equivalent mechanisms). There is no xQueueCreateSetStatic so I have come up with this piece of code: ~~~

if( ( configUSEQUEUESETS == 1 ) && ( configSUPPORTSTATICALLOCATION == 1 ) )
QueueSetHandle_t xQueueCreateSetStatic( const UBaseType_t uxEventQueueLength, uint8_t *pucQueueSetStorage, StaticQueue_t *pxStaticQueueSet )
{
QueueSetHandle_t pxQueue;

	pxQueue = xQueueGenericCreateStatic( uxEventQueueLength, ( UBaseType_t ) sizeof( Queue_t * ), pucQueueSetStorage, pxStaticQueueSet, queueQUEUE_TYPE_SET );

	return pxQueue;
}
endif /* configUSEQUEUESETS */

~~~ Questions: 1. Is there a better/clearer way to implement this functionality? 2. When using this function I have to pass a pointer to a buffer that will hold the queue set elements, internally each element has size sizeof(Queue_t*), which is simply size of a pointer. Is it safe to use static uint8_t queue_set_storage[sizeof(void*)*N]; as the buffer? (GCC, Cortex-M)


static queue set

Posted by rtel on June 30, 2018

That looks fine. Your application could of course just call xQueueGeneriCreateStatic() directly, but its not a documented API function so could change in the future - hence the way you are doing is probably best.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo, Nuvoton Cortex-M23 demo & STM32H745 dual core (AMP) demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Mediatek

Renesas

RISC-V

SiFIve RISC-V

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner