OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_processor/] [or1200/] [sw/] [or1200/] [exceptions.c] - Blame information for rev 38

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 alirezamon
#include "or1200-utils.h"
2
#include "int.h" // User interrupt handler header
3
//#include "uart.h"
4
//#include "printf.h"
5
 
6
#define STR_EXCEPTION_OCCURED " exception occured.\n"
7
 
8
char *exception_strings[] = {
9
  "An unknown",             // 0
10
  "A reset (?!)",           // 1 
11
  "A Bus Error",            // 2
12
  "A Data Page Fault",      // 3
13
  "An Instruction Page Fault", // 4
14
  "A Tick-Timer",              // 5
15
  "An Alignment",              // 6
16
  "An Illegal Instruction",    // 7
17
  "An External Interrupt",     // 8
18
  "A D-TLB Miss",              // 9
19
  "An I-TLB Miss",             // a
20
  "A Range",                   // b
21
  "A System Call",             // c
22
  "A Floating-Point",          // d
23
  "A Trap",                    // e
24
  "A \"Reserved\"",            // f
25
  "A \"Reserved\"",            // 10
26
  "A \"Reserved\"",            // 11
27
  "A \"Reserved\"",            // 12
28
  "A \"Reserved\"",            // 13
29
  "A \"Reserved\"",            // 14
30
  "An Implementation Specific \"Reserved\"", // 16
31
  "An Implementation Specific \"Reserved\"", // 17
32
  "An Implementation Specific \"Reserved\"", // 18
33
  "A Custom",                                // 19
34
  "A Custom",                                // 1a
35
  "A Custom",                                // 1b
36
  "A Custom",                                // 1c
37
  "A Custom",                                // 1d
38
  "A Custom",                                // 1e
39
  "A Custom",                                // 1f
40
};
41
 
42
extern void int_main(void);
43
extern void cpu_timer_tick(void);
44
 
45
void (*except_handlers[]) (void)  = {0,    // 0
46
                                    0,    // 1
47
                                    0,    // 2
48
                                    0,    // 3
49
                                    0,    // 4
50
                                    cpu_timer_tick,    // 5
51
                                    0,    // 6
52
                                    0,    // 7
53
                                    int_main,    // 8
54
                                    0,    // 9
55
                                    0,    // a
56
                                    0,    // b
57
                                    0,    // c
58
                                    0,    // d
59
                                    0,    // e
60
                                    0,    // f
61
                                    0,    // 10
62
                                    0,    // 11
63
                                    0,    // 12
64
                                    0};    // 13
65
 
66
 
67
void
68
add_handler(unsigned long vector, void (*handler) (void))
69
{
70
  except_handlers[vector] = handler;
71
}
72
 
73
void
74
default_exception_handler_c(unsigned exception_address,unsigned epc)
75
{
76
  int exception_no = (exception_address >> 8) & 0x1f;
77
  if (except_handlers[exception_no])
78
    {
79
            (*except_handlers[exception_no])();
80
            return;
81
    }
82
 
83
  // init uart here, incase it hasn't been
84
  //uart_init(DEFAULT_UART);
85
 
86
  //printf("EPC = 0x%.8x\n", exception_address);
87
 
88
  // Output initial messaging using low-level functions incase
89
  // something really bad happened.
90
  //printf("%s%s", exception_strings[exception_no],      STR_EXCEPTION_OCCURED);
91
 
92
  // Icing on the cake using fancy functions
93
  //printf("EPC = 0x%.8x\n", epc);
94
  report(exception_address);
95
  report(epc);
96
  __asm__("l.nop 1");
97
  for(;;);
98
}
99
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.