revert between 56095 -> 55830 in arch
[AROS.git] / rom / exec / addintserver.c
blobae02732be9a0705c5b1a9a6cfc2d5675e902ebd8
1 /*
2 Copyright © 1995-2017, 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>
16 #include "exec_intern.h"
17 #include "exec_debug.h"
18 #include "chipset.h"
19 #include "exec_locks.h"
21 static void krnIRQwrapper(void *data1, void *data2)
23 struct Interrupt *irq = (struct Interrupt *)data1;
24 struct ExecBase *SysBase = (struct ExecBase *)data2;
26 AROS_INTC1(irq->is_Code, irq->is_Data);
29 /*****************************************************************************
31 NAME */
33 AROS_LH2(void, AddIntServer,
35 /* SYNOPSIS */
36 AROS_LHA(ULONG, intNumber, D0),
37 AROS_LHA(struct Interrupt *, interrupt, A1),
39 /* LOCATION */
40 struct ExecBase *, SysBase, 28, Exec)
42 /* FUNCTION
44 INPUTS
46 RESULT
48 NOTES
49 This function also enables the corresponding chipset interrupt if
50 run on a native Amiga.
52 EXAMPLE
54 BUGS
56 SEE ALSO
58 INTERNALS
60 ******************************************************************************/
62 AROS_LIBFUNC_INIT
64 ExecLog(SysBase, EXECDEBUGF_EXCEPTHANDLER, "AddIntServer: Int %d, Interrupt %p\n", intNumber, interrupt);
66 if (intNumber >= INTB_KERNEL) {
67 /* N.B. ln_Succ is being re-purposed/abused here */
68 interrupt->is_Node.ln_Succ = KrnAddIRQHandler(intNumber - INTB_KERNEL, krnIRQwrapper, interrupt, SysBase);
69 return;
72 EXEC_LOCK_LIST_WRITE_AND_DISABLE(&SysBase->IntrList);
74 Enqueue((struct List *)SysBase->IntVects[intNumber].iv_Data, &interrupt->is_Node);
75 CUSTOM_ENABLE(intNumber);
77 EXEC_UNLOCK_LIST_AND_ENABLE(&SysBase->IntrList);
79 AROS_LIBFUNC_EXIT
80 } /* AddIntServer */