revision 812:8cc61d5ea1f8
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 812:8cc61d5ea1f8 |
parent | 811:7ff871670e58 |
child | 813:262efed79218 |
author | nkeynes |
date | Wed Aug 13 10:32:00 2008 +0000 (15 years ago) |
Add ARM test harness (not quite working on DC but almost...)
test/Makefile.in | view | annotate | diff | log | ||
test/aica.x | view | annotate | diff | log | ||
test/asic.h | view | annotate | diff | log | ||
test/crt0.s | view | annotate | diff | log | ||
test/dma.h | view | annotate | diff | log | ||
test/dmac.c | view | annotate | diff | log | ||
test/lib-arm/crt0.s | view | annotate | diff | log | ||
test/lib-arm/libc.a | view | annotate | diff | log | ||
test/lib-arm/libm.a | view | annotate | diff | log | ||
test/lib.h | view | annotate | diff | log | ||
test/lib/crt0.s | view | annotate | diff | log | ||
test/testaica.c | view | annotate | diff | log | ||
test/testspu.c | view | annotate | diff | log |
1.1 --- a/test/Makefile.in Wed Aug 13 10:27:49 2008 +00001.2 +++ b/test/Makefile.in Wed Aug 13 10:32:00 2008 +00001.3 @@ -19,9 +19,12 @@1.4 SH4OBJCOPY = @SHOBJCOPY@ -O binary1.6 ARMCC = @ARMCC@1.7 -ARMCFLAGS = -O21.8 +ARMCFLAGS = -O2 -fno-builtin -fno-strict-aliasing -mlittle-endian1.9 ARMLD = @ARMLD@1.10 -ARMOBJCOPY = @ARMOBJCOPY@1.11 +ARMLDFLAGS = -Wl,-T$(srcdir)/aica.x -nostartfiles -mlittle-endian \1.12 + -nostdlib -L$(srcdir)/lib-arm1.13 +ARMLIBS = -Wl,--start-group -lc -lgcc -lm -Wl,--end-group1.14 +ARMOBJCOPY = @ARMOBJCOPY@ -O binary1.16 RUNTEST = ../src/lxdream -c $(srcdir)/lxdream.rc -puH -A null1.17 RUNTESTX = ../src/lxdream -c $(srcdir)/lxdream.rc -xpuH -A null1.18 @@ -72,7 +75,7 @@1.20 build-tests: testsh4 testmath testide testta testregs testrend testdisp testspu testmmu1.22 -testsh4: crt0.so sh4/testsh4.so timer.so interrupt.so \1.23 +testsh4: lib/crt0.so sh4/testsh4.so timer.so interrupt.so \1.24 sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so \1.25 sh4/bf.so sh4/bsr.so sh4/bt.so sh4/cmp.so sh4/cmpstr.so \1.26 sh4/div0.so sh4/div1.so sh4/float.so sh4/fmov.so sh4/ftrc.so \1.27 @@ -83,57 +86,61 @@1.28 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.29 $(SH4OBJCOPY) testsh4 testsh4.bin1.31 -testide: crt0.so testide.so ide.so lib.so testdata.so1.32 +testide: lib/crt0.so testide.so ide.so lib.so testdata.so1.33 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.34 $(SH4OBJCOPY) testide testide.bin1.36 -testmmu: crt0.so testmmu.so lib.so1.37 +testmmu: lib/crt0.so testmmu.so lib.so1.38 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.39 $(SH4OBJCOPY) testmmu testmmu.bin1.41 -testmath: crt0.so $(SHARED_OBJECTS) testmath.so math.so1.42 +testmath: lib/crt0.so $(SHARED_OBJECTS) testmath.so math.so1.43 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.45 -testregs: crt0.so $(SHARED_OBJECTS) testregs.so ide.so1.46 +testregs: lib/crt0.so $(SHARED_OBJECTS) testregs.so ide.so1.47 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.48 $(SH4OBJCOPY) testregs testregs.bin1.50 -testta: crt0.so $(SHARED_OBJECTS) testta.so pvr.so dmac.so asic.so lib.so testdata.so1.51 +testta: lib/crt0.so $(SHARED_OBJECTS) testta.so pvr.so dmac.so asic.so lib.so testdata.so1.52 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.53 $(SH4OBJCOPY) testta testta.bin1.55 -testrend: crt0.so $(SHARED_OBJECTS) testrend.so pvr.so dmac.so asic.so lib.so testdata.so1.56 +testaica: lib/crt0.so $(SHARED_OBJECTS) testaica.so dmac.so asic.so lib.so1.57 + $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.58 + $(SH4OBJCOPY) testaica testaica.bin1.59 +1.60 +testrend: lib/crt0.so $(SHARED_OBJECTS) testrend.so pvr.so dmac.so asic.so lib.so testdata.so1.61 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.62 $(SH4OBJCOPY) testrend testrend.bin1.64 -testblend: crt0.so $(SHARED_OBJECTS) testblend.so pvr.so dmac.so asic.so lib.so testdata.so1.65 +testblend: lib/crt0.so $(SHARED_OBJECTS) testblend.so pvr.so dmac.so asic.so lib.so testdata.so1.66 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.67 $(SH4OBJCOPY) testblend testblend.bin1.69 -testdisp: crt0.so $(SHARED_OBJECTS) testdisp.so pvr.so asic.so lib.so testdata.so timer.so1.70 +testdisp: lib/crt0.so $(SHARED_OBJECTS) testdisp.so pvr.so asic.so lib.so testdata.so timer.so1.71 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.72 $(SH4OBJCOPY) testdisp testdisp.bin1.74 -testyuv: crt0.so $(SHARED_OBJECTS) testyuv.so pvr.so asic.so lib.so testdata.so timer.so dmac.so1.75 +testyuv: lib/crt0.so $(SHARED_OBJECTS) testyuv.so pvr.so asic.so lib.so testdata.so timer.so dmac.so1.76 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.77 $(SH4OBJCOPY) testyuv testyuv.bin1.79 -testspu: crt0.so $(SHARED_OBJECTS) testspu.so asic.so lib.so testdata.so timer.so dmac.so1.80 +testspu: lib/crt0.so $(SHARED_OBJECTS) testspu.so asic.so lib.so testdata.so timer.so dmac.so1.81 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.82 $(SH4OBJCOPY) testspu testspu.bin1.84 -testg2: crt0.so $(SHARED_OBJECTS) testg2.so asic.so lib.so testdata.so timer.so dmac.so1.85 +testg2: lib/crt0.so $(SHARED_OBJECTS) testg2.so asic.so lib.so testdata.so timer.so dmac.so1.86 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.87 $(SH4OBJCOPY) testg2 testg2.bin1.89 -readdata: crt0.so readdata.so1.90 +readdata: lib/crt0.so readdata.so1.91 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.93 -rend: crt0.so rendload.so asic.so lib.so timer.so pvr.so1.94 +rend: lib/crt0.so rendload.so asic.so lib.so timer.so pvr.so1.95 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.96 $(SH4OBJCOPY) rend rend.bin1.98 -testFF10: crt0.so testFF10.so lib.so1.99 +testFF10: lib/crt0.so testFF10.so lib.so1.100 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)1.101 $(SH4OBJCOPY) testFF10 testFF10.bin1.103 @@ -152,7 +159,7 @@1.105 uninstall:1.107 -DISTFILES = asic.c asic.h bin2c.c crt0.s dma.h dmac.c ide.c ide.h interrupt.s \1.108 +DISTFILES = asic.c asic.h bin2c.c dma.h dmac.c ide.c ide.h interrupt.s \1.109 lib.c lib.h math.s pvr.c pvr.h rendload.c sh4/add.s sh4/addc.s \1.110 sh4/addv.s sh4/and.s sh4/andi.s sh4/bf.s sh4/bsr.s sh4/bt.s sh4/cmp.s \1.111 sh4/cmpstr.s sh4/div0.s sh4/div1.s sh4/excslot.s sh4/float.s sh4/fmov.s \1.112 @@ -161,7 +168,8 @@1.113 sh4/xtrct.s testdata.c testdata.h testdisp.c testide.c testmath.c \1.114 testmmu.c testregs.c testrend.c testspu.c testta.c testyuv.c timer.c timer.h \1.115 testta.data testta2.data testta3.data testta4.data testta5.data testsort.data \1.116 - lxdream.rc dc.x lib/libc.a lib/libm.a lib/newlib-1.8.2-dc.patch \1.117 + lxdream.rc dc.x lib/crt0.s lib/libc.a lib/libm.a lib/newlib-1.8.2-dc.patch \1.118 + aica.x lib-arm/libc.a lib-arm/libm.a lib-arm/crt0.s \1.119 include/_ansi.h include/_syslist.h include/ar.h include/assert.h include/ctype.h \1.120 include/dirent.h include/errno.h include/fastmath.h include/fcntl.h include/grp.h \1.121 include/ieeefp.h include/locale.h include/machine/fastmath.h include/machine/ieeefp.h \
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00002.2 +++ b/test/aica.x Wed Aug 13 10:32:00 2008 +00002.3 @@ -0,0 +1,229 @@2.4 +/* Sega Dreamcast linker script */2.5 +2.6 +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm",2.7 + "elf32-littlearm")2.8 +OUTPUT_ARCH(arm)2.9 +ENTRY(start)2.10 + SEARCH_DIR(/usr/local/dcdev/arm-elf/lib);2.11 +/* Do we need any of these for elf?2.12 + __DYNAMIC = 0; */2.13 +2.14 +MEMORY2.15 +{2.16 + ram (rwx) : ORIGIN = 0x00000000, LENGTH = 0x002000002.17 +}2.18 +2.19 +SECTIONS2.20 +{2.21 + /* Read-only sections, merged into text segment: */2.22 +/* . = 0x1000;*/2.23 + .interp : { *(.interp) }2.24 + .hash : { *(.hash) }2.25 + .dynsym : { *(.dynsym) }2.26 + .dynstr : { *(.dynstr) }2.27 + .gnu.version : { *(.gnu.version) }2.28 + .gnu.version_d : { *(.gnu.version_d) }2.29 + .gnu.version_r : { *(.gnu.version_r) }2.30 + .rel.init : { *(.rel.init) }2.31 + .rela.init : { *(.rela.init) }2.32 + .rel.text :2.33 + {2.34 + *(.rel.text)2.35 + *(.rel.text.*)2.36 + *(.rel.gnu.linkonce.t*)2.37 + }2.38 + .rela.text :2.39 + {2.40 + *(.rela.text)2.41 + *(.rela.text.*)2.42 + *(.rela.gnu.linkonce.t*)2.43 + }2.44 + .rel.fini : { *(.rel.fini) }2.45 + .rela.fini : { *(.rela.fini) }2.46 + .rel.rodata :2.47 + {2.48 + *(.rel.rodata)2.49 + *(.rel.rodata.*)2.50 + *(.rel.gnu.linkonce.r*)2.51 + }2.52 + .rela.rodata :2.53 + {2.54 + *(.rela.rodata)2.55 + *(.rela.rodata.*)2.56 + *(.rela.gnu.linkonce.r*)2.57 + }2.58 + .rel.data :2.59 + {2.60 + *(.rel.data)2.61 + *(.rel.data.*)2.62 + *(.rel.gnu.linkonce.d*)2.63 + }2.64 + .rela.data :2.65 + {2.66 + *(.rela.data)2.67 + *(.rela.data.*)2.68 + *(.rela.gnu.linkonce.d*)2.69 + }2.70 + .rel.ctors : { *(.rel.ctors) }2.71 + .rela.ctors : { *(.rela.ctors) }2.72 + .rel.dtors : { *(.rel.dtors) }2.73 + .rela.dtors : { *(.rela.dtors) }2.74 + .rel.got : { *(.rel.got) }2.75 + .rela.got : { *(.rela.got) }2.76 + .rel.sdata :2.77 + {2.78 + *(.rel.sdata)2.79 + *(.rel.sdata.*)2.80 + *(.rel.gnu.linkonce.s*)2.81 + }2.82 + .rela.sdata :2.83 + {2.84 + *(.rela.sdata)2.85 + *(.rela.sdata.*)2.86 + *(.rela.gnu.linkonce.s*)2.87 + }2.88 + .rel.sbss : { *(.rel.sbss) }2.89 + .rela.sbss : { *(.rela.sbss) }2.90 + .rel.bss : { *(.rel.bss) }2.91 + .rela.bss : { *(.rela.bss) }2.92 + .rel.plt : { *(.rel.plt) }2.93 + .rela.plt : { *(.rela.plt) }2.94 + .init :2.95 + {2.96 + KEEP (*(.init))2.97 + } =02.98 + .plt : { *(.plt) }2.99 + .text :2.100 + {2.101 + *(.text)2.102 + *(.text.*)2.103 + *(.stub)2.104 + /* .gnu.warning sections are handled specially by elf32.em. */2.105 + *(.gnu.warning)2.106 + *(.gnu.linkonce.t*)2.107 + } =02.108 + _etext = .;2.109 + PROVIDE (etext = .);2.110 + .fini :2.111 + {2.112 + KEEP (*(.fini))2.113 + } =02.114 + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) }2.115 + .rodata1 : { *(.rodata1) }2.116 + /* Adjust the address for the data segment. We want to adjust up to2.117 + the same address within the page on the next page up. */2.118 + . = ALIGN(128) + (. & (128 - 1));2.119 + .data :2.120 + {2.121 + *(.data)2.122 + *(.data.*)2.123 + *(.gnu.linkonce.d*)2.124 + SORT(CONSTRUCTORS)2.125 + }2.126 + .data1 : { *(.data1) }2.127 + .eh_frame : { *(.eh_frame) }2.128 + .gcc_except_table : { *(.gcc_except_table) }2.129 + .ctors ALIGN(4):2.130 + {2.131 + ___ctors = .;2.132 + /* gcc uses crtbegin.o to find the start of2.133 + the constructors, so we make sure it is2.134 + first. Because this is a wildcard, it2.135 + doesn't matter if the user does not2.136 + actually link against crtbegin.o; the2.137 + linker won't look for a file to match a2.138 + wildcard. The wildcard also means that it2.139 + doesn't matter which directory crtbegin.o2.140 + is in. */2.141 + KEEP (*crtbegin.o(.ctors))2.142 + /* We don't want to include the .ctor section from2.143 + from the crtend.o file until after the sorted ctors.2.144 + The .ctor section from the crtend file contains the2.145 + end of ctors marker and it must be last */2.146 + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))2.147 + KEEP (*(SORT(.ctors.*)))2.148 + KEEP (*(.ctors))2.149 + ___ctors_end = .;2.150 + }2.151 + .dtors :2.152 + {2.153 + ___dtors = .;2.154 + KEEP (*crtbegin.o(.dtors))2.155 + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))2.156 + KEEP (*(SORT(.dtors.*)))2.157 + KEEP (*(.dtors))2.158 + ___dtors_end = .;2.159 + }2.160 + .got : { *(.got.plt) *(.got) }2.161 + .dynamic : { *(.dynamic) }2.162 + /* We want the small data sections together, so single-instruction offsets2.163 + can access them all, and initialized data all before uninitialized, so2.164 + we can shorten the on-disk segment size. */2.165 + .sdata :2.166 + {2.167 + *(.sdata)2.168 + *(.sdata.*)2.169 + *(.gnu.linkonce.s.*)2.170 + }2.171 + _edata = .;2.172 + PROVIDE (edata = .);2.173 + __bss_start = .;2.174 + .sbss :2.175 + {2.176 + *(.dynsbss)2.177 + *(.sbss)2.178 + *(.sbss.*)2.179 + *(.scommon)2.180 + }2.181 + .bss :2.182 + {2.183 + *(.dynbss)2.184 + *(.bss)2.185 + *(.bss.*)2.186 + *(COMMON)2.187 + /* Align here to ensure that the .bss section occupies space up to2.188 + _end. Align after .bss to ensure correct alignment even if the2.189 + .bss section disappears because there are no input sections. */2.190 + . = ALIGN(32 / 8);2.191 + }2.192 + . = ALIGN(32 / 8);2.193 + _end = .;2.194 + __bss_end = .;2.195 + PROVIDE (end = .);2.196 + /* Stabs debugging sections. */2.197 + .stab 0 : { *(.stab) }2.198 + .stabstr 0 : { *(.stabstr) }2.199 + .stab.excl 0 : { *(.stab.excl) }2.200 + .stab.exclstr 0 : { *(.stab.exclstr) }2.201 + .stab.index 0 : { *(.stab.index) }2.202 + .stab.indexstr 0 : { *(.stab.indexstr) }2.203 + .comment 0 : { *(.comment) }2.204 + /* DWARF debug sections.2.205 + Symbols in the DWARF debugging sections are relative to the beginning2.206 + of the section so we begin them at 0. */2.207 + /* DWARF 1 */2.208 + .debug 0 : { *(.debug) }2.209 + .line 0 : { *(.line) }2.210 + /* GNU DWARF 1 extensions */2.211 + .debug_srcinfo 0 : { *(.debug_srcinfo) }2.212 + .debug_sfnames 0 : { *(.debug_sfnames) }2.213 + /* DWARF 1.1 and DWARF 2 */2.214 + .debug_aranges 0 : { *(.debug_aranges) }2.215 + .debug_pubnames 0 : { *(.debug_pubnames) }2.216 + /* DWARF 2 */2.217 + .debug_info 0 : { *(.debug_info) }2.218 + .debug_abbrev 0 : { *(.debug_abbrev) }2.219 + .debug_line 0 : { *(.debug_line) }2.220 + .debug_frame 0 : { *(.debug_frame) }2.221 + .debug_str 0 : { *(.debug_str) }2.222 + .debug_loc 0 : { *(.debug_loc) }2.223 + .debug_macinfo 0 : { *(.debug_macinfo) }2.224 + /* SGI/MIPS DWARF 2 extensions */2.225 + .debug_weaknames 0 : { *(.debug_weaknames) }2.226 + .debug_funcnames 0 : { *(.debug_funcnames) }2.227 + .debug_typenames 0 : { *(.debug_typenames) }2.228 + .debug_varnames 0 : { *(.debug_varnames) }2.229 +/* .stack 0x8c00f400 : { _stack = .; *(.stack) }*/2.230 + /* These must appear regardless of . */2.231 + _stack = 0x00200000;2.232 +}
3.1 --- a/test/asic.h Wed Aug 13 10:27:49 2008 +00003.2 +++ b/test/asic.h Wed Aug 13 10:32:00 2008 +00003.3 @@ -13,10 +13,10 @@3.4 #define EVENT_MAPLE_DMA 123.5 #define EVENT_MAPLE_ERR 13 /* ??? */3.6 #define EVENT_IDE_DMA 143.7 -#define EVENT_SPU_DMA0 153.8 -#define EVENT_SPU_DMA1 163.9 -#define EVENT_SPU_DMA2 173.10 -#define EVENT_SPU_DMA3 183.11 +#define EVENT_G2_DMA0 153.12 +#define EVENT_G2_DMA1 163.13 +#define EVENT_G2_DMA2 173.14 +#define EVENT_G2_DMA3 183.15 #define EVENT_PVR_DMA 193.16 #define EVENT_SORT_DMA 203.17 #define EVENT_PVR_PUNCHOUT_DONE 21
4.1 --- a/test/crt0.s Wed Aug 13 10:27:49 2008 +00004.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00004.3 @@ -1,119 +0,0 @@4.4 - .section .text4.5 - .global start4.6 - .global ___exit4.7 - .global _atexit4.8 -start:4.9 - mov.l setup_cache_k,r04.10 - mov.l p2_mask,r14.11 - or r1,r04.12 - jmp @r04.13 - nop4.14 -setup_cache:4.15 - mov.l ccr_addr,r04.16 - mov.w ccr_data,r14.17 - mov.l r1,@r04.18 - mov.l start_2_k,r04.19 - nop4.20 - nop4.21 - nop4.22 - nop4.23 - nop4.24 - nop4.25 - nop4.26 - jmp @r04.27 - nop4.28 -start_2:4.29 - mov.l old_stack_k,r144.30 - mov.l r15,@r144.31 - mov.l old_pr_k,r144.32 - sts pr,r154.33 - mov.l r15,@r144.34 - mov.l stack_k,r154.35 -4.36 - ! zero out bss4.37 - mov.l edata_k,r04.38 - mov.l end_k,r14.39 - mov #0,r24.40 -start_l:4.41 - mov.l r2,@r04.42 - add #4,r04.43 - cmp/ge r0,r14.44 - bt start_l4.45 -4.46 -#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY)4.47 - mov.l set_fpscr_k, r14.48 - jsr @r14.49 - mov #0,r44.50 - lds r3,fpscr4.51 -#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) */4.52 -4.53 - ! call the mainline4.54 - mov.l main_k,r04.55 - jsr @r04.56 - or r0,r04.57 -4.58 - ! call exit4.59 - mov r0,r44.60 - mov.l exit_k,r04.61 - jsr @r04.62 - or r0,r04.63 -4.64 -___exit:4.65 - mov.l old_pr_k,r144.66 - mov.l @r14,r154.67 - lds r15,pr4.68 - mov.l old_stack_k,r144.69 - mov.l @r14,r154.70 - rts4.71 - nop4.72 -4.73 -_atexit:4.74 - rts4.75 - nop4.76 -4.77 - .align 44.78 -#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)4.79 -set_fpscr_k:4.80 - .long ___set_fpscr4.81 -#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */4.82 -stack_k:4.83 - .long _stack4.84 -edata_k:4.85 - .long _edata4.86 -end_k:4.87 - .long _end4.88 -main_k:4.89 - .long _main4.90 -exit_k:4.91 - .long _exit4.92 -4.93 -old_stack_k:4.94 - .long _old_stack4.95 -old_pr_k:4.96 - .long _old_pr4.97 -4.98 -_old_stack:4.99 - .long 04.100 -_old_pr:4.101 - .long 04.102 -4.103 -setup_cache_k:4.104 - .long setup_cache4.105 -start_2_k:4.106 - .long start_24.107 -p2_mask:4.108 - .long 0xa00000004.109 -ccr_addr:4.110 - .long 0xff00001c4.111 -ccr_data:4.112 - .word 0x090b4.113 -4.114 - .align 44.115 -4.116 -#ifdef __ELF__4.117 - .section .stack,"aw"4.118 -#else4.119 - .section .stack4.120 -#endif4.121 -! _stack: .long 0xdeaddead4.122 -
5.1 --- a/test/dma.h Wed Aug 13 10:27:49 2008 +00005.2 +++ b/test/dma.h Wed Aug 13 10:32:00 2008 +00005.3 @@ -45,3 +45,21 @@5.4 * @return 0 on success, non-zero on failure.5.5 */5.6 int pvr_dma_write( unsigned int target, char *buf, int length, int region );5.7 +5.8 +/**5.9 + * Transfer TA data to the PVR via SORT-DMA.5.10 + *5.11 + * @param sorttable Start address of the sort table5.12 + * @param tablelen Size of the sort table (in bytes)5.13 + * @param data Start address of the TA data (polygons)5.14 + * @param datalen Size of the polygon data block (in bytes)5.15 + * @param bitwidth5.16 + * @param datasize5.17 + * @param region Target region for VRAM writes, 0 for 64-byte region, 1 for 32-byte region.5.18 + *5.19 + * @return 0 on success, non-zero on failure.5.20 + */5.21 +int sort_dma_write( char *sorttable, int tablelen, char *data, int datalen, int bitwidth, int datasize );5.22 +5.23 +int aica_dma_write( uint32_t aica_addr, char *data, uint32_t size );5.24 +int aica_dma_read( char *data, uint32_t aica_addr, uint32_t size );
6.1 --- a/test/dmac.c Wed Aug 13 10:27:49 2008 +00006.2 +++ b/test/dmac.c Wed Aug 13 10:32:00 2008 +00006.3 @@ -40,6 +40,20 @@6.4 #define SORT_DMA_CTL (ASIC_BASE+0x820)6.5 #define SORT_DMA_COUNT (ASIC_BASE+0x860)6.7 +#define G2BASERAM 0x008000006.8 +6.9 +#define G2DMABASE 0xA05F78006.10 +#define G2DMATIMEOUT (G2DMABASE+0x90)6.11 +#define G2DMAMAGIC (G2DMABASE+0xBC)6.12 +#define G2DMAEXT(x) (G2DMABASE+(0x20*(x)))6.13 +#define G2DMAHOST(x) (G2DMABASE+(0x20*(x))+0x04)6.14 +#define G2DMASIZE(x) (G2DMABASE+(0x20*(x))+0x08)6.15 +#define G2DMADIR(x) (G2DMABASE+(0x20*(x))+0x0C)6.16 +#define G2DMAMODE(x) (G2DMABASE+(0x20*(x))+0x10)6.17 +#define G2DMACTL1(x) (G2DMABASE+(0x20*(x))+0x14)6.18 +#define G2DMACTL2(x) (G2DMABASE+(0x20*(x))+0x18)6.19 +#define G2DMASTOP(x) (G2DMABASE+(0x20*(x))+0x1C)6.20 +6.21 void dmac_dump_channel( FILE *f, unsigned int channel )6.22 {6.23 fprintf( f, "DMAC SAR: %08X Count: %08X Ctl: %08X OR: %08X\n",6.24 @@ -157,3 +171,35 @@6.25 CHECK_IEQUALS( 0, long_read(SORT_DMA_CTL) );6.26 return result;6.27 }6.28 +6.29 +int aica_dma_transfer( uint32_t aica_addr, char *data, uint32_t size, int writeFlag )6.30 +{6.31 + long_write( G2DMATIMEOUT, 0 );6.32 + long_write( G2DMAMAGIC, 0x4659404f );6.33 + long_write( G2DMACTL1(0), 0 );6.34 + long_write( G2DMAEXT(0), aica_addr );6.35 + long_write( G2DMAHOST(0), ((uint32_t)data) );6.36 + long_write( G2DMASIZE(0), ((size+31)&0x7FFFFFE0) | 0x80000000 );6.37 + long_write( G2DMADIR(0), (writeFlag ? 0 : 1) );6.38 + long_write( G2DMAMODE(0), 0 );6.39 +6.40 + long_write( G2DMACTL1(0), 1 );6.41 + long_write( G2DMACTL2(0), 1 );6.42 + if( asic_wait( EVENT_G2_DMA0 ) != 0 ) {6.43 + fprintf( stderr, "Timeout waiting for G2 DMA event\n" );6.44 + return -1;6.45 + }6.46 + // CHECK_IEQUALS( 0, long_read( G2DMACTL1(0) ) );6.47 + CHECK_IEQUALS( 0, long_read( G2DMACTL2(0) ) );6.48 + return 0;6.49 +}6.50 +6.51 +int aica_dma_write( uint32_t aica_addr, char *data, uint32_t size )6.52 +{6.53 + return aica_dma_transfer( aica_addr, data, size, 1 );6.54 +}6.55 +6.56 +int aica_dma_read( char *data, uint32_t aica_addr, uint32_t size )6.57 +{6.58 + return aica_dma_transfer( aica_addr, data, size, 0 );6.59 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00007.2 +++ b/test/lib-arm/crt0.s Wed Aug 13 10:32:00 2008 +00007.3 @@ -0,0 +1,59 @@7.4 +.section .text7.5 +.code 327.6 +.align 07.7 +.global start7.8 +.global ___exit7.9 +.global _atexit7.10 +start:7.11 +7.12 +/* Start by setting up a stack */7.13 + /* Set up the stack pointer to a fixed value */7.14 + ldr r3, .LC07.15 + mov sp, r37.16 + /* Setup a default stack-limit in-case the code has been7.17 + compiled with "-mapcs-stack-check". Hard-wiring this value7.18 + is not ideal, since there is currently no support for7.19 + checking that the heap and stack have not collided, or that7.20 + this default 64k is enough for the program being executed.7.21 + However, it ensures that this simple crt0 world will not7.22 + immediately cause an overflow event: */7.23 + sub sl, sp, #64 << 10 /* Still assumes 256bytes below sl */7.24 +7.25 + /* Zero-out the BSS segment */7.26 + mov a2, #0 /* Second arg: fill value */7.27 + mov fp, a2 /* Null frame pointer */7.28 + mov r7, a2 /* Null frame pointer for Thumb */7.29 +7.30 + ldr a1, .LC1 /* First arg: start of memory block */7.31 + ldr a3, .LC27.32 + sub a3, a3, a1 /* Third arg: length of block */7.33 + bl memset7.34 + b .LB07.35 + .word 0 /* padding */7.36 +7.37 +.syscall:7.38 + .word -1 /* Syscall # */7.39 + .word 0 /* Arguments */7.40 + .word 07.41 + .word 07.42 +7.43 + /* Enter main with no arguments for now */7.44 +.LB0:7.45 + mov r0, #0 /* no arguments */7.46 + mov r1, #0 /* no argv either */7.47 + bl main7.48 +7.49 + bl exit /* Should not return */7.50 +7.51 + /* For Thumb, constants must be after the code since only7.52 + positive offsets are supported for PC relative addresses. */7.53 +7.54 + .align 07.55 +.LC0:7.56 + .word _stack7.57 +.LC1:7.58 + .word __bss_start7.59 +.LC2:7.60 + .word __bss_end7.61 +7.62 +
8.1 Binary file test/lib-arm/libc.a has changed
9.1 Binary file test/lib-arm/libm.a has changed
10.1 --- a/test/lib.h Wed Aug 13 10:27:49 2008 +000010.2 +++ b/test/lib.h Wed Aug 13 10:32:00 2008 +000010.3 @@ -16,6 +16,8 @@10.4 #define ASIC_IRQC2 0xA05f693810.5 #define IRQB0_MASK 0x0007B00010.7 +#define AICA_RESET 0xA0702C0010.8 +10.9 #define float_read(A) (*((volatile float*)(A)))10.10 #define float_write(A, V) ( (*((volatile float*)(A))) = (V) )10.11 #define long_read(A) (*((volatile unsigned long*)(A)))10.12 @@ -38,9 +40,8 @@10.13 void reset_asic_status(void);10.14 void g2_fifo_wait( void );10.16 -void spu_memload( uint32_t dst, const void *src, int length );10.17 -void spu_memread( void *dst, uint32_t src, int length );10.18 -void dump_spu_memory( unsigned int from, int length );10.19 +#define aica_enable() long_write( AICA_RESET, (long_read(AICA_RESET) & 0xFFFFFFFE) )10.20 +#define aica_disable() long_write( AICA_RESET, (long_read(AICA_RESET) | 1) )10.22 struct spudma_struct {10.23 uint32_t g2_addr;
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000011.2 +++ b/test/lib/crt0.s Wed Aug 13 10:32:00 2008 +000011.3 @@ -0,0 +1,119 @@11.4 + .section .text11.5 + .global start11.6 + .global ___exit11.7 + .global _atexit11.8 +start:11.9 + mov.l setup_cache_k,r011.10 + mov.l p2_mask,r111.11 + or r1,r011.12 + jmp @r011.13 + nop11.14 +setup_cache:11.15 + mov.l ccr_addr,r011.16 + mov.w ccr_data,r111.17 + mov.l r1,@r011.18 + mov.l start_2_k,r011.19 + nop11.20 + nop11.21 + nop11.22 + nop11.23 + nop11.24 + nop11.25 + nop11.26 + jmp @r011.27 + nop11.28 +start_2:11.29 + mov.l old_stack_k,r1411.30 + mov.l r15,@r1411.31 + mov.l old_pr_k,r1411.32 + sts pr,r1511.33 + mov.l r15,@r1411.34 + mov.l stack_k,r1511.35 +11.36 + ! zero out bss11.37 + mov.l edata_k,r011.38 + mov.l end_k,r111.39 + mov #0,r211.40 +start_l:11.41 + mov.l r2,@r011.42 + add #4,r011.43 + cmp/ge r0,r111.44 + bt start_l11.45 +11.46 +#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY)11.47 + mov.l set_fpscr_k, r111.48 + jsr @r111.49 + mov #0,r411.50 + lds r3,fpscr11.51 +#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) */11.52 +11.53 + ! call the mainline11.54 + mov.l main_k,r011.55 + jsr @r011.56 + or r0,r011.57 +11.58 + ! call exit11.59 + mov r0,r411.60 + mov.l exit_k,r011.61 + jsr @r011.62 + or r0,r011.63 +11.64 +___exit:11.65 + mov.l old_pr_k,r1411.66 + mov.l @r14,r1511.67 + lds r15,pr11.68 + mov.l old_stack_k,r1411.69 + mov.l @r14,r1511.70 + rts11.71 + nop11.72 +11.73 +_atexit:11.74 + rts11.75 + nop11.76 +11.77 + .align 411.78 +#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)11.79 +set_fpscr_k:11.80 + .long ___set_fpscr11.81 +#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */11.82 +stack_k:11.83 + .long _stack11.84 +edata_k:11.85 + .long _edata11.86 +end_k:11.87 + .long _end11.88 +main_k:11.89 + .long _main11.90 +exit_k:11.91 + .long _exit11.92 +11.93 +old_stack_k:11.94 + .long _old_stack11.95 +old_pr_k:11.96 + .long _old_pr11.97 +11.98 +_old_stack:11.99 + .long 011.100 +_old_pr:11.101 + .long 011.102 +11.103 +setup_cache_k:11.104 + .long setup_cache11.105 +start_2_k:11.106 + .long start_211.107 +p2_mask:11.108 + .long 0xa000000011.109 +ccr_addr:11.110 + .long 0xff00001c11.111 +ccr_data:11.112 + .word 0x090b11.113 +11.114 + .align 411.115 +11.116 +#ifdef __ELF__11.117 + .section .stack,"aw"11.118 +#else11.119 + .section .stack11.120 +#endif11.121 +! _stack: .long 0xdeaddead11.122 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000012.2 +++ b/test/testaica.c Wed Aug 13 10:32:00 2008 +000012.3 @@ -0,0 +1,102 @@12.4 +/**12.5 + * $Id: testdata.c 602 2008-01-15 20:50:23Z nkeynes $12.6 + *12.7 + * AICA test loader12.8 + *12.9 + * Copyright (c) 2006 Nathan Keynes.12.10 + *12.11 + * This program is free software; you can redistribute it and/or modify12.12 + * it under the terms of the GNU General Public License as published by12.13 + * the Free Software Foundation; either version 2 of the License, or12.14 + * (at your option) any later version.12.15 + *12.16 + * This program is distributed in the hope that it will be useful,12.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of12.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12.19 + * GNU General Public License for more details.12.20 + */12.21 +12.22 +#include <stdio.h>12.23 +12.24 +#include "lib.h"12.25 +12.26 +#define AICA_RAM_BASE 0x0080000012.27 +12.28 +#define AICA_SYSCALL (AICA_RAM_BASE+0x30)12.29 +#define AICA_SYSCALL_ARG1 (AICA_SYSCALL+4)12.30 +#define AICA_SYSCALL_ARG2 (AICA_SYSCALL+8)12.31 +#define AICA_SYSCALL_ARG3 (AICA_SYSCALL+12)12.32 +#define AICA_SYSCALL_RETURN (AICA_SYSCALL+4)12.33 +12.34 +#define SYS_READ 012.35 +#define SYS_WRITE 112.36 +#define SYS_OPEN 212.37 +#define SYS_CLOSE 312.38 +#define SYS_CREAT 412.39 +#define SYS_LINK 512.40 +#define SYS_UNLINK 612.41 +#define SYS_CHDIR 712.42 +#define SYS_CHMOD 812.43 +#define SYS_LSEEK 912.44 +#define SYS_FSTAT 1012.45 +#define SYS_TIME 1112.46 +#define SYS_STAT 1212.47 +#define SYS_UTIME 1312.48 +#define SYS_ASSIGNWRKMEM 1412.49 +#define SYS_EXIT 1512.50 +#define SYS_OPENDIR 1612.51 +#define SYS_CLOSEDIR 1712.52 +#define SYS_READDIR 1812.53 +#define SYS_GETHOSTINFO 1912.54 +12.55 +uint32_t do_syscall( uint32_t syscall, uint32_t arg1, uint32_t arg2, uint32_t arg3 )12.56 +{12.57 + uint32_t fd, len;12.58 + char *data;12.59 +12.60 + switch( syscall ) {12.61 + case SYS_READ:12.62 + fd = arg1;12.63 + data = (char *)(AICA_RAM_BASE + (arg2 & 0x001FFFFF));12.64 + len = arg3;12.65 + return read( fd, data, len );12.66 + case SYS_WRITE:12.67 + fd = arg1;12.68 + data = (char *)(AICA_RAM_BASE + (arg2 & 0x001FFFFF));12.69 + len = arg3;12.70 + return write( fd, data, len );12.71 + break;12.72 + case SYS_EXIT:12.73 + aica_disable();12.74 + exit(arg1);12.75 + default:12.76 + return 0;12.77 + }12.78 +}12.79 +12.80 +12.81 +int main( int argc, char *argv[] )12.82 +{12.83 + char buf[65536] __attribute__((aligned(32)));12.84 + uint32_t aica_addr = AICA_RAM_BASE;12.85 + int len;12.86 +12.87 + aica_disable();12.88 + /* Load ARM program from stdin and copy to ARM memory */12.89 + while( (len = read(0, buf, sizeof(buf))) > 0 ) {12.90 + aica_dma_write( aica_addr, buf, len );12.91 + aica_addr += len;12.92 + }12.93 +12.94 + /* Main loop waiting for IO commands */12.95 + aica_enable();12.96 + do {12.97 + int syscall = long_read(AICA_SYSCALL);12.98 + if( syscall != -1 ) {12.99 + uint32_t result = do_syscall( syscall, long_read(AICA_SYSCALL_ARG1),12.100 + long_read(AICA_SYSCALL_ARG2), long_read(AICA_SYSCALL_ARG3) );12.101 + long_write( AICA_SYSCALL_RETURN, result );12.102 + long_write( AICA_SYSCALL, -1 );12.103 + }12.104 + } while( 1 );12.105 +}12.106 \ No newline at end of file
13.1 --- a/test/testspu.c Wed Aug 13 10:27:49 2008 +000013.2 +++ b/test/testspu.c Wed Aug 13 10:32:00 2008 +000013.3 @@ -38,7 +38,7 @@13.5 long_write( SPUDMACTL1(chan), 1 );13.6 long_write( SPUDMACTL2(chan), 1 );13.7 - if( asic_wait( EVENT_SPU_DMA0 + chan ) != 0 ) {13.8 + if( asic_wait( EVENT_G2_DMA0 + chan ) != 0 ) {13.9 fprintf( stderr, "Timeout waiting for DMA event\n" );13.10 dump_spu_regs();13.11 return -1;13.12 @@ -60,7 +60,7 @@13.14 long_write( SPUDMACTL1(chan), 1 );13.15 long_write( SPUDMACTL2(chan), 1 );13.16 - if( asic_wait( EVENT_SPU_DMA0 + chan ) != 0 ) {13.17 + if( asic_wait( EVENT_G2_DMA0 + chan ) != 0 ) {13.18 fprintf( stderr, "Timeout waiting for DMA event\n" );13.19 dump_spu_regs();13.20 return -1;
.