Skip to content

Commit c01594f

Browse files
author
Sebastien Bourdeauducq
committedMay 21, 2012
Common interrupt numbers
1 parent 9424551 commit c01594f

File tree

5 files changed

+19
-30
lines changed

5 files changed

+19
-30
lines changed
 

‎common/interrupt.h

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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 */

‎software/bios/isr.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
#include <hw/interrupts.h>
1918
#include <hw/uart.h>
19+
#include <interrupt.h>
2020
#include <irq.h>
2121
#include <uart.h>
2222

@@ -27,6 +27,6 @@ void isr(void)
2727

2828
irqs = irq_pending() & irq_getmask();
2929

30-
if(irqs & IRQ_UART)
30+
if(irqs & (1 << UART_INTERRUPT))
3131
uart_isr();
3232
}

‎software/include/hw/interrupts.h

-23
This file was deleted.

‎software/libbase/uart.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <uart.h>
1919
#include <irq.h>
2020
#include <hw/uart.h>
21-
#include <hw/interrupts.h>
21+
#include <interrupt.h>
2222

2323
/*
2424
* Buffer sizes must be a power of 2 so that modulos can be computed
@@ -121,7 +121,7 @@ void uart_init(void)
121121
CSR_UART_EV_ENABLE = UART_EV_TX | UART_EV_RX;
122122

123123
mask = irq_getmask();
124-
mask |= IRQ_UART;
124+
mask |= UART_INTERRUPT;
125125
irq_setmask(mask);
126126
}
127127

‎top.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def csr_offset(name):
6363
assert((base >= 0xe0000000) and (base <= 0xe0010000))
6464
return (base - 0xe0000000)//0x800
6565

66+
interrupt_macros = get_macros("common/interrupt.h")
67+
def interrupt_n(name):
68+
return int(interrupt_macros[name + "_INTERRUPT"], 0)
69+
6670
version = get_macros("common/version.h")["VERSION"][1:-1]
6771

6872
def get():
@@ -130,9 +134,9 @@ def get():
130134
# Interrupts
131135
#
132136
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)
136140
])
137141

138142
#

0 commit comments

Comments
 (0)
Please sign in to comment.