X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fm68k%2Fapollo%2Fdn_ints.c;fp=arch%2Fm68k%2Fapollo%2Fdn_ints.c;h=a31259359a1208711a83d1828d7e5ed0b5a70a5f;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=9fe07803797bb9c2211decdd76e63717ad2fc258;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/arch/m68k/apollo/dn_ints.c b/arch/m68k/apollo/dn_ints.c index 9fe078037..a31259359 100644 --- a/arch/m68k/apollo/dn_ints.c +++ b/arch/m68k/apollo/dn_ints.c @@ -1,44 +1,125 @@ -#include +#include +#include +#include +#include +#include +#include #include #include +#include +#include #include +#include -void dn_process_int(unsigned int irq, struct pt_regs *fp) +static irq_handler_t dn_irqs[16]; + +irqreturn_t dn_process_int(int irq, struct pt_regs *fp) { - m68k_handle_int(irq, fp); + irqreturn_t res = IRQ_NONE; + + if(dn_irqs[irq-160].handler) { + res = dn_irqs[irq-160].handler(irq,dn_irqs[irq-160].dev_id,fp); + } else { + printk("spurious irq %d occurred\n",irq); + } + + *(volatile unsigned char *)(pica)=0x20; + *(volatile unsigned char *)(picb)=0x20; - *(volatile unsigned char *)(pica)=0x20; - *(volatile unsigned char *)(picb)=0x20; + return res; } -int apollo_irq_startup(unsigned int irq) -{ - if (irq < 8) - *(volatile unsigned char *)(pica+1) &= ~(1 << irq); - else - *(volatile unsigned char *)(picb+1) &= ~(1 << (irq - 8)); - return 0; +void dn_init_IRQ(void) { + + int i; + + for(i=0;i<16;i++) { + dn_irqs[i].handler=NULL; + dn_irqs[i].flags=IRQ_FLG_STD; + dn_irqs[i].dev_id=NULL; + dn_irqs[i].devname=NULL; + } + } -void apollo_irq_shutdown(unsigned int irq) -{ - if (irq < 8) - *(volatile unsigned char *)(pica+1) |= (1 << irq); - else - *(volatile unsigned char *)(picb+1) |= (1 << (irq - 8)); +int dn_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) { + + if((irq<0) || (irq>15)) { + printk("Trying to request invalid IRQ\n"); + return -ENXIO; + } + + if(!dn_irqs[irq].handler) { + dn_irqs[irq].handler=handler; + dn_irqs[irq].flags=IRQ_FLG_STD; + dn_irqs[irq].dev_id=dev_id; + dn_irqs[irq].devname=devname; + if(irq<8) + *(volatile unsigned char *)(pica+1)&=~(1<15)) { + printk("Trying to free invalid IRQ\n"); + return ; + } + + if(irq<8) + *(volatile unsigned char *)(pica+1)|=(1<