Latest News Items: FreeRTOS V8 released - FAT file system released - Tick suppression demo'ed SAM4L, RX100 & STM32L
 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs Books & Kits Visualisation Ecosystem Training Contact & Support

Last site update Jan 14 2014

[Queue Management]

BaseType_t xQueueSendToFrontFromISR ( QueueHandle_t xQueue, const void *pvItemToQueue, BaseType_t *pxHigherPriorityTaskWoken );

This is a macro that calls xQueueGenericSendFromISR().

Post an item to the front of a queue. It is safe to use this function from within an interrupt service routine.

Items are queued by copy not reference so it is preferable to either only send small items, or alternatively send a pointer to the item.

xQueue The handle to the queue on which the item is to be posted.
pvItemToQueue A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was created, so this many bytes will be copied from pvItemToQueue into the queue storage area.
pxHigherPriorityTaskWoken xQueueSendToFrontFromISR() will set *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task to unblock, and the unblocked task has a priority higher than the currently running task. If xQueueSendToFrontFromISR() sets this value to pdTRUE then a context switch should be requested before the interrupt is exited.

From FreeRTOS V7.3.0 pxHigherPriorityTaskWoken is an optional parameter and can be set to NULL.

pdPass if data was successfully sent to the queue, otherwise errQUEUE_FULL.
Example usage:
void vBufferISR( void ) { char cIn; BaseType_t xHigherPriorityTaskWoken; /* We have not woken a task at the start of the ISR. */ xHigherPriorityTaskWoken = pdFALSE; /* Obtain a byte from the buffer. */ cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); if( cIn == EMERGENCY_MESSAGE ) { /* Post the byte to the front of the queue. */ xQueueSendToFrontFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); } else { /* Post the byte to the back of the queue. */ xQueueSendToBackFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); } /* Did sending to the queue unblock a higher priority task? */ if( xHigherPriorityTaskWoken ) { /* Actual macro used here is port specific. */ taskYIELD_FROM_ISR (); } }

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2013 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.