1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup bsp_interrupt |
---|
5 | * |
---|
6 | * @brief Interrupt support. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2005 by Cogent Computer Systems |
---|
11 | * Written by Jay Monkman <jtm@lopingdog.com> |
---|
12 | * |
---|
13 | * COPYRIGHT (c) 1989-2012. |
---|
14 | * On-Line Applications Research Corporation (OAR). |
---|
15 | * |
---|
16 | * The license and distribution terms for this file may be |
---|
17 | * found in the file LICENSE in this distribution or at |
---|
18 | * http://www.rtems.com/license/LICENSE. |
---|
19 | * |
---|
20 | * $Id$ |
---|
21 | */ |
---|
22 | |
---|
23 | |
---|
24 | #include <bsp.h> |
---|
25 | #include <bsp/irq.h> |
---|
26 | #include <bsp/irq-generic.h> |
---|
27 | #include <libcpu/isr_entries.h> |
---|
28 | |
---|
29 | static const char *const cause_strings[32] = { |
---|
30 | /* 0 */ "Int", |
---|
31 | /* 1 */ "TLB Mods", |
---|
32 | /* 2 */ "TLB Load", |
---|
33 | /* 3 */ "TLB Store", |
---|
34 | /* 4 */ "Address Load", |
---|
35 | /* 5 */ "Address Store", |
---|
36 | /* 6 */ "Instruction Bus Error", |
---|
37 | /* 7 */ "Data Bus Error", |
---|
38 | /* 8 */ "Syscall", |
---|
39 | /* 9 */ "Breakpoint", |
---|
40 | /* 10 */ "Reserved Instruction", |
---|
41 | /* 11 */ "Coprocessor Unuseable", |
---|
42 | /* 12 */ "Overflow", |
---|
43 | /* 13 */ "Trap", |
---|
44 | /* 14 */ "Instruction Virtual Coherency Error", |
---|
45 | /* 15 */ "FP Exception", |
---|
46 | /* 16 */ "Reserved 16", |
---|
47 | /* 17 */ "Reserved 17", |
---|
48 | /* 18 */ "Reserved 18", |
---|
49 | /* 19 */ "Reserved 19", |
---|
50 | /* 20 */ "Reserved 20", |
---|
51 | /* 21 */ "Reserved 21", |
---|
52 | /* 22 */ "Reserved 22", |
---|
53 | /* 23 */ "Watch", |
---|
54 | /* 24 */ "Reserved 24", |
---|
55 | /* 25 */ "Reserved 25", |
---|
56 | /* 26 */ "Reserved 26", |
---|
57 | /* 27 */ "Reserved 27", |
---|
58 | /* 28 */ "Reserved 28", |
---|
59 | /* 29 */ "Reserved 29", |
---|
60 | /* 30 */ "Reserved 30", |
---|
61 | /* 31 */ "Data Virtual Coherency Error" |
---|
62 | }; |
---|
63 | |
---|
64 | static inline bool bsp_irq_is_valid(rtems_vector_number vector) |
---|
65 | { |
---|
66 | return vector <= BSP_INTERRUPT_VECTOR_MAX; |
---|
67 | } |
---|
68 | |
---|
69 | rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector) |
---|
70 | { |
---|
71 | return RTEMS_SUCCESSFUL; |
---|
72 | } |
---|
73 | |
---|
74 | rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector) |
---|
75 | { |
---|
76 | return RTEMS_SUCCESSFUL; |
---|
77 | } |
---|
78 | |
---|
79 | rtems_status_code bsp_interrupt_facility_initialize(void) |
---|
80 | { |
---|
81 | mips_install_isr_entries(); |
---|
82 | return RTEMS_SUCCESSFUL; |
---|
83 | } |
---|
84 | |
---|
85 | void bsp_interrupt_handler_default(rtems_vector_number vector) |
---|
86 | { |
---|
87 | uint32_t sr; |
---|
88 | uint32_t cause; |
---|
89 | |
---|
90 | mips_get_sr( sr ); |
---|
91 | mips_get_cause( cause ); |
---|
92 | |
---|
93 | printk( "Unhandled exception %d\n", vector ); |
---|
94 | printk( "sr: 0x%08x cause: 0x%08x --> %s\n", sr, cause, |
---|
95 | cause_strings[(cause >> 2) &0x1f] ); |
---|
96 | #if 0 |
---|
97 | mips_dump_exception_frame( frame ); |
---|
98 | #endif |
---|
99 | rtems_fatal_error_occurred(1); |
---|
100 | } |
---|