I generally check them in a fixed order, handle the first one I find that needs service, then get out of the interrupt. Multiple devices could have their interrupt conditions set by the time you check them. Note that the device you end up servicing in a shared interrupt routine may not be the one that originally caused the interrupt. The state for that device is now hung because it needs service and probably can't generate new events, but the one event that caused the current condition has already been cleared. Now the condition for the new event has been cleared, but your code doesn't know that. The device interrupts, you handle it, then another event occurs right before you clear the interrupt condition. The main reason for clearing the interrupt condition before servicing the interrupt is to not lose a interrupt. Clearing the interrupt condition should usually be the first thing this code does. Once you have found a device with its interrupt condition set, you go to the code to handle that device. In the case of a shared interrupt routine, you first have to check which device is causing the interrupt. You might do the normal saving of state before anything else, but clearing the interrupt condition should be the next thing you do. In the case of vectored interrupts, this is very early in the interrupt routine because you know the interrupt cause just from being there. Your question isn't limited to FIFOs or any particular interrupt-causing hardware.Ĭlear interrupt conditions as soon as you know you will handle that condition. Please do excuse if my understanding of interrupts is wrong Where is the best place to reset the interrupt? Problem2 that may occur: Suppose I reset the interrupt at the end of the ISR,if another FIFO gets filled while I'm in the ISR, since I have not yet reset the interrupt, will I re-enter the ISR I have executed the last line of the ISR? Problem1 that may occur: Suppose I reset the interrupt at the beginning of the ISR,if another FIFO gets filled while I'm in the ISR, since I have reset the interrupt, what will happen? Will it automatically re-enter the ISR after I execute the last line of the ISR or will some other problem occur? What I would like to know is whether the Interrupt must be reset at the beginning of the ISR function or the end. Now, everytime a FIFO receives 8 bytes of data a single ISR is called and in the ISR I have to identify which FIFO caused the interrupt. Each FIFO is connected to a common bus and can receive data independently(at any point of time). Im working on a uC that has interrupts configured for various FIFO's present in the uC.
0 Comments
Leave a Reply. |