Last change
on this file since 946 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.9 KB
|
Line | |
---|
1 | /* |
---|
2 | * basic DMA check: check that the DMA engine works and and doens't |
---|
3 | * clobbers memory |
---|
4 | */ |
---|
5 | #include <registers.h> |
---|
6 | #include <misc.h> |
---|
7 | #include <vcache.h> |
---|
8 | .text |
---|
9 | .globl _start |
---|
10 | _start: |
---|
11 | .set noreorder |
---|
12 | la k0, TTY_BASE |
---|
13 | la k1, EXIT_BASE |
---|
14 | |
---|
15 | PRINT(mmustr_a) |
---|
16 | |
---|
17 | /* reset cop0 status (keep BEV) */ |
---|
18 | lui a0, 0x0040; |
---|
19 | mtc0 a0, COP0_STATUS |
---|
20 | |
---|
21 | la t0, testval |
---|
22 | lw a0, 0(t0); |
---|
23 | PRINTX |
---|
24 | PUTCHAR(' ') |
---|
25 | la t0, testval2 |
---|
26 | lw a0, 0(t0); |
---|
27 | PRINTX |
---|
28 | PUTCHAR('\n') |
---|
29 | la t0, testval |
---|
30 | la t1, testval3 |
---|
31 | lw a0, 0(t0); |
---|
32 | sw a0, 0(t1) |
---|
33 | |
---|
34 | la a1, DMA_BASE |
---|
35 | la a0, tstsrc |
---|
36 | sw a0, DMA_SRC(a1) |
---|
37 | la a0, tstdst |
---|
38 | sw a0, DMA_DST(a1) |
---|
39 | la a0, 0x18 |
---|
40 | sw a0, DMA_LEN(a1) /* start DMA */ |
---|
41 | loop: |
---|
42 | lw a0, DMA_LEN(a1) |
---|
43 | bne a0, zero, loop; |
---|
44 | nop |
---|
45 | sw a0, DMA_RESET(a1) /* reset DMA */ |
---|
46 | |
---|
47 | la a0, testval2 |
---|
48 | sw a0, DMA_SRC(a1) |
---|
49 | la a0, testval |
---|
50 | sw a0, DMA_DST(a1) |
---|
51 | la a0, 0x4 |
---|
52 | sw a0, DMA_LEN(a1) /* start DMA */ |
---|
53 | loop2: |
---|
54 | lw a0, DMA_LEN(a1) |
---|
55 | bne a0, zero, loop2; |
---|
56 | nop |
---|
57 | sw a0, DMA_RESET(a1) /* reset DMA */ |
---|
58 | |
---|
59 | PRINT(mmustr_b) |
---|
60 | la t0, testval |
---|
61 | lw a0, 0(t0); |
---|
62 | PRINTX |
---|
63 | PUTCHAR(' ') |
---|
64 | la t0, testval2 |
---|
65 | lw a0, 0(t0); |
---|
66 | PRINTX |
---|
67 | PUTCHAR(' ') |
---|
68 | la t0, testval3 |
---|
69 | lw a0, 0(t0); |
---|
70 | PRINTX |
---|
71 | PUTCHAR(' ') |
---|
72 | la t0, tstsrc |
---|
73 | lw a0, 0(t0); |
---|
74 | PRINTX |
---|
75 | PUTCHAR(' ') |
---|
76 | la t0, tstdst |
---|
77 | lw a0, 0(t0); |
---|
78 | PRINTX |
---|
79 | PUTCHAR('\n') |
---|
80 | |
---|
81 | /* we should get there */ |
---|
82 | EXIT(0) |
---|
83 | |
---|
84 | .globl excep |
---|
85 | excep: |
---|
86 | .set noreorder |
---|
87 | PRINT(statusstr) |
---|
88 | mfc0 a0, COP0_STATUS |
---|
89 | PRINTX |
---|
90 | |
---|
91 | PRINT(causestr) |
---|
92 | mfc0 a0, COP0_CAUSE |
---|
93 | PRINTX |
---|
94 | |
---|
95 | PRINT(pcstr) |
---|
96 | mfc0 a0, COP0_EXPC |
---|
97 | PRINTX |
---|
98 | |
---|
99 | PRINT(badvastr) |
---|
100 | mfc0 a0, COP_0_BADVADDR |
---|
101 | PRINTX |
---|
102 | |
---|
103 | PUTCHAR('\n') |
---|
104 | /* we should not get there */ |
---|
105 | EXIT(3) |
---|
106 | |
---|
107 | .rodata: |
---|
108 | statusstr: .ascii "status \0" |
---|
109 | causestr: .ascii " cause \0" |
---|
110 | pcstr: .ascii " pc \0" |
---|
111 | badvastr: .ascii " badva \0" |
---|
112 | mmustr_a: .ascii "before DMA \0" |
---|
113 | mmustr_b: .ascii "after DMA \0" |
---|
114 | startstr: .ascii "start\n\0" |
---|
115 | |
---|
116 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
117 | .globl evect |
---|
118 | evect: |
---|
119 | j excep |
---|
120 | nop |
---|
121 | |
---|
122 | .data |
---|
123 | testval: |
---|
124 | .word MAGIC2 |
---|
125 | testval2: |
---|
126 | .word MAGIC4 |
---|
127 | testval3: |
---|
128 | .word MAGIC4 |
---|
129 | tstdst: |
---|
130 | .word 0 |
---|
131 | .org 0x1000 |
---|
132 | .word 0 |
---|
133 | tstsrc: |
---|
134 | .word MAGIC1 |
---|
135 | |
---|
Note: See
TracBrowser
for help on using the repository browser.