Quality RTOS & Embedded Software

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




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) 2004-2010 Richard Barry. Copyright (C) 2010-2016 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.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists