Last change
on this file since 1030 was
520,
checked in by bouyer, 11 years ago
|
Re-add the tests; reverting previous which was done at the wrong level (sorry)
|
File size:
1.4 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 cop0 status (keep BEV), enable interrupt 0 */ |
---|
16 | lui a0, 0x0040; |
---|
17 | addiu a0, 0x0401; |
---|
18 | mtc0 a0, COP0_STATUS |
---|
19 | |
---|
20 | /* reset cause, make sure IV is off */ |
---|
21 | mtc0 zero, COP0_CAUSE |
---|
22 | |
---|
23 | PRINT(startstr) |
---|
24 | |
---|
25 | /* program xicu */ |
---|
26 | la t0, XICU_BASE |
---|
27 | /* clear pending interrupt */ |
---|
28 | lw a0, XICU_PTI_ACK(0)(t0) |
---|
29 | /* route PTI0 to irq 0 */ |
---|
30 | li a0, 1 << 0 |
---|
31 | sw a0, XICU_MSK_PTI_E(0)(t0) |
---|
32 | /* interrupt in 10 cycles */ |
---|
33 | li a0, 10 |
---|
34 | sw a0, XICU_PTI_PER(0)(t0) |
---|
35 | |
---|
36 | 1: j 1b |
---|
37 | nop |
---|
38 | /* we should not end there */ |
---|
39 | EXIT(1) |
---|
40 | |
---|
41 | .globl excep |
---|
42 | excep: |
---|
43 | .set noreorder |
---|
44 | PRINT(statusstr) |
---|
45 | mfc0 a0, COP0_STATUS |
---|
46 | PRINTX |
---|
47 | |
---|
48 | PRINT(causestr) |
---|
49 | mfc0 a0, COP0_CAUSE |
---|
50 | PRINTX |
---|
51 | |
---|
52 | PRINT(pcstr) |
---|
53 | mfc0 a0, COP0_EXPC |
---|
54 | PRINTX |
---|
55 | |
---|
56 | PRINT(badvastr) |
---|
57 | mfc0 a0, COP_0_BADVADDR |
---|
58 | PRINTX |
---|
59 | |
---|
60 | PRINT(xicustr) |
---|
61 | la t0, XICU_BASE |
---|
62 | lw a0, XICU_PRIO(0)(t0) |
---|
63 | PRINTX |
---|
64 | |
---|
65 | PUTCHAR('\n') |
---|
66 | /* clear interrupt */ |
---|
67 | mfc0 a0, COP0_CAUSE |
---|
68 | andi t0, a0, 0xff00 |
---|
69 | xor a0, a0, t0 |
---|
70 | mtc0 a0, COP0_CAUSE |
---|
71 | /* we should end there */ |
---|
72 | EXIT(0) |
---|
73 | |
---|
74 | .rodata: |
---|
75 | statusstr: .ascii "status \0" |
---|
76 | causestr: .ascii " cause \0" |
---|
77 | pcstr: .ascii " pc \0" |
---|
78 | badvastr: .ascii " badva \0" |
---|
79 | xicustr: .ascii " xicu \0" |
---|
80 | startstr: .ascii "start\n\0" |
---|
81 | eretstr: .ascii "eret\n\0" |
---|
82 | |
---|
83 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
84 | .globl evect |
---|
85 | evect: |
---|
86 | j excep |
---|
87 | nop |
---|
88 | .data |
---|
89 | myvar: .word 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.