Last change
on this file since 661 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.5 KB
|
Rev | Line | |
---|
[520] | 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, tstdst |
---|
| 22 | sw zero, 0(t0); |
---|
| 23 | PRINT(tstdst) |
---|
| 24 | PUTCHAR('E') |
---|
| 25 | PUTCHAR('\n') |
---|
| 26 | |
---|
| 27 | la a1, DMA_BASE |
---|
| 28 | la a0, tstsrc |
---|
| 29 | sw a0, DMA_SRC(a1) |
---|
| 30 | la a0, tstdst |
---|
| 31 | sw a0, DMA_DST(a1) |
---|
| 32 | la a0, 160 #strlen(tstsrc) |
---|
| 33 | sw a0, DMA_LEN(a1) /* start DMA */ |
---|
| 34 | loop: |
---|
| 35 | lw a0, DMA_LEN(a1) |
---|
| 36 | bne a0, zero, loop; |
---|
| 37 | nop |
---|
| 38 | |
---|
| 39 | PRINT(mmustr_b) |
---|
| 40 | PRINT(tstdst) |
---|
| 41 | |
---|
| 42 | /* we should get there */ |
---|
| 43 | EXIT(0) |
---|
| 44 | |
---|
| 45 | .globl excep |
---|
| 46 | excep: |
---|
| 47 | .set noreorder |
---|
| 48 | PRINT(statusstr) |
---|
| 49 | mfc0 a0, COP0_STATUS |
---|
| 50 | PRINTX |
---|
| 51 | |
---|
| 52 | PRINT(causestr) |
---|
| 53 | mfc0 a0, COP0_CAUSE |
---|
| 54 | PRINTX |
---|
| 55 | |
---|
| 56 | PRINT(pcstr) |
---|
| 57 | mfc0 a0, COP0_EXPC |
---|
| 58 | PRINTX |
---|
| 59 | |
---|
| 60 | PRINT(badvastr) |
---|
| 61 | mfc0 a0, COP_0_BADVADDR |
---|
| 62 | PRINTX |
---|
| 63 | |
---|
| 64 | PUTCHAR('\n') |
---|
| 65 | /* we should not get there */ |
---|
| 66 | EXIT(3) |
---|
| 67 | |
---|
| 68 | .rodata: |
---|
| 69 | statusstr: .ascii "status \0" |
---|
| 70 | causestr: .ascii " cause \0" |
---|
| 71 | pcstr: .ascii " pc \0" |
---|
| 72 | badvastr: .ascii " badva \0" |
---|
| 73 | mmustr_a: .ascii "before DMA \0" |
---|
| 74 | mmustr_b: .ascii "after DMA \0" |
---|
| 75 | startstr: .ascii "start\n\0" |
---|
| 76 | |
---|
| 77 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
| 78 | .globl evect |
---|
| 79 | evect: |
---|
| 80 | j excep |
---|
| 81 | nop |
---|
| 82 | |
---|
| 83 | .data |
---|
| 84 | testval: |
---|
| 85 | .word MAGIC2 |
---|
| 86 | testval2: |
---|
| 87 | .word MAGIC4 |
---|
| 88 | testval3: |
---|
| 89 | .word MAGIC4 |
---|
| 90 | tstdst: |
---|
| 91 | .word 0 |
---|
| 92 | .org 0x1000 |
---|
| 93 | testval4: |
---|
| 94 | .word MAGIC1 |
---|
| 95 | tstsrc: |
---|
| 96 | .ascii "this is the test string unaligned and more than 64 chars long abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 123456789 abcdefghijklmnopqrstuvwxyz\n\0" |
---|
Note: See
TracBrowser
for help on using the repository browser.