2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id: irqclass.c 25081 2006-12-15 17:27:59Z jogr0326 $
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 /* Don't initialize them with "= 0", otherwise they end up in the DATA segment! */
27 static OOP_AttrBase HiddIRQAttrBase
;
29 static struct OOP_ABDescr attrbases
[] =
31 { IID_Hidd_IRQ
, &HiddIRQAttrBase
},
35 /*** HIDDIRQ::AddHandler() ***************************************/
37 BOOL
Irq__Hidd_IRQ__AddHandler(OOP_Class
*cl
, OOP_Object
*obj
, struct pHidd_IRQ_AddHandler
*msg
)
39 LONG irqnum
= msg
->id
;
41 EnterFunc(bug("HIDDIRQ::AddHandler()\n"));
42 D(bug("Adding handler %s, irq %d\n",msg
->handlerinfo
->h_Node
.ln_Name
, msg
->id
));
52 case vHidd_IRQ_Keyboard
:
56 case vHidd_IRQ_Serial2
:
60 case vHidd_IRQ_Serial1
:
64 case vHidd_IRQ_Floppy
:
85 else if (msg
->id
>= 0 && msg
->id
<= 15)
86 irqnum
= msg
->id
+ 0x20;
88 D(bug("Translated IRQ number is %d\n", irqnum
));
90 if (irqnum
>= 0x20 && irqnum
<= 0xfe)
92 void *KernelBase
= TLS_GET(KernelBase
);
93 static HIDDT_IRQ_HwInfo dummy
;
94 dummy
.sysBase
= TLS_GET(SysBase
);
98 * The interrupts are added through the kernel.resource now. I will store the Handle in
99 * Node structure of HIDDT_IRQ_Handler, which is not used anymore :)
101 msg
->handlerinfo
->h_Node
.ln_Succ
= KrnAddIRQHandler(irqnum
, msg
->handlerinfo
->h_Code
, msg
->handlerinfo
, &dummy
);
103 ReturnInt("HIDDIRQ::AddHandler", ULONG
, TRUE
);
106 ReturnInt("HIDDIRQ::AddHandler", ULONG
, FALSE
);
109 /*** HIDDIRQ::RemHandler() ***************************************/
111 VOID
Irq__Hidd_IRQ__RemHandler(OOP_Class
*cl
, OOP_Object
*obj
, struct pHidd_IRQ_RemHandler
*msg
)
113 EnterFunc(bug("HIDDIRQ::RemHandler()\n"));
114 D(bug("Removing handler %s\n",msg
->handlerinfo
->h_Node
.ln_Name
));
116 void *KernelBase
= TLS_GET(KernelBase
);
118 /* If ln_Succ is not empty then it surely points to the Handle returned from KrnAddIRQHandler().
119 * Use it to remove the handler by kernel.resource now */
121 if (msg
->handlerinfo
&& msg
->handlerinfo
->h_Node
.ln_Succ
)
122 KrnRemIRQHandler(msg
->handlerinfo
->h_Node
.ln_Succ
);
124 msg
->handlerinfo
->h_Node
.ln_Succ
= NULL
;
126 ReturnVoid("HIDDIRQ::RemHandler");
129 /*** HIDDIRQ::CauseIRQ() *****************************************/
131 VOID
Irq__Hidd_IRQ__CauseIRQ(OOP_Class
*cl
, OOP_Object
*obj
, struct pHidd_CauseIRQ
*msg
)
133 EnterFunc(bug("HIDDIRQ::CauseIRQ()\n"));
134 #warning TODO: Write CauseIRQ method
135 ReturnVoid("HIDDIRQ::CauseIRQ");