Quality RTOS & Embedded Software

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




Loading

Forcefully resume task from vTaskDelay()

Posted by Nathan Martin on March 21, 2013
I've looked around in the task.h and semphr.h header files trying to find the answer, but no available. Is it possible to forcefully resume a task that is in a suspended state via vTaskDelay() by using the vTaskResume() function or another similar function? If this will not work then what alternatives do I have to accomplish the same result?

My intentions for doing this is for a crude uITRON 4.0 event flag twai_flg() function implementation I'm doing for an uITRON API compatibility wrapper I'm creating for FreeRTOS. I've got some driver code that was designed for uITRON for a specific SoC I'm working with and instead of trying to modify the rat's nest condition that the driver code is in I'm creating the support wrapper API for the driver code to indirectly make use of FreeRTOS's APIs as much as possible.

The idea is for tasks that call twai_flg() with tmout != TMO_FEVR || TMO_POL to place the task's handle into a linked list of tasks waiting on a specific flag bit pattern and then they perform vTaskDelay(tmout / portTICK_RATE_MS); so that they're sitting in a timeout-able suspended state. Once the event flag's bit pattern has changed and matches that of a waiting task I need to wake up/resume the suspended task as its wait condition has been met. So, this is where I'm stuck. I'm trying to have the task only be suspended for up to tmout value (in milliseconds in this case) and be able to forcefully resume said task upon waiting condition met, the condition checking will be done for each individual waiting task upon successful set_flg() and clr_flg() uITRON API calls in my implementation.

I did look over the various semaphores that FreeRTOS provides and I couldn't find any that would be acceptable for what uITRON's event flags are required to do. Perhaps I'm wrong and overlooked something, so suggestions are welcome.

Thanks!

RE: Forcefully resume task from vTaskDelay()

Posted by MEdwards on March 21, 2013
There is no way of doing what you want if you block on a vTaskDelay. You could suspend on a semaphore with a timeout, then give the semaphore when the event flags are in the right state. If the event flags never get into the right state the semaphore is not given and the task will time out at the appropriate time.

According to Richard, FreeRTOS does not directly support event flags because the implementations thus far have not been good enough to make it into the FreeRTOS code because they are not deterministic and have long critical sections.


[ 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