Hi,
Here is a suggestion for handling nested interrupts, without impacting old ports. And without using portCRITICAL_NESTING_IN_TCB, which is complex and less efficient to deal with each time a new port is created.
Define a macro portINTERRUPT_STATUS_DECL() for declaring a stack variable.
This macro is placed at the start of any section accessing the enable/disable interrupts. It is placed in the core source code (it is not needed in the ports).
This macro is defined as empty, by default. Hence, it has no impact on old ports.
For new ports, this macro is defined in portmacro.h, for example, as:
This new variable, on stack, is then used by the port specific macros portDISABLE_INTERRUPTS, portENABLE_INTERRUPTS, etc. to disable/enable interrupts in each new port.
E.g.
Hence, we can save the interrupt status in this stack variable and restore it. Without impacting old ports. And without using portCRITICAL_NESTING_IN_TCB.
Sorry for the website's automatic formatting above in too large font. It should read