OpenCores
URL https://opencores.org/ocsvn/mips32r1/mips32r1/trunk

Subversion Repositories mips32r1

[/] [mips32r1/] [trunk/] [Software/] [demos/] [XD5_Threads/] [src/] [os/] [exception_handler.c] - Blame information for rev 9

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ayersg
#include "drivers/lcd.h"
2
#include "drivers/piezo.h"
3
#include "drivers/monitor.h"
4
#include "drivers/uart.h"
5
 
6
void dead_loop(void)
7
{
8
        for (;;) {}
9
}
10
 
11
void mips32_handler_AdEL(void)
12
{
13
        LCD_clear();
14
        LCD_printString("AdEL");
15
        dead_loop();
16
}
17
 
18
void mips32_handler_AdES(void)
19
{
20
        LCD_clear();
21
        LCD_printString("AdES");
22
        dead_loop();
23
}
24
 
25
void mips32_handler_Bp(void)
26
{
27
        LCD_clear();
28
        LCD_printString("Bp");
29
        dead_loop();
30
}
31
 
32
void mips32_handler_CpU(void)
33
{
34
        LCD_clear();
35
        LCD_printString("CpU");
36
        dead_loop();
37
}
38
 
39
void mips32_handler_Ov(void)
40
{
41
        LCD_clear();
42
        LCD_printString("Ov");
43
        dead_loop();
44
}
45
 
46
void mips32_handler_RI(void)
47
{
48
        LCD_clear();
49
        LCD_printString("RI");
50
        dead_loop();
51
}
52
 
53
void mips32_handler_Sys(void)
54
{
55
        LCD_clear();
56
        LCD_printString("Sys");
57
        dead_loop();
58
}
59
 
60
void mips32_handler_Tr(void)
61
{
62
        LCD_clear();
63
        LCD_printString("Trap");
64
        dead_loop();
65
}
66
 
67
/* Timer is bypassed to scheduler in this demo */
68
void mips32_handler_HwInt5(void)
69
{
70
}
71
 
72
void mips32_handler_HwInt4(void)
73
{
74
        static volatile char count = 0;
75
 
76
        LCD_printByte(count);
77
        count++;
78
}
79
 
80
void mips32_handler_HwInt3(void)
81
{
82
        static volatile char count = 0;
83
 
84
        LCD_printByte(count);
85
        count++;
86
}
87
 
88
void mips32_handler_HwInt2(void)
89
{
90
        static volatile char count = 0;
91
 
92
        LCD_printByte(count);
93
        count++;
94
}
95
 
96
void mips32_handler_HwInt1(void)
97
{
98
        static volatile char count = 0;
99
 
100
        LCD_printByte(count);
101
        count++;
102
}
103
 
104
 
105
/* UART */
106
void mips32_handler_HwInt0(void)
107
{
108
        uint32_t recv_msg;
109
        uint32_t bytes_avail;
110
        uint8_t  read_byte;
111
 
112
        recv_msg = UART_readMessage();
113
        read_byte = (uint8_t)recv_msg;
114
        bytes_avail = (recv_msg >> 8);
115
 
116
        while (bytes_avail > 0) {
117
                if (read_byte == 0x7f) {  // delete
118
                        LCD_setAutoIncr(0);
119
                        LCD_printByte(0x20);
120
                        LCD_setPos(LCD_getPos()-1);
121
                        LCD_setAutoIncr(1);
122
                }
123
                else {
124
                        LCD_printByte(read_byte);
125
                }
126
                bytes_avail--;
127
                read_byte = UART_readByte();
128
        }
129
}
130
 
131
void mips32_handler_SwInt1(void)
132
{
133
        static volatile char count = 0;
134
 
135
        LCD_printByte(count);
136
        count++;
137
}
138
 
139
void mips32_handler_SwInt0(void)
140
{
141
        static volatile char count = 0;
142
 
143
        LCD_printByte(count);
144
        count++;
145
}
146
 

powered by: WebSVN 2.1.0

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