Matthew Dharm wrote: > I've taken it upon myself to re-write some interrupt handling code. > It's a mess, and it needs cleaning. > That is usually a right attitude to start ... :=) > > An interrupt handler must be registered with set_except_vector(0, ...) > which must return a numeric code in the range of 0..NR_IRQS -- it can > do this in any way it wants, including limited function calls (ie > there is a stack in place). > Interrupt is setup throught request_irq()/setup_irq(). set_except_vector() for setting exception handlers, which is different from interrupts. > The irq_desc array of irq_desc_t structures is where the magic > happens. The value returned by the interrupt handler is used as an > index into this array to do the dispatch a specific handler. The > 'status' and 'action' fields are pretty much self-explanatory. The > 'handler' field seems to point to a set of function pointers used for > enabling/disabling the IRQ. But what is 'depth' for? Boards seem to > set it to either 0 or 1 commonly, but I don't see why. For nested disabling and enabling of interrupts. > I also don't > see how IRQ sharing is accomplished... Yes, it is there. See do_IRQ() and a sub-routine handle_event() (or something like that) > Is this pretty much how it all works? I have a more detailed description in my porting guide. http://linux.junsun.net/porting-howto/porting-howto.html#chapter-interrupt Jun