| 14 |
theseven |
1 |
//
|
|
|
2 |
//
|
|
|
3 |
// Copyright 2010 TheSeven
|
|
|
4 |
//
|
|
|
5 |
//
|
|
|
6 |
// This file is part of emBIOS.
|
|
|
7 |
//
|
|
|
8 |
// emBIOS is free software: you can redistribute it and/or
|
|
|
9 |
// modify it under the terms of the GNU General Public License as
|
|
|
10 |
// published by the Free Software Foundation, either version 2 of the
|
|
|
11 |
// License, or (at your option) any later version.
|
|
|
12 |
//
|
|
|
13 |
// emBIOS is distributed in the hope that it will be useful,
|
|
|
14 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
15 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
16 |
// See the GNU General Public License for more details.
|
|
|
17 |
//
|
|
|
18 |
// You should have received a copy of the GNU General Public License along
|
|
|
19 |
// with emBIOS. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20 |
//
|
|
|
21 |
//
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
#include "global.h"
|
|
|
25 |
#include "panic.h"
|
|
|
26 |
#include "s5l8701.h"
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
#define default_interrupt(name) extern __attribute__((weak,alias("unhandled_irq"))) void name(void)
|
|
|
30 |
|
|
|
31 |
default_interrupt(EXT0);
|
|
|
32 |
default_interrupt(EXT1);
|
|
|
33 |
default_interrupt(EXT2);
|
|
|
34 |
default_interrupt(EINT_VBUS);
|
|
|
35 |
default_interrupt(EINTG);
|
|
|
36 |
default_interrupt(INT_TIMERA);
|
|
|
37 |
default_interrupt(INT_WDT);
|
|
|
38 |
default_interrupt(INT_TIMERB);
|
|
|
39 |
default_interrupt(INT_TIMERC);
|
|
|
40 |
default_interrupt(INT_TIMERD);
|
|
|
41 |
default_interrupt(INT_DMA);
|
|
|
42 |
default_interrupt(INT_ALARM_RTC);
|
|
|
43 |
default_interrupt(INT_PRI_RTC);
|
|
|
44 |
default_interrupt(RESERVED1);
|
|
|
45 |
default_interrupt(INT_UART);
|
|
|
46 |
default_interrupt(INT_USB_HOST);
|
|
|
47 |
default_interrupt(INT_USB_FUNC);
|
|
|
48 |
default_interrupt(INT_LCDC_0);
|
|
|
49 |
default_interrupt(INT_LCDC_1);
|
|
|
50 |
default_interrupt(INT_ECC);
|
|
|
51 |
default_interrupt(INT_CALM);
|
|
|
52 |
default_interrupt(INT_ATA);
|
|
|
53 |
default_interrupt(INT_UART0);
|
|
|
54 |
default_interrupt(INT_SPDIF_OUT);
|
|
|
55 |
default_interrupt(INT_SDCI);
|
|
|
56 |
default_interrupt(INT_LCD);
|
|
|
57 |
default_interrupt(INT_SPI);
|
|
|
58 |
default_interrupt(INT_IIC);
|
|
|
59 |
default_interrupt(RESERVED2);
|
|
|
60 |
default_interrupt(INT_MSTICK);
|
|
|
61 |
default_interrupt(INT_ADC_WAKEUP);
|
|
|
62 |
default_interrupt(INT_ADC);
|
|
|
63 |
default_interrupt(INT_UNK1);
|
|
|
64 |
default_interrupt(INT_UNK2);
|
|
|
65 |
default_interrupt(INT_UNK3);
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
void unhandled_irq(void)
|
|
|
69 |
{
|
|
|
70 |
panicf(PANIC_FATAL, "Unhandled IRQ %d!", INTOFFSET);
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
void INT_TIMER()
|
|
|
74 |
{
|
|
|
75 |
if (TACON & 0x00038000) INT_TIMERA();
|
|
|
76 |
if (TBCON & 0x00038000) INT_TIMERB();
|
|
|
77 |
if (TCCON & 0x00038000) INT_TIMERC();
|
|
|
78 |
if (TDCON & 0x00038000) INT_TIMERD();
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
static void (* const irqvector[])(void) =
|
|
|
82 |
{
|
|
|
83 |
EXT0,EXT1,EXT2,EINT_VBUS,EINTG,INT_TIMER,INT_WDT,INT_UNK1,
|
|
|
84 |
INT_UNK2,INT_UNK3,INT_DMA,INT_ALARM_RTC,INT_PRI_RTC,RESERVED1,INT_UART,INT_USB_HOST,
|
|
|
85 |
INT_USB_FUNC,INT_LCDC_0,INT_LCDC_1,INT_CALM,INT_ATA,INT_UART0,INT_SPDIF_OUT,INT_ECC,
|
|
|
86 |
INT_SDCI,INT_LCD,INT_SPI,INT_IIC,RESERVED2,INT_MSTICK,INT_ADC_WAKEUP,INT_ADC
|
|
|
87 |
};
|
|
|
88 |
|
|
|
89 |
void irqhandler(void)
|
|
|
90 |
{
|
|
|
91 |
int irq_no = INTOFFSET;
|
|
|
92 |
irqvector[irq_no]();
|
|
|
93 |
SRCPND = (1 << irq_no);
|
|
|
94 |
INTPND = INTPND;
|
|
|
95 |
}
|