safely re-enabling interrupts after chSysDisable()
Posted: Mon Sep 25, 2017 8:47 am
After using chSysDisable() to disable interrupts the obvious thing to re-enable interrupts is chSysEnable(). That doesn't seem to cope with the case where the caller of the function had also disabled interrupts, so I'm wondering if there is a recommended approach to restore the previous interrupt mask state.
What I was expecting was something like:
isr_state_t state = chSysDisable();
// do stuff with interrupts disabled
chSysRestore(state);
is there an equivalent to this in ChibiOS? Or is there some other way to safely restore the previous interrupt mask state?
I'm on a stm32f4xx in case it matters.
Cheers, Tridge
What I was expecting was something like:
isr_state_t state = chSysDisable();
// do stuff with interrupts disabled
chSysRestore(state);
is there an equivalent to this in ChibiOS? Or is there some other way to safely restore the previous interrupt mask state?
I'm on a stm32f4xx in case it matters.
Cheers, Tridge