1 | /* |
---|
2 | * TX4925 Interrupt Vectoring |
---|
3 | * |
---|
4 | * vectorisrs.c,v 1.6 2004/06/23 18:16:36 |
---|
5 | */ |
---|
6 | |
---|
7 | #include <rtems.h> |
---|
8 | #include <stdlib.h> |
---|
9 | #include <libcpu/tx4925.h> |
---|
10 | |
---|
11 | void mips_default_isr( int vector ); |
---|
12 | |
---|
13 | #define CALL_ISR(_vector,_frame) \ |
---|
14 | do { \ |
---|
15 | if ( _ISR_Vector_table[_vector] ) \ |
---|
16 | (_ISR_Vector_table[_vector])(_vector,_frame); \ |
---|
17 | else \ |
---|
18 | mips_default_isr(_vector); \ |
---|
19 | } while (0) |
---|
20 | |
---|
21 | #include <rtems/bspIo.h> /* for printk */ |
---|
22 | |
---|
23 | void mips_vector_isr_handlers( CPU_Interrupt_frame *frame ) |
---|
24 | { |
---|
25 | unsigned int sr; |
---|
26 | unsigned int cause; |
---|
27 | unsigned int pending; |
---|
28 | |
---|
29 | mips_get_sr( sr ); |
---|
30 | mips_get_cause( cause ); |
---|
31 | |
---|
32 | pending = (cause & sr & 0x700) >> CAUSE_IPSHIFT; |
---|
33 | |
---|
34 | if ( pending & 0x4 ) { /* (IP[2] == 1) ==> IP[3-7] are valid */ |
---|
35 | unsigned int v = (cause >> (CAUSE_IPSHIFT + 3)) & 0x1f; |
---|
36 | CALL_ISR( MIPS_INTERRUPT_BASE + v, frame ); |
---|
37 | } |
---|
38 | |
---|
39 | if ( pending & 0x01 ) /* IP[0] */ |
---|
40 | CALL_ISR( TX4925_IRQ_SOFTWARE_1, frame ); |
---|
41 | |
---|
42 | if ( pending & 0x02 ) /* IP[1] */ |
---|
43 | CALL_ISR( TX4925_IRQ_SOFTWARE_2, frame ); |
---|
44 | } |
---|
45 | |
---|
46 | void mips_default_isr( int vector ) |
---|
47 | { |
---|
48 | unsigned int sr; |
---|
49 | unsigned int cause; |
---|
50 | |
---|
51 | mips_get_sr( sr ); |
---|
52 | mips_get_cause( cause ); |
---|
53 | |
---|
54 | printk( "Unhandled isr exception: vector 0x%02x, cause 0x%08X, sr 0x%08X\n", |
---|
55 | vector, cause, sr ); |
---|
56 | |
---|
57 | while(1); /* Lock it up */ |
---|
58 | |
---|
59 | rtems_fatal_error_occurred(1); |
---|
60 | } |
---|
61 | |
---|