Forum Discussion
Altera_Forum
Honored Contributor
10 years agoalt_irq_disable_all() not allowed in isr
Hello, Simple and general newbie question. I have inherited someones code which uses HAL irq legacy functions. I noticed from the API reference that alt_irq_disable_all() is not allowed to b...
Altera_Forum
Honored Contributor
10 years agoInterrupts and getting them right is a harder problem than it seems at first. In general, if you have a lot going on in a device driver interrupt routine you are doing it wrong.
Some rules I follow: Make ISRs as small as possible. More than 10-20 lines is probably too big. Never disable interrupts within an interrupt routine. If you think you need to your interrupt priorities are probably wrong. Don't use coroutines in an ISR. Don't loop in an ISR. Never modify the same thing in both an ISR and in your main code, I.E. no linked lists. Never modify something in more than one ISR. If you follow these rules, you will have a much easier time of it. Some old school devs do way too much in interrupt routines. Their code always has weird infrequent and hard to track down bugs in it.