NetBurner 3.5.0
PDF Version
cfinter.h
Go to the documentation of this file.
1
/*NB_REVISION*/
2
3
/*NB_COPYRIGHT*/
4
31
#ifndef _COLDFIRE_INTERRUPT_H
32
#define _COLDFIRE_INTERRUPT_H
33
34
#ifdef __cplusplus
35
36
#ifdef _NBRTOS_H
37
55
#define INTERRUPT(x, y) \
56
extern "C" \
57
{ \
58
void real_##x(); \
59
void x(); \
60
} \
61
void fake_##x() \
62
{ \
63
__asm__(".global " #x); \
64
__asm__(#x ":"); \
65
__asm__("move.w #0x2700,%sr "); \
66
__asm__("lea -60(%a7),%a7 "); \
67
__asm__("movem.l %d0-%d7/%a0-%a6,(%a7) "); \
68
__asm__("move.l (OSISRLevel32),%d0 "); \
69
__asm__("move.l %d0,-(%sp) "); \
70
__asm__("move.l (OSIntNesting),%d0"); \
71
__asm__("addq.l #1,%d0"); \
72
__asm__("move.l %d0,(OSIntNesting)"); \
73
__asm__("move.l #" #y ",%d0 "); \
74
__asm__("move.w %d0,%sr "); \
75
__asm__("move.l %d0,(OSISRLevel32)"); \
76
__asm__("jsr real_" #x); \
77
__asm__("move.l (%sp)+,%d0 "); \
78
__asm__("move.l %d0,(OSISRLevel32)"); \
79
__asm__(" jsr OSIntExit "); \
80
__asm__("movem.l (%a7),%d0-%d7/%a0-%a6 "); \
81
__asm__("lea 60(%a7),%a7 "); \
82
__asm__("rte"); \
83
} \
84
void real_##x()
85
86
#else
87
#error NBRTOS must be included
88
#endif
89
90
#else
/*Do C version */
91
92
#ifdef _NBRTOS_H
93
#define INTERRUPT(x, y) \
94
void x(); \
95
void fake_##x() \
96
{ \
97
__asm__(".global " #x); \
98
__asm__(#x ":"); \
99
__asm__("move.w #0x2700,%sr "); \
100
__asm__("lea -60(%a7),%a7 "); \
101
__asm__("movem.l %d0-%d7/%a0-%a6,(%a7) "); \
102
__asm__("move.l (OSISRLevel32),%d0 "); \
103
__asm__("move.l %d0,-(%sp) "); \
104
__asm__("move.l (OSIntNesting),%d0"); \
105
__asm__("addq.l #1,%d0"); \
106
__asm__("move.l %d0,(OSIntNesting)"); \
107
__asm__("move.l #" #y ",%d0 "); \
108
__asm__("move.w %d0,%sr "); \
109
__asm__("move.l %d0,(OSISRLevel32)"); \
110
__asm__("jsr real_" #x); \
111
__asm__("move.l (%sp)+,%d0 "); \
112
__asm__("move.l %d0,(OSISRLevel32)"); \
113
__asm__(" jsr OSIntExit "); \
114
__asm__("movem.l (%a7),%d0-%d7/%a0-%a6 "); \
115
__asm__("lea 60(%a7),%a7 "); \
116
__asm__("rte"); \
117
} \
118
void real_##x()
119
#else
120
#error NBRTOS must be included
121
#endif
122
#endif
/*C Version */
123
124
/*----------------------------------------------------------------------------------------------------
125
* The following definitions define the vector offset for various predefined vectors on the coldfire.
126
*----------------------------------------------------------------------------------------------------*/
127
#define CF_ACCESSERROR_VECTOR 2
128
#define CF_ADDRESSERROR_VECTOR 3
129
#define CF_ILLEGAL_INSTRUCTION_VECTOR 4
130
#define CF_PRIVLEDGE_VIOLATION_VECTOR 8
131
#define CF_TRACE_VECTOR 9
132
#define CF_UNIMPLMENTED_A_VECTOR 10
133
#define CF_UNIMPLMENTED_F_VECTOR 11
134
#define CF_DEBUG_INTERRUPT 12
135
#define CF_FORMAT_ERR_VECTOR 14
136
#define CF_UNINITIALIZED_VECTOR 15
137
#define CF_SPURIOUS_INT_VECTOR 24
138
#define CF_AUTOVECTOR_IRQ1 25
139
#define CF_AUTOVECTOR_IRQ2 26
140
#define CF_AUTOVECTOR_IRQ3 27
141
#define CF_AUTOVECTOR_IRQ4 28
142
#define CF_AUTOVECTOR_IRQ5 29
143
#define CF_AUTOVECTOR_IRQ6 30
144
#define CF_AUTOVECTOR_IRQ7 31
145
#define CF_TRAP0_VECTOR 32
146
#define CF_TRAP1_VECTOR 33
147
#define CF_TRAP2_VECTOR 34
148
#define CF_TRAP3_VECTOR 35
149
#define CF_TRAP4_VECTOR 36
150
#define CF_TRAP5_VECTOR 37
151
#define CF_TRAP6_VECTOR 38
152
#define CF_TRAP7_VECTOR 39
153
#define CF_TRAP8_VECTOR 40
154
#define CF_TRAP9_VECTOR 41
155
#define CF_TRAP10_VECTOR 42
156
#define CF_TRAP11_VECTOR 43
157
#define CF_TRAP12_VECTOR 44
158
#define CF_TRAP13_VECTOR 45
159
#define CF_TRAP14_VECTOR 46
160
#define CF_TRAP15_VECTOR 47
161
#define CF_USER_BASE_VECTOR 64
162
163
extern
"C"
164
{
165
/*---------------------------------------------------------------
166
* This gets the current interrupt mask level in the SR register.
167
* You must have supervisor privileges to use this macro.
168
*---------------------------------------------------------------*/
169
uint16_t GetSR_IntLevel();
170
171
/*------------------------------------------------------------
172
* The following macro sets the interrupt mask level in the SR.
173
* You must have supervisor privileges to use this macro.
174
*------------------------------------------------------------*/
175
void
SetSR_IntLevel(uint16_t sv);
176
}
177
178
#endif
179