I work with the AT91 controller from atmel, which managed all interrups by the Advanced Interrupt Controller (AIC).
I've critical code zone, where no interrups should be occured.
unsigned int mask; //disable interrupts mask = AT91C_BASE_AIC->AIC_IMR; AT91C_BASE_AIC->AIC_IDCR = 0xFFFFFFFF; //critical code //critical code //enable interrupts AT91C_BASE_AIC->AIC_IECR = mask;
If an interrupt occurs just before the AIC is disabled but not processed until just afterwards, I will get a suprious interrupt.
If I only disable the AIC - without saving the mask register - I have to enable all interrupts step by step.
What's the best way to do that?
Thomas