Quality RTOS & Embedded Software

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




Loading

FreeRTOS support multi-level of interrupt?

Posted by newnie super on June 17, 2009
I'm porting FreeRTOS to my application. It seems that FreeRTOS protects the critical section simply by disabling the global interrupt and reenabling the global interrupt when exit from critical section. The problem is, my application may have disabled the global interupt before calling protection function, such as EnterCritical, which means when exit from the critical section the global interrupt will be enabled but my application doesn't want to.
Any help would be greatly appreciated.
Thanks.

RE: FreeRTOS support multi-level of interrupt?

Posted by Richard Damon on June 17, 2009
The simple solution is for you to use the EnterCritical/ExitCritical functions to disable/enable interrupts in your own code.

You should be a bit careful with this, as some ports of freeRTOS do not disable ALL the interrupts in critical sections, but only those below the level that are allowed to access the kernel, so if you need others disabled you should do it in a way that you can easily fix for when (or if) that feature makes it to the port you are using.

RE: FreeRTOS support multi-level of interrupt?

Posted by newnie super on June 17, 2009
Many thanks for your reply but you might be misunderstanding my question.

To sum up, my code needs to recover the interrupt status after ExitCritical called, i.e., if the interrupt has been disabled before EnterCritical is called, then the interrupt status should still keep disabled even ExitCritical called after.

Thanks again.

RE: FreeRTOS support multi-level of interrupt?

Posted by Richard Damon on June 17, 2009
The way to do that is to use EnterCritical as the way to disable your interrupts. That way FreeRTOS can manage the interrupts.

The other option is to change EnterCritical/ExitCritical to somehow save the interrupt state (or at least what the interrupt state was when the first level of EnterCritical was called), and have this restored by ExitCritical. Note that this will add overhead to all Critical Setions, so the first method (using calls to EnterCritical) is preferred.


[ 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