FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [October 2014 Threads]
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?
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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.