FreeRTOS support multi-level of interrupt?

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.

FreeRTOS support multi-level of interrupt?

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.

FreeRTOS support multi-level of interrupt?

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.

FreeRTOS support multi-level of interrupt?

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.