1 /***************************************************************************
2 
3 	cpuint.h
4 
5 	Core multi-CPU interrupt engine.
6 
7 ***************************************************************************/
8 
9 #ifndef CPUINT_H
10 #define CPUINT_H
11 
12 #include "osd_cpu.h"
13 #include "memory.h"
14 #include "timer.h"
15 #include "hiscore.h"
16 
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 
23 /*************************************
24  *
25  *	Interrupt constants
26  *
27  *************************************/
28 
29 enum
30 {
31 	/* generic "none" vector */
32 	INTERRUPT_NONE = 126
33 };
34 
35 
36 
37 /*************************************
38  *
39  *	Startup/shutdown
40  *
41  *************************************/
42 
43 int cpuint_init(void);
44 
45 void cpuint_reset_cpu(int cpunum);
46 
47 extern int (*cpu_irq_callbacks[])(int);
48 
49 
50 
51 /*************************************
52  *
53  *	Interrupt handling
54  *
55  *************************************/
56 
57 /* Install a driver callback for IRQ acknowledge */
58 void cpu_set_irq_callback(int cpunum, int (*callback)(int irqline));
59 
60 /* Set the vector to be returned during a CPU's interrupt acknowledge cycle */
61 void cpu_irq_line_vector_w(int cpunum, int irqline, int vector);
62 
63 /* set the IRQ line state for a specific irq line of a CPU */
64 /* normally use state HOLD_LINE, irqline 0 for first IRQ type of a cpu */
65 void cpu_set_irq_line(int cpunum, int irqline, int state);
66 
67 /* set the IRQ line state and a vector for the IRQ */
68 void cpu_set_irq_line_and_vector(int cpunum, int irqline, int state, int vector);
69 
70 /* macro for handling NMI lines */
71 #define cpu_set_nmi_line(cpunum, state) cpu_set_irq_line(cpunum, IRQ_LINE_NMI, state)
72 
73 
74 
75 /*************************************
76  *
77  *	Preferred interrupt callbacks
78  *
79  *************************************/
80 
81 INTERRUPT_GEN( nmi_line_pulse );
82 INTERRUPT_GEN( nmi_line_assert );
83 
84 INTERRUPT_GEN( irq0_line_hold );
85 INTERRUPT_GEN( irq0_line_pulse );
86 INTERRUPT_GEN( irq0_line_assert );
87 
88 INTERRUPT_GEN( irq1_line_hold );
89 INTERRUPT_GEN( irq1_line_pulse );
90 INTERRUPT_GEN( irq1_line_assert );
91 
92 INTERRUPT_GEN( irq2_line_hold );
93 INTERRUPT_GEN( irq2_line_pulse );
94 INTERRUPT_GEN( irq2_line_assert );
95 
96 INTERRUPT_GEN( irq3_line_hold );
97 INTERRUPT_GEN( irq3_line_pulse );
98 INTERRUPT_GEN( irq3_line_assert );
99 
100 INTERRUPT_GEN( irq4_line_hold );
101 INTERRUPT_GEN( irq4_line_pulse );
102 INTERRUPT_GEN( irq4_line_assert );
103 
104 INTERRUPT_GEN( irq5_line_hold );
105 INTERRUPT_GEN( irq5_line_pulse );
106 INTERRUPT_GEN( irq5_line_assert );
107 
108 INTERRUPT_GEN( irq6_line_hold );
109 INTERRUPT_GEN( irq6_line_pulse );
110 INTERRUPT_GEN( irq6_line_assert );
111 
112 INTERRUPT_GEN( irq7_line_hold );
113 INTERRUPT_GEN( irq7_line_pulse );
114 INTERRUPT_GEN( irq7_line_assert );
115 
116 
117 
118 /*************************************
119  *
120  *	Obsolete interrupt handling
121  *
122  *************************************/
123 
124 /* OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE */
125 /* OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE */
126 /* OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE */
127 
128 /* Obsolete functions: avoid using them in new drivers, as many of them will
129    go away in the future! */
130 
131 void cpu_interrupt_enable(int cpu,int enabled);
132 WRITE_HANDLER( interrupt_enable_w );
133 WRITE_HANDLER( interrupt_vector_w );
134 READ_HANDLER( interrupt_enable_r );
135 
136 /* OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE */
137 /* OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE */
138 /* OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE OBSOLETE */
139 
140 
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif	/* CPUEXEC_H */
147