2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
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>
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
},
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
));
55 // case vHidd_IRQ_Keyboard:
59 // case vHidd_IRQ_Serial2:
63 // case vHidd_IRQ_Serial1:
67 // case vHidd_IRQ_Floppy:
71 // case vHidd_IRQ_RTC:
75 // case vHidd_IRQ_Mouse:
79 // case vHidd_IRQ_HDD1:
83 // case vHidd_IRQ_HDD2:
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
;
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");