File tree 5 files changed +19
-30
lines changed
5 files changed +19
-30
lines changed Original file line number Diff line number Diff line change
1
+ #ifndef __INTERRUPT_H
2
+ #define __INTERRUPT_H
3
+
4
+ #define UART_INTERRUPT 0
5
+ #define TIMER0_INTERRUPT 1
6
+ #define MINIMAC_INTERRUPT 2
7
+
8
+ #endif /* __INTERRUPT_H */
Original file line number Diff line number Diff line change 15
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
*/
17
17
18
- #include <hw/interrupts.h>
19
18
#include <hw/uart.h>
19
+ #include <interrupt.h>
20
20
#include <irq.h>
21
21
#include <uart.h>
22
22
@@ -27,6 +27,6 @@ void isr(void)
27
27
28
28
irqs = irq_pending () & irq_getmask ();
29
29
30
- if (irqs & IRQ_UART )
30
+ if (irqs & ( 1 << UART_INTERRUPT ) )
31
31
uart_isr ();
32
32
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 18
18
#include <uart.h>
19
19
#include <irq.h>
20
20
#include <hw/uart.h>
21
- #include <hw/interrupts .h>
21
+ #include <interrupt .h>
22
22
23
23
/*
24
24
* Buffer sizes must be a power of 2 so that modulos can be computed
@@ -121,7 +121,7 @@ void uart_init(void)
121
121
CSR_UART_EV_ENABLE = UART_EV_TX | UART_EV_RX ;
122
122
123
123
mask = irq_getmask ();
124
- mask |= IRQ_UART ;
124
+ mask |= UART_INTERRUPT ;
125
125
irq_setmask (mask );
126
126
}
127
127
Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ def csr_offset(name):
63
63
assert ((base >= 0xe0000000 ) and (base <= 0xe0010000 ))
64
64
return (base - 0xe0000000 )// 0x800
65
65
66
+ interrupt_macros = get_macros ("common/interrupt.h" )
67
+ def interrupt_n (name ):
68
+ return int (interrupt_macros [name + "_INTERRUPT" ], 0 )
69
+
66
70
version = get_macros ("common/version.h" )["VERSION" ][1 :- 1 ]
67
71
68
72
def get ():
@@ -130,9 +134,9 @@ def get():
130
134
# Interrupts
131
135
#
132
136
interrupts = Fragment ([
133
- cpu0 .interrupt [0 ].eq (uart0 .events .irq ),
134
- cpu0 .interrupt [1 ].eq (timer0 .events .irq ),
135
- cpu0 .interrupt [2 ].eq (minimac0 .events .irq )
137
+ cpu0 .interrupt [interrupt_n ( "UART" ) ].eq (uart0 .events .irq ),
138
+ cpu0 .interrupt [interrupt_n ( "TIMER0" ) ].eq (timer0 .events .irq ),
139
+ cpu0 .interrupt [interrupt_n ( "MINIMAC" ) ].eq (minimac0 .events .irq )
136
140
])
137
141
138
142
#
You can’t perform that action at this time.
0 commit comments