Quality RTOS & Embedded Software

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




Loading

xEventGroupSetBitsFromISR return value

Posted by embeddedavenger on October 22, 2014

I am confused by the page for the xEventGroupSetBitsFromISR function.

The return value is described with “If the callback request was registered successfully then pdPASS is returned, otherwise pdFALSE is returned. pdFALSE will be returned if the timer service queue was full.” The page makes no other mention of a callback function. Though the page says that INCLUDE_xTimerPendFunctionCall must be set to 1, it makes no other mention of timers. Finally, the example code tests the return value against pdFAIL.

Is the return value pdTRUE/pdFALSE or pdPASS/pdFAIL? (Which ignores the question of why you have two pairs of values that are equivalent.) Is there a callback function I should be setting up before making this call?


xEventGroupSetBitsFromISR return value

Posted by rtel on October 22, 2014

For mutual exclusion reasons, xEventGroupSetBitsFromISR() does not access the bits in the event groups directly, but instead requests that the bits be set/cleared by the RTOS when the interrupt exits. It does this using the same mechanism described on this page: http://www.freertos.org/xTimerPendFunctionCallFromISR.html - but that is more detail than you need to know to use the function.

More simply, calling the function sends a message to the RTOS on a queue. The message is the function to execute (what is referred to as the callback on the page you referenced) A task created/controlled by the RTOS then reads the message and performs the processing. If the message can be sent, then pdTRUE/pdPASS is returned. If the message cannot be sent (because the queue is full) then pdFALSE/pdFAIL is returned. The mechanism is automatic, you do not need to do anything with a callback yourself, or even know the callback exists.

That is not how function was originally implemented and it looks like the documentation for the function has only been partially updated to explain this, and some information is missing and caused the confusion. I will update the documentation page, and also make the use of pdPASS/pdTRUE and pdFAIL/pdFALSE more consistend. The two definitions in each pair are equivalent.

Regards.


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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