Background:
I am using a cortex-M3 ARM core without an OS.
My main loop waits for a flag from an interrupt handler and then executes a function doBigTask()
.
Within a separate interrupt handler, I want to execute another function doSmallTask()
, but since this function is also non-trivial, I still want other I/O related interrupts to be handled.
My Question:
Are there any issues with simply enabling interrupts from within doSmallTask()
? For example, are there any complications with exiting an interrupt handler after interrupts have already been disabled?.
Note: I'm not expecting a re-entrant interrupt to occur as doSmallTask()
will finish well before the next interrupt triggers it.
int flag = 0;
void doSmallTask()
{
asm volatile ("cpsie i"); // Enable interrupts
// do rest of function
// ...
}
void irqHandler1()
{
flag = 1;
}
void irqHandler2()
{
doSmallTask();
}
void irqHandler3()
{
// service I/O
}
int main()
{
while(1)
if (flag)
{
doBigTask();
flag = 0;
}
}