2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: IRQ servers for SA1110
10 #include <aros/asmcall.h>
11 #include <exec/types.h>
12 #include <exec/lists.h>
13 #include <exec/interrupts.h>
14 #include <exec/execbase.h>
15 #include <exec/memory.h>
17 #include <utility/utility.h>
18 #include <hardware/intbits.h>
20 #include <exec/ptrace.h>
23 #include <proto/exec.h>
24 #include <proto/oop.h>
27 #include <aros/core.h>
30 # include <aros/debug.h>
37 void global_server(int cpl
, void *isd
, struct pt_regs
*);
39 struct irqServer irq_int
= { global_server
, "irq: (all) " , NULL
};
41 void timer_interrupt(HIDDT_IRQ_Handler
*irq
, HIDDT_IRQ_HwInfo
*hw
);
43 /*******************************************************************************
44 Two special irq handlers. As we don't need these two interrupts we define
46 *******************************************************************************/
48 void no_action(int cpl
, void *dev_id
, struct pt_regs
*regs
, struct irq_staticdata
*isd
) { }
51 #define SysBase (isd->sysbase)
53 void init_Servers(struct irq_staticdata
*isd
)
55 HIDDT_IRQ_Handler
*timer
;
57 irqSet(1, &irq_int
, (void *)isd
, SysBase
);
59 /* Install timer interrupt */
60 timer
= AllocMem(sizeof(HIDDT_IRQ_Handler
), MEMF_CLEAR
|MEMF_PUBLIC
);
62 timer
->h_Node
.ln_Name
= "INT_VERTB emulator";
63 timer
->h_Node
.ln_Type
= NT_INTERRUPT
;
64 timer
->h_Node
.ln_Pri
= 0;
65 timer
->h_Data
= &SysBase
->IntVects
[INTB_VERTB
];
66 timer
->h_Code
= timer_interrupt
;
68 Enqueue((struct List
*)&isd
->irqlist
[vHidd_IRQ_Timer
], (struct Node
*)timer
);
74 /*******************************************************************************
75 This timer interrupt is used to keep compatibility with old Amiga software
76 *******************************************************************************/
78 void timer_interrupt(HIDDT_IRQ_Handler
*irq
, HIDDT_IRQ_HwInfo
*hw
)
80 struct IntVector
*iv
= irq
->h_Data
;
84 /* Call it. I call with all these parameters for a reason.
86 In my `Amiga ROM Kernel Reference Manual: Libraries and
87 Devices' (the 1.3 version), interrupt servers are called
88 with the following 5 parameters.
90 D1 - Mask of INTENAR and INTREQR
91 A0 - 0xDFF000 (base of custom chips)
93 A5 - Interrupt Code vector
96 It is quite possible that some code uses all of these, so
97 I must supply them here. Obviously I will dummy some of these
100 AROS_UFC5(void, iv
->iv_Code
,
101 AROS_UFCA(ULONG
, 0, D1
),
102 AROS_UFCA(ULONG
, 0, A0
),
103 AROS_UFCA(APTR
, iv
->iv_Data
, A1
),
104 AROS_UFCA(APTR
, iv
->iv_Code
, A5
),
105 AROS_UFCA(struct ExecBase
*, hw
->sysBase
, A6
));
108 if (--SysBase
->Elapsed
== 0) {
109 SysBase
->SysFlags
|= 0x2000;
110 SysBase
->AttnResched
|= 0x80;
116 /*******************************************************************************
117 Global Interrupt Handler
119 This piece of code translates real irq number to AROS specific irq id. This
120 allows us to map system-dependent irqs (audio, ethernet and so on) into well
122 *******************************************************************************/
125 #define SysBase (isd->sysbase)
127 HIDDT_IRQ_Id translation_table
[] = {
134 -1, //vHidd_IRQ_Floppy,
140 -1, //vHidd_IRQ_Mouse,
142 -1, //vHidd_IRQ_HDD1,
147 void global_server(int cpl
, void *_isd
, struct pt_regs
*regs
)
149 struct irq_staticdata
* isd
= (struct irq_staticdata
*)_isd
;
150 if (cpl
>= 0 && cpl
<= 15) {
152 HIDDT_IRQ_HwInfo hwinfo
;
153 HIDDT_IRQ_Handler
*handler
;
155 if (-1 == (id
= translation_table
[cpl
]))
158 hwinfo
.Error
= 0; /* No errorcode */
159 hwinfo
.sysBase
= isd
->sysbase
;
161 /* Execute all installed handlers */
162 ForeachNode(&isd
->irqlist
[id
], handler
) {
163 handler
->h_Code(handler
, &hwinfo
);
166 /* Leave the interrupt. */