8c062aa53ff3a5e1044ab7dcf03fa15e6a74492f
[AROS.git] / rom / exec / addintserver.c
blob8c062aa53ff3a5e1044ab7dcf03fa15e6a74492f
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add interrupt client to chain of interrupt servers
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <aros/libcall.h>
11 #include <exec/execbase.h>
12 #include <exec/interrupts.h>
13 #include <hardware/intbits.h>
14 #include <proto/exec.h>
15 #include <proto/kernel.h>
17 #include "exec_intern.h"
18 #include "chipset.h"
20 static void krnIRQwrapper(void *data1, void *data2)
22 struct Interrupt *irq = (struct Interrupt *)data1;
23 struct ExecBase *SysBase = (struct ExecBase *)data2;
25 AROS_INTC1(irq->is_Code, irq->is_Data);
28 /*****************************************************************************
30 NAME */
32 AROS_LH2(void, AddIntServer,
34 /* SYNOPSIS */
35 AROS_LHA(ULONG, intNumber, D0),
36 AROS_LHA(struct Interrupt *, interrupt, A1),
38 /* LOCATION */
39 struct ExecBase *, SysBase, 28, Exec)
41 /* FUNCTION
43 INPUTS
45 RESULT
47 NOTES
48 This function also enables the corresponding chipset interrupt if
49 run on a native Amiga.
51 EXAMPLE
53 BUGS
55 SEE ALSO
57 INTERNALS
59 ******************************************************************************/
61 AROS_LIBFUNC_INIT
63 if (intNumber >= INTB_KERNEL) {
64 /* N.B. ln_Succ is being re-purposed/abused here */
65 interrupt->is_Node.ln_Succ = KrnAddIRQHandler(intNumber - INTB_KERNEL, krnIRQwrapper, interrupt, SysBase);
66 return;
69 Disable();
71 Enqueue((struct List *)SysBase->IntVects[intNumber].iv_Data, &interrupt->is_Node);
72 CUSTOM_ENABLE(intNumber);
74 Enable();
76 AROS_LIBFUNC_EXIT
77 } /* AddIntServer */