(For some reason, configKERNEL_INTERRUPT_PRIORITY is considered too long a word to be in the title)
Sorry for the noise, but I am feeling really thick at the moment and struggling to get a grasp of something which seems to be documented everywhere and explained multiple times, but somehow is not getting through to me. Things have a habit of clicking with me when I try to explain my thoughts, so bear with me.
I have also read through this thread but still I dont seem to be getting it : What is config KERNEL INTERRUPT PRIORITY?
In my m68k port I have defined both configKERNEL_INTERRUPT_PRIORITY and configMAX_API_CALL_INTERRUPT_PRIORITY.
On the m68k, IPL 0 means “all interrupts are enabled”, but is not an IRQ level itself. The minimum IRQ is 1, so in my current project my tick interrupt is configured for IRQ 1 as it is recommended to be the lowest available IRQ level. (c1600_freertos_tcp/FreeRTOSConfig.h at master · tomstorey/c1600_freertos_tcp · GitHub)
The problem is arising when I look at my implementation of portENABLE_INTERRUPTS (FreeRTOS-Kernel/portmacro.h at new_task_switch · tomstorey/FreeRTOS-Kernel · GitHub). My fuzzy understanding was that this should fully re-enable all interrupts, i.e. configure the IPL to 0. However, if I do this, I get a lot of crashes due to null pointers. Configuring IPL 1 is generally leaps and bounds more stable (although I still seem to be getting crashes due to null pointers for some reason right now… this has been very temperamental)
But it doesnt seem right to “re-enable” interrupts at a priority above 0? Surely if portDISABLE_INTERRUPTS is setting the IPL to configMAX_API_CALL_INTERRUPT_PRIORITY to prevent API-calling ISRs from interrupting the kernel, then portENABLE_INTERRUPTS should restore the IPL to 0 to re-enable all interrupts as the name suggests?
What am I missing?