summaryrefslogtreecommitdiff
path: root/cpu/bf533/interrupt.S
blob: e780dc6d6b0559fa48b3608dedec42e1c5526606 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
/*
 * U-boot - interrupt.S Processing of interrupts and exception handling
 *
 * Copyright (c) 2005 blackfin.uclinux.org
 *
 * (C) Copyright 2000-2004
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * This file is based on interrupt.S
 *
 * Copyright (C) 2003  Metrowerks, Inc. <mwaddel@metrowerks.com>
 * Copyright (C) 2002  Arcturus Networks Ltd. Ted Ma <mated@sympatico.ca>
 * Copyright (C) 1998  D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>,
 *                     Kenneth Albanowski <kjahds@kjahds.com>,
 *                     The Silver Hammer Group, Ltd.
 *
 * (c) 1995, Dionne & Associates
 * (c) 1995, DKG Display Tech.
 *
 * This file is also based on exception.asm
 * (C) Copyright 2001-2005 - Analog Devices, Inc.  All rights reserved.
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

#define ASSEMBLY

#include <asm/hw_irq.h>
#include <asm/entry.h>
#include <asm/blackfin_defs.h>
#include <asm/cpu/bf533_irq.h>

.global blackfin_irq_panic;

.text
.align 2

#ifndef CONFIG_KGDB
.global evt_emulation
evt_emulation:
	SAVE_CONTEXT
	r0 = IRQ_EMU;
	r1 = seqstat;
	sp += -12;
	call blackfin_irq_panic;
	sp += 12;
	rte;
#endif

.global evt_nmi
evt_nmi:
	SAVE_CONTEXT
	r0 = IRQ_NMI;
	r1 = RETN;
	sp += -12;
	call blackfin_irq_panic;
	sp += 12;

_evt_nmi_exit:
	rtn;

.global trap
trap:
	[--sp] = r0;
	[--sp] = r1;
	[--sp] = p0;
	[--sp] = p1;
	[--sp] = astat;
	r0 = seqstat;
	R0 <<= 26;
	R0 >>= 26;
	p0 = r0;
	p1.l = EVTABLE;
	p1.h = EVTABLE;
	p0 = p1 + (p0 << 1);
	r1 = W[p0] (Z);
	p1 = r1;
	jump (pc + p1);

.global _EVENT1
_EVENT1:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT2
_EVENT2:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT3
_EVENT3:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT4
_EVENT4:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT5
_EVENT5:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT6
_EVENT6:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT7
_EVENT7:
	RAISE 15;
	JUMP.S _EXIT;

.global _EVENT8
_EVENT8:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT9
_EVENT9:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT10
_EVENT10:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT11
_EVENT11:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT12
_EVENT12:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT13
_EVENT13:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT14
_EVENT14:
/*	RAISE 14;	*/
	CALL	_cplb_hdr;
	JUMP.S _EXIT;

.global _EVENT19
_EVENT19:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT20
_EVENT20:
	RAISE 14;
	JUMP.S _EXIT;

.global _EVENT21
_EVENT21:
	RAISE 14;
	JUMP.S _EXIT;

.global _EXIT
_EXIT:
	ASTAT = [sp++];
	p1 = [sp++];
	p0 = [sp++];
	r1 = [sp++];
	r0 = [sp++];
	RTX;

EVTABLE:
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x0000;
	.byte2 0x003E;
	.byte2 0x0042;
	.byte4 0x0000;
	.byte4 0x0000;
	.byte4 0x0000;
	.byte4 0x0000;
	.byte4 0x0000;
	.byte4 0x0000;
	.byte4 0x0000;
	.byte2 0x0000;
	.byte2 0x001E;
	.byte2 0x0022;
	.byte2 0x0032;
	.byte2 0x002e;
	.byte2 0x0002;
	.byte2 0x0036;
	.byte2 0x002A;
	.byte2 0x001A;
	.byte2 0x0016;
	.byte2 0x000A;
	.byte2 0x000E;
	.byte2 0x0012;
	.byte2 0x0006;
	.byte2 0x0026;

.global evt_rst
evt_rst:
	SAVE_CONTEXT
	r0 = IRQ_RST;
	r1 = RETN;
	sp += -12;
	call do_reset;
	sp += 12;

_evt_rst_exit:
	rtn;

irq_panic:
	r0 = IRQ_EVX;
	r1 =  sp;
	sp += -12;
	call blackfin_irq_panic;
	sp += 12;

.global evt_ivhw
evt_ivhw:
	SAVE_CONTEXT
	RAISE 14;

_evt_ivhw_exit:
	 rti;

.global evt_timer
evt_timer:
	SAVE_CONTEXT
	r0 = IRQ_CORETMR;
	sp += -12;
	/* Polling method used now. */
	/* call timer_int; */
	sp += 12;
	RESTORE_CONTEXT
	rti;
	nop;

.global evt_evt7
evt_evt7:
	SAVE_CONTEXT
	r0 = 7;
	sp += -12;
	call process_int;
	sp += 12;

evt_evt7_exit:
	RESTORE_CONTEXT
	rti;

.global evt_evt8
evt_evt8:
	SAVE_CONTEXT
	r0 = 8;
	sp += -12;
	call process_int;
	sp += 12;

evt_evt8_exit:
	RESTORE_CONTEXT
	rti;

.global evt_evt9
evt_evt9:
	SAVE_CONTEXT
	r0 = 9;
	sp += -12;
	call process_int;
	sp += 12;

evt_evt9_exit:
	RESTORE_CONTEXT
	rti;

.global evt_evt10
evt_evt10:
	SAVE_CONTEXT
	r0 = 10;
	sp += -12;
	call process_int;
	sp += 12;

evt_evt10_exit:
	RESTORE_CONTEXT
	rti;

.global evt_evt11
evt_evt11:
	SAVE_CONTEXT
	r0 = 11;
	sp += -12;
	call process_int;
	sp += 12;

evt_evt11_exit:
	RESTORE_CONTEXT
	rti;

.global evt_evt12
evt_evt12:
	SAVE_CONTEXT
	r0 = 12;
	sp += -12;
	call process_int;
	sp += 12;
evt_evt12_exit:
	 RESTORE_CONTEXT
	 rti;

.global evt_evt13
evt_evt13:
	SAVE_CONTEXT
	r0 = 13;
	sp += -12;
	call process_int;
	sp += 12;

evt_evt13_exit:
	 RESTORE_CONTEXT
	 rti;

.global evt_system_call
evt_system_call:
	[--sp] = r0;
	[--SP] = RETI;
	r0 = [sp++];
	r0 += 2;
	[--sp] = r0;
	RETI = [SP++];
	r0 = [SP++];
	SAVE_CONTEXT
	sp += -12;
	call display_excp;
	sp += 12;
	RESTORE_CONTEXT
	RTI;

evt_system_call_exit:
	rti;

.global evt_soft_int1
evt_soft_int1:
	[--sp] = r0;
	[--SP] = RETI;
	r0 = [sp++];
	r0 += 2;
	[--sp] = r0;
	RETI = [SP++];
	r0 = [SP++];
	SAVE_CONTEXT
	sp += -12;
	call display_excp;
	sp += 12;
	RESTORE_CONTEXT
	RTI;

evt_soft_int1_exit:
	rti;