Last change
on this file since 368 was
324,
checked in by joannou, 12 years ago
|
updated the test_interrupt_delayslot : now testing for several delay values
|
File size:
1.8 KB
|
Line | |
---|
1 | /* |
---|
2 | * Check that we can take an interrupt from the xicu timer0 |
---|
3 | */ |
---|
4 | #include <registers.h> |
---|
5 | #include <misc.h> |
---|
6 | #include <xicu.h> |
---|
7 | |
---|
8 | .text |
---|
9 | .globl _start |
---|
10 | _start: |
---|
11 | .set noreorder |
---|
12 | la k0, TTY_BASE |
---|
13 | la k1, EXIT_BASE |
---|
14 | |
---|
15 | /* reset cause, make sure IV is off */ |
---|
16 | mtc0 zero, COP0_CAUSE |
---|
17 | |
---|
18 | PRINT(startstr) |
---|
19 | |
---|
20 | /* program xicu */ |
---|
21 | la t0, XICU_BASE |
---|
22 | /* clear pending interrupt */ |
---|
23 | lw a0, XICU_PTI_ACK(0)(t0) |
---|
24 | /* route PTI0 to irq 0 */ |
---|
25 | li a0, 1 << 0 |
---|
26 | sw a0, XICU_MSK_PTI_E(0)(t0) |
---|
27 | /* init s0 */ |
---|
28 | li s0, MAGIC2 |
---|
29 | /* |
---|
30 | * interrupt in INTERRUPT_DELAY cycles. |
---|
31 | * Without cache this takes us to the delay slot of the jump. |
---|
32 | */ |
---|
33 | |
---|
34 | li a0, INTERRUPT_DELAY |
---|
35 | //li a0, 38 |
---|
36 | sw a0, XICU_PTI_PER(0)(t0) |
---|
37 | /* clear pending interrupt */ |
---|
38 | lw a0, XICU_PTI_ACK(0)(t0) |
---|
39 | /* reset cop0 status (keep BEV), enable interrupt 0 */ |
---|
40 | lui a0, 0x0040; |
---|
41 | addiu a0, 0x0401; |
---|
42 | mtc0 a0, COP0_STATUS |
---|
43 | |
---|
44 | nop |
---|
45 | nop |
---|
46 | nop |
---|
47 | j end |
---|
48 | li s0, MAGIC1 |
---|
49 | nop |
---|
50 | /* we should not end there */ |
---|
51 | EXIT(1) |
---|
52 | |
---|
53 | end: |
---|
54 | PRINT(endstr) |
---|
55 | move a0, s0 |
---|
56 | PRINTX |
---|
57 | PUTCHAR('\n') |
---|
58 | EXIT(0) |
---|
59 | |
---|
60 | .globl excep |
---|
61 | excep: |
---|
62 | .set noreorder |
---|
63 | /* disable timer0 */ |
---|
64 | la t0, XICU_BASE |
---|
65 | sw zero, XICU_PTI_PER(0)(t0) |
---|
66 | PRINT(statusstr) |
---|
67 | mfc0 a0, COP0_STATUS |
---|
68 | PRINTX |
---|
69 | |
---|
70 | PRINT(causestr) |
---|
71 | mfc0 a0, COP0_CAUSE |
---|
72 | PRINTX |
---|
73 | |
---|
74 | PRINT(pcstr) |
---|
75 | mfc0 a0, COP0_EXPC |
---|
76 | PRINTX |
---|
77 | |
---|
78 | PRINT(badvastr) |
---|
79 | mfc0 a0, COP_0_BADVADDR |
---|
80 | PRINTX |
---|
81 | |
---|
82 | PRINT(xicustr) |
---|
83 | la t0, XICU_BASE |
---|
84 | lw a0, XICU_PRIO(0)(t0) |
---|
85 | PRINTX |
---|
86 | |
---|
87 | PUTCHAR('\n') |
---|
88 | /* clear interrupt */ |
---|
89 | mfc0 a0, COP0_CAUSE |
---|
90 | andi t0, a0, 0xff00 |
---|
91 | xor a0, a0, t0 |
---|
92 | mtc0 a0, COP0_CAUSE |
---|
93 | eret |
---|
94 | /* we should not end there */ |
---|
95 | EXIT(1) |
---|
96 | |
---|
97 | .rodata: |
---|
98 | statusstr: .ascii "status \0" |
---|
99 | causestr: .ascii " cause \0" |
---|
100 | pcstr: .ascii " pc \0" |
---|
101 | badvastr: .ascii " badva \0" |
---|
102 | xicustr: .ascii " xicu \0" |
---|
103 | startstr: .ascii "start\n\0" |
---|
104 | endstr: .ascii "end \0" |
---|
105 | |
---|
106 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
107 | .globl evect |
---|
108 | evect: |
---|
109 | j excep |
---|
110 | nop |
---|
111 | .data |
---|
112 | myvar: .word 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.