Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / ppc-sam440 / irq.hidd / irqclass.c
blob74b1094c281156a0526001cab2c29500ce4dde71
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: IRQ class
6 Lang: english
7 */
9 #include <hidd/irq.h>
11 #include <proto/exec.h>
12 #include <proto/utility.h>
13 #include <proto/oop.h>
14 #include <proto/kernel.h>
16 #include <exec/alerts.h>
17 #include <exec/memory.h>
18 #include <aros/system.h>
20 #include "irq.h"
22 #define DEBUG 0
23 #include <aros/debug.h>
25 #include <asm/amcc440.h>
27 /* Don't initialize them with "= 0", otherwise they end up in the DATA segment! */
29 static OOP_AttrBase HiddIRQAttrBase;
31 static struct OOP_ABDescr attrbases[] =
33 { IID_Hidd_IRQ, &HiddIRQAttrBase },
34 { NULL, NULL }
37 /*** HIDDIRQ::AddHandler() ***************************************/
39 BOOL Irq__Hidd_IRQ__AddHandler(OOP_Class *cl, OOP_Object *obj, struct pHidd_IRQ_AddHandler *msg)
41 LONG irqnum = msg->id;
42 void *KernelBase = OpenResource("kernel.resource");
44 EnterFunc(bug("HIDDIRQ::AddHandler()\n"));
45 D(bug("Adding handler %s, irq %d\n",msg->handlerinfo->h_Node.ln_Name, msg->id));
47 if (msg->id < 0)
49 switch (msg->id)
51 case vHidd_IRQ_Timer:
52 irqnum = INTR_GDP;
53 break;
55 // case vHidd_IRQ_Keyboard:
56 // irqnum = 0x21;
57 // break;
59 // case vHidd_IRQ_Serial2:
60 // irqnum = 0x23;
61 // break;
63 // case vHidd_IRQ_Serial1:
64 // irqnum = 0x24;
65 // break;
67 // case vHidd_IRQ_Floppy:
68 // irqnum = 0x26;
69 // break;
71 // case vHidd_IRQ_RTC:
72 // irqnum = 0x28;
73 // break;
75 // case vHidd_IRQ_Mouse:
76 // irqnum = 0x2c;
77 // break;
79 // case vHidd_IRQ_HDD1:
80 // irqnum = 0x2e;
81 // break;
83 // case vHidd_IRQ_HDD2:
84 // irqnum = 0x2f;
85 // break;
88 else
89 irqnum = msg->id;
91 D(bug("Translated IRQ number is %d\n", irqnum));
93 if (irqnum >= 0 && irqnum <= 63)
95 static HIDDT_IRQ_HwInfo dummy;
96 dummy.sysBase = SysBase;
97 dummy.Error = 0;
100 * The interrupts are added through the kernel.resource now. I will store the Handle in
101 * Node structure of HIDDT_IRQ_Handler, which is not used anymore :)
103 msg->handlerinfo->h_Node.ln_Succ = KrnAddIRQHandler(irqnum, msg->handlerinfo->h_Code, msg->handlerinfo, &dummy);
105 ReturnInt("HIDDIRQ::AddHandler", ULONG, TRUE);
108 ReturnInt("HIDDIRQ::AddHandler", ULONG, FALSE);
111 /*** HIDDIRQ::RemHandler() ***************************************/
113 VOID Irq__Hidd_IRQ__RemHandler(OOP_Class *cl, OOP_Object *obj, struct pHidd_IRQ_RemHandler *msg)
115 EnterFunc(bug("HIDDIRQ::RemHandler()\n"));
116 D(bug("Removing handler %s\n",msg->handlerinfo->h_Node.ln_Name));
118 void *KernelBase = OpenResource("kernel.resource");
120 /* If ln_Succ is not empty then it surely points to the Handle returned from KrnAddIRQHandler().
121 * Use it to remove the handler by kernel.resource now */
123 if (msg->handlerinfo && msg->handlerinfo->h_Node.ln_Succ)
124 KrnRemIRQHandler(msg->handlerinfo->h_Node.ln_Succ);
126 msg->handlerinfo->h_Node.ln_Succ = NULL;
128 ReturnVoid("HIDDIRQ::RemHandler");
131 /*** HIDDIRQ::CauseIRQ() *****************************************/
133 VOID Irq__Hidd_IRQ__CauseIRQ(OOP_Class *cl, OOP_Object *obj, struct pHidd_CauseIRQ *msg)
135 EnterFunc(bug("HIDDIRQ::CauseIRQ()\n"));
136 #warning TODO: Write CauseIRQ method
137 ReturnVoid("HIDDIRQ::CauseIRQ");