On Tue, May 08, 2007 at 04:12:17PM +0200, Krzysztof Halasa wrote:See for example arch/arm/mach-ep93xx/core.c, handling of the A/B/F port GPIO interrupts. In a nutshell, it goes like this. 1) Allocate a set of IRQ numbers. E.g. in include/asm-arm/arch-ixp4xx/irqs.h: #define IRQ_IXP4XX_QUEUE_0 64 #define IRQ_IXP4XX_QUEUE_1 65 [...] Adjust NR_IRQS, too. 2) Implement interrupt chip functions: static void ixp4xx_queue_low_irq_mask_ack(unsigned int irq) { [...] } static void ixp4xx_queue_low_irq_mask(unsigned int irq) { [...] } static void ixp4xx_queue_low_irq_unmask(unsigned int irq) { [...] } static void ixp4xx_queue_low_irq_set_type(unsigned int irq) { [...] } static struct irq_chip ixp4xx_queue_low_irq_chip = { .name = "QMGR low", .ack = ixp4xx_queue_low_irq_mask_ack, .mask = ixp4xx_queue_low_irq_mask, .unmask = ixp4xx_queue_low_irq_unmask, .set_type = ixp4xx_queue_low_irq_set_type, }; 3) Hook up the queue interrupts: for (i = IRQ_IXP4XX_QUEUE_0; i <= IRQ_IXP4XX_QUEUE_31; i++) { set_irq_chip(i, &ixp4xx_queue_low_irq_chip); set_irq_handler(i, handle_level_irq); set_irq_flags(i, IRQF_VALID); } 4) Implement an interrupt handler for the parent interrupt: static void ixp4xx_qmgr_low_irq_handler(unsigned int irq, struct irq_des c *desc) { u32 status; int i; status = __raw_readl(IXP4XX_WHATEVER_QMGR_LOW_STATUS_REGISTER); for (i = 0; i < 32; i++) { if (status & (1 << i)) { desc = irq_desc + IRQ_IXP4XX_QUEUE_0 + i; desc_handle_irq(IRQ_IXP4XX_QUEUE_0 + i, desc); } } } 5) Hook up the parent interrupt: set_irq_chained_handler(IRQ_IXP4XX_QM1, ixp4xx_qmgr_low_irq_handler); Or something like that. You're unlikely to be using all of those at the same time, though. And what do you do if the user does compile all of these features into his kernel and then tries to use them all at the same time? Return -ENOMEM? Shouldn't we make sure that at least the features that are compiled in can be used at the same time? If you want that guarantee, then you might as well determine the SRAM map at compile time. -
| Alan Cox | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Jan Engelhardt | intel iommu (Re: -mm merge plans for 2.6.23) |
| Adrian Bunk | Re: LSM conversion to static interface |
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Andrew Morton | Re: [BUG] New Kernel Bugs |
| Winkler, Tomas | RE: iwlwifi: fix build bug in "iwlwifi: fix LED stall" |
