-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrap.c
64 lines (55 loc) · 2.04 KB
/
trap.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "defs.h"
void __attribute__((__interrupt__,no_auto_psv)) _OscillatorFail(void);
void __attribute__((__interrupt__,no_auto_psv)) _AddressError(void);
void __attribute__((__interrupt__,no_auto_psv)) _StackError(void);
void __attribute__((__interrupt__,no_auto_psv)) _MathError(void);
void __attribute__((__interrupt__,no_auto_psv)) _AltOscillatorFail(void);
void __attribute__((__interrupt__,no_auto_psv)) _AltAddressError(void);
void __attribute__((__interrupt__,no_auto_psv)) _AltStackError(void);
void __attribute__((__interrupt__,no_auto_psv)) _AltMathError(void);
void __attribute__((__interrupt__,no_auto_psv)) _OscillatorFail(void)
{
INTCON1bits.OSCFAIL = 0; //Clear the trap flag
while (1);
}
void __attribute__((__interrupt__,no_auto_psv)) _AddressError(void)
{
INTCON1bits.ADDRERR = 0; //Clear the trap flag
while (1);
}
void __attribute__((__interrupt__,no_auto_psv)) _StackError(void)
{
INTCON1bits.STKERR = 0; //Clear the trap flag
while (1);
}
void __attribute__((__interrupt__,no_auto_psv)) _MathError(void)
{
INTCON1bits.MATHERR = 0; //Clear the trap flag
while (1);
}
/* Alternate Exception Vector handlers:
These routines are used if INTCON2bits.ALTIVT = 1.
All trap service routines in this file simply ensure that device
continuously executes code within the trap service routine. Users
may modify the basic framework provided here to suit to the needs
of their application. */
void __attribute__((__interrupt__,no_auto_psv)) _AltOscillatorFail(void)
{
INTCON1bits.OSCFAIL = 0;
while (1);
}
void __attribute__((__interrupt__,no_auto_psv)) _AltAddressError(void)
{
INTCON1bits.ADDRERR = 0;
while (1);
}
void __attribute__((__interrupt__,no_auto_psv)) _AltStackError(void)
{
INTCON1bits.STKERR = 0;
while (1);
}
void __attribute__((__interrupt__,no_auto_psv)) _AltMathError(void)
{
INTCON1bits.MATHERR = 0;
while (1);
}