summaryrefslogtreecommitdiffstats
path: root/c/src/lib
diff options
context:
space:
mode:
authorAun-Ali Zaidi <admin@kodeit.net>2015-12-10 18:29:55 -0600
committerGedare Bloom <gedare@rtems.org>2015-12-11 09:20:34 -0500
commit32c2cd2be1067ebe32cdabccbc8aa16126ae3a32 (patch)
tree7c4e2f70630f4849308cf2cfe22a796098188e54 /c/src/lib
parentscore: Untangle thread actions (diff)
downloadrtems-32c2cd2be1067ebe32cdabccbc8aa16126ae3a32.tar.bz2
arm/nds: Remove
updates #2450.
Diffstat (limited to 'c/src/lib')
-rw-r--r--c/src/lib/libbsp/arm/acinclude.m42
-rw-r--r--c/src/lib/libbsp/arm/nds/Makefile.am236
-rw-r--r--c/src/lib/libbsp/arm/nds/README8
-rw-r--r--c/src/lib/libbsp/arm/nds/block/block.c115
-rw-r--r--c/src/lib/libbsp/arm/nds/bsp_specs13
-rw-r--r--c/src/lib/libbsp/arm/nds/clock/clock.c86
-rw-r--r--c/src/lib/libbsp/arm/nds/configure.ac26
-rw-r--r--c/src/lib/libbsp/arm/nds/console/console.c191
-rw-r--r--c/src/lib/libbsp/arm/nds/coproc/coproc.S112
-rw-r--r--c/src/lib/libbsp/arm/nds/coproc/coproc.c207
-rw-r--r--c/src/lib/libbsp/arm/nds/coproc/coproc.ld195
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm7/makefile145
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm7/source/wifi_arm7.c1637
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm7/source/wifi_arm7.h136
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/makefile150
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP.c63
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP.h56
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ARP.c304
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ARP.h80
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Config.h274
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DHCP.c375
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DHCP.h86
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DNS.c492
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DNS.h69
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Hub.c211
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Hub.h109
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ICMP.c56
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ICMP.h52
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_IP.c124
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_IP.h64
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_TCP.c915
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_TCP.h134
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_UDP.c245
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_UDP.h81
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_memblock.c295
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_memblock.h65
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_sockets.c521
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_sockets.h83
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/wifi_arm9.c996
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/arm9/source/wifi_arm9.h122
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/common/source/dsregs.h179
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/common/source/spinlock.S41
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/common/source/spinlock.h63
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/common/source/wifi_shared.h284
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/dswifi_license.txt27
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/include/dswifi7.h89
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/include/dswifi9.h337
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/include/dswifi_version.h10
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/include/netdb.h49
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/include/netinet/in.h61
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/include/sgIP_errno.h165
-rw-r--r--c/src/lib/libbsp/arm/nds/dswifi/makefile69
-rw-r--r--c/src/lib/libbsp/arm/nds/fb/fb.c194
-rw-r--r--c/src/lib/libbsp/arm/nds/include/bsp.h43
-rw-r--r--c/src/lib/libbsp/arm/nds/include/my_ipc.h34
-rw-r--r--c/src/lib/libbsp/arm/nds/include/sys/iosupport.h32
-rw-r--r--c/src/lib/libbsp/arm/nds/include/types.h27
-rw-r--r--c/src/lib/libbsp/arm/nds/irq/irq.c97
-rw-r--r--c/src/lib/libbsp/arm/nds/irq/irq.h21
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/gba/include/fat.h102
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/include/fat.h117
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/nds/include/fat.h107
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/bit_ops.h58
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/cache.c237
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/cache.h118
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/common.h54
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/directory.c902
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/directory.h171
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc.c184
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc.h126
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc_io.h81
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_cf_common.c322
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_cf_common.h78
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_dldi.S73
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_dldi.h44
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.c307
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.h23
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.c334
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.h44
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3_common.c60
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3_common.h48
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.c96
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.h45
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.c518
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.h48
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.c100
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.h45
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.c595
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.h50
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.c348
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.h53
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sc_common.c47
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sc_common.h45
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.c83
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.h45
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.c400
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.h48
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd_s.S139
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sd_common.c210
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sd_common.h117
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/fatdir.c536
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/fatdir.h80
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/fatfile.c815
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/fatfile.h98
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/file_allocation_table.c331
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/file_allocation_table.h64
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/filetime.c138
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/filetime.h44
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/libfat.c144
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/mem_allocate.h47
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/partition.c461
-rw-r--r--c/src/lib/libbsp/arm/nds/libfat/source/partition.h124
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/Makefile.arm710
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/Makefile.arm914
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/basicARM7/source/defaultARM7.c142
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/default_font_bin.h9
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/gbfs.h98
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds.h93
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/audio.h139
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/clock.h140
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/serial.h165
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/touch.h71
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/background.h59
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/boxtest.h108
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/cache.h86
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/console.h85
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/exceptions.h42
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/image.h69
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/input.h95
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/math.h225
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/ndsmotion.h190
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/pcx.h57
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/postest.h88
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/rumble.h59
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sound.h43
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sprite.h224
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/trig_lut.h41
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/video.h591
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/videoGL.h1295
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/bios.h365
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/card.h125
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/dma.h151
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/interrupts.h185
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/ipc.h155
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/jtypes.h134
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/memory.h229
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/registers_alt.h311
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/reload.h79
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/system.h248
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h204
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/libnds_license.txt18
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/audio.c25
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/clock.c279
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/microphone.c113
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/spi.c75
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c371
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/userSettings.c69
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S75
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S75
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S75
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c97
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c456
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S92
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S523
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S109
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c34
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c270
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S55
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c132
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c94
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c97
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c488
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c85
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c73
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c72
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c31
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c46
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c122
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c424
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/common/biosCalls.S333
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/common/card.c393
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c202
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/common/interruptDispatcher.S117
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c145
-rw-r--r--c/src/lib/libbsp/arm/nds/make/custom/nds.cfg34
-rwxr-xr-xc/src/lib/libbsp/arm/nds/mk_libnds.sh35
-rw-r--r--c/src/lib/libbsp/arm/nds/patch.libnds11
-rw-r--r--c/src/lib/libbsp/arm/nds/preinstall.am244
-rw-r--r--c/src/lib/libbsp/arm/nds/rtc/rtc.c94
-rw-r--r--c/src/lib/libbsp/arm/nds/sound/sound.c223
-rw-r--r--c/src/lib/libbsp/arm/nds/sound/sound.h73
-rw-r--r--c/src/lib/libbsp/arm/nds/start/start.S280
-rw-r--r--c/src/lib/libbsp/arm/nds/startup/bspreset.c17
-rw-r--r--c/src/lib/libbsp/arm/nds/startup/bspstart.c56
-rw-r--r--c/src/lib/libbsp/arm/nds/startup/linkcmds40
-rw-r--r--c/src/lib/libbsp/arm/nds/timer/timer.c55
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/Makefile.am58
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/bin2s.c199
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/configure.ac24
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/arm7_sha1_homebrew.h14
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/arm7_sha1_nintendo.h14
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/banner.h19
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/bigint.h11
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/crc.h175
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/default_icon.h14
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/encryption.h10
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/header.h97
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/hook.h1
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/little.h111
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/loadme.h14
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/logo.h1
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndscreate.h5
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndsextract.h3
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndstool.h65
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndstree.h60
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/overlay.h17
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme.h1
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_sram.h14
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_vhd1.h55
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_vhd2.h58
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/raster.h56
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/sha1.h70
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/include/types.h13
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/arm7_sha1_homebrew.c70
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/arm7_sha1_nintendo.c108
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/banner.cpp86
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/bigint.cpp111
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/compile_date.c1
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/crc.cpp144
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/default_icon.c47
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/encryption.cpp574
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/header.cpp648
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/hook.cpp76
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/loadme.c18
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/logo.cpp160
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndscodes.cpp334
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndscreate.cpp606
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndsextract.cpp288
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndstool.cpp499
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndstree.cpp69
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/passme.cpp176
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/passme_sram.c2057
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/raster.cpp54
-rw-r--r--c/src/lib/libbsp/arm/nds/tools/ndstool/source/sha1.cpp183
-rwxr-xr-xc/src/lib/libbsp/arm/nds/tools/runtest249
-rw-r--r--c/src/lib/libbsp/arm/nds/touchscreen/README.reco3
-rw-r--r--c/src/lib/libbsp/arm/nds/touchscreen/parser.c205
-rw-r--r--c/src/lib/libbsp/arm/nds/touchscreen/reco.c245
-rw-r--r--c/src/lib/libbsp/arm/nds/touchscreen/reco.h137
-rw-r--r--c/src/lib/libbsp/arm/nds/touchscreen/touchscreen.c133
-rw-r--r--c/src/lib/libbsp/arm/nds/touchscreen/touchscreen.h60
-rw-r--r--c/src/lib/libbsp/arm/nds/wifi/compat.c219
-rw-r--r--c/src/lib/libbsp/arm/nds/wifi/compat.h114
-rw-r--r--c/src/lib/libbsp/arm/nds/wifi/wifi.c414
254 files changed, 0 insertions, 42975 deletions
diff --git a/c/src/lib/libbsp/arm/acinclude.m4 b/c/src/lib/libbsp/arm/acinclude.m4
index 327650ee13..607a3b6e9b 100644
--- a/c/src/lib/libbsp/arm/acinclude.m4
+++ b/c/src/lib/libbsp/arm/acinclude.m4
@@ -28,8 +28,6 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
AC_CONFIG_SUBDIRS([lpc24xx]);;
lpc32xx )
AC_CONFIG_SUBDIRS([lpc32xx]);;
- nds )
- AC_CONFIG_SUBDIRS([nds]);;
raspberrypi )
AC_CONFIG_SUBDIRS([raspberrypi]);;
realview-pbx-a9 )
diff --git a/c/src/lib/libbsp/arm/nds/Makefile.am b/c/src/lib/libbsp/arm/nds/Makefile.am
deleted file mode 100644
index f2867ee2d4..0000000000
--- a/c/src/lib/libbsp/arm/nds/Makefile.am
+++ /dev/null
@@ -1,236 +0,0 @@
-ACLOCAL_AMFLAGS = -I ../../../../aclocal
-
-SUBDIRS = . tools
-
-include $(top_srcdir)/../../../../automake/compile.am
-
-include_bspdir = $(includedir)/bsp
-
-dist_project_lib_DATA = bsp_specs
-
-include_HEADERS = include/bsp.h
-include_HEADERS += ../../shared/include/tm27.h
-
-nodist_include_HEADERS = include/bspopts.h
-nodist_include_HEADERS += ../../shared/include/coverhd.h
-
-nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
-nodist_include_bsp_HEADERS += irq/irq.h
-DISTCLEANFILES = include/bspopts.h
-noinst_PROGRAMS =
-
-noinst_LIBRARIES = libbspstart.a
-libbspstart_a_SOURCES = start/start.S
-project_lib_DATA = start.$(OBJEXT)
-
-dist_project_lib_DATA += startup/linkcmds
-
-noinst_LIBRARIES += libbsp.a
-libbsp_a_SOURCES =
-
-include_ndsdir = $(includedir)/nds
-include_nds_HEADERS = touchscreen/touchscreen.h sound/sound.h
-
-libbsp_a_CPPFLAGS = -DARM9
-libbsp_a_CPPFLAGS += -I$(srcdir)/../../shared/include
-libbsp_a_CPPFLAGS += -I$(srcdir)/include
-libbsp_a_CPPFLAGS += -I$(srcdir)/libnds/include
-libbsp_a_CPPFLAGS += -I$(srcdir)/libfat/source/disc_io
-libbsp_a_SOURCES += ../../shared/bsplibc.c
-libbsp_a_SOURCES += ../../shared/bsppost.c
-libbsp_a_SOURCES += startup/bspstart.c
-libbsp_a_SOURCES += ../../shared/bspclean.c
-libbsp_a_SOURCES += startup/bspreset.c
-libbsp_a_SOURCES += ../../shared/bspgetworkarea.c
-libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
-libbsp_a_SOURCES += ../../shared/bootcard.c
-libbsp_a_SOURCES += ../../shared/cpucounterread.c
-libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
-libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
-libbsp_a_SOURCES += clock/clock.c
-libbsp_a_SOURCES += ../../shared/clockdrv_shell.h
-libbsp_a_SOURCES += rtc/rtc.c
-libbsp_a_SOURCES += ../../shared/tod.c
-libbsp_a_SOURCES += console/console.c
-libbsp_a_SOURCES += fb/fb.c
-libbsp_a_SOURCES += touchscreen/touchscreen.c
-libbsp_a_SOURCES += touchscreen/parser.c
-libbsp_a_SOURCES += touchscreen/reco.c
-libbsp_a_SOURCES += timer/timer.c
-libbsp_a_SOURCES += sound/sound.c
-libbsp_a_SOURCES += block/block.c
-libbsp_a_SOURCES += irq/irq.c
-# Cache
-libbsp_a_SOURCES += ../../../libcpu/shared/src/cache_manager.c
-libbsp_a_SOURCES += ../../shared/include/cache_.h
-
-if HAS_NETWORKING
-noinst_PROGRAMS += wifi.rel
-wifi_rel_SOURCES = wifi/wifi.c wifi/compat.c
-wifi_rel_CPPFLAGS = $(AM_CPPFLAGS) -DARM9 -I$(srcdir)/dswifi/include -I$(srcdir)/libnds/include -I$(srcdir)/dswifi/include -D_KERNEL -D__BSD_VISIBLE
-wifi_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-endif
-
-# libnds, ARM9 side
-noinst_PROGRAMS += libnds9.rel
-bin2s: $(srcdir)/tools/bin2s.c
- cc -o $(srcdir)/tools/bin2s $(srcdir)/tools/bin2s.c
-
-SUFFIXES = .bin
-
-%.s: %.bin bin2s
- $(srcdir)/tools/bin2s $< > $(srcdir)/$@
-
-libnds9_rel_SOURCES = libnds/source/common/biosCalls.S \
- libnds/source/common/card.c \
- libnds/source/common/gbfs.c \
- libnds/source/common/interruptDispatcher.S \
- libnds/source/common/interrupts.c \
- libnds/source/arm9/boxtest.c \
- libnds/source/arm9/default_font.S \
- libnds/source/arm9/console.c \
- libnds/source/arm9/COS.S \
- libnds/source/arm9/dcache.S \
- libnds/source/arm9/exceptionHandler.S \
- libnds/source/arm9/exceptions.c \
- libnds/source/arm9/gurumeditation.c \
- libnds/source/arm9/icache.S \
- libnds/source/arm9/image.c \
- libnds/source/arm9/initSystem.c \
- libnds/source/arm9/keys.c \
- libnds/source/arm9/ndsmotion.c \
- libnds/source/arm9/pcx.c \
- libnds/source/arm9/rumble.c \
- libnds/source/arm9/SIN.S \
- libnds/source/arm9/sound.c \
- libnds/source/arm9/system.c \
- libnds/source/arm9/TAN.S \
- libnds/source/arm9/touch.c \
- libnds/source/arm9/video.c \
- libnds/source/arm9/videoGL.c
-libnds9_rel_CPPFLAGS = $(AM_CPPFLAGS) -DARM9 -I$(srcdir)/libnds/include -I$(srcdir)/include
-libnds9_rel_CCASFLAGS = $(AM_CCASFLAGS) -DARM9 -I$(srcdir)/libnds/include
-libnds9_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
-if HAS_NETWORKING
-# dswifi, ARM9 side
-noinst_PROGRAMS += dswifi9.rel
-dswifi9_rel_SOURCES = dswifi/arm9/source/wifi_arm9.c
-dswifi9_rel_SOURCES += dswifi/common/source/spinlock.S
-dswifi9_rel_CPPFLAGS = $(AM_CPPFLAGS) -DARM9 -I$(srcdir)/dswifi/include -I$(srcdir)/libnds/include -I$(srcdir)/dswifi/common/source -I$(srcdir)/wifi -D_KERNEL
-dswifi9_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-endif
-
-# dldi
-noinst_PROGRAMS += libdldi.rel
-libdldi_rel_SOURCES = libfat/source/disc_io/disc.c \
- libfat/source/disc_io/io_cf_common.c \
- libfat/source/disc_io/io_efa2.c \
- libfat/source/disc_io/io_fcsr.c \
- libfat/source/disc_io/io_m3cf.c \
- libfat/source/disc_io/io_m3_common.c \
- libfat/source/disc_io/io_m3sd.c \
- libfat/source/disc_io/io_mpcf.c \
- libfat/source/disc_io/io_njsd.c \
- libfat/source/disc_io/io_nmmc.c \
- libfat/source/disc_io/io_sccf.c \
- libfat/source/disc_io/io_sc_common.c \
- libfat/source/disc_io/io_scsd.c \
- libfat/source/disc_io/io_sd_common.c \
- libfat/source/disc_io/io_dldi.S \
- libfat/source/disc_io/io_scsd_s.S
-libdldi_rel_CPPFLAGS = $(AM_CPPFLAGS) -DARM9 -I$(srcdir)/libnds/include -I$(srcdir)/libfat/source/disc_io
-libdldi_rel_CCASFLAGS = $(AM_CCASFLAGS) -DARM9 -I$(srcdir)/libnds/include -I$(srcdir)/libfat/source/disc_io
-libdldi_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
-# libnds, ARM7 side
-noinst_PROGRAMS += libnds7.rel
-libnds7_rel_SOURCES = libnds/source/common/biosCalls.S \
- libnds/source/common/card.c \
- libnds/source/common/gbfs.c \
- libnds/source/common/interruptDispatcher.S \
- libnds/source/common/interrupts.c \
- libnds/source/arm7/audio.c \
- libnds/source/arm7/clock.c \
- libnds/source/arm7/microphone.c \
- libnds/source/arm7/spi.c \
- libnds/source/arm7/touch.c \
- libnds/source/arm7/userSettings.c
-libnds7_rel_CPPFLAGS = $(AM_CPPFLAGS) -DARM7 -I$(srcdir)/libnds/include
-libnds7_rel_CFLAGS = -mcpu=arm7tdmi -mfpu=vfp -mfloat-abi=soft
-libnds7_rel_CCASFLAGS = -mcpu=arm7tdmi -mfpu=vfp -mfloat-abi=soft
-libnds7_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
-if HAS_NETWORKING
-# dswifi, ARM7 side
-noinst_PROGRAMS += dswifi7.rel
-dswifi7_rel_SOURCES = dswifi/arm7/source/wifi_arm7.c \
- dswifi/common/source/spinlock.S
-dswifi7_rel_CPPFLAGS = $(AM_CPPFLAGS) -DARM7 -I$(srcdir)/dswifi/include -I$(srcdir)/libnds/include -I$(srcdir)/dswifi/common/source
-dswifi7_rel_CFLAGS = -mcpu=arm7tdmi -mfpu=vfp -mfloat-abi=soft
-dswifi7_rel_CCASFLAGS = -mcpu=arm7tdmi -mfpu=vfp -mfloat-abi=soft
-dswifi7_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-endif
-
-# include libnds to dist so the user program can include it
-include_libndsdir = $(includedir)/libnds
-include_libnds_HEADERS = libnds/include/gbfs.h \
- libnds/include/nds.h
-
-include_libndsndsdir = $(includedir)/libnds/nds
-include_libndsnds_HEADERS = libnds/include/nds/memory.h \
- libnds/include/nds/system.h \
- libnds/include/nds/bios.h \
- libnds/include/nds/registers_alt.h \
- libnds/include/nds/interrupts.h \
- libnds/include/nds/card.h \
- libnds/include/nds/ipc.h \
- libnds/include/nds/timers.h \
- libnds/include/nds/dma.h \
- libnds/include/nds/reload.h \
- libnds/include/nds/jtypes.h
-
-include_libndsnds9dir = $(includedir)/libnds/nds/arm9
-include_libndsnds9_HEADERS = libnds/include/nds/arm9/ndsmotion.h \
- libnds/include/nds/arm9/pcx.h \
- libnds/include/nds/arm9/input.h \
- libnds/include/nds/arm9/math.h \
- libnds/include/nds/arm9/console.h \
- libnds/include/nds/arm9/sprite.h \
- libnds/include/nds/arm9/videoGL.h \
- libnds/include/nds/arm9/cache.h \
- libnds/include/nds/arm9/image.h \
- libnds/include/nds/arm9/trig_lut.h \
- libnds/include/nds/arm9/video.h \
- libnds/include/nds/arm9/exceptions.h \
- libnds/include/nds/arm9/rumble.h \
- libnds/include/nds/arm9/background.h \
- libnds/include/nds/arm9/boxtest.h \
- libnds/include/nds/arm9/postest.h \
- libnds/include/nds/arm9/sound.h
-
-include_libndsnds7dir = $(includedir)/libnds/nds/arm7
-include_libndsnds7_HEADERS = libnds/include/nds/arm7/serial.h \
- libnds/include/nds/arm7/audio.h \
- libnds/include/nds/arm7/clock.h \
- libnds/include/nds/arm7/touch.h
-EXTRA_DIST = coproc/coproc.S coproc/coproc.c
-if HAS_NETWORKING
-coproc.bin: coproc/coproc.S coproc/coproc.c libnds7.rel dswifi7.rel
- @CC@ -o coproc.elf -mcpu=arm7tdmi -mfpu=vfp -mfloat-abi=soft -O2 -DARM7 -I$(srcdir)/libnds/include -I$(srcdir)/dswifi/include -DENABLE_WIFI -T $(srcdir)/coproc/coproc.ld $^ -lc
- $(OBJCOPY) -O binary coproc.elf coproc.bin
-else
-coproc.bin: coproc/coproc.S coproc/coproc.c libnds7.rel
- @CC@ -o coproc.elf -mcpu=arm7tdmi -mfpu=vfp -mfloat-abi=soft -O2 -DARM7 -I$(srcdir)/libnds/include -T $(srcdir)/coproc/coproc.ld $^ -lc
- $(OBJCOPY) -O binary coproc.elf coproc.bin
-endif
-project_lib_DATA += coproc.bin
-
-libbsp_a_LIBADD = libnds9.rel libdldi.rel
-
-if HAS_NETWORKING
- libbsp_a_LIBADD += wifi.rel dswifi9.rel
-endif
-
-include $(srcdir)/preinstall.am
-include $(top_srcdir)/../../../../automake/local.am
diff --git a/c/src/lib/libbsp/arm/nds/README b/c/src/lib/libbsp/arm/nds/README
deleted file mode 100644
index 17205ce01c..0000000000
--- a/c/src/lib/libbsp/arm/nds/README
+++ /dev/null
@@ -1,8 +0,0 @@
-This is the BSP for Nintendo DS.
-
-Original authors:
-
- * Matthieu Bucchianeri <mbucchia@gmail.com>
- * Benjamin Ratier
- * Renaud Voltz
- * Cedric Gestes
diff --git a/c/src/lib/libbsp/arm/nds/block/block.c b/c/src/lib/libbsp/arm/nds/block/block.c
deleted file mode 100644
index a2e48c1bb3..0000000000
--- a/c/src/lib/libbsp/arm/nds/block/block.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * RTEMS for Nintendo DS flash driver.
- */
-
-/*
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <rtems.h>
-#include <bsp.h>
-#include <libchip/ide_ctrl.h>
-#include <libchip/ide_ctrl_cfg.h>
-#include <libchip/ide_ctrl_io.h>
-
-#include <disc.h>
-
-static bool
-nds_flash_probe (int minor)
-{
- return true;
-}
-
-static void
-nds_flash_initialize (int minor)
-{
- const IO_INTERFACE *flash;
-
- printk ("[+] flash started\n");
-
- flash = _FAT_disc_dsSlotFindInterface ();
- if (flash == NULL) {
- printk ("[!] error getting device\n");
- rtems_fatal_error_occurred (0);
- }
-
- if (_FAT_disc_isInserted (flash)) {
- printk ("[#] flash inserted\n");
- } else {
- printk ("[!] flash not inserted\n");
- }
-}
-
-static void
-nds_flash_read_reg (int minor, int reg, uint16_t * value)
-{
- printk ("nds_flash_read_reg\n");
-}
-
-static void
-nds_flash_write_reg (int minor, int reg, uint16_t value)
-{
- printk ("nds_flash_write_reg\n");
-}
-
-static void
-nds_flash_read_block (int minor, uint32_t block_size,
- rtems_blkdev_sg_buffer * bufs,
- uint32_t * cbuf, uint32_t * pos)
-{
- printk ("nds_flash_read_block\n");
-}
-
-static void
-nds_flash_write_block (int minor, uint32_t block_size,
- rtems_blkdev_sg_buffer * bufs,
- uint32_t * cbuf, uint32_t * pos)
-{
- printk ("nds_flash_write_block\n");
-}
-
-static int
-nds_flash_control (int minor, uint32_t cmd, void *arg)
-{
- printk ("nds_flash_control\n");
- return 0;
-}
-
-static rtems_status_code
-nds_flash_io_speed (int minor, uint16_t mode)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-ide_ctrl_fns_t nds_flash_ctrl_fns = {
- nds_flash_probe,
- nds_flash_initialize,
- nds_flash_control,
- nds_flash_read_reg,
- nds_flash_write_reg,
- nds_flash_read_block,
- nds_flash_write_block,
- nds_flash_io_speed
-};
-
-/* IDE controllers Table */
-ide_controller_bsp_table_t IDE_Controller_Table[] = {
- {
- "/dev/flash",
- IDE_CUSTOM, /* standard IDE controller */
- &nds_flash_ctrl_fns,
- NULL, /* probe for IDE standard registers */
- FALSE, /* not (yet) initialized */
- 0x0, /* base I/O address for first IDE controller */
- FALSE, 0, /* not (yet) interrupt driven */
- NULL
- }
-};
-
-/* Number of rows in IDE_Controller_Table */
-unsigned long IDE_Controller_Count = 1;
diff --git a/c/src/lib/libbsp/arm/nds/bsp_specs b/c/src/lib/libbsp/arm/nds/bsp_specs
deleted file mode 100644
index 32c105fd0f..0000000000
--- a/c/src/lib/libbsp/arm/nds/bsp_specs
+++ /dev/null
@@ -1,13 +0,0 @@
-%rename endfile old_endfile
-%rename startfile old_startfile
-%rename link old_link
-
-*startfile:
-%{!qrtems: %(old_startfile)} \
-%{!nostdlib: %{qrtems: start.o%s crti.o%s crtbegin.o%s -e _start}}
-
-*link:
-%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
-
-*endfile:
-%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
diff --git a/c/src/lib/libbsp/arm/nds/clock/clock.c b/c/src/lib/libbsp/arm/nds/clock/clock.c
deleted file mode 100644
index 1e239d44d9..0000000000
--- a/c/src/lib/libbsp/arm/nds/clock/clock.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * @file
- *
- * RTEMS for Nintendo DS clock driver.
- */
-
-/*
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <rtems.h>
-#include <bsp.h>
-#include <rtems/irq.h>
-#include <nds.h>
-
-/*
- * forward declaration for clock isr in clockdrv_shell.h
- */
-void Clock_isr(rtems_irq_hdl_param arg);
-
-/*
- * forward declarations for methods in this file
- */
-void Clock_driver_support_shutdown_hardware (void);
-void Clock_driver_support_initialize_hardware (void);
-
-/*
- * isr registration variables.
- */
-static rtems_irq_connect_data clock_isr_data = {
- .name = IRQ_TIMER0,
- .hdl = Clock_isr,
- .handle = NULL,
- .on = NULL,
- .off = NULL,
- .isOn = NULL,
-};
-
-void update_touchscreen (void);
-
-/*
- * function called on every ticks.
- * NOTE: replaced by macro to avoid empty function call.
- */
-#define Clock_driver_support_at_tick() \
- update_touchscreen();
-
-/*
- * install isr for clock driver.
- */
-#define Clock_driver_support_install_isr( _new, _old ) \
- do { \
- _old = NULL; \
- BSP_install_rtems_irq_handler(&clock_isr_data); \
- } while (0)
-
-/*
- * disable clock.
- */
-void Clock_driver_support_shutdown_hardware (void)
-{
- BSP_remove_rtems_irq_handler (&clock_isr_data);
- TIMER_CR (0) &= ~(TIMER_ENABLE);
-}
-
-/*
- * initialize clock on timer 0.
- */
-void Clock_driver_support_initialize_hardware (void)
-{
- uint32_t freq =
- 1000 / (rtems_configuration_get_microseconds_per_tick () / 1000);
-
- printk ("[+] clock started\n");
- TIMER_CR (0) = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_DIV_64;
- printk ("[#] setting clock to %u hz\n", freq);
- TIMER_DATA (0) = TIMER_FREQ_64 ((uint16_t) freq);
-}
-
-#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
-
-#include "../../../shared/clockdrv_shell.h"
diff --git a/c/src/lib/libbsp/arm/nds/configure.ac b/c/src/lib/libbsp/arm/nds/configure.ac
deleted file mode 100644
index d71ea5e128..0000000000
--- a/c/src/lib/libbsp/arm/nds/configure.ac
+++ /dev/null
@@ -1,26 +0,0 @@
-AC_PREREQ([2.69])
-AC_INIT([rtems-c-src-lib-libbsp-arm-nds],[_RTEMS_VERSION],[https://devel.rtems.org/newticket])
-AC_CONFIG_SRCDIR([bsp_specs])
-RTEMS_TOP(../../../../../..)
-
-RTEMS_CANONICAL_TARGET_CPU
-AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.12.2])
-RTEMS_BSP_CONFIGURE
-
-RTEMS_PROG_CC_FOR_TARGET
-RTEMS_CANONICALIZE_TOOLS
-RTEMS_CHECK_TOOL(OBJCOPY,objcopy,:)
-RTEMS_PROG_CCAS
-
-RTEMS_CONFIG_BUILD_SUBDIRS(tools)
-
-## $srcdir/mk_libnds.sh $srcdir
-
-RTEMS_CHECK_NETWORKING
-AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
-
-RTEMS_BSP_CLEANUP_OPTIONS(1, 1)
-
-# Explicitly list all Makefiles here
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
diff --git a/c/src/lib/libbsp/arm/nds/console/console.c b/c/src/lib/libbsp/arm/nds/console/console.c
deleted file mode 100644
index 6036f9cff3..0000000000
--- a/c/src/lib/libbsp/arm/nds/console/console.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * RTEMS for Nintendo DS console driver.
- *
- * Copyright (c) 2008 by Renaud Voltz <renaud.voltz@gmail.com>
- * Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <bsp.h>
-#include <nds.h>
-#include <rtems/libio.h>
-#include <nds/arm9/console.h>
-#include <sys/iosupport.h>
-
-#include <rtems/mw_uid.h>
-
-/*
- * enables testsuite output to desmume. this is used to pass the rtems
- * testsuite.
- * comment the following line to disable (recommended).
- */
-
-//#define TESTSUITE
-
-/*
- * printk support.
- */
-
-/* from NDS support library */
-extern void consolePrintChar(char c);
-static void
-nds_putch (char c)
-{
-#ifdef TESTSUITE
- __asm__ volatile ("swi $0x1");
-#endif
- consolePrintChar (c);
-}
-
-static volatile char ch = 0;
-
-void console_push (char c); /* used in touchscreen.c */
-
-void
-console_push (char c)
-{
- ch = c;
-}
-
-static int
-nds_getch (void)
-{
- char c;
-
- while (ch == 0);
- c = ch;
- ch = 0;
- return c;
-}
-
-BSP_output_char_function_type BSP_output_char = nds_putch;
-BSP_polling_getchar_function_type BSP_poll_char = nds_getch;
-
-/*
- * console write operation.
- */
-
-static ssize_t
-nds_write (int minor, const char *buf, size_t len)
-{
- int count;
-
- for (count = 0; count < len; count++) {
- nds_putch (buf[count]);
- }
-
- return 0;
-}
-
-/*
- * console read operation.
- */
-
-static int
-nds_read (int minor)
-{
- return nds_getch ();
-}
-
-/*
- * from touchscreen/parser.c
- */
-
-void register_kbd_msg_queue (char *q_name);
-void unregister_kbd_msg_queue (void);
-
-/*
- * Console driver
- */
-
-rtems_device_driver
-console_initialize (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_status_code status;
-
- printk ("[+] console started\n");
-
- rtems_termios_initialize ();
-
- status = rtems_io_register_name ("/dev/console", major, 0);
- if (status != RTEMS_SUCCESSFUL) {
- printk ("[!] error registering console\n");
- rtems_fatal_error_occurred (status);
- }
-
- return (RTEMS_SUCCESSFUL);
-}
-
-rtems_device_driver
-console_open (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_status_code status;
- static rtems_termios_callbacks cb = {
- NULL, /* firstOpen */
- NULL, /* lastClose */
- nds_read, /* pollRead */
- nds_write, /* write */
- NULL, /* setAttributes */
- NULL, /* stopRemoteTx */
- NULL, /* startRemoteTx */
- 0 /* 1 = outputUsesInterrupts */
- };
-
- status = rtems_termios_open (major, minor, arg, &cb);
- if (status != RTEMS_SUCCESSFUL)
- printk ("[!] error opening console\n");
-
- return (status);
-}
-
-rtems_device_driver
-console_close (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_device_driver res = RTEMS_SUCCESSFUL;
-
- res = rtems_termios_close (arg);
-
- return res;
-}
-
-rtems_device_driver
-console_read (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- return rtems_termios_read (arg);
-}
-
-rtems_device_driver
-console_write (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- return rtems_termios_write (arg);
-}
-
-rtems_device_driver
-console_control (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_libio_ioctl_args_t *args = arg;
-
- switch (args->command) {
- case MW_UID_REGISTER_DEVICE:
- register_kbd_msg_queue (args->buffer);
- break;
- case MW_UID_UNREGISTER_DEVICE:
- unregister_kbd_msg_queue ();
- break;
- default:
- return rtems_termios_ioctl (arg);
- }
- args->ioctl_return = 0;
-
- return RTEMS_SUCCESSFUL;
-}
diff --git a/c/src/lib/libbsp/arm/nds/coproc/coproc.S b/c/src/lib/libbsp/arm/nds/coproc/coproc.S
deleted file mode 100644
index f1bc2bac61..0000000000
--- a/c/src/lib/libbsp/arm/nds/coproc/coproc.S
+++ /dev/null
@@ -1,112 +0,0 @@
-@---------------------------------------------------------------------------------
- .section ".init"
- .global _start
- .global _init
-@---------------------------------------------------------------------------------
- .align 4
- .arm
-@---------------------------------------------------------------------------------
-_start:
-@---------------------------------------------------------------------------------
- mov r0, #0x04000000 @ IME = 0;
- str r0, [r0, #0x208]
-
- mov r0, #0x12 @ Switch to IRQ Mode
- msr cpsr, r0
- ldr sp, =__sp_irq @ Set IRQ stack
-
- mov r0, #0x13 @ Switch to SVC Mode
- msr cpsr, r0
- ldr sp, =__sp_svc @ Set SVC stack
-
- mov r0, #0x1F @ Switch to System Mode
- msr cpsr, r0
- ldr sp, =__sp_usr @ Set user stack
-
- ldr r0, =__bss_start @ Clear BSS section to 0x00
- ldr r1, =__bss_end
- sub r1, r1, r0
- bl ClearMem
-
- ldr r3, =__libc_init_array @ global constructors
- bl _call_via_r3
-
- mov r0, #0 @ int argc
- mov r1, #0 @ char *argv[]
- ldr r3, =main
- bl _call_via_r3 @ jump to user code
-
- @ If the user ever returns, return to flash cartridge
- mov r0, #0x08000000
- bx r0
-
-@---------------------------------------------------------------------------------
-@ Clear memory to 0x00 if length != 0
-@ r0 = Start Address
-@ r1 = Length
-@---------------------------------------------------------------------------------
-ClearMem:
-@---------------------------------------------------------------------------------
- mov r2, #3 @ Round down to nearest word boundary
- add r1, r1, r2 @ Shouldn't be needed
- bics r1, r1, r2 @ Clear 2 LSB (and set Z)
- bxeq lr @ Quit if copy size is 0
-
- mov r2, #0
-ClrLoop:
- stmia r0!, {r2}
- subs r1, r1, #4
- bne ClrLoop
- bx lr
-
-@---------------------------------------------------------------------------------
-@ Copy memory if length != 0
-@ r1 = Source Address
-@ r2 = Dest Address
-@ r4 = Dest Address + Length
-@---------------------------------------------------------------------------------
-CopyMemCheck:
-@---------------------------------------------------------------------------------
- sub r3, r4, r2 @ Is there any data to copy?
-@---------------------------------------------------------------------------------
-@ Copy memory
-@ r1 = Source Address
-@ r2 = Dest Address
-@ r3 = Length
-@---------------------------------------------------------------------------------
-CopyMem:
-@---------------------------------------------------------------------------------
- mov r0, #3 @ These commands are used in cases where
- add r3, r3, r0 @ the length is not a multiple of 4,
- bics r3, r3, r0 @ even though it should be.
- bxeq lr @ Length is zero, so exit
-CIDLoop:
- ldmia r1!, {r0}
- stmia r2!, {r0}
- subs r3, r3, #4
- bne CIDLoop
- bx lr
-
-_init:
- bx lr
-
-@---------------------------------------------------------------------------------
- .align
-@ .pool
-@ .end
-@---------------------------------------------------------------------------------
-
-@---------------------------------------------------------------------------------
- .section ".fini"
- .global _fini
-@---------------------------------------------------------------------------------
- .align 4
- .arm
-@---------------------------------------------------------------------------------
-_fini:
- bx lr
-@---------------------------------------------------------------------------------
- .align
- .pool
- .end
-@---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/coproc/coproc.c b/c/src/lib/libbsp/arm/nds/coproc/coproc.c
deleted file mode 100644
index 611bd31971..0000000000
--- a/c/src/lib/libbsp/arm/nds/coproc/coproc.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- default ARM7 core
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#include <nds.h>
-#include "../include/my_ipc.h"
-
-#ifdef ENABLE_WIFI
-#include <dswifi7.h>
-#endif
-
-//---------------------------------------------------------------------------------
-void startSound(int sampleRate, const void* data, u32 bytes, u8 channel, u8 vol, u8 pan, u8 format) {
-//---------------------------------------------------------------------------------
- SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate);
- SCHANNEL_SOURCE(channel) = (u32)data;
- SCHANNEL_LENGTH(channel) = bytes >> 2 ;
- SCHANNEL_CR(channel) = SCHANNEL_ENABLE | SOUND_ONE_SHOT | SOUND_VOL(vol) | SOUND_PAN(pan) | (format==1?SOUND_8BIT:SOUND_16BIT);
-}
-
-//---------------------------------------------------------------------------------
-s32 getFreeSoundChannel() {
-//---------------------------------------------------------------------------------
- int i;
- for (i=0; i<16; i++) {
- if ( (SCHANNEL_CR(i) & SCHANNEL_ENABLE) == 0 ) return i;
- }
- return -1;
-}
-
-
-touchPosition first,tempPos;
-
-//---------------------------------------------------------------------------------
-void VcountHandler() {
-//---------------------------------------------------------------------------------
- static int lastbut = -1;
-
- uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0;
-
- but = REG_KEYXY;
-
- if (!( (but ^ lastbut) & (1<<6))) {
-
- tempPos = touchReadXY();
-
- if ( tempPos.x == 0 || tempPos.y == 0 ) {
- but |= (1 <<6);
- lastbut = but;
- } else {
- x = tempPos.x;
- y = tempPos.y;
- xpx = tempPos.px;
- ypx = tempPos.py;
- z1 = tempPos.z1;
- z2 = tempPos.z2;
- }
-
- } else {
- lastbut = but;
- but |= (1 <<6);
- }
- IPC->touchX = x;
- IPC->touchY = y;
- IPC->touchXpx = xpx;
- IPC->touchYpx = ypx;
- IPC->touchZ1 = z1;
- IPC->touchZ2 = z2;
- IPC->buttons = but;
-
-}
-
-//---------------------------------------------------------------------------------
-void VblankHandler(void) {
-//---------------------------------------------------------------------------------
- static u8 is_recording = 0;
- u32 i;
-
- //sound code :)
- TransferSound *snd = IPC->soundData;
- IPC->soundData = 0;
-
- if (0 != snd) {
-
- for (i=0; i<snd->count; i++) {
- s32 chan = getFreeSoundChannel();
-
- if (chan >= 0) {
- startSound(snd->data[i].rate, snd->data[i].data, snd->data[i].len, chan, snd->data[i].vol, snd->data[i].pan, snd->data[i].format);
- }
- }
- }
-
- // microphone code
- if (!is_recording && my_IPC->record)
- {
- StartRecording((u8 *)my_IPC->record_buffer, my_IPC->record_length_max);
- is_recording = 1;
- }
-
- if (is_recording && !my_IPC->record)
- {
- my_IPC->recorded_length = 1 + StopRecording();
- is_recording = 0;
- }
-
-#ifdef ENABLE_WIFI
- Wifi_Update(); // update wireless in vblank
-#endif
-}
-
-#ifdef ENABLE_WIFI
-// callback to allow wifi library to notify arm9
-void arm7_synctoarm9() { // send fifo message
- REG_IPC_FIFO_TX = 0x87654321;
-}
-// interrupt handler to allow incoming notifications from arm9
-void arm7_fifo() { // check incoming fifo messages
- u32 msg = REG_IPC_FIFO_RX;
- if(msg==0x87654321) Wifi_Sync();
-}
-#endif
-
-//---------------------------------------------------------------------------------
-int main(int argc, char ** argv) {
-//---------------------------------------------------------------------------------
-#ifdef ENABLE_WIFI
- REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; // enable & prepare
- // fifo asap
-#endif
-
- // read User Settings from firmware
- readUserSettings();
-
- //enable sound
- powerON(POWER_SOUND);
- writePowerManagement(PM_CONTROL_REG, ( readPowerManagement(PM_CONTROL_REG) & ~PM_SOUND_MUTE ) | PM_SOUND_AMP );
- SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F);
-
- irqInit();
-
- // Start the RTC tracking IRQ
- initClockIRQ();
-
- SetYtrigger(80);
- irqSet(IRQ_VCOUNT, VcountHandler);
- irqSet(IRQ_VBLANK, VblankHandler);
- irqSet(IRQ_TIMER0, ProcessMicrophoneTimerIRQ);
-
- irqEnable(IRQ_VBLANK | IRQ_VCOUNT | IRQ_TIMER0);
-
-#ifdef ENABLE_WIFI
- irqSet(IRQ_WIFI, Wifi_Interrupt); // set up wifi interrupt
- irqEnable(IRQ_WIFI);
-
- // sync with arm9 and init wifi
- u32 fifo_temp;
-
- while (1)
- { // wait for magic number
- while (REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)
- swiWaitForVBlank();
- fifo_temp = REG_IPC_FIFO_RX;
- if (fifo_temp == 0x12345678)
- break;
- }
- while (REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)
- swiWaitForVBlank();
- fifo_temp = REG_IPC_FIFO_RX;
- Wifi_Init(fifo_temp);
-
- irqSet(IRQ_FIFO_NOT_EMPTY,arm7_fifo); // set up fifo irq
- irqEnable(IRQ_FIFO_NOT_EMPTY);
- REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ;
-
- Wifi_SetSyncHandler(arm7_synctoarm9); // allow wifi lib to notify arm9
-#endif
- // Keep the ARM7 mostly idle
- while (1) {
- swiWaitForVBlank();
- }
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/coproc/coproc.ld b/c/src/lib/libbsp/arm/nds/coproc/coproc.ld
deleted file mode 100644
index deb2fe4343..0000000000
--- a/c/src/lib/libbsp/arm/nds/coproc/coproc.ld
+++ /dev/null
@@ -1,195 +0,0 @@
-OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(_start)
-
-MEMORY {
-
- rom : ORIGIN = 0x08000000, LENGTH = 32M
- iwram : ORIGIN = 0x037f8000, LENGTH = 96K
-}
-
-__iwram_start = ORIGIN(iwram);
-__iwram_top = ORIGIN(iwram)+ LENGTH(iwram);
-__sp_irq = __iwram_top - 0x60;
-__sp_svc = __sp_irq - 0x100;
-__sp_usr = __sp_svc - 0x100;
-
-__irq_flags = __iwram_top - 8;
-__irq_vector = __iwram_top - 4;
-
-SECTIONS
-{
- .init :
- {
- __text_start = . ;
- KEEP (*(.init))
- . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
- } >iwram = 0xff
- .plt : { *(.plt) } >iwram = 0xff
-
- .text : /* ALIGN (4): */
- {
-
- *(.text*)
- *(.stub)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- *(.gnu.linkonce.t*)
- *(.glue_7)
- *(.glue_7t)
- . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
- } >iwram = 0xff
-
- .fini :
- {
- KEEP (*(.fini))
- } >iwram =0xff
-
- __text_end = . ;
-
- .rodata :
- {
- *(.rodata)
- *all.rodata*(*)
- *(.roda)
- *(.rodata.*)
- *(.gnu.linkonce.r*)
- SORT(CONSTRUCTORS)
- . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
- } >iwram = 0xff
-
- .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >iwram
- __exidx_start = .;
- .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >iwram
- __exidx_end = .;
-
-/* Ensure the __preinit_array_start label is properly aligned. We
- could instead move the label definition inside the section, but
- the linker would then create the section even if it turns out to
- be empty, which isn't pretty. */
- . = ALIGN(32 / 8);
- PROVIDE (__preinit_array_start = .);
- .preinit_array : { KEEP (*(.preinit_array)) } >iwram = 0xff
- PROVIDE (__preinit_array_end = .);
- PROVIDE (__init_array_start = .);
- .init_array : { KEEP (*(.init_array)) } >iwram = 0xff
- PROVIDE (__init_array_end = .);
- PROVIDE (__fini_array_start = .);
- .fini_array : { KEEP (*(.fini_array)) } >iwram = 0xff
- PROVIDE (__fini_array_end = .);
-
- .ctors :
- {
- /* gcc uses crtbegin.o to find the start of the constructors, so
- we make sure it is first. Because this is a wildcard, it
- doesn't matter if the user does not actually link against
- crtbegin.o; the linker won't look for a file to match a
- wildcard. The wildcard also means that it doesn't matter which
- directory crtbegin.o is in. */
- KEEP (*crtbegin.o(.ctors))
- KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
- KEEP (*(SORT(.ctors.*)))
- KEEP (*(.ctors))
- . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
- } >iwram = 0xff
-
- .dtors :
- {
- KEEP (*crtbegin.o(.dtors))
- KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
- KEEP (*(SORT(.dtors.*)))
- KEEP (*(.dtors))
- . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
- } >iwram = 0xff
-
- .eh_frame :
- {
- KEEP (*(.eh_frame))
- . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
- } >iwram = 0xff
-
- .gcc_except_table :
- {
- *(.gcc_except_table)
- . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
- } >iwram = 0xff
- .jcr : { KEEP (*(.jcr)) } >iwram = 0
- .got : { *(.got.plt) *(.got) } >iwram = 0
-
-
- .iwram ALIGN(4) :
- {
- __iwram_start = ABSOLUTE(.) ;
- *(.iwram)
- *iwram.*(.text)
- . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
- __iwram_end = ABSOLUTE(.) ;
- } >iwram = 0xff
-
-
- .data ALIGN(4) : {
- __data_start = ABSOLUTE(.);
- *(.data)
- *(.data.*)
- *(.gnu.linkonce.d*)
- CONSTRUCTORS
- . = ALIGN(4);
- __data_end = ABSOLUTE(.) ;
- } >iwram = 0xff
-
-
-
- .bss ALIGN(4) :
- {
- __bss_start = ABSOLUTE(.);
- __bss_start__ = ABSOLUTE(.);
- *(.dynbss)
- *(.gnu.linkonce.b*)
- *(.bss*)
- *(COMMON)
- . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
- } >iwram
-
- __bss_end = . ;
- __bss_end__ = . ;
-
- _end = . ;
- __end__ = . ;
- PROVIDE (end = _end);
-
- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
- .comment 0 : { *(.comment) }
- /* DWARF debug sections.
- Symbols in the DWARF debugging sections are relative to the beginning
- of the section so we begin them at 0. */
- /* DWARF 1 */
- .debug 0 : { *(.debug) }
- .line 0 : { *(.line) }
- /* GNU DWARF 1 extensions */
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- /* DWARF 1.1 and DWARF 2 */
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- /* DWARF 2 */
- .debug_info 0 : { *(.debug_info) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_str 0 : { *(.debug_str) }
- .debug_loc 0 : { *(.debug_loc) }
- .debug_macinfo 0 : { *(.debug_macinfo) }
- /* SGI/MIPS DWARF 2 extensions */
- .debug_weaknames 0 : { *(.debug_weaknames) }
- .debug_funcnames 0 : { *(.debug_funcnames) }
- .debug_typenames 0 : { *(.debug_typenames) }
- .debug_varnames 0 : { *(.debug_varnames) }
- .stack 0x80000 : { _stack = .; *(.stack) }
- /* These must appear regardless of . */
-}
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm7/makefile b/c/src/lib/libbsp/arm/nds/dswifi/arm7/makefile
deleted file mode 100644
index 685a8f2285..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm7/makefile
+++ /dev/null
@@ -1,145 +0,0 @@
-#---------------------------------------------------------------------------------
-.SUFFIXES:
-#---------------------------------------------------------------------------------
-ifeq ($(strip $(DEVKITARM)),)
-$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
-endif
-
-include $(DEVKITARM)/ds_rules
-
-TOPDIR ?= $(CURDIR)/..
-
-#---------------------------------------------------------------------------------
-# BUILD is the directory where object files & intermediate files will be placed
-# SOURCES is a list of directories containing source code
-# INCLUDES is a list of directories containing extra header files
-# DATA is a list of directories containing binary files
-# all directories are relative to this makefile
-#---------------------------------------------------------------------------------
-BUILD ?= release
-SOURCES := source ../common/source
-INCLUDES := include build ../common/source ../include
-DATA :=
-
-#---------------------------------------------------------------------------------
-# options for code generation
-#---------------------------------------------------------------------------------
-ARCH := -mthumb-interwork
-
-CFLAGS := -g -Wall -O2\
- -mcpu=arm7tdmi -mtune=arm7tdmi -mfpu=vfp -mfloat-abi=soft -fomit-frame-pointer\
- -ffast-math \
- $(ARCH)
-
-CFLAGS += $(INCLUDE) -DARM7
-CXXFLAGS := $(CFLAGS)
-
-
-ASFLAGS := -g $(ARCH)
-LDFLAGS = -specs=ds_arm7.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*).map
-
-
-ifneq ($(BUILD),debug)
-export ARM7BIN := $(TOPDIR)/lib/libdswifi7.a
-else
-export ARM7BIN := $(TOPDIR)/lib/libdswifi7d.a
-CFLAGS += -DSGIP_DEBUG
-endif
-
-
-LIBS :=
-#-lnds7
-
-#---------------------------------------------------------------------------------
-# list of directories containing libraries, this must be the top level containing
-# include and lib
-#---------------------------------------------------------------------------------
-LIBDIRS := $(LIBNDS)
-
-
-#---------------------------------------------------------------------------------
-# no real need to edit anything past this point unless you need to add additional
-# rules for different file extensions
-#---------------------------------------------------------------------------------
-ifneq ($(BUILD),$(notdir $(CURDIR)))
-#---------------------------------------------------------------------------------
-
-export DEPSDIR := $(CURDIR)/$(BUILD)
-
-export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
-
-export CC := $(PREFIX)gcc
-export CXX := $(PREFIX)g++
-export AR := $(PREFIX)ar
-export OBJCOPY := $(PREFIX)objcopy
-
-CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
-CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
-SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
-BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
-
-export OFILES := $(addsuffix .o,$(BINFILES)) \
- $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
-
-export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
- $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
- -I$(CURDIR)/$(BUILD)
-
-export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
-
-#---------------------------------------------------------------------------------
-# use CXX for linking C++ projects, CC for standard C
-#---------------------------------------------------------------------------------
-ifeq ($(strip $(CPPFILES)),)
-#---------------------------------------------------------------------------------
- export LD := $(CC)
-#---------------------------------------------------------------------------------
-else
-#---------------------------------------------------------------------------------
- export LD := $(CXX)
-#---------------------------------------------------------------------------------
-endif
-#---------------------------------------------------------------------------------
-
-.PHONY: $(BUILD) clean
-
-#---------------------------------------------------------------------------------
-$(BUILD):
- @[ -d $@ ] || mkdir -p $@
- @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/makefile
-
-#---------------------------------------------------------------------------------
-clean:
- @echo clean ...
- @rm -fr debug release
- @rm -f $(TOPDIR)/lib/libdswifi7*
-
-all: $(ARM7BIN)
-
-#---------------------------------------------------------------------------------
-else
-
-DEPENDS := $(OFILES:.o=.d)
-
-#---------------------------------------------------------------------------------
-# main targets
-#---------------------------------------------------------------------------------
-$(ARM7BIN) : $(OFILES)
- @rm -f "$(ARM7BIN)"
- @$(AR) rcs "$(ARM7BIN)" $(OFILES)
- @echo built ... $(notdir $@)
-
-
-#---------------------------------------------------------------------------------
-# you need a rule like this for each extension you use as binary data
-#---------------------------------------------------------------------------------
-%.bin.o : %.bin
-#---------------------------------------------------------------------------------
- @echo $(notdir $<)
- @$(bin2o)
-
--include $(DEPENDS)
-
-#---------------------------------------------------------------------------------------
-endif
-#---------------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm7/source/wifi_arm7.c b/c/src/lib/libbsp/arm/nds/dswifi/arm7/source/wifi_arm7.c
deleted file mode 100644
index d743a5b4c0..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm7/source/wifi_arm7.c
+++ /dev/null
@@ -1,1637 +0,0 @@
-// DS Wifi interface code
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-// wifi_arm7.c - arm7 wifi interface code
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-
-#include <nds.h>
-#include "dsregs.h"
-#include "wifi_arm7.h"
-
-#include "spinlock.h" // .h file with code for spinlocking in it.
-
-volatile Wifi_MainStruct * WifiData = 0;
-WifiSyncHandler synchandler = 0;
-int keepalive_time = 0;
-int chdata_save5 = 0;
-
-//////////////////////////////////////////////////////////////////////////
-//
-// Flash support functions
-//
-char FlashData[512];
-void Read_Flash(int address, char * destination, int length) {
- int i;
- while(SPI_CR&0x80);
- SPI_CR=0x8900;
- SPI_DATA=3;
- while(SPI_CR&0x80);
- SPI_DATA=(address>>16)&255;
- while(SPI_CR&0x80);
- SPI_DATA=(address>>8)&255;
- while(SPI_CR&0x80);
- SPI_DATA=(address)&255;
- while(SPI_CR&0x80);
- for(i=0;i<length;i++) {
- SPI_DATA=0;
- while(SPI_CR&0x80);
- destination[i]=SPI_DATA;
- }
- SPI_CR=0;
-}
-
-void InitFlashData() {
- Read_Flash(0,FlashData,512);
-}
-
-int ReadFlashByte(int address) {
- if(address<0 || address>511) return 0;
- return FlashData[address];
-}
-
-int ReadFlashBytes(int address, int numbytes) {
- int dataout=0;
- int i;
- for(i=0;i<numbytes;i++) {
- dataout |= ReadFlashByte(i+address)<<(i*8);
- }
- return dataout;
-}
-int ReadFlashHWord(int address) {
- if(address<0 || address>510) return 0;
- return ReadFlashBytes(address,2);
-}
-
-//////////////////////////////////////////////////////////////////////////
-//
-// WFC data loading
-//
-/*
-int crc16_slow(u8 * data, int length) {
- int i,j,d, crc;
- crc=0x0000;
- for(i=0;i<length;i++) {
- d=data[i];
- for(j=0;j<8;j++) {
- if(((d)^(crc>>15))&1) crc = (crc<<1)^0x8005; else crc=crc<<1;
- d=d>>1;
- }
- }
- crc &=0xFFFF;
- return crc;
-}
-*/
-int crc16_slow(u8 * data, int length) {
- int i,j, crc;
- crc=0x0000;
- for(i=0;i<length;i++) {
- crc ^=data[i];
- for(j=0;j<8;j++) {
- if((crc)&1) crc = (crc>>1)^0xA001; else crc=crc>>1;
- }
- }
- crc &=0xFFFF;
- return crc;
-}
-
-void GetWfcSettings(void) {
- u8 data[256];
- int i,n, c;
- unsigned long s;
- c=0;
- u32 wfcBase = ReadFlashBytes(0x20, 2) * 8 - 0x400;
- for(i=0;i<3;i++) WifiData->wfc_enable[i]=0;
- for(i=0;i<3;i++) {
- Read_Flash( wfcBase +(i<<8),(char *)data,256);
- // check for validity (crc16)
- if(crc16_slow(data,256)==0x0000 && data[0xE7]==0x00) { // passed the test
- WifiData->wfc_enable[c] = 0x80 | (data[0xE6]&0x0F);
- WifiData->wfc_ap[c].channel=0;
- for(n=0;n<6;n++) WifiData->wfc_ap[c].bssid[n]=0;
- for(n=0;n<16;n++) WifiData->wfc_wepkey[c][n]=data[0x80+n];
- for(n=0;n<32;n++) WifiData->wfc_ap[c].ssid[n]=data[0x40+n];
- for(n=0;n<32;n++) if(!data[0x40+n]) break;
- WifiData->wfc_ap[c].ssid_len=n;
- WifiData->wfc_config[c][0]=((unsigned long *)(data+0xC0))[0];
- WifiData->wfc_config[c][1]=((unsigned long *)(data+0xC0))[1];
- WifiData->wfc_config[c][3]=((unsigned long *)(data+0xC0))[2];
- WifiData->wfc_config[c][4]=((unsigned long *)(data+0xC0))[3];
- s=0;
- for(n=0;n<data[0xD0];n++) {
- s |= 1<<(31-n);
- }
- s= (s<<24) | (s>>24) | ((s&0xFF00)<<8) | ((s&0xFF0000)>>8); // htonl
- WifiData->wfc_config[c][2]=s;
- c++;
- }
- }
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-//
-// Other support
-//
-
-int Wifi_BBRead(int a) {
- while(W_BBSIOBUSY&1);
- W_BBSIOCNT=a | 0x6000;
- while(W_BBSIOBUSY&1);
- return W_BBSIOREAD;
-}
-int Wifi_BBWrite(int a, int b) {
- int i;
- i=0x2710;
- while((W_BBSIOBUSY&1)) {
- if(!i--) return -1;
- }
- W_BBSIOWRITE=b;
- W_BBSIOCNT=a | 0x5000;
- i=0x2710;
- while((W_BBSIOBUSY&1)) {
- if(!i--) return 0;
- }
- return 0;
-}
-void Wifi_RFWrite(int writedata) {
- while(W_RFSIOBUSY&1);
- W_RFSIODATA1=writedata;
- W_RFSIODATA2=writedata>>16;
- while(W_RFSIOBUSY&1);
-}
-
-int PowerChip_ReadWrite(int cmd, int data) {
- if(cmd&0x80) data=0;
- while(SPI_CR&0x80);
- SPI_CR=0x8802;
- SPI_DATA=cmd;
- while(SPI_CR&0x80);
- SPI_CR=0x8002;
- SPI_DATA=data;
- while(SPI_CR&0x80);
- data=SPI_DATA;
- SPI_CR=0;
- return data;
-}
-
-#define LED_LONGBLINK 1
-#define LED_SHORTBLINK 3
-#define LED_ON 0
-int led_state=0;
-void SetLedState(int state) {
- int i;
- if(state>3 || state<0) return;
- if(state!=led_state) {
- led_state=state;
- i=PowerChip_ReadWrite(0x80,0);
- i=i&0xCF;
- i |= state<<4;
- PowerChip_ReadWrite(0,i);
- }
-}
-
-void ProxySetLedState(int state) {
- if(WifiData->flags9&WFLAG_ARM9_USELED) SetLedState(state);
-}
-
-//////////////////////////////////////////////////////////////////////////
-//
-// Main functionality
-//
-
-int RF_Reglist[] = { 0x146, 0x148, 0x14A, 0x14C, 0x120, 0x122, 0x154, 0x144, 0x130, 0x132, 0x140, 0x142, 0x38, 0x124, 0x128, 0x150 };
-
-void Wifi_RFInit() {
- int i,j;
- int channel_extrabits;
- int numchannels;
- int channel_extrabytes;
- int temp;
- for(i=0;i<16;i++) {
- WIFI_REG(RF_Reglist[i])=ReadFlashHWord(0x44+i*2);
- }
- numchannels=ReadFlashByte(0x42);
- channel_extrabits=ReadFlashByte(0x41);
- channel_extrabytes=(channel_extrabits+7)/8;
- WIFI_REG(0x184)=((channel_extrabits>>7)<<8) | (channel_extrabits&0x7F);
- j=0xCE;
- if(ReadFlashByte(0x40)==3) {
- for(i=0;i<numchannels;i++) {
- Wifi_RFWrite(ReadFlashByte(j++)|(i<<8)|0x50000);
- }
- } else if(ReadFlashByte(0x40)==2) {
- for(i=0;i<numchannels;i++) {
- temp = ReadFlashBytes(j,channel_extrabytes);
- Wifi_RFWrite(temp);
- j+=channel_extrabytes;
- if( (temp>>18)==9 ) {
- chdata_save5 = temp&(~0x7C00);
- }
- }
- } else {
- for(i=0;i<numchannels;i++) {
- Wifi_RFWrite(ReadFlashBytes(j,channel_extrabytes));
- j+=channel_extrabytes;
- }
- }
-}
-
-void Wifi_BBInit() {
- int i;
- WIFI_REG(0x160)=0x0100;
- for(i=0;i<0x69;i++) {
- Wifi_BBWrite(i,ReadFlashByte(0x64+i));
- }
-}
-
-// 22 entry list
-int MAC_Reglist[] = { 0x04, 0x08, 0x0A, 0x12, 0x10, 0x254, 0xB4, 0x80, 0x2A, 0x28, 0xE8, 0xEA, 0xEE, 0xEC, 0x1A2, 0x1A0, 0x110, 0xBC, 0xD4, 0xD8, 0xDA, 0x76 };
-int MAC_Vallist[] = { 0, 0, 0, 0, 0xffff, 0, 0xffff, 0, 0, 0, 0, 0, 1, 0x3F03, 1, 0, 0x0800, 1, 3, 4, 0x0602, 0};
-void Wifi_MacInit() {
- int i;
- for(i=0;i<22;i++) {
- WIFI_REG(MAC_Reglist[i]) = MAC_Vallist[i];
- }
-}
-
-
-void Wifi_TxSetup() {
-/* switch(WIFI_REG(0x8006)&7) {
- case 0: //
- // 4170, 4028, 4000
- // TxqEndData, TxqEndManCtrl, TxqEndPsPoll
- WIFI_REG(0x4024)=0xB6B8;
- WIFI_REG(0x4026)=0x1D46;
- WIFI_REG(0x416C)=0xB6B8;
- WIFI_REG(0x416E)=0x1D46;
- WIFI_REG(0x4790)=0xB6B8;
- WIFI_REG(0x4792)=0x1D46;
- WIFI_REG(0x80AE) = 1;
- break;
- case 1: //
- // 4AA0, 4958, 4334
- // TxqEndData, TxqEndManCtrl, TxqEndBroadCast
- // 4238, 4000
- WIFI_REG(0x4234)=0xB6B8;
- WIFI_REG(0x4236)=0x1D46;
- WIFI_REG(0x4330)=0xB6B8;
- WIFI_REG(0x4332)=0x1D46;
- WIFI_REG(0x4954)=0xB6B8;
- WIFI_REG(0x4956)=0x1D46;
- WIFI_REG(0x4A9C)=0xB6B8;
- WIFI_REG(0x4A9E)=0x1D46;
- WIFI_REG(0x50C0)=0xB6B8;
- WIFI_REG(0x50C2)=0x1D46;
- //...
- break;
- case 2:
- // 45D8, 4490, 4468
- // TxqEndData, TxqEndManCtrl, TxqEndPsPoll
-
- WIFI_REG(0x4230)=0xB6B8;
- WIFI_REG(0x4232)=0x1D46;
- WIFI_REG(0x4464)=0xB6B8;
- WIFI_REG(0x4466)=0x1D46;
- WIFI_REG(0x448C)=0xB6B8;
- WIFI_REG(0x448E)=0x1D46;
- WIFI_REG(0x45D4)=0xB6B8;
- WIFI_REG(0x45D6)=0x1D46;
- WIFI_REG(0x4BF8)=0xB6B8;
- WIFI_REG(0x4BFA)=0x1D46;
-*/
- WIFI_REG(0x80AE)=0x000D;
-// }
-}
-
-void Wifi_RxSetup() {
- WIFI_REG(0x8030) = 0x8000;
-/* switch(WIFI_REG(0x8006)&7) {
- case 0:
- WIFI_REG(0x8050) = 0x4794;
- WIFI_REG(0x8056) = 0x03CA;
- // 17CC ?
- break;
- case 1:
- WIFI_REG(0x8050) = 0x50C4;
- WIFI_REG(0x8056) = 0x0862;
- // 0E9C ?
- break;
- case 2:
- WIFI_REG(0x8050) = 0x4BFC;
- WIFI_REG(0x8056) = 0x05FE;
- // 1364 ?
- break;
- case 3:
- WIFI_REG(0x8050) = 0x4794;
- WIFI_REG(0x8056) = 0x03CA;
- // 17CC ?
- break;
- }
- */
- WIFI_REG(0x8050) = 0x4C00;
- WIFI_REG(0x8056) = 0x0600;
-
- WIFI_REG(0x8052) = 0x5F60;
- WIFI_REG(0x805A) = (WIFI_REG(0x8050)&0x3FFF)>>1;
- WIFI_REG(0x8062) = 0x5F5E;
- WIFI_REG(0x8030) = 0x8001;
-}
-
-
-void Wifi_WakeUp() {
- u32 i;
- WIFI_REG(0x8036)=0;
-
- swiDelay( 67109 ); // 8ms delay
-
- WIFI_REG(0x8168)=0;
-
- i=Wifi_BBRead(1);
- Wifi_BBWrite(1,i&0x7f);
- Wifi_BBWrite(1,i);
-
- swiDelay( 335544 ); // 40ms delay
-
- Wifi_RFInit();
-}
-void Wifi_Shutdown() {
- int a;
- if(ReadFlashByte(0x40)==2) {
- Wifi_RFWrite(0xC008);
- }
- a=Wifi_BBRead(0x1E);
- Wifi_BBWrite(0x1E,a|0x3F);
- WIFI_REG(0x168)=0x800D;
- WIFI_REG(0x36)=1;
-}
-
-
-void Wifi_CopyMacAddr(volatile void * dest, volatile void * src) {
- ((u16 *)dest)[0]=((u16 *)src)[0];
- ((u16 *)dest)[1]=((u16 *)src)[1];
- ((u16 *)dest)[2]=((u16 *)src)[2];
-}
-
-int Wifi_CmpMacAddr(volatile void * mac1,volatile void * mac2) {
- return (((u16 *)mac1)[0]==((u16 *)mac2)[0]) && (((u16 *)mac1)[1]==((u16 *)mac2)[1]) && (((u16 *)mac1)[2]==((u16 *)mac2)[2]);
-}
-
-//////////////////////////////////////////////////////////////////////////
-//
-// MAC Copy functions
-//
-
-u16 inline Wifi_MACRead(u32 MAC_Base, u32 MAC_Offset) {
- MAC_Base += MAC_Offset;
- if(MAC_Base>=(WIFI_REG(0x52)&0x1FFE)) MAC_Base -= ((WIFI_REG(0x52)&0x1FFE)-(WIFI_REG(0x50)&0x1FFE));
- return WIFI_REG(0x4000+MAC_Base);
-}
-
-void Wifi_MACCopy(u16 * dest, u32 MAC_Base, u32 MAC_Offset, u32 length) {
- int endrange,subval;
- int thislength;
- endrange = (WIFI_REG(0x52)&0x1FFE);
- subval=((WIFI_REG(0x52)&0x1FFE)-(WIFI_REG(0x50)&0x1FFE));
- MAC_Base += MAC_Offset;
- if(MAC_Base>=endrange) MAC_Base -= subval;
- while(length>0) {
- thislength=length;
- if(thislength>(endrange-MAC_Base)) thislength=endrange-MAC_Base;
- length-=thislength;
- while(thislength>0) {
- *(dest++) = WIFI_REG(0x4000+MAC_Base);
- MAC_Base+=2;
- thislength-=2;
- }
- MAC_Base-=subval;
- }
-}
-
-void Wifi_MACWrite(u16 * src, u32 MAC_Base, u32 MAC_Offset, u32 length) {
- int endrange,subval;
- int thislength;
- endrange = (WIFI_REG(0x52)&0x1FFE);
- subval=((WIFI_REG(0x52)&0x1FFE)-(WIFI_REG(0x50)&0x1FFE));
- MAC_Base += MAC_Offset;
- if(MAC_Base>=endrange) MAC_Base -= subval;
- while(length>0) {
- thislength=length;
- if(length>(endrange-MAC_Base)) length=endrange-MAC_Base;
- length-=thislength;
- while(thislength>0) {
- WIFI_REG(0x4000+MAC_Base) = *(src++);
- MAC_Base+=2;
- thislength-=2;
- }
- MAC_Base-=subval;
- }
-}
-int Wifi_QueueRxMacData(u32 base, u32 len) {
- int buflen, temp,macofs, tempout;
- macofs=0;
- buflen=(WifiData->rxbufIn-WifiData->rxbufOut-1)*2;
- if(buflen<0) buflen += WIFI_RXBUFFER_SIZE;
- if(buflen<len) { WifiData->stats[WSTAT_RXQUEUEDLOST]++; return 0; }
- WifiData->stats[WSTAT_RXQUEUEDPACKETS]++;
- WifiData->stats[WSTAT_RXQUEUEDBYTES]+=len;
- temp=WIFI_RXBUFFER_SIZE-(WifiData->rxbufOut*2);
- tempout=WifiData->rxbufOut;
- if(len>temp) {
- Wifi_MACCopy((u16*)WifiData->rxbufData+tempout,base,macofs,temp);
- macofs+=temp;
- len-=temp;
- tempout=0;
- }
- Wifi_MACCopy((u16*)WifiData->rxbufData+tempout,base,macofs,len);
- tempout+=len/2;
- if(tempout>=(WIFI_RXBUFFER_SIZE/2)) tempout-=(WIFI_RXBUFFER_SIZE/2);
- WifiData->rxbufOut=tempout;
- if(synchandler) synchandler();
- return 1;
-}
-
-int Wifi_CheckTxBuf(s32 offset) {
- offset+=WifiData->txbufIn;
- if(offset>=WIFI_TXBUFFER_SIZE/2) offset-=WIFI_TXBUFFER_SIZE/2;
- return WifiData->txbufData[offset];
-}
-
-// non-wrapping function.
-int Wifi_CopyFirstTxData(s32 macbase) {
- int seglen, readbase,max, packetlen,length;
- packetlen=Wifi_CheckTxBuf(5);
- readbase=WifiData->txbufIn;
- length = (packetlen+12-4+1)/2;
- max=WifiData->txbufOut-WifiData->txbufIn;
- if(max<0) max+=WIFI_TXBUFFER_SIZE/2;
- if(max<length) return 0;
- while(length>0) {
- seglen=length;
- if(readbase+seglen>WIFI_TXBUFFER_SIZE/2) seglen=WIFI_TXBUFFER_SIZE/2-readbase;
- length-=seglen;
- while(seglen--) { WIFI_REG(0x4000+macbase)=WifiData->txbufData[readbase++]; macbase+=2; }
- if(readbase>=WIFI_TXBUFFER_SIZE/2) readbase-=WIFI_TXBUFFER_SIZE/2;
- }
- WifiData->txbufIn=readbase;
-
- WifiData->stats[WSTAT_TXPACKETS]++;
- WifiData->stats[WSTAT_TXBYTES]+=packetlen+12-4;
- WifiData->stats[WSTAT_TXDATABYTES]+=packetlen-4;
-
- return packetlen;
-}
-
-
-
-u16 arm7q[1024];
-u16 arm7qlen = 0;
-
-void Wifi_TxRaw(u16 * data, int datalen) {
- datalen = (datalen+3)&(~3);
- Wifi_MACWrite(data, 0, 0, datalen);
-// WIFI_REG(0xB8)=0x0001;
- WIFI_REG(0xA8)=0x8000;
- WifiData->stats[WSTAT_TXPACKETS]++;
- WifiData->stats[WSTAT_TXBYTES]+=datalen;
- WifiData->stats[WSTAT_TXDATABYTES]+=datalen-12;
-}
-
-int Wifi_TxCheck(void) {
- if(WIFI_REG(0xA8)&0x8000) return 0;
- return 1;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-//
-// Wifi Interrupts
-//
-
-void Wifi_Intr_RxEnd(void) {
- int base;
- int packetlen;
- int full_packetlen;
- int cut, temp;
- int tIME;
- tIME=REG_IME;
- REG_IME=0;
- cut=0;
-
- while(WIFI_REG(0x54)!=WIFI_REG(0x5A)) {
- base = WIFI_REG(0x5A)<<1;
- packetlen=Wifi_MACRead(base,8);
- full_packetlen=12+((packetlen+3)&(~3));
- WifiData->stats[WSTAT_RXPACKETS]++;
- WifiData->stats[WSTAT_RXBYTES]+=full_packetlen;
- WifiData->stats[WSTAT_RXDATABYTES]+=full_packetlen-12;
-
-
- // process packet here
- temp=Wifi_ProcessReceivedFrame(base,full_packetlen); // returns packet type
- if(temp&WifiData->reqPacketFlags || WifiData->reqReqFlags&WFLAG_REQ_PROMISC) { // if packet type is requested, forward it to the rx queue
- keepalive_time=0;
- if(!Wifi_QueueRxMacData(base,full_packetlen)) {
- // failed, ignore for now.
- }
- }
-
- base += full_packetlen;
- if(base>=(WIFI_REG(0x52)&0x1FFE)) base -= ((WIFI_REG(0x52)&0x1FFE)-(WIFI_REG(0x50)&0x1FFE));
- WIFI_REG(0x5A)=base>>1;
-
- if(cut++>5) break;
- }
- REG_IME=tIME;
-}
-
-#define CNT_STAT_START WSTAT_HW_1B0
-#define CNT_STAT_NUM 18
-u16 count_ofs_list[CNT_STAT_NUM] = {
- 0x1B0, 0x1B2, 0x1B4, 0x1B6, 0x1B8, 0x1BA, 0x1BC, 0x1BE, 0x1C0, 0x1C4, 0x1D0, 0x1D2, 0x1D4, 0x1D6, 0x1D8, 0x1DA, 0x1DC, 0x1DE
-};
-void Wifi_Intr_CntOverflow(void) {
- int i;
- int s,d;
- s=CNT_STAT_START;
- for(i=0;i<CNT_STAT_NUM;i++) {
- d=WIFI_REG(count_ofs_list[i]);
- WifiData->stats[s++]+=(d&0xFF);
- WifiData->stats[s++]+=((d>>8)&0xFF);
- }
-}
-
-void Wifi_Intr_StartTx(void) {
- if(WifiData->reqReqFlags&WFLAG_REQ_PROMISC) { // attempt to ensure packet is received
-
- }
-}
-
-void Wifi_Intr_TxEnd(void) { // assume that we can now tx something new.
- if(arm7qlen) {
- Wifi_TxRaw(arm7q, arm7qlen);
- keepalive_time=0;
- arm7qlen=0;
- return;
- }
- if((WifiData->txbufOut!=WifiData->txbufIn) && (!(WifiData->curReqFlags&WFLAG_REQ_APCONNECT) || WifiData->authlevel==WIFI_AUTHLEVEL_ASSOCIATED)) {
- if(Wifi_CopyFirstTxData(0)) {
- keepalive_time=0;
- if(WIFI_REG(0x4008)==0) { WIFI_REG(0x4008)=WifiData->maxrate7; } // if rate dne, fill it in.
- if(WIFI_REG(0x400C)&0x4000) { // wep is enabled, fill in the IV.
- WIFI_REG(0x4024) = (W_RANDOM ^ (W_RANDOM<<7) ^ (W_RANDOM<<15))&0xFFFF;
- WIFI_REG(0x4026) = ((W_RANDOM ^ (W_RANDOM>>7))&0xFF) | (WifiData->wepkeyid7<<14);
- }
- // WIFI_REG(0xB8)=0x0001;
- WIFI_REG(0xA8)=0x8000;
- WIFI_REG(0xAE)=0x000D;
- }
- }
-}
-
-void Wifi_Intr_TBTT(void) {
- if(WIFI_REG(0xA8)&0x8000) {
- WIFI_REG(0xAE)=0x000D;
- }
-}
-
-void Wifi_Intr_DoNothing(void) {
-}
-
-
-
-void Wifi_Interrupt(void) {
- int wIF;
- if(!WifiData) return;
- if(!(WifiData->flags7&WFLAG_ARM7_RUNNING)) return;
- do {
- REG_IF=0x01000000; // now that we've cleared the wireless IF, kill the bit in regular IF.
- wIF= W_IE & W_IF;
- if(wIF& 0x0001) { W_IF=0x0001; Wifi_Intr_RxEnd(); } // 0) Rx End
- if(wIF& 0x0002) { W_IF=0x0002; Wifi_Intr_TxEnd(); } // 1) Tx End
- if(wIF& 0x0004) { W_IF=0x0004; Wifi_Intr_DoNothing(); } // 2) Rx Cntup
- if(wIF& 0x0008) { W_IF=0x0008; Wifi_Intr_DoNothing(); } // 3) Tx Err
- if(wIF& 0x0010) { W_IF=0x0010; Wifi_Intr_CntOverflow(); } // 4) Count Overflow
- if(wIF& 0x0020) { W_IF=0x0020; Wifi_Intr_CntOverflow(); } // 5) AckCount Overflow
- if(wIF& 0x0040) { W_IF=0x0040; Wifi_Intr_DoNothing(); } // 6) Start Rx
- if(wIF& 0x0080) { W_IF=0x0080; Wifi_Intr_StartTx(); } // 7) Start Tx
- if(wIF& 0x0100) { W_IF=0x0100; Wifi_Intr_DoNothing(); } // 8)
- if(wIF& 0x0200) { W_IF=0x0200; Wifi_Intr_DoNothing(); } // 9)
- if(wIF& 0x0400) { W_IF=0x0400; Wifi_Intr_DoNothing(); } //10)
- if(wIF& 0x0800) { W_IF=0x0800; Wifi_Intr_DoNothing(); } //11) RF Wakeup
- if(wIF& 0x1000) { W_IF=0x1000; Wifi_Intr_DoNothing(); } //12) MP End
- if(wIF& 0x2000) { W_IF=0x2000; Wifi_Intr_DoNothing(); } //13) ACT End
- if(wIF& 0x4000) { W_IF=0x4000; Wifi_Intr_TBTT(); } //14) TBTT
- if(wIF& 0x8000) { W_IF=0x8000; Wifi_Intr_DoNothing(); } //15) PreTBTT
- wIF= W_IE & W_IF;
- } while(wIF);
-
-}
-
-
-
-
-
-
-void Wifi_Update(void) {
- int i;
- if(!WifiData) return;
- WifiData->random ^=(W_RANDOM ^ (W_RANDOM<<11) ^ (W_RANDOM<<22));
- WifiData->stats[WSTAT_ARM7_UPDATES]++;
- WifiData->stats[WSTAT_DEBUG]=WIFI_REG(0xA8);
- if(WIFI_REG(0xA8)&0x8000) {
- WIFI_REG(0xAE)=0x000D;
- }
- // check flags, to see if we need to change anything
- switch(WifiData->curMode) {
- case WIFIMODE_DISABLED:
- ProxySetLedState(LED_ON);
- if(WifiData->reqMode!=WIFIMODE_DISABLED) {
- Wifi_Start();
- WifiData->curMode=WIFIMODE_NORMAL;
- }
- break;
- case WIFIMODE_NORMAL: // main switcher function
- ProxySetLedState(LED_LONGBLINK);
- if(WifiData->reqMode==WIFIMODE_DISABLED) {
- Wifi_Stop();
- WifiData->curMode=WIFIMODE_DISABLED;
- break;
- }
- if(WifiData->reqMode==WIFIMODE_SCAN) {
- WifiData->counter7=WIFI_REG(0xFA); // timer hword 2 (each tick is 65.5ms)
- WifiData->curMode=WIFIMODE_SCAN;
- break;
- }
- if((WifiData->reqReqFlags ^ WifiData->curReqFlags) & WFLAG_REQ_APCONNECT) {
- if(WifiData->curReqFlags& WFLAG_REQ_APCONNECT) { // already connected; disconnect
- WifiData->curReqFlags &=~WFLAG_REQ_APCONNECT;
- } else { // not connected - connect!
- if(WifiData->reqReqFlags&WFLAG_REQ_APCOPYVALUES) {
- WifiData->wepkeyid7=WifiData->wepkeyid9;
- WifiData->wepmode7=WifiData->wepmode9;
- WifiData->apchannel7=WifiData->apchannel9;
- Wifi_CopyMacAddr(WifiData->bssid7,WifiData->bssid9);
- Wifi_CopyMacAddr(WifiData->apmac7,WifiData->apmac9);
- for(i=0;i<20;i++) WifiData->wepkey7[i]=WifiData->wepkey9[i];
- for(i=0;i<34;i++) WifiData->ssid7[i]=WifiData->ssid9[i];
- for(i=0;i<16;i++) WifiData->baserates7[i]=WifiData->baserates9[i];
- if(WifiData->reqReqFlags&WFLAG_REQ_APADHOC) WifiData->curReqFlags |= WFLAG_REQ_APADHOC; else WifiData->curReqFlags &= ~WFLAG_REQ_APADHOC;
- }
- Wifi_SetWepKey((void *)WifiData->wepkey7);
- Wifi_SetWepMode(WifiData->wepmode7);
- // latch BSSID
- W_BSSID[0]= ((u16 *)WifiData->bssid7)[0];
- W_BSSID[1]= ((u16 *)WifiData->bssid7)[1];
- W_BSSID[2]= ((u16 *)WifiData->bssid7)[2];
- //WIFI_REG(0xD0) &= ~0x0400;
- WIFI_REG(0xD0) |= 0x0400;
- WifiData->reqChannel=WifiData->apchannel7;
- Wifi_SetChannel(WifiData->apchannel7);
- if(WifiData->curReqFlags&WFLAG_REQ_APADHOC) {
- WifiData->authlevel=WIFI_AUTHLEVEL_ASSOCIATED;
- } else {
- Wifi_SendOpenSystemAuthPacket();
- WifiData->authlevel=WIFI_AUTHLEVEL_DISCONNECTED;
- }
- WifiData->txbufIn=WifiData->txbufOut; // empty tx buffer.
- WifiData->curReqFlags |= WFLAG_REQ_APCONNECT;
- WifiData->counter7=WIFI_REG(0xFA); // timer hword 2 (each tick is 65.5ms)
- WifiData->curMode=WIFIMODE_ASSOCIATE;
- WifiData->authctr=0;
- }
- }
- break;
- case WIFIMODE_SCAN:
- ProxySetLedState(LED_LONGBLINK);
- if(WifiData->reqMode!=WIFIMODE_SCAN) {
- WifiData->curMode=WIFIMODE_NORMAL;
- break;
- }
- if(((u16)(WIFI_REG(0xFA)-WifiData->counter7))>6) { // jump ship!
- WifiData->counter7=WIFI_REG(0xFA);
- WifiData->reqChannel++;
- {
- int i;
- for(i=0;i<WIFI_MAX_AP;i++) {
- if(WifiData->aplist[i].flags & WFLAG_APDATA_ACTIVE) {
- WifiData->aplist[i].timectr++;
- if(WifiData->aplist[i].timectr>WIFI_AP_TIMEOUT) {
- WifiData->aplist[i].rssi=0;
- WifiData->aplist[i].rssi_past[0]=WifiData->aplist[i].rssi_past[1]=
- WifiData->aplist[i].rssi_past[2]=WifiData->aplist[i].rssi_past[3]=
- WifiData->aplist[i].rssi_past[4]=WifiData->aplist[i].rssi_past[5]=
- WifiData->aplist[i].rssi_past[6]=WifiData->aplist[i].rssi_past[7]=0; // update rssi later.
- }
- }
- }
- }
- if(WifiData->reqChannel==14) WifiData->reqChannel=1;
- }
- break;
- case WIFIMODE_ASSOCIATE:
- ProxySetLedState(LED_LONGBLINK);
- if(WifiData->authlevel==WIFI_AUTHLEVEL_ASSOCIATED) {
- WifiData->curMode=WIFIMODE_ASSOCIATED;
- break;
- }
- if(((u16)(WIFI_REG(0xFA)-WifiData->counter7))>20) { // ~1 second, reattempt connect stage
- WifiData->counter7=WIFI_REG(0xFA);
- WifiData->authctr++;
- if(WifiData->authctr>WIFI_MAX_ASSOC_RETRY) {
- WifiData->curMode=WIFIMODE_CANNOTASSOCIATE;
- break;
- }
- switch(WifiData->authlevel) {
- case WIFI_AUTHLEVEL_DISCONNECTED: // send auth packet
- if(!(WifiData->curReqFlags&WFLAG_REQ_APADHOC)) {
- Wifi_SendOpenSystemAuthPacket();
- break;
- }
- WifiData->authlevel=WIFI_AUTHLEVEL_ASSOCIATED;
- break;
- case WIFI_AUTHLEVEL_DEASSOCIATED:
- case WIFI_AUTHLEVEL_AUTHENTICATED: // send assoc packet
- Wifi_SendAssocPacket();
- break;
- case WIFI_AUTHLEVEL_ASSOCIATED:
- WifiData->curMode=WIFIMODE_ASSOCIATED;
- break;
- }
- }
- if(!(WifiData->reqReqFlags & WFLAG_REQ_APCONNECT)) {
- WifiData->curReqFlags &=~WFLAG_REQ_APCONNECT;
- WifiData->curMode=WIFIMODE_NORMAL;
- break;
- }
- break;
- case WIFIMODE_ASSOCIATED:
- ProxySetLedState(LED_SHORTBLINK);
- keepalive_time++;
- if(keepalive_time>WIFI_KEEPALIVE_COUNT) {
- keepalive_time=0;
- Wifi_SendNullFrame();
- }
- if((u16)(WIFI_REG(0xFA)-WifiData->pspoll_period)>WIFI_PS_POLL_CONST) {
- WifiData->pspoll_period=WIFI_REG(0xFA);
- // Wifi_SendPSPollFrame();
- }
- if(!(WifiData->reqReqFlags & WFLAG_REQ_APCONNECT)) {
- W_BSSID[0]= ((u16 *)WifiData->bssid7)[0];
- W_BSSID[1]= ((u16 *)WifiData->bssid7)[1];
- W_BSSID[2]= ((u16 *)WifiData->bssid7)[2];
- //WIFI_REG(0xD0) &= ~0x0400;
- WifiData->curMode=WIFIMODE_NORMAL;
- WifiData->authlevel=WIFI_AUTHLEVEL_DISCONNECTED;
- if(WifiData->curReqFlags &WFLAG_REQ_APCONNECT) { // deassociate, then return
- WifiData->curReqFlags &=~WFLAG_REQ_APCONNECT;
- } else { // not connected for some reason, return.
- WifiData->curReqFlags &=~WFLAG_REQ_APCONNECT;
- WifiData->curMode=WIFIMODE_ASSOCIATE;
- }
- break;
- }
- if(WifiData->authlevel!=WIFI_AUTHLEVEL_ASSOCIATED) {
- WifiData->curMode=WIFIMODE_ASSOCIATE;
- break;
- }
- break;
- case WIFIMODE_CANNOTASSOCIATE:
- ProxySetLedState(LED_LONGBLINK);
- if(!(WifiData->reqReqFlags & WFLAG_REQ_APCONNECT)) {
- WifiData->curReqFlags &=~WFLAG_REQ_APCONNECT;
- WifiData->curMode=WIFIMODE_NORMAL;
- break;
- }
- break;
-
-
- }
- if(WifiData->curChannel!=WifiData->reqChannel) {
- Wifi_SetChannel(WifiData->reqChannel);
- }
- // check Rx
- Wifi_Intr_RxEnd();
- // check if we need to tx anything
- if(Wifi_TxCheck()) Wifi_Intr_TxEnd(); // easiest way to do so at the moment.
-}
-
-
-
-
-//////////////////////////////////////////////////////////////////////////
-//
-// Wifi User-called Functions
-//
-void erasemem(void * mem, int length) {
- int i;
- char * m = (char *)mem;
- for(i=0;i<length;i++)
- m[i]=0;
-}
-
-
-void Wifi_Init(u32 wifidata) {
- WifiData = (Wifi_MainStruct *)wifidata;
-
- POWERCNT7 |= 2; // enable power for the wifi
- *((volatile u16 *)0x04000206) = 0x30; // ???
-
- InitFlashData();
-
- // reset/shutdown wifi:
- WIFI_REG(0x4)=0xffff;
- Wifi_Stop();
- Wifi_Shutdown(); // power off wifi
-
- WifiData->curChannel=1;
- WifiData->reqChannel=1;
- WifiData->curMode=WIFIMODE_DISABLED;
- WifiData->reqMode=WIFIMODE_DISABLED;
- WifiData->reqPacketFlags=WFLAG_PACKET_ALL & (~WFLAG_PACKET_BEACON);
- WifiData->curReqFlags=0;
- WifiData->reqReqFlags=0;
- WifiData->maxrate7=0x0A;
-
- int i;
- for(i=0x4000;i<0x6000;i+=2) WIFI_REG(i)=0;
-
-
- // load in the WFC data.
- GetWfcSettings();
-
- for(i=0;i<6;i++) WifiData->MacAddr[i]=ReadFlashByte(0x36+i);
-
- W_IE=0;
- Wifi_WakeUp();
-
- Wifi_MacInit();
- Wifi_RFInit();
- Wifi_BBInit();
-
- // Set Default Settings
- W_MACADDR[0]=((u16 *)WifiData->MacAddr)[0];
- W_MACADDR[1]=((u16 *)WifiData->MacAddr)[1];
- W_MACADDR[2]=((u16 *)WifiData->MacAddr)[2];
-
- W_RETRLIMIT=7;
- Wifi_SetMode(2);
- Wifi_SetWepMode(WEPMODE_NONE);
-
-
- Wifi_SetChannel(1);
-
- Wifi_BBWrite(0x13, 0x00);
- Wifi_BBWrite(0x35, 0x1F);
-
-// Wifi_Shutdown();
- WifiData->random ^=(W_RANDOM ^ (W_RANDOM<<11) ^ (W_RANDOM<<22));
-
- WifiData->flags7 |= WFLAG_ARM7_ACTIVE;
-}
-
-void Wifi_Deinit() {
- Wifi_Stop();
- POWERCNT7 &= ~2;
-}
-
-void Wifi_Start() {
- int i, tIME;
- tIME=REG_IME;
- REG_IME=0;
- Wifi_Stop();
-
-// Wifi_WakeUp();
-
- WIFI_REG(0x8032) = 0x8000;
- WIFI_REG(0x8134) = 0xFFFF;
- WIFI_REG(0x802A) = 0;
- W_AIDS = 0;
- WIFI_REG(0x80E8) = 1;
- WIFI_REG(0x8038) = 0x0000;
- WIFI_REG(0x20) = 0x0000;
- WIFI_REG(0x22) = 0x0000;
- WIFI_REG(0x24) = 0x0000;
-
- Wifi_TxSetup();
- Wifi_RxSetup();
-
- WIFI_REG(0x8030) = 0x8000;
-/*
- switch(WIFI_REG(0x8006)&7) {
- case 0: // infrastructure mode?
- W_IF=0xFFFF;
- W_IE=0x003F;
- WIFI_REG(0x81AE)=0x1fff;
- //WIFI_REG(0x81AA)=0x0400;
- WIFI_REG(0x80D0)=0xffff;
- WIFI_REG(0x80E0)=0x0008;
- WIFI_REG(0x8008)=0;
- WIFI_REG(0x800A)=0;
- WIFI_REG(0x80E8)=0;
- WIFI_REG(0x8004)=1;
- //SetStaState(0x40);
- break;
- case 1: // ad-hoc mode? -- beacons are required to be created!
- W_IF=0xFFF;
- W_IE=0x703F;
- WIFI_REG(0x81AE)=0x1fff;
- WIFI_REG(0x81AA)=0; // 0x400
- WIFI_REG(0x80D0)=0x0301;
- WIFI_REG(0x80E0)=0x000D;
- WIFI_REG(0x8008)=0xE000;
- WIFI_REG(0x800A)=0;
- WIFI_REG(0x8004)=1;
- //??
- WIFI_REG(0x80EA)=1;
- WIFI_REG(0x80AE)=2;
- break;
- case 2: // DS comms mode?
- */
- W_IF=0xFFFF;
- //W_IE=0xE03F;
- W_IE=0x40B3;
- WIFI_REG(0x81AE)=0x1fff;
- WIFI_REG(0x81AA)=0; //0x68
- W_BSSID[0]=0xFFFF;
- W_BSSID[1]=0xFFFF;
- W_BSSID[2]=0xFFFF;
- WIFI_REG(0x80D0)=0x0181; // 0x181
- WIFI_REG(0x80E0)=0x000B;
- WIFI_REG(0x8008)=0;
- WIFI_REG(0x800A)=0;
- WIFI_REG(0x8004)=1;
- WIFI_REG(0x80E8)=1;
- WIFI_REG(0x80EA)=1;
- //SetStaState(0x20);
- /*
- break;
- case 3:
- case 4:
- break;
- }
- */
-
- WIFI_REG(0x8048)=0x0000;
- Wifi_DisableTempPowerSave();
- //WIFI_REG(0x80AE)=0x0002;
- W_POWERSTATE |= 2;
- WIFI_REG(0xAC) = 0xFFFF;
- i=0xFA0;
- while(i!=0 && !(WIFI_REG(0x819C)&0x80)) i--;
- WifiData->flags7 |=WFLAG_ARM7_RUNNING;
- REG_IME=tIME;
-}
-
-void Wifi_Stop() {
- int tIME;
- tIME=REG_IME;
- WifiData->flags7 &= ~WFLAG_ARM7_RUNNING;
- W_IE=0;
- WIFI_REG(0x8004) = 0;
- WIFI_REG(0x80EA) = 0;
- WIFI_REG(0x80E8) = 0;
- WIFI_REG(0x8008) = 0;
- WIFI_REG(0x800A) = 0;
-
- WIFI_REG(0x80AC) = 0xFFFF;
- WIFI_REG(0x80B4) = 0xFFFF;
-// Wifi_Shutdown();
- REG_IME=tIME;
-}
-
-void Wifi_SetChannel(int channel) {
- int i,n,l;
- if(channel<1 || channel>13) return;
- channel-=1;
-
- switch(ReadFlashByte(0x40)) {
- case 2:
- case 5:
- Wifi_RFWrite(ReadFlashBytes(0xf2+channel*6,3));
- Wifi_RFWrite(ReadFlashBytes(0xf5+channel*6,3));
-
- swiDelay( 12583 ); // 1500 us delay
-
- if(chdata_save5 & 0x10000)
- {
- if(chdata_save5 & 0x8000) break;
- n = ReadFlashByte(0x154+channel);
- Wifi_RFWrite( chdata_save5 | ((n&0x1F)<<10) );
- } else {
- Wifi_BBWrite(0x1E, ReadFlashByte(0x146+channel));
- }
-
- break;
- case 3:
- n=ReadFlashByte(0x42);
- n+=0xCF;
- l=ReadFlashByte(n-1);
- for(i=0;i<l;i++) {
- Wifi_BBWrite(ReadFlashByte(n),ReadFlashByte(n+channel+1));
- n+=15;
- }
- for(i=0;i<ReadFlashByte(0x43);i++) {
- Wifi_RFWrite( (ReadFlashByte(n)<<8) | ReadFlashByte(n+channel+1) | 0x050000 );
- n+=15;
- }
-
- swiDelay( 12583 ); // 1500 us delay
-
- break;
- default:
- break;
- }
- WifiData->curChannel=channel+1;
-}
-void Wifi_SetWepKey(void * wepkey) {
- int i;
- for(i=0;i<16;i++) {
- W_WEPKEY0[i]=((u16 *)wepkey)[i];
- W_WEPKEY1[i]=((u16 *)wepkey)[i];
- W_WEPKEY2[i]=((u16 *)wepkey)[i];
- W_WEPKEY3[i]=((u16 *)wepkey)[i];
- }
-}
-
-void Wifi_SetWepMode(int wepmode) {
- if(wepmode<0 || wepmode>7) return;
- if(wepmode==0) {
- WIFI_REG(0x32)=0x0000;
- } else {
- WIFI_REG(0x32)=0x8000;
- }
- if(wepmode==0) wepmode=1;
- W_MODE_WEP = (W_MODE_WEP & 0xFFC7) | (wepmode<<3);
-}
-
-void Wifi_SetBeaconPeriod(int beacon_period) {
- if(beacon_period<0x10 || beacon_period>0x3E7) return;
- WIFI_REG(0x8C)=beacon_period;
-}
-
-void Wifi_SetMode(int wifimode) {
- if(wifimode>3 || wifimode<0) return;
- W_MODE_WEP = (W_MODE_WEP& 0xfff8) | wifimode;
-}
-void Wifi_SetPreambleType(int preamble_type) {
- if(preamble_type>1 || preamble_type<0) return;
- WIFI_REG(0x80BC) = (WIFI_REG(0x80BC) & 0xFFBF) | (preamble_type<<6);
-}
-void Wifi_DisableTempPowerSave() {
- WIFI_REG(0x8038) &= ~2;
- WIFI_REG(0x8048) = 0;
-}
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////
-//
-// 802.11b system, tied in a bit with the :
-
-
-int Wifi_TxQueue(u16 * data, int datalen) {
- int i,j;
- if(arm7qlen) {
- if(Wifi_TxCheck()) {
- Wifi_TxRaw(arm7q,arm7qlen);
- arm7qlen=0;
- j=(datalen+1)>>1;
- if(j>1024) return 0;
- for(i=0;i<j;i++) arm7q[i]=data[i];
- arm7qlen=datalen;
- return 1;
- }
- return 0;
- }
- if(Wifi_TxCheck()) {
- Wifi_TxRaw(data,datalen);
- return 1;
- }
- arm7qlen=0;
- j=(datalen+1)>>1;
- if(j>1024) return 0;
- for(i=0;i<j;i++) arm7q[i]=data[i];
- arm7qlen=datalen;
- return 1;
-}
-
-int Wifi_GenMgtHeader(u8 * data, u16 headerflags) {
- // tx header
- ((u16 *)data)[0]=0;
- ((u16 *)data)[1]=0;
- ((u16 *)data)[2]=0;
- ((u16 *)data)[3]=0;
- ((u16 *)data)[4]=0;
- ((u16 *)data)[5]=0;
- // fill in most header fields
- ((u16 *)data)[7]=0x0000;
- Wifi_CopyMacAddr(data+16,WifiData->apmac7);
- Wifi_CopyMacAddr(data+22,WifiData->MacAddr);
- Wifi_CopyMacAddr(data+28,WifiData->bssid7);
- ((u16 *)data)[17]=0;
-
- // fill in wep-specific stuff
- if(headerflags&0x4000) {
- ((u32 *)data)[9]=((W_RANDOM ^ (W_RANDOM<<7) ^ (W_RANDOM<<15))&0x0FFF) | (WifiData->wepkeyid7<<30); // I'm lazy and certainly haven't done this to spec.
- ((u16 *)data)[6]=headerflags;
- return 28+12;
- } else {
- ((u16 *)data)[6]=headerflags;
- return 24+12;
- }
-}
-
-int Wifi_SendOpenSystemAuthPacket() {
- // max size is 12+24+4+6 = 46
- u8 data[64];
- int i;
- i=Wifi_GenMgtHeader(data,0x00B0);
-
- ((u16 *)(data+i))[0]=0; // Authentication algorithm number (0=open system)
- ((u16 *)(data+i))[1]=1; // Authentication sequence number
- ((u16 *)(data+i))[2]=0; // Authentication status code (reserved for this message, =0)
-
- ((u16 *)data)[4]=0x000A;
- ((u16 *)data)[5]=i+6-12+4;
-
- return Wifi_TxQueue((u16 *)data, i+6);
-}
-
-int Wifi_SendSharedKeyAuthPacket(void) {
- // max size is 12+24+4+6 = 46
- u8 data[64];
- int i;
- i=Wifi_GenMgtHeader(data,0x00B0);
-
- ((u16 *)(data+i))[0]=1; // Authentication algorithm number (1=shared key)
- ((u16 *)(data+i))[1]=1; // Authentication sequence number
- ((u16 *)(data+i))[2]=0; // Authentication status code (reserved for this message, =0)
-
- ((u16 *)data)[4]=0x000A;
- ((u16 *)data)[5]=i+6-12+4;
-
- return Wifi_TxQueue((u16 *)data, i+6);
-}
-
-int Wifi_SendSharedKeyAuthPacket2(int challenge_length, u8 * challenge_Text) {
- // max size is 12+24+4+6 = 46
- u8 data[320];
- int i,j;
- i=Wifi_GenMgtHeader(data,0x40B0);
-
- ((u16 *)(data+i))[0]=1; // Authentication algorithm number (1=shared key)
- ((u16 *)(data+i))[1]=3; // Authentication sequence number
- ((u16 *)(data+i))[2]=0; // Authentication status code (reserved for this message, =0)
-
- data[i+6]=0x10; // 16=challenge text block
- data[i+7]=challenge_length;
-
- for(j=0;j<challenge_length;j++) {
- data[i+j+8]=challenge_Text[j];
- }
-
- ((u16 *)data)[4]=0x000A;
- ((u16 *)data)[5]=i+8+challenge_length-12+4 +4;
-
- return Wifi_TxQueue((u16 *)data, i+8+challenge_length);
-}
-
-
-int Wifi_SendAssocPacket() { // uses arm7 data in our struct
- // max size is 12+24+4+34+4 = 66
- u8 data[96];
- int i,j,numrates;
-
- i=Wifi_GenMgtHeader(data,0x0000);
-
- if(WifiData->wepmode7) {
- ((u16 *)(data+i))[0]=0x0031; // CAPS info
- } else {
- ((u16 *)(data+i))[0]=0x0021; // CAPS info
- }
-
- ((u16 *)(data+i))[1]=WIFI_REG(0x8E); // Listen interval
- i+=4;
- data[i++]=0; // SSID element
- data[i++]=WifiData->ssid7[0];
- for(j=0;j<WifiData->ssid7[0];j++) data[i++]=WifiData->ssid7[1+j];
-
- if((WifiData->baserates7[0]&0x7f)!=2) {
- for(j=1;j<16;j++) WifiData->baserates7[i]=WifiData->baserates7[j-1];
- }
- WifiData->baserates7[0]=0x82;
- if((WifiData->baserates7[1]&0x7f)!=4) {
- for(j=2;j<16;j++) WifiData->baserates7[j]=WifiData->baserates7[j-1];
- }
- WifiData->baserates7[1]=0x04;
-
- WifiData->baserates7[15]=0;
- for(j=0;j<16;j++) if(WifiData->baserates7[j]==0) break;
- numrates=j;
- for(j=2;j<numrates;j++) WifiData->baserates7[j] &= 0x7F;
-
- data[i++]=1; // rate set
- data[i++]=numrates;
- for(j=0;j<numrates;j++) data[i++]=WifiData->baserates7[j];
-
- // reset header fields with needed data
- ((u16 *)data)[4]=0x000A;
- ((u16 *)data)[5]=i-12+4;
-
- return Wifi_TxQueue((u16 *)data, i);
-}
-
-int Wifi_SendNullFrame() {
- // max size is 12+16 = 28
- u8 data[32];
- // tx header
- ((u16 *)data)[0]=0;
- ((u16 *)data)[1]=0;
- ((u16 *)data)[2]=0;
- ((u16 *)data)[3]=0;
- ((u16 *)data)[4]=WifiData->maxrate7;
- ((u16 *)data)[5]=18+4;
- // fill in packet header fields
- ((u16 *)data)[6]=0x0148;
- ((u16 *)data)[7]=0;
- Wifi_CopyMacAddr(data+16,WifiData->apmac7);
- Wifi_CopyMacAddr(data+22,WifiData->MacAddr);
-
- return Wifi_TxQueue((u16 *)data, 30);
-}
-
-int Wifi_SendPSPollFrame() {
- // max size is 12+16 = 28
- u8 data[32];
- // tx header
- ((u16 *)data)[0]=0;
- ((u16 *)data)[1]=0;
- ((u16 *)data)[2]=0;
- ((u16 *)data)[3]=0;
- ((u16 *)data)[4]=WifiData->maxrate7;
- ((u16 *)data)[5]=16+4;
- // fill in packet header fields
- ((u16 *)data)[6]=0x01A4;
- ((u16 *)data)[7]=0xC000 | W_AIDS;
- Wifi_CopyMacAddr(data+16,WifiData->apmac7);
- Wifi_CopyMacAddr(data+22,WifiData->MacAddr);
-
- return Wifi_TxQueue((u16 *)data, 28);
-}
-
-int Wifi_ProcessReceivedFrame(int macbase, int framelen) {
- Wifi_RxHeader packetheader;
- u16 control_802;
- Wifi_MACCopy((u16 *)&packetheader,macbase,0,12);
- control_802=Wifi_MACRead(macbase,12);
- switch((control_802>>2)&0x3F) {
- // Management Frames
- case 0x20: // 1000 00 Beacon
- case 0x14: // 0101 00 Probe Response // process probe responses too.
- // mine data from the beacon...
- {
- u8 data[512];
- u8 wepmode,fromsta;
- u8 segtype,seglen;
- u8 channel;
- u8 wpamode;
- u8 rateset[16];
- u16 ptr_ssid;
- u16 maxrate;
- u16 curloc;
- u32 datalen;
- u16 i,j,compatible;
- datalen=packetheader.byteLength;
- if(datalen>512) datalen=512;
- Wifi_MACCopy((u16 *)data,macbase,12,(datalen+1)&~1);
- wepmode=0;
- maxrate=0;
- if(((u16 *)data)[5+12]&0x0010) { // capability info, WEP bit
- wepmode=1;
- }
- fromsta=Wifi_CmpMacAddr(data+10, data+16);
- curloc=12+24; // 12 fixed bytes, 24 802.11 header
- compatible=1;
- ptr_ssid=0;
- channel=WifiData->curChannel;
- wpamode=0;
- do {
- if(curloc>=datalen) break;
- segtype=data[curloc++];
- seglen=data[curloc++];
- switch(segtype) {
- case 0: // SSID element
- ptr_ssid=curloc-2;
- break;
- case 1: // rate set (make sure we're compatible)
- compatible=0;
- maxrate=0;
- j=0;
- for(i=0;i<seglen;i++) {
- if((data[curloc+i]&0x7F)>maxrate) maxrate=data[curloc+i]&0x7F;
- if(j<15 && data[curloc+i]&0x80) rateset[j++]=data[curloc+i];
- }
- for(i=0;i<seglen;i++) {
- if(data[curloc+i]==0x82 || data[curloc+i]==0x84) compatible=1; // 1-2mbit, fully compatible
- else if(data[curloc+i]==0x8B || data[curloc+i]==0x96) compatible=2; // 5.5,11mbit, have to fake our way in.
- else if(data[curloc+i]&0x80) { compatible=0; break; }
- }
- rateset[j]=0;
- break;
- case 3: // DS set (current channel)
- channel=data[curloc];
- break;
- case 48: // RSN(A) field- WPA enabled.
- wpamode=1;
- break;
-
- } // don't care about the others.
- curloc+=seglen;
- } while(curloc<datalen);
- if(wpamode==1) compatible=0;
- if(1) {
- seglen=0;
- segtype=255;
- for(i=0;i<WIFI_MAX_AP;i++) {
- if( Wifi_CmpMacAddr(WifiData->aplist[i].bssid,data+16)) {
- seglen++;
- if(Spinlock_Acquire(WifiData->aplist[i])==SPINLOCK_OK) {
- WifiData->aplist[i].timectr=0;
- WifiData->aplist[i].flags=WFLAG_APDATA_ACTIVE | (wepmode?WFLAG_APDATA_WEP:0) | (fromsta?0:WFLAG_APDATA_ADHOC);
- if(compatible==1) WifiData->aplist[i].flags |= WFLAG_APDATA_COMPATIBLE;
- if(compatible==2) WifiData->aplist[i].flags |= WFLAG_APDATA_EXTCOMPATIBLE;
- if(wpamode==1) WifiData->aplist[i].flags |= WFLAG_APDATA_WPA;
- WifiData->aplist[i].maxrate=maxrate;
-
- Wifi_CopyMacAddr(WifiData->aplist[i].macaddr,data+10); // src: +10
- if(ptr_ssid) {
- WifiData->aplist[i].ssid_len=data[ptr_ssid+1];
- if(WifiData->aplist[i].ssid_len>32) WifiData->aplist[i].ssid_len=32;
- for(j=0;j<WifiData->aplist[i].ssid_len;j++) {
- WifiData->aplist[i].ssid[j]=data[ptr_ssid+2+j];
- }
- WifiData->aplist[i].ssid[j]=0;
- }
- if(WifiData->curChannel==channel) { // only use RSSI when we're on the right channel
- if(WifiData->aplist[i].rssi_past[0]==0) { // min rssi is 2, heh.
- WifiData->aplist[i].rssi_past[0]=WifiData->aplist[i].rssi_past[1]=
- WifiData->aplist[i].rssi_past[2]=WifiData->aplist[i].rssi_past[3]=
- WifiData->aplist[i].rssi_past[4]=WifiData->aplist[i].rssi_past[5]=
- WifiData->aplist[i].rssi_past[6]=WifiData->aplist[i].rssi_past[7]=packetheader.rssi_&255;
- } else {
- for(j=0;j<7;j++) {
- WifiData->aplist[i].rssi_past[j]=WifiData->aplist[i].rssi_past[j+1];
- }
- WifiData->aplist[i].rssi_past[7]=packetheader.rssi_&255;
- }
- }
- WifiData->aplist[i].channel=channel;
- for(j=0;j<16;j++) WifiData->aplist[i].base_rates[j]=rateset[j];
- Spinlock_Release(WifiData->aplist[i]);
- } else {
- // couldn't update beacon - oh well :\ there'll be other beacons.
- }
- } else {
- if(WifiData->aplist[i].flags & WFLAG_APDATA_ACTIVE) {
- // WifiData->aplist[i].timectr++;
- } else {
- if(segtype==255) segtype=i;
- }
- }
- }
- if(seglen==0) { // we couldn't find an existing record
- if(segtype==255) {
- j=0;
- for(i=0;i<WIFI_MAX_AP;i++) {
- if(WifiData->aplist[i].timectr>j) {
- j=WifiData->aplist[i].timectr;
- segtype=i;
- }
- }
- }
- // stuff new data in
- i=segtype;
- if(Spinlock_Acquire(WifiData->aplist[i])==SPINLOCK_OK) {
- Wifi_CopyMacAddr(WifiData->aplist[i].bssid,data+16); // bssid: +16
- Wifi_CopyMacAddr(WifiData->aplist[i].macaddr,data+10); // src: +10
- WifiData->aplist[i].timectr=0;
- WifiData->aplist[i].flags=WFLAG_APDATA_ACTIVE | (wepmode?WFLAG_APDATA_WEP:0) | (fromsta?0:WFLAG_APDATA_ADHOC);
- if(compatible==1) WifiData->aplist[i].flags |= WFLAG_APDATA_COMPATIBLE;
- if(compatible==2) WifiData->aplist[i].flags |= WFLAG_APDATA_EXTCOMPATIBLE;
- if(wpamode==1) WifiData->aplist[i].flags |= WFLAG_APDATA_WPA;
- WifiData->aplist[i].maxrate=maxrate;
-
- if(ptr_ssid) {
- WifiData->aplist[i].ssid_len=data[ptr_ssid+1];
- if(WifiData->aplist[i].ssid_len>32) WifiData->aplist[i].ssid_len=32;
- for(j=0;j<WifiData->aplist[i].ssid_len;j++) {
- WifiData->aplist[i].ssid[j]=data[ptr_ssid+2+j];
- }
- WifiData->aplist[i].ssid[j]=0;
- }
- if(WifiData->curChannel==channel) { // only use RSSI when we're on the right channel
- WifiData->aplist[i].rssi_past[0]=WifiData->aplist[i].rssi_past[1]=
- WifiData->aplist[i].rssi_past[2]=WifiData->aplist[i].rssi_past[3]=
- WifiData->aplist[i].rssi_past[4]=WifiData->aplist[i].rssi_past[5]=
- WifiData->aplist[i].rssi_past[6]=WifiData->aplist[i].rssi_past[7]=packetheader.rssi_&255;
- } else {
- WifiData->aplist[i].rssi_past[0]=WifiData->aplist[i].rssi_past[1]=
- WifiData->aplist[i].rssi_past[2]=WifiData->aplist[i].rssi_past[3]=
- WifiData->aplist[i].rssi_past[4]=WifiData->aplist[i].rssi_past[5]=
- WifiData->aplist[i].rssi_past[6]=WifiData->aplist[i].rssi_past[7]=0; // update rssi later.
- }
- WifiData->aplist[i].channel=channel;
- for(j=0;j<16;j++) WifiData->aplist[i].base_rates[j]=rateset[j];
-
- Spinlock_Release(WifiData->aplist[i]);
- } else {
- // couldn't update beacon - oh well :\ there'll be other beacons.
- }
- }
- }
- }
- if(((control_802>>2)&0x3F)==0x14) return WFLAG_PACKET_MGT;
- return WFLAG_PACKET_BEACON;
- case 0x04: // 0001 00 Assoc Response
- case 0x0C: // 0011 00 Reassoc Response
- // we might have been associated, let's check.
- {
- int datalen,i;
- u8 data[64];
- datalen=packetheader.byteLength;
- if(datalen>64) datalen=64;
- Wifi_MACCopy((u16 *)data,macbase,12,(datalen+1)&~1);
-
- if(Wifi_CmpMacAddr(data+4,WifiData->MacAddr)) { // packet is indeed sent to us.
- if(Wifi_CmpMacAddr(data+16,WifiData->bssid7)) { // packet is indeed from the base station we're trying to associate to.
- if(((u16 *)(data+24))[1]==0) { // status code, 0==success
- W_AIDS=((u16 *)(data+24))[2];
- WIFI_REG(0x2A)=((u16 *)(data+24))[2];
- // set max rate
- WifiData->maxrate7=0xA;
- for(i=0;i<((u8 *)(data+24))[7];i++) {
- if(((u8 *)(data+24))[8+i]==0x84 || ((u8 *)(data+24))[8+i]==0x04) {
- WifiData->maxrate7=0x14;
- }
- }
- if(WifiData->authlevel==WIFI_AUTHLEVEL_AUTHENTICATED || WifiData->authlevel==WIFI_AUTHLEVEL_DEASSOCIATED) {
- WifiData->authlevel=WIFI_AUTHLEVEL_ASSOCIATED;
- WifiData->authctr=0;
-
-
-
- }
- } else { // status code = failure!
- WifiData->curMode=WIFIMODE_CANNOTASSOCIATE;
- }
- }
- }
- }
-
-
- return WFLAG_PACKET_MGT;
- case 0x00: // 0000 00 Assoc Request
- case 0x08: // 0010 00 Reassoc Request
- case 0x10: // 0100 00 Probe Request
- case 0x24: // 1001 00 ATIM
- case 0x28: // 1010 00 Disassociation
- return WFLAG_PACKET_MGT;
- case 0x2C: // 1011 00 Authentication
- // check auth response to ensure we're in
- {
- int datalen;
- u8 data[384];
- datalen=packetheader.byteLength;
- if(datalen>384) datalen=384;
- Wifi_MACCopy((u16 *)data,macbase,12,(datalen+1)&~1);
-
- if(Wifi_CmpMacAddr(data+4,WifiData->MacAddr)) { // packet is indeed sent to us.
- if(Wifi_CmpMacAddr(data+16,WifiData->bssid7)) { // packet is indeed from the base station we're trying to associate to.
- if(((u16 *)(data+24))[0]==0) { // open system auth
- if(((u16 *)(data+24))[1]==2) { // seq 2, should be final sequence
- if(((u16 *)(data+24))[2]==0) { // status code: successful
- if(WifiData->authlevel==WIFI_AUTHLEVEL_DISCONNECTED) {
- WifiData->authlevel=WIFI_AUTHLEVEL_AUTHENTICATED;
- WifiData->authctr=0;
- Wifi_SendAssocPacket();
- }
- } else { // status code: rejected, try something else
- Wifi_SendSharedKeyAuthPacket();
- }
- }
- } else if(((u16 *)(data+24))[0]==1) { // shared key auth
- if(((u16 *)(data+24))[1]==2) { // seq 2, challenge text
- if(((u16 *)(data+24))[2]==0) { // status code: successful
- // scrape challenge text and send challenge reply
- if(data[24+6]==0x10) { // 16 = challenge text - this value must be 0x10 or else!
- Wifi_SendSharedKeyAuthPacket2(data[24+7],data+24+8);
- }
- } else { // rejected, just give up.
- WifiData->curMode=WIFIMODE_CANNOTASSOCIATE;
- }
- } else if(((u16 *)(data+24))[1]==4) { // seq 4, accept/deny
- if(((u16 *)(data+24))[2]==0) { // status code: successful
- if(WifiData->authlevel==WIFI_AUTHLEVEL_DISCONNECTED) {
- WifiData->authlevel=WIFI_AUTHLEVEL_AUTHENTICATED;
- WifiData->authctr=0;
- Wifi_SendAssocPacket();
- }
- } else { // status code: rejected. Cry in the corner.
- WifiData->curMode=WIFIMODE_CANNOTASSOCIATE;
- }
- }
- }
- }
- }
- }
- return WFLAG_PACKET_MGT;
- case 0x30: // 1100 00 Deauthentication
- {
- int datalen;
- u8 data[64];
- datalen=packetheader.byteLength;
- if(datalen>64) datalen=64;
- Wifi_MACCopy((u16 *)data,macbase,12,(datalen+1)&~1);
-
- if(Wifi_CmpMacAddr(data+4,WifiData->MacAddr)) { // packet is indeed sent to us.
- if(Wifi_CmpMacAddr(data+16,WifiData->bssid7)) { // packet is indeed from the base station we're trying to associate to.
- // bad things! they booted us!.
- // back to square 1.
- if(WifiData->curReqFlags&WFLAG_REQ_APADHOC){
- WifiData->authlevel=WIFI_AUTHLEVEL_AUTHENTICATED;
- Wifi_SendAssocPacket();
- } else {
- WifiData->authlevel=WIFI_AUTHLEVEL_DISCONNECTED;
- Wifi_SendOpenSystemAuthPacket();
- }
- }
- }
- }
- return WFLAG_PACKET_MGT;
- // Control Frames
- case 0x29: // 1010 01 PowerSave Poll
- case 0x2D: // 1011 01 RTS
- case 0x31: // 1100 01 CTS
- case 0x35: // 1101 01 ACK
- case 0x39: // 1110 01 CF-End
- case 0x3D: // 1111 01 CF-End+CF-Ack
- return WFLAG_PACKET_CTRL;
- // Data Frames
- case 0x02: // 0000 10 Data
- case 0x06: // 0001 10 Data + CF-Ack
- case 0x0A: // 0010 10 Data + CF-Poll
- case 0x0E: // 0011 10 Data + CF-Ack + CF-Poll
- // We like data!
-
- return WFLAG_PACKET_DATA;
- case 0x12: // 0100 10 Null Function
- case 0x16: // 0101 10 CF-Ack
- case 0x1A: // 0110 10 CF-Poll
- case 0x1E: // 0111 10 CF-Ack + CF-Poll
- return WFLAG_PACKET_DATA;
- default: // ignore!
- return 0;
- }
-}
-int Wifi_CreateTxFrame(int frametype, void * dest, int destlen) {
- switch(frametype) {
-
- default:
- return 0;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-// sync functions
-
-void Wifi_Sync() {
- Wifi_Update();
-}
-void Wifi_SetSyncHandler(WifiSyncHandler sh) {
- synchandler=sh;
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm7/source/wifi_arm7.h b/c/src/lib/libbsp/arm/nds/dswifi/arm7/source/wifi_arm7.h
deleted file mode 100644
index e7e5cc3b8e..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm7/source/wifi_arm7.h
+++ /dev/null
@@ -1,136 +0,0 @@
-// DS Wifi interface code
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-// wifi_arm7.h - arm7 wifi interface header
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#ifndef WIFI_ARM7_H
-#define WIFI_ARM7_H
-
-#ifndef ARM7
-#error Wifi is only accessible from the ARM7
-#endif
-
-
-// keepalive updated in the update handler, which should be called in vblank
-// keepalive set for 2 minutes.
-#define WIFI_KEEPALIVE_COUNT (60*60*2)
-
-
-#define WIFI_REG(ofs) (*((volatile u16 *)(0x04800000+(ofs))))
-// Wifi regs
-#define W_WEPKEY0 (((volatile u16 *)(0x04805F80)))
-#define W_WEPKEY1 (((volatile u16 *)(0x04805FA0)))
-#define W_WEPKEY2 (((volatile u16 *)(0x04805FC0)))
-#define W_WEPKEY3 (((volatile u16 *)(0x04805FE0)))
-
-#define W_MODE_RST (*((volatile u16 *)(0x04800004)))
-#define W_MODE_WEP (*((volatile u16 *)(0x04800006)))
-#define W_IF (*((volatile u16 *)(0x04800010)))
-#define W_IE (*((volatile u16 *)(0x04800012)))
-#define W_MACADDR (((volatile u16 *)(0x04800018)))
-#define W_BSSID (((volatile u16 *)(0x04800020)))
-#define W_AIDS (*((volatile u16 *)(0x04800028)))
-#define W_RETRLIMIT (*((volatile u16 *)(0x0480002C)))
-#define W_POWERSTATE (*((volatile u16 *)(0x0480003C)))
-#define W_RANDOM (*((volatile u16 *)(0x04800044)))
-
-#define W_BBSIOCNT (*((volatile u16 *)(0x04800158)))
-#define W_BBSIOWRITE (*((volatile u16 *)(0x0480015A)))
-#define W_BBSIOREAD (*((volatile u16 *)(0x0480015C)))
-#define W_BBSIOBUSY (*((volatile u16 *)(0x0480015E)))
-#define W_RFSIODATA2 (*((volatile u16 *)(0x0480017C)))
-#define W_RFSIODATA1 (*((volatile u16 *)(0x0480017E)))
-#define W_RFSIOBUSY (*((volatile u16 *)(0x04800180)))
-
-
-
-
-
-
-#include "wifi_shared.h"
-
-extern volatile Wifi_MainStruct * WifiData;
-
-// Wifi Sync Handler function: Callback function that is called when the arm9 needs to be told to synchronize with new fifo data.
-// If this callback is used (see Wifi_SetSyncHandler()), it should send a message via the fifo to the arm9, which will call Wifi_Sync() on arm9.
-typedef void (*WifiSyncHandler)(void);
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-extern void Read_Flash(int address, char * destination, int length);
-extern void InitFlashData(void);
-extern int ReadFlashByte(int address);
-extern int ReadFlashHWord(int address);
-extern int ReadFlashBytes(int address, int numbytes);
-
-extern int Wifi_BBRead(int a);
-extern int Wifi_BBWrite(int a, int b);
-extern void Wifi_RFWrite(int writedata);
-
-extern void Wifi_RFInit(void);
-extern void Wifi_BBInit(void);
-extern void Wifi_WakeUp(void);
-extern void Wifi_Shutdown(void);
-extern void Wifi_MacInit(void);
-extern void Wifi_Interrupt(void);
-extern void Wifi_Update(void);
-
-extern void Wifi_CopyMacAddr(volatile void * dest, volatile void * src);
-extern int Wifi_CmpMacAddr(volatile void * mac1, volatile void * mac2);
-
-extern void Wifi_Init(u32 WifiData);
-extern void Wifi_Deinit(void);
-extern void Wifi_Start(void);
-extern void Wifi_Stop(void);
-extern void Wifi_SetChannel(int channel);
-extern void Wifi_SetWepKey(void * wepkey);
-extern void Wifi_SetWepMode(int wepmode);
-extern void Wifi_SetBeaconPeriod(int beacon_period);
-extern void Wifi_SetMode(int wifimode);
-extern void Wifi_SetPreambleType(int preamble_type);
-extern void Wifi_TxSetup(void);
-extern void Wifi_RxSetup(void);
-extern void Wifi_DisableTempPowerSave(void);
-
-extern int Wifi_SendOpenSystemAuthPacket(void);
-extern int Wifi_SendAssocPacket(void);
-extern int Wifi_SendNullFrame(void);
-extern int Wifi_SendPSPollFrame(void);
-extern int Wifi_ProcessReceivedFrame(int macbase, int framelen);
-
-extern void Wifi_Sync(void);
-extern void Wifi_SetSyncHandler(WifiSyncHandler sh);
-
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/makefile b/c/src/lib/libbsp/arm/nds/dswifi/arm9/makefile
deleted file mode 100644
index ef827e7062..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/makefile
+++ /dev/null
@@ -1,150 +0,0 @@
-#---------------------------------------------------------------------------------
-.SUFFIXES:
-#---------------------------------------------------------------------------------
-ifeq ($(strip $(DEVKITARM)),)
-$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
-endif
-
-include $(DEVKITARM)/ds_rules
-
-TOPDIR ?= $(CURDIR)/..
-
-#---------------------------------------------------------------------------------
-# BUILD is the directory where object files & intermediate files will be placed
-# SOURCES is a list of directories containing source code
-# INCLUDES is a list of directories containing extra header files
-# DATA is a list of directories containing binary files
-# all directories are relative to this makefile
-#---------------------------------------------------------------------------------
-BUILD ?= release
-SOURCES := source ../common/source
-INCLUDES := include ../common/source ../include
-DATA := data
-
-#---------------------------------------------------------------------------------
-# options for code generation
-#---------------------------------------------------------------------------------
-ARCH := -mthumb -mthumb-interwork -fno-schedule-insns2
-
-# note: arm9tdmi isn't the correct CPU arch, but anything newer and LD
-# *insists* it has a FPU or VFP, and it won't take no for an answer!
-CFLAGS := -g -Wall -O2\
- -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\
- -ffast-math \
- $(ARCH)
-
-CFLAGS += $(INCLUDE) -DARM9
-CXXFLAGS := $(CFLAGS)
-
-ASFLAGS := -g $(ARCH)
-LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map)
-
-ifneq ($(BUILD),debug)
-export ARM9BIN := $(TOPDIR)/lib/libdswifi9.a
-else
-export ARM9BIN := $(TOPDIR)/lib/libdswifi9d.a
-CFLAGS += -DSGIP_DEBUG
-endif
-
-
-#---------------------------------------------------------------------------------
-# any extra libraries we wish to link with the project
-#---------------------------------------------------------------------------------
-LIBS :=
-#-lnds9
-
-#---------------------------------------------------------------------------------
-# list of directories containing libraries, this must be the top level containing
-# include and lib
-#---------------------------------------------------------------------------------
-LIBDIRS := $(LIBNDS)
-
-#---------------------------------------------------------------------------------
-# no real need to edit anything past this point unless you need to add additional
-# rules for different file extensions
-#---------------------------------------------------------------------------------
-ifneq ($(BUILD),$(notdir $(CURDIR)))
-#---------------------------------------------------------------------------------
-
-
-export DEPSDIR := $(CURDIR)/$(BUILD)
-
-export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
- $(foreach dir,$(DATA),$(CURDIR)/$(dir))
-
-export CC := $(PREFIX)gcc
-export CXX := $(PREFIX)g++
-export AR := $(PREFIX)ar
-export OBJCOPY := $(PREFIX)objcopy
-
-CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
-CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
-SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
-BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
-
-#---------------------------------------------------------------------------------
-# use CXX for linking C++ projects, CC for standard C
-#---------------------------------------------------------------------------------
-ifeq ($(strip $(CPPFILES)),)
-#---------------------------------------------------------------------------------
- export LD := $(CC)
-#---------------------------------------------------------------------------------
-else
-#---------------------------------------------------------------------------------
- export LD := $(CXX)
-#---------------------------------------------------------------------------------
-endif
-#---------------------------------------------------------------------------------
-
-export OFILES := $(addsuffix .o,$(BINFILES)) \
- $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
-
-export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
- $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
- $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
- -I$(CURDIR)/$(BUILD)
-
-export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
-
-.PHONY: $(BUILD) clean
-
-#---------------------------------------------------------------------------------
-$(BUILD):
- @[ -d $@ ] || mkdir -p $@
- @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/makefile
-
-#---------------------------------------------------------------------------------
-clean:
- @echo clean ...
- @rm -fr debug release
- @rm -f $(TOPDIR)/lib/libdswifi9*
-
-all: $(ARM9BIN)
-
-#---------------------------------------------------------------------------------
-else
-
-DEPENDS := $(OFILES:.o=.d)
-
-#---------------------------------------------------------------------------------
-# main targets
-#---------------------------------------------------------------------------------
-$(ARM9BIN) : $(OFILES)
- @rm -f "$(ARM9BIN)"
- @$(AR) rcs "$(ARM9BIN)" $(OFILES)
- @echo built ... $(notdir $@)
-
-#---------------------------------------------------------------------------------
-# you need a rule like this for each extension you use as binary data
-#---------------------------------------------------------------------------------
-%.bin.o : %.bin
-#---------------------------------------------------------------------------------
- @echo $(notdir $<)
- @$(bin2o)
-
-
--include $(DEPENDS)
-
-#---------------------------------------------------------------------------------------
-endif
-#---------------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP.c
deleted file mode 100644
index fa57f98adb..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP.c
+++ /dev/null
@@ -1,63 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include "sgIP.h"
-
-unsigned long volatile sgIP_timems;
-int sgIP_errno;
-
-// sgIP_Init(): Initializes sgIP hub and sets up a default surrounding interface (ARP and IP)
-void sgIP_Init() {
- sgIP_timems = 0;
- sgIP_memblock_Init();
- sgIP_Hub_Init();
- sgIP_ARP_Init();
- sgIP_TCP_Init();
- sgIP_UDP_Init();
- sgIP_DNS_Init();
- sgIP_DHCP_Init();
- sgIP_Hub_AddProtocolInterface(PROTOCOL_ETHER_IP,&sgIP_IP_ReceivePacket,0);
-}
-
-
-unsigned long count_100ms;
-unsigned long count_1000ms;
-void sgIP_Timer(int num_ms) {
- sgIP_timems+=num_ms;
- count_100ms+=num_ms;
- if(count_100ms>=100) {
- count_100ms-=100;
- if(count_100ms>=100) count_100ms=0;
- sgIP_ARP_Timer100ms();
- }
- count_1000ms+=num_ms;
- if(count_1000ms>=1000) {
- count_1000ms-=1000;
- if(count_1000ms>=1000) count_1000ms=0;
- sgIP_DNS_Timer1000ms();
- }
- sgIP_TCP_Timer();
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP.h
deleted file mode 100644
index 8965fe1ae6..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-
-#ifndef SGIP_H
-#define SGIP_H
-
-#include "sgIP_Config.h"
-#include "sgIP_memblock.h"
-#include "sgIP_Hub.h"
-#include "sgIP_IP.h"
-#include "sgIP_ARP.h"
-#include "sgIP_ICMP.h"
-#include "sgIP_TCP.h"
-#include "sgIP_UDP.h"
-#include "sgIP_DNS.h"
-#include "sgIP_DHCP.h"
-
-extern unsigned long volatile sgIP_timems;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- void sgIP_Init(void);
- void sgIP_Timer(int num_ms);
-
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ARP.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ARP.c
deleted file mode 100644
index eca655fe78..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ARP.c
+++ /dev/null
@@ -1,304 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include "sgIP_ARP.h"
-
-sgIP_ARP_Record ArpRecords[SGIP_ARP_MAXENTRIES];
-
-
-int sgIP_FindArpSlot(sgIP_Hub_HWInterface * hw, unsigned long destip) {
- int i;
- for(i=0;i<SGIP_ARP_MAXENTRIES;i++) {
- if(ArpRecords[i].flags&SGIP_ARP_FLAG_ACTIVE) {
- if(ArpRecords[i].linked_interface==hw && ArpRecords[i].protocol_address==destip) return i;
- }
- }
- return -1;
-}
-int sgIP_GetArpSlot() {
- int i,m,midle;
- m=0;
- midle=0;
- for(i=0;i<SGIP_ARP_MAXENTRIES;i++) {
- if(ArpRecords[i].flags&SGIP_ARP_FLAG_ACTIVE) {
- if(ArpRecords[i].idletime>=midle) {
- midle=ArpRecords[i].idletime; m=i;
- }
- } else {
- return i;
- }
- }
- // this slot *was* in use, so let's fix that situation.
- if(ArpRecords[m].queued_packet) sgIP_memblock_free(ArpRecords[m].queued_packet);
- ArpRecords[m].flags=0;
- ArpRecords[m].retrycount=0;
- ArpRecords[m].idletime=0;
- ArpRecords[m].queued_packet=0;
- return m;
-}
-
-int sgIP_is_broadcast_address(sgIP_Hub_HWInterface * hw, unsigned long ipaddr) {
- if((hw->snmask | ipaddr) == 0xFFFFFFFF) return 1;
- return 0;
-}
-
-// this function will protect against malformed packets that could cause internal problems.
-int sgIP_ARP_Check_isok(sgIP_Hub_HWInterface * hw, sgIP_memblock * mb, sgIP_Header_ARP * arp) {
- return 1; // doesn't do anything yet ;)
-}
-
-void sgIP_ARP_Init() {
- int i;
- for(i=0;i<SGIP_ARP_MAXENTRIES;i++) {
- ArpRecords[i].flags=0;
- ArpRecords[i].idletime=0;
- ArpRecords[i].queued_packet=0;
- }
-}
-void sgIP_ARP_Timer100ms() {
- int i;
- for(i=0;i<SGIP_ARP_MAXENTRIES;i++) {
- if(ArpRecords[i].flags & SGIP_ARP_FLAG_ACTIVE) {
- ArpRecords[i].idletime++;
- if(!(ArpRecords[i].flags&SGIP_ARP_FLAG_HAVEHWADDR)) {
- ArpRecords[i].retrycount++;
- if(ArpRecords[i].retrycount>125) { // it's a lost cause.
- if(ArpRecords[i].queued_packet) { // if there is already a queued packet, kill it.
- sgIP_memblock_free(ArpRecords[i].queued_packet);
- }
- ArpRecords[i].flags=0;
- continue;
- }
- if((ArpRecords[i].retrycount&7)==7) { // attempt retransmit of ARP frame.
- sgIP_ARP_SendARPRequest(ArpRecords[i].linked_interface, ArpRecords[i].linked_protocol, ArpRecords[i].protocol_address);
- }
- }
- }
- }
-}
-
-void sgIP_ARP_FlushInterface(sgIP_Hub_HWInterface * hw) {
- int i;
- for(i=0;i<SGIP_ARP_MAXENTRIES;i++) {
- if(ArpRecords[i].linked_interface==hw) ArpRecords[i].flags=0;
- if(hw==0) ArpRecords[i].flags=0; // flush all interfaces
- }
-}
- // don't *really* need to process this, but it helps.
-int sgIP_ARP_ProcessIPFrame(sgIP_Hub_HWInterface * hw, sgIP_memblock * mb) {
-
- return 0;
-}
-int sgIP_ARP_ProcessARPFrame(sgIP_Hub_HWInterface * hw, sgIP_memblock * mb) {
- int i, j, ip;
- if(!hw || !mb) return 0;
- sgIP_memblock_exposeheader(mb,-14); // hide 14 bytes at the start temporarily...
- // look at arp frame...
- sgIP_Header_ARP * arp = (sgIP_Header_ARP *) mb->datastart;
-
- if(!sgIP_ARP_Check_isok(hw,mb,arp)) {
- sgIP_memblock_free(mb);
- return 0; // error - arp header incorrect somehow.
- }
- sgIP_memblock_exposeheader(mb,14); // re-expose 14 bytes at the start...
-
- if(htons(arp->opcode)==1) { // request
- // requested IP
- ip = arp->addresses[arp->hw_addr_len*2+4+0]+(arp->addresses[arp->hw_addr_len*2+4+1]<<8)+(arp->addresses[arp->hw_addr_len*2+4+2]<<16)+(arp->addresses[arp->hw_addr_len*2+4+3]<<24);
- SGIP_DEBUG_MESSAGE(("ARP: request IP %08X",ip));
- if(ip==hw->ipaddr) {// someone's asking for our info, toss them a reply.
- sgIP_ARP_SendARPResponse(hw,mb);
- return 0;
- }
- }
- if(htons(arp->opcode)==2) { // response
- // sender IP
- ip = arp->addresses[arp->hw_addr_len+0]+(arp->addresses[arp->hw_addr_len+1]<<8)+(arp->addresses[arp->hw_addr_len+2]<<16)+(arp->addresses[arp->hw_addr_len+3]<<24);
- i=sgIP_FindArpSlot(hw,ip);
- if(i!=-1) { // we've been waiting for you...
- for(j=0;j<arp->hw_addr_len;j++) ArpRecords[i].hw_address[j]=arp->addresses[j];
- ArpRecords[i].flags|=SGIP_ARP_FLAG_HAVEHWADDR;
- sgIP_memblock * mb2;
- mb2=ArpRecords[i].queued_packet;
- ArpRecords[i].queued_packet=0;
- if(mb2) sgIP_ARP_SendProtocolFrame(hw,mb2,ArpRecords[i].linked_protocol,ip);
- }
- }
-
- sgIP_memblock_free(mb);
- return 0;
-}
-int sgIP_ARP_SendProtocolFrame(sgIP_Hub_HWInterface * hw, sgIP_memblock * mb, unsigned short protocol, unsigned long destaddr) {
- int i,j;
- int m;
- sgIP_Header_Ethernet * ether;
- if(!hw || !mb) return 0;
- sgIP_memblock_exposeheader(mb,14); // add 14 bytes at the start for the header
-
- if(sgIP_is_broadcast_address(hw,destaddr)) {
- // construct ethernet header
- ether = (sgIP_Header_Ethernet *) mb->datastart;
- for(j=0;j<6;j++) {
- ether->src_mac[j] = hw->hwaddr[j];
- ether->dest_mac[j]= 0xFF; // broadcast destination
- }
- ether->protocol=protocol;
- return sgIP_Hub_SendRawPacket(hw,mb); // this function will free the memory block when it's done.
- }
-
- i=sgIP_FindArpSlot(hw,destaddr);
- if(i!=-1) {
- if(ArpRecords[i].flags & SGIP_ARP_FLAG_HAVEHWADDR) { // we have the adddress
- ArpRecords[i].idletime=0;
- // construct ethernet header
- ether = (sgIP_Header_Ethernet *) mb->datastart;
- for(j=0;j<6;j++) {
- ether->src_mac[j] = hw->hwaddr[j];
- ether->dest_mac[j]= ArpRecords[i].hw_address[j];
- }
- ether->protocol=protocol;
- return sgIP_Hub_SendRawPacket(hw,mb); // this function will free the memory block when it's done.
- } else { // we don't have the address, but are looking for it.
- if(ArpRecords[i].queued_packet) { // if there is already a queued packet, reject the new one.
- sgIP_memblock_free(mb);
- return 0; // couldn't send.
- } else {
- sgIP_memblock_exposeheader(mb,-14); // re-hide ethernet header.
- ArpRecords[i].queued_packet=mb; // queue packet.
- ArpRecords[i].linked_protocol=protocol; // queue packet.
- return 0;
- }
- }
- }
- m=sgIP_GetArpSlot(); // gets and cleans out an arp slot for us
- // build new record
- ArpRecords[m].flags=SGIP_ARP_FLAG_ACTIVE;
- ArpRecords[m].idletime=0;
- ArpRecords[m].retrycount=0;
- ArpRecords[m].linked_interface=hw;
- ArpRecords[m].protocol_address=destaddr;
- sgIP_memblock_exposeheader(mb,-14); // re-hide ethernet header.
- ArpRecords[m].queued_packet=mb;
- ArpRecords[m].linked_protocol=protocol;
- sgIP_ARP_SendARPRequest(hw,protocol,destaddr);
- return 0; // queued, but not sent yet.
-}
-
-int sgIP_ARP_SendARPResponse(sgIP_Hub_HWInterface * hw, sgIP_memblock * mb) {
- int i;
- if(!hw || !mb) return 0;
- sgIP_memblock_exposeheader(mb,-14); // hide 14 bytes at the start temporarily...
-
- // Repurpose existing ARP packet
- sgIP_Header_ARP * arp = (sgIP_Header_ARP *) mb->datastart;
- if(!sgIP_ARP_Check_isok(hw,mb,arp)) {
- sgIP_memblock_free(mb);
- return 0; // error - arp header incorrect somehow.
- }
-
- if(arp->hw_addr_len!=hw->hwaddrlen || arp->protocol_addr_len!=4) {
- // eek! can't send it back in this sorry state!
- sgIP_memblock_free(mb);
- return 0;
- }
-
- arp->opcode=htons(2); // response
- for(i=0;i<hw->hwaddrlen;i++) arp->addresses[i+4+hw->hwaddrlen]=arp->addresses[i]; // copy src hw addr
- for(i=0;i<4;i++) arp->addresses[i+(hw->hwaddrlen)*2+4]=arp->addresses[i+hw->hwaddrlen];
- for(i=0;i<hw->hwaddrlen;i++) arp->addresses[i]=hw->hwaddr[i];
- for(i=0;i<4;i++) arp->addresses[i+(hw->hwaddrlen)]=(hw->ipaddr>>(i*8))&255;
-
- // construct ethernet header
- sgIP_memblock_exposeheader(mb,14); // add 14 bytes at the start for the header
- sgIP_Header_Ethernet * ether = (sgIP_Header_Ethernet *) mb->datastart;
- for(i=0;i<6;i++) {
- ether->src_mac[i] = hw->hwaddr[i];
- ether->dest_mac[i]= arp->addresses[i+4+hw->hwaddrlen]; // requesting party
- }
- ether->protocol=htons(0x0806); // ARP protocol
-
- // Send ethernet packet
- return sgIP_Hub_SendRawPacket(hw,mb); // this function will free the memory block when it's done.
-}
-int sgIP_ARP_SendGratARP(sgIP_Hub_HWInterface * hw) {
- int i;
- if(!hw) return 0;
- sgIP_memblock * mb = sgIP_memblock_alloc(SGIP_HEADER_ARP_BASESIZE+2*4 + 2*hw->hwaddrlen);
- if(!mb) return 0;
-
- // Construct ARP packet
- sgIP_Header_ARP * arp = (sgIP_Header_ARP *) mb->datastart;
- arp->hwspace=htons(1); // ethernet
- arp->protocol=htons(0x0800);
- arp->opcode=htons(2); // response
- arp->hw_addr_len=hw->hwaddrlen;
- arp->protocol_addr_len= 4;
- for(i=0;i<hw->hwaddrlen;i++) arp->addresses[i]=hw->hwaddr[i];
- for(i=0;i<4;i++) arp->addresses[i+hw->hwaddrlen]=(hw->ipaddr>>(i*8))&255;
- for(i=0;i<hw->hwaddrlen;i++) arp->addresses[i+4+hw->hwaddrlen]=hw->hwaddr[i];
- for(i=0;i<4;i++) arp->addresses[i+hw->hwaddrlen*2+4]=(hw->ipaddr>>(i*8))&255;
-
- // construct ethernet header
- sgIP_memblock_exposeheader(mb,14); // add 14 bytes at the start for the header
- sgIP_Header_Ethernet * ether = (sgIP_Header_Ethernet *) mb->datastart;
- for(i=0;i<6;i++) {
- ether->src_mac[i] = hw->hwaddr[i];
- ether->dest_mac[i]= 0xFF; // broadcast packet
- }
- ether->protocol=htons(0x0806); // ARP protocol
-
- // Send ethernet packet
- return sgIP_Hub_SendRawPacket(hw,mb); // this function will free the memory block when it's done.
-}
-int sgIP_ARP_SendARPRequest(sgIP_Hub_HWInterface * hw, int protocol, unsigned long protocol_addr) {
- int i;
- if(!hw) return 0;
- sgIP_memblock * mb = sgIP_memblock_alloc(SGIP_HEADER_ARP_BASESIZE+2*4 + 2*hw->hwaddrlen);
- if(!mb) return 0;
-
- // Construct ARP packet
- sgIP_Header_ARP * arp = (sgIP_Header_ARP *) mb->datastart;
- arp->hwspace=htons(1); // 1=ethernet
- arp->protocol=(protocol);
- arp->opcode=htons(1); // 1=request
- arp->hw_addr_len=hw->hwaddrlen;
- arp->protocol_addr_len= 4;
- for(i=0;i<hw->hwaddrlen;i++) arp->addresses[i]=hw->hwaddr[i];
- for(i=0;i<4;i++) arp->addresses[i+hw->hwaddrlen]=(hw->ipaddr>>(i*8))&255;
- for(i=0;i<hw->hwaddrlen;i++) arp->addresses[i+4+hw->hwaddrlen]=0;
- for(i=0;i<4;i++) arp->addresses[i+hw->hwaddrlen*2+4]=(protocol_addr>>(i*8))&255;
-
- // construct ethernet header
- sgIP_memblock_exposeheader(mb,14); // add 14 bytes at the start for the header
- sgIP_Header_Ethernet * ether = (sgIP_Header_Ethernet *) mb->datastart;
- for(i=0;i<6;i++) {
- ether->src_mac[i] = hw->hwaddr[i];
- ether->dest_mac[i]= 0xFF; // broadcast packet
- }
- ether->protocol=htons(0x0806); // ARP protocol
-
- // Send ethernet packet
- return sgIP_Hub_SendRawPacket(hw,mb); // this function will free the memory block when it's done.
-}
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ARP.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ARP.h
deleted file mode 100644
index eda6e89d32..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ARP.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-#ifndef SGIP_ARP_H
-#define SGIP_ARP_H
-
-#include "sgIP_Config.h"
-#include "sgIP_memblock.h"
-#include "sgIP_Hub.h"
-
-#define SGIP_ARP_FLAG_ACTIVE 0x0001
-#define SGIP_ARP_FLAG_HAVEHWADDR 0x0002
-
-typedef struct SGIP_ARP_RECORD {
- unsigned short flags, retrycount;
- unsigned long idletime;
- sgIP_Hub_HWInterface * linked_interface;
- sgIP_memblock * queued_packet;
- int linked_protocol;
- unsigned long protocol_address;
- char hw_address[SGIP_MAXHWADDRLEN];
-} sgIP_ARP_Record;
-
-
-typedef struct SGIP_HEADER_ARP {
- unsigned short hwspace; // ethernet=1;
- unsigned short protocol;
- unsigned char hw_addr_len;
- unsigned char protocol_addr_len;
- unsigned short opcode; // request=1, reply=2
- unsigned char addresses[8+12]; // sender HW, sender Protocol, dest HW, dest Protocol
-} sgIP_Header_ARP;
-
-#define SGIP_HEADER_ARP_BASESIZE 8
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- extern void sgIP_ARP_Init(void);
- extern void sgIP_ARP_Timer100ms(void);
- extern void sgIP_ARP_FlushInterface(sgIP_Hub_HWInterface * hw);
-
- extern int sgIP_ARP_ProcessIPFrame(sgIP_Hub_HWInterface * hw, sgIP_memblock * mb);
- extern int sgIP_ARP_ProcessARPFrame(sgIP_Hub_HWInterface * hw, sgIP_memblock * mb);
- extern int sgIP_ARP_SendProtocolFrame(sgIP_Hub_HWInterface * hw, sgIP_memblock * mb, unsigned short protocol, unsigned long destaddr);
-
- extern int sgIP_ARP_SendARPResponse(sgIP_Hub_HWInterface * hw, sgIP_memblock * mb);
- extern int sgIP_ARP_SendGratARP(sgIP_Hub_HWInterface * hw);
- extern int sgIP_ARP_SendARPRequest(sgIP_Hub_HWInterface * hw, int protocol, unsigned long protocol_addr);
-
-
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Config.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Config.h
deleted file mode 100644
index 26772b0f40..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Config.h
+++ /dev/null
@@ -1,274 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-
-#ifndef SGIP_CONFIG_H
-#define SGIP_CONFIG_H
-
-#include <errno.h>
-
-//////////////////////////////////////////////////////////////////////////
-// General options - these control the core functionality of the stack.
-
-// SGIP_USEDYNAMICMEMORY: Allows the stack to use memory as it needs it, via malloc()/free()
-// This option is extremely useful in environments where it can be used, as it prevents the
-// overhead of allocating per-connection memory in advance, and allows an unlimited number
-// of connections, provided the memory space. This option requires the implementation of
-// two C functions, "void * sgIP_malloc(int)" and "void sgIP_free(void *)", which behave
-// similarly to the malloc and free functions commonly used in C.
-#define SGIP_USEDYNAMICMEMORY
-
-// SGIP_INTERRUPT_THREADING_MODEL: Provides memory protection in a system that can allow
-// multiple processing "threads" by way of interrupts. This is not required on single
-// threaded systems, and not adequate on multithreaded systems, but provides a way to
-// allow protection against contention on interrupt-driven systems. This option requires
-// the system to implement two C functions "int sgIP_DisableInterrupts()" and additionally
-// "void sgIP_RestoreInterrupts(int)" that takes as a parameter the value returned by
-// sgIP_DisableInterrupts(). Interrupts are disabled upon beginning work with sensitive
-// memory areas or allocation/deallocation of memory, and are restored afterwards.
-#define SGIP_INTERRUPT_THREADING_MODEL
-
-// SGIP_MULTITHREADED_THREADING_MODEL: Standard memory protection for large multithreaded
-// systems, such as operating systems and the like. This kind of memory protection is
-// useful for true multithreaded systems but useless in a single-threaded system and
-// harmful in an interrupt-based multiprocess system.
-//#define SGIP_MULTITHREADED_THREADING_MODEL
-
-#define SGIP_LITTLEENDIAN
-
-//////////////////////////////////////////////////////////////////////////
-// Temporary memory system settings
-
-// SGIP_MEMBLOCK_DATASIZE: This is the maximum data size contained in a single sgIP_memblock.
-// for best performance ensure this value is larger than any packet that is expected to be
-// received, however, in a memory-tight situation, much smaller values can be used.
-#define SGIP_MEMBLOCK_DATASIZE 1600
-
-// SGIP_MEMBLOCK_BASENUM: The starting number of memblocks that will be allocated. This is
-// also the total number of memblocks that will be allocated if sgIP is not configured to use
-// dynamic memory allocation.
-#define SGIP_MEMBLOCK_BASENUM 12
-
-// SGIP_MEMBLOCK_STEPNUM: In the case that all memblocks are full, and dynamic memory is
-// enabled, this many additional memblocks will be allocated in an attempt to satasfy the
-// memory usage demands of the stack.
-#define SGIP_MEMBLOCK_STEPNUM 6
-
-// SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL: Who cares what the other memblock defines say, let's
-// Generate all memblocks by mallocing 'em.
-#define SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
-
-//////////////////////////////////////////////////////////////////////////
-// Hardware layer settings
-
-// SGIP_MAXHWADDRLEN: The maximum usable hardware address length. Ethernet is 6 bytes.
-#define SGIP_MAXHWADDRLEN 8
-
-// SGIP_MAXHWHEADER: The maximum allocated size for hardware headers.
-#define SGIP_MAXHWHEADER 16
-
-// SGIP_MTU_OVERRIDE: This is the maximum MTU that will be accepted. By default it is being
-// set to 1460 bytes in order to be courteous to Ethernet and it's ridiculously low MTU.
-// This value will allow you to prevent fragmentation of IP packets by not using the full
-// MTU available to your network interface when the IP packet will just be sliced and diced
-// at the next smaller MTU. (the stack will still use HW mtu if it's lower.)
-#define SGIP_MTU_OVERRIDE 1460
-
-
-//////////////////////////////////////////////////////////////////////////
-// Connection settings - can be tuned to change memory usage and performance
-
-// SGIP_TCP_STATELESS_LISTEN: Uses a technique to prevent syn-flooding from blocking listen
-// ports by using all the connection blocks/memory.
-#define SGIP_TCP_STATELESS_LISTEN
-
-// SGIP_TCP_STEALTH: Only sends packets in response to connections to active ports. Doing so
-// causes ports to appear not as closed, but as if the deviced does not exist when probing
-// ports that are not in use.
-//#define SGIP_TCP_STEALTH
-
-// SGIP_TCP_TTL: Time-to-live value given to outgoing packets, in the absence of a reason to
-// manually override this value.
-#define SGIP_IP_TTL 128
-
-// SGIP_TCPRECEIVEBUFFERLENGTH: The size (in bytes) of the receive FIFO in a TCP connection
-#define SGIP_TCP_RECEIVEBUFFERLENGTH 8192
-
-// SGIP_TCPTRANSMITBUFFERLENGTH: The size (in bytes) of the transmit FIFO in a TCP connection
-#define SGIP_TCP_TRANSMITBUFFERLENGTH 8192
-
-// SGIP_TCPOOBBUFFERLENGTH: The size (in bytes) of the receive OOB data FIFO in a TCP connection
-#define SGIP_TCP_OOBBUFFERLENGTH 256
-
-// SGIP_ARP_MAXENTRIES: The maximum number of cached ARP entries - this is defined staticly
-// because it's somewhat impractical to dynamicly allocate memory for such a small structure
-// (at least on most smaller systems)
-#define SGIP_ARP_MAXENTRIES 32
-
-// SGIP_HUB_MAXHWINTERFACES: The maximum number of hardware interfaces the sgIP hub will
-// connect to. A hardware interface being some port (ethernet, wifi, etc) that will relay
-// packets to the outside world.
-#define SGIP_HUB_MAXHWINTERFACES 1
-
-// SGIP_HUB_MAXPROTOCOLINTERFACES: The maximum number of protocol interfaces the sgIP hub will
-// connect to. A protocol interface being a software handler for a certain protocol type
-// (such as IP)
-#define SGIP_HUB_MAXPROTOCOLINTERFACES 1
-
-#define SGIP_TCP_FIRSTOUTGOINGPORT 40000
-#define SGIP_TCP_LASTOUTGOINGPORT 65000
-#define SGIP_UDP_FIRSTOUTGOINGPORT 40000
-#define SGIP_UDP_LASTOUTGOINGPORT 65000
-
-#define SGIP_TCP_GENTIMEOUTMS 6000
-#define SGIP_TCP_TRANSMIT_DELAY 25
-#define SGIP_TCP_TRANSMIT_IMMTHRESH 40
-#define SGIP_TCP_TIMEMS_2MSL 1000*60*2
-#define SGIP_TCP_MAXRETRY 7
-#define SGIP_TCP_MAXSYNS 64
-#define SGIP_TCP_REACK_THRESH 1000
-
-#define SGIP_TCP_SYNRETRYMS 250
-#define SGIP_TCP_GENRETRYMS 500
-#define SGIP_TCP_BACKOFFMAX 6000
-
-#define SGIP_SOCKET_MAXSOCKETS 32
-
-//#define SGIP_SOCKET_DEFAULT_NONBLOCK 1
-
-
-//////////////////////////////////////////////////////////////////////////
-// DNS settings
-
-#define SGIP_DNS_MAXRECORDSCACHE 16
-#define SGIP_DNS_MAXRECORDADDRS 4
-#define SGIP_DNS_MAXALIASES 4
-#define SGIP_DNS_TIMEOUTMS 5000
-#define SGIP_DNS_MAXRETRY 3
-#define SGIP_DNS_MAXSERVERRETRY 4
-
-//////////////////////////////////////////////////////////////////////////
-
-#define SGIP_DHCP_ERRORTIMEOUT 45000
-#define SGIP_DHCP_RESENDTIMEOUT 3000
-#define SGIP_DHCP_DEFAULTHOSTNAME "NintendoDS"
-#define SGIP_DHCP_CLASSNAME "sgIP 0.3"
-
-//////////////////////////////////////////////////////////////////////////
-// Static memory settings - only used if SGIP_USEDYNAMICMEMORY is NOT defined.
-
-// SGIP_TCP_MAXCONNECTIONS: In the case dynamic memory is not used, this value gives the max
-// number of TCP blocks available for inbound/outbound connections via TCP.
-#define SGIP_TCP_MAXCONNECTIONS 10
-
-
-
-
-//////////////////////////////////////////////////////////////////////////
-// Debugging options
-
-
-// SGIP_DEBUG: Enable debug logging.
-// requires external function "void sgIP_dbgprint(char *, ...);"
-//#define SGIP_DEBUG
-
-#ifdef SGIP_DEBUG
-#define SGIP_DEBUG_MESSAGE(param) sgIP_dbgprint param
-#define SGIP_DEBUG_ERROR(param) sgIP_dbgprint param; while(1);
-#else
-#define SGIP_DEBUG_MESSAGE(param)
-#define SGIP_DEBUG_ERROR(param)
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////
-// Error handling
-extern int sgIP_errno;
-#define SGIP_ERROR(a) ((errno=(a)), -1)
-#define SGIP_ERROR0(a) ((errno=(a)), 0)
-
-//////////////////////////////////////////////////////////////////////////
-// Error checking
-
-
-#ifdef SGIP_MULTITHREADED_THREADING_MODEL
-#ifdef SGIP_INTERRUPT_THREADING_MODEL
-#error SGIP_INTERRUPT_THREADING_MODEL and SGIP_MULTITHREADED_THREADING_MODEL cannot be used together!
-#endif
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////
-// External option-based dependencies
-
-
-#ifdef SGIP_INTERRUPT_THREADING_MODEL
-#ifdef __cplusplus
-extern "C" {
-#endif
- extern int sgIP_DisableInterrupts(void);
- extern void sgIP_RestoreInterrupts(int);
- extern void sgIP_IntrWaitEvent(void);
-#ifdef __cplusplus
-};
-#endif
-#define SGIP_INTR_PROTECT() \
- int tIME; \
- tIME=sgIP_DisableInterrupts()
-#define SGIP_INTR_REPROTECT() \
- tIME=sgIP_DisableInterrupts()
-#define SGIP_INTR_UNPROTECT() \
- sgIP_RestoreInterrupts(tIME)
-#define SGIP_WAITEVENT() \
- sgIP_IntrWaitEvent()
-#else // !SGIP_INTERRUPT_THREADING_MODEL
-#define SGIP_INTR_PROTECT()
-#define SGIP_INTR_REPROTECT()
-#define SGIP_INTR_UNPROTECT()
-#define SGIP_WAITEVENT();
-#endif // SGIP_INTERRUPT_THREADING_MODEL
-
-#ifdef SGIP_DEBUG
-#ifdef __cplusplus
-extern "C" {
-#endif
- extern void sgIP_dbgprint(char *, ...);
-#ifdef __cplusplus
-};
-#endif
-#endif // SGIP_DEBUG
-
-#ifdef SGIP_USEDYNAMICMEMORY
-#ifdef __cplusplus
-extern "C" {
-#endif
- extern void * sgIP_malloc(int);
- extern void sgIP_free(void *);
-#ifdef __cplusplus
-};
-#endif
-#endif // SGIP_USEDYNAMICMEMORY
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DHCP.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DHCP.c
deleted file mode 100644
index 33805ba5e4..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DHCP.c
+++ /dev/null
@@ -1,375 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include "sgIP_DHCP.h"
-#include "sgIP_DNS.h"
-#include <string.h>
-#include "sys/socket.h"
-#include "netinet/in.h"
-
-extern unsigned long volatile sgIP_timems;
-int dhcp_socket;
-char dhcp_hostname[64];
-int dhcp_tid;
-unsigned long dhcp_timestart, dhcp_timelastaction;
-sgIP_DHCP_Packet * dhcp_p;
-sgIP_Hub_HWInterface * dhcp_int;
-int dhcp_optionptr;
-int dhcp_requestDNS;
-int dhcp_status;
-int dhcp_state; // 0== send DHCPDISCOVER wait for DHCPOFFER, 1== send DHCPREQUEST wait for DHCPACK
-unsigned long dhcp_rcvd_ip, dhcp_rcvd_gateway, dhcp_rcvd_snmask, dhcp_rcvd_dns[3], dhcp_serverip;
-
-
-void sgIP_DHCP_Init() {
- dhcp_socket=0;
- dhcp_p=0;
- dhcp_int=0;
- dhcp_rcvd_ip=0;
- strcpy(dhcp_hostname,SGIP_DHCP_DEFAULTHOSTNAME);
- dhcp_status=SGIP_DHCP_STATUS_IDLE;
-}
-void sgIP_DHCP_SetHostName(char * s) {
- strncpy(dhcp_hostname,s,63);
- dhcp_hostname[63]=0;
-}
-int sgIP_DHCP_IsDhcpIp(unsigned long ip) { // check if the IP address was assigned via dhcp.
- return ip==dhcp_rcvd_ip;
-}
-
-void sgIP_DHCP_SendDgram() {
- struct sockaddr_in sain;
- int len_dhcp;
- sain.sin_port=htons(67); // bootp server port
- sain.sin_addr.s_addr=0xFFFFFFFF; // broadcast
- dhcp_p->options[dhcp_optionptr++]=0xFF; // terminate options list.
- //sendto(dhcp_socket,dhcp_p,sizeof(sgIP_DHCP_Packet)-312+dhcp_optionptr,0,(struct sockaddr *)&sain,sizeof(sain));
- len_dhcp = sizeof(sgIP_DHCP_Packet)-312+dhcp_optionptr;
- if(len_dhcp<300) len_dhcp=300;
- sendto(dhcp_socket,dhcp_p,len_dhcp,0,(struct sockaddr *)&sain,sizeof(sain));
- sgIP_free(dhcp_p);
- dhcp_p=0;
- dhcp_timelastaction=sgIP_timems;
-}
-
-void sgIP_DHCP_BeginDgram(int dgramtype) {
- int i;
- if(dhcp_p) sgIP_free(dhcp_p);
- dhcp_p = (sgIP_DHCP_Packet *) sgIP_malloc(sizeof(sgIP_DHCP_Packet));
- if(!dhcp_p) return;
-
- // ensure packet is zero'd.. seems to pacify some routers. malloc doesn't initialise the memory returned.
- memset(dhcp_p,0,sizeof(sgIP_DHCP_Packet));
-
- dhcp_p->op=1; // 1==BOOTREQUEST
- dhcp_p->htype=1; // 1== ethernet address type
- dhcp_p->hlen=6; // hardware address length
- dhcp_p->hops=0; // client sets to zero
- dhcp_p->xid=dhcp_tid; // DHCP transaction ID
- dhcp_p->secs=(sgIP_timems-dhcp_timestart)/1000; // seconds since DHCP start
- dhcp_p->flags=htons(0x0000); // top bit set = request broadcast response
- dhcp_p->ciaddr=0;
- dhcp_p->yiaddr=0;
- dhcp_p->siaddr=0;
- dhcp_p->giaddr=0;
-
- memcpy(dhcp_p->chaddr,dhcp_int->hwaddr,6);
-
- dhcp_optionptr=0;
- dhcp_p->options[dhcp_optionptr++]=0x63;
- dhcp_p->options[dhcp_optionptr++]=0x82;
- dhcp_p->options[dhcp_optionptr++]=0x53;
- dhcp_p->options[dhcp_optionptr++]=0x63; // 4-byte "magic cookie" (bleh!)
- // add some necessary options... - by default add the dhcp message type, host name, class id, and parameter request list
- dhcp_p->options[dhcp_optionptr++]=0x35; // DHCP Message type
- dhcp_p->options[dhcp_optionptr++]=0x01;
- dhcp_p->options[dhcp_optionptr++]=dgramtype;
-
- dhcp_p->options[dhcp_optionptr++]=0x3D; // DHCP client identifier
- dhcp_p->options[dhcp_optionptr++]=0x07; // length
- dhcp_p->options[dhcp_optionptr++]=0x01; // hw type
- for(i=0;i<6;i++) dhcp_p->options[dhcp_optionptr++]=dhcp_int->hwaddr[i];
-
- dhcp_p->options[dhcp_optionptr++]=0x0C; // DHCP host name
- dhcp_p->options[dhcp_optionptr++]=strlen(dhcp_hostname);
- for(i=0;i<strlen(dhcp_hostname);i++) {
- dhcp_p->options[dhcp_optionptr++]=dhcp_hostname[i];
- }
-
- dhcp_p->options[dhcp_optionptr++]=0x37; // DHCP Parameter request list
- dhcp_p->options[dhcp_optionptr++]=2+dhcp_requestDNS;
- dhcp_p->options[dhcp_optionptr++]=1; // subnet mask
- dhcp_p->options[dhcp_optionptr++]=3; // router
- if(dhcp_requestDNS) dhcp_p->options[dhcp_optionptr++]=6; // dns server
-
- if(dgramtype==DHCP_TYPE_REQUEST) {
- dhcp_p->options[dhcp_optionptr++]=0x32; // DHCP Requested IP address
- dhcp_p->options[dhcp_optionptr++]=0x04;
- dhcp_p->options[dhcp_optionptr++]=(dhcp_rcvd_ip)&255;
- dhcp_p->options[dhcp_optionptr++]=(dhcp_rcvd_ip>>8)&255;
- dhcp_p->options[dhcp_optionptr++]=(dhcp_rcvd_ip>>16)&255;
- dhcp_p->options[dhcp_optionptr++]=(dhcp_rcvd_ip>>24)&255;
-
- dhcp_p->options[dhcp_optionptr++]=0x36; // DHCP Server identifier
- dhcp_p->options[dhcp_optionptr++]=0x04;
- dhcp_p->options[dhcp_optionptr++]=(dhcp_serverip)&255;
- dhcp_p->options[dhcp_optionptr++]=(dhcp_serverip>>8)&255;
- dhcp_p->options[dhcp_optionptr++]=(dhcp_serverip>>16)&255;
- dhcp_p->options[dhcp_optionptr++]=(dhcp_serverip>>24)&255;
- }
-
- dhcp_p->options[dhcp_optionptr++]=0x3C; // DHCP Vendor Class ID
- dhcp_p->options[dhcp_optionptr++]=strlen(SGIP_DHCP_CLASSNAME);
- for(i=0;i<strlen(SGIP_DHCP_CLASSNAME);i++) {
- dhcp_p->options[dhcp_optionptr++]=(SGIP_DHCP_CLASSNAME)[i];
- }
-
- // reason we don't send it immediately is in case the calling code wants to modify some data or add some options.
-}
-
-
-
-void sgIP_DHCP_Start(sgIP_Hub_HWInterface * interface, int getDNS) { // begin dhcp transaction to get IP and maybe DNS data.
- struct sockaddr_in sain;
- int i;
- SGIP_DEBUG_MESSAGE(("sgIP_DHCP_Start()"));
- sgIP_DHCP_Terminate();
- dhcp_requestDNS=getDNS?1:0;
- dhcp_int=interface;
- dhcp_timestart=sgIP_timems;
- dhcp_timelastaction=sgIP_timems;
- dhcp_tid=sgIP_timems;
- dhcp_status=SGIP_DHCP_STATUS_WORKING;
- dhcp_state=0;
-
- dhcp_rcvd_ip = 0;
- dhcp_rcvd_gateway=0;
- dhcp_rcvd_snmask=0;
- dhcp_rcvd_dns[0]=0;
- dhcp_rcvd_dns[1]=0;
- dhcp_rcvd_dns[2]=0;
-
- dhcp_socket=socket(AF_INET,SOCK_DGRAM,0);
- sain.sin_addr.s_addr=0;
- sain.sin_port=htons(68); // BOOTP client
- bind(dhcp_socket,(struct sockaddr *)&sain,sizeof(sain));
- i=1;
- ioctl(dhcp_socket,FIONBIO,&i);
-
- sgIP_DHCP_BeginDgram(DHCP_TYPE_DISCOVER);
- sgIP_DHCP_SendDgram();
-}
-void sgIP_DHCP_Release() { // call to dump our DHCP address and leave.
- if(dhcp_status==SGIP_DHCP_STATUS_WORKING) {
- sgIP_DHCP_Terminate();
- } else {
- sgIP_DHCP_BeginDgram(DHCP_TYPE_RELEASE);
- dhcp_p->ciaddr=dhcp_int->ipaddr;
- sgIP_DHCP_SendDgram();
-
- }
-}
-int sgIP_DHCP_Update() { // MUST be called periodicly; returns status - call until it returns SGIP_DHCP_STATUS_SUCCESS or _FAILED.
- sgIP_DHCP_Packet * p;
- struct sockaddr_in * sain;
- int i,j,n,l;
- if(dhcp_status!=SGIP_DHCP_STATUS_WORKING) return dhcp_status;
- int send = 0;
-
- p=(sgIP_DHCP_Packet *)sgIP_malloc(sizeof(sgIP_DHCP_Packet));
- if(p) {
-
- while(1) {
- l=recvfrom(dhcp_socket,p,sizeof(sgIP_DHCP_Packet),0,(struct sockaddr *)&sain,&n);
- if(l==-1) break;
- if(p->op!=2 || p->htype!=1 || p->hlen!=6 || p->xid!=dhcp_tid ) continue;
- // check magic cookie
- if(p->options[0]!=0x63 || p->options[1]!=0x82 || p->options[2]!=0x53 || p->options[3]!=0x63) continue;
- i=4; // yay, the cookie is valid.
- l -= (sizeof(sgIP_DHCP_Packet)-312); // number of bytes remaining in the options
- while(i<l) {
- n=p->options[i++];
- switch(n) {
- case 0: // ignore
- break;
- case 255: // end-of-options marker.
- l=0;
- break;
- case 53: // message type, variable length, 2+n
- j=p->options[i++];
- if(dhcp_state==0) {
- if(p->options[i]!=DHCP_TYPE_OFFER) l=-1;
- } else {
- if(p->options[i]==DHCP_TYPE_ACK) {
- sgIP_free(p);
- sgIP_DHCP_Terminate();
- dhcp_int->ipaddr=dhcp_rcvd_ip;
- dhcp_int->gateway=dhcp_rcvd_gateway;
- dhcp_int->snmask=dhcp_rcvd_snmask;
- SGIP_DEBUG_MESSAGE(("DHCP Configured!"));
- SGIP_DEBUG_MESSAGE(("IP%08X SM%08X GW%08X",dhcp_rcvd_ip,dhcp_rcvd_snmask,dhcp_rcvd_gateway));
- if(dhcp_requestDNS) {
- dhcp_int->dns[0]=dhcp_rcvd_dns[0];
- dhcp_int->dns[1]=dhcp_rcvd_dns[1];
- dhcp_int->dns[2]=dhcp_rcvd_dns[2];
- SGIP_DEBUG_MESSAGE(("DNS %08X %08X %08X",dhcp_rcvd_dns[0],dhcp_rcvd_dns[1],dhcp_rcvd_dns[2]));
- }
-
- dhcp_status=SGIP_DHCP_STATUS_SUCCESS;
- return dhcp_status;
- } else {
- l=-1;
- }
- }
- i+=j;
-
- break;
- case 1: // subnet mask field, variable length 2+n
- j=p->options[i++];
- if(dhcp_state==1 || j<4) {i+=j; break; }
- dhcp_rcvd_snmask = (dhcp_rcvd_snmask>>8) | (p->options[i++]<<24);
- dhcp_rcvd_snmask = (dhcp_rcvd_snmask>>8) | (p->options[i++]<<24);
- dhcp_rcvd_snmask = (dhcp_rcvd_snmask>>8) | (p->options[i++]<<24);
- dhcp_rcvd_snmask = (dhcp_rcvd_snmask>>8) | (p->options[i++]<<24);
- i+=j-4;
- break;
- case 3: // gateway, variable length 2+n
- j=p->options[i++];
- if(dhcp_state==1 || j<4) {i+=j; break; }
- dhcp_rcvd_gateway = (dhcp_rcvd_gateway>>8) | (p->options[i++]<<24);
- dhcp_rcvd_gateway = (dhcp_rcvd_gateway>>8) | (p->options[i++]<<24);
- dhcp_rcvd_gateway = (dhcp_rcvd_gateway>>8) | (p->options[i++]<<24);
- dhcp_rcvd_gateway = (dhcp_rcvd_gateway>>8) | (p->options[i++]<<24);
- i+=j-4;
- break;
- case 54: // server ID, variable length 2+n
- j=p->options[i++];
- if(dhcp_state==1 || j<4) {i+=j; break; }
- dhcp_serverip = (dhcp_serverip>>8) | (p->options[i++]<<24);
- dhcp_serverip = (dhcp_serverip>>8) | (p->options[i++]<<24);
- dhcp_serverip = (dhcp_serverip>>8) | (p->options[i++]<<24);
- dhcp_serverip = (dhcp_serverip>>8) | (p->options[i++]<<24);
- i+=j-4;
- break;
- case 6: // dns servers, variable length 2+n
- if(dhcp_requestDNS && !dhcp_state) {
- j=p->options[i++];
- n=0;
- while(n<3 && 4*n+3<j) {
- dhcp_rcvd_dns[n] = (dhcp_rcvd_dns[n]>>8) | (p->options[i++]<<24);
- dhcp_rcvd_dns[n] = (dhcp_rcvd_dns[n]>>8) | (p->options[i++]<<24);
- dhcp_rcvd_dns[n] = (dhcp_rcvd_dns[n]>>8) | (p->options[i++]<<24);
- dhcp_rcvd_dns[n] = (dhcp_rcvd_dns[n]>>8) | (p->options[i++]<<24);
- n++;
- }
- i+=j-4*n;
- break;
- }
- default:
- j=p->options[i++];
- i+=j;
- }
- }
- if(l==-1) continue;
- dhcp_rcvd_ip=(p->yiaddr);
-
- // discover succeeded. increment transaction id. force sending REQUEST message next.
- dhcp_state=1;
- dhcp_tid += ( sgIP_timems-dhcp_timestart ) + 1;
- send = 1;
- break;
- }
-
- sgIP_free(p);
- // has timeout expired?
- if( (sgIP_timems-dhcp_timestart) > SGIP_DHCP_ERRORTIMEOUT) {
- SGIP_DEBUG_MESSAGE(("sgIP DHCP error timeout!"));
- sgIP_DHCP_Terminate();
- dhcp_status=SGIP_DHCP_STATUS_FAILED;
- return dhcp_status;
- }
- if( send || (sgIP_timems-dhcp_timelastaction) > SGIP_DHCP_RESENDTIMEOUT )
- {
- if(dhcp_state==0) sgIP_DHCP_BeginDgram(DHCP_TYPE_DISCOVER); else sgIP_DHCP_BeginDgram(DHCP_TYPE_REQUEST);
- sgIP_DHCP_SendDgram();
- }
- } else {
- SGIP_DEBUG_MESSAGE(("sgIP DHCP alloc failed!"));
- sgIP_DHCP_Terminate();
- dhcp_status=SGIP_DHCP_STATUS_FAILED;
- }
-
- return dhcp_status;
-}
-void sgIP_DHCP_Terminate() { // kill the process where it stands; deallocate all DHCP resources.
- if(dhcp_socket) closesocket(dhcp_socket);
- dhcp_socket=0;
- if(dhcp_p) sgIP_free(dhcp_p);
- dhcp_p=0;
- dhcp_status=SGIP_DHCP_STATUS_IDLE;
-}
-
-int gethostname(char *name, size_t len)
-{
- int size = sizeof(dhcp_hostname);
- if (name == NULL)
- return SGIP_ERROR(EFAULT);
-
- if ( len <= size )
- return SGIP_ERROR(EINVAL);
-
- strncpy(name, dhcp_hostname, size);
- name[size]=0;
- return 0;
-}
-
-int sethostname(const char *name, size_t len)
-{
- sgIP_DNS_Record *rec;
-
- int size = sizeof(dhcp_hostname);
- if (name == NULL)
- return SGIP_ERROR(EFAULT);
-
- if ( len > size - 1)
- return SGIP_ERROR(EINVAL);
-
- rec = sgIP_DNS_FindDNSRecord(dhcp_hostname);
-
- strncpy(dhcp_hostname, name, len);
- dhcp_hostname[len]=0;
- strncpy(rec->aliases[0], name, len);
- rec->aliases[0][len]=0;
- strncpy(rec->name, name, len);
- rec->name[len]=0;
-
- return 0;
-}
-
-
-
-
-
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DHCP.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DHCP.h
deleted file mode 100644
index ba980af362..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DHCP.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-#ifndef SGIP_DHCP_H
-#define SGIP_DHCP_H
-
-#include "sgIP_Config.h"
-#include "sgIP_Hub.h"
-
-// "DHCP Server" port is 67, "DHCP Client" port is 68
-// DHCP messages broadcast by a client prior to that client obtaining its IP address must have the source address field in the IP header set to 0.
-
-
-
-typedef struct SGIP_DHCP_PACKET { // yes, freaking big endian prevails here too.
- unsigned char op; // opcode/message type (1=BOOTREQUEST, 2=BOOTREPLY)
- unsigned char htype; // hardware address type
- unsigned char hlen; // Hardware address length (should be 6, for ethernet/wifi)
- unsigned char hops; // set to 0
- unsigned long xid; // 4-byte client specified transaction ID
- unsigned short secs; // seconds elapsed since client started trying to boot
- unsigned short flags; // flags
- unsigned long ciaddr; // client IP address, filled in by client if verifying previous params
- unsigned long yiaddr; // "your" (client) IP address
- unsigned long siaddr; // IP addr of next server to use in bootstrap.
- unsigned long giaddr; // Relay agent IP address
- unsigned char chaddr[16]; // client hardware address
- char sname[64]; // optional server hostname (null terminated string)
- char file[128]; // boot file name, null terminated string
- char options[312]; // optional parameters
-} sgIP_DHCP_Packet;
-
-enum SGIP_DHCP_STATUS {
- SGIP_DHCP_STATUS_IDLE,
- SGIP_DHCP_STATUS_WORKING,
- SGIP_DHCP_STATUS_FAILED,
- SGIP_DHCP_STATUS_SUCCESS
-};
-
-#define DHCP_TYPE_DISCOVER 1
-#define DHCP_TYPE_OFFER 2
-#define DHCP_TYPE_REQUEST 3
-#define DHCP_TYPE_ACK 5
-#define DHCP_TYPE_RELEASE 7
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- void sgIP_DHCP_Init(void);
-
- void sgIP_DHCP_SetHostName(char * s); // just for the fun of it.
- int sgIP_DHCP_IsDhcpIp(unsigned long ip); // check if the IP address was assigned via dhcp.
- void sgIP_DHCP_Start(sgIP_Hub_HWInterface * interface, int getDNS); // begin dhcp transaction to get IP and maybe DNS data.
- void sgIP_DHCP_Release(void); // call to dump our DHCP address and leave.
- int sgIP_DHCP_Update(void); // MUST be called periodicly after _Start; returns status - call until it returns something other than SGIP_DHCP_STATUS_WORKING
- void sgIP_DHCP_Terminate(void); // kill the process where it stands; deallocate all DHCP resources.
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DNS.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DNS.c
deleted file mode 100644
index 432236b205..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DNS.c
+++ /dev/null
@@ -1,492 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include "sgIP_DNS.h"
-#include "sgIP_Hub.h"
-#include "netinet/in.h"
-#include "sys/socket.h"
-
-int dns_sock;
-int time_count;
-int last_id;
-int query_time_start;
-extern unsigned long volatile sgIP_timems;
-
-// cache record data
-sgIP_DNS_Record dnsrecords[SGIP_DNS_MAXRECORDSCACHE];
-
-// data to return via hostent
-volatile sgIP_DNS_Record dnsrecord_return;
-volatile char * alias_list[SGIP_DNS_MAXALIASES+1];
-volatile char * addr_list[SGIP_DNS_MAXRECORDADDRS+1];
-char ipaddr_alias[256];
-unsigned long ipaddr_ip;
-volatile sgIP_DNS_Hostent dnsrecord_hostent;
-
-unsigned char querydata[512];
-unsigned char responsedata[512];
-
-void sgIP_DNS_Init() {
- int i;
- for(i=0;i<SGIP_DNS_MAXRECORDSCACHE;i++) dnsrecords[i].flags=0;
- dns_sock=-1;
- time_count=0;
-}
-
-void sgIP_DNS_Timer1000ms() {
- int i;
- time_count++;
- for(i=0;i<SGIP_DNS_MAXRECORDSCACHE;i++) {
- if(dnsrecords[i].flags & SGIP_DNS_FLAG_RESOLVED) {
- dnsrecords[i].TTL-=1;
- if(dnsrecords[i].TTL<=0) {
- dnsrecords[i].flags=0;
- }
- }
- }
-}
-
-int sgIP_DNS_isipaddress(const char * name, unsigned long * ipdest) {
- int i,j,t,ndot;
- unsigned long out_addr, g[4];
- const char * c;
-
- ndot=0;
- c=name;
- while(*c) { // scan for invalid characters
- if(!((*c>='0' && *c<='9') || (*c>='A' && *c<='F') || (*c>='a' && *c<='f') || *c=='.' || *c=='x' || *c=='X')) return 0;
- if(*c=='.') ndot++;
- c++;
- }
- if(ndot>3) return 0;
- c=name;
- for(i=0;i<=ndot;i++) {
- g[i]=0;
- t=0;
- j=0;
- while(*c && *c!='.') {
- if(j==0 && *c=='0') { t++; }
- else if(j==1 && t==1 && (*c=='x' || *c=='X')) { t++; }
- else {
- switch(t) {
- case 0: // decimal
- if(*c=='x' || *c=='X' || (*c>='A' && *c<='F') || (*c>='a' && *c<='f')) return 0;
- g[i]=(g[i]*10)+(*c-'0');
- break;
- case 1: // octal
- if(*c=='x' || *c=='X' || (*c>='A' && *c<='F') || (*c>='a' && *c<='f') || *c=='8' || *c=='9') return 0;
- g[i]=(g[i]<<3)+(*c-'0');
- break;
- case 2: // hex
- if(*c=='x' || *c=='X') return 0;
- if(*c>='0' && *c<='9') {
- g[i]=(g[i]<<4)+(*c-'0');
- } else {
- g[i]=(g[i]<<4)+(*c&0xDF)+9;
- }
- break;
- }
- }
- j++; c++;
- }
- if(*c) c++; else break;
- }
- out_addr=0;
- switch(ndot) {
- case 0:
- out_addr=g[0];
- break;
- case 1:
- if(g[0]>=0x100 || g[1]>=0x1000000) return 0;
- out_addr= (g[0]<<24) | g[1];
- break;
- case 2:
- if(g[0]>=0x100 || g[1]>=0x100 || g[2]>=0x10000) return 0;
- out_addr= (g[0]<<24) | (g[1]<<16) | g[2];
- break;
- case 3:
- if(g[0]>=0x100 || g[1]>=0x100 || g[2]>=0x100 || g[3]>=0x100) return 0;
- out_addr= (g[0]<<24) | (g[1]<<16) | (g[2]<<8) | g[3];
- break;
- }
- *ipdest=htonl(out_addr);
- return 1;
-}
-
-sgIP_DNS_Record * sgIP_DNS_FindDNSRecord(const char * name) {
- int i,j,k,n,c,c2;
- SGIP_INTR_PROTECT();
- for(i=0;i<SGIP_DNS_MAXRECORDSCACHE;i++) {
- if((dnsrecords[i].flags&(SGIP_DNS_FLAG_ACTIVE|SGIP_DNS_FLAG_RESOLVED)) == (SGIP_DNS_FLAG_ACTIVE|SGIP_DNS_FLAG_RESOLVED)) {
- for(j=0;j<dnsrecords[i].numalias;j++) {
- k=0;
- for(n=0;name[n] && dnsrecords[i].aliases[j][n]; n++) { // obscure and complex case-insensitive string compare.
- c=name[n];
- c2=dnsrecords[i].aliases[j][n];
- if(c>='a' && c<='z') c+='A'-'a';
- if(c2>='a' && c2<='z') c2+='A'-'a';
- if(c==c2) {
- k++;
- } else {
- k=0; break;
- }
- }
- if(name[n] || dnsrecords[i].aliases[j][n]) k=0;
- if(k) {
- SGIP_INTR_UNPROTECT();
- return dnsrecords+i;
- }
- }
- }
- }
-
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-
-sgIP_DNS_Record * sgIP_DNS_GetUnusedRecord() {
- int i,j,minttl;
- SGIP_INTR_PROTECT();
- for(i=0;i<SGIP_DNS_MAXRECORDSCACHE;i++) {
- if(!(dnsrecords[i].flags&SGIP_DNS_FLAG_ACTIVE)) {
- SGIP_INTR_UNPROTECT();
- return dnsrecords+i;
- }
- }
- minttl=dnsrecords[0].TTL; j=0;
- for(i=1;i<SGIP_DNS_MAXRECORDSCACHE;i++) {
- if(dnsrecords[i].TTL<minttl && !(dnsrecords[i].flags&SGIP_DNS_FLAG_BUSY)) {
- j=i;
- minttl=dnsrecords[i].TTL;
- }
- }
- dnsrecords[j].flags=0;
- SGIP_INTR_UNPROTECT();
- return dnsrecords+j;
-}
-
-static
-void sgIP_ntoa(unsigned long ipaddr) {
- int c,i,j,n;
- c=0;
- for(j=0;j<4;j++) {
- if(j) ipaddr_alias[c++]='.';
- n=(ipaddr>>(j*8))&255;
- i=0;
- if(n>=100) { i=n/100; ipaddr_alias[c++]='0'+i; n-=i*100; }
- if(n>=10 || i) { i=n/10; ipaddr_alias[c++]='0'+i; n-=i*10; }
- ipaddr_alias[c++]='0'+n;
- }
- ipaddr_alias[c]=0;
-}
-
-static
-sgIP_DNS_Hostent * sgIP_DNS_GenerateHostentIP(unsigned long ipaddr) {
-
- sgIP_ntoa(ipaddr);
-
- alias_list[0]=ipaddr_alias;
- alias_list[1]=0;
- ipaddr_ip=ipaddr;
- addr_list[0]=(char *)&ipaddr_ip;
- addr_list[1]=0;
-
- dnsrecord_hostent.h_addr_list=(char **)addr_list;
- dnsrecord_hostent.h_addrtype=1;
- dnsrecord_hostent.h_aliases=(char **)alias_list;
- dnsrecord_hostent.h_length=4;
- dnsrecord_hostent.h_name=ipaddr_alias;
- return (sgIP_DNS_Hostent *)&dnsrecord_hostent;
-}
-
-sgIP_DNS_Hostent * sgIP_DNS_GenerateHostent(sgIP_DNS_Record * dnsrec) {
- volatile int i;
- dnsrecord_return = *dnsrec; // copy struct
- for(i=0;i<dnsrecord_return.numalias;i++) {
- alias_list[i]=dnsrecord_return.aliases[i];
- }
- alias_list[i]=0;
- for(i=0;i<dnsrecord_return.numaddr;i++) {
- addr_list[i]=(char *)&(dnsrecord_return.addrdata[i*dnsrecord_return.addrlen]);
- }
- addr_list[i]=0;
- dnsrecord_hostent.h_addr_list=(char **)addr_list;
- dnsrecord_hostent.h_addrtype=dnsrecord_return.addrclass;
- dnsrecord_hostent.h_aliases=(char **)alias_list;
- dnsrecord_hostent.h_length=dnsrecord_return.addrlen;
- dnsrecord_hostent.h_name=(char *)dnsrecord_return.name;
- return (sgIP_DNS_Hostent *)&dnsrecord_hostent;
-}
-
-static
-int sgIP_DNS_genquery(const char * name) {
- int i,j,c,l;
- unsigned short * querydata_s = (unsigned short *) querydata;
- unsigned char * querydata_c = querydata;
- // header section
- querydata_s[0]=htons(time_count&0xFFFF);
- last_id=querydata_s[0];
- querydata_s[1]=htons(0x0100); // recursion desired, standard query
- querydata_s[2]=htons(1); // one QD (question)
- querydata_s[3]=0; // no resource records
- querydata_s[4]=0; // no nameserver records
- querydata_s[5]=0; // no additional records
- // question section
-
- querydata_c+=12;
- querydata_s+=6;
- j=0;
- i=0;
- while(1) {
- l=j;
- j++;
- c=0;
- while(name[i]!=0 && name[i]!='.' && i<255) {
- querydata_c[j++]=name[i++]; c++;
- }
- querydata_c[l]=c;
- if(name[i]==0 || i>=255) break;
- if(c==0) return 0; // this should never happen (unless there's really invalid input with 2 dots next to each other.)
- i++;
- }
- querydata_c[j++]=0; // terminating zero length
- // qtype
- querydata_c[j++]=0;
- querydata_c[j++]=1; // 00 01 "A" (address)
- // qclass
- querydata_c[j++]=0;
- querydata_c[j++]=1; // 00 01 "IN" (internet)
-
- return j+12; // length
-}
-
-void sgIP_DNS_CopyAliasAt(char * deststr,int offset) {
- char * c;
- int i,j;
- i=0;
- c=(char *)responsedata+offset;
- do {
- j=c[0];
- if(j>63) {
- j=((j&63)<<8) | c[1];
- c=(char *)responsedata+j;
- continue;
- }
- if(!j) break;
- c++;
- for(;j>0;j--) {
- deststr[i++]= *(c++);
- }
- deststr[i++]='.';
- } while(1);
- if(i>0) i--;
- deststr[i]=0;
-}
-
-
-sgIP_DNS_Hostent * sgIP_DNS_gethostbyname(const char * name) {
- sgIP_DNS_Record * rec;
- sgIP_DNS_Hostent * he;
- sgIP_Hub_HWInterface * hw;
- int len,i,sainlen;
- int retries,dtime;
- unsigned long serverip;
- struct sockaddr_in sain;
- unsigned long IP;
- SGIP_INTR_PROTECT();
-
- // is name an IP address?
- if(sgIP_DNS_isipaddress(name,&IP)) {
- SGIP_INTR_UNPROTECT();
- return sgIP_DNS_GenerateHostentIP(IP);
- }
-
- // check cache, return if value required is in cache...
- rec=sgIP_DNS_FindDNSRecord(name);
- if(rec) {
- he=sgIP_DNS_GenerateHostent(rec);
- SGIP_INTR_UNPROTECT();
- return he;
- }
-
- // not in cache? generate a query...
- len=sgIP_DNS_genquery(name);
-
- // send off the query, handle retransmit and trying other dns servers.
- if(dns_sock==-1) {
- hw=sgIP_Hub_GetDefaultInterface();
- serverip=hw->dns[0];
-
- dns_sock=socket(AF_INET,SOCK_DGRAM,0);
- i=1;
- i=ioctl(dns_sock,FIONBIO,&i); // set non-blocking
-
- retries=0;
- do {
- query_time_start=sgIP_timems;
- sain.sin_addr.s_addr=serverip;
- sain.sin_port=htons(53);
- i=sendto(dns_sock,querydata,len,0,(struct sockaddr *)&sain,sizeof(sain));
-dns_listenonly:
-
- do {
- i=recvfrom(dns_sock,responsedata,512,0,(struct sockaddr *)&sain,&sainlen);
- if(i!=-1) break;
- dtime=sgIP_timems-query_time_start;
- if(dtime>SGIP_DNS_TIMEOUTMS) break;
- SGIP_INTR_UNPROTECT();
- SGIP_WAITEVENT();
- SGIP_INTR_REPROTECT();
- } while(1);
-
- if(i==-1) { // no reply, retry
- retries++;
- if(retries>=SGIP_DNS_MAXRETRY) { // maybe try another server? for now just quit.
- closesocket(dns_sock);
- dns_sock=-1;
- SGIP_INTR_UNPROTECT();
-
- return NULL;
- }
- continue; // send again
- }
-
- // got something, is it what we want?
- if(i<12 || sain.sin_addr.s_addr!=serverip || sain.sin_port!=htons(53)) { // suspicious.
- goto dns_listenonly; // yay! a goto! - go back and see if we can get a more official response.
- }
-
- // parse response.
- {
- const unsigned short * resdata_s = (unsigned short *) responsedata;
- const unsigned char * resdata_c = responsedata;
- const char * c;
- int j,q,a, nalias,naddr;
- if(last_id!=resdata_s[0]) { // bad.
- goto dns_listenonly;
- }
- q=htons(resdata_s[2]);
- a=htons(resdata_s[3]);
- // no answer.
- if (a == 0)
- {
- closesocket(dns_sock);
- dns_sock=-1;
- SGIP_INTR_UNPROTECT();
-
- return NULL;
- }
-
- resdata_c+=12;
- while(q) { // ignore questions
- do {
- j=resdata_c[0];
- if(j>63) { resdata_c+=2; break; }
- resdata_c += j+1;
- } while(j);
- resdata_c+=4;
- q--;
- }
-
- nalias=0;
- naddr=0;
- rec=sgIP_DNS_GetUnusedRecord();
- rec->flags=SGIP_DNS_FLAG_ACTIVE | SGIP_DNS_FLAG_BUSY;
- while(a) {
- if(nalias<SGIP_DNS_MAXALIASES) sgIP_DNS_CopyAliasAt(rec->aliases[nalias++],resdata_c-responsedata);
- do {
- j=resdata_c[0];
- if(j>63) { resdata_c+=2; break; }
- resdata_c += j+1;
- } while(j);
- // CNAME=5, A=1
- j=resdata_c[1];
- rec->addrclass=(resdata_c[2]<<8)|resdata_c[3];
- rec->TTL = (resdata_c[4]<<24)|(resdata_c[5]<<16)|(resdata_c[6]<<8)|resdata_c[7];
- if(j==1) { // A
- if(naddr<SGIP_DNS_MAXRECORDADDRS) {
- rec->addrdata[naddr*4] = resdata_c[10];
- rec->addrdata[naddr*4+1] = resdata_c[11];
- rec->addrdata[naddr*4+2] = resdata_c[12];
- rec->addrdata[naddr*4+3] = resdata_c[13];
- naddr++;
- }
- }
- j=(resdata_c[8]<<8)|resdata_c[9];
- resdata_c+=10+j;
- a--;
- }
-
- // likely we have all the data we care for now.
- rec->addrlen=4;
- rec->numaddr=naddr;
- rec->numalias=nalias;
- for(c=name,i=0;*c;c++,i++) rec->name[i]=*c;
- rec->name[i]=0;
- rec->flags=SGIP_DNS_FLAG_ACTIVE | SGIP_DNS_FLAG_RESOLVED;
- break; // we got our answer, let's get out of here!
- }
- } while(1);
-
- closesocket(dns_sock);
- dns_sock=-1;
- } else {
- SGIP_INTR_UNPROTECT();
- return NULL;
- }
-
- // received response, return data
- he=sgIP_DNS_GenerateHostent(rec);
- SGIP_INTR_UNPROTECT();
- return he;
-}
-
-unsigned long inet_addr(const char *cp) {
- unsigned long IP;
- if(sgIP_DNS_isipaddress(cp,&IP)) {
- return IP;
- }
- return 0xFFFFFFFF;
-}
-
-int inet_aton(const char *cp, struct in_addr *inp) {
- unsigned long IP;
-
- if(sgIP_DNS_isipaddress(cp,&IP)) {
- inp->s_addr = IP;
- return 1;
- }
-
- return 0;
-}
-
-
-char *inet_ntoa(struct in_addr in) {
- sgIP_ntoa(in.s_addr);
- return (char *)ipaddr_alias;
-}
-
-
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DNS.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DNS.h
deleted file mode 100644
index 2b23a2cec0..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_DNS.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-#ifndef SGIP_DNS_H
-#define SGIP_DNS_H
-
-#include "sgIP_Config.h"
-
-#define SGIP_DNS_FLAG_ACTIVE 1
-#define SGIP_DNS_FLAG_RESOLVED 2
-#define SGIP_DNS_FLAG_BUSY 4
-
-typedef struct SGIP_DNS_RECORD {
- char name [256];
- char aliases[SGIP_DNS_MAXALIASES][256];
- unsigned char addrdata[SGIP_DNS_MAXRECORDADDRS*4];
- short addrlen;
- short addrclass;
- int numaddr,numalias;
- int TTL;
- int flags;
-} sgIP_DNS_Record;
-
-typedef struct SGIP_DNS_HOSTENT {
- char * h_name;
- char ** h_aliases;
- int h_addrtype; // class - 1=IN (internet)
- int h_length;
- char ** h_addr_list;
-} sgIP_DNS_Hostent;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void sgIP_DNS_Init(void);
-extern void sgIP_DNS_Timer1000ms(void);
-
-extern sgIP_DNS_Hostent * sgIP_DNS_gethostbyname(const char * name);
-extern sgIP_DNS_Record * sgIP_DNS_GetUnusedRecord(void);
-extern sgIP_DNS_Record * sgIP_DNS_FindDNSRecord(const char * name);
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Hub.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Hub.c
deleted file mode 100644
index e91de87ad4..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Hub.c
+++ /dev/null
@@ -1,211 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-#include "sgIP_Hub.h"
-#include "sgIP_ARP.h"
-
-//////////////////////////////////////////////////////////////////////////
-// Global vars
-
-int NumHWInterfaces;
-int NumProtocolInterfaces;
-sgIP_Hub_Protocol ProtocolInterfaces[SGIP_HUB_MAXPROTOCOLINTERFACES];
-sgIP_Hub_HWInterface HWInterfaces[SGIP_HUB_MAXHWINTERFACES];
-
-
-
-//////////////////////////////////////////////////////////////////////////
-// Private functions
-
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////
-// Public functions
-
-
-void sgIP_Hub_Init() {
- NumHWInterfaces=0;
- NumProtocolInterfaces=0;
-
-}
-
-sgIP_Hub_Protocol * sgIP_Hub_AddProtocolInterface(int protocolID, int (*ReceivePacket)(sgIP_memblock *), int (*InterfaceInit)(sgIP_Hub_Protocol *)) {
- int n;
- if(NumProtocolInterfaces>=SGIP_HUB_MAXPROTOCOLINTERFACES) return 0;
- for(n=0;n<SGIP_HUB_MAXPROTOCOLINTERFACES;n++) {
- if(!(ProtocolInterfaces[n].flags&SGIP_FLAG_PROTOCOL_IN_USE)) break;
- }
- if(n==SGIP_HUB_MAXPROTOCOLINTERFACES) return 0;
-
- ProtocolInterfaces[n].flags=SGIP_FLAG_PROTOCOL_IN_USE | SGIP_FLAG_PROTOCOL_ENABLED;
- ProtocolInterfaces[n].protocol=protocolID;
- ProtocolInterfaces[n].ReceivePacket=ReceivePacket;
- if(InterfaceInit) InterfaceInit(ProtocolInterfaces+n);
- NumProtocolInterfaces++;
- return ProtocolInterfaces+n;
-}
-
-
-sgIP_Hub_HWInterface * sgIP_Hub_AddHardwareInterface(int (*TransmitFunction)(sgIP_Hub_HWInterface *, sgIP_memblock *), int (*InterfaceInit)(sgIP_Hub_HWInterface *)) {
- int n;
- if(NumHWInterfaces>=SGIP_HUB_MAXHWINTERFACES) return 0;
- for(n=0;n<SGIP_HUB_MAXHWINTERFACES;n++) {
- if(!(HWInterfaces[n].flags&SGIP_FLAG_HWINTERFACE_IN_USE)) break;
- }
- if(n==SGIP_HUB_MAXHWINTERFACES) return 0;
-
- HWInterfaces[n].flags = SGIP_FLAG_HWINTERFACE_IN_USE | SGIP_FLAG_HWINTERFACE_ENABLED;
- HWInterfaces[n].TransmitFunction=TransmitFunction;
- if(InterfaceInit) InterfaceInit(HWInterfaces+n);
- NumHWInterfaces++;
- return HWInterfaces+n;
-}
-
-extern void sgIP_Hub_RemoveProtocolInterface(sgIP_Hub_Protocol * protocol) {
- int n;
- for(n=0;n<SGIP_HUB_MAXPROTOCOLINTERFACES;n++) {
- if(ProtocolInterfaces+n ==protocol) break;
- }
- if(n==SGIP_HUB_MAXPROTOCOLINTERFACES) return;
- protocol->flags=0;
- NumProtocolInterfaces--;
-}
-extern void sgIP_Hub_RemoveHardwareInterface(sgIP_Hub_HWInterface * hw) {
- int n;
- for(n=0;n<SGIP_HUB_MAXHWINTERFACES;n++) {
- if(HWInterfaces+n == hw) break;
- }
- if(n==SGIP_HUB_MAXHWINTERFACES) return;
- hw->flags=0;
- NumHWInterfaces--;
-}
-
-int sgIP_Hub_ReceiveHardwarePacket(sgIP_Hub_HWInterface * hw, sgIP_memblock * packet) {
- if(!hw || !packet) return 0;
- if(hw->flags & SGIP_FLAG_HWINTERFACE_ENABLED) {
- int n;
- int protocol;
-
- protocol = ((unsigned short *)packet->datastart)[6];
-// SGIP_DEBUG_MESSAGE(("hub: rx packet %04X %X",protocol,packet->totallength));
- if(protocol==PROTOCOL_ETHER_ARP) { // arp
- sgIP_ARP_ProcessARPFrame(hw,packet);
- return 0;
- }
- if(protocol==PROTOCOL_ETHER_IP) { // IP, forward to the ARP system.
-
- }
-
- // hide ethernet header for higher-level protocols
- sgIP_memblock_exposeheader(packet,-14);
- for(n=0;n<SGIP_HUB_MAXPROTOCOLINTERFACES;n++) {
- if(ProtocolInterfaces[n].flags&SGIP_FLAG_PROTOCOL_ENABLED && ProtocolInterfaces[n].protocol==protocol) { // this protocol handler
- return ProtocolInterfaces[n].ReceivePacket(packet);
- }
- }
- }
- // hrmm, packet is unhandled. Ignore it for now.
- sgIP_memblock_free(packet);
- return 0;
-}
-// send packet from a protocol interface, resolve the requisite hardware interface addresses and send it.
-int sgIP_Hub_SendProtocolPacket(int protocol, sgIP_memblock * packet, unsigned long dest_address, unsigned long src_address) {
- if(!packet) return 0;
- sgIP_Hub_HWInterface * hw;
- int i;
- hw=0;
- // figure out what hardware interface is in use.
- for(i=0;i<SGIP_HUB_MAXHWINTERFACES;i++) if(HWInterfaces[i].ipaddr==src_address) {hw=HWInterfaces+i; break;}
- if(!hw) {
- sgIP_memblock_free(packet);
- return 0;
- }
- // resolve protocol address to hardware address & send packet
- if( (src_address & hw->snmask) == (dest_address & hw->snmask) // on same network
- || dest_address == 0xFFFFFFFF ) // or broadcast address, send directly.
- {
- return sgIP_ARP_SendProtocolFrame(hw,packet,protocol,dest_address);
- } else { // eek, on different network. Send to gateway
- return sgIP_ARP_SendProtocolFrame(hw,packet,protocol,hw->gateway);
- }
-}
-// send packet on a hardware interface.
-int sgIP_Hub_SendRawPacket(sgIP_Hub_HWInterface * hw, sgIP_memblock * packet) {
- if(!hw || !packet) return 0;
- if(hw->flags&SGIP_FLAG_HWINTERFACE_ENABLED) {
- return hw->TransmitFunction(hw,packet);
- }
- sgIP_memblock_free(packet);
- return 0;
-}
-
-int sgIP_Hub_IPMaxMessageSize(unsigned long ipaddr) {
- return SGIP_MTU_OVERRIDE; // hack - make this more accurate soon!
-}
-
-unsigned long sgIP_Hub_GetCompatibleIP(unsigned long destIP) {
- int n;
- for(n=0;n<SGIP_HUB_MAXHWINTERFACES;n++) {
- if((HWInterfaces[n].flags&SGIP_FLAG_HWINTERFACE_IN_USE)) {
- if((HWInterfaces[n].ipaddr & HWInterfaces[n].snmask) == (destIP & HWInterfaces[n].snmask)) return HWInterfaces[n].ipaddr;
- }
- }
- for(n=0;n<SGIP_HUB_MAXHWINTERFACES;n++) {
- if((HWInterfaces[n].flags&SGIP_FLAG_HWINTERFACE_IN_USE)) {
- return HWInterfaces[n].ipaddr;
- }
- }
- return 0;
-}
-
-extern sgIP_Hub_HWInterface * sgIP_Hub_GetDefaultInterface() {
- int n;
- for(n=0;n<SGIP_HUB_MAXHWINTERFACES;n++) {
- if((HWInterfaces[n].flags&SGIP_FLAG_HWINTERFACE_IN_USE)) {
- return HWInterfaces+n;
- }
- }
- return 0;
-}
-
-
-#ifdef SGIP_LITTLEENDIAN
-unsigned short htons(unsigned short num) {
- return ((num<<8)&0xFF00) | (num>>8);
-}
-unsigned long htonl(unsigned long num) {
- return (num<<24) | ((num&0xFF00)<<8) | ((num&0xFF0000)>>8) | (num>>24);
-}
-#else
-unsigned short htons(unsigned short num) {
- return num;
-}
-unsigned long htonl(unsigned long num) {
- return num;
-}
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Hub.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Hub.h
deleted file mode 100644
index f8df3a0cea..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_Hub.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-#ifndef SGIP_HUB_H
-#define SGIP_HUB_H
-
-#include "sgIP_Config.h"
-#include "sgIP_memblock.h"
-
-
-
-#define SGIP_FLAG_PROTOCOL_IN_USE 0x0001
-#define SGIP_FLAG_PROTOCOL_ENABLED 0x8000
-
-#define SGIP_FLAG_HWINTERFACE_IN_USE 0x0001
-#define SGIP_FLAG_HWINTERFACE_CONNECTED 0x0002
-#define SGIP_FLAG_HWINTERFACE_USEDHCP 0x0004
-#define SGIP_FLAG_HWINTERFACE_CHANGENETWORK 0x0008
-#define SGIP_FLAG_HWINTERFACE_ENABLED 0x8000
-
-#ifdef SGIP_LITTLEENDIAN
-#define PROTOCOL_ETHER_ARP 0x0608
-#define PROTOCOL_ETHER_IP 0x0008
-#else
-#define PROTOCOL_ETHER_ARP 0x0806
-#define PROTOCOL_ETHER_IP 0x0800
-#endif
-
-
-// structure sgIP_Hub_Protocol: Used to record the interface between the sgIP Hub and a protocol handler
-typedef struct SGIP_HUB_PROTOCOL {
- unsigned short flags;
- unsigned short protocol;
- int (*ReceivePacket)(sgIP_memblock *);
-
-} sgIP_Hub_Protocol;
-
-typedef struct SGIP_HUB_HWINTERFACE {
- unsigned short flags;
- unsigned short hwaddrlen;
- int MTU;
- int (*TransmitFunction)(struct SGIP_HUB_HWINTERFACE *, sgIP_memblock *);
- void * userdata;
- unsigned long ipaddr, gateway, snmask, dns[3];
- unsigned char hwaddr[SGIP_MAXHWADDRLEN];
-} sgIP_Hub_HWInterface;
-
-typedef struct SGIP_HEADER_ETHERNET {
- unsigned char dest_mac[6];
- unsigned char src_mac[6];
- unsigned short protocol;
-} sgIP_Header_Ethernet;
-
-#define ntohs(num) htons(num)
-#define ntohl(num) htonl(num)
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-extern void sgIP_Hub_Init(void);
-
-
-extern sgIP_Hub_Protocol * sgIP_Hub_AddProtocolInterface(int protocolID, int (*ReceivePacket)(sgIP_memblock *), int (*InterfaceInit)(sgIP_Hub_Protocol *));
-extern sgIP_Hub_HWInterface * sgIP_Hub_AddHardwareInterface(int (*TransmitFunction)(sgIP_Hub_HWInterface *, sgIP_memblock *), int (*InterfaceInit)(sgIP_Hub_HWInterface *));
-extern void sgIP_Hub_RemoveProtocolInterface(sgIP_Hub_Protocol * protocol);
-extern void sgIP_Hub_RemoveHardwareInterface(sgIP_Hub_HWInterface * hw);
-
-extern int sgIP_Hub_ReceiveHardwarePacket(sgIP_Hub_HWInterface * hw, sgIP_memblock * packet);
-extern int sgIP_Hub_SendProtocolPacket(int protocol, sgIP_memblock * packet, unsigned long dest_address, unsigned long src_address);
-extern int sgIP_Hub_SendRawPacket(sgIP_Hub_HWInterface * hw, sgIP_memblock * packet);
-
-extern int sgIP_Hub_IPMaxMessageSize(unsigned long ipaddr);
-unsigned long sgIP_Hub_GetCompatibleIP(unsigned long destIP);
-
-extern sgIP_Hub_HWInterface * sgIP_Hub_GetDefaultInterface(void);
-
-unsigned short htons(unsigned short num);
-unsigned long htonl(unsigned long num);
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ICMP.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ICMP.c
deleted file mode 100644
index 9595d844d3..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ICMP.c
+++ /dev/null
@@ -1,56 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include "sgIP_ICMP.h"
-#include "sgIP_IP.h"
-#include "sgIP_Hub.h"
-
-void sgIP_ICMP_Init() {
-
-}
-
-int sgIP_ICMP_ReceivePacket(sgIP_memblock * mb, unsigned long srcip, unsigned long destip) {
- if(!mb) return 0;
- sgIP_Header_ICMP * icmp;
- icmp = (sgIP_Header_ICMP *) mb->datastart;
- if(icmp->checksum!=0 && sgIP_memblock_IPChecksum(mb,0,mb->totallength)!=0xFFFF) {
- SGIP_DEBUG_MESSAGE(("ICMP receive checksum incorrect"));
- sgIP_memblock_free(mb);
- return 0;
- }
- switch(icmp->type) {
- case 8: // echo request
- icmp->type=0; // change to echo reply
- // mod checksum
- icmp->checksum=0;
- icmp->checksum=~sgIP_memblock_IPChecksum(mb,0,mb->totallength);
- return sgIP_IP_SendViaIP(mb,PROTOCOL_IP_ICMP,destip,srcip);
- case 0: // echo reply (ignore for now)
- default: // others (ignore for now)
- break;
- }
- sgIP_memblock_free(mb);
- return 0;
-}
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ICMP.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ICMP.h
deleted file mode 100644
index e9513b55ba..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_ICMP.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-#ifndef SGIP_ICMP_H
-#define SGIP_ICMP_H
-
-#include "sgIP_Config.h"
-#include "sgIP_memblock.h"
-
-typedef struct SGIP_HEADER_ICMP {
- unsigned char type,code;
- unsigned short checksum;
- unsigned long xtra;
-} sgIP_Header_ICMP;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- extern void sgIP_ICMP_Init(void);
-
- extern int sgIP_ICMP_ReceivePacket(sgIP_memblock * mb, unsigned long srcip, unsigned long destip);
-
-
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_IP.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_IP.c
deleted file mode 100644
index d145ba4d92..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_IP.c
+++ /dev/null
@@ -1,124 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include "sgIP_IP.h"
-#include "sgIP_TCP.h"
-#include "sgIP_UDP.h"
-#include "sgIP_ICMP.h"
-#include "sgIP_Hub.h"
-
-int idnum_count;
-
-int sgIP_IP_ReceivePacket(sgIP_memblock * mb) {
- sgIP_Header_IP * iphdr;
- unsigned short * chksum_calc;
- int chksum_temp;
- int hdrlen;
-
- iphdr=(sgIP_Header_IP *)mb->datastart;
- chksum_calc=(unsigned short *)mb->datastart;
- // check that header is valid:
- hdrlen=iphdr->version_ihl&15;
- // check length...
- if(mb->totallength<htons(iphdr->tot_length)) {
- SGIP_DEBUG_MESSAGE(("IP: bad length!"));
- SGIP_DEBUG_MESSAGE(("-%i/%i",mb->totallength,htons(iphdr->tot_length)));
- sgIP_memblock_free(mb);
- return 0; // bad size.
- }
- sgIP_memblock_trimsize(mb,htons(iphdr->tot_length));
- // check version
- if((iphdr->version_ihl>>4)!=4) {
- SGIP_DEBUG_MESSAGE(("IP: bad version!"));
- sgIP_memblock_free(mb);
- return 0; // bad version.
- }
-
- // check checksum
- chksum_temp=sgIP_memblock_IPChecksum(mb,0,hdrlen*4);
- if(chksum_temp!=0xFFFF) { // bad chksum! kill packet.
- SGIP_DEBUG_MESSAGE(("IP: bad checksum!"));
- sgIP_memblock_free(mb);
- return 0; // bad checksum.
- }
- if(htons(iphdr->fragment_offset)&0x3FFF) { // fragmented! oh noes! We can't deal with this!
- SGIP_DEBUG_MESSAGE(("IP: fragmented!"));
- sgIP_memblock_free(mb);
- return 0; // fragmented.
- }
-
- sgIP_memblock_exposeheader(mb,-hdrlen*4);
- switch(iphdr->protocol) {
- case PROTOCOL_IP_ICMP: // ICMP
- sgIP_ICMP_ReceivePacket(mb,iphdr->src_address,iphdr->dest_address);
- break;
- case PROTOCOL_IP_TCP: // TCP
- sgIP_TCP_ReceivePacket(mb,iphdr->src_address,iphdr->dest_address);
- break;
- case PROTOCOL_IP_UDP: // UDP
- sgIP_UDP_ReceivePacket(mb,iphdr->src_address,iphdr->dest_address);
- break;
- default:
- sgIP_memblock_free(mb);
- }
-
- return 0;
-}
-int sgIP_IP_MaxContentsSize(unsigned long destip) {
- return sgIP_Hub_IPMaxMessageSize(destip)-sgIP_IP_RequiredHeaderSize();
-}
-int sgIP_IP_RequiredHeaderSize() {
- return 5*4; // we'll not include zeroed options.
-}
-int sgIP_IP_SendViaIP(sgIP_memblock * mb, int protocol, unsigned long srcip, unsigned long destip) {
- sgIP_Header_IP * iphdr;
- unsigned short * chksum_calc;
- int chksum_temp,i;
- sgIP_memblock_exposeheader(mb,20);
- iphdr=(sgIP_Header_IP *)mb->datastart;
- chksum_calc=(unsigned short *)mb->datastart;
- iphdr->dest_address=destip;
- iphdr->fragment_offset=0;
- iphdr->header_checksum=0;
- iphdr->identification=idnum_count++;
- iphdr->protocol=protocol;
- iphdr->src_address=srcip;
- iphdr->tot_length=htons(mb->totallength);
- iphdr->TTL=SGIP_IP_TTL;
- iphdr->type_of_service=0;
- iphdr->version_ihl=0x45;
- chksum_temp=0;
- for(i=0;i<10;i++) chksum_temp+=chksum_calc[i];
- chksum_temp += chksum_temp>>16;
- chksum_temp &= 0xFFFF;
- chksum_temp = ~chksum_temp;
- if(chksum_temp==0) chksum_temp=0xFFFF;
- iphdr->header_checksum=chksum_temp;
- return sgIP_Hub_SendProtocolPacket(htons(0x0800),mb,destip,srcip);
-}
-unsigned long sgIP_IP_GetLocalBindAddr(unsigned long srcip, unsigned long destip) {
- if(srcip) return srcip;
- return sgIP_Hub_GetCompatibleIP(destip);
-}
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_IP.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_IP.h
deleted file mode 100644
index d6b047429d..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_IP.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-#ifndef SGIP_IP_H
-#define SGIP_IP_H
-
-#include "sgIP_memblock.h"
-
-#define PROTOCOL_IP_ICMP 1
-#define PROTOCOL_IP_TCP 6
-#define PROTOCOL_IP_UDP 17
-
-typedef struct SGIP_HEADER_IP {
- unsigned char version_ihl; // version = top 4 bits == 4, IHL = header length in 32bit increments = bottom 4 bits
- unsigned char type_of_service; // [3bit prescidence][ D ][ T ][ R ][ 0 0 ] - D=low delya, T=high thoroughput, R= high reliability
- unsigned short tot_length; // total length of packet including header
- unsigned short identification; // value assigned by sender to aid in packet reassembly
- unsigned short fragment_offset; // top 3 bits are flags [0][DF][MF] (Don't Fragment / More Fragments Exist) - offset is in 8-byte chunks.
- unsigned char TTL; // time to live, measured in hops
- unsigned char protocol; // protocols: ICMP=1, TCP=6, UDP=17
- unsigned short header_checksum; // checksum:
- unsigned long src_address; // src address is 32bit IP address
- unsigned long dest_address; // dest address is 32bit IP address
- unsigned char options[4]; // optional options come here.
-} sgIP_Header_IP;
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- extern int sgIP_IP_ReceivePacket(sgIP_memblock * mb);
- extern int sgIP_IP_MaxContentsSize(unsigned long destip);
- extern int sgIP_IP_RequiredHeaderSize(void);
- extern int sgIP_IP_SendViaIP(sgIP_memblock * mb, int protocol, unsigned long srcip, unsigned long destip);
- extern unsigned long sgIP_IP_GetLocalBindAddr(unsigned long srcip, unsigned long destip);
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_TCP.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_TCP.c
deleted file mode 100644
index 92e63ec6ba..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_TCP.c
+++ /dev/null
@@ -1,915 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include "sgIP_TCP.h"
-#include "sgIP_IP.h"
-#include "sgIP_Hub.h"
-#include "sys/socket.h"
-
-sgIP_Record_TCP * tcprecords;
-int port_counter;
-unsigned long lasttime;
-extern unsigned long volatile sgIP_timems;
-sgIP_TCP_SYNCookie synlist[SGIP_TCP_MAXSYNS];
-
-int numsynlist; // number of active entries in synlist (earliest first)
-
-void sgIP_TCP_Init() {
- tcprecords=0;
- numsynlist=0;
- port_counter=SGIP_TCP_FIRSTOUTGOINGPORT;
- lasttime=sgIP_timems;
-}
-
-void sgIP_TCP_Timer() { // scan through tcp records and resend anything necessary
- sgIP_Record_TCP * rec;
- int time,i,j;
- time=sgIP_timems-lasttime;
- lasttime=sgIP_timems;
- for(i=0;i<numsynlist;i++) {
- if(synlist[i].timenext<=time) {
- j=time-synlist[i].timenext;
- synlist[i].timebackoff*=2;
- if(synlist[i].timebackoff>SGIP_TCP_BACKOFFMAX) synlist[i].timebackoff=SGIP_TCP_BACKOFFMAX;
- if(j>synlist[i].timebackoff) synlist[i].timenext=0; else synlist[i].timenext=synlist[i].timebackoff-j;
- // resend SYN
- sgIP_TCP_SendSynReply(SGIP_TCP_FLAG_SYN|SGIP_TCP_FLAG_ACK,synlist[i].localseq,synlist[i].remoteseq,synlist[i].localip,synlist[i].remoteip,synlist[i].localport,synlist[i].remoteport,-1);
- } else {
- synlist[i].timenext-=time;
- }
- }
- rec=tcprecords;
- while(rec) {
- time=sgIP_timems-rec->time_last_action;
- switch(rec->tcpstate) {
- case SGIP_TCP_STATE_NODATA: // newly allocated [do nothing]
- case SGIP_TCP_STATE_UNUSED: // allocated & BINDed [do nothing]
- case SGIP_TCP_STATE_CLOSED: // Block is unused. [do nothing]
- case SGIP_TCP_STATE_LISTEN: // listening [do nothing]
- case SGIP_TCP_STATE_FIN_WAIT_2: // got ACK for our FIN, haven't got FIN yet. [do nothing]
- break;
- case SGIP_TCP_STATE_SYN_SENT: // connect initiated [resend syn]
- if(time>rec->time_backoff) {
- rec->retrycount++;
- if(rec->retrycount>=SGIP_TCP_MAXRETRY) {
- //error
- rec->errorcode=ECONNABORTED;
- rec->tcpstate=SGIP_TCP_STATE_CLOSED;
- break;
- }
- j=rec->time_backoff;
- j*=2;
- if(j>SGIP_TCP_BACKOFFMAX) j=SGIP_TCP_BACKOFFMAX;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_SYN,0);
- rec->time_backoff=j; // preserve backoff
- }
- break;
- case SGIP_TCP_STATE_CLOSE_WAIT: // got FIN, wait for user code to close socket & send FIN [do nothing]
- case SGIP_TCP_STATE_ESTABLISHED: // syns have been exchanged [check for data in buffer, send]
- if(rec->want_shutdown==1 && rec->buf_tx_out==rec->buf_tx_in) { // oblige & shutdown
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_FIN | SGIP_TCP_FLAG_ACK,0);
- if(rec->tcpstate==SGIP_TCP_STATE_CLOSE_WAIT) {
- rec->tcpstate=SGIP_TCP_STATE_CLOSING;
- } else {
- rec->tcpstate=SGIP_TCP_STATE_FIN_WAIT_1;
- }
- rec->want_shutdown=2;
- break;
- }
- j=rec->buf_tx_out-rec->buf_tx_in;
- if(j<0) j+=SGIP_TCP_TRANSMITBUFFERLENGTH;
- j+=(int)(rec->sequence-rec->sequence_next);
- if(j>0) {// never-sent bytes
- if(time>SGIP_TCP_TRANSMIT_DELAY) { // 1000 is an arbitrary constant.
- j=rec->buf_tx_out-rec->buf_tx_in;
- if(j<0) j+=SGIP_TCP_TRANSMITBUFFERLENGTH;
- i=(int)(rec->txwindow-rec->sequence);
- if(j>i) j=i;
- i=sgIP_IP_MaxContentsSize(rec->destip)-20; // max tcp data size
- if(j>i) j=i;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,i);
- break;
- }
- }
- if(time>rec->time_backoff && rec->buf_tx_out!=rec->buf_tx_in) { // resend last packet
- j=rec->buf_tx_out-rec->buf_tx_in;
- if(j<0) j+=SGIP_TCP_TRANSMITBUFFERLENGTH;
- i=(int)(rec->txwindow-rec->sequence);
- if(j>i) j=i;
- i=sgIP_IP_MaxContentsSize(rec->destip)-20; // max tcp data size
- if(j>i) j=i;
- j=rec->time_backoff;
- j*=2;
- if(j>SGIP_TCP_BACKOFFMAX) j=SGIP_TCP_BACKOFFMAX;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,i);
- rec->time_backoff=j; // preserve backoff
- break;
- }
- break;
- case SGIP_TCP_STATE_FIN_WAIT_1: // sent a FIN, haven't got FIN or ACK yet. [resend fin]
- if(time>rec->time_backoff) {
- rec->retrycount++;
- if(rec->retrycount>=SGIP_TCP_MAXRETRY) {
- //error
- rec->errorcode=ETIMEDOUT;
- rec->tcpstate=SGIP_TCP_STATE_CLOSED;
- break;
- }
- j=rec->time_backoff;
- j*=2;
- if(j>SGIP_TCP_BACKOFFMAX) j=SGIP_TCP_BACKOFFMAX;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_FIN,0);
- rec->time_backoff=j; // preserve backoff
- }
- break;
- case SGIP_TCP_STATE_CLOSING: // got FIN, waiting for ACK of our FIN [resend FINACK]
- if(time>rec->time_backoff) {
- rec->retrycount++;
- if(rec->retrycount>=SGIP_TCP_MAXRETRY) {
- //error
- rec->errorcode=ETIMEDOUT;
- rec->tcpstate=SGIP_TCP_STATE_CLOSED;
- break;
- }
- j=rec->time_backoff;
- j*=2;
- if(j>SGIP_TCP_BACKOFFMAX) j=SGIP_TCP_BACKOFFMAX;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_FIN | SGIP_TCP_FLAG_ACK,0);
- rec->time_backoff=j; // preserve backoff
- }
- break;
- case SGIP_TCP_STATE_LAST_ACK: // wait for ACK of our last FIN [resend FIN]
- if(time>rec->time_backoff) {
- rec->retrycount++;
- if(rec->retrycount>=SGIP_TCP_MAXRETRY) {
- //error
- rec->errorcode=ETIMEDOUT;
- rec->tcpstate=SGIP_TCP_STATE_CLOSED;
- break;
- }
- j=rec->time_backoff;
- j*=2;
- if(j>SGIP_TCP_BACKOFFMAX) j=SGIP_TCP_BACKOFFMAX;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_FIN,0);
- rec->time_backoff=j; // preserve backoff
- }
- break;
- case SGIP_TCP_STATE_TIME_WAIT: // wait to ensure remote tcp knows it's been terminated. [reset in 2MSL]
- if(time>SGIP_TCP_TIMEMS_2MSL) {
- rec->errorcode=ESHUTDOWN;
- rec->tcpstate=SGIP_TCP_STATE_CLOSED;
- }
- break;
- }
-
-
- rec=rec->next;
- }
-}
-
-
-unsigned long sgIP_TCP_support_seqhash(unsigned long srcip, unsigned long destip, unsigned short srcport, unsigned short destport) {
- unsigned long hash;
- hash=destip;
- hash ^= destport * (0x02041089+sgIP_timems);
- hash ^= srcport * (0x080810422+(sgIP_timems<<1));
- hash ^= srcip * (0x48841221+(sgIP_timems<<3));
- hash ^= destip * (0x04020108+(sgIP_timems<<5));
- return hash;
-}
-int sgIP_TCP_GetUnusedOutgoingPort() {
- int myport,clear;
- sgIP_Record_TCP * rec;
- port_counter+=(sgIP_timems&1023); // semi-random
- if(port_counter>SGIP_TCP_LASTOUTGOINGPORT) port_counter=SGIP_TCP_FIRSTOUTGOINGPORT;
- while(1) {
- rec = tcprecords;
- myport=port_counter++;
- if(port_counter>SGIP_TCP_LASTOUTGOINGPORT) port_counter=SGIP_TCP_FIRSTOUTGOINGPORT;
- clear=1;
- while(rec) {
- if(rec->srcport==myport && rec->tcpstate!=SGIP_TCP_STATE_CLOSED && rec->tcpstate!=SGIP_TCP_STATE_NODATA) { clear=0; break; }
- rec=rec->next;
- }
- if(clear) return myport;
- }
-}
-
-int sgIP_TCP_CalcChecksum(sgIP_memblock * mb, unsigned long srcip, unsigned long destip, int totallength) {
- int checksum;
- if(!mb) return 0;
- if(mb->totallength&1) mb->datastart[mb->totallength]=0;
- checksum=sgIP_memblock_IPChecksum(mb,0,mb->totallength);
- // add in checksum of "faux header"
- checksum+=(destip&0xFFFF);
- checksum+=(destip>>16);
- checksum+=(srcip&0xFFFF);
- checksum+=(srcip>>16);
- checksum+=htons(totallength);
- checksum+=(6)<<8;
- checksum= (checksum&0xFFFF) +(checksum>>16);
- checksum= (checksum&0xFFFF) +(checksum>>16);
-
- return checksum;
-}
-
-
-int sgIP_TCP_ReceivePacket(sgIP_memblock * mb, unsigned long srcip, unsigned long destip) {
- if(!mb) return 0;
- sgIP_Header_TCP * tcp;
- int delta1,delta2, delta3,datalen, shouldReply;
- unsigned long tcpack,tcpseq;
- tcp = (sgIP_Header_TCP *) mb->datastart;
- // 01234567890123456789012345678901
- // TCPxxxxxxxx-xxxxxxxx,xxxx-xxxx
- //SGIP_DEBUG_MESSAGE(("TCP%08X-%08X,%04X-%04X",srcip,destip,tcp->srcport,tcp->destport));
- // -Lxxxx,Cxxxx,Fxx,hx,Axxxxxxxx
- //SGIP_DEBUG_MESSAGE(("-L%04X,C%04X,F%02X,h%X,A%08X",mb->totallength,tcp->checksum,tcp->tcpflags,tcp->dataofs_>>4,tcp->acknum));
- if(tcp->checksum!=0x0000 && sgIP_TCP_CalcChecksum(mb,srcip,destip,mb->totallength)!=0xFFFF) { // checksum is invalid!
- SGIP_DEBUG_MESSAGE(("TCP receive checksum incorrect"));
- sgIP_memblock_free(mb);
- return 0;
- }
- sgIP_Record_TCP * rec;
- rec=tcprecords;
- // find associated block.
- while(rec) {
- if(rec->srcport==tcp->destport && (rec->srcip==destip || rec->srcip==0)) {
- if((rec->tcpstate==SGIP_TCP_STATE_LISTEN && (tcp->tcpflags&SGIP_TCP_FLAG_SYN)) || rec->destport==tcp->srcport) break;
- }
- rec=rec->next;
- }
- if(!rec) { // could be completion of an incoming connection?
- tcpack=htonl(tcp->acknum);
- if(tcp->tcpflags&SGIP_TCP_FLAG_ACK) {
- int i,j;
- for(i=0;i<numsynlist;i++) {
- if(synlist[i].localseq+1==tcpack) { // oki! this is probably legit ;)
- rec=synlist[i].linked; // we have the data we need.
- // remove entry from synlist
- numsynlist--;
- i*=3;
- for(;i<numsynlist;i++) {
- synlist[i]=synlist[i+1]; // assume struct copy
- }
- for(j=0;j<rec->maxlisten;j++) if(!rec->listendata[j]) break; // find last entry in listen queue
- if(j==rec->maxlisten) { rec=0; break; } // discard this connection! we have no space in the listen queue.
-
- rec->listendata[j]=sgIP_TCP_AllocRecord();
- j++;
- if(j!=rec->maxlisten) rec->listendata[j]=0;
-
- rec=rec->listendata[j-1];
-
- // fill in data about the connection.
- rec->tcpstate=SGIP_TCP_STATE_ESTABLISHED;
- rec->time_last_action=sgIP_timems;
- rec->time_backoff=SGIP_TCP_GENRETRYMS; // backoff timer
- rec->srcip=destip;
- rec->destip=srcip;
- rec->srcport=tcp->destport;
- rec->destport=tcp->srcport;
- rec->sequence=htonl(tcp->acknum);
- rec->ack=htonl(tcp->seqnum);
- rec->sequence_next=rec->sequence;
- rec->rxwindow=rec->ack+1400; // last byte in receive window
- rec->txwindow=rec->sequence+htons(tcp->window);
-
- sgIP_memblock_free(mb);
- return 0;
- }
- }
- }
- }
- if(!rec) { // we don't have a clue what this one is.
-#ifndef SGIP_TCP_STEALTH
- // send a RST
- sgIP_TCP_SendSynReply(SGIP_TCP_FLAG_RST,ntohl(tcp->acknum),0,destip,srcip,tcp->destport,tcp->srcport,0);
-#endif
- sgIP_memblock_free(mb);
- return 0;
- }
- // check sequence and ACK numbers, to ensure they're in range.
- tcpack=htonl(tcp->acknum);
- tcpseq=htonl(tcp->seqnum);
- datalen=mb->totallength-(tcp->dataofs_>>4)*4;
- shouldReply=0;
- if(tcp->tcpflags&SGIP_TCP_FLAG_RST) { // verify if rst is legit, and act on it.
- // check seq against receive window
- delta1=(int)(tcpseq-rec->ack);
- delta2=(int)(rec->rxwindow-tcpseq);
- if(delta1<0 || delta2<0 || rec->tcpstate==SGIP_TCP_STATE_LISTEN) {
- // out of range, ignore
- } else {
- // in range! reset connection.
- rec->errorcode=ECONNRESET;
- rec->tcpstate=SGIP_TCP_STATE_CLOSED;
- }
- sgIP_memblock_free(mb);
- return 0;
- }
-
- if((tcp->tcpflags&SGIP_TCP_FLAG_ACK) && !(tcp->tcpflags&SGIP_TCP_FLAG_SYN)) { // doesn't work very well with SYN.
- // verify ack value (checking ack sequence vs transmit window)
- delta1=(int)(tcpack-rec->sequence);
- delta2=(int)(rec->txwindow-tcpack);
- if(delta1<0 || delta2<0) { // invalid ack range, discard packet
- sgIP_memblock_free(mb);
- return 0;
- }
- delta2=tcpack-rec->sequence;
- rec->sequence=tcpack;
- delta2+=rec->buf_tx_in;
- if(delta2>=SGIP_TCP_TRANSMITBUFFERLENGTH) delta2-=SGIP_TCP_TRANSMITBUFFERLENGTH;
- rec->buf_tx_in=delta2;
- if(delta1>0) shouldReply=1;
- }
- rec->txwindow=rec->sequence+htons(tcp->window);
-
- // now, decide what to do with our nice new shiny memblock...
-
- // for most states, receive data
- switch(rec->tcpstate) {
- case SGIP_TCP_STATE_NODATA: // newly allocated
- case SGIP_TCP_STATE_UNUSED: // allocated & BINDed
- case SGIP_TCP_STATE_CLOSED: // Block is unused.
- case SGIP_TCP_STATE_LISTEN: // listening
- case SGIP_TCP_STATE_TIME_WAIT: // wait to ensure remote tcp knows it's been terminated.
- case SGIP_TCP_STATE_SYN_SENT: // connect initiated
- case SGIP_TCP_STATE_CLOSE_WAIT: // got FIN, wait for user code to close socket & send FIN
- case SGIP_TCP_STATE_CLOSING: // got FIN, waiting for ACK of our FIN
- case SGIP_TCP_STATE_LAST_ACK: // wait for ACK of our last FIN
- break;
- case SGIP_TCP_STATE_SYN_RECEIVED: // spawned from listen socket; or from syn sent.
- case SGIP_TCP_STATE_ESTABLISHED: // syns have been exchanged
- case SGIP_TCP_STATE_FIN_WAIT_1: // sent a FIN, haven't got FIN or ACK yet.
- case SGIP_TCP_STATE_FIN_WAIT_2: // got ACK for our FIN, haven't got FIN yet.
- if(tcp->tcpflags&SGIP_TCP_FLAG_ACK) {
- // check end of incoming data against receive window
- delta1=(int)(tcpseq+datalen-rec->ack); // check end of data vs start of window (>=0, end of data is equal to or after start of unreceived data)
- delta2=(int)(rec->rxwindow-tcpseq-datalen); // check end of data vs end of window (>=0, end of data is equal to or before end of rx window)
- delta3=(int)(rec->ack-tcpseq); // check start of data vs start of window (>=0, start of data is equal or before the next expected byte)
- if(delta1<0 || delta2<0 || delta3<0) {
- if(delta1>-SGIP_TCP_RECEIVEBUFFERLENGTH) { // ack it anyway, they got lost on the retard bus.
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0);
- }
- break; // out of range, they should know better.
- }
- {
- int datastart=(tcp->dataofs_>>4)*4;
- delta1=(int)(tcpseq-rec->ack);
- if(delta1<0) { // data is partly ack'd...just copy what we need.
- datastart-=delta1;
- datalen+=delta1;
- }
- // copy data into the fifo
- rec->ack+=datalen;
- delta1=datalen;
- while(datalen>0) { // don't actually need to check the rx buffer length, if the ack check approved it, it will be in range (not overflow) by default
- delta2=SGIP_TCP_RECEIVEBUFFERLENGTH-rec->buf_rx_out; // number of bytes til the end of the buffer
- if(datalen<delta2) delta2=datalen;
- sgIP_memblock_CopyToLinear(mb,rec->buf_rx+rec->buf_rx_out,datastart,delta2);
- datalen-=delta2;
- datastart+=delta2;
- rec->buf_rx_out += delta2;
- if(rec->buf_rx_out>=SGIP_TCP_RECEIVEBUFFERLENGTH) rec->buf_rx_out-=SGIP_TCP_RECEIVEBUFFERLENGTH;
- }
- if(rec->tcpstate==SGIP_TCP_STATE_FIN_WAIT_1 || rec->tcpstate==SGIP_TCP_STATE_FIN_WAIT_2) break;
- if(shouldReply || delta1>=0) { // send a packet in reply, ha!
- delta1=rec->buf_tx_out-rec->buf_tx_in;
- if(delta1<0) delta1+=SGIP_TCP_TRANSMITBUFFERLENGTH;
- delta2=(int)(rec->txwindow-rec->sequence);
- if(delta1>delta2) delta1=delta2;
- delta2=sgIP_IP_MaxContentsSize(rec->destip)-20; // max tcp data size
- if(delta1>delta2) delta1=delta2;
- if(delta1>=0) { // could be less than 0, but very odd.
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,delta1);
- }
- }
- }
- }
- }
-
- // decide what to do with the others
- switch(rec->tcpstate) {
- case SGIP_TCP_STATE_NODATA: // newly allocated
- case SGIP_TCP_STATE_UNUSED: // allocated & BINDed
- case SGIP_TCP_STATE_CLOSED: // Block is unused.
- break; // can't do anything in these states.
- case SGIP_TCP_STATE_LISTEN: // listening
- if(tcp->tcpflags&SGIP_TCP_FLAG_SYN) { // other end requesting a connection
- if(numsynlist==SGIP_TCP_MAXSYNS) {
- numsynlist--;
- for(delta1=0;delta1<numsynlist;delta1++) {
- synlist[delta1]=synlist[delta1+1]; // assume struct copy
- }
- }
- {
- unsigned long myseq,myport;
- myport=tcp->destport;
- myseq=sgIP_TCP_support_seqhash(srcip,destip,tcp->srcport,myport);
- // send relevant synack
- sgIP_TCP_SendSynReply(SGIP_TCP_FLAG_SYN|SGIP_TCP_FLAG_ACK,myseq,tcpseq+1,destip,srcip,myport,tcp->srcport,-1);
- synlist[numsynlist].localseq=myseq;
- synlist[numsynlist].timebackoff=SGIP_TCP_SYNRETRYMS;
- synlist[numsynlist].timenext=SGIP_TCP_SYNRETRYMS;
- synlist[numsynlist].linked=rec;
- synlist[numsynlist].remoteseq=tcpseq+1;
- synlist[numsynlist].remoteip=srcip;
- synlist[numsynlist].localip=destip;
- synlist[numsynlist].localport=myport;
- synlist[numsynlist].remoteport=tcp->srcport;
- numsynlist++;
- }
- }
- break;
- case SGIP_TCP_STATE_SYN_SENT: // connect initiated
- switch(tcp->tcpflags&(SGIP_TCP_FLAG_SYN|SGIP_TCP_FLAG_ACK)) {
- case SGIP_TCP_FLAG_SYN | SGIP_TCP_FLAG_ACK: // both flags set
- rec->ack=tcpseq+1;
- rec->sequence=tcpack;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0);
- rec->tcpstate=SGIP_TCP_STATE_ESTABLISHED;
- rec->retrycount=0;
- break;
- case SGIP_TCP_FLAG_SYN: // just got a syn...
- rec->ack=tcpseq+1;
- rec->sequence=tcpack;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0);
- rec->tcpstate=SGIP_TCP_STATE_SYN_RECEIVED;
- rec->retrycount=0;
- break;
- }
- break;
- case SGIP_TCP_STATE_SYN_RECEIVED: // spawned from listen socket; or from syn sent.
- if(tcp->tcpflags&SGIP_TCP_FLAG_ACK) {
- rec->tcpstate=SGIP_TCP_STATE_ESTABLISHED;
- rec->retrycount=0;
- }
- break;
- case SGIP_TCP_STATE_ESTABLISHED: // syns have been exchanged
- if(tcp->tcpflags&SGIP_TCP_FLAG_FIN) {
- // check sequence against next ack number
- delta1=(int)(tcpseq-rec->ack);
- //delta2=(int)(rec->rxwindow-tcpseq);
- if(delta1<0 || delta1>0) break; // out of range, they should know better.
- // this is the end...
- rec->tcpstate=SGIP_TCP_STATE_CLOSE_WAIT;
- rec->ack=tcpseq+datalen+1;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0);
-
- }
- break;
- case SGIP_TCP_STATE_FIN_WAIT_1: // sent a FIN, haven't got FIN or ACK yet.
- switch(tcp->tcpflags&(SGIP_TCP_FLAG_FIN|SGIP_TCP_FLAG_ACK)) {
- case SGIP_TCP_FLAG_FIN:
- // check sequence against next ack number
- delta1=(int)(tcpseq-rec->ack);
- //delta2=(int)(rec->rxwindow-tcpseq);
- if(delta1<0 || delta1>0) break; // out of range, they should know better.
-
- rec->tcpstate=SGIP_TCP_STATE_CLOSING;
- rec->ack=tcpseq+datalen+1;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0);
- break;
- case SGIP_TCP_FLAG_ACK: // already checked ack against appropriate window
- rec->tcpstate=SGIP_TCP_STATE_FIN_WAIT_2;
- break;
- case (SGIP_TCP_FLAG_FIN | SGIP_TCP_FLAG_ACK): // already checked ack, check sequence though
- // check sequence against next ack number
- delta1=(int)(tcpseq-rec->ack);
- //delta2=(int)(rec->rxwindow-tcpseq);
- if(delta1<0 || delta1>0) break; // out of range, they should know better.
- rec->tcpstate=SGIP_TCP_STATE_TIME_WAIT;
- rec->ack=tcpseq+datalen+1;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0);
- break;
- }
- break;
- case SGIP_TCP_STATE_FIN_WAIT_2: // got ACK for our FIN, haven't got FIN yet.
- if(tcp->tcpflags&SGIP_TCP_FLAG_FIN) {
- // check sequence against next ack number
- delta1=(int)(tcpseq-rec->ack);
- //delta2=(int)(rec->rxwindow-tcpseq);
- if(delta1<0 || delta1>0) break; // out of range, they should know better.
-
- rec->tcpstate=SGIP_TCP_STATE_TIME_WAIT;
- rec->ack=tcpseq+datalen+1;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0);
- }
- break;
- case SGIP_TCP_STATE_CLOSE_WAIT: // got FIN, wait for user code to close socket & send FIN
- if(tcp->tcpflags&SGIP_TCP_FLAG_FIN) {
- // check sequence against next ack number
- delta1=(int)(tcpseq-rec->ack);
- //delta2=(int)(rec->rxwindow-tcpseq);
- if(delta1<0 || delta1>0) break; // out of range, they should know better.
-
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0); // they still don't seem to have got our ack, we'll send it again.
- }
- break;
- case SGIP_TCP_STATE_CLOSING: // got FIN, waiting for ACK of our FIN
- switch(tcp->tcpflags&(SGIP_TCP_FLAG_FIN|SGIP_TCP_FLAG_ACK)) {
- case SGIP_TCP_FLAG_FIN:
- // check sequence against receive window
- delta1=(int)(tcpseq-rec->ack);
- delta2=(int)(rec->rxwindow-tcpseq);
- if(delta1<1 || delta2<0) break; // out of range, they should know better.
-
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0); // resend their ack.
- break;
- case SGIP_TCP_FLAG_ACK: // already checked ack against appropriate window
- rec->tcpstate=SGIP_TCP_STATE_TIME_WAIT;
- break;
- case (SGIP_TCP_FLAG_FIN | SGIP_TCP_FLAG_ACK): // already checked ack, check sequence though
- // check sequence against receive window
- delta1=(int)(tcpseq-rec->ack);
- delta2=(int)(rec->rxwindow-tcpseq);
- if(delta1<1 || delta2<0) break; // out of range, they should know better.
- rec->tcpstate=SGIP_TCP_STATE_TIME_WAIT;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0);
- break;
- }
- break;
-
- case SGIP_TCP_STATE_LAST_ACK: // wait for ACK of our last FIN
- if(tcp->tcpflags&SGIP_TCP_FLAG_ACK) {
- rec->tcpstate=SGIP_TCP_STATE_TIME_WAIT;
- }
- break;
- case SGIP_TCP_STATE_TIME_WAIT: // wait to ensure remote tcp knows it's been terminated.
- if(tcp->tcpflags&SGIP_TCP_FLAG_FIN) {
- // check sequence against receive window
- delta1=(int)(tcpseq-rec->ack);
- delta2=(int)(rec->rxwindow-tcpseq);
- if(delta1<1 || delta2<0) break; // out of range, they should know better.
-
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0); // send 'em a grat ACK
- }
- break;
- }
- sgIP_memblock_free(mb);
- return 0;
-}
-
-sgIP_memblock * sgIP_TCP_GenHeader(sgIP_Record_TCP * rec, int flags, int datalength) {
- sgIP_memblock * mb = sgIP_memblock_alloc(datalength+20+sgIP_IP_RequiredHeaderSize());
- int windowlen;
- if(!mb) return 0;
- sgIP_memblock_exposeheader(mb,-sgIP_IP_RequiredHeaderSize()); // hide IP header space for later
- sgIP_Header_TCP * tcp = (sgIP_Header_TCP *) mb->datastart;
- tcp->srcport=rec->srcport;
- tcp->destport=rec->destport;
- tcp->seqnum=htonl(rec->sequence);
- tcp->acknum=htonl(rec->ack);
- tcp->tcpflags=flags;
- tcp->urg_ptr=0; // no support for URG data atm.
- tcp->checksum=0;
- tcp->dataofs_=5<<4; // header length == 20 (5*32bit)
- windowlen=rec->buf_rx_out-rec->buf_rx_in;
- if(windowlen<0) windowlen+=SGIP_TCP_RECEIVEBUFFERLENGTH; // we now have the amount in the buffer
- windowlen = SGIP_TCP_RECEIVEBUFFERLENGTH-windowlen-1;
- if(windowlen<0) windowlen=0;
- if(flags&SGIP_TCP_FLAG_ACK) rec->want_reack = windowlen<SGIP_TCP_REACK_THRESH; // indicate an additional ack should be sent when we have more space in the buffer.
- if(windowlen>65535) windowlen=65535;
- if(windowlen>1400) windowlen=1400; // don't want to deal with IP fragmentation.
- rec->rxwindow=rec->ack+windowlen; // last byte in receive window
- tcp->window=htons(windowlen);
- return mb;
-}
-void sgIP_TCP_FixChecksum(unsigned long srcip, unsigned long destip, sgIP_memblock * mb) {
- int checksum;
- if(!mb) return;
- sgIP_Header_TCP * tcp;
- tcp = (sgIP_Header_TCP *) mb->datastart;
- tcp->checksum=0;
- checksum=sgIP_memblock_IPChecksum(mb,0,mb->totallength);
-
- // add in checksum of "faux header"
- checksum+=(destip&0xFFFF);
- checksum+=(destip>>16);
- checksum+=(srcip&0xFFFF);
- checksum+=(srcip>>16);
- checksum+=htons(mb->totallength);
- checksum+=(6)<<8;
- checksum=(checksum&0xFFFF) + (checksum>>16);
- checksum=(checksum&0xFFFF) + (checksum>>16);
-
- checksum = ~checksum;
- if(checksum==0) checksum=0xFFFF;
- tcp->checksum=checksum;
-}
-
-int sgIP_TCP_SendPacket(sgIP_Record_TCP * rec, int flags, int datalength) { // data sent is taken directly from the TX fifo.
- int i,j,k;
- if(!rec) return 0;
- SGIP_INTR_PROTECT();
-
- j=rec->buf_tx_out-rec->buf_tx_in;
- if(j<0) j+=SGIP_TCP_TRANSMITBUFFERLENGTH;
- if(datalength>j) datalength=j;
- sgIP_memblock * mb =sgIP_TCP_GenHeader(rec,flags,datalength);
- if(!mb) {
- SGIP_INTR_UNPROTECT();
- return 0;
- }
- j=20; // destination offset in memblock for data
- rec->sequence_next=rec->sequence+datalength;
- k=rec->buf_tx_in;
- while(datalength>0) {
- i=SGIP_TCP_TRANSMITBUFFERLENGTH-rec->buf_tx_in;
- if(i>datalength)i=datalength;
- sgIP_memblock_CopyFromLinear(mb,rec->buf_tx+k,j,i);
- k+=i;
- if(k>=SGIP_TCP_TRANSMITBUFFERLENGTH) k-=SGIP_TCP_TRANSMITBUFFERLENGTH;
- j+=i;
- datalength-=i;
- }
-
- sgIP_TCP_FixChecksum(rec->srcip,rec->destip,mb);
- sgIP_IP_SendViaIP(mb,6,rec->srcip,rec->destip);
-
- rec->time_last_action=sgIP_timems; // semi-generic timer.
- rec->time_backoff=SGIP_TCP_GENRETRYMS; // backoff timer
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-
-int sgIP_TCP_SendSynReply(int flags,unsigned long seq, unsigned long ack, unsigned long srcip, unsigned long destip, int srcport, int destport, int windowlen) {
- SGIP_INTR_PROTECT();
-
- sgIP_memblock * mb = sgIP_memblock_alloc(20+sgIP_IP_RequiredHeaderSize());
- if(!mb) {
- SGIP_INTR_UNPROTECT();
- return 0;
- }
- sgIP_memblock_exposeheader(mb,-sgIP_IP_RequiredHeaderSize()); // hide IP header space for later
- sgIP_Header_TCP * tcp = (sgIP_Header_TCP *) mb->datastart;
- tcp->srcport=srcport;
- tcp->destport=destport;
- tcp->seqnum=htonl(seq);
- tcp->acknum=htonl(ack);
- tcp->tcpflags=flags;
- tcp->urg_ptr=0; // no support for URG data atm.
- tcp->checksum=0;
- tcp->dataofs_=5<<4; // header length == 20 (5*32bit)
-
- if(windowlen<0 || windowlen>1400) windowlen=1400; // don't want to deal with IP fragmentation.
- tcp->window=htons(windowlen);
-
- sgIP_TCP_FixChecksum(srcip,destip,mb);
- sgIP_IP_SendViaIP(mb,6,srcip,destip);
-
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-
-sgIP_Record_TCP * sgIP_TCP_AllocRecord() {
- SGIP_INTR_PROTECT();
- sgIP_Record_TCP * rec;
- rec = sgIP_malloc(sizeof(sgIP_Record_TCP));
- if(rec) {
- rec->buf_oob_in=0;
- rec->buf_oob_out=0;
- rec->buf_rx_in=0;
- rec->buf_rx_out=0;
- rec->buf_tx_in=0;
- rec->buf_tx_out=0;
- rec->tcpstate=0;
- rec->next=tcprecords;
- tcprecords=rec;
- rec->maxlisten=0;
- rec->srcip=0;
- rec->retrycount=0;
- rec->errorcode=0;
- rec->listendata=0;
- rec->want_shutdown=0;
- rec->want_reack=0;
- }
- SGIP_INTR_UNPROTECT();
- return rec;
-}
-void sgIP_TCP_FreeRecord(sgIP_Record_TCP * rec) {
- if(!rec) return;
- SGIP_INTR_PROTECT();
- sgIP_Record_TCP * t;
- int i,j;
- rec->tcpstate=0;
- if(tcprecords==rec) {
- tcprecords=rec->next;
- } else {
- t=tcprecords;
- while(t) {
- if(t->next==rec) {
- t->next=rec->next;
- break;
- }
- t=t->next;
- }
- }
- if(rec->listendata) {
- for(i=0;i<rec->maxlisten;i++) {
- if(!rec->listendata[i]) break;
- sgIP_TCP_FreeRecord(rec->listendata[i]);
- }
- // kill any possible waiting elements in the SYN chain.
- j=0;
- for(i=0;i<numsynlist;i++) {
- if(j!=i) {
- synlist[j]=synlist[i];
- }
- if(synlist[i].linked==rec) j--;
- j++;
- }
- numsynlist=j;
- sgIP_free(rec->listendata);
- }
- sgIP_free(rec);
-
- SGIP_INTR_UNPROTECT();
-}
-
-int sgIP_TCP_Bind(sgIP_Record_TCP * rec, int srcport, unsigned long srcip) {
- if(!rec) return 0;
- SGIP_INTR_PROTECT();
- if(rec->tcpstate==SGIP_TCP_STATE_NODATA) {
- rec->srcip=srcip;
- rec->srcport=srcport;
- rec->tcpstate=SGIP_TCP_STATE_UNUSED;
- }
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-int sgIP_TCP_Listen(sgIP_Record_TCP * rec, int maxlisten) {
- if(!rec) return SGIP_ERROR(EINVAL);
- if(rec->tcpstate!=SGIP_TCP_STATE_UNUSED) return SGIP_ERROR(EINVAL);
- int err;
- SGIP_INTR_PROTECT();
- if(rec->maxlisten!=0) { // we're *already* listening.
- err=0;
- } else {
- err=0;
- if(maxlisten<=0) maxlisten=1;
- rec->maxlisten=maxlisten;
- rec->listendata = (sgIP_Record_TCP **) sgIP_malloc(maxlisten*4); // pointers to TCP records, 0-terminated list.
- if(!rec->listendata) { rec->maxlisten=0; err=0; } else {rec->tcpstate=SGIP_TCP_STATE_LISTEN; rec->listendata[0]=0;}
- }
- SGIP_INTR_UNPROTECT();
- return err;
-}
-
-sgIP_Record_TCP * sgIP_TCP_Accept(sgIP_Record_TCP * rec) {
- if(!rec) return (sgIP_Record_TCP *)SGIP_ERROR0(EINVAL);
- if(rec->tcpstate!=SGIP_TCP_STATE_LISTEN) return (sgIP_Record_TCP *)SGIP_ERROR0(EINVAL);
- int err,i;
- sgIP_Record_TCP * t;
- SGIP_INTR_PROTECT();
- if(!rec->listendata) err=SGIP_ERROR0(EINVAL);
- else {
- if(!rec->listendata[0]) {
- err=SGIP_ERROR0(EWOULDBLOCK);
- } else {
- t=rec->listendata[0];
- for(i=1;i<rec->maxlisten;i++) {
- rec->listendata[i-1]=rec->listendata[i];
- }
- rec->listendata[i-1]=0;
- SGIP_INTR_UNPROTECT();
- return t;
- }
- }
-
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-
-int sgIP_TCP_Close(sgIP_Record_TCP * rec) {
- if(!rec) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- if(rec->want_shutdown==0) rec->want_shutdown=1;
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-int sgIP_TCP_Connect(sgIP_Record_TCP * rec, unsigned long destip, int destport) {
- if(!rec) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- if(rec->tcpstate==SGIP_TCP_STATE_NODATA) { // need to bind a local address
- rec->srcip=sgIP_IP_GetLocalBindAddr(0,destip);
- rec->srcport=htons(sgIP_TCP_GetUnusedOutgoingPort());
- rec->destip=destip;
- rec->destport=destport;
- } else if(rec->tcpstate==SGIP_TCP_STATE_UNUSED) { // already bound to a local address.
- rec->srcip=sgIP_IP_GetLocalBindAddr(rec->srcip,destip);
- rec->destip=destip;
- rec->destport=destport;
- } else {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(EINVAL);
- }
-
- // send a SYN packet, and advance the state of the connection
- rec->sequence=sgIP_TCP_support_seqhash(rec->srcip,rec->destip,rec->srcport,rec->destport);
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_SYN,0);
- rec->retrycount=0;
- rec->tcpstate=SGIP_TCP_STATE_SYN_SENT;
-
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-int sgIP_TCP_Send(sgIP_Record_TCP * rec, const char * datatosend, int datalength, int flags) {
- if(!rec || !datatosend) return SGIP_ERROR(EINVAL);
- if(rec->want_shutdown) return SGIP_ERROR(ESHUTDOWN);
- SGIP_INTR_PROTECT();
- int bufsize;
- bufsize=rec->buf_tx_out-rec->buf_tx_in;
- if(bufsize<0) bufsize+=SGIP_TCP_TRANSMITBUFFERLENGTH;
- if(bufsize==0) { rec->time_last_action=sgIP_timems; rec->time_backoff=SGIP_TCP_GENRETRYMS; } // first byte sent, set up delay before sending
- bufsize=SGIP_TCP_TRANSMITBUFFERLENGTH-bufsize-1; // space left in buffer
- if(datalength>bufsize) datalength=bufsize;
- int i,j;
- j=rec->buf_tx_out;
- for(i=0;i<datalength;i++) {
- rec->buf_tx[j++]=datatosend[i];
- if(j==SGIP_TCP_TRANSMITBUFFERLENGTH) j=0;
- }
- rec->buf_tx_out = j;
- // check for immediate transmit
- j=rec->buf_tx_out-rec->buf_tx_in;
- if(j<0) j+=SGIP_TCP_TRANSMITBUFFERLENGTH;
- j+=(int)(rec->sequence-rec->sequence_next);
- if(j>SGIP_TCP_TRANSMIT_IMMTHRESH && rec->tcpstate==SGIP_TCP_STATE_ESTABLISHED) {
- j=(int)(rec->sequence_next-rec->sequence);
- if(j<1000) { // arbitrary constant.
- j=rec->buf_tx_out-rec->buf_tx_in;
- if(j<0) j+=SGIP_TCP_TRANSMITBUFFERLENGTH;
- i=(int)(rec->txwindow-rec->sequence);
- if(j>i) j=i;
- i=sgIP_IP_MaxContentsSize(rec->destip)-20; // max tcp data size
- if(j>i) j=i;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,i);
- rec->retrycount=0;
- }
- }
- SGIP_INTR_UNPROTECT();
- if(datalength==0) return SGIP_ERROR(EWOULDBLOCK);
- return datalength;
-}
-int sgIP_TCP_Recv(sgIP_Record_TCP * rec, char * databuf, int buflength, int flags) {
- if(!rec || !databuf) return SGIP_ERROR(EINVAL); //error
- if(rec->buf_rx_in==rec->buf_rx_out) {
- if(rec->tcpstate==SGIP_TCP_STATE_CLOSED || rec->tcpstate==SGIP_TCP_STATE_CLOSE_WAIT) {
- if(rec->errorcode) return SGIP_ERROR(rec->errorcode);
- return SGIP_ERROR0(ESHUTDOWN);
- }
- return SGIP_ERROR(EWOULDBLOCK); //error no data
- }
- SGIP_INTR_PROTECT();
- int rxlen = rec->buf_rx_out - rec->buf_rx_in;
- if(rxlen<0) rxlen+=SGIP_TCP_RECEIVEBUFFERLENGTH;
- if(buflength>rxlen) buflength=rxlen;
- int i,j;
- j=rec->buf_rx_in;
- for(i=0;i<buflength;i++) {
- databuf[i]=rec->buf_rx[j++];
- if(j==SGIP_TCP_RECEIVEBUFFERLENGTH) j=0;
- }
-
- if(!(flags&MSG_PEEK)) {
- rec->buf_rx_in=j;
-
- if(rec->want_reack) {
- i=rec->buf_rx_out-rec->buf_rx_in;
- if(i<0) i+=SGIP_TCP_RECEIVEBUFFERLENGTH; // we now have the amount in the buffer
- i = SGIP_TCP_RECEIVEBUFFERLENGTH-i-1;
- if(i<0) i=0;
- if(i>SGIP_TCP_REACK_THRESH) {
- rec->want_reack=0;
- sgIP_TCP_SendPacket(rec,SGIP_TCP_FLAG_ACK,0);
- }
- }
- }
- SGIP_INTR_UNPROTECT();
- return buflength;
-}
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_TCP.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_TCP.h
deleted file mode 100644
index 4e4e649b46..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_TCP.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-#ifndef SGIP_TCP_H
-#define SGIP_TCP_H
-
-#include "sgIP_Config.h"
-#include "sgIP_memblock.h"
-
-enum SGIP_TCP_STATE {
- SGIP_TCP_STATE_NODATA, // newly allocated
- SGIP_TCP_STATE_UNUSED, // allocated & BINDed
- SGIP_TCP_STATE_LISTEN, // listening
- SGIP_TCP_STATE_SYN_SENT, // connect initiated
- SGIP_TCP_STATE_SYN_RECEIVED, // spawned from listen socket;
- SGIP_TCP_STATE_ESTABLISHED, // syns have been exchanged
- SGIP_TCP_STATE_FIN_WAIT_1, // sent a FIN, haven't got FIN or ACK yet.
- SGIP_TCP_STATE_FIN_WAIT_2, // got ACK for our FIN, haven't got FIN yet.
- SGIP_TCP_STATE_CLOSE_WAIT, // got FIN, wait for user code to close socket & send FIN
- SGIP_TCP_STATE_CLOSING, // got FIN, waiting for ACK of our FIN
- SGIP_TCP_STATE_LAST_ACK, // wait for ACK of our last FIN
- SGIP_TCP_STATE_TIME_WAIT, // wait to ensure remote tcp knows it's been terminated.
- SGIP_TCP_STATE_CLOSED, // Block is unused.
-};
-
-
-#define SGIP_TCP_FLAG_FIN 1
-#define SGIP_TCP_FLAG_SYN 2
-#define SGIP_TCP_FLAG_RST 4
-#define SGIP_TCP_FLAG_PSH 8
-#define SGIP_TCP_FLAG_ACK 16
-#define SGIP_TCP_FLAG_URG 32
-
-typedef struct SGIP_HEADER_TCP {
- unsigned short srcport,destport;
- unsigned long seqnum;
- unsigned long acknum;
- unsigned char dataofs_;
- unsigned char tcpflags;
- unsigned short window;
- unsigned short checksum;
- unsigned short urg_ptr;
- unsigned char options[4];
-} sgIP_Header_TCP;
-
-
-// sgIP_Record_TCP - a TCP record, to store data for an active TCP connection.
-typedef struct SGIP_RECORD_TCP {
- struct SGIP_RECORD_TCP * next; // operate as a linked list
- // TCP state information
- int tcpstate;
- unsigned long sequence; // sequence number of first byte not acknowledged by remote system
- unsigned long ack; // external sequence number of next byte to receive
- unsigned long sequence_next; // sequence number of first unsent byte
- unsigned long rxwindow; // sequence of last byte in receive window
- unsigned long txwindow; // sequence of last byte allowed to send
- int time_last_action; // used for retransmission and etc.
- int time_backoff;
- int retrycount;
- unsigned long srcip;
- unsigned long destip;
- unsigned short srcport,destport;
- struct SGIP_RECORD_TCP ** listendata;
- int maxlisten;
- int errorcode;
- int want_shutdown; // 0= don't want shutdown, 1= want shutdown, 2= being shutdown
- int want_reack;
- // TCP buffer information:
- int buf_rx_in, buf_rx_out;
- int buf_tx_in, buf_tx_out;
- int buf_oob_in, buf_oob_out;
- unsigned char buf_rx[SGIP_TCP_RECEIVEBUFFERLENGTH];
- unsigned char buf_tx[SGIP_TCP_TRANSMITBUFFERLENGTH];
- unsigned char buf_oob[SGIP_TCP_OOBBUFFERLENGTH];
-} sgIP_Record_TCP;
-
-typedef struct SGIP_TCP_SYNCOOKIE {
- unsigned long localseq, remoteseq;
- unsigned long localip, remoteip;
- unsigned short localport, remoteport;
- unsigned long timenext,timebackoff;
- sgIP_Record_TCP * linked; // parent listening connection
-} sgIP_TCP_SYNCookie;
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- extern void sgIP_TCP_Init(void);
- extern void sgIP_TCP_Timer(void);
-
- extern int sgIP_TCP_ReceivePacket(sgIP_memblock * mb, unsigned long srcip, unsigned long destip);
- extern int sgIP_TCP_SendPacket(sgIP_Record_TCP * rec, int flags, int datalength); // data sent is taken directly from the TX fifo.
- extern int sgIP_TCP_SendSynReply(int flags,unsigned long seq, unsigned long ack, unsigned long srcip, unsigned long destip, int srcport, int destport, int windowlen);
-
- extern sgIP_Record_TCP * sgIP_TCP_AllocRecord(void);
- extern void sgIP_TCP_FreeRecord(sgIP_Record_TCP * rec);
- extern int sgIP_TCP_Bind(sgIP_Record_TCP * rec, int srcport, unsigned long srcip);
- extern int sgIP_TCP_Listen(sgIP_Record_TCP * rec, int maxlisten);
- extern sgIP_Record_TCP * sgIP_TCP_Accept(sgIP_Record_TCP * rec);
- extern int sgIP_TCP_Close(sgIP_Record_TCP * rec);
- extern int sgIP_TCP_Connect(sgIP_Record_TCP * rec, unsigned long destip, int destport);
- extern int sgIP_TCP_Send(sgIP_Record_TCP * rec, const char * datatosend, int datalength, int flags);
- extern int sgIP_TCP_Recv(sgIP_Record_TCP * rec, char * databuf, int buflength, int flags);
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_UDP.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_UDP.c
deleted file mode 100644
index 9b4ef807cd..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_UDP.c
+++ /dev/null
@@ -1,245 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include "sgIP_Hub.h"
-#include "sgIP_UDP.h"
-#include "sgIP_IP.h"
-
-sgIP_Record_UDP * udprecords;
-int udpport_counter;
-extern unsigned long volatile sgIP_timems;
-
-void sgIP_UDP_Init() {
- udprecords=0;
- udpport_counter=SGIP_UDP_FIRSTOUTGOINGPORT;
-}
-
-
-int sgIP_UDP_GetUnusedOutgoingPort() {
- int myport,clear;
- sgIP_Record_UDP * rec;
- udpport_counter+=(sgIP_timems&1023); // semi-random
- if(udpport_counter>SGIP_UDP_LASTOUTGOINGPORT) udpport_counter=SGIP_UDP_FIRSTOUTGOINGPORT;
- while(1) {
- rec = udprecords;
- myport=udpport_counter++;
- if(udpport_counter>SGIP_UDP_LASTOUTGOINGPORT) udpport_counter=SGIP_UDP_FIRSTOUTGOINGPORT;
- clear=1;
- while(rec) {
- if(rec->srcport==myport) { clear=0; break; }
- rec=rec->next;
- }
- if(clear) return myport;
- }
-}
-
-int sgIP_UDP_CalcChecksum(sgIP_memblock * mb, unsigned long srcip, unsigned long destip, int totallength) {
- int checksum;
- if(!mb) return 0;
- if(mb->totallength&1) mb->datastart[mb->totallength]=0;
- checksum=sgIP_memblock_IPChecksum(mb,0,mb->totallength);
- // add in checksum of "faux header"
- checksum+=(destip&0xFFFF);
- checksum+=(destip>>16);
- checksum+=(srcip&0xFFFF);
- checksum+=(srcip>>16);
- checksum+=htons(totallength);
- checksum+=(17)<<8;
- checksum=(checksum&0xFFFF) + (checksum>>16);
- checksum=(checksum&0xFFFF) + (checksum>>16);
-
- checksum = (~checksum)&0xFFFF;
- if(checksum==0) checksum=0xFFFF;
- return checksum;
-}
-
-int sgIP_UDP_ReceivePacket(sgIP_memblock * mb, unsigned long srcip, unsigned long destip) {
- if(!mb) return 0;
- int chk = sgIP_UDP_CalcChecksum(mb,srcip,destip,mb->totallength);
- if(chk!=0xFFFF) {
- SGIP_DEBUG_MESSAGE(("UDP receive checksum incorrect"));
- sgIP_memblock_free(mb);
- return 0; // checksum error
- }
- sgIP_Header_UDP * udp;
- udp=(sgIP_Header_UDP *)mb->datastart;
- sgIP_Record_UDP * rec;
- sgIP_memblock *tmb;
- SGIP_INTR_PROTECT();
- rec=udprecords;
-
- while(rec) {
- if((rec->srcip==destip || rec->srcip==0) && rec->srcport==udp->destport && rec->state!=SGIP_UDP_STATE_UNUSED) break; // a match!
- rec=rec->next;
- }
- if(!rec) { // no matching records
- sgIP_memblock_free(mb);
- SGIP_INTR_UNPROTECT();
- return 0;
- }
- // we have a record and a packet for it; add some data to the record and stuff it into the record queue.
- sgIP_memblock_exposeheader(mb,4);
- *((unsigned long *)mb->datastart)=srcip; // keep srcip around.
- if(rec->incoming_queue==0) {
- rec->incoming_queue=mb;
- } else {
- rec->incoming_queue_end->next=mb;
- }
-
- tmb=mb;
- while(tmb->next) tmb=tmb->next;
- rec->incoming_queue_end=tmb;
- // ok, data added to queue - yay!
- // that means... we're done.
-
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-
-int sgIP_UDP_SendPacket(sgIP_Record_UDP * rec, const char * data, int datalen, unsigned long destip, int destport) {
- if(!rec || !data) return SGIP_ERROR(EINVAL);
- if(rec->state!=SGIP_UDP_STATE_BOUND) {
- rec->srcip=0;
- rec->srcport=sgIP_UDP_GetUnusedOutgoingPort();
- rec->state=SGIP_UDP_STATE_BOUND;
- }
- sgIP_memblock * mb = sgIP_memblock_alloc(sgIP_IP_RequiredHeaderSize()+8+datalen);
- if(!mb) return SGIP_ERROR(ENOMEM);
- sgIP_memblock_exposeheader(mb,-sgIP_IP_RequiredHeaderSize()); // hide IP header space for later
-
- SGIP_INTR_PROTECT();
- unsigned long srcip = sgIP_IP_GetLocalBindAddr(rec->srcip,destip);
- sgIP_Header_UDP * udp = (sgIP_Header_UDP *) mb->datastart;
- udp->srcport=rec->srcport;
- udp->destport=destport;
- udp->length=htons(datalen+8);
- udp->checksum=0;
- int i;
- for(i=0;i<datalen;i++) {
- mb->datastart[i+8]=data[i];
- }
- udp->checksum=sgIP_UDP_CalcChecksum(mb,srcip,destip,mb->totallength);
- sgIP_IP_SendViaIP(mb,17,srcip,destip);
-
- SGIP_INTR_UNPROTECT();
- return datalen;
-}
-
-sgIP_Record_UDP * sgIP_UDP_AllocRecord() {
- SGIP_INTR_PROTECT();
- sgIP_Record_UDP * rec;
- rec = (sgIP_Record_UDP *)sgIP_malloc(sizeof(sgIP_Record_UDP));
- if(rec) {
- rec->destip=0;
- rec->destport=0;
- rec->incoming_queue=0;
- rec->incoming_queue_end=0;
- rec->srcip=0;
- rec->srcport=0;
- rec->state=0;
- rec->next=udprecords;
- udprecords=rec;
- }
- SGIP_INTR_UNPROTECT();
- return rec;
-}
-void sgIP_UDP_FreeRecord(sgIP_Record_UDP * rec) {
- if(!rec) return;
- SGIP_INTR_PROTECT();
- sgIP_Record_UDP * t;
- // incoming queue is all clumped together as a single memblock, so, time to free it all in one call :)
- if(rec->incoming_queue) sgIP_memblock_free(rec->incoming_queue); // woohoo!
- rec->state=0;
- if(udprecords==rec) {
- udprecords=rec->next;
- } else {
- t=udprecords;
- while(t) {
- if(t->next==rec) {
- t->next=rec->next;
- break;
- }
- t=t->next;
- }
- }
- sgIP_free(rec);
-
- SGIP_INTR_UNPROTECT();
-}
-
-int sgIP_UDP_Bind(sgIP_Record_UDP * rec, int srcport, unsigned long srcip) {
- if(!rec) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- if(rec->state!=SGIP_UDP_STATE_UNUSED) {
- rec->srcip=srcip;
- rec->srcport=srcport;
- if(rec->state==SGIP_UDP_STATE_UNBOUND) rec->state=SGIP_UDP_STATE_BOUND;
- }
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-
-int sgIP_UDP_RecvFrom(sgIP_Record_UDP * rec, char * destbuf, int buflength, int flags, unsigned long * sender_ip, unsigned short * sender_port) {
- if(!rec || !destbuf || !sender_ip || !sender_port || buflength==0) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- if(rec->incoming_queue==0) {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(EWOULDBLOCK);
- }
- int packetlen=rec->incoming_queue->totallength-12;
- if(packetlen>buflength) {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(EMSGSIZE);
- }
- sgIP_memblock * mb;
- *sender_ip=*((unsigned long *)rec->incoming_queue->datastart);
- *sender_port=((unsigned short *)rec->incoming_queue->datastart)[2];
- int totlen,first, buf_start,i;
- totlen=rec->incoming_queue->totallength;
- first=12;
- buf_start=0;
-
- while(totlen>0 && rec->incoming_queue) {
- totlen-=rec->incoming_queue->thislength;
- for(i=first;i<rec->incoming_queue->thislength;i++) {
- destbuf[buf_start+i-first]=rec->incoming_queue->datastart[i];
- }
- buf_start+=rec->incoming_queue->thislength-first;
- first=0;
- mb=rec->incoming_queue;
- rec->incoming_queue=rec->incoming_queue->next;
- mb->next=0;
- sgIP_memblock_free(mb);
- }
- if(!(rec->incoming_queue)) rec->incoming_queue_end=0;
-
- SGIP_INTR_UNPROTECT();
- return buf_start;
-}
-
-int sgIP_UDP_SendTo(sgIP_Record_UDP * rec, const char * buf, int buflength, int flags, unsigned long dest_ip, int dest_port) {
- return sgIP_UDP_SendPacket(rec,buf,buflength,dest_ip,dest_port);
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_UDP.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_UDP.h
deleted file mode 100644
index 676cd7b6d4..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_UDP.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-
-#ifndef SGIP_UDP_H
-#define SGIP_UDP_H
-
-#include "sgIP_Config.h"
-#include "sgIP_memblock.h"
-
-
-enum SGIP_UDP_STATE {
- SGIP_UDP_STATE_UNBOUND, // newly allocated
- SGIP_UDP_STATE_BOUND, // got a source address/port
- SGIP_UDP_STATE_UNUSED, // no longer in use.
-};
-
-
-typedef struct SGIP_HEADER_UDP {
- unsigned short srcport,destport;
- unsigned short length,checksum;
-} sgIP_Header_UDP;
-
-typedef struct SGIP_RECORD_UDP {
- struct SGIP_RECORD_UDP * next;
-
- int state;
- unsigned long srcip;
- unsigned long destip;
- unsigned short srcport,destport;
-
- sgIP_memblock * incoming_queue;
- sgIP_memblock * incoming_queue_end;
-
-} sgIP_Record_UDP;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- void sgIP_UDP_Init(void);
-
- int sgIP_UDP_CalcChecksum(sgIP_memblock * mb, unsigned long srcip, unsigned long destip, int totallength);
- int sgIP_UDP_ReceivePacket(sgIP_memblock * mb, unsigned long srcip, unsigned long destip);
- int sgIP_UDP_SendPacket(sgIP_Record_UDP * rec, const char * data, int datalen, unsigned long destip, int destport);
-
- sgIP_Record_UDP * sgIP_UDP_AllocRecord(void);
- void sgIP_UDP_FreeRecord(sgIP_Record_UDP * rec);
-
- int sgIP_UDP_Bind(sgIP_Record_UDP * rec, int srcport, unsigned long srcip);
- int sgIP_UDP_RecvFrom(sgIP_Record_UDP * rec, char * destbuf, int buflength, int flags, unsigned long * sender_ip, unsigned short * sender_port);
- int sgIP_UDP_SendTo(sgIP_Record_UDP * rec, const char * buf, int buflength, int flags, unsigned long dest_ip, int dest_port);
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_memblock.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_memblock.c
deleted file mode 100644
index b68918033b..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_memblock.c
+++ /dev/null
@@ -1,295 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include "sgIP_memblock.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
-
-#ifndef SGIP_USEDYNAMICMEMORY
-sgIP_memblock memblock_pool[SGIP_MEMBLOCK_BASENUM];
-#else
-sgIP_memblock * memblock_pool;
-#endif
-
-sgIP_memblock * memblock_poolfree;
-int numused, numfree;
-void * pool_link;
-
-
-sgIP_memblock * sgIP_memblock_getunused() {
- int i;
- sgIP_memblock * mb;
- SGIP_INTR_PROTECT();
- if(memblock_poolfree) { // we still have free memblocks!
- mb=memblock_poolfree;
- memblock_poolfree=mb->next;
- numfree--;
- numused++;
- } else { // oh noes, we have no more free memblocks.
- mb = 0; // eventually alloc new blocks, but for now just stop.
- }
-
- SGIP_INTR_UNPROTECT();
- return mb;
-}
-#endif //SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
-
-void sgIP_memblock_Init() {
-#ifndef SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
- int i;
-#ifdef SGIP_USEDYNAMICMEMORY
- pool_link = sgIP_malloc(sizeof(sgIP_memblock)*SGIP_MEMBLOCK_BASENUM+4);
- ((long *)pool_link)[0]=0;
- memblock_pool = (sgIP_memblock *) (((char *)pool_link)+4);
-#endif
- numused=numfree=0;
- memblock_poolfree=0;
- for(i=0;i<SGIP_MEMBLOCK_BASENUM;i++) {
- memblock_pool[i].totallength=0;
- memblock_pool[i].next=memblock_poolfree;
- memblock_poolfree=memblock_pool+i;
- numfree++;
- }
-#endif //SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
-}
-
-#ifdef SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
-
-sgIP_memblock * sgIP_memblock_allocHW(int headersize, int packetsize) {
- sgIP_memblock * mb;
- mb = (sgIP_memblock *) sgIP_malloc(SGIP_MEMBLOCK_HEADERSIZE+SGIP_MAXHWHEADER+packetsize);
- if(!mb) return 0;
- mb->totallength=headersize+packetsize;
- mb->thislength=mb->totallength;
- mb->datastart=mb->reserved+SGIP_MAXHWHEADER-headersize;
- mb->next=0;
- return mb;
-}
-
-#else //SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
-
-sgIP_memblock * sgIP_memblock_allocHW(int headersize, int packetsize) {
- sgIP_memblock * mb, * tmb, *t;
- int totlen;
- mb = sgIP_memblock_getunused();
- if(!mb) return 0;
- mb->totallength=headersize+packetsize;
- mb->datastart=mb->reserved+SGIP_MAXHWHEADER-headersize;
- mb->next=0;
- mb->thislength=headersize+SGIP_MEMBLOCK_FIRSTINTERNALSIZE;
- if(mb->thislength>=mb->totallength) {
- mb->thislength = mb->totallength;
-// SGIP_DEBUG_MESSAGE(("memblock_alloc: %i free, %i used",numfree,numused));
- return mb;
- } else { // need more blocks
- totlen=mb->thislength;
- tmb=mb;
- while(totlen<mb->totallength) {
- t=sgIP_memblock_getunused();
- if(!t) { // we're skrewed.
- sgIP_memblock_free(mb);
- return 0;
- }
- tmb->next=t;
- t->totallength=mb->totallength;
- t->datastart=mb->reserved; // no header on blocks after the first.
- t->next=0;
- t->thislength=SGIP_MEMBLOCK_INTERNALSIZE;
- if(t->thislength+totlen>=mb->totallength) {
- t->thislength=mb->totallength-totlen;
-// SGIP_DEBUG_MESSAGE(("memblock_alloc: %i free, %i used",numfree,numused));
- return mb;
- } else { // need YET more blocks.
- totlen+=t->thislength;
- tmb=t;
- } // the cycle contiues.
- }
- sgIP_memblock_free(mb); // should never get here.
- }
- return 0;
-}
-#endif //SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
-
-sgIP_memblock * sgIP_memblock_alloc(int packetsize) {
- return sgIP_memblock_allocHW(0,packetsize);
-}
-
-#ifdef SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
-
-void sgIP_memblock_free(sgIP_memblock * mb) {
- sgIP_memblock * f;
-
- SGIP_INTR_PROTECT();
- while(mb) {
- mb->totallength=0;
- mb->thislength=0;
- f=mb;
- mb = mb->next;
-
- sgIP_free(f);
- }
-
- SGIP_INTR_UNPROTECT();
-}
-
-#else //SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
-
-void sgIP_memblock_free(sgIP_memblock * mb) {
- sgIP_memblock * f;
-
- SGIP_INTR_PROTECT();
- while(mb) {
- mb->totallength=0;
- mb->thislength=0;
- f=mb;
- mb = mb->next;
-
- numfree++; // reinstate memblock into the pool!
- numused--;
- f->next=memblock_poolfree;
- memblock_poolfree=f;
- }
-// SGIP_DEBUG_MESSAGE(("memblock_free: %i free, %i used",numfree,numused));
-
- SGIP_INTR_UNPROTECT();
-
-}
-
-#endif //SGIP_MEMBLOCK_DYNAMIC_MALLOC_ALL
-
-// positive to expose, negative to hide.
-void sgIP_memblock_exposeheader(sgIP_memblock * mb, int change) {
- if(mb) {
- mb->thislength+=change;
- mb->totallength+=change;
- mb->datastart-=change;
- while(mb->next) {
- mb->next->totallength=mb->totallength;
- mb=mb->next;
- }
- }
-}
-void sgIP_memblock_trimsize(sgIP_memblock * mb, int newsize) {
- int lentot;
- if(mb) {
- mb->totallength=newsize;
- lentot=0;
- while(mb) {
- lentot+=mb->thislength;
- if(lentot>newsize) {
- mb->thislength-=(lentot-newsize);
- if(mb->next) sgIP_memblock_free(mb->next);
- mb->next=0;
- return;
- } else {
- mb=mb->next;
- }
- }
- }
-}
-
-
-int sgIP_memblock_IPChecksum(sgIP_memblock * mb, int startbyte, int chksum_length) {
- int chksum_temp,offset;
- // check checksum
- chksum_temp=0;
- offset=0;
- while(mb && startbyte>mb->thislength) { startbyte-=mb->thislength; mb=mb->next; }
- if(!mb) return 0;
- while(chksum_length) {
- while(startbyte+offset+1<mb->thislength && chksum_length>1) {
- chksum_temp+= ((unsigned char *)mb->datastart)[startbyte+offset] + (((unsigned char *)mb->datastart)[startbyte+offset+1]<<8);
- offset+=2;
- chksum_length-=2;
- }
- chksum_temp= (chksum_temp&0xFFFF) +(chksum_temp>>16);
- if(startbyte+offset<mb->thislength && chksum_length>0) {
- chksum_temp+= ((unsigned char *)mb->datastart)[startbyte+offset];
- if(chksum_length==1) break;
- chksum_length--;
- offset=0;
- startbyte=0;
- mb=mb->next;
- if(!mb) break;
- if(mb->thislength==0) break;
- chksum_temp+= ((unsigned char *)mb->datastart)[startbyte+offset]<<8;
- if(chksum_length==1) break;
- offset++;
- chksum_length--;
- }
- }
- chksum_temp= (chksum_temp&0xFFFF) +(chksum_temp>>16);
- chksum_temp= (chksum_temp&0xFFFF) +(chksum_temp>>16);
- return chksum_temp;
-}
-int sgIP_memblock_CopyToLinear(sgIP_memblock * mb, void * dest_buf, int startbyte, int copy_length) {
- int copylen,ofs_src, tot_copy;
- ofs_src=startbyte;
- while(mb && ofs_src>=mb->thislength) { ofs_src-=mb->thislength; mb=mb->next; }
- if(!mb) return 0;
- if(startbyte+copy_length>mb->totallength) copy_length=mb->totallength-startbyte;
- if(copy_length<0) copy_length=0;
- tot_copy=0;
- while(copy_length>0) {
- copylen=copy_length;
- if(copylen>mb->thislength-ofs_src) copylen=mb->thislength-ofs_src;
- memcpy(((char *)dest_buf)+tot_copy,mb->datastart+ofs_src,copylen);
- copy_length-=copylen;
- tot_copy+=copylen;
- ofs_src=0;
- mb=mb->next;
- if(!mb) break;
- }
- return tot_copy;
-}
-int sgIP_memblock_CopyFromLinear(sgIP_memblock * mb, void * src_buf, int startbyte, int copy_length) {
- int copylen,ofs_src, tot_copy;
- ofs_src=startbyte;
- while(mb && ofs_src>=mb->thislength) { ofs_src-=mb->thislength; mb=mb->next; }
- if(!mb) return 0;
- if(startbyte+copy_length>mb->totallength) copy_length=mb->totallength-startbyte;
- if(copy_length<0) copy_length=0;
- tot_copy=0;
- while(copy_length>0) {
- copylen=copy_length;
- if(copylen>mb->thislength-ofs_src) copylen=mb->thislength-ofs_src;
- memcpy(mb->datastart+ofs_src,((char *)src_buf)+tot_copy,copylen);
- copy_length-=copylen;
- tot_copy+=copylen;
- ofs_src=0;
- mb=mb->next;
- if(!mb) break;
- }
- return tot_copy;
-
-}
-int sgIP_memblock_CopyBlock(sgIP_memblock * mb_src, sgIP_memblock * mb_dest, int start_src, int start_dest, int copy_length) {
-
- return 0;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_memblock.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_memblock.h
deleted file mode 100644
index 85d6011364..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_memblock.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-
-#ifndef SGIP_MEMBLOCK_H
-#define SGIP_MEMBLOCK_H
-
-#include "sgIP_Config.h"
-
-
-typedef struct SGIP_MEMBLOCK {
- int totallength;
- int thislength;
- struct SGIP_MEMBLOCK * next;
- char * datastart;
- char reserved[SGIP_MEMBLOCK_DATASIZE-16]; // assume the other 4 values are 16 bytes total in length.
-} sgIP_memblock;
-
-#define SGIP_MEMBLOCK_HEADERSIZE 16
-#define SGIP_MEMBLOCK_INTERNALSIZE (SGIP_MEMBLOCK_DATASIZE-16)
-#define SGIP_MEMBLOCK_FIRSTINTERNALSIZE (SGIP_MEMBLOCK_DATASIZE-16-SGIP_MAXHWHEADER)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- extern void sgIP_memblock_Init(void);
- extern sgIP_memblock * sgIP_memblock_alloc(int packetsize);
- extern sgIP_memblock * sgIP_memblock_allocHW(int headersize, int packetsize);
- extern void sgIP_memblock_free(sgIP_memblock * mb);
- extern void sgIP_memblock_exposeheader(sgIP_memblock * mb, int change);
- extern void sgIP_memblock_trimsize(sgIP_memblock * mb, int newsize);
-
- extern int sgIP_memblock_IPChecksum(sgIP_memblock * mb, int startbyte, int chksum_length);
- extern int sgIP_memblock_CopyToLinear(sgIP_memblock * mb, void * dest_buf, int startbyte, int copy_length);
- extern int sgIP_memblock_CopyFromLinear(sgIP_memblock * mb, void * src_buf, int startbyte, int copy_length);
- extern int sgIP_memblock_CopyBlock(sgIP_memblock * mb_src, sgIP_memblock * mb_dest, int start_src, int start_dest, int copy_length);
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_sockets.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_sockets.c
deleted file mode 100644
index 199f37a1a8..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_sockets.c
+++ /dev/null
@@ -1,521 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include "sgIP_sockets.h"
-#include "sgIP_TCP.h"
-#include "sgIP_UDP.h"
-#include "sgIP_ICMP.h"
-#include "sgIP_DNS.h"
-
-
-sgIP_socket_data socketlist[SGIP_SOCKET_MAXSOCKETS];
-extern unsigned long sgIP_timems;
-
-
-void sgIP_sockets_Init() {
- int i;
- for(i=0;i<SGIP_SOCKET_MAXSOCKETS;i++) {
- socketlist[i].conn_ptr=0;
- socketlist[i].flags = 0;
- }
-}
-
- // spawn/kill socket for internal use ONLY.
-int spawn_socket(int flags) {
- int s;
- SGIP_INTR_PROTECT();
- for(s=0;s<SGIP_SOCKET_MAXSOCKETS;s++) if(!(socketlist[s].flags&SGIP_SOCKET_FLAG_ACTIVE)) break;
- if(s==SGIP_SOCKET_MAXSOCKETS) {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(ENOMEM);
- }
- socketlist[s].flags=SGIP_SOCKET_FLAG_ACTIVE | flags;
- socketlist[s].conn_ptr=0;
- SGIP_INTR_UNPROTECT();
- return s+1;
-}
-int kill_socket(int s) {
- if(s<1 || s>SGIP_SOCKET_MAXSOCKETS) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- s--;
- socketlist[s].conn_ptr=0;
- socketlist[s].flags=0;
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-
-int socket(int domain, int type, int protocol) {
- int s;
- if(domain!=AF_INET) return SGIP_ERROR(EINVAL);
- if(protocol!=0) return SGIP_ERROR(EINVAL);
- if(type!=SOCK_DGRAM && type!=SOCK_STREAM) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- for(s=0;s<SGIP_SOCKET_MAXSOCKETS;s++) if(!(socketlist[s].flags&SGIP_SOCKET_FLAG_ACTIVE)) break;
- if(s==SGIP_SOCKET_MAXSOCKETS) {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(ENOMEM);
- }
- if(type==SOCK_STREAM) {
- socketlist[s].flags=SGIP_SOCKET_FLAG_ACTIVE | SGIP_SOCKET_FLAG_TYPE_TCP;
- socketlist[s].conn_ptr=sgIP_TCP_AllocRecord();
- } else if(type==SOCK_DGRAM) {
- socketlist[s].flags=SGIP_SOCKET_FLAG_ACTIVE | SGIP_SOCKET_FLAG_TYPE_UDP;
- socketlist[s].conn_ptr=sgIP_UDP_AllocRecord();
- } else {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(EINVAL);
- }
-#ifdef SGIP_SOCKET_DEFAULT_NONBLOCK
- socketlist[s].flags|=SGIP_SOCKET_FLAG_NONBLOCKING;
-#endif
- SGIP_INTR_UNPROTECT();
- return s+1;
-}
-
-
-int closesocket(int socket) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- socket--;
- if(!(socketlist[socket].flags&SGIP_SOCKET_FLAG_ACTIVE)) { SGIP_INTR_UNPROTECT(); return 0; }
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- sgIP_TCP_FreeRecord((sgIP_Record_TCP *)socketlist[socket].conn_ptr);
- } else if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_UDP) {
- sgIP_UDP_FreeRecord((sgIP_Record_UDP *)socketlist[socket].conn_ptr);
- }
- socketlist[socket].conn_ptr=0;
- socketlist[socket].flags=0;
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-
-int bind(int socket, const struct sockaddr * addr, int addr_len) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return SGIP_ERROR(EINVAL);
- if(addr_len!=sizeof(struct sockaddr_in)) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- int retval=SGIP_ERROR(EINVAL);
- socket--;
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- retval=sgIP_TCP_Bind((sgIP_Record_TCP *)socketlist[socket].conn_ptr,((struct sockaddr_in *)addr)->sin_port,((struct sockaddr_in *)addr)->sin_addr.s_addr);
- } else if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_UDP) {
- retval=sgIP_UDP_Bind((sgIP_Record_UDP *)socketlist[socket].conn_ptr,((struct sockaddr_in *)addr)->sin_port,((struct sockaddr_in *)addr)->sin_addr.s_addr);
- }
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-int connect(int socket, const struct sockaddr * addr, int addr_len) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return SGIP_ERROR(EINVAL);
- if(addr_len!=sizeof(struct sockaddr_in)) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- int i;
- int retval=SGIP_ERROR(EINVAL);
- socket--;
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- retval=sgIP_TCP_Connect((sgIP_Record_TCP *)socketlist[socket].conn_ptr,((struct sockaddr_in *)addr)->sin_addr.s_addr,((struct sockaddr_in *)addr)->sin_port);
- if(retval==0) {
- do {
- i=((sgIP_Record_TCP *)socketlist[socket].conn_ptr)->tcpstate;
- if(i==SGIP_TCP_STATE_ESTABLISHED || i==SGIP_TCP_STATE_CLOSE_WAIT) {retval=0; break;}
- if(i==SGIP_TCP_STATE_CLOSED || i==SGIP_TCP_STATE_UNUSED || i==SGIP_TCP_STATE_LISTEN || i==SGIP_TCP_STATE_NODATA)
- { retval=SGIP_ERROR(((sgIP_Record_TCP *)socketlist[socket].conn_ptr)->errorcode); break; }
- if(socketlist[socket].flags&SGIP_SOCKET_FLAG_NONBLOCKING) break;
- SGIP_INTR_UNPROTECT();
- SGIP_WAITEVENT();
- SGIP_INTR_REPROTECT();
- } while(1);
- }
- }
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-int send(int socket, const void * data, int sendlength, int flags) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return -1;
- SGIP_INTR_PROTECT();
- int retval=SGIP_ERROR(EINVAL);
- socket--;
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- do {
- retval=sgIP_TCP_Send((sgIP_Record_TCP *)socketlist[socket].conn_ptr,data,sendlength,flags);
- if(retval!=-1) break;
- if(errno!=EWOULDBLOCK) break;
- if(socketlist[socket].flags&SGIP_SOCKET_FLAG_NONBLOCKING) break;
- SGIP_INTR_UNPROTECT();
- SGIP_WAITEVENT();
- SGIP_INTR_REPROTECT();
- } while(1);
- }
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-int recv(int socket, void * data, int recvlength, int flags) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return -1;
- SGIP_INTR_PROTECT();
- int retval=SGIP_ERROR(EINVAL);
- socket--;
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- do {
- retval=sgIP_TCP_Recv((sgIP_Record_TCP *)socketlist[socket].conn_ptr,data,recvlength,flags);
- if(retval!=-1) break;
- if(errno!=EWOULDBLOCK) break;
- if(socketlist[socket].flags&SGIP_SOCKET_FLAG_NONBLOCKING) break;
- SGIP_INTR_UNPROTECT();
- SGIP_WAITEVENT();
- SGIP_INTR_REPROTECT();
- } while(1);
- }
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-int sendto(int socket, const void * data, int sendlength, int flags, const struct sockaddr * addr, int addr_len) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return -1;
- if(!addr) return -1;
- SGIP_INTR_PROTECT();
- int retval=SGIP_ERROR(EINVAL);
- socket--;
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- } else if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_UDP) {
- retval=sgIP_UDP_SendTo((sgIP_Record_UDP *)socketlist[socket].conn_ptr,data,sendlength,flags,((struct sockaddr_in *)addr)->sin_addr.s_addr,((struct sockaddr_in *)addr)->sin_port);
- }
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-int recvfrom(int socket, void * data, int recvlength, int flags, struct sockaddr * addr, int * addr_len) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return -1;
- if(!addr) return -1;
- SGIP_INTR_PROTECT();
- int retval=SGIP_ERROR(EINVAL);
- socket--;
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- } else if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_UDP) {
- do {
- retval=sgIP_UDP_RecvFrom((sgIP_Record_UDP *)socketlist[socket].conn_ptr,data,recvlength,flags,&(((struct sockaddr_in *)addr)->sin_addr.s_addr),&(((struct sockaddr_in *)addr)->sin_port));
- if(retval!=-1) break;
- if(errno!=EWOULDBLOCK) break;
- if(socketlist[socket].flags&SGIP_SOCKET_FLAG_NONBLOCKING) break;
- SGIP_INTR_UNPROTECT(); // give interrupts a chance to occur.
- SGIP_WAITEVENT(); // don't just try again immediately
- SGIP_INTR_REPROTECT();
- } while(1);
- *addr_len = sizeof(struct sockaddr_in);
- }
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-int listen(int socket, int max_connections) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- int retval=SGIP_ERROR(EINVAL);
- socket--;
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- retval=sgIP_TCP_Listen((sgIP_Record_TCP *)socketlist[socket].conn_ptr,max_connections);
- }
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-int accept(int socket, struct sockaddr * addr, int * addr_len) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS || !addr || !addr_len) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- sgIP_Record_TCP * ret;
- int retval,s;
- retval=SGIP_ERROR0(EINVAL);
- ret=0;
- socket--;
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- s=spawn_socket((socketlist[socket].flags&SGIP_SOCKET_FLAG_NONBLOCKING) | SGIP_SOCKET_FLAG_TYPE_TCP);
- if(s>0) {
- do {
- ret=sgIP_TCP_Accept((sgIP_Record_TCP *)socketlist[socket].conn_ptr);
- if(ret!=0) break;
- if(errno!=EWOULDBLOCK) break;
- if(socketlist[socket].flags&SGIP_SOCKET_FLAG_NONBLOCKING) break;
- SGIP_INTR_UNPROTECT(); // give interrupts a chance to occur.
- SGIP_WAITEVENT(); // don't just try again immediately
- SGIP_INTR_REPROTECT();
- } while(1);
- }
- if(ret==0) {
- kill_socket(s);
- retval=-1;
- } else {
- *addr_len=sizeof(struct sockaddr_in);
- ((struct sockaddr_in *)addr)->sin_family=AF_INET;
- ((struct sockaddr_in *)addr)->sin_port=ret->destport;
- ((struct sockaddr_in *)addr)->sin_addr.s_addr=ret->destip;
- socketlist[s-1].conn_ptr=ret;
- retval=s;
- }
- }
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-int shutdown(int socket, int shutdown_type) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return SGIP_ERROR(EINVAL);
- SGIP_INTR_PROTECT();
- int retval=SGIP_ERROR(EINVAL);
- socket--;
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- retval=sgIP_TCP_Close((sgIP_Record_TCP *)socketlist[socket].conn_ptr);
- }
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-
-int ioctl(int socket, long cmd, void * arg) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return SGIP_ERROR(EBADF);
- socket--;
- int retval,i;
- retval=0;
- SGIP_INTR_PROTECT();
- switch(cmd) {
- case FIONBIO:
- if(!arg){
- retval=SGIP_ERROR(EINVAL);
- } else {
- socketlist[socket].flags &= ~SGIP_SOCKET_FLAG_NONBLOCKING;
- if(*((unsigned long *)arg)) socketlist[socket].flags |= SGIP_SOCKET_FLAG_NONBLOCKING;
- }
- break;
- case FIONREAD:
- if(!arg) {
- retval=SGIP_ERROR(EINVAL);
- } else {
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- i=((sgIP_Record_TCP *)socketlist[socket].conn_ptr)->buf_rx_out-((sgIP_Record_TCP *)socketlist[socket].conn_ptr)->buf_rx_in;
- if(i<0) i+=SGIP_TCP_RECEIVEBUFFERLENGTH;
- *((int *)arg)=i;
- } else {
- retval=SGIP_ERROR(EINVAL);
- }
- }
- }
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-
-int setsockopt(int socket, int level, int option_name, const void * data, int data_len) {
- return 0;
-}
-int getsockopt(int socket, int level, int option_name, void * data, int * data_len) {
- return 0;
-}
-
-int getpeername(int socket, struct sockaddr *addr, int * addr_len) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return SGIP_ERROR(EBADF);
- if(!addr || !addr_len) return SGIP_ERROR(EFAULT);
- if(*addr_len<sizeof(struct sockaddr_in)) return SGIP_ERROR(EFAULT);
- socket--;
- SGIP_INTR_PROTECT();
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- {
- struct sockaddr_in * sain = (struct sockaddr_in *)addr;
- sgIP_Record_TCP * rec = (sgIP_Record_TCP *)socketlist[socket].conn_ptr;
- if(rec->tcpstate!=SGIP_TCP_STATE_ESTABLISHED) {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(ENOTCONN);
- } else {
- sain->sin_addr.s_addr=rec->destip;
- sain->sin_family=AF_INET;
- sain->sin_port=rec->destport;
- *addr_len=sizeof(struct sockaddr_in);
- }
- }
- } else {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(EOPNOTSUPP);
- }
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-int getsockname(int socket, struct sockaddr *addr, int * addr_len) {
- if(socket<1 || socket>SGIP_SOCKET_MAXSOCKETS) return SGIP_ERROR(EBADF);
- if(!addr || !addr_len) return SGIP_ERROR(EFAULT);
- if(*addr_len<sizeof(struct sockaddr_in)) return SGIP_ERROR(EFAULT);
- socket--;
- SGIP_INTR_PROTECT();
- if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- {
- struct sockaddr_in * sain = (struct sockaddr_in *)addr;
- sgIP_Record_TCP * rec = (sgIP_Record_TCP *)socketlist[socket].conn_ptr;
- if(rec->tcpstate==SGIP_TCP_STATE_UNUSED || rec->tcpstate==SGIP_TCP_STATE_CLOSED) {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(EINVAL);
- } else {
- sain->sin_addr.s_addr=rec->srcip;
- sain->sin_family=AF_INET;
- sain->sin_port=rec->srcport;
- *addr_len=sizeof(struct sockaddr_in);
- }
- }
- } else if((socketlist[socket].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_UDP) {
- {
- struct sockaddr_in * sain = (struct sockaddr_in *)addr;
- sgIP_Record_UDP * rec = (sgIP_Record_UDP *)socketlist[socket].conn_ptr;
- if(rec->state==SGIP_UDP_STATE_UNUSED) {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(EINVAL);
- } else {
- sain->sin_addr.s_addr=rec->srcip;
- sain->sin_family=AF_INET;
- sain->sin_port=rec->srcport;
- *addr_len=sizeof(struct sockaddr_in);
- }
- }
- } else {
- SGIP_INTR_UNPROTECT();
- return SGIP_ERROR(EOPNOTSUPP);
- }
- SGIP_INTR_UNPROTECT();
- return 0;
-}
-
-
-struct hostent * gethostbyname(const char * name) {
- return (struct hostent *)sgIP_DNS_gethostbyname(name);
-};
-
-
-extern int select(int nfds, fd_set *__restrict readfds, fd_set *__restrict writefds,
- fd_set *__restrict errorfds, struct timeval *__restrict timeout) {
- // 31 days = 2678400 seconds
- unsigned long timeout_ms, lasttime, temp;
- sgIP_Record_TCP * rec;
- sgIP_Record_UDP * urec;
- lasttime=sgIP_timems;
- if(!timeout) timeout_ms=2678400000UL;
- else {
- if(timeout->tv_sec>=2678400) {
- timeout_ms=2678400000UL;
- } else {
- timeout_ms=timeout->tv_sec*1000 + (timeout->tv_usec/1000);
- }
- }
- SGIP_INTR_PROTECT();
- nfds=SGIP_SOCKET_MAXSOCKETS;
-
- int i,j,retval;
- while(timeout_ms>0) { // check all fd sets
- // readfds
- if(readfds) {
- for(i=0;i<nfds;i++) {
- if(FD_ISSET(i+1,readfds)) {
- if((socketlist[i].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- rec = (sgIP_Record_TCP *)socketlist[i].conn_ptr;
- if(rec->buf_rx_in!=rec->buf_rx_out) { timeout_ms=0; break; }
- } else if((socketlist[i].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_UDP) {
- urec = (sgIP_Record_UDP *)socketlist[i].conn_ptr;
- if(urec->incoming_queue) { timeout_ms=0; break; }
- }
- }
- }
- if(timeout_ms==0) break;
- }
- if(writefds) {
- // writefds
- for(i=0;i<nfds;i++) {
- if(FD_ISSET(i+1,writefds)) {
- if((socketlist[i].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- rec = (sgIP_Record_TCP *)socketlist[i].conn_ptr;
- j=rec->buf_tx_in-1;
- if(j<0) j=SGIP_TCP_TRANSMITBUFFERLENGTH-1;
- if(rec->buf_tx_in!=j) { timeout_ms=0; break; }
- }
- }
- }
- if(timeout_ms==0) break;
- }
- // errorfds
- // ignore errorfds for now.
-
- temp=sgIP_timems-lasttime;
- if(timeout_ms<temp) timeout_ms=0; else timeout_ms -= temp;
- lasttime+=temp;
- SGIP_INTR_UNPROTECT(); // give interrupts a chance to occur.
- SGIP_WAITEVENT(); // don't just try again immediately
- SGIP_INTR_REPROTECT();
- }
- // markup fd sets and return
- // readfds
- retval=0;
- if(readfds) {
- for(i=0;i<nfds;i++) {
- if(FD_ISSET(i+1,readfds)) {
- if((socketlist[i].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- rec = (sgIP_Record_TCP *)socketlist[i].conn_ptr;
- if(rec->buf_rx_in==rec->buf_rx_out) { FD_CLR(i+1,readfds);} else retval++;
- } else if((socketlist[i].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_UDP) {
- urec = (sgIP_Record_UDP *)socketlist[i].conn_ptr;
- if(!urec->incoming_queue) { FD_CLR(i+1,readfds);} else retval++;
- }
- }
- }
- }
-
- // writefds
- if(writefds) {
- for(i=0;i<nfds;i++) {
- if(FD_ISSET(i+1,writefds)) {
- if((socketlist[i].flags&SGIP_SOCKET_FLAG_TYPEMASK)==SGIP_SOCKET_FLAG_TYPE_TCP) {
- rec = (sgIP_Record_TCP *)socketlist[i].conn_ptr;
- j=rec->buf_tx_in-1;
- if(j<0) j=SGIP_TCP_TRANSMITBUFFERLENGTH-1;
- if(rec->buf_tx_in==j) { FD_CLR(i+1,writefds); } else retval++;
- }
- }
- }
- }
-
- if(errorfds) { FD_ZERO(errorfds); }
-
- SGIP_INTR_UNPROTECT();
- return retval;
-}
-
-
-/*
-extern void FD_CLR(int fd, fd_set * fdset) {
- if(fd<1 || fd>FD_SETSIZE || !fdset) return;
- fd--;
- fdset->fdbits[fd>>5] &= ~(1<<(fd&31));
-}
-extern int FD_ISSET(int fd, fd_set * fdset) {
- if(fd<1 || fd>FD_SETSIZE || !fdset) return 0;
- fd--;
- return (fdset->fdbits[fd>>5] & 1<<(fd&31))?1:0;
-}
-extern void FD_SET(int fd, fd_set * fdset) {
- if(fd<1 || fd>FD_SETSIZE || !fdset) return;
- fd--;
- fdset->fdbits[fd>>5] |= 1<<(fd&31);
-}
-extern void FD_ZERO(fd_set * fdset) {
- int i;
- if(!fdset) return;
- for(i=0;i<(FD_SETSIZE+31)/32;i++) {
- fdset->fdbits[i]=0;
- }
-}
-*/
-
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_sockets.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_sockets.h
deleted file mode 100644
index a48e2dc467..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/sgIP_sockets.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// DSWifi Project - sgIP Internet Protocol Stack Implementation
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#ifndef SGIP_SOCKETS_H
-#define SGIP_SOCKETS_H
-
-#include "sgIP_Config.h"
-#include "sys/socket.h"
-#include "netinet/in.h"
-#include "netdb.h"
-
-#define SGIP_SOCKET_FLAG_ACTIVE 0x8000
-#define SGIP_SOCKET_FLAG_NONBLOCKING 0x4000
-#define SGIP_SOCKET_FLAG_TYPEMASK 0x0001
-#define SGIP_SOCKET_FLAG_TYPE_TCP 0x0001
-#define SGIP_SOCKET_FLAG_TYPE_UDP 0x0000
-
-typedef struct SGIP_SOCKET_DATA {
- unsigned int flags;
- void * conn_ptr;
-} sgIP_socket_data;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- extern void sgIP_sockets_Init();
-
- // sys/socket.h
- extern int socket(int domain, int type, int protocol);
- extern int bind(int socket, const struct sockaddr * addr, int addr_len);
- extern int connect(int socket, const struct sockaddr * addr, int addr_len);
- extern int send(int socket, const void * data, int sendlength, int flags);
- extern int recv(int socket, void * data, int recvlength, int flags);
- extern int sendto(int socket, const void * data, int sendlength, int flags, const struct sockaddr * addr, int addr_len);
- extern int recvfrom(int socket, void * data, int recvlength, int flags, struct sockaddr * addr, int * addr_len);
- extern int listen(int socket, int max_connections);
- extern int accept(int socket, struct sockaddr * addr, int * addr_len);
- extern int shutdown(int socket, int shutdown_type);
- extern int closesocket(int socket);
-
- extern int ioctl(int socket, long cmd, void * arg);
-
- extern int setsockopt(int socket, int level, int option_name, const void * data, int data_len);
- extern int getsockopt(int socket, int level, int option_name, void * data, int * data_len);
-
- extern int getpeername(int socket, struct sockaddr *addr, int * addr_len);
- extern int getsockname(int socket, struct sockaddr *addr, int * addr_len);
-
- // sys/time.h (actually intersects partly with libnds, so I'm letting libnds handle fd_set for the time being)
- extern int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout);
-
- // arpa/inet.h
- extern unsigned long inet_addr(const char *cp);
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/wifi_arm9.c b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/wifi_arm9.c
deleted file mode 100644
index 970c788e7e..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/wifi_arm9.c
+++ /dev/null
@@ -1,996 +0,0 @@
-// DS Wifi interface code
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-// wifi_arm9.c - arm9 wifi support code
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#include <unistd.h>
-
-#include <nds.h>
-#include "dsregs.h"
-
-#include "wifi_arm9.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-
-
-
-
-
-
-
-
-
-#ifdef WIFI_USE_TCP_SGIP
-
-#include "sgIP.h"
-
-
-sgIP_Hub_HWInterface * wifi_hw;
-
-
-int sgIP_DisableInterrupts() {
- int a;
- a=REG_IME;
- REG_IME=0;
- return a;
-}
-void sgIP_RestoreInterrupts(int old_ime) {
- REG_IME=old_ime;
-}
-
-void sgIP_IntrWaitEvent() {
- // __asm__ ( ".ARM\n swi 0x060000\n" );
- int i,j;
- j=0;
- for(i=0;i<20000;i++) {
- j+=i;
- }
-}
-
-void * sgIP_malloc(int size) __attribute__((weak));
-void sgIP_free(void * ptr) __attribute__((weak));
-
-
-
-//////////////////////////////////////////////////////////////////////////
-// wifi heap allocator system
-
-#define WHEAP_RECORD_FLAG_INUSE 0
-#define WHEAP_RECORD_FLAG_UNUSED 1
-#define WHEAP_RECORD_FLAG_FREED 2
-
-typedef struct WHEAP_RECORD {
- struct WHEAP_RECORD * next;
- unsigned short flags, unused;
- int size;
-} wHeapRecord;
-
-#ifdef SGIP_DEBUG
-#define WHEAP_FILL_START 0xAA
-#define WHEAP_FILL_END 0xBB
-#define WHEAP_PAD_START 4
-#define WHEAP_PAD_END 4
-#define WHEAP_DO_PAD
-#else
-#define WHEAP_PAD_START 0
-#define WHEAP_PAD_END 0
-#undef WHEAP_DO_PAD
-#endif
-#define WHEAP_RECORD_SIZE (sizeof(wHeapRecord))
-#define WHEAP_PAD_SIZE ((WHEAP_PAD_START)+(WHEAP_PAD_END))
-#define WHEAP_SIZE_CUTOFF ((WHEAP_RECORD_SIZE)+64)
-
-
-int wHeapsize;
-wHeapRecord * wHeapStart; // start of heap
-wHeapRecord * wHeapFirst; // first free block
-void wHeapAllocInit(int size) {
- wHeapStart=(wHeapRecord *)malloc(size);
- wHeapFirst=wHeapStart;
- wHeapStart->flags=WHEAP_RECORD_FLAG_UNUSED;
- wHeapStart->next=0;
- wHeapStart->size=size-sizeof(wHeapRecord);
-}
-
-
-void * wHeapAlloc(int size) {
- wHeapRecord * rec = wHeapFirst;
- void * voidptr;
- int n;
- size=(size+3)&(~3);
- if(size==0) size=4;
- size+=WHEAP_PAD_SIZE;
- if(!rec) { SGIP_DEBUG_MESSAGE(("wHeapAlloc: heap full!")); return 0; } // should not happen given normal use.
- while(rec->size<size) {
- if(!rec->next) { SGIP_DEBUG_MESSAGE(("wHeapAlloc: heap too full!")); return 0; } // cannot alloc
- if(rec->next->flags!=WHEAP_RECORD_FLAG_INUSE) { // try to merge with next one
- rec->size+=rec->next->size+WHEAP_RECORD_SIZE;
- rec->next=rec->next->next;
- } else { // skip ahead to more friendly waters
- rec=rec->next;
- while(rec->next) {
- if(rec->flags!=WHEAP_RECORD_FLAG_INUSE) break;
- rec=rec->next;
- }
- if(rec->flags==WHEAP_RECORD_FLAG_INUSE) { SGIP_DEBUG_MESSAGE(("wHeapAlloc: heap too full!")); return 0; } // no empty slots :(
- }
- }
- rec->flags=WHEAP_RECORD_FLAG_INUSE;
- n=rec->size-size;
- voidptr = ((char *)rec)+WHEAP_RECORD_SIZE+WHEAP_PAD_START;
- if(n<WHEAP_SIZE_CUTOFF) { // pad to include unused portion
- rec->unused=n;
- } else { // chop block into 2
- wHeapRecord * rec2;
- rec2=(wHeapRecord *)(((char *)rec)+WHEAP_RECORD_SIZE+size);
- rec2->flags=WHEAP_RECORD_FLAG_UNUSED;
- rec2->size=rec->size-size-WHEAP_RECORD_SIZE;
- rec->size=size;
- rec2->next=rec->next;
- rec->next=rec2;
- rec->unused=0;
- }
- if(rec==wHeapFirst) {
- while(wHeapFirst->next && wHeapFirst->flags==WHEAP_RECORD_FLAG_INUSE) wHeapFirst=wHeapFirst->next;
- if(wHeapFirst->flags==WHEAP_RECORD_FLAG_INUSE) wHeapFirst=0;
- }
-#ifdef WHEAP_DO_PAD
- {
- int i;
- for(i=0;i<WHEAP_PAD_START;i++) {
- (((unsigned char *)rec)+WHEAP_RECORD_SIZE)[i]=WHEAP_FILL_START;
- }
- for(i=0;i<WHEAP_PAD_END;i++) {
- (((unsigned char *)rec)+WHEAP_RECORD_SIZE+size-WHEAP_PAD_END)[i]=WHEAP_FILL_END;
- }
- }
-#endif
- return voidptr;
-}
-
-void wHeapFree(void * data) {
- wHeapRecord * rec = (wHeapRecord *)(((char *)data)-WHEAP_RECORD_SIZE-WHEAP_PAD_START);
-#ifdef WHEAP_DO_PAD
- {
- int size=rec->size-rec->unused;
- int i;
- for(i=0;i<WHEAP_PAD_START;i++) {
- if((((unsigned char *)rec)+WHEAP_RECORD_SIZE)[i]!=WHEAP_FILL_START) break;
- }
- if(i!=WHEAP_PAD_START) { // note heap error
- SGIP_DEBUG_MESSAGE(("wHeapFree: Corruption found before allocated data! 0x%X",data));
- }
- for(i=0;i<WHEAP_PAD_END;i++) {
- if((((unsigned char *)rec)+WHEAP_RECORD_SIZE+size-WHEAP_PAD_END)[i]!=WHEAP_FILL_END) break;
- }
- if(i!=WHEAP_PAD_END) { // note heap error
- SGIP_DEBUG_MESSAGE(("wHeapFree: Corruption found after allocated data! 0x%x",data));
- }
- }
-#endif
- if(rec->flags!=WHEAP_RECORD_FLAG_INUSE) { // note heap error
- SGIP_DEBUG_MESSAGE(("wHeapFree: Data already freed! 0x%X",data));
- }
- rec->flags=WHEAP_RECORD_FLAG_FREED;
- if(rec<wHeapFirst || !wHeapFirst) wHeapFirst=rec; // reposition the "starting" pointer.
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-void * sgIP_malloc(int size) { return wHeapAlloc(size); }
-void sgIP_free(void * ptr) { wHeapFree(ptr); }
-
-
-#endif
-
-
-
-
-
-void ethhdr_print(char f, void * d) {
- char buffer[33];
- int i;
- int t,c;
- buffer[0]=f;
- buffer[1]=':';
- buffer[14]=' ';
- buffer[27]=' ';
- buffer[32]=0;
- for(i=0;i<6;i++) {
- t=((u8 *)d)[i];
- c=t&15;
- if(c>9) c+='A'-10; else c+='0';
- buffer[3+i*2]=c;
- c=(t>>4)&15;
- if(c>9) c+='A'-10; else c+='0';
- buffer[2+i*2]=c;
-
- t=((u8 *)d)[i+6];
- c=t&15;
- if(c>9) c+='A'-10; else c+='0';
- buffer[16+i*2]=c;
- c=(t>>4)&15;
- if(c>9) c+='A'-10; else c+='0';
- buffer[15+i*2]=c;
- }
- for(i=0;i<2;i++) {
- t=((u8 *)d)[i+12];
- c=t&15;
- if(c>9) c+='A'-10; else c+='0';
- buffer[29+i*2]=c;
- c=(t>>4)&15;
- if(c>9) c+='A'-10; else c+='0';
- buffer[28+i*2]=c;
- }
- SGIP_DEBUG_MESSAGE((buffer));
-}
-
-
-
-
-Wifi_MainStruct Wifi_Data_Struct;
-
-volatile Wifi_MainStruct * WifiData = 0;
-
-WifiPacketHandler packethandler = 0;
-WifiSyncHandler synchandler = 0;
-
-void erasemem(void * mem, int length) {
- int i;
- char * m = (char *)mem;
- for(i=0;i<length;i++)
- m[i]=0;
-}
-
-void Wifi_CopyMacAddr(volatile void * dest, volatile void * src) {
- ((u16 *)dest)[0]=((u16 *)src)[0];
- ((u16 *)dest)[1]=((u16 *)src)[1];
- ((u16 *)dest)[2]=((u16 *)src)[2];
-}
-
-int Wifi_CmpMacAddr(volatile void * mac1,volatile void * mac2) {
- return (((u16 *)mac1)[0]==((u16 *)mac2)[0]) && (((u16 *)mac1)[1]==((u16 *)mac2)[1]) && (((u16 *)mac1)[2]==((u16 *)mac2)[2]);
-}
-
-
-
-u32 Wifi_TxBufferWordsAvailable(void) {
- s32 size=WifiData->txbufIn-WifiData->txbufOut-1;
- if(size<0) size += WIFI_TXBUFFER_SIZE/2;
- return size;
-}
-void Wifi_TxBufferWrite(s32 start, s32 len, u16 * data) {
- int writelen;
- while(len>0) {
- writelen=len;
- if(writelen>(WIFI_TXBUFFER_SIZE/2)-start) writelen=(WIFI_TXBUFFER_SIZE/2)-start;
- len-=writelen;
- while(writelen) {
- WifiData->txbufData[start++]=*(data++);
- writelen--;
- }
- start=0;
- }
-}
-
-int Wifi_RxRawReadPacket(s32 packetID, s32 readlength, u16 * data) {
- int readlen,read_data;
- readlength= (readlength+1)/2;
- read_data=0;
- while(readlength>0) {
- readlen=readlength;
- if(readlen>(WIFI_RXBUFFER_SIZE/2)-packetID) readlen=(WIFI_RXBUFFER_SIZE/2)-packetID;
- readlength-=readlen;
- read_data+=readlen;
- while(readlen>0) {
- *(data++) = WifiData->rxbufData[packetID++];
- readlen--;
- }
- packetID=0;
- }
- return read_data;
-}
-
-u16 Wifi_RxReadOffset(s32 base, s32 offset) {
- base+=offset;
- if(base>=(WIFI_RXBUFFER_SIZE/2)) base -= (WIFI_RXBUFFER_SIZE/2);
- return WifiData->rxbufData[base];
-}
-
-// datalen = size of packet from beginning of 802.11 header to end, but not including CRC.
-int Wifi_RawTxFrame(u16 datalen, u16 rate, u16 * data) {
- Wifi_TxHeader txh;
- int sizeneeded;
- int base;
- sizeneeded=((datalen+12+4+3)/4)*2;
- if(sizeneeded>Wifi_TxBufferWordsAvailable()) {WifiData->stats[WSTAT_TXQUEUEDREJECTED]++; return -1; }
- txh.tx_rate=rate;
- txh.tx_length=datalen+4;
- base = WifiData->txbufOut;
- Wifi_TxBufferWrite(base,6,(u16 *)&txh);
- base += 6;
- if(base>=(WIFI_TXBUFFER_SIZE/2)) base -= WIFI_TXBUFFER_SIZE/2;
- Wifi_TxBufferWrite(base,((datalen+3)/4)*2,data);
- base += ((datalen+3)/4)*2;
- if(base>=(WIFI_TXBUFFER_SIZE/2)) base -= WIFI_TXBUFFER_SIZE/2;
- WifiData->txbufOut=base;
- WifiData->stats[WSTAT_TXQUEUEDPACKETS]++;
- WifiData->stats[WSTAT_TXQUEUEDBYTES]+=sizeneeded;
- if(synchandler) synchandler();
- return 0;
-}
-
-
-void Wifi_RawSetPacketHandler(WifiPacketHandler wphfunc) {
- packethandler=wphfunc;
-}
-void Wifi_SetSyncHandler(WifiSyncHandler wshfunc) {
- synchandler=wshfunc;
-}
-
-void Wifi_DisableWifi(void) {
- WifiData->reqMode=WIFIMODE_DISABLED;
- WifiData->reqReqFlags &= ~WFLAG_REQ_APCONNECT;
-}
-void Wifi_EnableWifi(void) {
- WifiData->reqMode=WIFIMODE_NORMAL;
- WifiData->reqReqFlags &= ~WFLAG_REQ_APCONNECT;
-}
-void Wifi_SetPromiscuousMode(int enable) {
- if(enable) WifiData->reqReqFlags |= WFLAG_REQ_PROMISC;
- else WifiData->reqReqFlags &= ~WFLAG_REQ_PROMISC;
-}
-
-void Wifi_ScanMode(void) {
- WifiData->reqMode=WIFIMODE_SCAN;
- WifiData->reqReqFlags &= ~WFLAG_REQ_APCONNECT;
-}
-void Wifi_SetChannel(int channel) {
- if(channel<1 || channel>13) return;
- if(WifiData->reqMode==WIFIMODE_NORMAL || WifiData->reqMode==WIFIMODE_SCAN) {
- WifiData->reqChannel=channel;
- }
-}
-
-
-int Wifi_GetNumAP(void) {
- int i,j;
- j=0;
- for(i=0;i<WIFI_MAX_AP;i++) if(WifiData->aplist[i].flags&WFLAG_APDATA_ACTIVE) j++;
- return j;
-}
-
-int Wifi_GetAPData(int apnum, Wifi_AccessPoint * apdata) {
- int i,j;
- if(!apdata) return WIFI_RETURN_PARAMERROR;
- j=0;
- for(i=0;i<WIFI_MAX_AP;i++){
- if(WifiData->aplist[i].flags&WFLAG_APDATA_ACTIVE) {
- if(j==apnum) {
- while(Spinlock_Acquire(WifiData->aplist[i])!=SPINLOCK_OK);
- {
- // additionally calculate average RSSI here
- WifiData->aplist[i].rssi=0;
- for(j=0;j<8;j++) {
- WifiData->aplist[i].rssi+=WifiData->aplist[i].rssi_past[j];
- }
- WifiData->aplist[i].rssi = WifiData->aplist[i].rssi >> 3;
- *apdata = WifiData->aplist[i]; // yay for struct copy!
- Spinlock_Release(WifiData->aplist[i]);
- return WIFI_RETURN_OK;
- }
- }
- j++;
- }
- }
- return WIFI_RETURN_ERROR;
-}
-
-int Wifi_FindMatchingAP(int numaps, Wifi_AccessPoint * apdata, Wifi_AccessPoint * match_dest) {
- int ap_match,i,j,n;
- Wifi_AccessPoint ap;
- u16 macaddrzero[3] = {0,0,0}; // check for empty mac addr
- ap_match=-1;
- for(i=0;i<Wifi_GetNumAP();i++){
- Wifi_GetAPData(i,&ap);
- for(j=0;j<numaps;j++) {
- if(apdata[j].ssid_len>32 || ((signed char)apdata[j].ssid_len)<0) continue;
- if(apdata[j].ssid_len>0) { // compare SSIDs
- if(apdata[j].ssid_len!=ap.ssid_len) continue;
- for(n=0;n<apdata[j].ssid_len;n++) {
- if(apdata[j].ssid[n]!=ap.ssid[n]) break;
- }
- if(n!=apdata[j].ssid_len) continue;
- }
- if(!Wifi_CmpMacAddr(apdata[j].macaddr,macaddrzero)) { // compare mac addr
- if(!Wifi_CmpMacAddr(apdata[j].macaddr,ap.macaddr)) continue;
- }
- if(apdata[j].channel!=0) { // compare channels
- if(apdata[j].channel!=ap.channel) continue;
- }
- if(j<ap_match || ap_match==-1) {
- ap_match=j;
- if(match_dest) *match_dest = ap;
- }
- if(ap_match==0) return ap_match;
- }
- }
- return ap_match;
-}
-
-int wifi_connect_state = 0; // -1==error, 0==searching, 1==associating, 2==dhcp'ing, 3==done, 4=searching wfc data
-Wifi_AccessPoint wifi_connect_point;
-int Wifi_ConnectAP(Wifi_AccessPoint * apdata, int wepmode, int wepkeyid, u8 * wepkey) {
- int i;
- Wifi_AccessPoint ap;
- wifi_connect_state=-1;
- if(!apdata) return -1;
- if(((signed char)apdata->ssid_len)<0 || apdata->ssid_len>32) return -1;
-
- Wifi_DisconnectAP();
-
- wifi_connect_state=0;
- WifiData->wepmode9=wepmode; // copy data
- WifiData->wepkeyid9=wepkeyid;
- for(i=0;i<20;i++) {
- WifiData->wepkey9[i]=wepkey[i];
- }
-
-
- i=Wifi_FindMatchingAP(1,apdata,&ap);
- if(i==0) {
- Wifi_CopyMacAddr(WifiData->bssid9, ap.bssid);
- Wifi_CopyMacAddr(WifiData->apmac9, ap.bssid);
- WifiData->ssid9[0]=ap.ssid_len;
- for(i=0;i<32;i++) {
- WifiData->ssid9[i+1]=ap.ssid[i];
- }
- WifiData->apchannel9=ap.channel;
- for(i=0;i<16;i++) WifiData->baserates9[i]=ap.base_rates[i];
- WifiData->reqMode=WIFIMODE_NORMAL;
- WifiData->reqReqFlags |= WFLAG_REQ_APCONNECT | WFLAG_REQ_APCOPYVALUES;
- wifi_connect_state=1;
- } else {
- WifiData->reqMode=WIFIMODE_SCAN;
- wifi_connect_point = *apdata;
- }
- return 0;
-}
-void Wifi_AutoConnect(void) {
- if(!(WifiData->wfc_enable[0]&0x80)) {
- wifi_connect_state=ASSOCSTATUS_CANNOTCONNECT;
- } else {
- wifi_connect_state=4;
- WifiData->reqMode=WIFIMODE_SCAN;
- }
-}
-
-static
-void sgIP_DNS_Record_Localhost(void)
-{
- sgIP_DNS_Record *rec;
- const unsigned char * resdata_c = (unsigned char *)&(wifi_hw->ipaddr);
- rec = sgIP_DNS_GetUnusedRecord();
- rec->flags=SGIP_DNS_FLAG_ACTIVE | SGIP_DNS_FLAG_BUSY;
-
- rec->addrlen = 4;
- rec->numalias = 1;
- gethostname(rec->aliases[0], 256);
- gethostname(rec->name, 256);
- rec->numaddr = 1;
- rec->addrdata[0] = resdata_c[0];
- rec->addrdata[1] = resdata_c[1];
- rec->addrdata[2] = resdata_c[2];
- rec->addrdata[3] = resdata_c[3];
- rec->addrclass = AF_INET;
- rec->TTL = 0;
-
- rec->flags=SGIP_DNS_FLAG_ACTIVE | SGIP_DNS_FLAG_BUSY|SGIP_DNS_FLAG_RESOLVED;
-}
-
-int Wifi_AssocStatus(void) {
- switch(wifi_connect_state) {
- case -1: // error
- return ASSOCSTATUS_CANNOTCONNECT;
- case 0: // searching
- {
- int i;
- Wifi_AccessPoint ap;
- i=Wifi_FindMatchingAP(1,&wifi_connect_point,&ap);
- if(i==0) {
- Wifi_CopyMacAddr(WifiData->bssid9, ap.bssid);
- Wifi_CopyMacAddr(WifiData->apmac9, ap.bssid);
- WifiData->ssid9[0]=ap.ssid_len;
- for(i=0;i<32;i++) {
- WifiData->ssid9[i+1]=ap.ssid[i];
- }
- WifiData->apchannel9=ap.channel;
- for(i=0;i<16;i++) WifiData->baserates9[i]=ap.base_rates[i];
- WifiData->reqMode=WIFIMODE_NORMAL;
- WifiData->reqReqFlags |= WFLAG_REQ_APCONNECT | WFLAG_REQ_APCOPYVALUES;
- wifi_connect_state=1;
- }
- }
- return ASSOCSTATUS_SEARCHING;
- case 1: // associating
- switch(WifiData->curMode) {
- case WIFIMODE_DISABLED:
- case WIFIMODE_NORMAL:
- case WIFIMODE_DISASSOCIATE:
- return ASSOCSTATUS_DISCONNECTED;
- case WIFIMODE_SCAN:
- if(WifiData->reqReqFlags&WFLAG_REQ_APCONNECT) return ASSOCSTATUS_AUTHENTICATING;
- return ASSOCSTATUS_DISCONNECTED;
- case WIFIMODE_ASSOCIATE:
- switch(WifiData->authlevel) {
- case WIFI_AUTHLEVEL_DISCONNECTED:
- return ASSOCSTATUS_AUTHENTICATING;
- case WIFI_AUTHLEVEL_AUTHENTICATED:
- case WIFI_AUTHLEVEL_DEASSOCIATED:
- return ASSOCSTATUS_ASSOCIATING;
- case WIFI_AUTHLEVEL_ASSOCIATED:
-#ifdef WIFI_USE_TCP_SGIP
- if(wifi_hw) {
- if(!(wifi_hw->ipaddr)) {
- sgIP_DHCP_Start(wifi_hw,wifi_hw->dns[0]==0);
- wifi_connect_state=2;
- return ASSOCSTATUS_ACQUIRINGDHCP;
- }
- }
- sgIP_ARP_SendGratARP(wifi_hw);
-#endif
- wifi_connect_state=3;
- WifiData->flags9|=WFLAG_ARM9_NETREADY;
- return ASSOCSTATUS_ASSOCIATED;
- }
- break;
- case WIFIMODE_ASSOCIATED:
-#ifdef WIFI_USE_TCP_SGIP
- if(wifi_hw) {
- if(!(wifi_hw->ipaddr)) {
- sgIP_DHCP_Start(wifi_hw,wifi_hw->dns[0]==0);
- wifi_connect_state=2;
- return ASSOCSTATUS_ACQUIRINGDHCP;
- }
- }
- sgIP_ARP_SendGratARP(wifi_hw);
-#endif
- wifi_connect_state=3;
- WifiData->flags9|=WFLAG_ARM9_NETREADY;
- return ASSOCSTATUS_ASSOCIATED;
- case WIFIMODE_CANNOTASSOCIATE:
- return ASSOCSTATUS_CANNOTCONNECT;
- }
- return ASSOCSTATUS_DISCONNECTED;
- case 2: // dhcp'ing
-#ifdef WIFI_USE_TCP_SGIP
- {
- int i;
- i=sgIP_DHCP_Update();
- if(i!=SGIP_DHCP_STATUS_WORKING) {
- switch(i) {
- case SGIP_DHCP_STATUS_SUCCESS:
- wifi_connect_state=3;
- WifiData->flags9|=WFLAG_ARM9_NETREADY;
- sgIP_ARP_SendGratARP(wifi_hw);
- sgIP_DNS_Record_Localhost();
- return ASSOCSTATUS_ASSOCIATED;
- default:
- case SGIP_DHCP_STATUS_IDLE:
- case SGIP_DHCP_STATUS_FAILED:
- Wifi_DisconnectAP();
- wifi_connect_state=-1;
- return ASSOCSTATUS_CANNOTCONNECT;
-
- }
- }
- }
-#else
- // should never get here (dhcp state) without sgIP!
- Wifi_DisconnectAP();
- wifi_connect_state=-1;
- return ASSOCSTATUS_CANNOTCONNECT;
-#endif
- return ASSOCSTATUS_ACQUIRINGDHCP;
- case 3: // connected!
- return ASSOCSTATUS_ASSOCIATED;
- case 4: // search nintendo WFC data for a suitable AP
- {
- int n,i;
- for(n=0;n<3;n++) if(!(WifiData->wfc_enable[n]&0x80)) break;
- Wifi_AccessPoint ap;
- n=Wifi_FindMatchingAP(n,WifiData->wfc_ap,&ap);
- if(n!=-1) {
-#ifdef WIFI_USE_TCP_SGIP
- Wifi_SetIP(WifiData->wfc_config[n][0],WifiData->wfc_config[n][1],WifiData->wfc_config[n][2],WifiData->wfc_config[n][3],WifiData->wfc_config[n][4]);
-#endif
- WifiData->wepmode9=WifiData->wfc_enable[n]&0x03; // copy data
- WifiData->wepkeyid9=(WifiData->wfc_enable[n]>>4)&7;
- for(i=0;i<16;i++) {
- WifiData->wepkey9[i]=WifiData->wfc_wepkey[n][i];
- }
-
- Wifi_CopyMacAddr(WifiData->bssid9, ap.bssid);
- Wifi_CopyMacAddr(WifiData->apmac9, ap.bssid);
- WifiData->ssid9[0]=ap.ssid_len;
- for(i=0;i<32;i++) {
- WifiData->ssid9[i+1]=ap.ssid[i];
- }
- WifiData->apchannel9=ap.channel;
- for(i=0;i<16;i++) WifiData->baserates9[i]=ap.base_rates[i];
- WifiData->reqMode=WIFIMODE_NORMAL;
- WifiData->reqReqFlags |= WFLAG_REQ_APCONNECT | WFLAG_REQ_APCOPYVALUES;
- wifi_connect_state=1;
- return ASSOCSTATUS_SEARCHING;
-
- }
-
- }
- return ASSOCSTATUS_SEARCHING;
- }
- return ASSOCSTATUS_CANNOTCONNECT;
-}
-
-
-int Wifi_DisconnectAP() {
- WifiData->reqMode=WIFIMODE_NORMAL;
- WifiData->reqReqFlags &= ~WFLAG_REQ_APCONNECT;
- WifiData->flags9&=~WFLAG_ARM9_NETREADY;
-
- wifi_connect_state=-1;
- return 0;
-}
-
-
-#ifdef WIFI_USE_TCP_SGIP
-
-
-
-int Wifi_TransmitFunction(sgIP_Hub_HWInterface * hw, sgIP_memblock * mb) {
- // convert ethernet frame into wireless frame and output.
- // ethernet header: 6byte dest, 6byte src, 2byte protocol_id
- // assumes individual pbuf len is >=14 bytes, it's pretty likely ;) - also hopes pbuf len is a multiple of 2 :|
- int base,framelen, hdrlen, writelen;
- int copytotal, copyexpect;
- u16 framehdr[6+12+2];
- sgIP_memblock * t;
- framelen=mb->totallength-14+8 + (WifiData->wepmode7?4:0);
-
- if(!(WifiData->flags9&WFLAG_ARM9_NETUP)) {
- SGIP_DEBUG_MESSAGE(("Transmit:err_netdown"));
- sgIP_memblock_free(mb);
- return 0; //?
- }
- if(framelen+40>Wifi_TxBufferWordsAvailable()*2) { // error, can't send this much!
- SGIP_DEBUG_MESSAGE(("Transmit:err_space"));
- sgIP_memblock_free(mb);
- return 0; //?
- }
-
- ethhdr_print('T',mb->datastart);
- framehdr[0]=0;
- framehdr[1]=0;
- framehdr[2]=0;
- framehdr[3]=0;
- framehdr[4]=0; // rate, will be filled in by the arm7.
- hdrlen=18;
- framehdr[7]=0;
-
- if(WifiData->curReqFlags&WFLAG_REQ_APADHOC) { // adhoc mode
- framehdr[6]=0x0008;
- Wifi_CopyMacAddr(framehdr+14,WifiData->bssid7);
- Wifi_CopyMacAddr(framehdr+11,WifiData->MacAddr);
- Wifi_CopyMacAddr(framehdr+8,((u8 *)mb->datastart));
- } else {
- framehdr[6]=0x0108;
- Wifi_CopyMacAddr(framehdr+8,WifiData->bssid7);
- Wifi_CopyMacAddr(framehdr+11,WifiData->MacAddr);
- Wifi_CopyMacAddr(framehdr+14,((u8 *)mb->datastart));
- }
- if(WifiData->wepmode7) { framehdr[6] |=0x4000; hdrlen=20; }
- framehdr[17] = 0;
- framehdr[18] = 0; // wep IV, will be filled in if needed on the arm7 side.
- framehdr[19] = 0;
-
- framehdr[5]=framelen+hdrlen*2-12+4;
- copyexpect= ((framelen+hdrlen*2-12+4) +12 -4 +1)/2;
- copytotal=0;
-
- WifiData->stats[WSTAT_TXQUEUEDPACKETS]++;
- WifiData->stats[WSTAT_TXQUEUEDBYTES]+=framelen+hdrlen*2;
-
- base = WifiData->txbufOut;
- Wifi_TxBufferWrite(base,hdrlen,framehdr);
- base += hdrlen;
- copytotal+=hdrlen;
- if(base>=(WIFI_TXBUFFER_SIZE/2)) base -= WIFI_TXBUFFER_SIZE/2;
-
- // add LLC header
- framehdr[0]=0xAAAA;
- framehdr[1]=0x0003;
- framehdr[2]=0x0000;
- framehdr[3]=((u16 *)mb->datastart)[6]; // frame type
-
- Wifi_TxBufferWrite(base,4,framehdr);
- base += 4;
- copytotal+=4;
- if(base>=(WIFI_TXBUFFER_SIZE/2)) base -= WIFI_TXBUFFER_SIZE/2;
-
- t=mb;
- writelen=(mb->thislength-14);
- if(writelen) {
- Wifi_TxBufferWrite(base,(writelen+1)/2,((u16 *)mb->datastart)+7);
- base+=(writelen+1)/2;
- copytotal+=(writelen+1)/2;
- if(base>=(WIFI_TXBUFFER_SIZE/2)) base -= WIFI_TXBUFFER_SIZE/2;
- }
- while(mb->next) {
- mb=mb->next;
- writelen=mb->thislength;
- Wifi_TxBufferWrite(base,(writelen+1)/2,((u16 *)mb->datastart));
- base+=(writelen+1)/2;
- copytotal+=(writelen+1)/2;
- if(base>=(WIFI_TXBUFFER_SIZE/2)) base -= WIFI_TXBUFFER_SIZE/2;
- }
- if(WifiData->wepmode7) { // add required extra bytes
- base+=2;
- copytotal+=2;
- if(base>=(WIFI_TXBUFFER_SIZE/2)) base -= WIFI_TXBUFFER_SIZE/2;
- }
- WifiData->txbufOut=base; // update fifo out pos, done sending packet.
-
- sgIP_memblock_free(t); // free packet, as we're the last stop on this chain.
-
- if(copytotal!=copyexpect) {
- SGIP_DEBUG_MESSAGE(("Tx exp:%i que:%i",copyexpect,copytotal));
- }
- if(synchandler) synchandler();
- return 0;
-}
-
-int Wifi_Interface_Init(sgIP_Hub_HWInterface * hw) {
- hw->MTU=2300;
- hw->ipaddr=(192)|(168<<8)|(1<<16)|(151<<24);
- hw->snmask=0x00FFFFFF;
- hw->gateway=(192)|(168<<8)|(1<<16)|(1<<24);
- hw->dns[0]=(192)|(168<<8)|(1<<16)|(1<<24);
- hw->hwaddrlen=6;
- Wifi_CopyMacAddr(hw->hwaddr,WifiData->MacAddr);
- hw->userdata=0;
- return 0;
-}
-
-void Wifi_Timer(int num_ms) {
- Wifi_Update();
- sgIP_Timer(num_ms);
-}
-
-#endif
-
-unsigned long Wifi_Init(int initflags) {
- erasemem(&Wifi_Data_Struct,sizeof(Wifi_Data_Struct));
- DC_FlushAll();
- WifiData = (Wifi_MainStruct *) (((u32)&Wifi_Data_Struct)| 0x00400000); // should prevent the cache from eating us alive.
-
-#ifdef WIFI_USE_TCP_SGIP
- switch(initflags & WIFIINIT_OPTION_HEAPMASK) {
- case WIFIINIT_OPTION_USEHEAP_128:
- wHeapAllocInit(128*1024);
- break;
- case WIFIINIT_OPTION_USEHEAP_64:
- wHeapAllocInit(64*1024);
- break;
- case WIFIINIT_OPTION_USEHEAP_256:
- wHeapAllocInit(256*1024);
- break;
- case WIFIINIT_OPTION_USEHEAP_512:
- wHeapAllocInit(512*1024);
- break;
- case WIFIINIT_OPTION_USECUSTOMALLOC:
- break;
- }
- sgIP_Init();
-
-#endif
-
- WifiData->flags9 = WFLAG_ARM9_ACTIVE | (initflags & WFLAG_ARM9_INITFLAGMASK) ;
- return (u32) &Wifi_Data_Struct;
-}
-
-int Wifi_CheckInit(void) {
- if(!WifiData) return 0;
- return ((WifiData->flags7 & WFLAG_ARM7_ACTIVE) && (WifiData->flags9 & WFLAG_ARM9_ARM7READY));
-}
-
-
-void Wifi_Update(void) {
- int cnt;
- int base, base2, len, fulllen;
- if(!WifiData) return;
-
-#ifdef WIFI_USE_TCP_SGIP
-
- if(!(WifiData->flags9&WFLAG_ARM9_ARM7READY)) {
- if(WifiData->flags7 & WFLAG_ARM7_ACTIVE) {
- WifiData->flags9 |=WFLAG_ARM9_ARM7READY;
- // add network interface.
- wifi_hw = sgIP_Hub_AddHardwareInterface(&Wifi_TransmitFunction,&Wifi_Interface_Init);
- sgIP_timems=WifiData->random; //hacky! but it should work just fine :)
- }
- }
- if(WifiData->authlevel!=WIFI_AUTHLEVEL_ASSOCIATED && WifiData->flags9&WFLAG_ARM9_NETUP) {
- WifiData->flags9 &= ~(WFLAG_ARM9_NETUP);
- } else if(WifiData->authlevel==WIFI_AUTHLEVEL_ASSOCIATED && !(WifiData->flags9&WFLAG_ARM9_NETUP)) {
- WifiData->flags9 |= (WFLAG_ARM9_NETUP);
- }
-
-#endif
-
- // check for received packets, forward to whatever wants them.
- cnt=0;
- while(WifiData->rxbufIn!=WifiData->rxbufOut) {
- base = WifiData->rxbufIn;
- len=Wifi_RxReadOffset(base,4);
- fulllen=((len+3)&(~3))+12;
-#ifdef WIFI_USE_TCP_SGIP
- // Do lwIP interfacing for rx here
- if((Wifi_RxReadOffset(base,6)&0x01CF)==0x0008) // if it is a non-null data packet coming from the AP (toDS==0)
- {
- u16 framehdr[6+12+2+4];
- sgIP_memblock * mb;
- int hdrlen;
- base2=base;
- Wifi_RxRawReadPacket(base,22*2,framehdr);
-
- // ethhdr_print('!',framehdr+8);
- if((framehdr[8]==((u16 *)WifiData->MacAddr)[0] && framehdr[9]==((u16 *)WifiData->MacAddr)[1] && framehdr[10]==((u16 *)WifiData->MacAddr)[2]) ||
- (framehdr[8]==0xFFFF && framehdr[9]==0xFFFF && framehdr[10]==0xFFFF)) {
- // destination matches our mac address, or the broadcast address.
- //if(framehdr[6]&0x4000) { // wep enabled (when receiving WEP packets, the IV is stripped for us! how nice :|
- // base2+=24; hdrlen=28; // base2+=[wifi hdr 12byte]+[802 header hdrlen]+[slip hdr 8byte]
- //} else {
- base2+=22; hdrlen=24;
- //}
- // SGIP_DEBUG_MESSAGE(("%04X %04X %04X %04X %04X",Wifi_RxReadOffset(base2-8,0),Wifi_RxReadOffset(base2-7,0),Wifi_RxReadOffset(base2-6,0),Wifi_RxReadOffset(base2-5,0),Wifi_RxReadOffset(base2-4,0)));
- // check for LLC/SLIP header...
- if(Wifi_RxReadOffset(base2-4,0)==0xAAAA && Wifi_RxReadOffset(base2-4,1)==0x0003 && Wifi_RxReadOffset(base2-4,2)==0) {
- mb = sgIP_memblock_allocHW(14,len-8-hdrlen);
- if(mb) {
- if(base2>=(WIFI_RXBUFFER_SIZE/2)) base2-=(WIFI_RXBUFFER_SIZE/2);
- Wifi_RxRawReadPacket(base2,(len-8-hdrlen)&(~1),((u16 *)mb->datastart)+7);
- if(len&1) ((u8 *)mb->datastart)[len+14-1-8-hdrlen]=Wifi_RxReadOffset(base2,((len-8-hdrlen)/2))&255;
- Wifi_CopyMacAddr(mb->datastart,framehdr+8); // copy dest
- if(Wifi_RxReadOffset(base,6)&0x0200) { // from DS set?
- Wifi_CopyMacAddr(((u8 *)mb->datastart)+6,framehdr+14); // copy src from adrs3
- } else {
- Wifi_CopyMacAddr(((u8 *)mb->datastart)+6,framehdr+11); // copy src from adrs2
- }
- ((u16 *)mb->datastart)[6]=framehdr[(hdrlen/2)+6+3]; // assume LLC exists and is 8 bytes.
-
- ethhdr_print('R',mb->datastart);
-
- // Done generating recieved data packet... now distribute it.
- sgIP_Hub_ReceiveHardwarePacket(wifi_hw,mb);
-
- }
- }
- }
- }
-
-#endif
-
- // check if we have a handler
- if(packethandler) {
- base2=base+6;
- if(base2>=(WIFI_RXBUFFER_SIZE/2)) base2-=(WIFI_RXBUFFER_SIZE/2);
- (*packethandler)(base2,len);
- }
-
- base+=fulllen/2;
- if(base>=(WIFI_RXBUFFER_SIZE/2)) base-=(WIFI_RXBUFFER_SIZE/2);
- WifiData->rxbufIn=base;
-
- if(cnt++>80) break;
- }
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-// Ip addr get/set functions
-#ifdef WIFI_USE_TCP_SGIP
-
-u32 Wifi_GetIP(void) {
- if(wifi_hw) return wifi_hw->ipaddr;
- return 0;
-}
-
-unsigned long Wifi_GetIPInfo(unsigned long * pGateway,unsigned long * pSnmask,unsigned long * pDns1,unsigned long * pDns2) {
- if(wifi_hw) {
- if(pGateway) *pGateway=wifi_hw->gateway;
- if(pSnmask) *pSnmask=wifi_hw->snmask;
- if(pDns1) *pDns1=wifi_hw->dns[0];
- if(pDns2) *pDns2=wifi_hw->dns[1];
- return wifi_hw->ipaddr;
- }
- return 0;
-}
-
-
-void Wifi_SetIP(u32 IPaddr, u32 gateway, u32 subnetmask, u32 dns1, u32 dns2) {
- if(wifi_hw) {
- SGIP_DEBUG_MESSAGE(("SetIP%08X %08X %08X",IPaddr,gateway,subnetmask));
- wifi_hw->ipaddr=IPaddr;
- wifi_hw->gateway=gateway;
- wifi_hw->snmask=subnetmask;
- wifi_hw->dns[0]=dns1;
- wifi_hw->dns[1]=dns2;
- // reset arp cache...
- sgIP_ARP_FlushInterface(wifi_hw);
- }
-}
-
-void Wifi_SetDHCP(void) {
-
-
-}
-
-#endif
-
-
-int Wifi_GetData(int datatype, int bufferlen, unsigned char * buffer) {
- int i;
- if(datatype<0 || datatype>=MAX_WIFIGETDATA) return -1;
- switch(datatype) {
- case WIFIGETDATA_MACADDRESS:
- if(bufferlen<6 || !buffer) return -1;
- for(i=0;i<6;i++) {
- buffer[i]=WifiData->MacAddr[i];
- }
- return 6;
- case WIFIGETDATA_NUMWFCAPS:
- for(i=0;i<3;i++) if(!(WifiData->wfc_enable[i]&0x80)) break;
- return i;
- }
- return -1;
-}
-
-u32 Wifi_GetStats(int statnum) {
- if(statnum<0 || statnum>=NUM_WIFI_STATS) return 0;
- return WifiData->stats[statnum];
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-// sync functions
-
-void Wifi_Sync(void) {
- Wifi_Update();
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/wifi_arm9.h b/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/wifi_arm9.h
deleted file mode 100644
index 3b354636cd..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/arm9/source/wifi_arm9.h
+++ /dev/null
@@ -1,122 +0,0 @@
-// DS Wifi interface code
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-// wifi_arm9.c - arm9 wifi support header
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-
-#ifndef WIFI_ARM9_H
-#define WIFI_ARM9_H
-
-#include "wifi_shared.h"
-
-
-
-// default option is to use 128k heap
-#define WIFIINIT_OPTION_USEHEAP_128 0x0000
-#define WIFIINIT_OPTION_USEHEAP_64 0x1000
-#define WIFIINIT_OPTION_USEHEAP_256 0x2000
-#define WIFIINIT_OPTION_USEHEAP_512 0x3000
-#define WIFIINIT_OPTION_USECUSTOMALLOC 0x4000
-#define WIFIINIT_OPTION_HEAPMASK 0xF000
-
-#ifdef WIFI_USE_TCP_SGIP
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
-
-extern volatile Wifi_MainStruct * WifiData;
-
-enum WIFIGETDATA {
- WIFIGETDATA_MACADDRESS, // MACADDRESS: returns data in the buffer, requires at least 6 bytes
- WIFIGETDATA_NUMWFCAPS, // NUM WFC APS: returns number between 0 and 3, doesn't use buffer.
-
- MAX_WIFIGETDATA
-};
-
-// Wifi Packet Handler function: (int packetID, int packetlength) - packetID is only valid while the called function is executing.
-// call Wifi_RxRawReadPacket while in the packet handler function, to retreive the data to a local buffer.
-typedef void (*WifiPacketHandler)(int, int);
-
-// Wifi Sync Handler function: Callback function that is called when the arm7 needs to be told to synchronize with new fifo data.
-// If this callback is used (see Wifi_SetSyncHandler()), it should send a message via the fifo to the arm7, which will call Wifi_Sync() on arm7.
-typedef void (*WifiSyncHandler)(void);
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void Wifi_CopyMacAddr(volatile void * dest, volatile void * src);
-extern int Wifi_CmpMacAddr(volatile void * mac1, volatile void * mac2);
-
-extern unsigned long Wifi_Init(int initflags);
-extern int Wifi_CheckInit(void);
-
-extern int Wifi_RawTxFrame(u16 datalen, u16 rate, u16 * data);
-extern void Wifi_SetSyncHandler(WifiSyncHandler wshfunc);
-extern void Wifi_RawSetPacketHandler(WifiPacketHandler wphfunc);
-extern int Wifi_RxRawReadPacket(s32 packetID, s32 readlength, u16 * data);
-
-extern void Wifi_DisableWifi(void);
-extern void Wifi_EnableWifi(void);
-extern void Wifi_SetPromiscuousMode(int enable);
-extern void Wifi_ScanMode(void);
-extern void Wifi_SetChannel(int channel);
-
-extern int Wifi_GetNumAP(void);
-extern int Wifi_GetAPData(int apnum, Wifi_AccessPoint * apdata);
-extern int Wifi_FindMatchingAP(int numaps, Wifi_AccessPoint * apdata, Wifi_AccessPoint * match_dest);
-extern int Wifi_ConnectAP(Wifi_AccessPoint * apdata, int wepmode, int wepkeyid, u8 * wepkey);
-extern void Wifi_AutoConnect(void);
-
-extern int Wifi_AssocStatus(void);
-extern int Wifi_DisconnectAP(void);
-extern int Wifi_GetData(int datatype, int bufferlen, unsigned char * buffer);
-
-
-extern void Wifi_Update(void);
-extern void Wifi_Sync(void);
-
-#ifdef WIFI_USE_TCP_SGIP
-extern void Wifi_Timer(int num_ms);
-extern void Wifi_SetIP(u32 IPaddr, u32 gateway, u32 subnetmask, u32 dns1, u32 dns2);
-extern u32 Wifi_GetIP(void);
-
-#endif
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/common/source/dsregs.h b/c/src/lib/libbsp/arm/nds/dswifi/common/source/dsregs.h
deleted file mode 100644
index 3d4c489a85..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/common/source/dsregs.h
+++ /dev/null
@@ -1,179 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-// DSRegs.h - (c) 2005-2006 Stephen Stair
-// General reference mumbo jumbo to give me easy access to the regs I like.
-//////////////////////////////////////////////////////////////////////////
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#ifndef DSREGS_H
-#define DSREGS_H
-
-#include <nds.h>
-
-
-//////////////////////////////////////////////////////////////////////////
-// General registers
-
-
-// general memory range defines
-#define PAL ((u16 *) 0x05000000)
-#define VRAM1 ((u16 *) 0x06000000)
-#define VRAM2 ((u16 *) 0x06200000)
-
-//#define OAM ((u16 *) 0x07000000)
-#define CART ((u16 *) 0x08000000)
-
-
-// video registers
-#define DISPCNT (*((u32 volatile *) 0x04000000))
-#define DISPSTAT (*((u16 volatile *) 0x04000004))
-#define VCOUNT (*((u16 volatile *) 0x04000006))
-#define BG0CNT (*((u16 volatile *) 0x04000008))
-#define BG1CNT (*((u16 volatile *) 0x0400000A))
-#define BG2CNT (*((u16 volatile *) 0x0400000C))
-#define BG3CNT (*((u16 volatile *) 0x0400000E))
-#define BG0HOFS (*((u16 volatile *) 0x04000010))
-#define BG0VOFS (*((u16 volatile *) 0x04000012))
-#define BG1HOFS (*((u16 volatile *) 0x04000014))
-#define BG1VOFS (*((u16 volatile *) 0x04000016))
-#define BG2HOFS (*((u16 volatile *) 0x04000018))
-#define BG2VOFS (*((u16 volatile *) 0x0400001A))
-#define BG3HOFS (*((u16 volatile *) 0x0400001C))
-#define BG3VOFS (*((u16 volatile *) 0x0400001E))
-#define BG2PA (*((u16 volatile *) 0x04000020))
-#define BG2PB (*((u16 volatile *) 0x04000022))
-#define BG2PC (*((u16 volatile *) 0x04000024))
-#define BG2PD (*((u16 volatile *) 0x04000026))
-#define BG2X (*((u32 volatile *) 0x04000028))
-#define BG2Y (*((u32 volatile *) 0x0400002C))
-#define BG3PA (*((u16 volatile *) 0x04000030))
-#define BG3PB (*((u16 volatile *) 0x04000032))
-#define BG3PC (*((u16 volatile *) 0x04000034))
-#define BG3PD (*((u16 volatile *) 0x04000036))
-#define BG3X (*((u32 volatile *) 0x04000038))
-#define BG3Y (*((u32 volatile *) 0x0400003C))
-#define WIN0H (*((u16 volatile *) 0x04000040))
-#define WIN1H (*((u16 volatile *) 0x04000042))
-#define WIN0V (*((u16 volatile *) 0x04000044))
-#define WIN1V (*((u16 volatile *) 0x04000046))
-#define WININ (*((u16 volatile *) 0x04000048))
-#define WINOUT (*((u16 volatile *) 0x0400004A))
-#define MOSAIC (*((u16 volatile *) 0x0400004C))
-#define BLDCNT (*((u16 volatile *) 0x04000050))
-#define BLDALPHA (*((u16 volatile *) 0x04000052))
-#define BLDY (*((u16 volatile *) 0x04000054))
-
-#define DISPCNT2 (*((u32 volatile *) 0x04001000))
-#define DISPSTAT2 (*((u16 volatile *) 0x04001004))
-#define VCOUNT2 (*((u16 volatile *) 0x04001006))
-#define BG0CNT2 (*((u16 volatile *) 0x04001008))
-#define BG1CNT2 (*((u16 volatile *) 0x0400100A))
-#define BG2CNT2 (*((u16 volatile *) 0x0400100C))
-#define BG3CNT2 (*((u16 volatile *) 0x0400100E))
-#define BG0HOFS2 (*((u16 volatile *) 0x04001010))
-#define BG0VOFS2 (*((u16 volatile *) 0x04001012))
-#define BG1HOFS2 (*((u16 volatile *) 0x04001014))
-#define BG1VOFS2 (*((u16 volatile *) 0x04001016))
-#define BG2HOFS2 (*((u16 volatile *) 0x04001018))
-#define BG2VOFS2 (*((u16 volatile *) 0x0400101A))
-#define BG3HOFS2 (*((u16 volatile *) 0x0400101C))
-#define BG3VOFS2 (*((u16 volatile *) 0x0400101E))
-#define BG2PA2 (*((u16 volatile *) 0x04001020))
-#define BG2PB2 (*((u16 volatile *) 0x04001022))
-#define BG2PC2 (*((u16 volatile *) 0x04001024))
-#define BG2PD2 (*((u16 volatile *) 0x04001026))
-#define BG2X2 (*((u32 volatile *) 0x04001028))
-#define BG2Y2 (*((u32 volatile *) 0x0400102C))
-#define BG3PA2 (*((u16 volatile *) 0x04001030))
-#define BG3PB2 (*((u16 volatile *) 0x04001032))
-#define BG3PC2 (*((u16 volatile *) 0x04001034))
-#define BG3PD2 (*((u16 volatile *) 0x04001036))
-#define BG3X2 (*((u32 volatile *) 0x04001038))
-#define BG3Y2 (*((u32 volatile *) 0x0400103C))
-#define WIN0H2 (*((u16 volatile *) 0x04001040))
-#define WIN1H2 (*((u16 volatile *) 0x04001042))
-#define WIN0V2 (*((u16 volatile *) 0x04001044))
-#define WIN1V2 (*((u16 volatile *) 0x04001046))
-#define WININ2 (*((u16 volatile *) 0x04001048))
-#define WINOUT2 (*((u16 volatile *) 0x0400104A))
-#define MOSAIC2 (*((u16 volatile *) 0x0400104C))
-#define BLDCNT2 (*((u16 volatile *) 0x04001050))
-#define BLDALPHA2 (*((u16 volatile *) 0x04001052))
-#define BLDY2 (*((u16 volatile *) 0x04001054))
-
-// video memory defines
-#define PAL_BG1 ((u16 *) 0x05000000)
-#define PAL_FG1 ((u16 *) 0x05000200)
-#define PAL_BG2 ((u16 *) 0x05000400)
-#define PAL_FG2 ((u16 *) 0x05000600)
-
-// other video defines
-#define VRAMBANKCNT (((u16 volatile *) 0x04000240))
-
-#define RGB(r,g,b) ( ((r)&31) | (((g)&31)<<5) | (((b)&31)<<10) )
-#define VRAM_SETBANK(bank, set) \
- if((bank)&1) { VRAMBANKCNT[(bank)>>1] = (VRAMBANKCNT[(bank)>>1]&0x00ff) | (((set)&0xff)<<8); } else \
- { VRAMBANKCNT[(bank)>>1] = (VRAMBANKCNT[(bank)>>1]&0xff00) | ((set)&0xff); }
-
-// joypad input
-#define KEYINPUT (*((u16 volatile *) 0x04000130))
-#define KEYCNT (*((u16 volatile *) 0x04000132))
-
-
-// System registers
-#define WAITCNT (*((u16 volatile *) 0x04000204))
-//#define IME (*((u16 volatile *) 0x04000208))
-//#define IE (*((u32 volatile *) 0x04000210))
-//#define IF (*((u32 volatile *) 0x04000214))
-#define HALTCNT (*((u16 volatile *) 0x04000300))
-
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////
-// ARM7 specific registers
-#ifdef ARM7
-#define POWERCNT7 (*((u16 volatile *) 0x04000304))
-
-#define SPI_CR (*((u16 volatile *) 0x040001C0))
-#define SPI_DATA (*((u16 volatile *) 0x040001C2))
-
-
-
-#endif
-
-//////////////////////////////////////////////////////////////////////////
-// ARM9 specific registers
-#ifdef ARM9
-#define POWERCNT (*((u16 volatile *) 0x04000308))
-
-
-
-#endif
-// End of file!
-#endif
-
-
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/common/source/spinlock.S b/c/src/lib/libbsp/arm/nds/dswifi/common/source/spinlock.S
deleted file mode 100644
index 78f3ca08bc..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/common/source/spinlock.S
+++ /dev/null
@@ -1,41 +0,0 @@
- .text
-
- .code 32
-
-
-.GLOBL SLasm_Acquire, SLasm_Release
-.ARM
-SLasm_Acquire:
- ldr r2,[r0]
- cmp r2,#0
- movne r0,#1
- bxne lr
- mov r2,r1
- swp r2,r2,[r0]
- cmp r2,#0
- cmpne r2,r1
- moveq r0,#0
- bxeq lr
- swp r2,r2,[r0]
- mov r0,#1
- bx lr
-
-
-
-SLasm_Release:
- ldr r2,[r0]
- cmp r2,r1
- movne r0,#2
- bxne lr
- mov r2,#0
- swp r2,r2,[r0]
- cmp r2,r1
- moveq r0,#0
- movne r0,#2
- bx lr
-
-
-
- .pool
- .end
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/common/source/spinlock.h b/c/src/lib/libbsp/arm/nds/dswifi/common/source/spinlock.h
deleted file mode 100644
index 0900dbd122..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/common/source/spinlock.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// DS Wifi interface code
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-// spinlock.h - code for spinlocking for basic wifi structure memory protection
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-
-
-/*
-
-__asm__ (
-".GLOBL SLasm_Acquire, SLasm_Release \n"
-".ARM \n"
-"SLasm_Acquire: \n"
-" ldr r2,[r0] \n"
-" cmp r2,#0 \n"
-" movne r0,#1 \n"
-" bxne lr \n"
-" mov r2,r1 \n"
-" swp r2,r2,[r0] \n"
-" cmp r2,#0 \n"
-" cmpne r2,r1 \n"
-" moveq r0,#0 \n"
-" bxeq lr \n"
-" swp r2,r2,[r0] \n"
-" mov r0,#1 \n"
-" bx lr \n"
-"\n\n"
-"SLasm_Release: \n"
-" ldr r2,[r0] \n"
-" cmp r2,r1 \n"
-" movne r0,#2 \n"
-" bxne lr \n"
-" mov r2,#0 \n"
-" swp r2,r2,[r0] \n"
-" cmp r2,r1 \n"
-" moveq r0,#0 \n"
-" movne r0,#2 \n"
-" bx lr \n"
-);
-
-*/
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/common/source/wifi_shared.h b/c/src/lib/libbsp/arm/nds/dswifi/common/source/wifi_shared.h
deleted file mode 100644
index 8656feea6d..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/common/source/wifi_shared.h
+++ /dev/null
@@ -1,284 +0,0 @@
-// DS Wifi interface code
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-// wifi_shared.h - Shared structures to be used by arm9 and arm7
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#ifndef WIFI_SHARED_H
-#define WIFI_SHARED_H
-
-
-#include <nds.h>
-
-
-
-// on spinlock contention, the side unsuccessfully attempting the lock reverts the lock.
-// if the unlocking side sees the lock incorrectly set, the unlocking side will delay until it has reverted to the correct value, then continue unlocking.
-// there should be a delay of at least about ~10-20 cycles between a lock and unlock, to prevent contention.
-#define SPINLOCK_NOBODY 0x0000
-#define SPINLOCK_ARM7 0x0001
-#define SPINLOCK_ARM9 0x0002
-
-#define SPINLOCK_OK 0x0000
-#define SPINLOCK_INUSE 0x0001
-#define SPINLOCK_ERROR 0x0002
-
-#ifdef ARM7
-#define SPINLOCK_VALUE SPINLOCK_ARM7
-#endif
-#ifdef ARM9
-#define SPINLOCK_VALUE SPINLOCK_ARM9
-#endif
-
-
-#define Spinlock_Acquire(structtolock) SLasm_Acquire(&((structtolock).spinlock),SPINLOCK_VALUE)
-#define Spinlock_Release(structtolock) SLasm_Release(&((structtolock).spinlock),SPINLOCK_VALUE)
-#define Spinlock_Check(structtolock) (((structtolock).spinlock)!=SPINLOCK_NOBODY)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern u32 SLasm_Acquire(volatile u32 * lockaddr, u32 lockvalue);
-extern u32 SLasm_Release(volatile u32 * lockaddr, u32 lockvalue);
-
-#ifdef __cplusplus
-};
-#endif
-
-// If for whatever reason you want to ditch SGIP and use your own stack, comment out the following line.
-#define WIFI_USE_TCP_SGIP 1
-
-#define WIFI_RXBUFFER_SIZE (1024*12)
-#define WIFI_TXBUFFER_SIZE (1024*24)
-#define WIFI_MAX_AP 32
-#define WIFI_MAX_ASSOC_RETRY 30
-#define WIFI_PS_POLL_CONST 2
-
-#define WIFI_MAX_PROBE 4
-
-#define WIFI_AP_TIMEOUT 40
-
-#define WFLAG_PACKET_DATA 0x0001
-#define WFLAG_PACKET_MGT 0x0002
-#define WFLAG_PACKET_BEACON 0x0004
-#define WFLAG_PACKET_CTRL 0x0008
-
-
-#define WFLAG_PACKET_ALL 0xFFFF
-
-#define WFLAG_ARM7_ACTIVE 0x0001
-#define WFLAG_ARM7_RUNNING 0x0002
-
-#define WFLAG_ARM9_ACTIVE 0x0001
-#define WFLAG_ARM9_USELED 0x0002
-#define WFLAG_ARM9_ARM7READY 0x0004
-#define WFLAG_ARM9_NETUP 0x0008
-#define WFLAG_ARM9_NETREADY 0x0010
-
-#define WFLAG_ARM9_INITFLAGMASK 0x0002
-
-#define WFLAG_IP_GOTDHCP 0x0001
-
-// request - request flags
-#define WFLAG_REQ_APCONNECT 0x0001
-#define WFLAG_REQ_APCOPYVALUES 0x0002
-#define WFLAG_REQ_APADHOC 0x0008
-#define WFLAG_REQ_PROMISC 0x0010
-#define WFLAG_REQ_USEWEP 0x0020
-
-// request - informational flags
-#define WFLAG_REQ_APCONNECTED 0x8000
-
-#define WFLAG_APDATA_ADHOC 0x0001
-#define WFLAG_APDATA_WEP 0x0002
-#define WFLAG_APDATA_WPA 0x0004
-#define WFLAG_APDATA_COMPATIBLE 0x0008
-#define WFLAG_APDATA_EXTCOMPATIBLE 0x0010
-#define WFLAG_APDATA_SHORTPREAMBLE 0x0020
-#define WFLAG_APDATA_ACTIVE 0x8000
-
-
-enum WIFI_RETURN {
- WIFI_RETURN_OK = 0, // Everything went ok
- WIFI_RETURN_LOCKFAILED = 1, // the spinlock attempt failed (it wasn't retried cause that could lock both cpus- retry again after a delay.
- WIFI_RETURN_ERROR = 2, // There was an error in attempting to complete the requested task.
- WIFI_RETURN_PARAMERROR = 3, // There was an error in the parameters passed to the function.
-};
-
-enum WIFI_STATS {
- // software stats
- WSTAT_RXQUEUEDPACKETS, // number of packets queued into the rx fifo
- WSTAT_TXQUEUEDPACKETS, // number of packets queued into the tx fifo
- WSTAT_RXQUEUEDBYTES, // number of bytes queued into the rx fifo
- WSTAT_TXQUEUEDBYTES, // number of bytes queued into the tx fifo
- WSTAT_RXQUEUEDLOST, // number of packets lost due to space limitations in queuing
- WSTAT_TXQUEUEDREJECTED, // number of packets rejected due to space limitations in queuing
- WSTAT_RXPACKETS,
- WSTAT_RXBYTES,
- WSTAT_RXDATABYTES,
- WSTAT_TXPACKETS,
- WSTAT_TXBYTES,
- WSTAT_TXDATABYTES,
- WSTAT_ARM7_UPDATES,
- WSTAT_DEBUG,
- // harware stats (function mostly unknown.)
- WSTAT_HW_1B0,WSTAT_HW_1B1,WSTAT_HW_1B2,WSTAT_HW_1B3,WSTAT_HW_1B4,WSTAT_HW_1B5,WSTAT_HW_1B6,WSTAT_HW_1B7,
- WSTAT_HW_1B8,WSTAT_HW_1B9,WSTAT_HW_1BA,WSTAT_HW_1BB,WSTAT_HW_1BC,WSTAT_HW_1BD,WSTAT_HW_1BE,WSTAT_HW_1BF,
- WSTAT_HW_1C0,WSTAT_HW_1C1,WSTAT_HW_1C4,WSTAT_HW_1C5,
- WSTAT_HW_1D0,WSTAT_HW_1D1,WSTAT_HW_1D2,WSTAT_HW_1D3,WSTAT_HW_1D4,WSTAT_HW_1D5,WSTAT_HW_1D6,WSTAT_HW_1D7,
- WSTAT_HW_1D8,WSTAT_HW_1D9,WSTAT_HW_1DA,WSTAT_HW_1DB,WSTAT_HW_1DC,WSTAT_HW_1DD,WSTAT_HW_1DE,WSTAT_HW_1DF,
-
- NUM_WIFI_STATS
-};
-
-
-enum WIFI_MODE {
- WIFIMODE_DISABLED,
- WIFIMODE_NORMAL,
- WIFIMODE_SCAN,
- WIFIMODE_ASSOCIATE,
- WIFIMODE_ASSOCIATED,
- WIFIMODE_DISASSOCIATE,
- WIFIMODE_CANNOTASSOCIATE,
-};
-enum WIFI_AUTHLEVEL {
- WIFI_AUTHLEVEL_DISCONNECTED,
- WIFI_AUTHLEVEL_AUTHENTICATED,
- WIFI_AUTHLEVEL_ASSOCIATED,
- WIFI_AUTHLEVEL_DEASSOCIATED,
-};
-
-enum WEPMODES {
- WEPMODE_NONE = 0,
- WEPMODE_40BIT = 1,
- WEPMODE_128BIT = 2
-};
-
-enum WIFI_ASSOCSTATUS {
- ASSOCSTATUS_DISCONNECTED, // not *trying* to connect
- ASSOCSTATUS_SEARCHING, // data given does not completely specify an AP, looking for AP that matches the data.
- ASSOCSTATUS_AUTHENTICATING, // connecting...
- ASSOCSTATUS_ASSOCIATING, // connecting...
- ASSOCSTATUS_ACQUIRINGDHCP, // connected to AP, but getting IP data from DHCP
- ASSOCSTATUS_ASSOCIATED, // Connected! (COMPLETE if Wifi_ConnectAP was called to start)
- ASSOCSTATUS_CANNOTCONNECT, // error in connecting... (COMPLETE if Wifi_ConnectAP was called to start)
-};
-
-typedef struct WIFI_TXHEADER {
- u16 enable_flags;
- u16 unknown;
- u16 countup;
- u16 beaconfreq;
- u16 tx_rate;
- u16 tx_length;
-} Wifi_TxHeader;
-
-typedef struct WIFI_RXHEADER {
- u16 a;
- u16 b;
- u16 c;
- u16 d;
- u16 byteLength;
- u16 rssi_;
-} Wifi_RxHeader;
-
-typedef struct WIFI_ACCESSPOINT {
- char ssid[33]; // 0-32byte data, zero
- char ssid_len;
- u8 bssid[6];
- u8 macaddr[6];
- u16 maxrate; // max rate is measured in steps of 1/2Mbit - 5.5Mbit will be represented as 11, or 0x0B
- u32 timectr;
- u16 rssi;
- u16 flags;
- u32 spinlock;
- u8 channel;
- u8 rssi_past[8];
- u8 base_rates[16]; // terminated by a 0 entry
-} Wifi_AccessPoint;
-
-typedef struct WIFI_MAINSTRUCT {
- unsigned long dummy1[8];
- // wifi status
- u16 curChannel, reqChannel;
- u16 curMode, reqMode;
- u16 authlevel,authctr;
- u32 flags9, flags7, reqPacketFlags;
- u16 curReqFlags, reqReqFlags;
- u32 counter7,bootcounter7;
- char MacAddr[6];
- u16 authtype;
- u16 iptype,ipflags;
- u32 ip,snmask,gateway;
-
- // current AP data
- char ssid7[34],ssid9[34];
- u8 bssid7[6], bssid9[6];
- u8 apmac7[6], apmac9[6];
- char wepmode7, wepmode9;
- char wepkeyid7, wepkeyid9;
- u8 wepkey7[20],wepkey9[20];
- u8 baserates7[16], baserates9[16];
- u8 apchannel7, apchannel9;
- u8 maxrate7;
- u16 ap_rssi;
- u16 pspoll_period;
-
- // AP data
- Wifi_AccessPoint aplist[WIFI_MAX_AP];
-
- // probe stuff
- u8 probe9_numprobe;
- u8 probe9_ssidlen[WIFI_MAX_PROBE];
- char probe9_ssid[WIFI_MAX_PROBE][32];
-
- // WFC data
- u8 wfc_enable[4]; // wep mode, or 0x80 for "enabled"
- Wifi_AccessPoint wfc_ap[3];
- unsigned long wfc_config[3][5]; // ip, snmask, gateway, primarydns, 2nddns
- u8 wfc_wepkey[3][16];
-
-
- // wifi data
- u32 rxbufIn, rxbufOut; // bufIn/bufOut have 2-byte granularity.
- u16 rxbufData[WIFI_RXBUFFER_SIZE/2]; // send raw 802.11 data through! rxbuffer is for rx'd data, arm7->arm9 transfer
-
- u32 txbufIn, txbufOut;
- u16 txbufData[WIFI_TXBUFFER_SIZE/2]; // tx buffer is for data to tx, arm9->arm7 transfer
-
- // stats data
- u32 stats[NUM_WIFI_STATS];
-
- u16 debug[30];
-
- u32 random; // semirandom number updated at the convenience of the arm7. use for initial seeds & such.
-
- unsigned long dummy2[8];
-
-} Wifi_MainStruct;
-
-
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/dswifi_license.txt b/c/src/lib/libbsp/arm/nds/dswifi/dswifi_license.txt
deleted file mode 100644
index 2ab66f783e..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/dswifi_license.txt
+++ /dev/null
@@ -1,27 +0,0 @@
- DSWifi Project - sgIP Internet Protocol Stack Implementation
-
- Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org
-
- http://www.akkit.org
-
-
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/include/dswifi7.h b/c/src/lib/libbsp/arm/nds/dswifi/include/dswifi7.h
deleted file mode 100644
index cc8b5322c0..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/include/dswifi7.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// DSWifi Project - Arm7 Library Header file (dswifi7.h)
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#ifndef DSWIFI7_H
-#define DSWIFI7_H
-
-#include "dswifi_version.h"
-
-// Wifi Sync Handler function: Callback function that is called when the arm9 needs to be told to synchronize with new fifo data.
-// If this callback is used (see Wifi_SetSyncHandler()), it should send a message via the fifo to the arm9, which will call Wifi_Sync() on arm9.
-typedef void (*WifiSyncHandler)(void);
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Read_Flash: Reads an arbitrary amount of data from the firmware flash chip
-// int address: Offset to start reading from in the flash chip
-// char * destination: Pointer to a memory buffer to hold incoming data
-// int length: The number of bytes to read
-extern void Read_Flash(int address, char * destination, int length);
-
-// PowerChip_ReadWrite: Reads or writes a value to the DS's power chip
-// int cmp: The byte-long command to send to the chip (top bit 1=read, 0=write - other bits = register ID to read/write)
-// int data: The data to write to the chip (if sending a read command, this should be zero)
-// Returns: The data read returned by the serial connection; only really useful when reading.
-extern int PowerChip_ReadWrite(int cmd, int data);
-
-// Wifi_Interrupt: Handler for the arm7 wifi interrupt. Should be called by the
-// interrupt handler on arm7, and should *not* have multiple interrupts enabled.
-extern void Wifi_Interrupt(void);
-
-// Wifi_Update: Sync function to ensure data continues to flow between the two
-// CPUs smoothly. Should be called at a periodic interval, such as in vblank.
-extern void Wifi_Update(void);
-
-// Wifi_Init: Requires the data returned by the arm9 wifi init call. The arm9
-// init call's returned data must be passed to the arm7 and then given to this
-// function. (or else very bad things happen)
-// This function also enables power to the wifi system, which will shorten
-// battery life.
-// unsigned long WifiData: You must pass the 32bit value returned by the call to
-// Wifi_Init on the ARM9.
-extern void Wifi_Init(unsigned long WifiData);
-
-// Wifi_Deinit: In the case that it is necessary, this function cuts power to
-// the wifi system. After this the wifi will be unusable until Wifi_Init is
-// called again.
-extern void Wifi_Deinit(void);
-
-// Wifi_Sync: Call this function when requested to sync by the arm9 side of the
-// wifi lib
-extern void Wifi_Sync(void);
-
-// Wifi_SetSyncHandler: Call this function to request notification of when the
-// ARM9-side Wifi_Sync function should be called.
-// WifiSyncHandler sh: Pointer to the function to be called for notification.
-extern void Wifi_SetSyncHandler(WifiSyncHandler sh);
-
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif // DSWIFI7_H
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/include/dswifi9.h b/c/src/lib/libbsp/arm/nds/dswifi/include/dswifi9.h
deleted file mode 100644
index 9171b48aac..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/include/dswifi9.h
+++ /dev/null
@@ -1,337 +0,0 @@
-// DSWifi Project - Arm9 Library Header File (dswifi9.h)
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#ifndef DSWIFI9_H
-#define DSWIFI9_H
-
-#include "dswifi_version.h"
-
-// well, some flags and stuff are just stuffed in here and not documented very well yet... Most of the important stuff is documented though.
-// Next version should clean up some of this a lot more :)
-
-#define WIFIINIT_OPTION_USELED 0x0002
-
-// default option is to use 128k heap
-#define WIFIINIT_OPTION_USEHEAP_128 0x0000
-#define WIFIINIT_OPTION_USEHEAP_64 0x1000
-#define WIFIINIT_OPTION_USEHEAP_256 0x2000
-#define WIFIINIT_OPTION_USEHEAP_512 0x3000
-#define WIFIINIT_OPTION_USECUSTOMALLOC 0x4000
-#define WIFIINIT_OPTION_HEAPMASK 0xF000
-
-#define WFLAG_PACKET_DATA 0x0001
-#define WFLAG_PACKET_MGT 0x0002
-#define WFLAG_PACKET_BEACON 0x0004
-#define WFLAG_PACKET_CTRL 0x0008
-
-#define WFLAG_PACKET_ALL 0xFFFF
-
-
-#define WFLAG_APDATA_ADHOC 0x0001
-#define WFLAG_APDATA_WEP 0x0002
-#define WFLAG_APDATA_WPA 0x0004
-#define WFLAG_APDATA_COMPATIBLE 0x0008
-#define WFLAG_APDATA_EXTCOMPATIBLE 0x0010
-#define WFLAG_APDATA_SHORTPREAMBLE 0x0020
-#define WFLAG_APDATA_ACTIVE 0x8000
-
-enum WIFI_RETURN {
- WIFI_RETURN_OK = 0, // Everything went ok
- WIFI_RETURN_LOCKFAILED = 1, // the spinlock attempt failed (it wasn't retried cause that could lock both cpus- retry again after a delay.
- WIFI_RETURN_ERROR = 2, // There was an error in attempting to complete the requested task.
- WIFI_RETURN_PARAMERROR = 3, // There was an error in the parameters passed to the function.
-};
-
-enum WIFI_STATS {
- // software stats
- WSTAT_RXQUEUEDPACKETS, // number of packets queued into the rx fifo
- WSTAT_TXQUEUEDPACKETS, // number of packets queued into the tx fifo
- WSTAT_RXQUEUEDBYTES, // number of bytes queued into the rx fifo
- WSTAT_TXQUEUEDBYTES, // number of bytes queued into the tx fifo
- WSTAT_RXQUEUEDLOST, // number of packets lost due to space limitations in queuing
- WSTAT_TXQUEUEDREJECTED, // number of packets rejected due to space limitations in queuing
- WSTAT_RXPACKETS,
- WSTAT_RXBYTES,
- WSTAT_RXDATABYTES,
- WSTAT_TXPACKETS,
- WSTAT_TXBYTES,
- WSTAT_TXDATABYTES,
- // harware stats (function mostly unknown.)
- WSTAT_HW_1B0,WSTAT_HW_1B1,WSTAT_HW_1B2,WSTAT_HW_1B3,WSTAT_HW_1B4,WSTAT_HW_1B5,WSTAT_HW_1B6,WSTAT_HW_1B7,
- WSTAT_HW_1B8,WSTAT_HW_1B9,WSTAT_HW_1BA,WSTAT_HW_1BB,WSTAT_HW_1BC,WSTAT_HW_1BD,WSTAT_HW_1BE,WSTAT_HW_1BF,
- WSTAT_HW_1C0,WSTAT_HW_1C1,WSTAT_HW_1C4,WSTAT_HW_1C5,
- WSTAT_HW_1D0,WSTAT_HW_1D1,WSTAT_HW_1D2,WSTAT_HW_1D3,WSTAT_HW_1D4,WSTAT_HW_1D5,WSTAT_HW_1D6,WSTAT_HW_1D7,
- WSTAT_HW_1D8,WSTAT_HW_1D9,WSTAT_HW_1DA,WSTAT_HW_1DB,WSTAT_HW_1DC,WSTAT_HW_1DD,WSTAT_HW_1DE,WSTAT_HW_1DF,
-
- NUM_WIFI_STATS
-};
-
-// user code should NEVER have to use the WIFI_MODE or WIFI_AUTHLEVEL enums... is here in case I want to have some debug code...
-enum WIFI_MODE {
- WIFIMODE_DISABLED,
- WIFIMODE_NORMAL,
- WIFIMODE_SCAN,
- WIFIMODE_ASSOCIATE,
- WIFIMODE_ASSOCIATED,
- WIFIMODE_DISASSOCIATE,
- WIFIMODE_CANNOTASSOCIATE,
-};
-enum WIFI_AUTHLEVEL {
- WIFI_AUTHLEVEL_DISCONNECTED,
- WIFI_AUTHLEVEL_AUTHENTICATED,
- WIFI_AUTHLEVEL_ASSOCIATED,
- WIFI_AUTHLEVEL_DEASSOCIATED,
-};
-
-// user code uses members of the WIFIGETDATA structure in calling Wifi_GetData to retreive miscellaneous odd information
-enum WIFIGETDATA {
- WIFIGETDATA_MACADDRESS, // MACADDRESS: returns data in the buffer, requires at least 6 bytes
- WIFIGETDATA_NUMWFCAPS, // NUM WFC APS: returns number between 0 and 3, doesn't use buffer.
-
- MAX_WIFIGETDATA
-};
-
-
-enum WEPMODES {
- WEPMODE_NONE = 0,
- WEPMODE_40BIT = 1,
- WEPMODE_128BIT = 2
-};
-// WIFI_ASSOCSTATUS - returned by Wifi_AssocStatus() after calling Wifi_ConnectAPk
-enum WIFI_ASSOCSTATUS {
- ASSOCSTATUS_DISCONNECTED, // not *trying* to connect
- ASSOCSTATUS_SEARCHING, // data given does not completely specify an AP, looking for AP that matches the data.
- ASSOCSTATUS_AUTHENTICATING, // connecting...
- ASSOCSTATUS_ASSOCIATING, // connecting...
- ASSOCSTATUS_ACQUIRINGDHCP, // connected to AP, but getting IP data from DHCP
- ASSOCSTATUS_ASSOCIATED, // Connected! (COMPLETE if Wifi_ConnectAP was called to start)
- ASSOCSTATUS_CANNOTCONNECT, // error in connecting... (COMPLETE if Wifi_ConnectAP was called to start)
-};
-
-// most user code will never need to know about the WIFI_TXHEADER or WIFI_RXHEADER
-typedef struct WIFI_TXHEADER {
- u16 enable_flags;
- u16 unknown;
- u16 countup;
- u16 beaconfreq;
- u16 tx_rate;
- u16 tx_length;
-} Wifi_TxHeader;
-
-typedef struct WIFI_RXHEADER {
- u16 a;
- u16 b;
- u16 c;
- u16 d;
- u16 byteLength;
- u16 rssi_;
-} Wifi_RxHeader;
-
-// WIFI_ACCESSPOINT is an important structure in that it defines how to connect to an access point.
-// listed inline are information about the members and their function
-// if a field is not necessary for Wifi_ConnectAP it will be marked as such
-// *only* 4 fields are absolutely required to be filled in correctly for the connection to work, they are:
-// ssid, ssid_len, bssid, and channel - all others can be ignored (though flags should be set to 0)
-typedef struct WIFI_ACCESSPOINT {
- char ssid[33]; // the AP's SSID - zero terminated is not necessary.. if ssid[0] is zero, the ssid will be ignored in trying to find an AP to connect to. [REQUIRED]
- char ssid_len; // number of valid bytes in the ssid field (0-32) [REQUIRED]
- u8 bssid[6]; // BSSID is the AP's SSID - setting it to all 00's indicates this is not known and it will be ignored [REQUIRED]
- u8 macaddr[6]; // mac address of the "AP" is only necessary in ad-hoc mode. [generally not required to connect]
- u16 maxrate; // max rate is measured in steps of 1/2Mbit - 5.5Mbit will be represented as 11, or 0x0B [not required to connect]
- u32 timectr; // internal information about how recently a beacon has been received [not required to connect]
- u16 rssi; // running average of the recent RSSI values for this AP, will be set to 0 after not receiving beacons for a while. [not required to connect]
- u16 flags; // flags indicating various parameters for the AP [not required, but the WFLAG_APDATA_ADHOC flag will be used]
- u32 spinlock; // internal data word used to lock the record to guarantee data coherence [not required to connect]
- u8 channel; // valid channels are 1-13, setting the channel to 0 will indicate the system should search. [REQUIRED]
- u8 rssi_past[8]; // rssi_past indicates the RSSI values for the last 8 beacons received ([7] is the most recent) [not required to connect]
- u8 base_rates[16]; // list of the base rates "required" by the AP (same format as maxrate) - zero-terminated list [not required to connect]
-} Wifi_AccessPoint;
-
-// Wifi Packet Handler function: (int packetID, int packetlength) - packetID is only valid while the called function is executing.
-// call Wifi_RxRawReadPacket while in the packet handler function, to retreive the data to a local buffer.
-typedef void (*WifiPacketHandler)(int, int);
-
-// Wifi Sync Handler function: Callback function that is called when the arm7 needs to be told to synchronize with new fifo data.
-// If this callback is used (see Wifi_SetSyncHandler()), it should send a message via the fifo to the arm7, which will call Wifi_Sync() on arm7.
-typedef void (*WifiSyncHandler)(void);
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//////////////////////////////////////////////////////////////////////////
-// Init/update/state management functions
-
-// Wifi_Init: Initializes the wifi library (arm9 side) and the sgIP library.
-// int initflags: set up some optional things, like controlling the LED blinking.
-// Returns: a 32bit value that *must* be passed to arm7.
-extern unsigned long Wifi_Init(int initflags);
-
-// Wifi_CheckInit: Verifies when the ARM7 has been successfully initialized
-// Returns: 1 if the arm7 is ready for wifi, 0 otherwise
-extern int Wifi_CheckInit(void);
-
-// Wifi_DisableWifi: Instructs the ARM7 to disengage wireless and stop receiving or
-// transmitting.
-extern void Wifi_DisableWifi(void);
-
-// Wifi_EnableWifi: Instructs the ARM7 to go into a basic "active" mode, not actually
-// associated to an AP, but actively receiving and potentially transmitting
-extern void Wifi_EnableWifi(void);
-
-// Wifi_SetPromiscuousMode: Allows the DS to enter or leave a "promsicuous" mode, in which
-// all data that can be received is forwarded to the arm9 for user processing.
-// Best used with Wifi_RawSetPacketHandler, to allow user code to use the data
-// (well, the lib won't use 'em, so they're just wasting CPU otherwise.)
-// int enable: 0 to disable promiscuous mode, nonzero to engage
-extern void Wifi_SetPromiscuousMode(int enable);
-
-// Wifi_ScanMode: Instructs the ARM7 to periodically rotate through the channels to
-// pick up and record information from beacons given off by APs
-extern void Wifi_ScanMode(void);
-
-// Wifi_SetChannel: If the wifi system is not connected or connecting to an access point, instruct
-// the chipset to change channel
-// int channel: the channel to change to, in the range of 1-13
-extern void Wifi_SetChannel(int channel);
-
-// Wifi_GetNumAP:
-// Returns: the current number of APs that are known about and tracked internally
-extern int Wifi_GetNumAP(void);
-
-// Wifi_GetAPData: Grabs data from internal structures for user code (always succeeds)
-// int apnum: the 0-based index of the access point record to fetch
-// Wifi_AccessPoint * apdata: Pointer to the location where the retrieved data should be stored
-extern int Wifi_GetAPData(int apnum, Wifi_AccessPoint * apdata);
-
-// Wifi_FindMatchingAP: determines whether various APs exist in the local area. You provide a
-// list of APs, and it will return the index of the first one in the list that can be found
-// in the internal list of APs that are being tracked
-// int numaps: number of records in the list
-// Wifi_AccessPoint * apdata: pointer to an array of structures with information about the APs to find
-// Wifi_AccessPoint * match_dest: OPTIONAL pointer to a record to receive the matching AP record.
-// Returns: -1 for none found, or a positive/zero integer index into the array
-extern int Wifi_FindMatchingAP(int numaps, Wifi_AccessPoint * apdata, Wifi_AccessPoint * match_dest);
-
-// Wifi_ConnectAP: Connect to an access point
-// Wifi_AccessPoint * apdata: basic data on the AP
-// int wepmode: indicates whether wep is used, and what kind
-// int wepkeyid: indicates which wep key ID to use for transmitting
-// unsigned char * wepkey: the wep key, to be used in all 4 key slots (should make this more flexible in the future)
-// Returns: 0 for ok, -1 for error with input data
-extern int Wifi_ConnectAP(Wifi_AccessPoint * apdata, int wepmode, int wepkeyid, unsigned char * wepkey);
-
-// Wifi_AutoConnect: Connect to an access point specified by the WFC data in the firmware
-extern void Wifi_AutoConnect(void);
-
-// Wifi_AssocStatus: Returns information about the status of connection to an AP
-// Returns: a value from the WIFI_ASSOCSTATUS enum, continue polling until you
-// receive ASSOCSTATUS_CONNECTED or ASSOCSTATUS_CANNOTCONNECT
-extern int Wifi_AssocStatus(void);
-
-// Wifi_DisconnectAP: Disassociate from the Access Point
-extern int Wifi_DisconnectAP(void);
-
-// Wifi_Timer: This function should be called in a periodic interrupt. It serves as the basis
-// for all updating in the sgIP library, all retransmits, timeouts, and etc are based on this
-// function being called. It's not timing critical but it is rather essential.
-// int num_ms: The number of milliseconds since the last time this function was called.
-extern void Wifi_Timer(int num_ms);
-
-// Wifi_GetIP:
-// Returns: The current IP address of the DS (may not be valid before connecting to an AP, or setting the IP manually.)
-extern unsigned long Wifi_GetIP(void); // get local ip
-
-// Wifi_GetIPInfo: (values may not be valid before connecting to an AP, or setting the IP manually.)
-// unsigned long * pGateway: pointer to receive the currently configured gateway IP
-// unsigned long * pSnmask: pointer to receive the currently configured subnet mask
-// unsigned long * pDns1: pointer to receive the currently configured primary DNS server IP
-// unsigned long * pDns2: pointer to receive the currently configured secondary DNS server IP
-// Returns: The current IP address of the DS
-extern unsigned long Wifi_GetIPInfo(unsigned long * pGateway,unsigned long * pSnmask,unsigned long * pDns1,unsigned long * pDns2);
-
-// Wifi_SetIP: Set the DS's IP address and other IP configuration information.
-// unsigned long IPaddr: The new IP address (NOTE! if this value is zero, the IP, the gateway, and the subnet mask will be allocated via DHCP)
-// unsigned long gateway: The new gateway (example: 192.168.1.1 is 0xC0A80101)
-// unsigned long subnetmask: The new subnet mask (example: 255.255.255.0 is 0xFFFFFF00)
-// unsigned long dns1: The new primary dns server (NOTE! if this value is zero AND the IPaddr value is zero, dns1 and dns2 will be allocated via DHCP)
-// unsigned long dns2: The new secondary dns server
-extern void Wifi_SetIP(unsigned long IPaddr, unsigned long gateway, unsigned long subnetmask, unsigned long dns1, unsigned long dns2);
-
-// Wifi_GetData: Retrieve an arbitrary or misc. piece of data from the wifi hardware. see WIFIGETDATA enum.
-// int datatype: element from the WIFIGETDATA enum specifing what kind of data to get
-// int bufferlen: length of the buffer to copy data to (not always used)
-// unsigned char * buffer: buffer to copy element data to (not always used)
-// Returns: -1 for failure, the number of bytes written to the buffer, or the value requested if the buffer isn't used.
-extern int Wifi_GetData(int datatype, int bufferlen, unsigned char * buffer);
-
-// Wifi_GetStats: Retreive an element of the wifi statistics gathered
-// int statnum: Element from the WIFI_STATS enum, indicating what statistic to return
-// Returns: the requested stat, or 0 for failure
-extern u32 Wifi_GetStats(int statnum);
-//////////////////////////////////////////////////////////////////////////
-// Raw Send/Receive functions
-
-// Wifi_RawTxFrame: Send a raw 802.11 frame at a specified rate
-// unsigned short datalen: The length in bytes of the frame to send
-// unsigned short rate: The rate to transmit at (Specified as mbits/10, 1mbit=0x000A, 2mbit=0x0014)
-// unsigned short * data: Pointer to the data to send (should be halfword-aligned)
-// Returns: Nothing of interest.
-extern int Wifi_RawTxFrame(unsigned short datalen, unsigned short rate, unsigned short * data);
-
-// Wifi_RawSetPacketHandler: Set a handler to process all raw incoming packets
-// WifiPacketHandler wphfunc: Pointer to packet handler (see WifiPacketHandler definition for more info)
-extern void Wifi_RawSetPacketHandler(WifiPacketHandler wphfunc);
-
-// Wifi_RxRawReadPacket: Allows user code to read a packet from within the WifiPacketHandler function
-// long packetID: a non-unique identifier which locates the packet specified in the internal buffer
-// long readlength: number of bytes to read (actually reads (number+1)&~1 bytes)
-// unsigned short * data: location for the data to be read into
-extern int Wifi_RxRawReadPacket(long packetID, long readlength, unsigned short * data);
-
-//////////////////////////////////////////////////////////////////////////
-// Fast transfer support - update functions
-
-// Wifi_Update: Checks for new data from the arm7 and initiates routing if data
-// is available.
-extern void Wifi_Update(void);
-
-// Wifi_Sync: Call this function when requested to sync by the arm7 side of the
-// wifi lib
-extern void Wifi_Sync(void);
-
-// Wifi_SetSyncHandler: Call this function to request notification of when the
-// ARM7-side Wifi_Sync function should be called.
-// WifiSyncHandler sh: Pointer to the function to be called for notification.
-extern void Wifi_SetSyncHandler(WifiSyncHandler sh);
-
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/include/dswifi_version.h b/c/src/lib/libbsp/arm/nds/dswifi/include/dswifi_version.h
deleted file mode 100644
index 7a82b91323..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/include/dswifi_version.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _dswifi_version_h_
-#define _dswifi_version_h_
-
-#define DSWIFI_MAJOR 0
-#define DSWIFI_MINOR 3
-#define DSWIFI_REVISION 4
-
-#define DSWIFI_VERSION "0.3.4"
-
-#endif // _dswifi_version_h_
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/include/netdb.h b/c/src/lib/libbsp/arm/nds/dswifi/include/netdb.h
deleted file mode 100644
index 914e672db3..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/include/netdb.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// DSWifi Project - socket emulation layer defines/prototypes (netdb.h)
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#ifndef NETDB_H
-#define NETDB_H
-
-struct hostent {
- char * h_name;
- char ** h_aliases;
- int h_addrtype;
- int h_length;
- char ** h_addr_list;
-};
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- extern struct hostent * gethostbyname(const char * name);
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/include/netinet/in.h b/c/src/lib/libbsp/arm/nds/dswifi/include/netinet/in.h
deleted file mode 100644
index 22b960def1..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/include/netinet/in.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// DSWifi Project - socket emulation layer defines/prototypes (netinet/in.h)
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-#ifndef NETINET_IN_H
-#define NETINET_IN_H
-
-#include "sys/socket.h"
-
-#define INADDR_ANY 0x00000000
-#define INADDR_BROADCAST 0xFFFFFFFF
-#define INADDR_NONE 0xFFFFFFFF
-
-
-struct in_addr {
- unsigned long s_addr;
-};
-
-struct sockaddr_in {
- unsigned short sin_family;
- unsigned short sin_port;
- struct in_addr sin_addr;
- unsigned char sin_zero[8];
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- // actually from arpa/inet.h - but is included through netinet/in.h
- unsigned long inet_addr(const char *cp);
- int inet_aton(const char *cp, struct in_addr *inp);
- char *inet_ntoa(struct in_addr in);
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/include/sgIP_errno.h b/c/src/lib/libbsp/arm/nds/dswifi/include/sgIP_errno.h
deleted file mode 100644
index 48484d6ae6..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/include/sgIP_errno.h
+++ /dev/null
@@ -1,165 +0,0 @@
-// DSWifi Project - socket emulation layer defines/prototypes (sgIP_errno.h)
-// Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org
-/******************************************************************************
-DSWifi Lib and test materials are licenced under the MIT open source licence:
-Copyright (c) 2005-2006 Stephen Stair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-******************************************************************************/
-
-/**** Note: This file is unused unless you need to build in an environment without newlib ****/
-
-#ifndef SGIP_ERRNO_H
-#define SGIP_ERRNO_H
-
-#define EPERM 1 /* Operation not permitted */
-#define ENOENT 2 /* No such file or directory */
-#define ESRCH 3 /* No such process */
-#define EINTR 4 /* Interrupted system call */
-#define EIO 5 /* I/O error */
-#define ENXIO 6 /* No such device or address */
-#define E2BIG 7 /* Arg list too long */
-#define ENOEXEC 8 /* Exec format error */
-#define EBADF 9 /* Bad file number */
-#define ECHILD 10 /* No child processes */
-#define EAGAIN 11 /* Try again */
-#define ENOMEM 12 /* Out of memory */
-#define EACCES 13 /* Permission denied */
-#define EFAULT 14 /* Bad address */
-#define ENOTBLK 15 /* Block device required */
-#define EBUSY 16 /* Device or resource busy */
-#define EEXIST 17 /* File exists */
-#define EXDEV 18 /* Cross-device link */
-#define ENODEV 19 /* No such device */
-#define ENOTDIR 20 /* Not a directory */
-#define EISDIR 21 /* Is a directory */
-#define EINVAL 22 /* Invalid argument */
-#define ENFILE 23 /* File table overflow */
-#define EMFILE 24 /* Too many open files */
-#define ENOTTY 25 /* Not a typewriter */
-#define ETXTBSY 26 /* Text file busy */
-#define EFBIG 27 /* File too large */
-#define ENOSPC 28 /* No space left on device */
-#define ESPIPE 29 /* Illegal seek */
-#define EROFS 30 /* Read-only file system */
-#define EMLINK 31 /* Too many links */
-#define EPIPE 32 /* Broken pipe */
-#define EDOM 33 /* Math argument out of domain of func */
-#define ERANGE 34 /* Math result not representable */
-#define EDEADLK 35 /* Resource deadlock would occur */
-#define ENAMETOOLONG 36 /* File name too long */
-#define ENOLCK 37 /* No record locks available */
-#define ENOSYS 38 /* Function not implemented */
-#define ENOTEMPTY 39 /* Directory not empty */
-#define ELOOP 40 /* Too many symbolic links encountered */
-#define EWOULDBLOCK EAGAIN /* Operation would block */
-#define ENOMSG 42 /* No message of desired type */
-#define EIDRM 43 /* Identifier removed */
-#define ECHRNG 44 /* Channel number out of range */
-#define EL2NSYNC 45 /* Level 2 not synchronized */
-#define EL3HLT 46 /* Level 3 halted */
-#define EL3RST 47 /* Level 3 reset */
-#define ELNRNG 48 /* Link number out of range */
-#define EUNATCH 49 /* Protocol driver not attached */
-#define ENOCSI 50 /* No CSI structure available */
-#define EL2HLT 51 /* Level 2 halted */
-#define EBADE 52 /* Invalid exchange */
-#define EBADR 53 /* Invalid request descriptor */
-#define EXFULL 54 /* Exchange full */
-#define ENOANO 55 /* No anode */
-#define EBADRQC 56 /* Invalid request code */
-#define EBADSLT 57 /* Invalid slot */
-
-#define EDEADLOCK EDEADLK
-
-#define EBFONT 59 /* Bad font file format */
-#define ENOSTR 60 /* Device not a stream */
-#define ENODATA 61 /* No data available */
-#define ETIME 62 /* Timer expired */
-#define ENOSR 63 /* Out of streams resources */
-#define ENONET 64 /* Machine is not on the network */
-#define ENOPKG 65 /* Package not installed */
-#define EREMOTE 66 /* Object is remote */
-#define ENOLINK 67 /* Link has been severed */
-#define EADV 68 /* Advertise error */
-#define ESRMNT 69 /* Srmount error */
-#define ECOMM 70 /* Communication error on send */
-#define EPROTO 71 /* Protocol error */
-#define EMULTIHOP 72 /* Multihop attempted */
-#define EDOTDOT 73 /* RFS specific error */
-#define EBADMSG 74 /* Not a data message */
-#define EOVERFLOW 75 /* Value too large for defined data type */
-#define ENOTUNIQ 76 /* Name not unique on network */
-#define EBADFD 77 /* File descriptor in bad state */
-#define EREMCHG 78 /* Remote address changed */
-#define ELIBACC 79 /* Can not access a needed shared library */
-#define ELIBBAD 80 /* Accessing a corrupted shared library */
-#define ELIBSCN 81 /* .lib section in a.out corrupted */
-#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
-#define ELIBEXEC 83 /* Cannot exec a shared library directly */
-#define EILSEQ 84 /* Illegal byte sequence */
-#define ERESTART 85 /* Interrupted system call should be restarted */
-#define ESTRPIPE 86 /* Streams pipe error */
-#define EUSERS 87 /* Too many users */
-#define ENOTSOCK 88 /* Socket operation on non-socket */
-#define EDESTADDRREQ 89 /* Destination address required */
-#define EMSGSIZE 90 /* Message too long */
-#define EPROTOTYPE 91 /* Protocol wrong type for socket */
-#define ENOPROTOOPT 92 /* Protocol not available */
-#define EPROTONOSUPPORT 93 /* Protocol not supported */
-#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
-#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
-#define EPFNOSUPPORT 96 /* Protocol family not supported */
-#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
-#define EADDRINUSE 98 /* Address already in use */
-#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
-#define ENETDOWN 100 /* Network is down */
-#define ENETUNREACH 101 /* Network is unreachable */
-#define ENETRESET 102 /* Network dropped connection because of reset */
-#define ECONNABORTED 103 /* Software caused connection abort */
-#define ECONNRESET 104 /* Connection reset by peer */
-#define ENOBUFS 105 /* No buffer space available */
-#define EISCONN 106 /* Transport endpoint is already connected */
-#define ENOTCONN 107 /* Transport endpoint is not connected */
-#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
-#define ETOOMANYREFS 109 /* Too many references: cannot splice */
-#define ETIMEDOUT 110 /* Connection timed out */
-#define ECONNREFUSED 111 /* Connection refused */
-#define EHOSTDOWN 112 /* Host is down */
-#define EHOSTUNREACH 113 /* No route to host */
-#define EALREADY 114 /* Operation already in progress */
-#define EINPROGRESS 115 /* Operation now in progress */
-#define ESTALE 116 /* Stale NFS file handle */
-#define EUCLEAN 117 /* Structure needs cleaning */
-#define ENOTNAM 118 /* Not a XENIX named type file */
-#define ENAVAIL 119 /* No XENIX semaphores available */
-#define EISNAM 120 /* Is a named type file */
-#define EREMOTEIO 121 /* Remote I/O error */
-#define EDQUOT 122 /* Quota exceeded */
-
-#define ENOMEDIUM 123 /* No medium found */
-#define EMEDIUMTYPE 124 /* Wrong medium type */
-
-
-#ifndef errno
-extern int sgIP_errno;
-#define errno sgIP_errno
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/dswifi/makefile b/c/src/lib/libbsp/arm/nds/dswifi/makefile
deleted file mode 100644
index bdd88a2607..0000000000
--- a/c/src/lib/libbsp/arm/nds/dswifi/makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-ifeq ($(strip $(DEVKITPRO)),)
-$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
-endif
-
-export TOPDIR := $(CURDIR)
-
-export DSWIFI_MAJOR := 0
-export DSWIFI_MINOR := 3
-export DSWIFI_REVISION := 4
-
-VERSION := $(DSWIFI_MAJOR).$(DSWIFI_MINOR).$(DSWIFI_REVISION)
-
-.PHONEY: release debug clean all
-
-all: include/dswifi_version.h release debug
-
-include/dswifi_version.h : makefile
- @echo "#ifndef _dswifi_version_h_" > $@
- @echo "#define _dswifi_version_h_" >> $@
- @echo >> $@
- @echo "#define DSWIFI_MAJOR $(DSWIFI_MAJOR)" >> $@
- @echo "#define DSWIFI_MINOR $(DSWIFI_MINOR)" >> $@
- @echo "#define DSWIFI_REVISION $(DSWIFI_REVISION)" >> $@
- @echo >> $@
- @echo '#define DSWIFI_VERSION "'$(DSWIFI_MAJOR).$(DSWIFI_MINOR).$(DSWIFI_REVISION)'"' >> $@
- @echo >> $@
- @echo "#endif // _dswifi_version_h_" >> $@
-
-
-#-------------------------------------------------------------------------------
-release: lib
-#-------------------------------------------------------------------------------
- $(MAKE) -C arm9 BUILD=release
- $(MAKE) -C arm7 BUILD=release
-
-#-------------------------------------------------------------------------------
-debug: lib
-#-------------------------------------------------------------------------------
- $(MAKE) -C arm9 BUILD=debug
- $(MAKE) -C arm7 BUILD=debug
-
-#-------------------------------------------------------------------------------
-lib:
-#-------------------------------------------------------------------------------
- mkdir lib
-
-#-------------------------------------------------------------------------------
-clean:
-#-------------------------------------------------------------------------------
- @$(MAKE) -C arm9 clean
- @$(MAKE) -C arm7 clean
-
-#-------------------------------------------------------------------------------
-dist-src: clean
-#-------------------------------------------------------------------------------
- @tar --exclude=*CVS* -cvjf dswifi-src-$(VERSION).tar.bz2 arm7 arm9 common include makefile dswifi_license.txt
-
-#-------------------------------------------------------------------------------
-dist-bin: all
-#-------------------------------------------------------------------------------
- @tar --exclude=*CVS* -cvjf dswifi-$(VERSION).tar.bz2 include lib dswifi_license.txt
-
-dist: dist-bin dist-src
-
-#-------------------------------------------------------------------------------
-install: dist-bin
-#-------------------------------------------------------------------------------
- bzip2 -cd dswifi-$(VERSION).tar.bz2 | tar -xv -C $(DEVKITPRO)/libnds
-
diff --git a/c/src/lib/libbsp/arm/nds/fb/fb.c b/c/src/lib/libbsp/arm/nds/fb/fb.c
deleted file mode 100644
index 8fdc380a49..0000000000
--- a/c/src/lib/libbsp/arm/nds/fb/fb.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * RTEMS for Nintendo DS framebuffer display driver.
- *
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-
-#include <bsp.h>
-#include <rtems/irq.h>
-#include <rtems/libio.h>
-#include <nds.h>
-
-#include <rtems/fb.h>
-#include <rtems/framebuffer.h>
-
-/*
- * screen information for the driver (fb0).
- */
-
-static struct fb_var_screeninfo fb_var_info = {
- .xres = SCREEN_WIDTH, /* screen size x, y */
- .yres = SCREEN_HEIGHT,
- .bits_per_pixel = 16 /* bits per pixel */
-};
-
-static struct fb_fix_screeninfo fb_fix_info = {
- .smem_start = (void *) VRAM_A, /* buffer pointer */
- .smem_len = 0x18000, /* buffer size */
- .type = FB_TYPE_PACKED_PIXELS, /* type of dsplay */
- .visual = FB_VISUAL_TRUECOLOR, /* color scheme used */
- .line_length = SCREEN_WIDTH /* pixels per line (redundant with xres ?) */
-};
-
-/*
- * screen information for the driver (fb1).
- */
-
-static struct fb_var_screeninfo fb_var_info2 = {
- .xres = SCREEN_WIDTH, /* screen size x, y */
- .yres = SCREEN_HEIGHT,
- .bits_per_pixel = 16 /* bits per pixel */
-};
-
-static struct fb_fix_screeninfo fb_fix_info2 = {
- .smem_start = (void *) VRAM_B, /* buffer pointer */
- .smem_len = 0x18000, /* buffer size */
- .type = FB_TYPE_PACKED_PIXELS, /* type of dsplay */
- .visual = FB_VISUAL_TRUECOLOR, /* color scheme used */
- .line_length = SCREEN_WIDTH /* pixels per line (redundant with xres ?) */
-};
-
-
-/*
- * fbds device driver initialize entry point.
- */
-
-rtems_device_driver
-frame_buffer_initialize (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_status_code status;
-
- printk ("[+] framebuffer started\n");
-
- /* register the devices */
- status = rtems_io_register_name (FRAMEBUFFER_DEVICE_0_NAME, major, 0);
- if (status != RTEMS_SUCCESSFUL) {
- printk ("[!] error registering framebuffer\n");
- rtems_fatal_error_occurred (status);
- }
- status = rtems_io_register_name (FRAMEBUFFER_DEVICE_NAME "1", major, 1);
- if (status != RTEMS_SUCCESSFUL) {
- printk ("[!] error registering framebuffer\n");
- rtems_fatal_error_occurred (status);
- }
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * fbds device driver open operation.
- */
-
-rtems_device_driver
-frame_buffer_open (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- printk ("[#] entering graphic mode on fb%d\n", minor);
- if (!minor) {
- videoSetMode (MODE_FB0);
- vramSetBankA (VRAM_A_LCD);
- memset ((void *)fb_fix_info.smem_start, 0, fb_fix_info.smem_len);
- } else {
- videoSetModeSub (MODE_FB0);
- vramSetBankB (VRAM_B_LCD);
- memset ((void *)fb_fix_info2.smem_start, 0, fb_fix_info2.smem_len);
- }
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * fbds device driver close operation.
- */
-
-rtems_device_driver
-frame_buffer_close (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- printk ("[#] leaving graphic mode on fb%d\n", minor);
- if (!minor) {
- memset ((void *)fb_fix_info.smem_start, 0, fb_fix_info.smem_len);
- }
- else {
- memset ((void *)fb_fix_info2.smem_start, 0, fb_fix_info2.smem_len);
- /* back to console */
- videoSetModeSub (MODE_0_2D | DISPLAY_BG0_ACTIVE);
- vramSetBankC (VRAM_C_SUB_BG);
- }
-
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * fbds device driver read operation.
- */
-
-rtems_device_driver
-frame_buffer_read (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) arg;
- rw_args->bytes_moved = 0;
-
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * fbds device driver write operation.
- */
-
-rtems_device_driver
-frame_buffer_write (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) arg;
- rw_args->bytes_moved = 0;
-
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * ioctl entry point.
- */
-
-rtems_device_driver
-frame_buffer_control (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_libio_ioctl_args_t *args = arg;
-
- /* XXX check minor */
-
- switch (args->command) {
- case FBIOGET_VSCREENINFO:
- memcpy (args->buffer, minor ? &fb_var_info2 : &fb_var_info, sizeof (fb_var_info));
- args->ioctl_return = 0;
- break;
- case FBIOGET_FSCREENINFO:
- memcpy (args->buffer, minor ? &fb_fix_info2 : &fb_fix_info, sizeof (fb_fix_info));
- args->ioctl_return = 0;
- break;
- case FBIOGETCMAP:
- args->ioctl_return = 0; /* XXX */
- break;
- case FBIOPUTCMAP:
- args->ioctl_return = 0; /* XXX */
- break;
-
- /* no break on purpose */
- default:
- args->ioctl_return = 0;
- break;
-
- }
- return RTEMS_SUCCESSFUL;
-}
diff --git a/c/src/lib/libbsp/arm/nds/include/bsp.h b/c/src/lib/libbsp/arm/nds/include/bsp.h
deleted file mode 100644
index 8b795e288f..0000000000
--- a/c/src/lib/libbsp/arm/nds/include/bsp.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#ifndef LIBBSP_ARM_NDS_H
-#define LIBBSP_ARM_NDS_H
-
-#include <bspopts.h>
-#include <bsp/default-initial-extension.h>
-#include <rtems.h>
-#include <rtems/iosupp.h>
-#include <rtems/bspIo.h>
-#include <rtems/console.h>
-#include <rtems/clockdrv.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct rtems_bsdnet_ifconfig;
-
-int rtems_wifi_driver_attach (struct rtems_bsdnet_ifconfig *config,
- int attach);
-
-#define RTEMS_BSP_NETWORK_DRIVER_NAME "dswifi0"
-#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_wifi_driver_attach
-
-#define RTC_DRIVER_TABLE_ENTRY \
- { rtc_initialize, NULL, NULL, NULL, NULL, NULL }
-extern rtems_device_driver rtc_initialize (rtems_device_major_number major,
- rtems_device_minor_number minor,
- void *arg);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/include/my_ipc.h b/c/src/lib/libbsp/arm/nds/include/my_ipc.h
deleted file mode 100644
index 6dd05eaee7..0000000000
--- a/c/src/lib/libbsp/arm/nds/include/my_ipc.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * RTEMS for Nintendo DS interprocessor communication extensions.
- *
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#ifndef _MYIPC_H_
-#define _MYIPC_H_
-
-#include "types.h"
-
-typedef struct
-{
- vuint8_t *record_buffer;
- vuint32_t record_length_max;
- vuint32_t recorded_length;
- vuint8_t record;
-} my_TransferRegion;
-
-static inline my_TransferRegion volatile *
-getmy_IPC (void)
-{
- return (my_TransferRegion volatile *) (0x027FF000 +
- sizeof (TransferRegion));
-}
-
-#define my_IPC getmy_IPC()
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/include/sys/iosupport.h b/c/src/lib/libbsp/arm/nds/include/sys/iosupport.h
deleted file mode 100644
index 685065c30f..0000000000
--- a/c/src/lib/libbsp/arm/nds/include/sys/iosupport.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __iosupp_h__
-#define __iosupp_h__
-
-#include <reent.h>
-
-enum {
- STD_IN,
- STD_OUT,
- STD_ERR,
- STD_MAX = 16
-};
-
-#define _SHIFTL(v, s, w) \
- ((unsigned int) (((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s)))
-#define _SHIFTR(v, s, w) \
- ((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1)))
-
-typedef struct {
- const char *name;
- int (*open_r)(struct _reent *r,const char *path,int flags,int mode);
- int (*close_r)(struct _reent *r,int fd);
- int (*write_r)(struct _reent *r,int fd,const char *ptr,int len);
- int (*read_r)(struct _reent *r,int fd,char *ptr,int len);
- int (*seek_r)(struct _reent *r,int fd,int pos,int dir);
- int (*stat_r)(struct _reent *r,int fd,struct stat *st);
-} devoptab_t;
-
-extern const devoptab_t *devoptab_list[];
-
-int AddDevice( const devoptab_t* device);
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/include/types.h b/c/src/lib/libbsp/arm/nds/include/types.h
deleted file mode 100644
index f8dcfbad6f..0000000000
--- a/c/src/lib/libbsp/arm/nds/include/types.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#ifndef BSP_NDS_TYPES_H_
-#define BSP_NDS_TYPES_H_
-
-#include <stdint.h>
-
-/*
- * volatile types for registers.
- */
-
-typedef volatile char vint8_t;
-typedef volatile short int vint16_t;
-typedef volatile int vint32_t;
-
-typedef volatile unsigned char vuint8_t;
-typedef volatile unsigned short int vuint16_t;
-typedef volatile unsigned int vuint32_t;
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/irq/irq.c b/c/src/lib/libbsp/arm/nds/irq/irq.c
deleted file mode 100644
index d0e3915452..0000000000
--- a/c/src/lib/libbsp/arm/nds/irq/irq.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * RTEMS for Nintendo DS interrupt manager.
- */
-
-/*
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <bsp.h>
-#include <rtems/irq.h>
-#include <bsp/irq.h>
-#include <nds.h>
-
-/*
- * this function check that the value given for the irq line is valid.
- */
-static int
-isValidInterrupt (int irq)
-{
- if (irq < 0 || irq >= MAX_INTERRUPTS)
- return 0;
- return 1;
-}
-
-/*
- * initialize the irq management.
- */
-void
-BSP_rtems_irq_mngt_init (void)
-{
- irqInit ();
-
- REG_IME = IME_ENABLE;
-}
-
-/*
- * install a irq handler.
- */
-int
-BSP_install_rtems_irq_handler (const rtems_irq_connect_data * irq)
-{
- rtems_interrupt_level level;
-
- if (!isValidInterrupt (irq->name))
- return 0;
-
- rtems_interrupt_disable (level);
-
- /*
- * FIXME: irq_hdl will probably not be called with its parameter
- */
- irqSet (irq->name, (VoidFunctionPointer)irq->hdl);
-
- if (irq->on != NULL)
- irq->on (irq);
-
- rtems_interrupt_enable (level);
-
- return 1;
-}
-
-/*
- * return the handler hooked to the given irq.
- */
-int
-BSP_get_current_rtems_irq_handler (rtems_irq_connect_data * irq)
-{
- return 0; /* FIXME */
-}
-
-/*
- * remove & disable given irq.
- */
-int
-BSP_remove_rtems_irq_handler (const rtems_irq_connect_data * irq)
-{
- rtems_interrupt_level level;
-
- if (!isValidInterrupt (irq->name))
- return 0;
-
- rtems_interrupt_disable (level);
-
- if (irq->off != NULL)
- irq->off (irq);
-
- irqClear (irq->name);
-
- rtems_interrupt_enable (level);
-
- return 1;
-}
diff --git a/c/src/lib/libbsp/arm/nds/irq/irq.h b/c/src/lib/libbsp/arm/nds/irq/irq.h
deleted file mode 100644
index aeaccef298..0000000000
--- a/c/src/lib/libbsp/arm/nds/irq/irq.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE
- */
-
-#ifndef __BSP_IRQ_H_
-#define __BSP_IRQ_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-extern void BSP_rtems_irq_mngt_init (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libfat/gba/include/fat.h b/c/src/lib/libbsp/arm/nds/libfat/gba/include/fat.h
deleted file mode 100644
index 3fbcce9bed..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/gba/include/fat.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- fat.h
- Simple functionality for startup, mounting and unmounting of FAT-based devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-14
- * fatInitialise renamed to fatInit
-
- 2006-07-16 - Chishm
- * Added fatInitDefault
-*/
-
-
-#ifndef _LIBFAT_H
-#define _LIBFAT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "gba_types.h"
-
-typedef enum {PI_CART_SLOT} PARTITION_INTERFACE;
-
-struct IO_INTERFACE_STRUCT ;
-
-/*
-Initialise any inserted block-devices.
-Add the fat device driver to the devoptab, making it available for standard file functions.
-cacheSize: The number of pages to allocate for each inserted block-device
-setAsDefaultDevice: if true, make this the default device driver for file operations
-*/
-bool fatInit (u32 cacheSize, bool setAsDefaultDevice);
-
-/*
-Calls fatInit with setAsDefaultDevice = true and cacheSize optimised for the host system.
-*/
-bool fatInitDefault (void);
-
-/*
-Mount the device specified by partitionNumber
-PD_DEFAULT is not allowed, use _FAT_partition_setDefaultDevice
-PD_CUSTOM is not allowed, use _FAT_partition_mountCustomDevice
-*/
-bool fatMountNormalInterface (PARTITION_INTERFACE partitionNumber, u32 cacheSize);
-
-/*
-Mount a partition on a custom device
-*/
-bool fatMountCustomInterface (struct IO_INTERFACE_STRUCT* device, u32 cacheSize);
-
-/*
-Unmount the partition specified by partitionNumber
-If there are open files, it will fail
-*/
-bool fatUnmount (PARTITION_INTERFACE partitionNumber);
-
-
-/*
-Forcibly unmount the partition specified by partitionNumber
-Any open files on the partition will become invalid
-The cache will be invalidated, and any unflushed writes will be lost
-*/
-bool fatUnsafeUnmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:
-PD_DEFAULT is unallowed.
-Doesn't do anything useful on GBA, since there is only one device
-*/
-bool fatSetDefaultInterface (PARTITION_INTERFACE partitionNumber);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _LIBFAT_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/include/fat.h b/c/src/lib/libbsp/arm/nds/libfat/include/fat.h
deleted file mode 100644
index 07c02af866..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/include/fat.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- fat.h
- Simple functionality for startup, mounting and unmounting of FAT-based devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-14
- * fatInitialise renamed to fatInit
-
- 2006-07-16 - Chishm
- * Added fatInitDefault
-*/
-
-
-#ifndef _LIBFAT_H
-#define _LIBFAT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// When compiling for NDS, make sure NDS is defined
-#ifndef NDS
- #if defined ARM9 || defined ARM7
- #define NDS
- #endif
-#endif
-
-#ifdef NDS
- #include <nds/jtypes.h>
-#else
- #include "gba_types.h"
-#endif
-
-#ifdef NDS
-typedef enum {PI_DEFAULT, PI_SLOT_1, PI_SLOT_2, PI_CUSTOM} PARTITION_INTERFACE;
-#else
-typedef enum {PI_CART_SLOT} PARTITION_INTERFACE;
-#endif
-
-struct IO_INTERFACE_STRUCT ;
-
-/*
-Initialise any inserted block-devices.
-Add the fat device driver to the devoptab, making it available for standard file functions.
-cacheSize: The number of pages to allocate for each inserted block-device
-setAsDefaultDevice: if true, make this the default device driver for file operations
-*/
-bool fatInit (u32 cacheSize, bool setAsDefaultDevice);
-
-/*
-Calls fatInit with setAsDefaultDevice = true and cacheSize optimised for the host system.
-*/
-bool fatInitDefault (void);
-
-/*
-Mount the device specified by partitionNumber
-PD_DEFAULT is not allowed, use _FAT_partition_setDefaultDevice
-PD_CUSTOM is not allowed, use _FAT_partition_mountCustomDevice
-*/
-bool fatMountNormalInterface (PARTITION_INTERFACE partitionNumber, u32 cacheSize);
-
-/*
-Mount a partition on a custom device
-*/
-bool fatMountCustomInterface (const struct IO_INTERFACE_STRUCT* device, u32 cacheSize);
-
-/*
-Unmount the partition specified by partitionNumber
-If there are open files, it will fail
-*/
-bool fatUnmount (PARTITION_INTERFACE partitionNumber);
-
-
-/*
-Forcibly unmount the partition specified by partitionNumber
-Any open files on the partition will become invalid
-The cache will be invalidated, and any unflushed writes will be lost
-*/
-bool fatUnsafeUnmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:
-PD_DEFAULT is unallowed.
-Doesn't do anything useful on GBA, since there is only one device
-*/
-bool fatSetDefaultInterface (PARTITION_INTERFACE partitionNumber);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _LIBFAT_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/nds/include/fat.h b/c/src/lib/libbsp/arm/nds/libfat/nds/include/fat.h
deleted file mode 100644
index 4dde46ddec..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/nds/include/fat.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- fat.h
- Simple functionality for startup, mounting and unmounting of FAT-based devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-14
- * fatInitialise renamed to fatInit
-
- 2006-07-16 - Chishm
- * Added fatInitDefault
-*/
-
-
-#ifndef _LIBFAT_H
-#define _LIBFAT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// When compiling for NDS, make sure NDS is defined
-#ifndef NDS
- #define NDS
-#endif
-
-#include <nds/jtypes.h>
-
-typedef enum {PI_DEFAULT, PI_SLOT_1, PI_SLOT_2, PI_CUSTOM} PARTITION_INTERFACE;
-
-struct IO_INTERFACE_STRUCT ;
-
-/*
-Initialise any inserted block-devices.
-Add the fat device driver to the devoptab, making it available for standard file functions.
-cacheSize: The number of pages to allocate for each inserted block-device
-setAsDefaultDevice: if true, make this the default device driver for file operations
-*/
-bool fatInit (u32 cacheSize, bool setAsDefaultDevice);
-
-/*
-Calls fatInit with setAsDefaultDevice = true and cacheSize optimised for the host system.
-*/
-bool fatInitDefault (void);
-
-/*
-Mount the device specified by partitionNumber
-PD_DEFAULT is not allowed, use _FAT_partition_setDefaultDevice
-PD_CUSTOM is not allowed, use _FAT_partition_mountCustomDevice
-*/
-bool fatMountNormalInterface (PARTITION_INTERFACE partitionNumber, u32 cacheSize);
-
-/*
-Mount a partition on a custom device
-*/
-bool fatMountCustomInterface (struct IO_INTERFACE_STRUCT* device, u32 cacheSize);
-
-/*
-Unmount the partition specified by partitionNumber
-If there are open files, it will fail
-*/
-bool fatUnmount (PARTITION_INTERFACE partitionNumber);
-
-
-/*
-Forcibly unmount the partition specified by partitionNumber
-Any open files on the partition will become invalid
-The cache will be invalidated, and any unflushed writes will be lost
-*/
-bool fatUnsafeUnmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:
-PD_DEFAULT is unallowed.
-Doesn't do anything useful on GBA, since there is only one device
-*/
-bool fatSetDefaultInterface (PARTITION_INTERFACE partitionNumber);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _LIBFAT_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/bit_ops.h b/c/src/lib/libbsp/arm/nds/libfat/source/bit_ops.h
deleted file mode 100644
index 1bc0ab7538..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/bit_ops.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- bit_ops.h
- Functions for dealing with conversion of data between types
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _BIT_OPS_H
-#define _BIT_OPS_H
-
-/*-----------------------------------------------------------------
-Functions to deal with little endian values stored in u8 arrays
------------------------------------------------------------------*/
-static inline u16 u8array_to_u16 (const u8* item, int offset) {
- return ( item[offset] | (item[offset + 1] << 8));
-}
-
-static inline u32 u8array_to_u32 (const u8* item, int offset) {
- return ( item[offset] | (item[offset + 1] << 8) | (item[offset + 2] << 16) | (item[offset + 3] << 24));
-}
-
-static inline void u16_to_u8array (u8* item, int offset, u16 value) {
- item[offset] = (u8)value;
- item[offset + 1] = (u8)(value >> 8);
-}
-
-static inline void u32_to_u8array (u8* item, int offset, u32 value) {
- item[offset] = (u8)value;
- item[offset + 1] = (u8)(value >> 8);
- item[offset + 2] = (u8)(value >> 16);
- item[offset + 3] = (u8)(value >> 24);
-}
-
-#endif // _BIT_OPS_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/cache.c b/c/src/lib/libbsp/arm/nds/libfat/source/cache.c
deleted file mode 100644
index a1a597c284..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/cache.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- cache.c
- The cache is not visible to the user. It should be flushed
- when any file is closed or changes are made to the filesystem.
-
- This cache implements a least-used-page replacement policy. This will
- distribute sectors evenly over the pages, so if less than the maximum
- pages are used at once, they should all eventually remain in the cache.
- This also has the benefit of throwing out old sectors, so as not to keep
- too many stale pages around.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <string.h>
-
-#include "common.h"
-#include "cache.h"
-#include "disc_io/disc.h"
-
-#include "mem_allocate.h"
-
-#define CACHE_FREE 0xFFFFFFFF
-
-CACHE* _FAT_cache_constructor (u32 numberOfPages, const IO_INTERFACE* discInterface) {
- CACHE* cache;
- u32 i;
- CACHE_ENTRY* cacheEntries;
-
- if (numberOfPages < 2) {
- numberOfPages = 2;
- }
-
- cache = (CACHE*) _FAT_mem_allocate (sizeof(CACHE));
- if (cache == NULL) {
- return false;
- }
-
- cache->disc = discInterface;
- cache->numberOfPages = numberOfPages;
-
-
- cacheEntries = (CACHE_ENTRY*) _FAT_mem_allocate ( sizeof(CACHE_ENTRY) * numberOfPages);
- if (cacheEntries == NULL) {
- _FAT_mem_free (cache);
- return false;
- }
-
- for (i = 0; i < numberOfPages; i++) {
- cacheEntries[i].sector = CACHE_FREE;
- cacheEntries[i].count = 0;
- cacheEntries[i].dirty = false;
- }
-
- cache->cacheEntries = cacheEntries;
-
- cache->pages = (u8*) _FAT_mem_allocate ( CACHE_PAGE_SIZE * numberOfPages);
- if (cache->pages == NULL) {
- _FAT_mem_free (cache->cacheEntries);
- _FAT_mem_free (cache);
- return false;
- }
-
- return cache;
-}
-
-void _FAT_cache_destructor (CACHE* cache) {
- // Clear out cache before destroying it
- _FAT_cache_flush(cache);
-
- // Free memory in reverse allocation order
- _FAT_mem_free (cache->pages);
- _FAT_mem_free (cache->cacheEntries);
- _FAT_mem_free (cache);
-
- return;
-}
-
-/*
-Retrieve a sector's page from the cache. If it is not found in the cache,
-load it into the cache and return the page it was loaded to.
-Return CACHE_FREE on error.
-*/
-static u32 _FAT_cache_getSector (CACHE* cache, u32 sector) {
- u32 i;
- CACHE_ENTRY* cacheEntries = cache->cacheEntries;
- u32 numberOfPages = cache->numberOfPages;
-
- u32 leastUsed = 0;
- u32 lowestCount = 0xFFFFFFFF;
-
- for (i = 0; (i < numberOfPages) && (cacheEntries[i].sector != sector); i++) {
- // While searching for the desired sector, also search for the leased used page
- if ( (cacheEntries[i].sector == CACHE_FREE) || (cacheEntries[i].count < lowestCount) ) {
- leastUsed = i;
- lowestCount = cacheEntries[i].count;
- }
- }
-
- // If it found the sector in the cache, return it
- if ((i < numberOfPages) && (cacheEntries[i].sector == sector)) {
- // Increment usage counter
- cacheEntries[i].count += 1;
- return i;
- }
-
- // If it didn't, replace the least used cache page with the desired sector
- if ((cacheEntries[leastUsed].sector != CACHE_FREE) && (cacheEntries[leastUsed].dirty == true)) {
- // Write the page back to disc if it has been written to
- if (!_FAT_disc_writeSectors (cache->disc, cacheEntries[leastUsed].sector, 1, cache->pages + CACHE_PAGE_SIZE * leastUsed)) {
- return CACHE_FREE;
- }
- cacheEntries[leastUsed].dirty = false;
- }
-
- // Load the new sector into the cache
- if (!_FAT_disc_readSectors (cache->disc, sector, 1, cache->pages + CACHE_PAGE_SIZE * leastUsed)) {
- return CACHE_FREE;
- }
- cacheEntries[leastUsed].sector = sector;
- // Increment the usage count, don't reset it
- // This creates a paging policy of least used PAGE, not sector
- cacheEntries[leastUsed].count += 1;
- return leastUsed;
-}
-
-/*
-Reads some data from a cache page, determined by the sector number
-*/
-bool _FAT_cache_readPartialSector (CACHE* cache, void* buffer, u32 sector, u32 offset, u32 size) {
- u32 page;
-
- if (offset + size > BYTES_PER_READ) {
- return false;
- }
-
- page = _FAT_cache_getSector (cache, sector);
- if (page == CACHE_FREE) {
- return false;
- }
- memcpy (buffer, cache->pages + (CACHE_PAGE_SIZE * page) + offset, size);
- return true;
-}
-
-/*
-Writes some data to a cache page, making sure it is loaded into memory first.
-*/
-bool _FAT_cache_writePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size) {
- u32 page;
-
- if (offset + size > BYTES_PER_READ) {
- return false;
- }
-
- page = _FAT_cache_getSector (cache, sector);
- if (page == CACHE_FREE) {
- return false;
- }
-
- memcpy (cache->pages + (CACHE_PAGE_SIZE * page) + offset, buffer, size);
- cache->cacheEntries[page].dirty = true;
-
- return true;
-}
-
-/*
-Writes some data to a cache page, zeroing out the page first
-*/
-bool _FAT_cache_eraseWritePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size) {
- u32 page;
-
- if (offset + size > BYTES_PER_READ) {
- return false;
- }
-
- page = _FAT_cache_getSector (cache, sector);
- if (page == CACHE_FREE) {
- return false;
- }
-
- memset (cache->pages + (CACHE_PAGE_SIZE * page), 0, CACHE_PAGE_SIZE);
- memcpy (cache->pages + (CACHE_PAGE_SIZE * page) + offset, buffer, size);
- cache->cacheEntries[page].dirty = true;
-
- return true;
-}
-
-
-/*
-Flushes all dirty pages to disc, clearing the dirty flag.
-Also resets all pages' page count to 0.
-*/
-bool _FAT_cache_flush (CACHE* cache) {
- u32 i;
-
- for (i = 0; i < cache->numberOfPages; i++) {
- if (cache->cacheEntries[i].dirty) {
- if (!_FAT_disc_writeSectors (cache->disc, cache->cacheEntries[i].sector, 1, cache->pages + CACHE_PAGE_SIZE * i)) {
- return CACHE_FREE;
- }
- }
- cache->cacheEntries[i].count = 0;
- cache->cacheEntries[i].dirty = false;
- }
-
- return true;
-}
-
-void _FAT_cache_invalidate (CACHE* cache) {
- int i;
- for (i = 0; i < cache->numberOfPages; i++) {
- cache->cacheEntries[i].sector = CACHE_FREE;
- cache->cacheEntries[i].count = 0;
- cache->cacheEntries[i].dirty = false;
- }
-}
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/cache.h b/c/src/lib/libbsp/arm/nds/libfat/source/cache.h
deleted file mode 100644
index 5d08022b1e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/cache.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- cache.h
- The cache is not visible to the user. It should be flushed
- when any file is closed or changes are made to the filesystem.
-
- This cache implements a least-used-page replacement policy. This will
- distribute sectors evenly over the pages, so if less than the maximum
- pages are used at once, they should all eventually remain in the cache.
- This also has the benefit of throwing out old sectors, so as not to keep
- too many stale pages around.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _CACHE_H
-#define _CACHE_H
-
-#include "common.h"
-#include "disc_io/disc_io.h"
-
-#define CACHE_PAGE_SIZE BYTES_PER_READ
-
-typedef struct {
- u32 sector;
- u32 count;
- bool dirty;
-} CACHE_ENTRY;
-
-typedef struct {
- const IO_INTERFACE* disc;
- u32 numberOfPages;
- CACHE_ENTRY* cacheEntries;
- u8* pages;
-} CACHE;
-
-
-/*
-Read data from a sector in the cache
-If the sector is not in the cache, it will be swapped in
-offset is the position to start reading from
-size is the amount of data to read
-Precondition: offset + size <= BYTES_PER_READ
-*/
-bool _FAT_cache_readPartialSector (CACHE* cache, void* buffer, u32 sector, u32 offset, u32 size);
-
-/*
-Write data to a sector in the cache
-If the sector is not in the cache, it will be swapped in.
-When the sector is swapped out, the data will be written to the disc
-offset is the position to start reading from
-size is the amount of data to read
-Precondition: offset + size <= BYTES_PER_READ
-*/
-bool _FAT_cache_writePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size);
-
-/*
-Write data to a sector in the cache, zeroing the sector first
-If the sector is not in the cache, it will be swapped in.
-When the sector is swapped out, the data will be written to the disc
-offset is the position to start reading from
-size is the amount of data to read
-Precondition: offset + size <= BYTES_PER_READ
-*/
-bool _FAT_cache_eraseWritePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size);
-
-/*
-Read a full sector from the cache
-*/
-static inline bool _FAT_cache_readSector (CACHE* cache, void* buffer, u32 sector) {
- return _FAT_cache_readPartialSector (cache, buffer, sector, 0, BYTES_PER_READ);
-}
-
-/*
-Write a full sector to the cache
-*/
-static inline bool _FAT_cache_writeSector (CACHE* cache, const void* buffer, u32 sector) {
- return _FAT_cache_writePartialSector (cache, buffer, sector, 0, BYTES_PER_READ);
-}
-
-/*
-Write any dirty sectors back to disc and clear out the contents of the cache
-*/
-bool _FAT_cache_flush (CACHE* cache);
-
-/*
-Clear out the contents of the cache without writing any dirty sectors first
-*/
-void _FAT_cache_invalidate (CACHE* cache);
-
-CACHE* _FAT_cache_constructor (u32 numberOfPages, const IO_INTERFACE* discInterface);
-
-void _FAT_cache_destructor (CACHE* cache);
-
-#endif // _CACHE_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/common.h b/c/src/lib/libbsp/arm/nds/libfat/source/common.h
deleted file mode 100644
index 0cdfa55b6b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/common.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- common.h
- Common definitions and included files for the FATlib
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _COMMON_H
-#define _COMMON_H
-
-// When compiling for NDS, make sure NDS is defined
-#ifndef NDS
- #if defined ARM9 || defined ARM7
- #define NDS
- #endif
-#endif
-
-#ifdef NDS
- #include <nds/jtypes.h>
-#else
- #include "gba_types.h"
-#endif
-
-#define BYTES_PER_READ 512
-
-#ifndef NULL
- #define NULL 0
-#endif
-
-#endif // _COMMON_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/directory.c b/c/src/lib/libbsp/arm/nds/libfat/source/directory.c
deleted file mode 100644
index 495ca51c57..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/directory.c
+++ /dev/null
@@ -1,902 +0,0 @@
-/*
- directory.c
- Reading, writing and manipulation of the directory structure on
- a FAT partition
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-08-14 - Chishm
- * entryFromPath correctly finds "" and "." now
-
- 2006-08-17 - Chishm
- * entryFromPath doesn't look for "" anymore - use "." to refer to the current directory
-
- 2006-08-19 - Chishm
- * Fixed entryFromPath bug when looking for "." in root directory
-
- 2006-10-01 - Chishm
- * Now clears the whole new cluster when linking in more clusters for a directory
-
- 2006-10-28 - Chishm
- * stat returns the hostType for the st_dev value
-*/
-
-#include <string.h>
-#include <ctype.h>
-
-#include "directory.h"
-#include "common.h"
-#include "partition.h"
-#include "file_allocation_table.h"
-#include "bit_ops.h"
-#include "filetime.h"
-
-// Directory entry codes
-#define DIR_ENTRY_LAST 0x00
-#define DIR_ENTRY_FREE 0xE5
-
-
-// Long file name directory entry
-enum LFN_offset {
- LFN_offset_ordinal = 0x00, // Position within LFN
- LFN_offset_char0 = 0x01,
- LFN_offset_char1 = 0x03,
- LFN_offset_char2 = 0x05,
- LFN_offset_char3 = 0x07,
- LFN_offset_char4 = 0x09,
- LFN_offset_flag = 0x0B, // Should be equal to ATTRIB_LFN
- LFN_offset_reserved1 = 0x0C, // Always 0x00
- LFN_offset_checkSum = 0x0D, // Checksum of short file name (alias)
- LFN_offset_char5 = 0x0E,
- LFN_offset_char6 = 0x10,
- LFN_offset_char7 = 0x12,
- LFN_offset_char8 = 0x14,
- LFN_offset_char9 = 0x16,
- LFN_offset_char10 = 0x18,
- LFN_offset_reserved2 = 0x1A, // Always 0x0000
- LFN_offset_char11 = 0x1C,
- LFN_offset_char12 = 0x1E
-};
-const int LFN_offset_table[13]={0x01,0x03,0x05,0x07,0x09,0x0E,0x10,0x12,0x14,0x16,0x18,0x1C,0x1E};
-
-#define LFN_END 0x40
-#define LFN_DEL 0x80
-
-bool _FAT_directory_isValidLfn (const char* name) {
- u32 i;
- u32 nameLength;
- // Make sure the name is short enough to be valid
- if ( strnlen(name, MAX_FILENAME_LENGTH) >= MAX_FILENAME_LENGTH) {
- return false;
- }
- // Make sure it doesn't contain any invalid characters
- if (strpbrk (name, "\\/:*?\"<>|") != NULL) {
- return false;
- }
- nameLength = strnlen(name, MAX_FILENAME_LENGTH);
- // Make sure the name doesn't contain any control codes
- for (i = 0; i < nameLength; i++) {
- if (name[i] < 0x20) {
- return false;
- }
- }
- // Otherwise it is valid
- return true;
-}
-
-bool _FAT_directory_isValidAlias (const char* name) {
- u32 i;
- u32 nameLength;
- const char* dot;
-
- // Make sure the name is short enough to be valid
- if ( strnlen(name, MAX_ALIAS_LENGTH) >= MAX_ALIAS_LENGTH) {
- return false;
- }
- // Make sure it doesn't contain any invalid characters
- if (strpbrk (name, "\\/:;*?\"<>|&+,=[]") != NULL) {
- return false;
- }
- nameLength = strnlen(name, MAX_ALIAS_LENGTH);
- // Make sure the name doesn't contain any control codes
- for (i = 0; i < nameLength; i++) {
- if (name[i] < 0x20) {
- return false;
- }
- }
-
- dot = strchr ( name, '.');
- // Make sure there is only one '.'
- if ((dot != NULL) && (strrchr ( name, '.') != dot)) {
- return false;
- }
- // If there is a '.':
- if (dot != NULL) {
- // Make sure the filename portion is 1-8 characters long
- if (((dot - 1 - name) > 8) || ((dot - 1 - name) < 1)) {
- return false;
- }
- // Make sure the extension is 1-3 characters long, if it exists
- if ((strnlen(dot + 1, MAX_ALIAS_LENGTH) > 3) || (strnlen(dot + 1, MAX_ALIAS_LENGTH) < 1)) {
- return false;
- }
- } else {
- // Make sure the entire file name is 1-8 characters long
- if ((nameLength > 8) || (nameLength < 1)) {
- return false;
- }
- }
-
- // Since we made it through all those tests, it must be valid
- return true;
-}
-
-static bool _FAT_directory_entryGetAlias (const u8* entryData, char* destName) {
- int i=0;
- int j=0;
-
- destName[0] = '\0';
- if (entryData[0] != DIR_ENTRY_FREE) {
- if (entryData[0] == '.') {
- destName[0] = '.';
- if (entryData[1] == '.') {
- destName[1] = '.';
- destName[2] = '\0';
- } else {
- destName[1] = '\0';
- }
- } else {
- // Copy the filename from the dirEntry to the string
- for (i = 0; (i < 8) && (entryData[DIR_ENTRY_name + i] != ' '); i++) {
- destName[i] = entryData[DIR_ENTRY_name + i];
- }
- // Copy the extension from the dirEntry to the string
- if (entryData[DIR_ENTRY_extension] != ' ') {
- destName[i++] = '.';
- for ( j = 0; (j < 3) && (entryData[DIR_ENTRY_extension + j] != ' '); j++) {
- destName[i++] = entryData[DIR_ENTRY_extension + j];
- }
- }
- destName[i] = '\0';
- }
- }
-
- return (destName[0] != '\0');
-}
-
-u32 _FAT_directory_entryGetCluster (const u8* entryData) {
- return u8array_to_u16(entryData,DIR_ENTRY_cluster) | (u8array_to_u16(entryData, DIR_ENTRY_clusterHigh) << 16);
-}
-
-static bool _FAT_directory_incrementDirEntryPosition (PARTITION* partition, DIR_ENTRY_POSITION* entryPosition, bool extendDirectory) {
- DIR_ENTRY_POSITION position;
- position = *entryPosition;
- u32 tempCluster;
-
- // Increment offset, wrapping at the end of a sector
- ++ position.offset;
- if (position.offset == BYTES_PER_READ / DIR_ENTRY_DATA_SIZE) {
- position.offset = 0;
- // Increment sector when wrapping
- ++ position.sector;
- // But wrap at the end of a cluster
- if ((position.sector == partition->sectorsPerCluster) && (position.cluster != FAT16_ROOT_DIR_CLUSTER)) {
- position.sector = 0;
- // Move onto the next cluster, making sure there is another cluster to go to
- tempCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if (tempCluster == CLUSTER_EOF) {
- if (extendDirectory) {
- tempCluster = _FAT_fat_linkFreeClusterCleared (partition, position.cluster);
- if (tempCluster == CLUSTER_FREE) {
- return false; // This will only happen if the disc is full
- }
- } else {
- return false; // Got to the end of the directory, not extending it
- }
- }
- position.cluster = tempCluster;
- } else if ((position.cluster == FAT16_ROOT_DIR_CLUSTER) && (position.sector == (partition->dataStart - partition->rootDirStart))) {
- return false; // Got to end of root directory, can't extend it
- }
- }
- *entryPosition = position;
- return true;
-}
-
-bool _FAT_directory_getNextEntry (PARTITION* partition, DIR_ENTRY* entry) {
- DIR_ENTRY_POSITION entryStart;
- DIR_ENTRY_POSITION entryEnd;
-
- u8 entryData[0x20];
-
- bool notFound, found;
- u32 maxSectors;
- int lfnPos;
- u8 lfnChkSum, chkSum;
- char* filename;
- bool lfnExists;
-
- int i;
-
- lfnChkSum = 0;
-
- entryStart = entry->dataEnd;
-
- // Make sure we are using the correct root directory, in case of FAT32
- if (entryStart.cluster == FAT16_ROOT_DIR_CLUSTER) {
- entryStart.cluster = partition->rootDirCluster;
- }
-
- entryEnd = entryStart;
- filename = entry->filename;
-
- // Can only be FAT16_ROOT_DIR_CLUSTER if it is the root directory on a FAT12 or FAT16 partition
- if (entryStart.cluster == FAT16_ROOT_DIR_CLUSTER) {
- maxSectors = partition->dataStart - partition->rootDirStart;
- } else {
- maxSectors = partition->sectorsPerCluster;
- }
-
- lfnExists = false;
-
- found = false;
- notFound = false;
-
- while (!found && !notFound) {
- if (_FAT_directory_incrementDirEntryPosition (partition, &entryEnd, false) == false) {
- notFound = true;
- }
-
- _FAT_cache_readPartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, entryEnd.cluster) + entryEnd.sector, entryEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
-
- if (entryData[DIR_ENTRY_attributes] == ATTRIB_LFN) {
- // It's an LFN
- if (entryData[LFN_offset_ordinal] & LFN_DEL) {
- lfnExists = false;
- } else if (entryData[LFN_offset_ordinal] & LFN_END) {
- // Last part of LFN, make sure it isn't deleted using previous if(Thanks MoonLight)
- entryStart = entryEnd; // This is the start of a directory entry
- lfnExists = true;
- filename[(entryData[LFN_offset_ordinal] & ~LFN_END) * 13] = '\0'; // Set end of lfn to null character
- lfnChkSum = entryData[LFN_offset_checkSum];
- } if (lfnChkSum != entryData[LFN_offset_checkSum]) {
- lfnExists = false;
- }
- if (lfnExists) {
- lfnPos = ((entryData[LFN_offset_ordinal] & ~LFN_END) - 1) * 13;
- for (i = 0; i < 13; i++) {
- filename[lfnPos + i] = entryData[LFN_offset_table[i]]; // modify this for unicode support;
- }
- }
- } else if (entryData[DIR_ENTRY_attributes] & ATTRIB_VOL) {
- // This is a volume name, don't bother with it
- } else if (entryData[0] == DIR_ENTRY_LAST) {
- notFound = true;
- } else if ((entryData[0] != DIR_ENTRY_FREE) && (entryData[0] > 0x20) && !(entryData[DIR_ENTRY_attributes] & ATTRIB_VOL)) {
- if (lfnExists) {
- // Calculate file checksum
- chkSum = 0;
- for (i=0; i < 11; i++) {
- // NOTE: The operation is an unsigned char rotate right
- chkSum = ((chkSum & 1) ? 0x80 : 0) + (chkSum >> 1) + entryData[i];
- }
- if (chkSum != lfnChkSum) {
- lfnExists = false;
- filename[0] = '\0';
- }
- }
- if (!lfnExists) {
- entryStart = entryEnd;
- _FAT_directory_entryGetAlias (entryData, filename);
- }
- found = true;
- }
- }
-
- // If no file is found, return false
- if (notFound) {
- return false;
- } else {
- // Fill in the directory entry struct
- entry->dataStart = entryStart;
- entry->dataEnd = entryEnd;
- memcpy (entry->entryData, entryData, DIR_ENTRY_DATA_SIZE);
- return true;
- }
-}
-
-bool _FAT_directory_getFirstEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster) {
- entry->dataStart.cluster = dirCluster;
- entry->dataStart.sector = 0;
- entry->dataStart.offset = -1; // Start before the beginning of the directory
-
- entry->dataEnd = entry->dataStart;
-
- return _FAT_directory_getNextEntry (partition, entry);
-}
-
-bool _FAT_directory_getRootEntry (PARTITION* partition, DIR_ENTRY* entry) {
- entry->dataStart.cluster = 0;
- entry->dataStart.sector = 0;
- entry->dataStart.offset = 0;
-
- entry->dataEnd = entry->dataStart;
-
- memset (entry->filename, '\0', MAX_FILENAME_LENGTH);
- entry->filename[0] = '.';
-
- memset (entry->entryData, 0, DIR_ENTRY_DATA_SIZE);
- memset (entry->entryData, ' ', 11);
- entry->entryData[0] = '.';
-
- entry->entryData[DIR_ENTRY_attributes] = ATTRIB_DIR;
-
- u16_to_u8array (entry->entryData, DIR_ENTRY_cluster, partition->rootDirCluster);
- u16_to_u8array (entry->entryData, DIR_ENTRY_clusterHigh, partition->rootDirCluster >> 16);
-
- return true;
-}
-
-bool _FAT_directory_entryFromPosition (PARTITION* partition, DIR_ENTRY* entry) {
- DIR_ENTRY_POSITION entryStart;
- DIR_ENTRY_POSITION entryEnd;
- entryStart = entry->dataStart;
- entryEnd = entry->dataEnd;
- bool entryStillValid;
- bool finished;
-
- int i;
- int lfnPos;
-
- u8 entryData[DIR_ENTRY_DATA_SIZE];
-
- memset (entry->filename, '\0', MAX_FILENAME_LENGTH);
-
- // Create an empty directory entry to overwrite the old ones with
- for ( entryStillValid = true, finished = false;
- entryStillValid && !finished;
- entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &entryStart, false))
- {
- _FAT_cache_readPartialSector (partition->cache, entryData,
- _FAT_fat_clusterToSector(partition, entryStart.cluster) + entryStart.sector,
- entryStart.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
-
- if ((entryStart.cluster == entryEnd.cluster)
- && (entryStart.sector == entryEnd.sector)
- && (entryStart.offset == entryEnd.offset)) {
- // Copy the entry data and stop, since this is the last section of the directory entry
- memcpy (entry->entryData, entryData, DIR_ENTRY_DATA_SIZE);
- finished = true;
- } else {
- // Copy the long file name data
- lfnPos = ((entryData[LFN_offset_ordinal] & ~LFN_END) - 1) * 13;
- for (i = 0; i < 13; i++) {
- entry->filename[lfnPos + i] = entryData[LFN_offset_table[i]]; // modify this for unicode support;
- }
- }
- }
-
- if (!entryStillValid) {
- return false;
- }
-
- if ((entryStart.cluster == entryEnd.cluster)
- && (entryStart.sector == entryEnd.sector)
- && (entryStart.offset == entryEnd.offset)) {
- // Since the entry doesn't have a long file name, extract the short filename
- if (!_FAT_directory_entryGetAlias (entry->entryData, entry->filename)) {
- return false;
- }
- }
-
- return true;
-}
-
-
-
-bool _FAT_directory_entryFromPath (PARTITION* partition, DIR_ENTRY* entry, const char* path, const char* pathEnd) {
- size_t dirnameLength;
- const char* pathPosition;
- const char* nextPathPosition;
- u32 dirCluster;
- bool foundFile;
-
- char alias[MAX_ALIAS_LENGTH];
-
- bool found, notFound;
-
- pathPosition = path;
-
- found = false;
- notFound = false;
-
- if (pathEnd == NULL) {
- // Set pathEnd to the end of the path string
- pathEnd = strchr (path, '\0');
- }
-
- if (pathPosition[0] == DIR_SEPARATOR) {
- // Start at root directory
- dirCluster = partition->rootDirCluster;
- // Consume separator(s)
- while (pathPosition[0] == DIR_SEPARATOR) {
- pathPosition++;
- }
- // If the path is only specifying a directory in the form of "/" return it
- if (pathPosition >= pathEnd) {
- _FAT_directory_getRootEntry (partition, entry);
- found = true;
- }
- } else {
- // Start in current working directory
- dirCluster = partition->cwdCluster;
- }
-
- // If the path is only specifying a directory in the form "."
- // and this is the root directory, return it
- if ((dirCluster == partition->rootDirCluster) && (strncasecmp(".", pathPosition, 2) == 0)) {
- _FAT_directory_getRootEntry (partition, entry);
- found = true;
- }
-
- while (!found && !notFound) {
- // Get the name of the next required subdirectory within the path
- nextPathPosition = strchr (pathPosition, DIR_SEPARATOR);
- if (nextPathPosition != NULL) {
- dirnameLength = nextPathPosition - pathPosition;
- } else {
- dirnameLength = strlen(pathPosition);
- }
-
- if (dirnameLength > MAX_FILENAME_LENGTH) {
- // The path is too long to bother with
- return false;
- }
-
- // Look for the directory within the path
- foundFile = _FAT_directory_getFirstEntry (partition, entry, dirCluster);
-
- while (foundFile && !found && !notFound) { // It hasn't already found the file
- // Check if the filename matches
- if ((dirnameLength == strnlen(entry->filename, MAX_FILENAME_LENGTH))
- && (strncasecmp(entry->filename, pathPosition, dirnameLength) == 0)) {
- found = true;
- }
-
- // Check if the alias matches
- _FAT_directory_entryGetAlias (entry->entryData, alias);
- if ((dirnameLength == strnlen(alias, MAX_ALIAS_LENGTH))
- && (strncasecmp(alias, pathPosition, dirnameLength) == 0)) {
- found = true;
- }
-
- if (found && !(entry->entryData[DIR_ENTRY_attributes] & ATTRIB_DIR) && (nextPathPosition != NULL)) {
- // Make sure that we aren't trying to follow a file instead of a directory in the path
- found = false;
- }
-
- if (!found) {
- foundFile = _FAT_directory_getNextEntry (partition, entry);
- }
- }
-
- if (!foundFile) {
- // Check that the search didn't get to the end of the directory
- notFound = true;
- found = false;
- } else if ((nextPathPosition == NULL) || (nextPathPosition >= pathEnd)) {
- // Check that we reached the end of the path
- found = true;
- } else if (entry->entryData[DIR_ENTRY_attributes] & ATTRIB_DIR) {
- dirCluster = _FAT_directory_entryGetCluster (entry->entryData);
- pathPosition = nextPathPosition;
- // Consume separator(s)
- while (pathPosition[0] == DIR_SEPARATOR) {
- pathPosition++;
- }
- // The requested directory was found
- if (pathPosition >= pathEnd) {
- found = true;
- } else {
- found = false;
- }
- }
- }
-
- if (found && !notFound) {
- return true;
- } else {
- return false;
- }
-}
-
-bool _FAT_directory_removeEntry (PARTITION* partition, DIR_ENTRY* entry) {
- DIR_ENTRY_POSITION entryStart;
- DIR_ENTRY_POSITION entryEnd;
- entryStart = entry->dataStart;
- entryEnd = entry->dataEnd;
- bool entryStillValid;
- bool finished;
-
- u8 entryData[DIR_ENTRY_DATA_SIZE];
-
- // Create an empty directory entry to overwrite the old ones with
- for ( entryStillValid = true, finished = false;
- entryStillValid && !finished;
- entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &entryStart, false))
- {
- _FAT_cache_readPartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, entryStart.cluster) + entryStart.sector, entryStart.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- entryData[0] = DIR_ENTRY_FREE;
- _FAT_cache_writePartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, entryStart.cluster) + entryStart.sector, entryStart.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- if ((entryStart.cluster == entryEnd.cluster) && (entryStart.sector == entryEnd.sector) && (entryStart.offset == entryEnd.offset)) {
- finished = true;
- }
- }
-
- if (!entryStillValid) {
- return false;
- }
-
- return true;
-}
-
-static bool _FAT_directory_findEntryGap (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster, u32 size) {
- DIR_ENTRY_POSITION gapStart;
- DIR_ENTRY_POSITION gapEnd;
-
- u8 entryData[DIR_ENTRY_DATA_SIZE];
-
- u32 dirEntryRemain;
-
- bool endOfDirectory, entryStillValid;
-
- // Scan Dir for free entry
- gapEnd.offset = 0;
- gapEnd.sector = 0;
- gapEnd.cluster = dirCluster;
-
- gapStart = gapEnd;
-
- entryStillValid = true;
- dirEntryRemain = size;
- endOfDirectory = false;
-
- while (entryStillValid && !endOfDirectory && (dirEntryRemain > 0)) {
- _FAT_cache_readPartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, gapEnd.cluster) + gapEnd.sector, gapEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- if (entryData[0] == DIR_ENTRY_LAST) {
- gapStart = gapEnd;
- -- dirEntryRemain;
- endOfDirectory = true;
- } else if (entryData[0] == DIR_ENTRY_FREE) {
- if (dirEntryRemain == size) {
- gapStart = gapEnd;
- }
- -- dirEntryRemain;
- } else {
- dirEntryRemain = size;
- }
-
- if (!endOfDirectory && (dirEntryRemain > 0)) {
- entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &gapEnd, true);
- }
- }
-
- // Make sure the scanning didn't fail
- if (!entryStillValid) {
- return false;
- }
-
- // Save the start entry, since we know it is valid
- entry->dataStart = gapStart;
-
- if (endOfDirectory) {
- memset (entryData, DIR_ENTRY_LAST, DIR_ENTRY_DATA_SIZE);
- dirEntryRemain += 1; // Increase by one to take account of End Of Directory Marker
- while ((dirEntryRemain > 0) && entryStillValid) {
- // Get the gapEnd before incrementing it, so the second to last one is saved
- entry->dataEnd = gapEnd;
- // Increment gapEnd, moving onto the next entry
- entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &gapEnd, true);
- -- dirEntryRemain;
- // Fill the entry with blanks
- _FAT_cache_writePartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, gapEnd.cluster) + gapEnd.sector, gapEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- }
- if (!entryStillValid) {
- return false;
- }
- } else {
- entry->dataEnd = gapEnd;
- }
-
- return true;
-}
-
-static bool _FAT_directory_entryExists (PARTITION* partition, const char* name, u32 dirCluster) {
- DIR_ENTRY tempEntry;
- bool foundFile;
- char alias[MAX_ALIAS_LENGTH];
- u32 dirnameLength;
-
- dirnameLength = strnlen(name, MAX_FILENAME_LENGTH);
-
- if (dirnameLength >= MAX_FILENAME_LENGTH) {
- return false;
- }
-
- // Make sure the entry doesn't already exist
- foundFile = _FAT_directory_getFirstEntry (partition, &tempEntry, dirCluster);
-
- while (foundFile) { // It hasn't already found the file
- // Check if the filename matches
- if ((dirnameLength == strnlen(tempEntry.filename, MAX_FILENAME_LENGTH))
- && (strcasecmp(tempEntry.filename, name) == 0)) {
- return true;
- }
-
- // Check if the alias matches
- _FAT_directory_entryGetAlias (tempEntry.entryData, alias);
- if ((dirnameLength == strnlen(alias, MAX_ALIAS_LENGTH))
- && (strcasecmp(alias, name) == 0)) {
- return true;
- }
- foundFile = _FAT_directory_getNextEntry (partition, &tempEntry);
- }
- return false;
-}
-
-
-
-bool _FAT_directory_addEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster) {
- u32 entrySize;
- u8 lfnEntry[DIR_ENTRY_DATA_SIZE];
- s32 i,j; // Must be signed for use when decrementing in for loop
- char *tmpCharPtr;
- DIR_ENTRY_POSITION curEntryPos;
- bool entryStillValid;
- u8 aliasCheckSum = 0;
- char alias [MAX_ALIAS_LENGTH];
-
- // Make sure the filename is not 0 length
- if (strnlen (entry->filename, MAX_FILENAME_LENGTH) < 1) {
- return false;
- }
-
- // Make sure the filename is at least a valid LFN
- if ( !(_FAT_directory_isValidLfn (entry->filename))) {
- return false;
- }
-
- // Remove trailing spaces
- for (i = strlen (entry->filename) - 1; (i > 0) && (entry->filename[i] == ' '); --i) {
- entry->filename[i] = '\0';
- }
- // Remove leading spaces
- for (i = 0; (i < strlen (entry->filename)) && (entry->filename[i] == ' '); ++i) ;
- if (i > 0) {
- memmove (entry->filename, entry->filename + i, strlen (entry->filename + i));
- }
-
- // Remove junk in filename
- i = strlen (entry->filename);
- memset (entry->filename + i, '\0', MAX_FILENAME_LENGTH - i);
-
- // Make sure the entry doesn't already exist
- if (_FAT_directory_entryExists (partition, entry->filename, dirCluster)) {
- return false;
- }
-
- // Clear out alias, so we can generate a new one
- memset (entry->entryData, ' ', 11);
-
- if ( strncmp(entry->filename, ".", MAX_FILENAME_LENGTH) == 0) {
- // "." entry
- entry->entryData[0] = '.';
- entrySize = 1;
- } else if ( strncmp(entry->filename, "..", MAX_FILENAME_LENGTH) == 0) {
- // ".." entry
- entry->entryData[0] = '.';
- entry->entryData[1] = '.';
- entrySize = 1;
- } else if ( _FAT_directory_isValidAlias (entry->filename)) {
- // Short filename
- strupr (entry->filename);
- entrySize = 1;
- // Copy into alias
- for (i = 0, j = 0; (j < 8) && (entry->filename[i] != '.') && (entry->filename[i] != '\0'); i++, j++) {
- entry->entryData[j] = entry->filename[i];
- }
- while (j < 8) {
- entry->entryData[j] = ' ';
- ++ j;
- }
- if (entry->filename[i] == '.') {
- // Copy extension
- ++ i;
- while ((entry->filename[i] != '\0') && (j < 11)) {
- entry->entryData[j] = entry->filename[i];
- ++ i;
- ++ j;
- }
- }
- while (j < 11) {
- entry->entryData[j] = ' ';
- ++ j;
- }
- } else {
- // Long filename needed
- entrySize = ((strnlen (entry->filename, MAX_FILENAME_LENGTH) + LFN_ENTRY_LENGTH - 1) / LFN_ENTRY_LENGTH) + 1;
- // Generate alias
- tmpCharPtr = strrchr (entry->filename, '.');
- if (tmpCharPtr == NULL) {
- tmpCharPtr = strrchr (entry->filename, '\0');
- }
- for (i = 0, j = 0; (j < 6) && (entry->filename + i < tmpCharPtr); i++) {
- if ( isalnum(entry->filename[i])) {
- alias[j] = entry->filename[i];
- ++ j;
- }
- }
- while (j < 8) {
- alias[j] = '_';
- ++ j;
- }
- tmpCharPtr = strrchr (entry->filename, '.');
- if (tmpCharPtr != NULL) {
- alias[8] = '.';
- // Copy extension
- while ((tmpCharPtr != '\0') && (j < 12)) {
- alias[j] = tmpCharPtr[0];
- ++ tmpCharPtr;
- ++ j;
- }
- alias[j] = '\0';
- } else {
- for (j = 8; j < MAX_ALIAS_LENGTH; j++) {
- alias[j] = '\0';
- }
- }
-
- // Get a valid tail number
- alias[5] = '~';
- i = 0;
- do {
- i++;
- alias[6] = '0' + ((i / 10) % 10); // 10's digit
- alias[7] = '0' + (i % 10); // 1's digit
- } while (_FAT_directory_entryExists (partition, alias, dirCluster) && (i < 100));
- if (i == 100) {
- // Couldn't get a tail number
- return false;
- }
-
- // Make it upper case
- strupr (alias);
-
- // Now copy it into the directory entry data
- memcpy (entry->entryData, alias, 8);
- memcpy (entry->entryData + 8, alias + 9, 3);
- for (i = 0; i < 10; i++) {
- if (entry->entryData[i] < 0x20) {
- // Replace null and control characters with spaces
- entry->entryData[i] = 0x20;
- }
- }
- // Generate alias checksum
- for (i=0; i < 11; i++)
- {
- // NOTE: The operation is an unsigned char rotate right
- aliasCheckSum = ((aliasCheckSum & 1) ? 0x80 : 0) + (aliasCheckSum >> 1) + entry->entryData[i];
- }
-
- }
-
- // Find or create space for the entry
- if (_FAT_directory_findEntryGap (partition, entry, dirCluster, entrySize) == false) {
- return false;
- }
-
- // Write out directory entry
- curEntryPos = entry->dataStart;
-
- for (entryStillValid = true, i = entrySize; entryStillValid && i > 0;
- entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &curEntryPos, false), -- i )
- {
- if (i > 1) {
- // Long filename entry
- lfnEntry[LFN_offset_ordinal] = (i - 1) | (i == entrySize ? LFN_END : 0);
- for (j = 0; j < 13; j++) {
- if (entry->filename [(i - 2) * 13 + j] == '\0') {
- if ((j > 1) && (entry->filename [(i - 2) * 13 + (j-1)] == '\0')) {
- u16_to_u8array (lfnEntry, LFN_offset_table[j], 0xffff); // Padding
- } else {
- u16_to_u8array (lfnEntry, LFN_offset_table[j], 0x0000); // Terminating null character
- }
- } else {
- u16_to_u8array (lfnEntry, LFN_offset_table[j], entry->filename [(i - 2) * 13 + j]);
- }
- }
-
- lfnEntry[LFN_offset_checkSum] = aliasCheckSum;
- lfnEntry[LFN_offset_flag] = ATTRIB_LFN;
- lfnEntry[LFN_offset_reserved1] = 0;
- u16_to_u8array (lfnEntry, LFN_offset_reserved2, 0);
- _FAT_cache_writePartialSector (partition->cache, lfnEntry, _FAT_fat_clusterToSector(partition, curEntryPos.cluster) + curEntryPos.sector, curEntryPos.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- } else {
- // Alias & file data
- _FAT_cache_writePartialSector (partition->cache, entry->entryData, _FAT_fat_clusterToSector(partition, curEntryPos.cluster) + curEntryPos.sector, curEntryPos.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- }
- }
-
- return true;
-}
-
-bool _FAT_directory_chdir (PARTITION* partition, const char* path) {
- DIR_ENTRY entry;
-
- if (!_FAT_directory_entryFromPath (partition, &entry, path, NULL)) {
- return false;
- }
-
- if (!(entry.entryData[DIR_ENTRY_attributes] & ATTRIB_DIR)) {
- return false;
- }
-
- partition->cwdCluster = _FAT_directory_entryGetCluster (entry.entryData);
-
- return true;
-}
-
-void _FAT_directory_entryStat (PARTITION* partition, DIR_ENTRY* entry, struct stat *st) {
- // Fill in the stat struct
- // Some of the values are faked for the sake of compatibility
- st->st_dev = _FAT_disc_hostType(partition->disc); // The device is the 32bit ioType value
- st->st_ino = (ino_t)(_FAT_directory_entryGetCluster(entry->entryData)); // The file serial number is the start cluster
- st->st_mode = (_FAT_directory_isDirectory(entry) ? S_IFDIR : S_IFREG) |
- (S_IRUSR | S_IRGRP | S_IROTH) |
- (_FAT_directory_isWritable (entry) ? (S_IWUSR | S_IWGRP | S_IWOTH) : 0); // Mode bits based on dirEntry ATTRIB byte
- st->st_nlink = 1; // Always one hard link on a FAT file
- st->st_uid = 1; // Faked for FAT
- st->st_gid = 2; // Faked for FAT
- st->st_rdev = st->st_dev;
- st->st_size = u8array_to_u32 (entry->entryData, DIR_ENTRY_fileSize); // File size
- st->st_atime = _FAT_filetime_to_time_t (
- 0,
- u8array_to_u16 (entry->entryData, DIR_ENTRY_aDate)
- );
- st->st_spare1 = 0;
- st->st_mtime = _FAT_filetime_to_time_t (
- u8array_to_u16 (entry->entryData, DIR_ENTRY_mTime),
- u8array_to_u16 (entry->entryData, DIR_ENTRY_mDate)
- );
- st->st_spare2 = 0;
- st->st_ctime = _FAT_filetime_to_time_t (
- u8array_to_u16 (entry->entryData, DIR_ENTRY_cTime),
- u8array_to_u16 (entry->entryData, DIR_ENTRY_cDate)
- );
- st->st_spare3 = 0;
- st->st_blksize = BYTES_PER_READ; // Prefered file I/O block size
- st->st_blocks = (st->st_size + BYTES_PER_READ - 1) / BYTES_PER_READ; // File size in blocks
- st->st_spare4[0] = 0;
- st->st_spare4[1] = 0;
-}
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/directory.h b/c/src/lib/libbsp/arm/nds/libfat/source/directory.h
deleted file mode 100644
index 3c75658e7e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/directory.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- directory.h
- Reading, writing and manipulation of the directory structure on
- a FAT partition
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _DIRECTORY_H
-#define _DIRECTORY_H
-
-#include <sys/stat.h>
-
-#include "common.h"
-#include "partition.h"
-
-#define DIR_ENTRY_DATA_SIZE 0x20
-#define MAX_FILENAME_LENGTH 256
-#define MAX_ALIAS_LENGTH 13
-#define LFN_ENTRY_LENGTH 13
-#define FAT16_ROOT_DIR_CLUSTER 0
-
-#define DIR_SEPARATOR '/'
-
-// File attributes
-#define ATTRIB_ARCH 0x20 // Archive
-#define ATTRIB_DIR 0x10 // Directory
-#define ATTRIB_LFN 0x0F // Long file name
-#define ATTRIB_VOL 0x08 // Volume
-#define ATTRIB_SYS 0x04 // System
-#define ATTRIB_HID 0x02 // Hidden
-#define ATTRIB_RO 0x01 // Read only
-
-typedef enum {FT_DIRECTORY, FT_FILE} FILE_TYPE;
-
-typedef struct {
- u32 cluster;
- u32 sector;
- s32 offset;
-} DIR_ENTRY_POSITION;
-
-typedef struct {
- u8 entryData[DIR_ENTRY_DATA_SIZE];
- DIR_ENTRY_POSITION dataStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
- DIR_ENTRY_POSITION dataEnd; // Always points to the file/directory's alias entry
- char filename[MAX_FILENAME_LENGTH];
-} DIR_ENTRY;
-
-// Directory entry offsets
-enum DIR_ENTRY_offset {
- DIR_ENTRY_name = 0x00,
- DIR_ENTRY_extension = 0x08,
- DIR_ENTRY_attributes = 0x0B,
- DIR_ENTRY_reserved = 0x0C,
- DIR_ENTRY_cTime_ms = 0x0D,
- DIR_ENTRY_cTime = 0x0E,
- DIR_ENTRY_cDate = 0x10,
- DIR_ENTRY_aDate = 0x12,
- DIR_ENTRY_clusterHigh = 0x14,
- DIR_ENTRY_mTime = 0x16,
- DIR_ENTRY_mDate = 0x18,
- DIR_ENTRY_cluster = 0x1A,
- DIR_ENTRY_fileSize = 0x1C
-};
-
-/*
-Returns true if the file specified by entry is a directory
-*/
-static inline bool _FAT_directory_isDirectory (DIR_ENTRY* entry) {
- return ((entry->entryData[DIR_ENTRY_attributes] & ATTRIB_DIR) != 0);
-}
-
-static inline bool _FAT_directory_isWritable (DIR_ENTRY* entry) {
- return ((entry->entryData[DIR_ENTRY_attributes] & ATTRIB_RO) == 0);
-}
-
-static inline bool _FAT_directory_isDot (DIR_ENTRY* entry) {
- return ((entry->filename[0] == '.') && ((entry->filename[1] == '\0') ||
- ((entry->filename[1] == '.') && entry->filename[2] == '\0')));
-}
-
-/*
-Reads the first directory entry from the directory starting at dirCluster
-Places result in entry
-entry will be destroyed even if no directory entry is found
-Returns true on success, false on failure
-*/
-bool _FAT_directory_getFirstEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster);
-
-/*
-Reads the next directory entry after the one already pointed to by entry
-Places result in entry
-entry will be destroyed even if no directory entry is found
-Returns true on success, false on failure
-*/
-bool _FAT_directory_getNextEntry (PARTITION* partition, DIR_ENTRY* entry);
-
-/*
-Gets the directory entry corrsponding to the supplied path
-entry will be destroyed even if no directory entry is found
-pathEnd specifies the end of the path string, for cutting strings short if needed
- specify NULL to use the full length of path
- pathEnd is only a suggestion, and the path string will be searched up until the next PATH_SEPARATOR
- after pathEND.
-Returns true on success, false on failure
-*/
-bool _FAT_directory_entryFromPath (PARTITION* partition, DIR_ENTRY* entry, const char* path, const char* pathEnd);
-
-/*
-Changes the current directory to the one specified by path
-Returns true on success, false on failure
-*/
-bool _FAT_directory_chdir (PARTITION* partition, const char* path);
-
-/*
-Removes the directory entry specified by entry
-Assumes that entry is valid
-Returns true on success, false on failure
-*/
-bool _FAT_directory_removeEntry (PARTITION* partition, DIR_ENTRY* entry);
-
-/*
-Add a directory entry to the directory specified by dirCluster
-The fileData, dataStart and dataEnd elements of the DIR_ENTRY struct are
-updated with the new directory entry position and alias.
-Returns true on success, false on failure
-*/
-bool _FAT_directory_addEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster);
-
-/*
-Get the start cluster of a file from it's entry data
-*/
-u32 _FAT_directory_entryGetCluster (const u8* entryData);
-
-/*
-Fill in the file name and entry data of DIR_ENTRY* entry.
-Assumes that the entry's dataStart and dataEnd are correct
-Returns true on success, false on failure
-*/
-bool _FAT_directory_entryFromPosition (PARTITION* partition, DIR_ENTRY* entry);
-
-/*
-Fill in a stat struct based on a file entry
-*/
-void _FAT_directory_entryStat (PARTITION* partition, DIR_ENTRY* entry, struct stat *st);
-
-#endif // _DIRECTORY_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc.c
deleted file mode 100644
index 8eea5fcaba..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-
- disc.c
-
- uniformed io-interface to work with Chishm's FAT library
-
- Written by MightyMax
-
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2005-11-06 - Chishm
- * Added WAIT_CR modifications for NDS
-
- 2006-02-03 www.neoflash.com
- * Added SUPPORT_* defines, comment out any of the SUPPORT_* defines in disc_io.h to remove support
- for the given interface and stop code being linked to the binary
-
- * Added support for MK2 MMC interface
-
- * Added disc_Cache* functions
-
- 2006-02-05 - Chishm
- * Added Supercard SD support
-
- 2006-02-26 - Cytex
- * Added EFA2 support
-
- 2006-05-18 - Chishm
- * Rewritten for FATlib disc.c
-
- 2006-06-19 - Chishm
- * Changed read and write interface to accept a u32 instead of a u8 for the number of sectors
-
- 2006-07-11 - Chishm
- * Removed disc_Cache* functions, since there is now a proper unified cache
- * Removed SUPPORT_* defines
- * Rewrote device detection functions
- * First libfat release
-
- 2006-07-25 - Chishm
- * Changed IO_INTERFACEs to const
-
- 2006-08-02 - Chishm
- * Added NinjaDS
-
- 2006-12-25 - Chishm
- * Added DLDI
- * Removed experimental interfaces
-
- 2007-05-01 - Chishm
- * Removed FCSR
-*/
-
-#include "disc.h"
-#include "disc_io.h"
-
-#ifdef NDS
- #include <nds.h>
-#endif
-
-
-// Include known io-interfaces:
-#include "io_dldi.h"
-#include "io_njsd.h"
-#include "io_nmmc.h"
-#include "io_mpcf.h"
-#include "io_m3cf.h"
-#include "io_sccf.h"
-#include "io_scsd.h"
-#include "io_m3sd.h"
-
-const IO_INTERFACE* ioInterfaces[] = {
- &_io_dldi, // Reserved for new interfaces
-#ifdef NDS
- // Place Slot 1 (DS Card) interfaces here
- &_io_njsd, &_io_nmmc,
-#endif
- // Place Slot 2 (GBA Cart) interfaces here
- &_io_mpcf, &_io_m3cf, &_io_sccf, &_io_scsd, &_io_m3sd
-};
-
-/*
-
- Hardware level disc funtions
-
-*/
-
-const IO_INTERFACE* _FAT_disc_gbaSlotFindInterface (void)
-{
- // If running on an NDS, make sure the correct CPU can access
- // the GBA cart. First implemented by SaTa.
-#ifdef NDS
- #ifdef ARM9
- sysSetCartOwner(BUS_OWNER_ARM9);
- #endif
-#endif
-
- int i;
-
- for (i = 0; i < (sizeof(ioInterfaces) / sizeof(IO_INTERFACE*)); i++) {
- if ((ioInterfaces[i]->features & FEATURE_SLOT_GBA) && (ioInterfaces[i]->fn_startup())) {
- return ioInterfaces[i];
- }
- }
- return NULL;
-}
-
-#ifdef NDS
-/*
- * Check the DS card slot for a valid memory card interface
- * If an interface is found, it is set as the default interace
- * and it returns true. Otherwise the default interface is left
- * untouched and it returns false.
- */
-const IO_INTERFACE* _FAT_disc_dsSlotFindInterface (void)
-{
-#ifdef ARM9
- sysSetCardOwner(BUS_OWNER_ARM9);
-#endif
- int i;
-
- for (i = 0; i < (sizeof(ioInterfaces) / sizeof(IO_INTERFACE*)); i++) {
- if ((ioInterfaces[i]->features & FEATURE_SLOT_NDS) && (ioInterfaces[i]->fn_startup())) {
- return ioInterfaces[i];
- }
- }
-
- return NULL;
-}
-#endif
-
-/*
- * When running on an NDS, check the either slot for a valid memory
- * card interface.
- * When running on a GBA, call _FAT_disc_gbaSlotFindInterface
- * If an interface is found, it is set as the default interace
- * and it returns true. Otherwise the default interface is left
- * untouched and it returns false.
- */
-#ifdef NDS
-const IO_INTERFACE* _FAT_disc_findInterface (void)
-{
-#ifdef ARM9
- sysSetBusOwners(BUS_OWNER_ARM9, BUS_OWNER_ARM9);
-#endif
-
- int i;
-
- for (i = 0; i < (sizeof(ioInterfaces) / sizeof(IO_INTERFACE*)); i++) {
- if (ioInterfaces[i]->fn_startup()) {
- return ioInterfaces[i];
- }
- }
-
- return NULL;
-}
-#else
-const IO_INTERFACE* _FAT_disc_findInterface (void)
-{
- return _FAT_disc_gbaSlotFindInterface();
-}
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc.h
deleted file mode 100644
index 5bb21f171f..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- disc.h
- Interface to the low level disc functions. Used by the higher level
- file system code.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
-*/
-#ifndef _DISC_H
-#define _DISC_H
-
-#include "../common.h"
-#include "disc_io.h"
-
-/*
-Search for a block based device in the GBA slot.
-Return a pointer to a usable interface if one is found,
-NULL if not.
-*/
-extern const IO_INTERFACE* _FAT_disc_gbaSlotFindInterface (void);
-
-/*
-Search for a block based device in the DS slot.
-Return a pointer to a usable interface if one is found,
-NULL if not.
-*/
-#ifdef NDS
-extern const IO_INTERFACE* _FAT_disc_dsSlotFindInterface (void);
-#endif
-
-/*
-Search for a block based device in the both slots.
-Return a pointer to a usable interface if one is found,
-NULL if not.
-*/
-extern const IO_INTERFACE* _FAT_disc_findInterface (void);
-
-/*
-Check if a disc is inserted
-Return true if a disc is inserted and ready, false otherwise
-*/
-static inline bool _FAT_disc_isInserted (const IO_INTERFACE* disc) {
- return disc->fn_isInserted();
-}
-
-/*
-Read numSectors sectors from a disc, starting at sector.
-numSectors is between 1 and 256
-sector is from 0 to 2^28
-buffer is a pointer to the memory to fill
-*/
-static inline bool _FAT_disc_readSectors (const IO_INTERFACE* disc, u32 sector, u32 numSectors, void* buffer) {
- return disc->fn_readSectors (sector, numSectors, buffer);
-}
-
-/*
-Write numSectors sectors to a disc, starting at sector.
-numSectors is between 1 and 256
-sector is from 0 to 2^28
-buffer is a pointer to the memory to read from
-*/
-static inline bool _FAT_disc_writeSectors (const IO_INTERFACE* disc, u32 sector, u32 numSectors, const void* buffer) {
- return disc->fn_writeSectors (sector, numSectors, buffer);
-}
-
-/*
-Reset the card back to a ready state
-*/
-static inline bool _FAT_disc_clearStatus (const IO_INTERFACE* disc) {
- return disc->fn_clearStatus();
-}
-
-/*
-Initialise the disc to a state ready for data reading or writing
-*/
-static inline bool _FAT_disc_startup (const IO_INTERFACE* disc) {
- return disc->fn_startup();
-}
-
-/*
-Put the disc in a state ready for power down.
-Complete any pending writes and disable the disc if necessary
-*/
-static inline bool _FAT_disc_shutdown (const IO_INTERFACE* disc) {
- return disc->fn_shutdown();
-}
-
-/*
-Return a 32 bit value unique to each type of interface
-*/
-static inline u32 _FAT_disc_hostType (const IO_INTERFACE* disc) {
- return disc->ioType;
-}
-
-/*
-Return a 32 bit value that specifies the capabilities of the disc
-*/
-static inline u32 _FAT_disc_features (const IO_INTERFACE* disc) {
- return disc->features;
-}
-
-#endif // _DISC_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc_io.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc_io.h
deleted file mode 100644
index 916f94e5a3..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/disc_io.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- disc_io.h
- Interface template for low level disc functions.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-16 - Chishm
- * Renamed _CF_USE_DMA to _IO_USE_DMA
- * Renamed _CF_ALLOW_UNALIGNED to _IO_ALLOW_UNALIGNED
-*/
-
-#ifndef _DISC_IO_H
-#define _DISC_IO_H
-
-#include "../common.h"
-
-//----------------------------------------------------------------------
-// Customisable features
-
-// Use DMA to read the card, remove this line to use normal reads/writes
-// #define _IO_USE_DMA
-
-// Allow buffers not alligned to 16 bits when reading files.
-// Note that this will slow down access speed, so only use if you have to.
-// It is also incompatible with DMA
-#define _IO_ALLOW_UNALIGNED
-
-#if defined _IO_USE_DMA && defined _IO_ALLOW_UNALIGNED
- #error "You cannot use both DMA and unaligned memory"
-#endif
-
-#define FEATURE_MEDIUM_CANREAD 0x00000001
-#define FEATURE_MEDIUM_CANWRITE 0x00000002
-#define FEATURE_SLOT_GBA 0x00000010
-#define FEATURE_SLOT_NDS 0x00000020
-
-typedef bool (* FN_MEDIUM_STARTUP)(void) ;
-typedef bool (* FN_MEDIUM_ISINSERTED)(void) ;
-typedef bool (* FN_MEDIUM_READSECTORS)(u32 sector, u32 numSectors, void* buffer) ;
-typedef bool (* FN_MEDIUM_WRITESECTORS)(u32 sector, u32 numSectors, const void* buffer) ;
-typedef bool (* FN_MEDIUM_CLEARSTATUS)(void) ;
-typedef bool (* FN_MEDIUM_SHUTDOWN)(void) ;
-
-struct IO_INTERFACE_STRUCT {
- unsigned long ioType ;
- unsigned long features ;
- FN_MEDIUM_STARTUP fn_startup ;
- FN_MEDIUM_ISINSERTED fn_isInserted ;
- FN_MEDIUM_READSECTORS fn_readSectors ;
- FN_MEDIUM_WRITESECTORS fn_writeSectors ;
- FN_MEDIUM_CLEARSTATUS fn_clearStatus ;
- FN_MEDIUM_SHUTDOWN fn_shutdown ;
-} ;
-
-typedef struct IO_INTERFACE_STRUCT IO_INTERFACE ;
-
-#endif // define _DISC_IO_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_cf_common.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_cf_common.c
deleted file mode 100644
index 386d24d5ed..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_cf_common.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- io_cf_common.c based on
-
- compact_flash.c
- By chishm (Michael Chisholm)
-
- Common hardware routines for using a compact flash card. This is not reentrant
- and does not do range checking on the supplied addresses. This is designed to
- be as fast as possible.
-
- CF routines modified with help from Darkfader
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "io_cf_common.h"
-
-//---------------------------------------------------------------
-// DMA
-#ifdef _IO_USE_DMA
- #ifndef NDS
- #include "gba_dma.h"
- #else
- #include <nds/dma.h>
- #ifdef ARM9
- #include <nds/arm9/cache.h>
- #endif
- #endif
-#endif
-
-//---------------------------------------------------------------
-// CF Addresses & Commands
-
-CF_REGISTERS cfRegisters = {0};
-
-
-/*-----------------------------------------------------------------
-_CF_isInserted
-Is a compact flash card inserted?
-bool return OUT: true if a CF card is inserted
------------------------------------------------------------------*/
-bool _CF_isInserted (void) {
- // Change register, then check if value did change
- *(cfRegisters.status) = CF_STS_INSERTED;
- return ((*(cfRegisters.status) & 0xff) == CF_STS_INSERTED);
-}
-
-
-/*-----------------------------------------------------------------
-_CF_clearStatus
-Tries to make the CF card go back to idle mode
-bool return OUT: true if a CF card is idle
------------------------------------------------------------------*/
-bool _CF_clearStatus (void) {
- int i;
-
- // Wait until CF card is finished previous commands
- i=0;
- while ((*(cfRegisters.command) & CF_STS_BUSY) && (i < CF_CARD_TIMEOUT)) {
- i++;
- }
-
- // Wait until card is ready for commands
- i = 0;
- while ((!(*(cfRegisters.status) & CF_STS_INSERTED)) && (i < CF_CARD_TIMEOUT)) {
- i++;
- }
- if (i >= CF_CARD_TIMEOUT)
- return false;
-
- return true;
-}
-
-
-/*-----------------------------------------------------------------
-_CF_readSectors
-Read 512 byte sector numbered "sector" into "buffer"
-u32 sector IN: address of first 512 byte sector on CF card to read
-u32 numSectors IN: number of 512 byte sectors to read,
- 1 to 256 sectors can be read
-void* buffer OUT: pointer to 512 byte buffer to store data in
-bool return OUT: true if successful
------------------------------------------------------------------*/
-bool _CF_readSectors (u32 sector, u32 numSectors, void* buffer) {
- int i;
-
- u16 *buff = (u16*)buffer;
-#ifdef _IO_ALLOW_UNALIGNED
- u8 *buff_u8 = (u8*)buffer;
- int temp;
-#endif
-
-#if (defined _IO_USE_DMA) && (defined NDS) && (defined ARM9)
- DC_FlushRange( buffer, j * BYTES_PER_READ);
-#endif
-
- // Wait until CF card is finished previous commands
- i=0;
- while ((*(cfRegisters.command) & CF_STS_BUSY) && (i < CF_CARD_TIMEOUT)) {
- i++;
- }
-
- // Wait until card is ready for commands
- i = 0;
- while ((!(*(cfRegisters.status) & CF_STS_INSERTED)) && (i < CF_CARD_TIMEOUT)) {
- i++;
- }
- if (i >= CF_CARD_TIMEOUT)
- return false;
-
- // Set number of sectors to read
- *(cfRegisters.sectorCount) = (numSectors < 256 ? numSectors : 0); // Read a maximum of 256 sectors, 0 means 256
-
- // Set read sector
- *(cfRegisters.lba1) = sector & 0xFF; // 1st byte of sector number
- *(cfRegisters.lba2) = (sector >> 8) & 0xFF; // 2nd byte of sector number
- *(cfRegisters.lba3) = (sector >> 16) & 0xFF; // 3rd byte of sector number
- *(cfRegisters.lba4) = ((sector >> 24) & 0x0F )| CF_CMD_LBA; // last nibble of sector number
-
- // Set command to read
- *(cfRegisters.command) = CF_CMD_READ;
-
-
- while (numSectors--)
- {
- // Wait until card is ready for reading
- i = 0;
- while (((*(cfRegisters.status) & 0xff)!= CF_STS_READY) && (i < CF_CARD_TIMEOUT))
- {
- i++;
- }
- if (i >= CF_CARD_TIMEOUT)
- return false;
-
- // Read data
-#ifdef _IO_USE_DMA
- #ifdef NDS
- DMA3_SRC = (u32)(cfRegisters.data);
- DMA3_DEST = (u32)buff;
- DMA3_CR = 256 | DMA_COPY_HALFWORDS | DMA_SRC_FIX;
- #else
- DMA3COPY ( (cfRegisters.data), buff, 256 | DMA16 | DMA_ENABLE | DMA_SRC_FIXED);
- #endif
- buff += BYTES_PER_READ / 2;
-#elif defined _IO_ALLOW_UNALIGNED
- i=256;
- if ((u32)buff_u8 & 0x01) {
- while(i--)
- {
- temp = *(cfRegisters.data);
- *buff_u8++ = temp & 0xFF;
- *buff_u8++ = temp >> 8;
- }
- } else {
- while(i--)
- *buff++ = *(cfRegisters.data);
- }
-#else
- i=256;
- while(i--)
- *buff++ = *(cfRegisters.data);
-#endif
- }
-#if (defined _IO_USE_DMA) && (defined NDS)
- // Wait for end of transfer before returning
- while(DMA3_CR & DMA_BUSY);
-#endif
- return true;
-}
-
-
-
-/*-----------------------------------------------------------------
-_CF_writeSectors
-Write 512 byte sector numbered "sector" from "buffer"
-u32 sector IN: address of 512 byte sector on CF card to read
-u32 numSectors IN: number of 512 byte sectors to read,
- 1 to 256 sectors can be read
-void* buffer IN: pointer to 512 byte buffer to read data from
-bool return OUT: true if successful
------------------------------------------------------------------*/
-bool _CF_writeSectors (u32 sector, u32 numSectors, void* buffer) {
- int i;
-
- u16 *buff = (u16*)buffer;
-#ifdef _IO_ALLOW_UNALIGNED
- u8 *buff_u8 = (u8*)buffer;
- int temp;
-#endif
-
-#if defined _IO_USE_DMA && defined NDS && defined ARM9
- DC_FlushRange( buffer, j * BYTES_PER_READ);
-#endif
-
- // Wait until CF card is finished previous commands
- i=0;
- while ((*(cfRegisters.command) & CF_STS_BUSY) && (i < CF_CARD_TIMEOUT))
- {
- i++;
- }
-
- // Wait until card is ready for commands
- i = 0;
- while ((!(*(cfRegisters.status) & CF_STS_INSERTED)) && (i < CF_CARD_TIMEOUT))
- {
- i++;
- }
- if (i >= CF_CARD_TIMEOUT)
- return false;
-
- // Set number of sectors to write
- *(cfRegisters.sectorCount) = (numSectors < 256 ? numSectors : 0); // Write a maximum of 256 sectors, 0 means 256
-
- // Set write sector
- *(cfRegisters.lba1) = sector & 0xFF; // 1st byte of sector number
- *(cfRegisters.lba2) = (sector >> 8) & 0xFF; // 2nd byte of sector number
- *(cfRegisters.lba3) = (sector >> 16) & 0xFF; // 3rd byte of sector number
- *(cfRegisters.lba4) = ((sector >> 24) & 0x0F )| CF_CMD_LBA; // last nibble of sector number
-
- // Set command to write
- *(cfRegisters.command) = CF_CMD_WRITE;
-
- while (numSectors--)
- {
- // Wait until card is ready for writing
- i = 0;
- while (((*(cfRegisters.status) & 0xff) != CF_STS_READY) && (i < CF_CARD_TIMEOUT))
- {
- i++;
- }
- if (i >= CF_CARD_TIMEOUT)
- return false;
-
- // Write data
-#ifdef _IO_USE_DMA
- #ifdef NDS
- DMA3_SRC = (u32)buff;
- DMA3_DEST = (u32)(cfRegisters.data);
- DMA3_CR = 256 | DMA_COPY_HALFWORDS | DMA_DST_FIX;
- #else
- DMA3COPY( buff, (cfRegisters.data), 256 | DMA16 | DMA_ENABLE | DMA_DST_FIXED);
- #endif
- buff += BYTES_PER_READ / 2;
-#elif defined _IO_ALLOW_UNALIGNED
- i=256;
- if ((u32)buff_u8 & 0x01) {
- while(i--)
- {
- temp = *buff_u8++;
- temp |= *buff_u8++ << 8;
- *(cfRegisters.data) = temp;
- }
- } else {
- while(i--)
- *(cfRegisters.data) = *buff++;
- }
-#else
- i=256;
- while(i--)
- *(cfRegisters.data) = *buff++;
-#endif
- }
-#if defined _IO_USE_DMA && defined NDS
- // Wait for end of transfer before returning
- while(DMA3_CR & DMA_BUSY);
-#endif
-
- return true;
-}
-
-/*-----------------------------------------------------------------
-_CF_shutdown
-shutdown the CF interface
------------------------------------------------------------------*/
-bool _CF_shutdown(void) {
- return _CF_clearStatus() ;
-}
-
-/*-----------------------------------------------------------------
-_CF_startUp
-Initializes the CF interface using the supplied registers
-returns true if successful, otherwise returns false
------------------------------------------------------------------*/
-bool _CF_startup(const CF_REGISTERS *usableCfRegs) {
- cfRegisters = *usableCfRegs;
- // See if there is a read/write register
- u16 temp = *(cfRegisters.lba1);
- *(cfRegisters.lba1) = (~temp & 0xFF);
- temp = (~temp & 0xFF);
- if (!(*(cfRegisters.lba1) == temp)) {
- return false;
- }
- // Make sure it is 8 bit
- *(cfRegisters.lba1) = 0xAA55;
- if (*(cfRegisters.lba1) == 0xAA55) {
- return false;
- }
- return true;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_cf_common.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_cf_common.h
deleted file mode 100644
index e08c1a9503..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_cf_common.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- io_cf_common.h
-
- By chishm (Michael Chisholm)
-
- Common Compact Flash card values
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-16 - Chishm
- * Combined all CF interfaces into one common set of routines
-*/
-
-#ifndef IO_CF_COMMON_H
-#define IO_CF_COMMON_H
-
-#include "disc_io.h"
-
-typedef struct {
- vu16* data;
- vu16* status;
- vu16* command;
- vu16* error;
- vu16* sectorCount;
- vu16* lba1;
- vu16* lba2;
- vu16* lba3;
- vu16* lba4;
-} CF_REGISTERS;
-
-
-// CF Card status
-#define CF_STS_INSERTED 0x50
-#define CF_STS_REMOVED 0x00
-#define CF_STS_READY 0x58
-
-#define CF_STS_DRQ 0x08
-#define CF_STS_BUSY 0x80
-
-// CF Card commands
-#define CF_CMD_LBA 0xE0
-#define CF_CMD_READ 0x20
-#define CF_CMD_WRITE 0x30
-
-#define CF_CARD_TIMEOUT 10000000
-
-bool _CF_isInserted (void);
-bool _CF_clearStatus (void);
-bool _CF_readSectors (u32 sector, u32 numSectors, void* buffer);
-bool _CF_writeSectors (u32 sector, u32 numSectors, void* buffer);
-bool _CF_shutdown(void);
-bool _CF_startup(const CF_REGISTERS *usableCfRegs);
-
-#endif // define IO_CF_COMMON_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_dldi.S b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_dldi.S
deleted file mode 100644
index d087bbd94d..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_dldi.S
+++ /dev/null
@@ -1,73 +0,0 @@
-@---------------------------------------------------------------------------------
- .align 4
- .arm
- .global _io_dldi
-@---------------------------------------------------------------------------------
-.equ FEATURE_MEDIUM_CANREAD, 0x00000001
-.equ FEATURE_MEDIUM_CANWRITE, 0x00000002
-.equ FEATURE_SLOT_GBA, 0x00000010
-.equ FEATURE_SLOT_NDS, 0x00000020
-
-
-_dldi_start:
-
-@---------------------------------------------------------------------------------
-@ Driver patch file standard header -- 16 bytes
- .word 0xBF8DA5ED @ Magic number to identify this region
- .asciz " Chishm" @ Identifying Magic string (8 bytes with null terminator)
- .byte 0x01 @ Version number
- .byte 0x0F @32KiB @ Log [base-2] of the size of this driver in bytes.
- .byte 0x00 @ Sections to fix
- .byte 0x0F @32KiB @ Log [base-2] of the allocated space in bytes.
-
-@---------------------------------------------------------------------------------
-@ Text identifier - can be anything up to 47 chars + terminating null -- 16 bytes
- .align 4
- .asciz "Default (No interface)"
-
-@---------------------------------------------------------------------------------
-@ Offsets to important sections within the data -- 32 bytes
- .align 6
- .word _dldi_start @ data start
- .word _dldi_end @ data end
- .word 0x00000000 @ Interworking glue start -- Needs address fixing
- .word 0x00000000 @ Interworking glue end
- .word 0x00000000 @ GOT start -- Needs address fixing
- .word 0x00000000 @ GOT end
- .word 0x00000000 @ bss start -- Needs setting to zero
- .word 0x00000000 @ bss end
-
-@---------------------------------------------------------------------------------
-@ IO_INTERFACE data -- 32 bytes
-_io_dldi:
- .ascii "DLDI" @ ioType
- .word 0x00000000 @ Features
- .word _DLDI_startup @
- .word _DLDI_isInserted @
- .word _DLDI_readSectors @ Function pointers to standard device driver functions
- .word _DLDI_writeSectors @
- .word _DLDI_clearStatus @
- .word _DLDI_shutdown @
-
-@---------------------------------------------------------------------------------
-
-_DLDI_startup:
-_DLDI_isInserted:
-_DLDI_readSectors:
-_DLDI_writeSectors:
-_DLDI_clearStatus:
-_DLDI_shutdown:
- mov r0, #0x00 @ Return false for every function
- bx lr
-
-
-
-@---------------------------------------------------------------------------------
- .align
- .pool
-
-.space 32632 @ Fill to 32KiB
-
-_dldi_end:
- .end
-@---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_dldi.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_dldi.h
deleted file mode 100644
index 97483914ff..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_dldi.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- io_dldi.h
-
- Reserved space for post-compilation adding of an extra driver
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-12-22 - Chishm
- * Original release
-*/
-
-#ifndef IO_DLDI_H
-#define IO_DLDI_H
-
-// 'DLDD'
-#define DEVICE_TYPE_DLDD 0x49444C44
-
-#include "disc_io.h"
-
-// export interface
-extern const IO_INTERFACE _io_dldi ;
-
-#endif // define IO_DLDI_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.c
deleted file mode 100644
index f68e74a2ac..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
-io_efa2.c by CyteX
-
-Based on io_mpfc.c by chishm (Michael Chisholm)
-
-Hardware Routines for reading the NAND flash located on
-EFA2 flash carts
-
-This software is completely free. No warranty is provided.
-If you use it, please give me credit and email me about your
-project at cytex <at> gmx <dot> de and do not forget to also
-drop chishm <at> hotmail <dot> com a line
-
- Use with permission by Michael "Chishm" Chisholm
-*/
-
-#include "io_efa2.h"
-
-//
-// EFA2 register addresses
-//
-
-// RTC registers
-#define REG_RTC_CLK (*(vu16*)0x080000c4)
-#define REG_RTC_EN (*(vu16*)0x080000c8)
-
-// "Magic" registers used for unlock/lock sequences
-#define REG_EFA2_MAGIC_A (*(vu16*)0x09fe0000)
-#define REG_EFA2_MAGIC_B (*(vu16*)0x08000000)
-#define REG_EFA2_MAGIC_C (*(vu16*)0x08020000)
-#define REG_EFA2_MAGIC_D (*(vu16*)0x08040000)
-#define REG_EFA2_MAGIC_E (*(vu16*)0x09fc0000)
-
-// NAND flash lock/unlock register
-#define REG_EFA2_NAND_LOCK (*(vu16*)0x09c40000)
-// NAND flash enable register
-#define REG_EFA2_NAND_EN (*(vu16*)0x09400000)
-// NAND flash command write register
-#define REG_EFA2_NAND_CMD (*(vu8*)0x09ffffe2)
-// NAND flash address/data write register
-#define REG_EFA2_NAND_WR (*(vu8*)0x09ffffe0)
-// NAND flash data read register
-#define REG_EFA2_NAND_RD (*(vu8*)0x09ffc000)
-
-// ID of Samsung K9K1G NAND flash chip
-#define EFA2_NAND_ID 0xEC79A5C0
-
-// first sector of udisk
-#define EFA2_UDSK_START 0x40
-
-//
-// EFA2 access functions
-//
-
-// deactivate RTC ports
-static inline void _EFA2_rtc_deactivate(void) {
- REG_RTC_EN = 0;
-}
-
-// unlock register access
-static void _EFA2_reg_unlock(void) {
- REG_EFA2_MAGIC_A = 0x0d200;
- REG_EFA2_MAGIC_B = 0x01500;
- REG_EFA2_MAGIC_C = 0x0d200;
- REG_EFA2_MAGIC_D = 0x01500;
-}
-
-// finish/lock register access
-static inline void _EFA2_reg_lock(void) {
- REG_EFA2_MAGIC_E = 0x1500;
-}
-
-// global reset/init/enable/unlock ?
-static void _EFA2_global_unlock(void) {
- _EFA2_reg_unlock();
- *(vu16*)0x09880000 = 0x08000;
- _EFA2_reg_lock();
-}
-
-// global lock, stealth mode
-/*static void _EFA2_global_lock(void) {
- // quite sure there is such a sequence, but haven't had
- // a look for it upto now
-}*/
-
-// unlock NAND Flash
-static void _EFA2_nand_unlock(void) {
- _EFA2_reg_unlock();
- REG_EFA2_NAND_LOCK = 0x01500;
- _EFA2_reg_lock();
-}
-
-// lock NAND Flash
-static void _EFA2_nand_lock(void) {
- _EFA2_reg_unlock();
- REG_EFA2_NAND_LOCK = 0x0d200;
- _EFA2_reg_lock();
-}
-
-//
-// Set NAND Flash chip enable and write protection bits ?
-//
-// val | ~CE | ~WP |
-// -----+-----+-----+
-// 0 | 0 | 0 |
-// 1 | 1 | 0 |
-// 3 | 1 | 1 |
-// -----+-----+-----+
-//
-static void _EFA2_nand_enable(u16 val) {
- _EFA2_reg_unlock();
- REG_EFA2_NAND_EN = val;
- _EFA2_reg_lock();
-}
-
-//
-// Perform NAND reset
-// NAND has to be unlocked and enabled when called
-//
-static inline void _EFA2_nand_reset(void) {
- REG_EFA2_NAND_CMD = 0xff; // write reset command
-}
-
-//
-// Read out NAND ID information, could be used for card detection
-//
-// | EFA2 1GBit |
-// ------------------+------------+
-// maker code | 0xEC |
-// device code | 0x79 |
-// don't care | 0xA5 |
-// multi plane code | 0xC0 |
-// ------------------+------------+
-//
-static u32 _EFA2_nand_id(void) {
- u8 byte;
- u32 id;
-
- _EFA2_nand_unlock();
- _EFA2_nand_enable(1);
-
- REG_EFA2_NAND_CMD = 0x90; // write id command
- REG_EFA2_NAND_WR = 0x00; // (dummy) address cycle
- byte = REG_EFA2_NAND_RD; // read maker code
- id = byte;
- byte = REG_EFA2_NAND_RD; // read device code
- id = (id << 8) | byte;
- byte = REG_EFA2_NAND_RD; // read don't care
- id = (id << 8) | byte;
- byte = REG_EFA2_NAND_RD; // read multi plane code
- id = (id << 8) | byte;
-
- _EFA2_nand_enable(0);
- _EFA2_nand_lock();
- return (id);
-}
-
-//
-// Start of gba_nds_fat block device description
-//
-
-/*-----------------------------------------------------------------
-EFA2_clearStatus
-Reads and checks NAND status information
-bool return OUT: true if NAND is idle
------------------------------------------------------------------*/
-static bool _EFA2_clearStatus (void)
-{
- // tbd: currently there is no write support, so always return
- // true, there is no possibility for pending operations
- return true;
-}
-
-/*-----------------------------------------------------------------
-EFA2_isInserted
-Checks to see if the NAND chip used by the EFA2 is present
-bool return OUT: true if the correct NAND chip is found
------------------------------------------------------------------*/
-static bool _EFA2_isInserted (void)
-{
- _EFA2_clearStatus();
- return (_EFA2_nand_id() == EFA2_NAND_ID);
-}
-
-/*-----------------------------------------------------------------
-EFA2_readSectors
-Read "numSecs" 512 byte sectors starting from "sector" into "buffer"
-No error correction, no use of spare cells, no use of R/~B signal
-u32 sector IN: number of first 512 byte sector to be read
-u32 numSecs IN: number of 512 byte sectors to read,
-void* buffer OUT: pointer to 512 byte buffer to store data in
-bool return OUT: true if successful
------------------------------------------------------------------*/
-static bool _EFA2_readSectors (u32 sector, u32 numSecs, void* buffer)
-{
- int i;
-
-#ifndef _IO_ALLOW_UNALIGNED
- u8 byte;
- u16 word;
-#endif
-
- // NAND page 0x40 (EFA2_UDSK_START) contains the MBR of the
- // udisk and thus is sector 0. The original EFA2 firmware
- // does never look at this, it only watches page 0x60, which
- // contains the boot block of the FAT16 partition. That is
- // fixed, so the EFA2 udisk must not be reformated, else
- // the ARK Octopus and also the original Firmware won't be
- // able to access the udisk anymore and I have to write a
- // recovery tool.
- u32 page = EFA2_UDSK_START + sector;
-
- // future enhancement: wait for possible write operations to
- // be finisched
- if (!_EFA2_clearStatus()) return false;
-
- _EFA2_nand_unlock();
- _EFA2_nand_enable(1);
- _EFA2_nand_reset();
-
- // set NAND to READ1 operation mode and transfer page address
- REG_EFA2_NAND_CMD = 0x00; // write READ1 command
- REG_EFA2_NAND_WR = 0x00; // write address [7:0]
- REG_EFA2_NAND_WR = (page ) & 0xff; // write address [15:8]
- REG_EFA2_NAND_WR = (page >> 8 ) & 0xff; // write address[23:16]
- REG_EFA2_NAND_WR = (page >> 16) & 0xff; // write address[26:24]
-
- // Due to a bug in EFA2 design there is need to waste some cycles
- // "by hand" instead the possibility to check the R/~B port of
- // the NAND flash via a register. The RTC deactivation is only
- // there to make sure the loop won't be optimized by the compiler
- for (i=0 ; i < 3 ; i++) _EFA2_rtc_deactivate();
-
- while (numSecs--)
- {
- // read page data
-#ifdef _IO_ALLOW_UNALIGNED
- // slow byte access to RAM, but works in principle
- for (i=0 ; i < 512 ; i++)
- ((u8*)buffer)[i] = REG_EFA2_NAND_RD;
-#else
- // a bit faster, but DMA is not possible
- for (i=0 ; i < 256 ; i++) {
- byte = REG_EFA2_NAND_RD; // read lo-byte
- word = byte;
- byte = REG_EFA2_NAND_RD; // read hi-byte
- word = word | (byte << 8);
- ((u16*)buffer)[i] = word;
- }
-#endif
- }
-
- _EFA2_nand_enable(0);
- _EFA2_nand_lock();
- return true;
-}
-
-
-/*-----------------------------------------------------------------
-EFA2_writeSectors
-Write "numSecs" 512 byte sectors starting at "sector" from "buffer"
-u32 sector IN: address of 512 byte sector on card to write
-u32 numSecs IN: number of 512 byte sectors to write
-1 to 256 sectors can be written, 0 = 256
-void* buffer IN: pointer to 512 byte buffer to read data from
-bool return OUT: true if successful
------------------------------------------------------------------*/
-static bool _EFA2_writeSectors (u32 sector, u8 numSecs, void* buffer)
-{
- // Upto now I focused on reading NAND, write operations
- // will follow
- return false;
-}
-
-/*-----------------------------------------------------------------
-EFA2_shutdown
-unload the EFA2 interface
------------------------------------------------------------------*/
-static bool _EFA2_shutdown(void)
-{
- return _EFA2_clearStatus();
-}
-
-/*-----------------------------------------------------------------
-EFA2_startUp
-initializes the EFA2 card, returns true if successful,
-otherwise returns false
------------------------------------------------------------------*/
-static bool _EFA2_startUp(void)
-{
- _EFA2_global_unlock();
- return (_EFA2_nand_id() == EFA2_NAND_ID);
-}
-
-/*-----------------------------------------------------------------
-the actual interface structure
------------------------------------------------------------------*/
-const IO_INTERFACE _io_efa2 = {
- DEVICE_TYPE_EFA2,
- FEATURE_MEDIUM_CANREAD | FEATURE_SLOT_GBA,
- (FN_MEDIUM_STARTUP)&_EFA2_startUp,
- (FN_MEDIUM_ISINSERTED)&_EFA2_isInserted,
- (FN_MEDIUM_READSECTORS)&_EFA2_readSectors,
- (FN_MEDIUM_WRITESECTORS)&_EFA2_writeSectors,
- (FN_MEDIUM_CLEARSTATUS)&_EFA2_clearStatus,
- (FN_MEDIUM_SHUTDOWN)&_EFA2_shutdown
-};
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.h
deleted file mode 100644
index d3a5e29c31..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- io_efa2.h by CyteX
-
- Based on io_mpfc.h by chishm (Michael Chisholm)
-
- Hardware Routines for reading the NAND flash located on
- EFA2 flash carts
-
- Used with permission from Cytex.
-*/
-
-#ifndef IO_EFA2_H
-#define IO_EFA2_H
-
-// 'EFA2'
-#define DEVICE_TYPE_EFA2 0x32414645
-
-#include "disc_io.h"
-
-// export interface
-extern const IO_INTERFACE _io_efa2;
-
-#endif // define IO_EFA2_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.c
deleted file mode 100644
index c888db0a0a..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- io_fcsr.c based on
-
- compact_flash.c
- By chishm (Michael Chisholm)
-
- Hardware Routines for using a GBA Flash Cart and SRAM as a
- block device.
-
- The file system must be 512 byte aligned, in cart address space.
- SRAM is supported.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "io_fcsr.h"
-
-#include <string.h>
-
-//---------------------------------------------------------------
-// DMA
-#ifdef _IO_USE_DMA
- #ifndef NDS
- #include "gba_dma.h"
- #else
- #include <nds/dma.h>
- #ifdef ARM9
- #include <nds/arm9/cache.h>
- #endif
- #endif
-#endif
-
-#ifdef NDS
- #define SRAM_START 0x0A000000
-#else
- #define SRAM_START 0x0E000000
-#endif
-
-#define NO_SRAM 0xFFFFFFFF
-
-#define FCSR 0x52534346
-const char _FCSR_LabelString[] = " Chishm FAT";
-
-u8* _FCSR_FileSysPointer = 0;
-u8* _FCSR_SramSectorPointer[4] = {0,0,0,0};
-u32 _FCSR_SramSectorStart[4] = {0,0,0,0};
-u32 _FCSR_SramSectorEnd[4] = {0,0,0,0};
-
-/*-----------------------------------------------------------------
-_FCSR_isInserted
-Is a GBA Flash Cart with a valid file system inserted?
-bool return OUT: true if a GBA FC card is inserted
------------------------------------------------------------------*/
-static bool _FCSR_isInserted (void)
-{
- bool flagFoundFileSys = false;
-
- u32* fileSysPointer = (u32*)0x08000100; // Start at beginning of cart address space, offset by expected location of string
-
- // Search for file system
- while ((fileSysPointer < (u32*)0x0A000000) && !flagFoundFileSys) // Only search while not at end of cart address space
- {
- while ((*fileSysPointer != FCSR) && (fileSysPointer < (u32*)0x0A000000))
- fileSysPointer += 0x40;
- if ((strncmp(_FCSR_LabelString, (char*)(fileSysPointer + 1), 12) == 0) && (fileSysPointer < (u32*)0x0A000000))
- {
- flagFoundFileSys = true;
- } else {
- fileSysPointer += 0x80;
- }
- }
-
- return flagFoundFileSys;
-}
-
-
-/*-----------------------------------------------------------------
-_FCSR_clearStatus
-Finish any pending operations
-bool return OUT: always true for GBA FC
------------------------------------------------------------------*/
-static bool _FCSR_clearStatus (void)
-{
- return true;
-}
-
-
-/*-----------------------------------------------------------------
-_FCSR_readSectors
-Read 512 byte sector numbered "sector" into "buffer"
-u32 sector IN: address of first 512 byte sector on Flash Cart to read
-u32 numSectors IN: number of 512 byte sectors to read,
- 1 to 256 sectors can be read
-void* buffer OUT: pointer to 512 byte buffer to store data in
-bool return OUT: true if successful
------------------------------------------------------------------*/
-static bool _FCSR_readSectors (u32 sector, u32 numSectors, void* buffer)
-{
- int i;
- bool flagSramSector = false;
- int readLength = numSectors * BYTES_PER_READ;
- u8* src;
- u8* dst;
-
- // Find which region this read is in
- for (i = 0; (i < 4) && !flagSramSector; i++)
- {
- if ((sector >= _FCSR_SramSectorStart[i]) && (sector < _FCSR_SramSectorEnd[i]))
- {
- flagSramSector = true;
- break;
- }
- }
-
- // Make sure read will be completely in SRAM range if it is partially there
- if ( flagSramSector && ((sector + numSectors) > _FCSR_SramSectorEnd[i]))
- return false;
-
- // Copy data to buffer
- if (flagSramSector)
- {
- src = _FCSR_SramSectorPointer[i] + (sector - _FCSR_SramSectorStart[i]) * BYTES_PER_READ;
- } else {
- src = _FCSR_FileSysPointer + sector * BYTES_PER_READ;
- }
- dst = (u8*)buffer;
-
- if (flagSramSector)
- {
- while (readLength--)
- {
- *dst++ = *src++;
- }
- } else { // Reading from Cart ROM
-
-#ifdef _IO_USE_DMA
- #ifdef NDS
- #ifdef ARM9
- DC_FlushRange( buffer, readLength);
- #endif // ARM9
- DMA3_SRC = (u32)src;
- DMA3_DEST = (u32)buffer;
- DMA3_CR = (readLength >> 1) | DMA_COPY_HALFWORDS;
- #else // ! NDS
- DMA3COPY ( src, buffer, (readLength >> 1) | DMA16 | DMA_ENABLE);
- #endif // NDS
-#else // !_IO_USE_DMA
- memcpy (buffer, src, readLength);
-#endif // _IO_USE_DMA
-
- } // if (flagSramSector)
-
- return true;
-}
-
-/*-----------------------------------------------------------------
-_FCSR_writeSectors
-Write 512 byte sector numbered "sector" from "buffer"
-u32 sector IN: address of 512 byte sector on Flash Cart to read
-u32 numSectors IN: number of 512 byte sectors to read,
- 1 to 256 sectors can be read
-void* buffer IN: pointer to 512 byte buffer to read data from
-bool return OUT: true if successful
------------------------------------------------------------------*/
-static bool _FCSR_writeSectors (u32 sector, u8 numSectors, void* buffer)
-{
- int i;
- bool flagSramSector = false;
- u32 writeLength = numSectors * BYTES_PER_READ;
- u8* src = (u8*) buffer;
- u8* dst;
-
- // Find which region this sector belongs in
- for (i = 0; (i < 4) && !flagSramSector; i++)
- {
- if ((sector >= _FCSR_SramSectorStart[i]) && (sector < _FCSR_SramSectorEnd[i]))
- {
- flagSramSector = true;
- break;
- }
- }
-
- if (!flagSramSector)
- return false;
-
- // Entire write must be within an SRAM region
- if ((sector + numSectors) > _FCSR_SramSectorEnd[i])
- return false;
-
- // Copy data to SRAM
- dst = _FCSR_SramSectorPointer[i] + (sector - _FCSR_SramSectorStart[i]) * BYTES_PER_READ;
- while (writeLength--)
- {
- *dst++ = *src++;
- }
-
- return true;
-}
-
-/*-----------------------------------------------------------------
-_FCSR_shutdown
-unload the Flash Cart interface
------------------------------------------------------------------*/
-static bool _FCSR_shutdown(void)
-{
- int i;
- if (_FCSR_clearStatus() == false)
- return false;
-
- _FCSR_FileSysPointer = 0;
-
- for (i=0; i < 4; i++)
- {
- _FCSR_SramSectorPointer[i] = 0;
- _FCSR_SramSectorStart[i] = 0;
- _FCSR_SramSectorEnd[i] = 0;
- }
- return true;
-}
-
-/*-----------------------------------------------------------------
-_FCSR_startUp
-initializes the Flash Cart interface, returns true if successful,
-otherwise returns false
------------------------------------------------------------------*/
-static bool _FCSR_startUp(void)
-{
- bool flagFoundFileSys = false;
- int i;
- int SramRegionSize[4];
- u8* srcByte;
- u8* destByte;
-
- u32* fileSysPointer = (u32*)0x08000100; // Start at beginning of cart address space, offset by expected location of string
-
- // Search for file system
- while ((fileSysPointer < (u32*)0x0A000000) && !flagFoundFileSys) // Only search while not at end of cart address space
- {
- while ((*fileSysPointer != FCSR) && (fileSysPointer < (u32*)0x0A000000))
- fileSysPointer += 0x40;
- if ((strncmp(_FCSR_LabelString, (char*)(fileSysPointer + 1), 12) == 0) && (fileSysPointer < (u32*)0x0A000000))
- {
- flagFoundFileSys = true;
- } else {
- fileSysPointer += 0x80;
- }
- }
-
- if (!flagFoundFileSys)
- return false;
-
- // Flash cart file system pointer has been found
- _FCSR_FileSysPointer = (u8*)(fileSysPointer - 0x40);
-
- // Get SRAM sector regions from header block
- for (i = 0; i < 4; i++)
- {
- _FCSR_SramSectorStart[i] = fileSysPointer[i+4];
- SramRegionSize[i] = fileSysPointer[i+8];
- _FCSR_SramSectorEnd[i] = _FCSR_SramSectorStart[i] + SramRegionSize[i];
- }
-
- // Calculate SRAM region pointers
- _FCSR_SramSectorPointer[0] = (u8*)(SRAM_START + 4);
- for (i = 1; i < 4; i++)
- {
- _FCSR_SramSectorPointer[i] = _FCSR_SramSectorPointer[i-1] + (SramRegionSize[i-1] * BYTES_PER_READ);
- }
-
- // Initialise SRAM with overlay if it hasn't been done so
- if ( (*((u8*)SRAM_START) != 'F') || (*((u8*)(SRAM_START+1)) != 'C') || (*((u8*)(SRAM_START+2)) != 'S') || (*((u8*)(SRAM_START+3)) != 'R') )
- {
- *((u8*)SRAM_START) = 'F';
- *((u8*)(SRAM_START+1)) = 'C';
- *((u8*)(SRAM_START+2)) = 'S';
- *((u8*)(SRAM_START+3)) = 'R';
-
- for (i = 0; i < 4; i++)
- {
- srcByte = _FCSR_FileSysPointer + (_FCSR_SramSectorStart[i] * BYTES_PER_READ);
- destByte = _FCSR_SramSectorPointer[i];
- while (srcByte < _FCSR_FileSysPointer + (_FCSR_SramSectorEnd[i] * BYTES_PER_READ) )
- *destByte++ = *srcByte++;
- }
- }
-
- // Get SRAM sector regions from header block
- for (i = 0; i < 4; i++)
- {
- if (SramRegionSize[i] == 0)
- {
- _FCSR_SramSectorStart[i] = NO_SRAM;
- _FCSR_SramSectorEnd[i] = NO_SRAM;
- }
- }
-
- return true;
-}
-
-/*-----------------------------------------------------------------
-the actual interface structure
------------------------------------------------------------------*/
-const IO_INTERFACE _io_fcsr = {
- DEVICE_TYPE_FCSR, // 'FCSR'
- FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_SLOT_GBA,
- (FN_MEDIUM_STARTUP)&_FCSR_startUp,
- (FN_MEDIUM_ISINSERTED)&_FCSR_isInserted,
- (FN_MEDIUM_READSECTORS)&_FCSR_readSectors,
- (FN_MEDIUM_WRITESECTORS)&_FCSR_writeSectors,
- (FN_MEDIUM_CLEARSTATUS)&_FCSR_clearStatus,
- (FN_MEDIUM_SHUTDOWN)&_FCSR_shutdown
-} ;
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.h
deleted file mode 100644
index 19b2537960..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- io_fcsr.h
-
- Hardware Routines for using a GBA Flash Cart with SRAM
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef IO_FCSR_H
-#define IO_FCSR_H
-
-// 'FCSR'
-#define DEVICE_TYPE_FCSR 0x52534346
-
-#include "disc_io.h"
-
-// export interface
-extern const IO_INTERFACE _io_fcsr ;
-
-#endif // define IO_FCSR_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3_common.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3_common.c
deleted file mode 100644
index 9c8280c808..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3_common.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- io_m3_common.c
-
- Routines common to all version of the M3
-
- Some code based on M3 SD drivers supplied by M3Adapter.
- Some code written by SaTa may have been unknowingly used.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "io_m3_common.h"
-
-static u16 _M3_readHalfword (u32 addr) {
- return *((vu16*)addr);
-}
-
-void _M3_changeMode (u32 mode) {
- _M3_readHalfword (0x08e00002);
- _M3_readHalfword (0x0800000e);
- _M3_readHalfword (0x08801ffc);
- _M3_readHalfword (0x0800104a);
- _M3_readHalfword (0x08800612);
- _M3_readHalfword (0x08000000);
- _M3_readHalfword (0x08801b66);
- _M3_readHalfword (0x08000000 + (mode << 1));
- _M3_readHalfword (0x0800080e);
- _M3_readHalfword (0x08000000);
-
- if ((mode & 0x0f) != 4) {
- _M3_readHalfword (0x09000000);
- } else {
- _M3_readHalfword (0x080001e4);
- _M3_readHalfword (0x080001e4);
- _M3_readHalfword (0x08000188);
- _M3_readHalfword (0x08000188);
- }
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3_common.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3_common.h
deleted file mode 100644
index 6d0c669783..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3_common.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- io_m3_common.h
-
- Routines common to all version of the M3
-
- Some code based on M3 SD drivers supplied by M3Adapter.
- Some code written by SaTa may have been unknowingly used.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef IO_M3_COMMON_H
-#define IO_M3_COMMON_H
-
-#include "disc_io.h"
-
-// Values for changing mode
-#define M3_MODE_ROM 0x00400004
-#define M3_MODE_MEDIA 0x00400003
-
-extern void _M3_changeMode (u32 mode);
-
-#endif // IO_M3_COMMON_H
-
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.c
deleted file mode 100644
index 2db8eec894..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- io_m3cf.c based on
-
- compact_flash.c
- By chishm (Michael Chisholm)
-
- Hardware Routines for reading a compact flash card
- using the M3 Perfect CF Adapter
-
- CF routines modified with help from Darkfader
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "io_m3cf.h"
-#include "io_m3_common.h"
-#include "io_cf_common.h"
-
-//---------------------------------------------------------------
-// DMA
-#ifdef _IO_USE_DMA
- #ifndef NDS
- #include "gba_dma.h"
- #else
- #include <nds/dma.h>
- #ifdef ARM9
- #include <nds/arm9/cache.h>
- #endif
- #endif
-#endif
-
-//---------------------------------------------------------------
-// M3 CF Addresses
-#define REG_M3CF_STS ((vu16*)0x080C0000) // Status of the CF Card / Device control
-#define REG_M3CF_CMD ((vu16*)0x088E0000) // Commands sent to control chip and status return
-#define REG_M3CF_ERR ((vu16*)0x08820000) // Errors / Features
-
-#define REG_M3CF_SEC ((vu16*)0x08840000) // Number of sector to transfer
-#define REG_M3CF_LBA1 ((vu16*)0x08860000) // 1st byte of sector address
-#define REG_M3CF_LBA2 ((vu16*)0x08880000) // 2nd byte of sector address
-#define REG_M3CF_LBA3 ((vu16*)0x088A0000) // 3rd byte of sector address
-#define REG_M3CF_LBA4 ((vu16*)0x088C0000) // last nibble of sector address | 0xE0
-
-#define REG_M3CF_DATA ((vu16*)0x08800000) // Pointer to buffer of CF data transered from card
-
-static const CF_REGISTERS _M3CF_Registers = {
- REG_M3CF_DATA,
- REG_M3CF_STS,
- REG_M3CF_CMD,
- REG_M3CF_ERR,
- REG_M3CF_SEC,
- REG_M3CF_LBA1,
- REG_M3CF_LBA2,
- REG_M3CF_LBA3,
- REG_M3CF_LBA4
-};
-
-
-static bool _M3CF_startup(void) {
- _M3_changeMode (M3_MODE_MEDIA);
- return _CF_startup (&_M3CF_Registers);
-}
-
-
-const IO_INTERFACE _io_m3cf = {
- DEVICE_TYPE_M3CF,
- FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_SLOT_GBA,
- (FN_MEDIUM_STARTUP)&_M3CF_startup,
- (FN_MEDIUM_ISINSERTED)&_CF_isInserted,
- (FN_MEDIUM_READSECTORS)&_CF_readSectors,
- (FN_MEDIUM_WRITESECTORS)&_CF_writeSectors,
- (FN_MEDIUM_CLEARSTATUS)&_CF_clearStatus,
- (FN_MEDIUM_SHUTDOWN)&_CF_shutdown
-} ;
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.h
deleted file mode 100644
index c72da0b4a2..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- io_m3cf.h
-
- Hardware Routines for reading a compact flash card
- using the M3 CF
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef IO_M3CF_H
-#define IO_M3CF_H
-
-// 'M3CF'
-#define DEVICE_TYPE_M3CF 0x4643334D
-
-#include "disc_io.h"
-
-// export interface
-extern const IO_INTERFACE _io_m3cf ;
-
-#endif // define IO_M3CF_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.c
deleted file mode 100644
index b5b3173a9d..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- io_m3sd.c
-
- Hardware Routines for reading a Secure Digital card
- using the M3 SD
-
- Some code based on M3 SD drivers supplied by M3Adapter.
- Some code written by SaTa may have been unknowingly used.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-25 - Chishm
- * Improved startup function that doesn't delay hundreds of seconds
- before reporting no card inserted.
- * Fixed writeData function to timeout on error
- * writeSectors function now wait until the card is ready before continuing with a transfer
-
- 2006-08-05 - Chishm
- * Tries multiple times to get a Relative Card Address at startup
-
- 2006-08-07 - Chishm
- * Moved the SD initialization to a common function
-*/
-
-#include "io_m3sd.h"
-#include "io_sd_common.h"
-#include "io_m3_common.h"
-
-//---------------------------------------------------------------
-// M3SD register addresses
-
-#define REG_M3SD_DIR (*(vu16*)0x08800000) // direction control register
-#define REG_M3SD_DAT (*(vu16*)0x09000000) // SD data line, 8 bits at a time
-#define REG_M3SD_CMD (*(vu16*)0x09200000) // SD command byte
-#define REG_M3SD_ARGH (*(vu16*)0x09400000) // SD command argument, high halfword
-#define REG_M3SD_ARGL (*(vu16*)0x09600000) // SD command argument, low halfword
-#define REG_M3SD_STS (*(vu16*)0x09800000) // command and status register
-
-//---------------------------------------------------------------
-// Send / receive timeouts, to stop infinite wait loops
-#define NUM_STARTUP_CLOCKS 100 // Number of empty (0xFF when sending) bytes to send/receive to/from the card
-#define TRANSMIT_TIMEOUT 20000 // Time to wait for the M3 to respond to transmit or receive requests
-#define RESPONSE_TIMEOUT 256 // Number of clocks sent to the SD card before giving up
-#define WRITE_TIMEOUT 3000 // Time to wait for the card to finish writing
-
-//---------------------------------------------------------------
-// Variables required for tracking SD state
-static u32 _M3SD_relativeCardAddress = 0; // Preshifted Relative Card Address
-
-//---------------------------------------------------------------
-// Internal M3 SD functions
-
-static inline void _M3SD_unlock (void) {
- _M3_changeMode (M3_MODE_MEDIA);
-}
-
-static inline bool _M3SD_waitOnBusy (void) {
- int i = 0;
- while ( (REG_M3SD_STS & 0x01) == 0x00) {
- i++;
- if (i >= TRANSMIT_TIMEOUT) {
- return false;
- }
- }
- return true;
-}
-
-static inline bool _M3SD_waitForDataReady (void) {
- int i = 0;
- while ( (REG_M3SD_STS & 0x40) == 0x00) {
- i++;
- if (i >= TRANSMIT_TIMEOUT) {
- return false;
- }
- }
- return true;
-}
-
-
-static bool _M3SD_sendCommand (u16 command, u32 argument) {
- REG_M3SD_STS = 0x8;
- REG_M3SD_CMD = 0x40 + command; // Include the start bit
- REG_M3SD_ARGH = argument >> 16;
- REG_M3SD_ARGL = argument;
- // The CRC7 of the command is calculated by the M3
-
- REG_M3SD_DIR=0x29;
- if (!_M3SD_waitOnBusy()) {
- REG_M3SD_DIR=0x09;
- return false;
- }
- REG_M3SD_DIR=0x09;
- return true;
-}
-
-static bool _M3SD_sendByte (u8 byte) {
- int i = 0;
- REG_M3SD_DAT = byte;
- REG_M3SD_DIR = 0x03;
- REG_M3SD_STS = 0x01;
- while ((REG_M3SD_STS & 0x04) == 0) {
- i++;
- if (i >= TRANSMIT_TIMEOUT) {
- return false;
- }
- }
- return true;
-}
-
-static u8 _M3SD_getByte (void) {
- int i;
- // Request 8 bits of data from the SD's CMD pin
- REG_M3SD_DIR = 0x02;
- REG_M3SD_STS = 0x02;
- // Wait for the data to be ready
- i = 0;
- while ((REG_M3SD_STS & 0x08) == 0) {
- i++;
- if (i >= TRANSMIT_TIMEOUT) {
- // Return an empty byte if a timeout occurs
- return 0xFF;
- }
- }
- i = 0;
- while ((REG_M3SD_STS & 0x08) != 0) {
- i++;
- if (i >= TRANSMIT_TIMEOUT) {
- // Return an empty byte if a timeout occurs
- return 0xFF;
- }
- }
- // Return the data
- return (REG_M3SD_DAT & 0xff);
-}
-
-// Returns the response from the SD card to a previous command.
-static bool _M3SD_getResponse (u8* dest, u32 length) {
- u32 i;
- u8 dataByte;
- int shiftAmount;
-
- // Wait for the card to be non-busy
- for (i = 0; i < RESPONSE_TIMEOUT; i++) {
- dataByte = _M3SD_getByte();
- if (dataByte != SD_CARD_BUSY) {
- break;
- }
- }
-
- if (dest == NULL) {
- return true;
- }
-
- // Still busy after the timeout has passed
- if (dataByte == 0xff) {
- return false;
- }
-
- // Read response into buffer
- for ( i = 0; i < length; i++) {
- dest[i] = dataByte;
- dataByte = _M3SD_getByte();
- }
- // dataByte will contain the last piece of the response
-
- // Send 16 more clocks, 8 more than the delay required between a response and the next command
- i = _M3SD_getByte();
- i = _M3SD_getByte();
-
- // Shift response so that the bytes are correctly aligned
- // The register may not contain properly aligned data
- for (shiftAmount = 0; ((dest[0] << shiftAmount) & 0x80) != 0x00; shiftAmount++) {
- if (shiftAmount >= 7) {
- return false;
- }
- }
-
- for (i = 0; i < length - 1; i++) {
- dest[i] = (dest[i] << shiftAmount) | (dest[i+1] >> (8-shiftAmount));
- }
- // Get the last piece of the response from dataByte
- dest[i] = (dest[i] << shiftAmount) | (dataByte >> (8-shiftAmount));
-
- return true;
-}
-
-
-static inline bool _M3SD_getResponse_R1 (u8* dest) {
- return _M3SD_getResponse (dest, 6);
-}
-
-static inline bool _M3SD_getResponse_R1b (u8* dest) {
- return _M3SD_getResponse (dest, 6);
-}
-
-static inline bool _M3SD_getResponse_R2 (u8* dest) {
- return _M3SD_getResponse (dest, 17);
-}
-
-static inline bool _M3SD_getResponse_R3 (u8* dest) {
- return _M3SD_getResponse (dest, 6);
-}
-
-static inline bool _M3SD_getResponse_R6 (u8* dest) {
- return _M3SD_getResponse (dest, 6);
-}
-
-static void _M3SD_sendClocks (u32 numClocks) {
- while (numClocks--) {
- _M3SD_sendByte(0xff);
- }
-}
-
-static void _M3SD_getClocks (u32 numClocks) {
- while (numClocks--) {
- _M3SD_getByte();
- }
-}
-
-static bool _M3SD_cmd_6byte_response (u8* responseBuffer, u8 command, u32 data) {
- _M3SD_sendCommand (command, data);
- return _M3SD_getResponse (responseBuffer, 6);
-}
-
-static bool _M3SD_cmd_17byte_response (u8* responseBuffer, u8 command, u32 data) {
- _M3SD_sendCommand (command, data);
- return _M3SD_getResponse (responseBuffer, 17);
-}
-
-static bool _M3SD_initCard (void) {
- // Give the card time to stabilise
- _M3SD_sendClocks (NUM_STARTUP_CLOCKS);
-
- // Reset the card
- if (!_M3SD_sendCommand (GO_IDLE_STATE, 0)) {
- return false;
- }
-
- _M3SD_getClocks (NUM_STARTUP_CLOCKS);
-
- // Card is now reset, including it's address
- _M3SD_relativeCardAddress = 0;
-
- // Init the card
- return _SD_InitCard (_M3SD_cmd_6byte_response,
- _M3SD_cmd_17byte_response,
- true,
- &_M3SD_relativeCardAddress);
-}
-
-static bool _M3SD_readData (void* buffer) {
- u32 i;
- u8* buff_u8 = (u8*)buffer;
- u16* buff = (u16*)buffer;
- u16 temp;
-
- REG_M3SD_DIR = 0x49;
- if (!_M3SD_waitForDataReady()) {
- REG_M3SD_DIR = 0x09;
- return false;
- }
- REG_M3SD_DIR = 0x09;
-
- REG_M3SD_DIR = 0x8;
- REG_M3SD_STS = 0x4;
-
- i = REG_M3SD_DIR;
- // Read data
- i=256;
- if ((u32)buff_u8 & 0x01) {
- while(i--)
- {
- temp = REG_M3SD_DIR;
- *buff_u8++ = temp & 0xFF;
- *buff_u8++ = temp >> 8;
- }
- } else {
- while(i--)
- *buff++ = REG_M3SD_DIR;
- }
- // Read end checksum
- i = REG_M3SD_DIR + REG_M3SD_DIR + REG_M3SD_DIR + REG_M3SD_DIR;
-
- return true;
-}
-
-static void _M3SD_clkout (void) {
- REG_M3SD_DIR = 0x4;
- REG_M3SD_DIR = 0xc;
-/* __asm volatile (
- "ldr r1, =0x08800000 \n"
- "mov r0, #0x04 \n"
- "strh r0, [r1] \n"
- "mov r0, r0 \n"
- "mov r0, r0 \n"
- "mov r0, #0x0c \n"
- "strh r0, [r1] \n"
- : // Outputs
- : // Inputs
- : "r0", "r1" // Clobber list
- );*/
-}
-
-static void _M3SD_clkin (void) {
- REG_M3SD_DIR = 0x0;
- REG_M3SD_DIR = 0x8;
-/* __asm volatile (
- "ldr r1, =0x08800000 \n"
- "mov r0, #0x00 \n"
- "strh r0, [r1] \n"
- "mov r0, r0 \n"
- "mov r0, r0 \n"
- "mov r0, #0x08 \n"
- "strh r0, [r1] \n"
- : // Outputs
- : // Inputs
- : "r0", "r1" // Clobber list
- );*/
-}
-
-static bool _M3SD_writeData (u8* data, u8* crc) {
- int i;
- u8 temp;
-
- do {
- _M3SD_clkin();
- } while ((REG_M3SD_DAT & 0x100) == 0);
-
- REG_M3SD_DAT = 0; // Start bit
-
- _M3SD_clkout();
-
- for (i = 0; i < BYTES_PER_READ; i++) {
- temp = (*data++);
- REG_M3SD_DAT = temp >> 4;
- _M3SD_clkout();
- REG_M3SD_DAT = temp;
- _M3SD_clkout();
- }
-
- if (crc != NULL) {
- for (i = 0; i < 8; i++) {
- temp = (*crc++);
- REG_M3SD_DAT = temp >> 4;
- _M3SD_clkout();
- REG_M3SD_DAT = temp;
- _M3SD_clkout();
- }
- }
-
- i = 32;
- while (i--) {
- temp += 2; // a NOP to stop the compiler optimising out the loop
- }
-
- for (i = 0; i < 32; i++) {
- REG_M3SD_DAT = 0xff;
- _M3SD_clkout();
- }
-
- do {
- _M3SD_clkin();
- } while ((REG_M3SD_DAT & 0x100) == 0);
-
- return true;
-}
-
-//---------------------------------------------------------------
-// Functions needed for the external interface
-
-static bool _M3SD_startUp (void) {
- _M3SD_unlock();
- return _M3SD_initCard();
-}
-
-static bool _M3SD_isInserted (void) {
- u8 responseBuffer [6];
- // Make sure the card receives the command
- if (!_M3SD_sendCommand (SEND_STATUS, 0)) {
- return false;
- }
- // Make sure the card responds
- if (!_M3SD_getResponse_R1 (responseBuffer)) {
- return false;
- }
- // Make sure the card responded correctly
- if (responseBuffer[0] != SEND_STATUS) {
- return false;
- }
- return true;
-}
-
-static bool _M3SD_readSectors (u32 sector, u32 numSectors, void* buffer) {
- u32 i;
- u8* dest = (u8*) buffer;
- u8 responseBuffer[6];
-
- if (numSectors == 1) {
- // If it's only reading one sector, use the (slightly faster) READ_SINGLE_BLOCK
- if (!_M3SD_sendCommand (READ_SINGLE_BLOCK, sector * BYTES_PER_READ)) {
- return false;
- }
-
- if (!_M3SD_readData (buffer)) {
- return false;
- }
-
- } else {
- // Stream the required number of sectors from the card
- if (!_M3SD_sendCommand (READ_MULTIPLE_BLOCK, sector * BYTES_PER_READ)) {
- return false;
- }
-
- for(i=0; i < numSectors; i++, dest+=BYTES_PER_READ) {
- if (!_M3SD_readData(dest)) {
- return false;
- }
- REG_M3SD_STS = 0x8;
- }
-
- // Stop the streaming
- _M3SD_sendCommand (STOP_TRANSMISSION, 0);
- _M3SD_getResponse_R1b (responseBuffer);
- }
-
- return true;
-}
-
-static bool _M3SD_writeSectors (u32 sector, u32 numSectors, const void* buffer) {
- u8 crc[8];
- u8 responseBuffer[6];
- u32 offset = sector * BYTES_PER_READ;
- u8* data = (u8*) buffer;
- int i;
- // Precalculate the data CRC
- _SD_CRC16 ( data, BYTES_PER_READ, crc);
-
- while (numSectors--) {
- // Send a single sector write command
- _M3SD_sendCommand (WRITE_BLOCK, offset);
- if (!_M3SD_getResponse_R1 (responseBuffer)) {
- return false;
- }
-
- REG_M3SD_DIR = 0x4;
- REG_M3SD_STS = 0x0;
-
- // Send the data
- if (! _M3SD_writeData( data, crc)) {
- return false;
- }
-
- if (numSectors > 0) {
- offset += BYTES_PER_READ;
- data += BYTES_PER_READ;
- // Calculate the next CRC while waiting for the card to finish writing
- _SD_CRC16 ( data, BYTES_PER_READ, crc);
- }
-
- // Wait for the card to be ready for the next transfer
- i = WRITE_TIMEOUT;
- responseBuffer[3] = 0;
- do {
- _M3SD_sendCommand (SEND_STATUS, _M3SD_relativeCardAddress);
- _M3SD_getResponse_R1 (responseBuffer);
- i--;
- if (i <= 0) {
- return false;
- }
- } while (((responseBuffer[3] & 0x1f) != ((SD_STATE_TRAN << 1) | READY_FOR_DATA)));
- }
-
- return true;
-
-}
-
-static bool _M3SD_clearStatus (void) {
- return _M3SD_initCard ();
-}
-
-static bool _M3SD_shutdown (void) {
- _M3_changeMode (M3_MODE_ROM);
- return true;
-}
-
-const IO_INTERFACE _io_m3sd = {
- DEVICE_TYPE_M3SD,
- FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_SLOT_GBA,
- (FN_MEDIUM_STARTUP)&_M3SD_startUp,
- (FN_MEDIUM_ISINSERTED)&_M3SD_isInserted,
- (FN_MEDIUM_READSECTORS)&_M3SD_readSectors,
- (FN_MEDIUM_WRITESECTORS)&_M3SD_writeSectors,
- (FN_MEDIUM_CLEARSTATUS)&_M3SD_clearStatus,
- (FN_MEDIUM_SHUTDOWN)&_M3SD_shutdown
-} ;
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.h
deleted file mode 100644
index 0e4d32b540..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- io_m3sd.h
-
- Hardware Routines for reading a Secure Digital card
- using the M3 SD
-
- Some code based on M3 SD drivers supplied by M3Adapter.
- Some code written by SaTa may have been unknowingly used.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef IO_M3SD_H
-#define IO_M3SD_H
-
-// 'M3SD'
-#define DEVICE_TYPE_M3SD 0x4453334D
-
-#include "disc_io.h"
-
-// export interface
-extern const IO_INTERFACE _io_m3sd ;
-
-#endif // define IO_M3SD_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.c
deleted file mode 100644
index 3dcafc193e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- io_mpcf.c based on
-
- compact_flash.c
- By chishm (Michael Chisholm)
-
- Hardware Routines for reading a compact flash card
- using the GBA Movie Player
-
- CF routines modified with help from Darkfader
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "io_mpcf.h"
-#include "io_cf_common.h"
-
-//---------------------------------------------------------------
-// DMA
-#ifdef _IO_USE_DMA
- #ifndef NDS
- #include "gba_dma.h"
- #else
- #include <nds/dma.h>
- #ifdef ARM9
- #include <nds/arm9/cache.h>
- #endif
- #endif
-#endif
-
-//---------------------------------------------------------------
-// GBAMP CF Addresses
-#define REG_MPCF_STS ((vu16*)0x098C0000) // Status of the CF Card / Device control
-#define REG_MPCF_CMD ((vu16*)0x090E0000) // Commands sent to control chip and status return
-#define REG_MPCF_ERR ((vu16*)0x09020000) // Errors / Features
-
-#define REG_MPCF_SEC ((vu16*)0x09040000) // Number of sector to transfer
-#define REG_MPCF_LBA1 ((vu16*)0x09060000) // 1st byte of sector address
-#define REG_MPCF_LBA2 ((vu16*)0x09080000) // 2nd byte of sector address
-#define REG_MPCF_LBA3 ((vu16*)0x090A0000) // 3rd byte of sector address
-#define REG_MPCF_LBA4 ((vu16*)0x090C0000) // last nibble of sector address | 0xE0
-
-#define REG_MPCF_DATA ((vu16*)0x09000000) // Pointer to buffer of CF data transered from card
-
-static const CF_REGISTERS _MPCF_Registers = {
- REG_MPCF_DATA,
- REG_MPCF_STS,
- REG_MPCF_CMD,
- REG_MPCF_ERR,
- REG_MPCF_SEC,
- REG_MPCF_LBA1,
- REG_MPCF_LBA2,
- REG_MPCF_LBA3,
- REG_MPCF_LBA4
-};
-
-/*-----------------------------------------------------------------
-_MPCF_startup
-initializes the CF interface, returns true if successful,
-otherwise returns false
------------------------------------------------------------------*/
-static bool _MPCF_startup(void) {
- return _CF_startup(&_MPCF_Registers);
-}
-
-/*-----------------------------------------------------------------
-the actual interface structure
------------------------------------------------------------------*/
-const IO_INTERFACE _io_mpcf = {
- DEVICE_TYPE_MPCF,
- FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_SLOT_GBA,
- (FN_MEDIUM_STARTUP)&_MPCF_startup,
- (FN_MEDIUM_ISINSERTED)&_CF_isInserted,
- (FN_MEDIUM_READSECTORS)&_CF_readSectors,
- (FN_MEDIUM_WRITESECTORS)&_CF_writeSectors,
- (FN_MEDIUM_CLEARSTATUS)&_CF_clearStatus,
- (FN_MEDIUM_SHUTDOWN)&_CF_shutdown
-} ;
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.h
deleted file mode 100644
index fc5770e18d..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- io_mpcf.h
-
- Hardware Routines for reading a compact flash card
- using the GBA Movie Player
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef IO_MPCF_H
-#define IO_MPCF_H
-
-// 'MPCF'
-#define DEVICE_TYPE_MPCF 0x4643504D
-
-#include "disc_io.h"
-
-// export interface
-extern const IO_INTERFACE _io_mpcf ;
-
-#endif // define IO_MPCF_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.c
deleted file mode 100644
index e394076e5c..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.c
+++ /dev/null
@@ -1,595 +0,0 @@
-/*
- io_njsd.c
-
- Hardware Routines for reading an SD card using
- a NinjaDS SD adapter.
-
- Original code supplied by NinjaMod
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-08-05 - Chishm
- * First release
-
- 2006-08-06 - Chishm
- * Removed unneeded _NJSD_writeRAM function
- * Removed casts for calls to cardWriteCommand
-
- 2006-08-07 - Chishm
- * Moved the SD initialization to a common function
-*/
-
-#include "io_njsd.h"
-
-#ifdef NDS
-
-#include <nds.h>
-#include <string.h>
-#include "io_sd_common.h"
-
-#define _NJSD_SYNC
-
-//---------------------------------------------------------------
-// Card communication speeds
-#define SD_CLK_167KHz 00
-#define SD_CLK_250KHz 01
-#define SD_CLK_5MHz 02
-#define SD_CLK_25MHz 03
-
-//---------------------------------------------------------------
-// Response types
-#define SD_RSP_48 0
-#define SD_RSP_136 1
-#define SD_RSP_DATA 2
-#define SD_RSP_STREAM 3
-
-//---------------------------------------------------------------
-// Send / receive timeouts, to stop infinite wait loops
-#define IRQ_TIMEOUT 1000000
-#define RESET_TIMEOUT 10000
-#define COMMAND_TIMEOUT 100000
-#define WRITE_TIMEOUT 3000 // Time to wait for the card to finish writing
-
-
-static const u8 _NJSD_read_cmd[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40};
-static const u8 _NJSD_read_end_cmd[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x41};
-
-static int _NJSD_speed = SD_CLK_5MHz; // Default speed;
-
-static u32 _NJSD_cardFlags;
-
-static u32 _NJSD_relativeCardAddress = 0;
-
-static inline bool _NJSD_waitIRQ(void) {
- int i = IRQ_TIMEOUT;
- while (!(REG_IF & 0x100000) && --i);
- REG_IF = 0x100000;
- if (i <= 0) {
- return false;
- } else {
- return true;
- }
-}
-
-static inline void _NJSD_writeCardCommand
- (u8 cmd0, u8 cmd1, u8 cmd2, u8 cmd3, u8 cmd4, u8 cmd5, u8 cmd6, u8 cmd7)
-{
- CARD_COMMAND[0] = cmd0;
- CARD_COMMAND[1] = cmd1;
- CARD_COMMAND[2] = cmd2;
- CARD_COMMAND[3] = cmd3;
- CARD_COMMAND[4] = cmd4;
- CARD_COMMAND[5] = cmd5;
- CARD_COMMAND[6] = cmd6;
- CARD_COMMAND[7] = cmd7;
-}
-
-static bool _NJSD_reset (void) {
- int i;
- CARD_CR1H = CARD_CR1_ENABLE;
- _NJSD_writeCardCommand (0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
- CARD_CR2 = 0xA0406000;
- i = RESET_TIMEOUT;
- while ((CARD_CR2 & CARD_BUSY) && --i);
- if (i <= 0) {
- return false;
- }
-
- return true;
-}
-
-static bool _NJSD_init (u32 flags) {
- _NJSD_cardFlags = flags;
-
- REG_IF = 0x100000; // Clear cart IRQ.
-
- irqDisable (IRQ_CARD_LINE);
-
- if (! _NJSD_reset() ) {
- return false;
- }
- return true;
-}
-
-static bool _NJSD_sendCMDR (int speed, u8 *rsp_buf, int type, u8 cmd, u32 param) {
- int i;
- u32 data;
-
-#ifdef _NJSD_SYNC
- u32 old_REG_IME;
- old_REG_IME = REG_IME;
- REG_IME = 0;
-#endif
-
- REG_IF = 0x100000;
-
- CARD_CR1H = CARD_CR1_ENABLE;
-
- if ((type & 3) < 2) {
- CARD_COMMAND[0] = 0xF0 | (speed << 2) | 1 | (type << 1);
- } else if ((type & 3) == 2) {
- CARD_COMMAND[0] = 0xE0 | (speed << 2) | 0 | (1 << 1);
- } else {
- CARD_COMMAND[0] = 0xF0 | (speed << 2) | 0 | (1 << 1);
- }
-
- CARD_COMMAND[1] = (type & 0x40) | ((( type >> 2) & 7) << 3);
- CARD_COMMAND[2] = 0x40 | cmd;
- CARD_COMMAND[3] = (param>>24) & 0xFF;
- CARD_COMMAND[4] = (param>>16) & 0xFF;
- CARD_COMMAND[5] = (param>>8) & 0xFF;
- CARD_COMMAND[6] = (param>>0) & 0xFF;
- CARD_COMMAND[7] = 0; // offset = 0
-
- if ((type & 3) < 2) {
- CARD_CR2 = _NJSD_cardFlags | 0x01000000;
-
- // wait for ninja DS to be done!
- if (!_NJSD_waitIRQ ()) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
-
- i = 0;
- do {
- // Read data if available
- if (CARD_CR2 & CARD_DATA_READY) {
- data=CARD_DATA_RD;
- if (rsp_buf != NULL) {
- if (i == 4) {
- rsp_buf[0] = (data>>0)&0xFF;
- rsp_buf[1] = (data>>8)&0xFF;
- rsp_buf[2] = (data>>16)&0xFF;
- rsp_buf[3] = (data>>24)&0xFF;
- } else if (i == 5) {
- rsp_buf[4] = (data>>0)&0xFF;
- rsp_buf[5] = (data>>8)&0xFF;
- }
- }
- i++;
- }
- } while (CARD_CR2 & CARD_BUSY);
- } else {
- CARD_CR2 = _NJSD_cardFlags;
- while (CARD_CR2 & CARD_BUSY);
-
- // wait for ninja DS to be done!
- if (!_NJSD_waitIRQ ()) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
- }
-
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return true;
-}
-
-static bool _NJSD_writeSector (u8 *buffer, u8 *crc_buf, u32 offset) {
- int i;
- u8 responseBuffer[6];
- u32 data;
-
-#ifdef _NJSD_SYNC
- u32 old_REG_IME;
- old_REG_IME = REG_IME;
- REG_IME = 0;
-#endif
-
- CARD_CR1H = CARD_CR1_ENABLE;
- _NJSD_writeCardCommand (0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
- CARD_CR2 = 0xA0406000;
- i = COMMAND_TIMEOUT;
- while ((CARD_CR2 & CARD_BUSY) && --i);
- if (i <= 0) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
-
- for (i = 0; i < 65; i++)
- {
- CARD_CR1H = CARD_CR1_ENABLE; // | CARD_CR1_IRQ;
- if (i < 64)
- {
- _NJSD_writeCardCommand (buffer[i*8+0], buffer[i*8+1], buffer[i*8+2], buffer[i*8+3],
- buffer[i*8+4], buffer[i*8+5], buffer[i*8+6], buffer[i*8+7]);
- } else {
- _NJSD_writeCardCommand (crc_buf[0], crc_buf[1], crc_buf[2], crc_buf[3],
- crc_buf[4], crc_buf[5], crc_buf[6], crc_buf[7]);
- }
- CARD_CR2 = 0xA7406000;
-
- do {
- // Read data if available
- if (CARD_CR2 & CARD_DATA_READY) {
- data=CARD_DATA_RD;
- }
- } while (CARD_CR2 & CARD_BUSY);
- }
-
- CARD_CR1H = CARD_CR1_ENABLE;
- _NJSD_writeCardCommand (0xF0 | (1 << 2) | 1, 0x80, 0x40 | WRITE_BLOCK, (u8)(offset>>24),
- (u8)(offset>>16), (u8)(offset>>8), (u8)(offset>>0), 0x00);
- CARD_CR2 = 0xA7406000;
-
- // wait for ninja DS to be done!
- if (!_NJSD_waitIRQ ()) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
-
- i = 0;
- do {
- // Read data if available
- if (CARD_CR2 & CARD_DATA_READY) {
- data = CARD_DATA_RD;
- if (i == 2) {
- responseBuffer[0] = (u8)(data>>0);
- responseBuffer[1] = (u8)(data>>8);
- responseBuffer[2] = (u8)(data>>16);
- responseBuffer[3] = (u8)(data>>24);
- } else if (i == 3) {
- responseBuffer[4] = (u8)(data>>0);
- responseBuffer[5] = (u8)(data>>8);
- }
- i++;
- }
- } while (CARD_CR2 & CARD_BUSY);
-
- i = WRITE_TIMEOUT;
- responseBuffer[3] = 0;
- do {
- _NJSD_sendCMDR (SD_CLK_167KHz, responseBuffer, SD_RSP_48, SEND_STATUS, _NJSD_relativeCardAddress);
- i--;
- if (i <= 0) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
- } while (((responseBuffer[3] & 0x1f) != ((SD_STATE_TRAN << 1) | READY_FOR_DATA)));
-
-
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
-
- return true;
-}
-
-static bool _NJSD_sendCLK (int speed, int count) {
- int i;
-
-#ifdef _NJSD_SYNC
- u32 old_REG_IME;
- old_REG_IME = REG_IME;
- REG_IME = 0;
-
- REG_IF = 0x100000;
-#endif
-
- //CARD_CR1H = CARD_CR1_ENABLE; // | CARD_CR1_IRQ;
- _NJSD_writeCardCommand (0xE0 | ((speed & 3) << 2), 0, (count - 1), 0, 0, 0, 0, 0);
-
- CARD_CR2 = _NJSD_cardFlags;
- i = COMMAND_TIMEOUT;
- while ((CARD_CR2 & CARD_BUSY) && --i);
- if (i <= 0) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
-
- // wait for ninja DS to be done!
- if (!_NJSD_waitIRQ ()) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
-
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return true;
-}
-
-static bool _NJSD_sendCMDN (int speed, u8 cmd, u32 param) {
- int i;
-
-#ifdef _NJSD_SYNC
- u32 old_REG_IME;
- old_REG_IME = REG_IME;
- REG_IME = 0;
-#endif
-
- REG_IF = 0x100000;
-
- CARD_CR1H = CARD_CR1_ENABLE; // | CARD_CR1_IRQ;
- _NJSD_writeCardCommand (0xF0 | ((speed & 3) << 2), 0x00, 0x40 | cmd, (param>>24) & 0xFF,
- (param>>16) & 0xFF, (param>>8) & 0xFF, (param>>0) & 0xFF, 0x00);
-
- CARD_CR2 = _NJSD_cardFlags;
- i = COMMAND_TIMEOUT;
- while ((CARD_CR2 & CARD_BUSY) && --i);
- if (i <= 0) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
-
- // wait for ninja DS to be done!
- if (!_NJSD_waitIRQ ()) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
-
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return true;
-}
-
-static bool _NJSD_cmd_6byte_response (u8* responseBuffer, u8 command, u32 data) {
- return _NJSD_sendCMDR (SD_CLK_167KHz, responseBuffer, SD_RSP_48, command, data);
-}
-
-static bool _NJSD_cmd_17byte_response (u8* responseBuffer, u8 command, u32 data) {
- return _NJSD_sendCMDR (SD_CLK_167KHz, responseBuffer, SD_RSP_136, command, data);
-}
-
-static bool _NJSD_cardInit (void) {
- // If the commands succeed the first time, assume they'll always succeed
- if (! _NJSD_sendCLK (SD_CLK_167KHz, 256) ) {
- return false;
- }
- if (! _NJSD_sendCMDN (SD_CLK_167KHz, GO_IDLE_STATE, 0) ) {
- return false;
- }
- _NJSD_sendCLK (SD_CLK_167KHz, 8);
-
- _NJSD_sendCLK (SD_CLK_167KHz, 256);
- _NJSD_sendCMDN (SD_CLK_167KHz, GO_IDLE_STATE, 0);
- _NJSD_sendCLK (SD_CLK_167KHz, 8);
-
- return _SD_InitCard (_NJSD_cmd_6byte_response,
- _NJSD_cmd_17byte_response,
- true,
- &_NJSD_relativeCardAddress);
-}
-
-
-static bool _NJSD_isInserted(void) {
- u8 responseBuffer [8];
- _NJSD_sendCMDR (SD_CLK_167KHz, responseBuffer, SD_RSP_48, SEND_STATUS, 0);
-
- // Make sure the card responded correctly
- if (responseBuffer[0] != SEND_STATUS) {
- return false;
- }
- return true;
-}
-
-static bool _NJSD_clearStatus (void) {
- return _NJSD_reset();
-}
-
-static bool _NJSD_shutdown(void) {
- return _NJSD_clearStatus();
-}
-
-static bool _NJSD_startup(void) {
- if (! _NJSD_init(0xA0406000) ) {
- return false;
- }
- if (! _NJSD_cardInit() ) {
- return false;
- }
- return true;
-}
-
-
-static bool _NJSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) {
- u8 crc[8];
- u32 offset = sector * BYTES_PER_READ;
- u8* data = (u8*) buffer;
-
- while (numSectors--) {
- _SD_CRC16 ( data, BYTES_PER_READ, crc);
-
- if (! _NJSD_writeSector (data, crc, offset)) {
- return false;
- }
- offset += BYTES_PER_READ;
- data += BYTES_PER_READ;
- }
- return true;
-}
-
-#ifdef _IO_ALLOW_UNALIGNED
-static bool _NJSD_readSectors (u32 sector, u32 numSectors, void* buffer) {
- u32 tmp[BYTES_PER_READ>>2];
- int i;
-
-#ifdef _NJSD_SYNC
- u32 old_REG_IME;
-#endif
-
- u8* tbuf = (u8*)buffer;
-
- if (numSectors == 0) {
- return false;
- }
-
-#ifdef _NJSD_SYNC
- old_REG_IME = REG_IME;
- REG_IME = 0;
-#endif
-
- if (numSectors > 1) {
- _NJSD_sendCMDR (_NJSD_speed, NULL, SD_RSP_DATA, READ_MULTIPLE_BLOCK, sector * BYTES_PER_READ);
- for (i = 0; i < numSectors - 2; i++) {
- if (((int)buffer & 0x03) != 0){
- cardPolledTransfer (0xA1406000, tmp, BYTES_PER_READ, _NJSD_read_cmd);
- memcpy (tbuf + i * BYTES_PER_READ, tmp, BYTES_PER_READ);
- } else {
- cardPolledTransfer (0xA1406000, (u32*)(tbuf + i * BYTES_PER_READ), BYTES_PER_READ, _NJSD_read_cmd);
- }
- if (!_NJSD_waitIRQ ()) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
- }
- if (((int)buffer & 0x03) != 0){
- cardPolledTransfer (0xA1406000, tmp, BYTES_PER_READ, _NJSD_read_end_cmd);
- memcpy (tbuf + (numSectors - 2) * BYTES_PER_READ, tmp, BYTES_PER_READ);
- } else {
- cardPolledTransfer (0xA1406000, (u32*)(tbuf + (numSectors - 2) * BYTES_PER_READ), BYTES_PER_READ, _NJSD_read_end_cmd);
- }
- if (!_NJSD_waitIRQ ()) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
-
- if (((int)buffer & 0x03) != 0){
- cardPolledTransfer (0xA1406000, tmp, BYTES_PER_READ, _NJSD_read_cmd);
- memcpy (tbuf + (numSectors - 1) * BYTES_PER_READ, tmp, BYTES_PER_READ);
- } else {
- cardPolledTransfer (0xA1406000, (u32*)(tbuf + (numSectors - 1) * BYTES_PER_READ), BYTES_PER_READ, _NJSD_read_cmd);
- }
- } else {
- _NJSD_sendCMDR (_NJSD_speed, NULL, SD_RSP_STREAM, READ_SINGLE_BLOCK, sector * BYTES_PER_READ);
- if (((int)buffer & 0x03) != 0){
- cardPolledTransfer (0xA1406000, tmp, BYTES_PER_READ, _NJSD_read_cmd);
- memcpy (tbuf, tmp, BYTES_PER_READ);
- } else {
- cardPolledTransfer (0xA1406000, (u32*)tbuf, BYTES_PER_READ, _NJSD_read_cmd);
- }
- }
-
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return true;
-}
-#else // not defined _IO_ALLOW_UNALIGNED
-bool _NJSD_readSectors (u32 sector, u32 numSectors, void* buffer) {
- int i;
-
-#ifdef _NJSD_SYNC
- u32 old_REG_IME;
-#endif
-
- u8* tbuf = (u8*)buffer;
-
- if (numSectors == 0) {
- return false;
- }
-
-#ifdef _NJSD_SYNC
- old_REG_IME = REG_IME;
- REG_IME = 0;
-#endif
-
- if (numSectors > 1) {
- _NJSD_sendCMDR (_NJSD_speed, NULL, SD_RSP_DATA, READ_MULTIPLE_BLOCK, sector * BYTES_PER_READ);
- for (i = 0; i < numSectors - 2; i++) {
- cardPolledTransfer (0xA1406000, (u32*)(tbuf + i * BYTES_PER_READ), BYTES_PER_READ, _NJSD_read_cmd);
- if (!_NJSD_waitIRQ ()) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
- }
- cardPolledTransfer (0xA1406000, (u32*)(tbuf + (numSectors - 2) * BYTES_PER_READ), BYTES_PER_READ, _NJSD_read_end_cmd);
- if (!_NJSD_waitIRQ ()) {
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return false;
- }
-
- cardPolledTransfer (0xA1406000, (u32*)(tbuf + (numSectors - 1) * BYTES_PER_READ), BYTES_PER_READ, _NJSD_read_cmd);
- } else {
- _NJSD_sendCMDR (_NJSD_speed, NULL, SD_RSP_STREAM, READ_SINGLE_BLOCK, sector * BYTES_PER_READ);
- cardPolledTransfer (0xA1406000, (u32*)tbuf, BYTES_PER_READ, _NJSD_read_cmd);
- }
-
-#ifdef _NJSD_SYNC
- REG_IME = old_REG_IME;
-#endif
- return true;
-}
-#endif // _IO_ALLOW_UNALIGNED
-
-const IO_INTERFACE _io_njsd = {
- DEVICE_TYPE_NJSD,
- FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_SLOT_NDS,
- (FN_MEDIUM_STARTUP)&_NJSD_startup,
- (FN_MEDIUM_ISINSERTED)&_NJSD_isInserted,
- (FN_MEDIUM_READSECTORS)&_NJSD_readSectors,
- (FN_MEDIUM_WRITESECTORS)&_NJSD_writeSectors,
- (FN_MEDIUM_CLEARSTATUS)&_NJSD_clearStatus,
- (FN_MEDIUM_SHUTDOWN)&_NJSD_shutdown
-} ;
-
-#endif // defined NDS
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.h
deleted file mode 100644
index b668a510bc..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- io_njsd.h
-
- Hardware Routines for reading an SD card using
- a NinjaDS SD adapter.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-08-02 - Chishm
- * Original release
-*/
-
-#ifndef IO_NJSD_H
-#define IO_NJSD_H
-
-#include "disc_io.h"
-
-#ifdef NDS
-
-// 'NJSD'
-#define DEVICE_TYPE_NJSD 0x44534A4E
-
-
-// export interface
-extern const IO_INTERFACE _io_njsd;
-
-#endif // defined NDS
-
-#endif // define IO_NJSD_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.c
deleted file mode 100644
index 88d8b48778..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- io_nmmc.c
-
- Hardware Routines for reading an SD or MMC card using
- a Neoflash MK2 or MK3.
-
- Written by www.neoflash.com
-
- Submit bug reports for this device to the NeoFlash forums
-
- See license.txt for license details.
-
- 2006-02-09 - www.neoflash.com:
- * First stable release
-
- 2006-02-13 - Chishm
- * Added ReadMK2Config function
- * Added read config test to init function so no unnecessary card commands are sent
- * Changed data read and write functions to use multiple block commands
-*/
-
-#include "io_nmmc.h"
-
-#ifdef NDS
-
-#include <nds/card.h>
-
-int _NMMC_spi_freq = 3;
-
-#define MK2_CONFIG_ZIP_RAM_CLOSE (1 << 5)
-#define MK2_CONFIG_GAME_FLASH_CLOSE ((1 << 4) | (1 << 0))
-//#define MK2_CONFIG_ZIP_RAM_CLOSE ((1 << 5) | (1 << 1))
-//#define MK2_CONFIG_GAME_FLASH_CLOSE (1 << 4)
-
-#define MMC_READ_MULTIPLE_BLOCK 18
-#define MMC_READ_BLOCK 17
-#define MMC_WRITE_MULTIPLE_BLOCK 25
-#define MMC_WRITE_BLOCK 24
-#define MMC_STOP_TRANSMISSION 12
-#define MMC_SET_BLOCKLEN 16
-#define MMC_SET_BLOCK_COUNT 23
-#define MMC_SEND_CSD 9
-
-// SPI functions
-
-static inline void _Neo_OpenSPI( u8 frequency )
-{
- CARD_CR1 = 0x0000A040 | frequency;
-}
-
-static inline u8 _Neo_SPI( u8 dataByte )
-{
- CARD_EEPDATA = dataByte;
- while (CARD_CR1 & 0x80); // card busy
- return CARD_EEPDATA;
-}
-
-static inline void _Neo_CloseSPI ( void )
-{
- CARD_CR1 = 0;
-}
-
-static inline void _Neo_MK2GameMode(void) {
- _Neo_OpenSPI(_NMMC_spi_freq); // Enable DS Card's SPI port
- _Neo_SPI(0xF1); // Switch to game mode
- _Neo_CloseSPI(); // Disable DS Card's SPI port
-}
-
-static inline void _Neo_EnableEEPROM( bool enable ) {
- _Neo_OpenSPI(_NMMC_spi_freq);
- if(enable) _Neo_SPI(0x06);
- else _Neo_SPI(0x0E);
- _Neo_CloseSPI();
-}
-
-static void _Neo_WriteMK2Config(u8 config) {
- _Neo_EnableEEPROM(true);
- _Neo_OpenSPI(_NMMC_spi_freq);
- _Neo_SPI(0xFA); // Send mem conf write command
- _Neo_SPI(0x01); // Send high byte (0x01)
- _Neo_SPI(config); // Send low byte
- _Neo_CloseSPI();
- _Neo_EnableEEPROM(false);
-}
-
-static u8 _Neo_ReadMK2Config(void)
-{
- u8 config;
- _Neo_EnableEEPROM(true);
- _Neo_OpenSPI(_NMMC_spi_freq);
- _Neo_SPI(0xf8); // Send mem conf read command
- _Neo_SPI(0x01); // Send high byte
- config = _Neo_SPI(0x00); // Get low byte
- _Neo_CloseSPI();
- _Neo_EnableEEPROM(false);
- return config;
-}
-
-// Low level functions
-
-u8 selectMMC_command [8] = {0xFF, 0x00, 0x6A, 0xDF, 0x37, 0x59, 0x33, 0xA3};
-
-static void _Neo_SelectMMC (u8 dataByte)
-{
- selectMMC_command[1] = dataByte; // Set enable / disable byte
- cardWriteCommand (selectMMC_command); // Send "5. Use the EEPROM CS to access the MK2 MMC/SD card"
- CARD_CR2 = CARD_ACTIVATE | CARD_nRESET;
- while (CARD_CR2 & CARD_BUSY);
- return;
-}
-
-static void _Neo_EnableMMC( bool enable )
-{
- if ( enable == false) {
- _Neo_CloseSPI ();
- _Neo_SelectMMC (0);
- _Neo_SelectMMC (0);
- } else {
- _Neo_SelectMMC (1);
- _Neo_SelectMMC (1);
- _Neo_OpenSPI (_NMMC_spi_freq);
- }
- return;
-}
-
-static void _Neo_SendMMCCommand( u8 command, u32 argument )
-{
- _Neo_SPI (0xFF);
- _Neo_SPI (command | 0x40);
- _Neo_SPI ((argument >> 24) & 0xff);
- _Neo_SPI ((argument >> 16) & 0xff);
- _Neo_SPI ((argument >> 8) & 0xff) ;
- _Neo_SPI (argument & 0xff);
- _Neo_SPI (0x95);
- _Neo_SPI (0xFF);
- return;
-}
-
-static bool _Neo_CheckMMCResponse( u8 response, u8 mask ) {
- u32 i;
- for(i=0;i<256;i++) {
- if( ( _Neo_SPI( 0xFF ) & mask ) == response )
- return true;
- }
- return false;
-}
-
-// Neo MMC functions
-
-static bool _Neo_InitMMC(void) {
- _Neo_MK2GameMode();
- _Neo_WriteMK2Config( MK2_CONFIG_ZIP_RAM_CLOSE | MK2_CONFIG_GAME_FLASH_CLOSE);
-
- // Make sure the configuration was accepted
- if (_Neo_ReadMK2Config() != (MK2_CONFIG_ZIP_RAM_CLOSE | MK2_CONFIG_GAME_FLASH_CLOSE)) {
- return false; // If not, then it wasn't initialised properly
- }
-
- return true;
-}
-
-// Neo MMC driver functions
-
-static bool _NMMC_isInserted(void) {
- int i;
-
- _Neo_EnableMMC( true ); // Open SPI port to MMC card
- _Neo_SendMMCCommand(MMC_SEND_CSD, 0);
- if( _Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
- _Neo_EnableMMC( false );
- return false;
- }
- if( _Neo_CheckMMCResponse( 0xFE, 0xFF ) == false ) { // Check for Start Block token
- _Neo_EnableMMC( false );
- return false;
- }
-
- // consume data from card, and send clocks.
- for (i = 0; i < 28; i++) {
- _Neo_SPI(0xff);
- }
-
- return true;
-}
-
-static bool _NMMC_clearStatus (void) {
- u32 i;
-
- _Neo_EnableMMC( true ); // Open SPI port to MMC card
- for (i = 0; i < 10; i++) {
- _Neo_SPI(0xFF); // Send 10 0xFF bytes to MMC card
- }
- _Neo_SendMMCCommand(0, 0); // Send GO_IDLE_STATE command
- if( _Neo_CheckMMCResponse( 0x01, 0xFF ) == false ) { // Check that it replied with 0x01 (not idle, no other error)
- _Neo_EnableMMC( false );
- return false;
- }
- for(i=0;i<256;i++) {
- _Neo_SendMMCCommand(1, 0); // Poll with SEND_OP_COND
- if( _Neo_CheckMMCResponse( 0x00, 0x01 ) == true ) { // Check for idle state
- _Neo_EnableMMC( false ); // Close SPI port to MMC card
- return true; // Card is now idle
- }
- }
- _Neo_EnableMMC( false );
- return false;
-}
-
-static bool _NMMC_shutdown(void) {
- return _NMMC_clearStatus();
-}
-
-static bool _NMMC_startUp(void) {
- int i;
- int transSpeed;
- if (_Neo_InitMMC() == false) {
- return false;
- }
- if (_NMMC_clearStatus() == false) {
- return false;
- }
- _Neo_EnableMMC( true ); // Open SPI port to MMC card
-
- // Set block length
- _Neo_SendMMCCommand(MMC_SET_BLOCKLEN, BYTES_PER_READ );
- if( _Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
- _Neo_EnableMMC( false );
- return false;
- }
-
- // Check if we can use a higher SPI frequency
- _Neo_SendMMCCommand(MMC_SEND_CSD, 0);
- if( _Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
- _Neo_EnableMMC( false );
- return false;
- }
- if( _Neo_CheckMMCResponse( 0xFE, 0xFF ) == false ) { // Check for Start Block token
- _Neo_EnableMMC( false );
- return false;
- }
- for (i = 0; i < 3; i++) {
- _Neo_SPI(0xFF);
- }
- transSpeed = _Neo_SPI (0xFF);
- for (i = 0; i < 24; i++) {
- _Neo_SPI(0xFF);
- }
- if ((transSpeed & 0xf0) >= 0x30) {
- _NMMC_spi_freq = 0;
- }
-
- _Neo_EnableMMC( false );
-
- return true;
-}
-
-
-static bool _NMMC_writeSectors (u32 sector, u32 totalSecs, const void* buffer)
-{
- u32 i;
- u8 *p=(u8*)buffer;
-
- sector *= BYTES_PER_READ;
-
- _Neo_EnableMMC( true ); // Open SPI port to MMC card
- _Neo_SendMMCCommand( 25, sector );
- if( _Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
- _Neo_EnableMMC( false );
- return false;
- }
-
- while (totalSecs--) {
- _Neo_SPI( 0xFC ); // Send Start Block token
- for( i = 0; i < BYTES_PER_READ; i++ ) // Send a block of data
- _Neo_SPI( *p++ );
- _Neo_SPI( 0xFF ); // Send fake CRC16
- _Neo_SPI( 0xFF ); // Send fake CRC16
-
- if( ( _Neo_SPI( 0xFF ) & 0x0F ) != 0x05 ) { // Make sure the block was accepted
- _Neo_EnableMMC( false );
- return false;
- }
- while( _Neo_SPI( 0xFF ) == 0x00 ); // Wait for the block to be written
- }
-
- // Stop transmission block
- _Neo_SPI( 0xFD ); // Send Stop Transmission Block token
- for( i = 0; i < BYTES_PER_READ; i++ ) // Send a block of fake data
- _Neo_SPI( 0xFF );
- _Neo_SPI( 0xFF ); // Send fake CRC16
- _Neo_SPI( 0xFF ); // Send fake CRC16
-
- _Neo_SPI (0xFF); // Send 8 clocks
- while( _Neo_SPI( 0xFF ) == 0x00 ); // Wait for the busy signal to clear
-
-
- for ( i = 0; i < 0x10; i++) {
- _Neo_SPI (0xFF); // Send clocks for the MMC card to finish what it's doing
- }
-
- _Neo_EnableMMC( false ); // Close SPI port to MMC card
- return true;
-}
-
-static bool _NMMC_readSectors (u32 sector, u32 totalSecs, void* buffer)
-{
- u32 i;
- u8 *p=(u8*)buffer;
-
- sector *= BYTES_PER_READ;
-
- _Neo_EnableMMC( true ); // Open SPI port to MMC card
-
- while (totalSecs--) {
- _Neo_SendMMCCommand(MMC_READ_BLOCK, sector );
- if( _Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
- _Neo_EnableMMC( false );
- return false;
- }
-
- if( _Neo_CheckMMCResponse( 0xFE, 0xFF ) == false ) { // Check for Start Block token
- _Neo_EnableMMC( false );
- return false;
- }
- for( i = 0; i < BYTES_PER_READ; i++ ) // Read in a block of data
- *p++ = _Neo_SPI( 0xFF );
- _Neo_SPI( 0xFF ); // Ignore CRC16
- _Neo_SPI( 0xFF ); // Ignore CRC16
- sector += BYTES_PER_READ;
- }
-
- _Neo_EnableMMC( false ); // Close SPI port to MMC card
- return true;
-}
-
-
-const IO_INTERFACE _io_nmmc = {
- DEVICE_TYPE_NMMC,
- FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_SLOT_NDS,
- (FN_MEDIUM_STARTUP)&_NMMC_startUp,
- (FN_MEDIUM_ISINSERTED)&_NMMC_isInserted,
- (FN_MEDIUM_READSECTORS)&_NMMC_readSectors,
- (FN_MEDIUM_WRITESECTORS)&_NMMC_writeSectors,
- (FN_MEDIUM_CLEARSTATUS)&_NMMC_clearStatus,
- (FN_MEDIUM_SHUTDOWN)&_NMMC_shutdown
-} ;
-
-#endif // defined NDS
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.h
deleted file mode 100644
index aeb2c64222..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- io_nmmc.h
-
- Hardware Routines for reading an SD or MMC card using
- a Neoflash MK2 or MK3.
-
- Original version written by www.neoflash.com,
- moddified and used with permission of www.neoflash.com
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef IO_NMMC_H
-#define IO_NMMC_H
-
-#include "disc_io.h"
-
-#ifdef NDS
-
-// 'NMMC'
-#define DEVICE_TYPE_NMMC 0x434D4D4E
-
-
-// export interface
-extern const IO_INTERFACE _io_nmmc;
-
-#endif // defined NDS
-
-#endif // define IO_NMMC_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sc_common.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sc_common.c
deleted file mode 100644
index 9dabbdcd84..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sc_common.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- io_m3_common.h
-
- Routines common to all version of the Super Card
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "io_sc_common.h"
-
-/*-----------------------------------------------------------------
-_SC_changeMode (was SC_Unlock)
-Added by MightyMax
-Modified by Chishm
-Modified again by loopy
-1=ram(readonly), 5=ram, 3=SD interface?
------------------------------------------------------------------*/
-void _SC_changeMode(u8 mode) {
- vu16 *unlockAddress = (vu16*)0x09FFFFFE;
- *unlockAddress = 0xA55A ;
- *unlockAddress = 0xA55A ;
- *unlockAddress = mode ;
- *unlockAddress = mode ;
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sc_common.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sc_common.h
deleted file mode 100644
index da30b7e5e3..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sc_common.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- io_sc_common.h
-
- Routines common to all version of the Super Card
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef IO_SC_COMMON_H
-#define IO_SC_COMMON_H
-
-#include "disc_io.h"
-
-// Values for changing mode
-#define SC_MODE_RAM 0x5
-#define SC_MODE_MEDIA 0x3
-#define SC_MODE_RAM_RO 0x1
-
-extern void _SC_changeMode (u8 mode);
-
-#endif // IO_SC_COMMON_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.c
deleted file mode 100644
index 06d1378028..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- io_sccf.c based on
-
- compact_flash.c
- By chishm (Michael Chisholm)
-
- Hardware Routines for reading a compact flash card
- using the Super Card CF
-
- CF routines modified with help from Darkfader
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "io_sccf.h"
-#include "io_sc_common.h"
-#include "io_cf_common.h"
-
-//---------------------------------------------------------------
-// SC CF Addresses
-#define REG_SCCF_STS ((vu16*)0x098C0000) // Status of the CF Card / Device control
-#define REG_SCCF_CMD ((vu16*)0x090E0000) // Commands sent to control chip and status return
-#define REG_SCCF_ERR ((vu16*)0x09020000) // Errors / Features
-
-#define REG_SCCF_SEC ((vu16*)0x09040000) // Number of sector to transfer
-#define REG_SCCF_LBA1 ((vu16*)0x09060000) // 1st byte of sector address
-#define REG_SCCF_LBA2 ((vu16*)0x09080000) // 2nd byte of sector address
-#define REG_SCCF_LBA3 ((vu16*)0x090A0000) // 3rd byte of sector address
-#define REG_SCCF_LBA4 ((vu16*)0x090C0000) // last nibble of sector address | 0xE0
-
-#define REG_SCCF_DATA ((vu16*)0x09000000) // Pointer to buffer of CF data transered from card
-
-static const CF_REGISTERS _SCCF_Registers = {
- REG_SCCF_DATA,
- REG_SCCF_STS,
- REG_SCCF_CMD,
- REG_SCCF_ERR,
- REG_SCCF_SEC,
- REG_SCCF_LBA1,
- REG_SCCF_LBA2,
- REG_SCCF_LBA3,
- REG_SCCF_LBA4
-};
-
-
-static bool _SCCF_startup(void) {
- _SC_changeMode (SC_MODE_MEDIA);
- return _CF_startup(&_SCCF_Registers);
-}
-
-
-const IO_INTERFACE _io_sccf = {
- DEVICE_TYPE_SCCF,
- FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_SLOT_GBA,
- (FN_MEDIUM_STARTUP)&_SCCF_startup,
- (FN_MEDIUM_ISINSERTED)&_CF_isInserted,
- (FN_MEDIUM_READSECTORS)&_CF_readSectors,
- (FN_MEDIUM_WRITESECTORS)&_CF_writeSectors,
- (FN_MEDIUM_CLEARSTATUS)&_CF_clearStatus,
- (FN_MEDIUM_SHUTDOWN)&_CF_shutdown
-} ;
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.h
deleted file mode 100644
index 86e428bfd5..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- io_sccf.h
-
- Hardware Routines for reading a compact flash card
- using the Supercard CF
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef IO_SCCF_H
-#define IO_SCCF_H
-
-// 'SCCF'
-#define DEVICE_TYPE_SCCF 0x46434353
-
-#include "disc_io.h"
-
-// export interface
-extern const IO_INTERFACE _io_sccf;
-
-#endif // define IO_SCCF_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.c
deleted file mode 100644
index 231b93fc37..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- io_scsd.c
-
- Hardware Routines for reading a Secure Digital card
- using the SC SD
-
- Some code based on scsd_c.c, written by Amadeus
- and Jean-Pierre Thomasset as part of DSLinux.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-22 - Chishm
- * First release of stable code
-
- 2006-07-25 - Chishm
- * Improved startup function that doesn't delay hundreds of seconds
- before reporting no card inserted.
-
- 2006-08-05 - Chishm
- * Tries multiple times to get a Relative Card Address at startup
-
- 2006-08-07 - Chishm
- * Moved the SD initialization to a common function
-
- 2006-08-19 - Chishm
- * Added SuperCard Lite support
-*/
-
-#include "io_scsd.h"
-#include "io_sd_common.h"
-#include "io_sc_common.h"
-
-//---------------------------------------------------------------
-// SCSD register addresses
-#define REG_SCSD_CMD (*(vu16*)(0x09800000))
- /* bit 0: command bit to read */
- /* bit 7: command bit to write */
-
-#define REG_SCSD_DATAWRITE (*(vu16*)(0x09000000))
-#define REG_SCSD_DATAREAD (*(vu16*)(0x09100000))
-#define REG_SCSD_DATAREAD_32 (*(vu32*)(0x09100000))
-#define REG_SCSD_LITE_ENABLE (*(vu16*)(0x09440000))
-#define REG_SCSD_LOCK (*(vu16*)(0x09FFFFFE))
- /* bit 0: 1 */
- /* bit 1: enable IO interface (SD,CF) */
- /* bit 2: enable R/W SDRAM access */
-
-//---------------------------------------------------------------
-// Responses
-#define SCSD_STS_BUSY 0x100
-#define SCSD_STS_INSERTED 0x300
-
-//---------------------------------------------------------------
-// Send / receive timeouts, to stop infinite wait loops
-#define NUM_STARTUP_CLOCKS 100 // Number of empty (0xFF when sending) bytes to send/receive to/from the card
-#define TRANSMIT_TIMEOUT 100000 // Time to wait for the SC to respond to transmit or receive requests
-#define RESPONSE_TIMEOUT 256 // Number of clocks sent to the SD card before giving up
-#define BUSY_WAIT_TIMEOUT 500000
-#define WRITE_TIMEOUT 3000 // Time to wait for the card to finish writing
-//---------------------------------------------------------------
-// Variables required for tracking SD state
-static u32 _SCSD_relativeCardAddress = 0; // Preshifted Relative Card Address
-
-//---------------------------------------------------------------
-// Internal SC SD functions
-
-extern bool _SCSD_writeData_s (u8 *data, u16* crc);
-
-static inline void _SCSD_unlock (void) {
- _SC_changeMode (SC_MODE_MEDIA);
-}
-
-static inline void _SCSD_enable_lite (void) {
- REG_SCSD_LITE_ENABLE = 0;
-}
-
-static bool _SCSD_sendCommand (u8 command, u32 argument) {
- u8 databuff[6];
- u8 *tempDataPtr = databuff;
- int length = 6;
- u16 dataByte;
- int curBit;
- int i;
-
- *tempDataPtr++ = command | 0x40;
- *tempDataPtr++ = argument>>24;
- *tempDataPtr++ = argument>>16;
- *tempDataPtr++ = argument>>8;
- *tempDataPtr++ = argument;
- *tempDataPtr = _SD_CRC7 (databuff, 5);
-
- i = BUSY_WAIT_TIMEOUT;
- while (((REG_SCSD_CMD & 0x01) == 0) && (--i));
- if (i == 0) {
- return false;
- }
-
- dataByte = REG_SCSD_CMD;
-
- tempDataPtr = databuff;
-
- while (length--) {
- dataByte = *tempDataPtr++;
- for (curBit = 7; curBit >=0; curBit--){
- REG_SCSD_CMD = dataByte;
- dataByte = dataByte << 1;
- }
- }
-
- return true;
-}
-
-// Returns the response from the SD card to a previous command.
-static bool _SCSD_getResponse (u8* dest, u32 length) {
- u32 i;
- int dataByte;
- int numBits = length * 8;
-
- // Wait for the card to be non-busy
- i = BUSY_WAIT_TIMEOUT;
- while (((REG_SCSD_CMD & 0x01) != 0) && (--i));
- if (dest == NULL) {
- return true;
- }
-
- if (i == 0) {
- // Still busy after the timeout has passed
- return false;
- }
-
- // The first bit is always 0
- dataByte = 0;
- numBits--;
- // Read the remaining bits in the response.
- // It's always most significant bit first
- while (numBits--) {
- dataByte = (dataByte << 1) | (REG_SCSD_CMD & 0x01);
- if ((numBits & 0x7) == 0) {
- // It's read a whole byte, so store it
- *dest++ = (u8)dataByte;
- dataByte = 0;
- }
- }
-
- // Send 16 more clocks, 8 more than the delay required between a response and the next command
- for (i = 0; i < 16; i++) {
- dataByte = REG_SCSD_CMD;
- }
-
- return true;
-}
-
-static inline bool _SCSD_getResponse_R1 (u8* dest) {
- return _SCSD_getResponse (dest, 6);
-}
-
-static inline bool _SCSD_getResponse_R1b (u8* dest) {
- return _SCSD_getResponse (dest, 6);
-}
-
-static inline bool _SCSD_getResponse_R2 (u8* dest) {
- return _SCSD_getResponse (dest, 17);
-}
-
-static inline bool _SCSD_getResponse_R3 (u8* dest) {
- return _SCSD_getResponse (dest, 6);
-}
-
-static inline bool _SCSD_getResponse_R6 (u8* dest) {
- return _SCSD_getResponse (dest, 6);
-}
-
-static void _SCSD_sendClocks (u32 numClocks) {
- u16 temp;
- do {
- (void) temp; /* avoid set but not used warning */
- temp = REG_SCSD_CMD;
- } while (numClocks--);
-}
-
-static bool _SCSD_cmd_6byte_response (u8* responseBuffer, u8 command, u32 data) {
- _SCSD_sendCommand (command, data);
- return _SCSD_getResponse (responseBuffer, 6);
-}
-
-static bool _SCSD_cmd_17byte_response (u8* responseBuffer, u8 command, u32 data) {
- _SCSD_sendCommand (command, data);
- return _SCSD_getResponse (responseBuffer, 17);
-}
-
-
-static bool _SCSD_initCard (void) {
- _SCSD_enable_lite();
-
- // Give the card time to stabilise
- _SCSD_sendClocks (NUM_STARTUP_CLOCKS);
-
- // Reset the card
- if (!_SCSD_sendCommand (GO_IDLE_STATE, 0)) {
- return false;
- }
-
- _SCSD_sendClocks (NUM_STARTUP_CLOCKS);
-
- // Card is now reset, including it's address
- _SCSD_relativeCardAddress = 0;
-
- // Init the card
- return _SD_InitCard (_SCSD_cmd_6byte_response,
- _SCSD_cmd_17byte_response,
- true,
- &_SCSD_relativeCardAddress);
-}
-
-static bool _SCSD_readData (void* buffer) {
- u8* buff_u8 = (u8*)buffer;
- u16* buff = (u16*)buffer;
- volatile register u32 temp;
- int i;
-
- i = BUSY_WAIT_TIMEOUT;
- while ((REG_SCSD_DATAREAD & SCSD_STS_BUSY) && (--i));
- if (i == 0) {
- return false;
- }
-
- i=256;
- if ((u32)buff_u8 & 0x01) {
- while(i--) {
- temp = REG_SCSD_DATAREAD_32;
- temp = REG_SCSD_DATAREAD_32 >> 16;
- *buff_u8++ = (u8)temp;
- *buff_u8++ = (u8)(temp >> 8);
- }
- } else {
- while(i--) {
- temp = REG_SCSD_DATAREAD_32;
- temp = REG_SCSD_DATAREAD_32 >> 16;
- *buff++ = temp;
- }
- }
-
-
- for (i = 0; i < 8; i++) {
- temp = REG_SCSD_DATAREAD_32;
- }
-
- temp = REG_SCSD_DATAREAD;
-
- return true;
-}
-
-//---------------------------------------------------------------
-// Functions needed for the external interface
-
-static bool _SCSD_startUp (void) {
- _SCSD_unlock();
- return _SCSD_initCard();
-}
-
-static bool _SCSD_isInserted (void) {
- u8 responseBuffer [6];
-
- // Make sure the card receives the command
- if (!_SCSD_sendCommand (SEND_STATUS, 0)) {
- return false;
- }
- // Make sure the card responds
- if (!_SCSD_getResponse_R1 (responseBuffer)) {
- return false;
- }
- // Make sure the card responded correctly
- if (responseBuffer[0] != SEND_STATUS) {
- return false;
- }
- return true;
-}
-
-static bool _SCSD_readSectors (u32 sector, u32 numSectors, void* buffer) {
- u32 i;
- u8* dest = (u8*) buffer;
- u8 responseBuffer[6];
-
- if (numSectors == 1) {
- // If it's only reading one sector, use the (slightly faster) READ_SINGLE_BLOCK
- if (!_SCSD_sendCommand (READ_SINGLE_BLOCK, sector * BYTES_PER_READ)) {
- return false;
- }
-
- if (!_SCSD_readData (buffer)) {
- return false;
- }
-
- } else {
- // Stream the required number of sectors from the card
- if (!_SCSD_sendCommand (READ_MULTIPLE_BLOCK, sector * BYTES_PER_READ)) {
- return false;
- }
-
- for(i=0; i < numSectors; i++, dest+=BYTES_PER_READ) {
- if (!_SCSD_readData(dest)) {
- return false;
- }
- }
-
- // Stop the streaming
- _SCSD_sendCommand (STOP_TRANSMISSION, 0);
- _SCSD_getResponse_R1b (responseBuffer);
- }
-
- _SCSD_sendClocks(0x10);
- return true;
-}
-
-static bool _SCSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) {
- u16 crc[4]; // One per data line
- u8 responseBuffer[6];
- u32 offset = sector * BYTES_PER_READ;
- u8* data = (u8*) buffer;
- int i;
-
- while (numSectors--) {
- // Calculate the CRC16
- _SD_CRC16 ( data, BYTES_PER_READ, (u8*)crc);
-
- // Send write command and get a response
- _SCSD_sendCommand (WRITE_BLOCK, offset);
- if (!_SCSD_getResponse_R1 (responseBuffer)) {
- return false;
- }
-
- // Send the data and CRC
- if (! _SCSD_writeData_s (data, crc)) {
- return false;
- }
-
- // Send a few clocks to the SD card
- _SCSD_sendClocks(0x10);
-
- offset += BYTES_PER_READ;
- data += BYTES_PER_READ;
-
- // Wait until card is finished programming
- i = WRITE_TIMEOUT;
- responseBuffer[3] = 0;
- do {
- _SCSD_sendCommand (SEND_STATUS, _SCSD_relativeCardAddress);
- _SCSD_getResponse_R1 (responseBuffer);
- i--;
- if (i <= 0) {
- return false;
- }
- } while (((responseBuffer[3] & 0x1f) != ((SD_STATE_TRAN << 1) | READY_FOR_DATA)));
- }
-
- return true;
-}
-
-static bool _SCSD_clearStatus (void) {
- return _SCSD_initCard ();
-}
-
-static bool _SCSD_shutdown (void) {
- _SC_changeMode (SC_MODE_RAM_RO);
- return true;
-}
-
-const IO_INTERFACE _io_scsd = {
- DEVICE_TYPE_SCSD,
- FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_SLOT_GBA,
- (FN_MEDIUM_STARTUP)&_SCSD_startUp,
- (FN_MEDIUM_ISINSERTED)&_SCSD_isInserted,
- (FN_MEDIUM_READSECTORS)&_SCSD_readSectors,
- (FN_MEDIUM_WRITESECTORS)&_SCSD_writeSectors,
- (FN_MEDIUM_CLEARSTATUS)&_SCSD_clearStatus,
- (FN_MEDIUM_SHUTDOWN)&_SCSD_shutdown
-} ;
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.h
deleted file mode 100644
index 25a02544df..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- io_scsd.h
-
- Hardware Routines for reading a Secure Digital card
- using the Supercard SD
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-22 - Chishm
- * First release of stable code
-*/
-
-#ifndef IO_SCSD_H
-#define IO_SCSD_H
-
-// 'SCSD'
-#define DEVICE_TYPE_SCSD 0x44534353
-
-#include "disc_io.h"
-
-// export interface
-extern const IO_INTERFACE _io_scsd ;
-
-#endif // define IO_SCSD_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd_s.S b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd_s.S
deleted file mode 100644
index 5ae8fdd2b8..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd_s.S
+++ /dev/null
@@ -1,139 +0,0 @@
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-@ io_scsd_s.s
-@
-@ Hardware Routines for reading a Secure Digital card
-@ using the SC SD
-@
-@ Based on code supplied by Romman
-@
-@ Copyright (c) 2006 Michael "Chishm" Chisholm
-@
-@ Redistribution and use in source and binary forms, with or without modification,
-@ are permitted provided that the following conditions are met:
-@
-@ 1. Redistributions of source code must retain the above copyright notice,
-@ this list of conditions and the following disclaimer.
-@ 2. Redistributions in binary form must reproduce the above copyright notice,
-@ this list of conditions and the following disclaimer in the documentation and/or
-@ other materials provided with the distribution.
-@ 3. The name of the author may not be used to endorse or promote products derived
-@ from this software without specific prior written permission.
-@
-@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-@ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-@ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
-@ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-@
-@ 2006-07-22 - Chishm
-@ * First release of stable code
-@
-@ 2006-08-19 - Chishm
-@ * Added SuperCard Lite support
-@
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-
- .align 4
- .arm
-
- .equ REG_SCSD_DATAWRITE, 0x09000000
- .equ BYTES_PER_READ, 0x200
- .equ SCSD_STS_BUSY, 0x100
- .equ BUSY_WAIT_TIMEOUT, 0x10000
- .equ FALSE, 0
- .equ TRUE, 1
-
-@ bool _SCSD_writeData_s (u8 *data, u16* crc)
-
- .global _SCSD_writeData_s
-
-_SCSD_writeData_s:
- stmfd r13!, {r4-r5}
- mov r5, #BYTES_PER_READ
- mov r2, #REG_SCSD_DATAWRITE
-
-@ Wait for a free data buffer on the SD card
- mov r4, #BUSY_WAIT_TIMEOUT
-_SCSD_writeData_busy_wait:
- @ Test for timeout
- subs r4, r4, #1
- moveq r0, #FALSE @ return false on failure
- beq _SCSD_writeData_return
- @ Check the busy bit of the status register
- ldrh r3, [r2]
- tst r3, #SCSD_STS_BUSY
- beq _SCSD_writeData_busy_wait
-
- ldrh r3, [r2] @ extra clock
-
- mov r3, #0 @ start bit
- strh r3,[r2]
-
-@ Check if the data buffer is aligned on a halfword boundary
- tst r0, #1
- beq _SCSD_writeData_data_loop
-
-@ Used when the source data is unaligned
-_SCSD_writeData_data_loop_unaligned:
- ldrb r3, [r0], #1
- ldrb r4, [r0], #1
- orr r3, r3, r4, lsl #8
- stmia r2, {r3-r4}
- subs r5, r5, #2
- bne _SCSD_writeData_data_loop_unaligned
- b _SCSD_writeData_crc
-
-@ Write the data to the card
-@ 4 halfwords are transmitted to the Supercard at once, for timing purposes
-@ Only the first halfword needs to contain data for standard SuperCards
-@ For the SuperCard Lite, the data is split into 4 nibbles, one per halfword
-_SCSD_writeData_data_loop:
- ldrh r3, [r0], #2
-
-@ This bit added for SCLite. Notice that the shift is not the same as in
-@ the original (buggy) code supplied by Romman
- add r3, r3, r3, lsl #20
- mov r4, r3, lsr #8
-
- stmia r2, {r3-r4}
-
- subs r5, r5, #2
- bne _SCSD_writeData_data_loop
-
-@ Send the data CRC
-_SCSD_writeData_crc:
- cmp r1, #0
- movne r0, r1
- movne r1, #0
- movne r5, #8
- bne _SCSD_writeData_data_loop
-
- mov r3, #0xff @ end bit
- strh r3, [r2]
-
-@ Wait for the SD card to signal that it is finished recieving
- mov r4, #BUSY_WAIT_TIMEOUT
-_SCSD_writeData_finished_wait:
- @ Test for timeout
- subs r4, r4, #1
- moveq r0, #FALSE @ return false on failure
- beq _SCSD_writeData_return
- @ Check the busy bit of the status register
- ldrh r3, [r2]
- tst r3, #0x100
- bne _SCSD_writeData_finished_wait
-
-@ Send 8 more clocks, as required by the SD card
- ldmia r2, {r3-r4}
-
-@ return true for success
- mov r0, #TRUE
-
-_SCSD_writeData_return:
- ldmfd r13!,{r4-r5}
- bx r14
-
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sd_common.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sd_common.c
deleted file mode 100644
index 86dd37355b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sd_common.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- io_sd_common.c
-
- By chishm (Michael Chisholm)
-
- Common SD card routines
-
- SD routines partially based on sd.s by Romman
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-08-07 - Chishm
- * Moved the SD initialization to a common function
- * Increased timeouts for slower cards
-
- 2006-08-08 - Chishm
- * Init aborts when it doesn't get a valid response to APP_CMD - speeds up detection when no card is inserted
-*/
-
-#include "io_sd_common.h"
-
-#define MAX_STARTUP_TRIES 1000 // Arbitrary value, check if the card is ready 20 times before giving up
-#define RESPONSE_TIMEOUT 256 // Number of clocks sent to the SD card before giving up
-
-/*
-Improved CRC7 function provided by cory1492
-Calculates the CRC of an SD command, and includes the end bit in the byte
-*/
-u8 _SD_CRC7(u8* data, int cnt) {
- int i, a;
- u8 crc, temp;
-
- crc = 0;
- for (a = 0; a < cnt; a++)
- {
- temp = data[a];
- for (i = 0; i < 8; i++)
- {
- crc <<= 1;
- if ((temp & 0x80) ^ (crc & 0x80)) crc ^= 0x09;
- temp <<= 1;
- }
- }
- crc = (crc << 1) | 1;
- return(crc);
-}
-
-/*
-Calculates the CRC16 for a sector of data. Calculates it
-as 4 separate lots, merged into one buffer. This is used
-for 4 SD data lines, not for 1 data line alone.
-*/
-void _SD_CRC16 (u8* buff, int buffLength, u8* crc16buff) {
- u32 a, b, c, d;
- int count;
- u32 bitPattern = 0x80808080; // r7
- u32 crcConst = 0x1021; // r8
- u32 dataByte = 0; // r2
-
- a = 0; // r3
- b = 0; // r4
- c = 0; // r5
- d = 0; // r6
-
- buffLength = buffLength * 8;
-
-
- do {
- if (bitPattern & 0x80) dataByte = *buff++;
-
- a = a << 1;
- if ( a & 0x10000) a ^= crcConst;
- if (dataByte & (bitPattern >> 24)) a ^= crcConst;
-
- b = b << 1;
- if (b & 0x10000) b ^= crcConst;
- if (dataByte & (bitPattern >> 25)) b ^= crcConst;
-
- c = c << 1;
- if (c & 0x10000) c ^= crcConst;
- if (dataByte & (bitPattern >> 26)) c ^= crcConst;
-
- d = d << 1;
- if (d & 0x10000) d ^= crcConst;
- if (dataByte & (bitPattern >> 27)) d ^= crcConst;
-
- bitPattern = (bitPattern >> 4) | (bitPattern << 28);
- } while (buffLength-=4);
-
- count = 16; // r8
-
- do {
- bitPattern = bitPattern << 4;
- if (a & 0x8000) bitPattern |= 8;
- if (b & 0x8000) bitPattern |= 4;
- if (c & 0x8000) bitPattern |= 2;
- if (d & 0x8000) bitPattern |= 1;
-
- a = a << 1;
- b = b << 1;
- c = c << 1;
- d = d << 1;
-
- count--;
-
- if (!(count & 0x01)) {
- *crc16buff++ = (u8)(bitPattern & 0xff);
- }
- } while (count != 0);
-
- return;
-}
-
-/*
-Initialise the SD card, after it has been sent into an Idle state
-cmd_6byte_response: a pointer to a function that sends the SD card a command and gets a 6 byte response
-cmd_17byte_response: a pointer to a function that sends the SD card a command and gets a 17 byte response
-use4bitBus: initialise card to use a 4 bit data bus when communicating with the card
-RCA: a pointer to the location to store the card's Relative Card Address, preshifted up by 16 bits.
-*/
-bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
- _SD_FN_CMD_17BYTE_RESPONSE cmd_17byte_response,
- bool use4bitBus,
- u32 *RCA)
-{
- u8 responseBuffer[17] = {0};
- int i;
-
- for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
- cmd_6byte_response (responseBuffer, APP_CMD, 0);
- // Check that the card gave the correct response
- if (responseBuffer[0] != APP_CMD) {
- return false;
- }
- if (
- cmd_6byte_response (responseBuffer, SD_APP_OP_COND, SD_OCR_VALUE) &&
- ((responseBuffer[1] & 0x80) != 0))
- {
- // Card is ready to receive commands now
- break;
- }
- }
- if (i >= MAX_STARTUP_TRIES) {
- return false;
- }
-
- // The card's name, as assigned by the manufacturer
- cmd_17byte_response (responseBuffer, ALL_SEND_CID, 0);
-
- // Get a new address
- for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
- cmd_6byte_response (responseBuffer, SEND_RELATIVE_ADDR, 0);
- *RCA = (responseBuffer[1] << 24) | (responseBuffer[2] << 16);
- if ((responseBuffer[3] & 0x1e) != (SD_STATE_STBY << 1)) {
- break;
- }
- }
- if (i >= MAX_STARTUP_TRIES) {
- return false;
- }
-
- // Some cards won't go to higher speeds unless they think you checked their capabilities
- cmd_17byte_response (responseBuffer, SEND_CSD, *RCA);
-
- // Only this card should respond to all future commands
- cmd_6byte_response (responseBuffer, SELECT_CARD, *RCA);
-
- if (use4bitBus) {
- // Set a 4 bit data bus
- cmd_6byte_response (responseBuffer, APP_CMD, *RCA);
- cmd_6byte_response (responseBuffer, SET_BUS_WIDTH, 2); // 4-bit mode.
- }
-
- // Use 512 byte blocks
- cmd_6byte_response (responseBuffer, SET_BLOCKLEN, 512); // 512 byte blocks
-
- // Wait until card is ready for data
- i = 0;
- do {
- if (i >= RESPONSE_TIMEOUT) {
- return false;
- }
- i++;
- } while (!cmd_6byte_response (responseBuffer, SEND_STATUS, *RCA) && ((responseBuffer[3] & 0x1f) != ((SD_STATE_TRAN << 1) | READY_FOR_DATA)));
-
- return true;
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sd_common.h b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sd_common.h
deleted file mode 100644
index 887160e293..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sd_common.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- io_sd_common.h
-
- By chishm (Michael Chisholm)
-
- Common SD card routines
-
- SD routines partially based on sd.s by Romman
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-28 - Chishm
- * Changed voltage range that the SD card can use
-
- 2006-11-14 - Chishm
- * Reduced voltage range again. Hopefully fixes MicroSD cards.
-*/
-
-#ifndef IO_SD_COMMON_H
-#define IO_SD_COMMON_H
-
-#include "disc_io.h"
-
-/* SD commands */
-#define GO_IDLE_STATE 0
-#define ALL_SEND_CID 2
-#define SEND_RELATIVE_ADDR 3
-#define SELECT_CARD 7
-#define SEND_CSD 9
-#define STOP_TRANSMISSION 12
-#define SEND_STATUS 13
-#define GO_INACTIVE_STATE 15
-#define SET_BLOCKLEN 16
-#define READ_SINGLE_BLOCK 17
-#define READ_MULTIPLE_BLOCK 18
-#define WRITE_BLOCK 24
-#define WRITE_MULTIPLE_BLOCK 25
-#define APP_CMD 55
-
-/* SD App commands */
-#define SET_BUS_WIDTH 6
-#define SD_APP_OP_COND 41
-
-/* OCR (Operating Conditions Register) send value */
-#define SD_OCR_VALUE 0x00030000 /* 2.8V to 3.0V */
-//#define SD_OCR_VALUE 0x003F8000 /* 2.7V to 3.4V */
-//#define SD_OCR_VALUE 0x00FC0000
-
-/* SD Data repsonses */
-#define SD_CARD_BUSY 0xff
-
-/* SD states */
-#define SD_STATE_IDLE 0 // Idle state, after power on or GO_IDLE_STATE command
-#define SD_STATE_READY 1 // Ready state, after card replies non-busy to SD_APP_OP_COND
-#define SD_STATE_IDENT 2 // Identification state, after ALL_SEND_CID
-#define SD_STATE_STBY 3 // Standby state, when card is deselected
-#define SD_STATE_TRAN 4 // Transfer state, after card is selected and ready for data transfer
-#define SD_STATE_DATA 5 //
-#define SD_STATE_RCV 6 // Receive data state
-#define SD_STATE_PRG 7 // Programming state
-#define SD_STATE_DIS 8 // Disconnect state
-#define SD_STATE_INA 9 // Inactive state, after GO_INACTIVE_STATE
-
-#define READY_FOR_DATA 1 // bit 8 in card status
-
-/*
-Calculate the CRC7 of a command and return it preshifted with
-an end bit added
-*/
-extern u8 _SD_CRC7(u8* data, int size);
-
-/*
-Calculate the CRC16 of a block of data, ready for transmission on
-four data lines at once
-*/
-extern void _SD_CRC16 (u8* buff, int buffLength, u8* crc16buff);
-
-typedef bool (*_SD_FN_CMD_6BYTE_RESPONSE) (u8* responseBuffer, u8 command, u32 data);
-typedef bool (*_SD_FN_CMD_17BYTE_RESPONSE) (u8* responseBuffer, u8 command, u32 data);
-
-/*
-Initialise the SD card, after it has been sent into an Idle state
-cmd_6byte_response: a pointer to a function that sends the SD card a command and gets a 6 byte response
-cmd_17byte_response: a pointer to a function that sends the SD card a command and gets a 17 byte response
-use4bitBus: initialise card to use a 4 bit data bus when communicating with the card
-RCA: a pointer to the location to store the card's Relative Card Address, preshifted up by 16 bits.
-*/
-extern bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
- _SD_FN_CMD_17BYTE_RESPONSE cmd_17byte_response,
- bool use4bitBus,
- u32 *RCA);
-
-#endif // define IO_SD_COMMON_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/fatdir.c b/c/src/lib/libbsp/arm/nds/libfat/source/fatdir.c
deleted file mode 100644
index 78a2b14f9e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/fatdir.c
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- fatdir.c
-
- Functions used by the newlib disc stubs to interface with
- this library
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
- * Added _FAT_mkdir_r
-
- 2006-08-14 - Chishm
- * Added directory iterator functions
-
- 2006-08-19 - Chishm
- * Updated dirnext return values to return correctly
-
- 2006-10-01 - Chishm
- * Now clears the whole cluster when creating a new directory, bug found by Hermes
-
- 2007-01-10 - Chishm
- * Updated directory iterator functions for DevkitPro r20
-*/
-
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <sys/dir.h>
-
-#include "fatdir.h"
-
-#include "cache.h"
-#include "file_allocation_table.h"
-#include "partition.h"
-#include "directory.h"
-#include "bit_ops.h"
-#include "filetime.h"
-
-
-int _FAT_stat_r (struct _reent *r, const char *path, struct stat *st) {
- PARTITION* partition = NULL;
-
- DIR_ENTRY dirEntry;
-
- // Get the partition this file is on
- partition = _FAT_partition_getPartitionFromPath (path);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Search for the file on the disc
- if (!_FAT_directory_entryFromPath (partition, &dirEntry, path, NULL)) {
- r->_errno = ENOENT;
- return -1;
- }
-
- // Fill in the stat struct
- _FAT_directory_entryStat (partition, &dirEntry, st);
-
- return 0;
-}
-
-int _FAT_link_r (struct _reent *r, const char *existing, const char *newLink) {
- r->_errno = ENOTSUP;
- return -1;
-}
-
-int _FAT_unlink_r (struct _reent *r, const char *path) {
- PARTITION* partition = NULL;
- DIR_ENTRY dirEntry;
- DIR_ENTRY dirContents;
- u32 cluster;
- bool nextEntry;
- bool errorOccured = false;
-
- // Get the partition this directory is on
- partition = _FAT_partition_getPartitionFromPath (path);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Make sure we aren't trying to write to a read-only disc
- if (partition->readOnly) {
- r->_errno = EROFS;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Search for the file on the disc
- if (!_FAT_directory_entryFromPath (partition, &dirEntry, path, NULL)) {
- r->_errno = ENOENT;
- return -1;
- }
-
- cluster = _FAT_directory_entryGetCluster (dirEntry.entryData);
-
-
- // If this is a directory, make sure it is empty
- if (_FAT_directory_isDirectory (&dirEntry)) {
- nextEntry = _FAT_directory_getFirstEntry (partition, &dirContents, cluster);
-
- while (nextEntry) {
- if (!_FAT_directory_isDot (&dirContents)) {
- // The directory had something in it that isn't a reference to itself or it's parent
- r->_errno = EPERM;
- return -1;
- }
- nextEntry = _FAT_directory_getNextEntry (partition, &dirContents);
- }
- }
-
- if (cluster != CLUSTER_FREE) {
- // Remove the cluster chain for this file
- if (!_FAT_fat_clearLinks (partition, cluster)) {
- r->_errno = EIO;
- errorOccured = true;
- }
- }
-
- // Remove the directory entry for this file
- if (!_FAT_directory_removeEntry (partition, &dirEntry)) {
- r->_errno = EIO;
- errorOccured = true;
- }
-
- // Flush any sectors in the disc cache
- if (!_FAT_cache_flush(partition->cache)) {
- r->_errno = EIO;
- errorOccured = true;
- }
-
- if (errorOccured) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int _FAT_chdir_r (struct _reent *r, const char *path) {
- PARTITION* partition = NULL;
-
- // Get the partition this directory is on
- partition = _FAT_partition_getPartitionFromPath (path);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Set the default device to match this one
- if (!_FAT_partition_setDefaultPartition (partition)) {
- r->_errno = ENOENT;
- return -1;
- }
-
- // Try changing directory
- if (_FAT_directory_chdir (partition, path)) {
- // Successful
- return 0;
- } else {
- // Failed
- r->_errno = ENOTDIR;
- return -1;
- }
-}
-
-int _FAT_rename_r (struct _reent *r, const char *oldName, const char *newName) {
- PARTITION* partition = NULL;
- DIR_ENTRY oldDirEntry;
- DIR_ENTRY newDirEntry;
- const char *pathEnd;
- u32 dirCluster;
-
- // Get the partition this directory is on
- partition = _FAT_partition_getPartitionFromPath (oldName);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Make sure the same partition is used for the old and new names
- if (partition != _FAT_partition_getPartitionFromPath (newName)) {
- r->_errno = EXDEV;
- return -1;
- }
-
- // Make sure we aren't trying to write to a read-only disc
- if (partition->readOnly) {
- r->_errno = EROFS;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (oldName, ':') != NULL) {
- oldName = strchr (oldName, ':') + 1;
- }
- if (strchr (oldName, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
- if (strchr (newName, ':') != NULL) {
- newName = strchr (newName, ':') + 1;
- }
- if (strchr (newName, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Search for the file on the disc
- if (!_FAT_directory_entryFromPath (partition, &oldDirEntry, oldName, NULL)) {
- r->_errno = ENOENT;
- return -1;
- }
-
- // Make sure there is no existing file / directory with the new name
- if (_FAT_directory_entryFromPath (partition, &newDirEntry, newName, NULL)) {
- r->_errno = EEXIST;
- return -1;
- }
-
- // Create the new file entry
- // Get the directory it has to go in
- pathEnd = strrchr (newName, DIR_SEPARATOR);
- if (pathEnd == NULL) {
- // No path was specified
- dirCluster = partition->cwdCluster;
- pathEnd = newName;
- } else {
- // Path was specified -- get the right dirCluster
- // Recycling newDirEntry, since it needs to be recreated anyway
- if (!_FAT_directory_entryFromPath (partition, &newDirEntry, newName, pathEnd) ||
- !_FAT_directory_isDirectory(&newDirEntry)) {
- r->_errno = ENOTDIR;
- return -1;
- }
- dirCluster = _FAT_directory_entryGetCluster (newDirEntry.entryData);
- // Move the pathEnd past the last DIR_SEPARATOR
- pathEnd += 1;
- }
-
- // Copy the entry data
- memcpy (&newDirEntry, &oldDirEntry, sizeof(DIR_ENTRY));
-
- // Set the new name
- strncpy (newDirEntry.filename, pathEnd, MAX_FILENAME_LENGTH - 1);
-
- // Write the new entry
- if (!_FAT_directory_addEntry (partition, &newDirEntry, dirCluster)) {
- r->_errno = ENOSPC;
- return -1;
- }
-
- // Remove the old entry
- if (!_FAT_directory_removeEntry (partition, &oldDirEntry)) {
- r->_errno = EIO;
- return -1;
- }
-
- // Flush any sectors in the disc cache
- if (!_FAT_cache_flush (partition->cache)) {
- r->_errno = EIO;
- return -1;
- }
-
- return 0;
-}
-
-int _FAT_mkdir_r (struct _reent *r, const char *path, int mode) {
- PARTITION* partition = NULL;
- bool fileExists;
- DIR_ENTRY dirEntry;
- const char* pathEnd;
- u32 parentCluster, dirCluster;
- u8 newEntryData[DIR_ENTRY_DATA_SIZE];
-
- partition = _FAT_partition_getPartitionFromPath (path);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Search for the file/directory on the disc
- fileExists = _FAT_directory_entryFromPath (partition, &dirEntry, path, NULL);
-
- // Make sure it doesn't exist
- if (fileExists) {
- r->_errno = EEXIST;
- return -1;
- }
-
- if (partition->readOnly) {
- // We can't write to a read-only partition
- r->_errno = EROFS;
- return -1;
- }
-
- // Get the directory it has to go in
- pathEnd = strrchr (path, DIR_SEPARATOR);
- if (pathEnd == NULL) {
- // No path was specified
- parentCluster = partition->cwdCluster;
- pathEnd = path;
- } else {
- // Path was specified -- get the right parentCluster
- // Recycling dirEntry, since it needs to be recreated anyway
- if (!_FAT_directory_entryFromPath (partition, &dirEntry, path, pathEnd) ||
- !_FAT_directory_isDirectory(&dirEntry)) {
- r->_errno = ENOTDIR;
- return -1;
- }
- parentCluster = _FAT_directory_entryGetCluster (dirEntry.entryData);
- // Move the pathEnd past the last DIR_SEPARATOR
- pathEnd += 1;
- }
- // Create the entry data
- strncpy (dirEntry.filename, pathEnd, MAX_FILENAME_LENGTH - 1);
- memset (dirEntry.entryData, 0, DIR_ENTRY_DATA_SIZE);
-
- // Set the creation time and date
- dirEntry.entryData[DIR_ENTRY_cTime_ms] = 0;
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_cTime, _FAT_filetime_getTimeFromRTC());
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_cDate, _FAT_filetime_getDateFromRTC());
-
- // Set the directory attribute
- dirEntry.entryData[DIR_ENTRY_attributes] = ATTRIB_DIR;
-
- // Get a cluster for the new directory
- dirCluster = _FAT_fat_linkFreeClusterCleared (partition, CLUSTER_FREE);
- if (dirCluster == CLUSTER_FREE) {
- // No space left on disc for the cluster
- r->_errno = ENOSPC;
- return -1;
- }
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_cluster, dirCluster);
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_clusterHigh, dirCluster >> 16);
-
- // Write the new directory's entry to it's parent
- if (!_FAT_directory_addEntry (partition, &dirEntry, parentCluster)) {
- r->_errno = ENOSPC;
- return -1;
- }
-
- // Create the dot entry within the directory
- memset (newEntryData, 0, DIR_ENTRY_DATA_SIZE);
- memset (newEntryData, ' ', 11);
- newEntryData[DIR_ENTRY_name] = '.';
- newEntryData[DIR_ENTRY_attributes] = ATTRIB_DIR;
- u16_to_u8array (newEntryData, DIR_ENTRY_cluster, dirCluster);
- u16_to_u8array (newEntryData, DIR_ENTRY_clusterHigh, dirCluster >> 16);
-
- // Write it to the directory, erasing that sector in the process
- _FAT_cache_eraseWritePartialSector ( partition->cache, newEntryData,
- _FAT_fat_clusterToSector (partition, dirCluster), 0, DIR_ENTRY_DATA_SIZE);
-
-
- // Create the double dot entry within the directory
- newEntryData[DIR_ENTRY_name + 1] = '.';
- u16_to_u8array (newEntryData, DIR_ENTRY_cluster, parentCluster);
- u16_to_u8array (newEntryData, DIR_ENTRY_clusterHigh, parentCluster >> 16);
-
- // Write it to the directory
- _FAT_cache_writePartialSector ( partition->cache, newEntryData,
- _FAT_fat_clusterToSector (partition, dirCluster), DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
-
- // Flush any sectors in the disc cache
- if (!_FAT_cache_flush(partition->cache)) {
- r->_errno = EIO;
- return -1;
- }
-
- return 0;
-}
-
-DIR_ITER* _FAT_diropen_r(struct _reent *r, DIR_ITER *dirState, const char *path) {
- DIR_ENTRY dirEntry;
- DIR_STATE_STRUCT* state = (DIR_STATE_STRUCT*) (dirState->dirStruct);
- bool fileExists;
-
- state->partition = _FAT_partition_getPartitionFromPath (path);
-
- if (state->partition == NULL) {
- r->_errno = ENODEV;
- return NULL;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return NULL;
- }
- // Get the start cluster of the directory
- fileExists = _FAT_directory_entryFromPath (state->partition, &dirEntry, path, NULL);
-
- if (!fileExists) {
- r->_errno = ENOENT;
- return NULL;
- }
-
- // Make sure it is a directory
- if (! _FAT_directory_isDirectory (&dirEntry)) {
- r->_errno = ENOTDIR;
- return NULL;
- }
-
- // Save the start cluster for use when resetting the directory data
- state->startCluster = _FAT_directory_entryGetCluster (dirEntry.entryData);
-
- // Get the first entry for use with a call to dirnext
- state->validEntry =
- _FAT_directory_getFirstEntry (state->partition, &(state->currentEntry), state->startCluster);
-
- // We are now using this entry
- state->inUse = true;
- return (DIR_ITER*) state;
-}
-
-int _FAT_dirreset_r (struct _reent *r, DIR_ITER *dirState) {
- DIR_STATE_STRUCT* state = (DIR_STATE_STRUCT*) (dirState->dirStruct);
-
- // Make sure we are still using this entry
- if (!state->inUse) {
- r->_errno = EBADF;
- return -1;
- }
-
- // Get the first entry for use with a call to dirnext
- state->validEntry =
- _FAT_directory_getFirstEntry (state->partition, &(state->currentEntry), state->startCluster);
-
- return 0;
-}
-
-int _FAT_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *filestat) {
- DIR_STATE_STRUCT* state = (DIR_STATE_STRUCT*) (dirState->dirStruct);
-
- // Make sure we are still using this entry
- if (!state->inUse) {
- r->_errno = EBADF;
- return -1;
- }
-
- // Make sure there is another file to report on
- if (! state->validEntry) {
- r->_errno = ENOENT;
- return -1;
- }
-
- // Get the filename
- strncpy (filename, state->currentEntry.filename, MAX_FILENAME_LENGTH);
- // Get the stats, if requested
- if (filestat != NULL) {
- _FAT_directory_entryStat (state->partition, &(state->currentEntry), filestat);
- }
-
- // Look for the next entry for use next time
- state->validEntry =
- _FAT_directory_getNextEntry (state->partition, &(state->currentEntry));
-
- return 0;
-}
-
-int _FAT_dirclose_r (struct _reent *r, DIR_ITER *dirState) {
- DIR_STATE_STRUCT* state = (DIR_STATE_STRUCT*) (dirState->dirStruct);
-
- // We are no longer using this entry
- state->inUse = false;
-
- return 0;
-}
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/fatdir.h b/c/src/lib/libbsp/arm/nds/libfat/source/fatdir.h
deleted file mode 100644
index 48d0cdf0dd..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/fatdir.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- fatdir.h
-
- Functions used by the newlib disc stubs to interface with
- this library
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
- * Added _FAT_mkdir_r
-
- 2006-08-14 - Chishm
- * Added directory iterator functions
-
- 2007-01-10 - Chishm
- * Updated directory iterator functions for DevkitPro r20
-*/
-
-
-#ifndef _FATDIR_H
-#define _FATDIR_H
-
-#include <sys/reent.h>
-#include <sys/stat.h>
-#include <sys/iosupport.h>
-#include "common.h"
-#include "directory.h"
-
-typedef struct {
- PARTITION* partition;
- DIR_ENTRY currentEntry;
- u32 startCluster;
- bool inUse;
- bool validEntry;
-} DIR_STATE_STRUCT;
-
-extern int _FAT_stat_r (struct _reent *r, const char *path, struct stat *st);
-
-extern int _FAT_link_r (struct _reent *r, const char *existing, const char *newLink);
-
-extern int _FAT_unlink_r (struct _reent *r, const char *name);
-
-extern int _FAT_chdir_r (struct _reent *r, const char *name);
-
-extern int _FAT_rename_r (struct _reent *r, const char *oldName, const char *newName);
-
-extern int _FAT_mkdir_r (struct _reent *r, const char *path, int mode);
-
-/*
-Directory iterator functions
-*/
-extern DIR_ITER* _FAT_diropen_r(struct _reent *r, DIR_ITER *dirState, const char *path);
-extern int _FAT_dirreset_r (struct _reent *r, DIR_ITER *dirState);
-extern int _FAT_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *filestat);
-extern int _FAT_dirclose_r (struct _reent *r, DIR_ITER *dirState);
-
-
-#endif // _FATDIR_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/fatfile.c b/c/src/lib/libbsp/arm/nds/libfat/source/fatfile.c
deleted file mode 100644
index 17151ab6fa..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/fatfile.c
+++ /dev/null
@@ -1,815 +0,0 @@
-/*
- fatfile.c
-
- Functions used by the newlib disc stubs to interface with
- this library
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-17 - Chishm
- * Made all path inputs const char*
- * Added _FAT_rename_r
-
- 2006-08-02 - Chishm
- * Fixed _FAT_seek_r
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
-*/
-
-
-#include "fatfile.h"
-
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <unistd.h>
-
-#include "cache.h"
-#include "file_allocation_table.h"
-#include "bit_ops.h"
-#include "filetime.h"
-
-int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode) {
- PARTITION* partition = NULL;
- bool fileExists;
- DIR_ENTRY dirEntry;
- const char* pathEnd;
- u32 dirCluster;
- FILE_STRUCT* file = (FILE_STRUCT*) fileStruct;
- partition = _FAT_partition_getPartitionFromPath (path);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Determine which mode the file is openned for
- if ((flags & 0x03) == O_RDONLY) {
- // Open the file for read-only access
- file->read = true;
- file->write = false;
- file->append = false;
- } else if ((flags & 0x03) == O_WRONLY) {
- // Open file for write only access
- file->read = false;
- file->write = true;
- file->append = false;
- } else if ((flags & 0x03) == O_RDWR) {
- // Open file for read/write access
- file->read = true;
- file->write = true;
- file->append = false;
- } else {
- r->_errno = EACCES;
- return -1;
- }
-
- // Make sure we aren't trying to write to a read-only disc
- if (file->write && partition->readOnly) {
- r->_errno = EROFS;
- return -1;
- }
-
- // Search for the file on the disc
- fileExists = _FAT_directory_entryFromPath (partition, &dirEntry, path, NULL);
-
- // The file shouldn't exist if we are trying to create it
- if ((flags & O_CREAT) && (flags & O_EXCL) && fileExists) {
- r->_errno = EEXIST;
- return -1;
- }
-
- // It should not be a directory if we're openning a file,
- if (fileExists && _FAT_directory_isDirectory(&dirEntry)) {
- r->_errno = EISDIR;
- return -1;
- }
-
- // If the file doesn't exist, create it if we're allowed to
- if (!fileExists) {
- if (flags & O_CREAT) {
- if (partition->readOnly) {
- // We can't write to a read-only partition
- r->_errno = EROFS;
- return -1;
- }
- // Create the file
- // Get the directory it has to go in
- pathEnd = strrchr (path, DIR_SEPARATOR);
- if (pathEnd == NULL) {
- // No path was specified
- dirCluster = partition->cwdCluster;
- pathEnd = path;
- } else {
- // Path was specified -- get the right dirCluster
- // Recycling dirEntry, since it needs to be recreated anyway
- if (!_FAT_directory_entryFromPath (partition, &dirEntry, path, pathEnd) ||
- !_FAT_directory_isDirectory(&dirEntry)) {
- r->_errno = ENOTDIR;
- return -1;
- }
- dirCluster = _FAT_directory_entryGetCluster (dirEntry.entryData);
- // Move the pathEnd past the last DIR_SEPARATOR
- pathEnd += 1;
- }
- // Create the entry data
- strncpy (dirEntry.filename, pathEnd, MAX_FILENAME_LENGTH - 1);
- memset (dirEntry.entryData, 0, DIR_ENTRY_DATA_SIZE);
-
- // Set the creation time and date
- dirEntry.entryData[DIR_ENTRY_cTime_ms] = 0;
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_cTime, _FAT_filetime_getTimeFromRTC());
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_cDate, _FAT_filetime_getDateFromRTC());
-
- if (!_FAT_directory_addEntry (partition, &dirEntry, dirCluster)) {
- r->_errno = ENOSPC;
- return -1;
- }
- } else {
- // file doesn't exist, and we aren't creating it
- r->_errno = ENOENT;
- return -1;
- }
- }
-
- file->filesize = u8array_to_u32 (dirEntry.entryData, DIR_ENTRY_fileSize);
-
- /* Allow LARGEFILEs with undefined results
- // Make sure that the file size can fit in the available space
- if (!(flags & O_LARGEFILE) && (file->filesize >= (1<<31))) {
- r->_errno = EFBIG;
- return -1;
- }
- */
-
- // Make sure we aren't trying to write to a read-only file
- if (file->write && !_FAT_directory_isWritable(&dirEntry)) {
- r->_errno = EROFS;
- return -1;
- }
-
- // Associate this file with a particular partition
- file->partition = partition;
-
- file->startCluster = _FAT_directory_entryGetCluster (dirEntry.entryData);
-
- // Truncate the file if requested
- if ((flags & O_TRUNC) && file->write && (file->startCluster != 0)) {
- _FAT_fat_clearLinks (partition, file->startCluster);
- file->startCluster = 0;
- file->filesize = 0;
- }
-
- // Get a new cluster for the file if required
- if (file->startCluster == 0) {
- file->startCluster = _FAT_fat_linkFreeCluster (partition, CLUSTER_FREE);
- }
-
- // Remember the position of this file's directory entry
- file->dirEntryStart = dirEntry.dataStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
- file->dirEntryEnd = dirEntry.dataEnd;
-
- file->currentPosition = 0;
-
- file->rwPosition.cluster = file->startCluster;
- file->rwPosition.sector = 0;
- file->rwPosition.byte = 0;
-
- file->appendPosition.cluster = _FAT_fat_lastCluster (partition, file->startCluster);
- file->appendPosition.sector = (file->filesize % partition->bytesPerCluster) / BYTES_PER_READ;
- file->appendPosition.byte = file->filesize % BYTES_PER_READ;
-
- // Check if the end of the file is on the end of a cluster
- if ( (file->filesize > 0) && ((file->filesize % partition->bytesPerCluster)==0) ){
- // Set flag to allocate a new cluster
- file->appendPosition.sector = partition->sectorsPerCluster;
- file->appendPosition.byte = 0;
- }
-
- if (flags & O_APPEND) {
- file->append = true;
- }
-
- file->inUse = true;
-
- partition->openFileCount += 1;
-
- return (int) file;
-}
-
-int _FAT_close_r (struct _reent *r, int fd) {
- FILE_STRUCT* file = (FILE_STRUCT*) fd;
- u8 dirEntryData[DIR_ENTRY_DATA_SIZE];
-
- if (!file->inUse) {
- r->_errno = EBADF;
- return -1;
- }
- if (file->write) {
- // Load the old entry
- _FAT_cache_readPartialSector (file->partition->cache, dirEntryData,
- _FAT_fat_clusterToSector(file->partition, file->dirEntryEnd.cluster) + file->dirEntryEnd.sector,
- file->dirEntryEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
-
- // Write new data to the directory entry
- // File size
- u32_to_u8array (dirEntryData, DIR_ENTRY_fileSize, file->filesize);
-
- // Start cluster
- u16_to_u8array (dirEntryData, DIR_ENTRY_cluster, file->startCluster);
- u16_to_u8array (dirEntryData, DIR_ENTRY_clusterHigh, file->startCluster >> 16);
-
- // Modification time and date
- u16_to_u8array (dirEntryData, DIR_ENTRY_mTime, _FAT_filetime_getTimeFromRTC());
- u16_to_u8array (dirEntryData, DIR_ENTRY_mDate, _FAT_filetime_getDateFromRTC());
-
- // Access date
- u16_to_u8array (dirEntryData, DIR_ENTRY_aDate, _FAT_filetime_getDateFromRTC());
-
- // Write the new entry
- _FAT_cache_writePartialSector (file->partition->cache, dirEntryData,
- _FAT_fat_clusterToSector(file->partition, file->dirEntryEnd.cluster) + file->dirEntryEnd.sector,
- file->dirEntryEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
-
- // Flush any sectors in the disc cache
- if (!_FAT_cache_flush(file->partition->cache)) {
- r->_errno = EIO;
- return -1;
- }
- }
-
- file->inUse = false;
- file->partition->openFileCount -= 1;
-
- return 0;
-}
-
-int _FAT_read_r (struct _reent *r, int fd, char *ptr, int len) {
- FILE_STRUCT* file = (FILE_STRUCT*) fd;
-
- PARTITION* partition;
- CACHE* cache;
-
- FILE_POSITION position;
- u32 tempNextCluster;
-
- int tempVar;
-
- u32 remain;
-
- bool flagNoError = true;
-
- // Make sure we can actually read from the file
- if ((file == NULL) || !file->inUse || !file->read) {
- r->_errno = EBADF;
- return 0;
- }
-
- // Don't try to read if the read pointer is past the end of file
- if (file->currentPosition >= file->filesize) {
- return 0;
- }
-
- // Don't read past end of file
- if (len + file->currentPosition > file->filesize) {
- r->_errno = EOVERFLOW;
- len = file->filesize - file->currentPosition;
- }
-
- remain = len;
-
- position = file->rwPosition;
-
- partition = file->partition;
- cache = file->partition->cache;
-
- // Align to sector
- tempVar = BYTES_PER_READ - position.byte;
- if (tempVar > remain) {
- tempVar = remain;
- }
-
- if ((tempVar < BYTES_PER_READ) && flagNoError)
- {
- _FAT_cache_readPartialSector ( cache, ptr, _FAT_fat_clusterToSector (partition, position.cluster) + position.sector,
- position.byte, tempVar);
-
- remain -= tempVar;
- ptr += tempVar;
-
- position.byte += tempVar;
- if (position.byte >= BYTES_PER_READ) {
- position.byte = 0;
- position.sector++;
- }
- }
-
- // align to cluster
- // tempVar is number of sectors to read
- if (remain > (partition->sectorsPerCluster - position.sector) * BYTES_PER_READ) {
- tempVar = partition->sectorsPerCluster - position.sector;
- } else {
- tempVar = remain / BYTES_PER_READ;
- }
-
- if ((tempVar > 0) && flagNoError) {
- _FAT_disc_readSectors (partition->disc, _FAT_fat_clusterToSector (partition, position.cluster) + position.sector,
- tempVar, ptr);
- ptr += tempVar * BYTES_PER_READ;
- remain -= tempVar * BYTES_PER_READ;
- position.sector += tempVar;
- }
-
- // Move onto next cluster
- // It should get to here without reading anything if a cluster is due to be allocated
- if (position.sector >= partition->sectorsPerCluster) {
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((remain == 0) && (tempNextCluster == CLUSTER_EOF)) {
- position.sector = partition->sectorsPerCluster;
- } else if (tempNextCluster == CLUSTER_FREE) {
- r->_errno = EIO;
- flagNoError = false;
- } else {
- position.sector = 0;
- position.cluster = tempNextCluster;
- }
- }
-
- // Read in whole clusters
- while ((remain >= partition->bytesPerCluster) && flagNoError) {
- _FAT_disc_readSectors (partition->disc, _FAT_fat_clusterToSector (partition, position.cluster), partition->sectorsPerCluster, ptr);
- ptr += partition->bytesPerCluster;
- remain -= partition->bytesPerCluster;
-
- // Advance to next cluster
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((remain == 0) && (tempNextCluster == CLUSTER_EOF)) {
- position.sector = partition->sectorsPerCluster;
- } else if (tempNextCluster == CLUSTER_FREE) {
- r->_errno = EIO;
- flagNoError = false;
- } else {
- position.sector = 0;
- position.cluster = tempNextCluster;
- }
- }
-
- // Read remaining sectors
- tempVar = remain / BYTES_PER_READ; // Number of sectors left
- if ((tempVar > 0) && flagNoError) {
- _FAT_disc_readSectors (partition->disc, _FAT_fat_clusterToSector (partition, position.cluster),
- tempVar, ptr);
- ptr += tempVar * BYTES_PER_READ;
- remain -= tempVar * BYTES_PER_READ;
- position.sector += tempVar;
- }
-
- // Last remaining sector
- // Check if anything is left
- if ((remain > 0) && flagNoError) {
- _FAT_cache_readPartialSector ( cache, ptr,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 0, remain);
- position.byte += remain;
- remain = 0;
- }
-
- // Length read is the wanted length minus the stuff not read
- len = len - remain;
-
- // Update file information
- file->rwPosition = position;
- file->currentPosition += len;
- return len;
-}
-
-/*
-Extend a file so that the size is the same as the rwPosition
-*/
-static bool file_extend_r (struct _reent *r, FILE_STRUCT* file) {
- PARTITION* partition = file->partition;
- CACHE* cache = file->partition->cache;
-
- FILE_POSITION position;
-
- u32 remain;
-
- u8 zeroBuffer [BYTES_PER_READ] = {0};
-
- u32 tempNextCluster;
-
- position.byte = file->filesize % BYTES_PER_READ;
- position.sector = (file->filesize % partition->bytesPerCluster) / BYTES_PER_READ;
- position.cluster = _FAT_fat_lastCluster (partition, file->startCluster);
-
- remain = file->currentPosition - file->filesize;
-
-
- // Only need to clear to the end of the sector
- if (remain + position.byte < BYTES_PER_READ) {
- _FAT_cache_writePartialSector (cache, zeroBuffer,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, position.byte, remain);
- position.byte += remain;
- } else {
- if (position.byte > 0) {
- _FAT_cache_writePartialSector (cache, zeroBuffer,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, position.byte,
- BYTES_PER_READ - position.byte);
- remain -= (BYTES_PER_READ - position.byte);
- position.byte = 0;
- position.sector ++;
- }
-
- while (remain >= BYTES_PER_READ) {
- if (position.sector >= partition->sectorsPerCluster) {
- position.sector = 0;
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- return false;
- } else {
- position.cluster = tempNextCluster;
- }
- }
-
- _FAT_disc_writeSectors (partition->disc,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 1, zeroBuffer);
-
- remain -= BYTES_PER_READ;
- position.sector ++;
- }
-
- if (position.sector >= partition->sectorsPerCluster) {
- position.sector = 0;
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- return false;
- } else {
- position.cluster = tempNextCluster;
- }
- }
-
- if (remain > 0) {
- _FAT_cache_writePartialSector (cache, zeroBuffer,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 0, remain);
- position.byte = remain;
- }
- }
-
- file->rwPosition = position;
- file->filesize = file->currentPosition;
- return true;
-}
-
-
-int _FAT_write_r (struct _reent *r,int fd, const char *ptr, int len) {
- FILE_STRUCT* file = (FILE_STRUCT*) fd;
-
- PARTITION* partition;
- CACHE* cache;
-
- FILE_POSITION position;
- u32 tempNextCluster;
-
- int tempVar;
-
- u32 remain;
-
- bool flagNoError = true;
- bool flagAppending = false;
-
- // Make sure we can actually write to the file
- if ((file == NULL) || !file->inUse || !file->write) {
- r->_errno = EBADF;
- return -1;
- }
-
- partition = file->partition;
- cache = file->partition->cache;
- remain = len;
-
- if (file->append) {
- position = file->appendPosition;
- flagAppending = true;
- } else {
- // If the write pointer is past the end of the file, extend the file to that size
- if (file->currentPosition > file->filesize) {
- if (!file_extend_r (r, file)) {
- return 0;
- }
- }
-
- // Write at current read pointer
- position = file->rwPosition;
-
- // If it is writing past the current end of file, set appending flag
- if (len + file->currentPosition > file->filesize) {
- flagAppending = true;
- }
- }
-
- // Move onto next cluster if needed
- if (position.sector >= partition->sectorsPerCluster) {
- position.sector = 0;
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- flagNoError = false;
- } else {
- position.cluster = tempNextCluster;
- }
- }
-
- // Align to sector
- tempVar = BYTES_PER_READ - position.byte;
- if (tempVar > remain) {
- tempVar = remain;
- }
-
- if ((tempVar < BYTES_PER_READ) && flagNoError) {
- // Write partial sector to disk
- _FAT_cache_writePartialSector (cache, ptr,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, position.byte, tempVar);
-
- remain -= tempVar;
- ptr += tempVar;
- position.byte += tempVar;
-
-
- // Move onto next sector
- if (position.byte >= BYTES_PER_READ) {
- position.byte = 0;
- position.sector ++;
- }
- }
-
- // Align to cluster
- // tempVar is number of sectors to write
- if (remain > (partition->sectorsPerCluster - position.sector) * BYTES_PER_READ) {
- tempVar = partition->sectorsPerCluster - position.sector;
- } else {
- tempVar = remain / BYTES_PER_READ;
- }
-
- if ((tempVar > 0) && flagNoError) {
- _FAT_disc_writeSectors (partition->disc,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, tempVar, ptr);
- ptr += tempVar * BYTES_PER_READ;
- remain -= tempVar * BYTES_PER_READ;
- position.sector += tempVar;
- }
-
- if ((position.sector >= partition->sectorsPerCluster) && flagNoError && (remain > 0)) {
- position.sector = 0;
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- flagNoError = false;
- } else {
- position.cluster = tempNextCluster;
- }
- }
-
- // Write whole clusters
- while ((remain >= partition->bytesPerCluster) && flagNoError) {
- _FAT_disc_writeSectors (partition->disc, _FAT_fat_clusterToSector(partition, position.cluster),
- partition->sectorsPerCluster, ptr);
- ptr += partition->bytesPerCluster;
- remain -= partition->bytesPerCluster;
- if (remain > 0) {
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- flagNoError = false;
- } else {
- position.cluster = tempNextCluster;
- }
- } else {
- // Allocate a new cluster when next writing the file
- position.sector = partition->sectorsPerCluster;
- }
- }
-
- // Write remaining sectors
- tempVar = remain / BYTES_PER_READ; // Number of sectors left
- if ((tempVar > 0) && flagNoError) {
- _FAT_disc_writeSectors (partition->disc, _FAT_fat_clusterToSector (partition, position.cluster),
- tempVar, ptr);
- ptr += tempVar * BYTES_PER_READ;
- remain -= tempVar * BYTES_PER_READ;
- position.sector += tempVar;
- }
-
- // Last remaining sector
- if ((remain > 0) && flagNoError) {
- if (flagAppending) {
- _FAT_cache_eraseWritePartialSector ( cache, ptr,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 0, remain);
- } else {
- _FAT_cache_writePartialSector ( cache, ptr,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 0, remain);
- }
- position.byte += remain;
- remain = 0;
- }
-
-
- // Amount read is the originally requested amount minus stuff remaining
- len = len - remain;
-
- // Update file information
- if (file->append) {
- // Appending doesn't affect the read pointer
- file->appendPosition = position;
- file->filesize += len;
- } else {
- // Writing also shifts the read pointer
- file->rwPosition = position;
- file->currentPosition += len;
- if (file->filesize < file->currentPosition) {
- file->filesize = file->currentPosition;
- }
- }
-
- return len;
-}
-
-
-int _FAT_seek_r (struct _reent *r, int fd, int pos, int dir) {
- FILE_STRUCT* file = (FILE_STRUCT*) fd;
-
- PARTITION* partition;
-
- u32 cluster, nextCluster;
- int clusCount;
- int position;
-
- if ((file == NULL) || (file->inUse == false)) {
- // invalid file
- r->_errno = EBADF;
- return -1;
- }
-
- partition = file->partition;
-
- switch (dir) {
- case SEEK_SET:
- position = pos;
- break;
- case SEEK_CUR:
- position = file->currentPosition + pos;
- break;
- case SEEK_END:
- position = file->filesize + pos;
- break;
- default:
- r->_errno = EINVAL;
- return -1;
- }
-
- if ((pos > 0) && (position < 0)) {
- r->_errno = EOVERFLOW;
- return -1;
- }
-
- if (position < 0) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Only change the read/write position if it is within the bounds of the current filesize
- if (file->filesize > position) {
-
- // Calculate the sector and byte of the current position,
- // and store them
- file->rwPosition.sector = (position % partition->bytesPerCluster) / BYTES_PER_READ;
- file->rwPosition.byte = position % BYTES_PER_READ;
-
- // Calculate where the correct cluster is
- if (position >= file->currentPosition) {
- clusCount = (position / partition->bytesPerCluster) - (file->currentPosition / partition->bytesPerCluster);
- cluster = file->rwPosition.cluster;
- } else {
- clusCount = position / partition->bytesPerCluster;
- cluster = file->startCluster;
- }
-
- nextCluster = _FAT_fat_nextCluster (partition, cluster);
- while ((clusCount > 0) && (nextCluster != CLUSTER_FREE) && (nextCluster != CLUSTER_EOF)) {
- clusCount--;
- cluster = nextCluster;
- nextCluster = _FAT_fat_nextCluster (partition, cluster);
- }
-
- // Check if ran out of clusters, and the file is being written to
- if ((clusCount > 0) && (file->write || file->append)) {
- // Set flag to allocate a new cluster
- file->rwPosition.sector = partition->sectorsPerCluster;
- file->rwPosition.byte = 0;
- }
-
- file->rwPosition.cluster = cluster;
- }
-
- // Save position
- file->currentPosition = position;
-
- return position;
-}
-
-
-
-int _FAT_fstat_r (struct _reent *r, int fd, struct stat *st) {
- FILE_STRUCT* file = (FILE_STRUCT*) fd;
-
- PARTITION* partition;
-
- DIR_ENTRY fileEntry;
-
- if ((file == NULL) || (file->inUse == false)) {
- // invalid file
- r->_errno = EBADF;
- return -1;
- }
-
- partition = file->partition;
-
- // Get the file's entry data
- fileEntry.dataStart = file->dirEntryStart;
- fileEntry.dataEnd = file->dirEntryEnd;
-
- if (!_FAT_directory_entryFromPosition (partition, &fileEntry)) {
- r->_errno = EIO;
- return -1;
- }
-
- // Fill in the stat struct
- _FAT_directory_entryStat (partition, &fileEntry, st);
-
- // Fix stats that have changed since the file was openned
- st->st_ino = (ino_t)(file->startCluster); // The file serial number is the start cluster
- st->st_size = file->filesize; // File size
-
- return 0;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/fatfile.h b/c/src/lib/libbsp/arm/nds/libfat/source/fatfile.h
deleted file mode 100644
index 2258045d7a..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/fatfile.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- fatfile.h
-
- Functions used by the newlib disc stubs to interface with
- this library
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-17 - Chishm
- * Made all path inputs const char*
- * Added _FAT_rename_r
-
- 2006-07-24 - Chishm
- * Removed padding workaround from FILE_STRUCT
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
-*/
-
-
-#ifndef _FATFILE_H
-#define _FATFILE_H
-
-#include <sys/reent.h>
-#include <sys/stat.h>
-
-#include "common.h"
-#include "partition.h"
-#include "directory.h"
-
-typedef struct {
- u32 cluster;
- u32 sector;
- s32 byte;
-} FILE_POSITION;
-
-typedef struct {
- u32 filesize;
- u32 startCluster;
- u32 currentPosition;
- FILE_POSITION rwPosition;
- FILE_POSITION appendPosition;
- bool read;
- bool write;
- bool append;
- bool inUse;
- PARTITION* partition;
- DIR_ENTRY_POSITION dirEntryStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
- DIR_ENTRY_POSITION dirEntryEnd; // Always points to the file's alias entry
-} FILE_STRUCT;
-
-extern int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode);
-
-extern int _FAT_close_r (struct _reent *r, int fd);
-
-extern int _FAT_write_r (struct _reent *r,int fd, const char *ptr, int len);
-
-extern int _FAT_read_r (struct _reent *r, int fd, char *ptr, int len);
-
-extern int _FAT_seek_r (struct _reent *r, int fd,int pos, int dir);
-
-extern int _FAT_fstat_r (struct _reent *r, int fd, struct stat *st);
-
-extern int _FAT_stat_r (struct _reent *r, const char *path, struct stat *st);
-
-extern int _FAT_link_r (struct _reent *r, const char *existing, const char *newLink);
-
-extern int _FAT_unlink_r (struct _reent *r, const char *name);
-
-extern int _FAT_chdir_r (struct _reent *r, const char *name);
-
-extern int _FAT_rename_r (struct _reent *r, const char *oldName, const char *newName);
-
-#endif // _FATFILE_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/file_allocation_table.c b/c/src/lib/libbsp/arm/nds/libfat/source/file_allocation_table.c
deleted file mode 100644
index f85ec3b196..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/file_allocation_table.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- file_allocation_table.c
- Reading, writing and manipulation of the FAT structure on
- a FAT partition
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-11 - Chishm
- * Made several fixes related to free clusters, thanks to Loopy
-
- 2006-10-01 - Chishm
- * Added _FAT_fat_linkFreeClusterCleared to clear a cluster when it is allocated
-*/
-
-
-#include "file_allocation_table.h"
-#include "partition.h"
-#include <string.h>
-
-/*
-Gets the cluster linked from input cluster
-*/
-u32 _FAT_fat_nextCluster(PARTITION* partition, u32 cluster)
-{
- u32 nextCluster = CLUSTER_FREE;
- u32 sector;
- int offset;
-
- switch (partition->filesysType)
- {
- case FS_UNKNOWN:
- nextCluster = CLUSTER_FREE;
- break;
-
- case FS_FAT12:
- sector = partition->fat.fatStart + (((cluster * 3) / 2) / BYTES_PER_READ);
- offset = ((cluster * 3) / 2) % BYTES_PER_READ;
-
-
- _FAT_cache_readPartialSector (partition->cache, &nextCluster, sector, offset, sizeof(u8));
-
- offset++;
-
- if (offset >= BYTES_PER_READ) {
- offset = 0;
- sector++;
- }
-
- _FAT_cache_readPartialSector (partition->cache, ((u8*)&nextCluster) + sizeof(u8), sector, offset, sizeof(u8));
-
- if (cluster & 0x01) {
- nextCluster = nextCluster >> 4;
- } else {
- nextCluster &= 0x0FFF;
- }
-
- if (nextCluster >= 0x0FF7)
- {
- nextCluster = CLUSTER_EOF;
- }
-
- break;
-
- case FS_FAT16:
- sector = partition->fat.fatStart + ((cluster << 1) / BYTES_PER_READ);
- offset = (cluster % (BYTES_PER_READ >> 1)) << 1;
-
- _FAT_cache_readPartialSector (partition->cache, &nextCluster, sector, offset, sizeof(u16));
-
- if (nextCluster >= 0xFFF7)
- {
- nextCluster = CLUSTER_EOF;
- }
- break;
-
- case FS_FAT32:
- sector = partition->fat.fatStart + ((cluster << 2) / BYTES_PER_READ);
- offset = (cluster % (BYTES_PER_READ >> 2)) << 2;
-
- _FAT_cache_readPartialSector (partition->cache, &nextCluster, sector, offset, sizeof(u32));
-
- if (nextCluster >= 0x0FFFFFF7)
- {
- nextCluster = CLUSTER_EOF;
- }
- break;
-
- default:
- nextCluster = CLUSTER_FREE;
- break;
- }
-
- return nextCluster;
-}
-
-/*
-writes value into the correct offset within a partition's FAT, based
-on the cluster number.
-*/
-static bool _FAT_fat_writeFatEntry (PARTITION* partition, u32 cluster, u32 value) {
- u32 sector;
- int offset;
- u8 oldValue;
-
- if ((cluster < 0x0002) || (cluster > partition->fat.lastCluster))
- {
- return false;
- }
-
- switch (partition->filesysType)
- {
- case FS_UNKNOWN:
- return false;
- break;
-
- case FS_FAT12:
- sector = partition->fat.fatStart + (((cluster * 3) / 2) / BYTES_PER_READ);
- offset = ((cluster * 3) / 2) % BYTES_PER_READ;
-
- if (cluster & 0x01) {
-
- _FAT_cache_readPartialSector (partition->cache, &oldValue, sector, offset, sizeof(u8));
-
- value = (value << 4) | (oldValue & 0x0F);
-
- _FAT_cache_writePartialSector (partition->cache, &value, sector, offset, sizeof(u8));
-
- offset++;
- if (offset >= BYTES_PER_READ) {
- offset = 0;
- sector++;
- }
-
- _FAT_cache_writePartialSector (partition->cache, ((u8*)&value) + sizeof(u8), sector, offset, sizeof(u8));
-
- } else {
-
- _FAT_cache_writePartialSector (partition->cache, &value, sector, offset, sizeof(u8));
-
- offset++;
- if (offset >= BYTES_PER_READ) {
- offset = 0;
- sector++;
- }
-
- _FAT_cache_readPartialSector (partition->cache, &oldValue, sector, offset, sizeof(u8));
-
- value = ((value >> 8) & 0x0F) | (oldValue & 0xF0);
-
- _FAT_cache_writePartialSector (partition->cache, &value, sector, offset, sizeof(u8));
- }
-
- break;
-
- case FS_FAT16:
- sector = partition->fat.fatStart + ((cluster << 1) / BYTES_PER_READ);
- offset = (cluster % (BYTES_PER_READ >> 1)) << 1;
-
- _FAT_cache_writePartialSector (partition->cache, &value, sector, offset, sizeof(u16));
-
- break;
-
- case FS_FAT32:
- sector = partition->fat.fatStart + ((cluster << 2) / BYTES_PER_READ);
- offset = (cluster % (BYTES_PER_READ >> 2)) << 2;
-
- _FAT_cache_writePartialSector (partition->cache, &value, sector, offset, sizeof(u32));
-
- break;
-
- default:
- return false;
- break;
- }
-
- return true;
-}
-
-/*-----------------------------------------------------------------
-gets the first available free cluster, sets it
-to end of file, links the input cluster to it then returns the
-cluster number
-If an error occurs, return CLUSTER_FREE
------------------------------------------------------------------*/
-u32 _FAT_fat_linkFreeCluster(PARTITION* partition, u32 cluster) {
- u32 firstFree;
- u32 curLink;
- u32 lastCluster;
- bool loopedAroundFAT = false;
-
- lastCluster = partition->fat.lastCluster;
-
- if (cluster > lastCluster) {
- return CLUSTER_FREE;
- }
-
- // Check if the cluster already has a link, and return it if so
- curLink = _FAT_fat_nextCluster(partition, cluster);
- if ((curLink >= CLUSTER_FIRST) && (curLink <= lastCluster)) {
- return curLink; // Return the current link - don't allocate a new one
- }
-
- // Get a free cluster
- firstFree = partition->fat.firstFree;
- // Start at first valid cluster
- if (firstFree < CLUSTER_FIRST) {
- firstFree = CLUSTER_FIRST;
- }
-
- // Search until a free cluster is found
- while (_FAT_fat_nextCluster(partition, firstFree) != CLUSTER_FREE) {
- firstFree++;
- if (firstFree > lastCluster) {
- if (loopedAroundFAT) {
- // If couldn't get a free cluster then return, saying this fact
- partition->fat.firstFree = firstFree;
- return CLUSTER_FREE;
- } else {
- // Try looping back to the beginning of the FAT
- // This was suggested by loopy
- firstFree = CLUSTER_FIRST;
- loopedAroundFAT = true;
- }
- }
- }
- partition->fat.firstFree = firstFree;
-
- if ((cluster >= CLUSTER_FIRST) && (cluster < lastCluster))
- {
- // Update the linked from FAT entry
- _FAT_fat_writeFatEntry (partition, cluster, firstFree);
- }
- // Create the linked to FAT entry
- _FAT_fat_writeFatEntry (partition, firstFree, CLUSTER_EOF);
-
- return firstFree;
-}
-
-/*-----------------------------------------------------------------
-gets the first available free cluster, sets it
-to end of file, links the input cluster to it, clears the new
-cluster to 0 valued bytes, then returns the cluster number
-If an error occurs, return CLUSTER_FREE
------------------------------------------------------------------*/
-u32 _FAT_fat_linkFreeClusterCleared (PARTITION* partition, u32 cluster) {
- u32 newCluster;
- int i;
- u8 emptySector[BYTES_PER_READ];
-
- // Link the cluster
- newCluster = _FAT_fat_linkFreeCluster(partition, cluster);
-
- if (newCluster == CLUSTER_FREE) {
- return CLUSTER_FREE;
- }
-
- // Clear all the sectors within the cluster
- memset (emptySector, 0, BYTES_PER_READ);
- for (i = 0; i < partition->sectorsPerCluster; i++) {
- _FAT_disc_writeSectors (partition->disc,
- _FAT_fat_clusterToSector (partition, newCluster) + i,
- 1, emptySector);
- }
-
- return newCluster;
-}
-
-
-/*-----------------------------------------------------------------
-_FAT_fat_clearLinks
-frees any cluster used by a file
------------------------------------------------------------------*/
-bool _FAT_fat_clearLinks (PARTITION* partition, u32 cluster) {
- u32 nextCluster;
-
- if ((cluster < 0x0002) || (cluster > partition->fat.lastCluster))
- return false;
-
- // If this clears up more space in the FAT before the current free pointer, move it backwards
- if (cluster < partition->fat.firstFree) {
- partition->fat.firstFree = cluster;
- }
-
- while ((cluster != CLUSTER_EOF) && (cluster != CLUSTER_FREE)) {
- // Store next cluster before erasing the link
- nextCluster = _FAT_fat_nextCluster (partition, cluster);
-
- // Erase the link
- _FAT_fat_writeFatEntry (partition, cluster, CLUSTER_FREE);
-
- // Move onto next cluster
- cluster = nextCluster;
- }
-
- return true;
-}
-
-/*-----------------------------------------------------------------
-_FAT_fat_lastCluster
-Trace the cluster links until the last one is found
------------------------------------------------------------------*/
-u32 _FAT_fat_lastCluster (PARTITION* partition, u32 cluster) {
- while ((_FAT_fat_nextCluster(partition, cluster) != CLUSTER_FREE) && (_FAT_fat_nextCluster(partition, cluster) != CLUSTER_EOF)) {
- cluster = _FAT_fat_nextCluster(partition, cluster);
- }
- return cluster;
-}
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/file_allocation_table.h b/c/src/lib/libbsp/arm/nds/libfat/source/file_allocation_table.h
deleted file mode 100644
index 21ed549e7e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/file_allocation_table.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- file_allocation_table.h
- Reading, writing and manipulation of the FAT structure on
- a FAT partition
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-10-01 - Chishm
- * Added _FAT_fat_linkFreeClusterCleared to clear a cluster when it is allocated
-*/
-
-#ifndef _FAT_H
-#define _FAT_H
-
-#include "common.h"
-#include "partition.h"
-
-#define CLUSTER_EOF_16 0xFFFF
-#define CLUSTER_EOF 0x0FFFFFFF
-#define CLUSTER_FREE 0x0000
-#define CLUSTER_FIRST 0x0002
-
-#define CLUSTERS_PER_FAT12 4085
-#define CLUSTERS_PER_FAT16 65525
-
-
-u32 _FAT_fat_nextCluster(PARTITION* partition, u32 cluster);
-
-u32 _FAT_fat_linkFreeCluster(PARTITION* partition, u32 cluster);
-u32 _FAT_fat_linkFreeClusterCleared (PARTITION* partition, u32 cluster);
-
-bool _FAT_fat_clearLinks (PARTITION* partition, u32 cluster);
-
-u32 _FAT_fat_lastCluster (PARTITION* partition, u32 cluster);
-
-static inline u32 _FAT_fat_clusterToSector (PARTITION* partition, u32 cluster) {
- return (cluster >= 2) ? ((cluster - 2) * partition->sectorsPerCluster) + partition->dataStart : partition->rootDirStart;
-}
-
-#endif // _FAT_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/filetime.c b/c/src/lib/libbsp/arm/nds/libfat/source/filetime.c
deleted file mode 100644
index 4619225d71..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/filetime.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- filetime.c
- Conversion of file time and date values to various other types
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-09-30 - Chishm
- * Validity checks performed on the time supplied by the IPC
- * Cleaned up magic numbers
-
- 2006-10-01 - Chishm
- * Fixed incorrect use of bitwise-or instead of logical-or
-*/
-
-
-#include "filetime.h"
-
-#ifdef NDS
-#include <nds/ipc.h>
-#endif
-
-#define HOUR_PM_INDICATOR 40
-
-#define MAX_HOUR 23
-#define MAX_MINUTE 59
-#define MAX_SECOND 59
-
-#define MAX_YEAR 99
-#define MIN_YEAR 6 // The date is invalid if it's before this year
-#define MAX_MONTH 12
-#define MIN_MONTH 1
-#define MAX_DAY 31
-#define MIN_DAY 1
-
-// Second values are averages, so time value won't be 100% accurate,
-// but should be within the correct month.
-#define SECONDS_PER_MINUTE 60
-#define SECONDS_PER_HOUR 3600
-#define SECONDS_PER_DAY 86400
-#define SECONDS_PER_MONTH 2629743
-#define SECONDS_PER_YEAR 31556926
-
-u16 _FAT_filetime_getTimeFromRTC (void) {
-#ifdef NDS
- int hour, minute, second;
- hour = (IPC->time.rtc.hours >= HOUR_PM_INDICATOR ? IPC->time.rtc.hours - HOUR_PM_INDICATOR : IPC->time.rtc.hours);
- minute = IPC->time.rtc.minutes;
- second = IPC->time.rtc.seconds;
-
- // Check that the values are all in range.
- // If they are not, return 0 (no timestamp)
- if ((hour < 0) || (hour > MAX_HOUR)) return 0;
- if ((minute < 0) || (minute > MAX_MINUTE)) return 0;
- if ((second < 0) || (second > MAX_SECOND)) return 0;
-
- return (
- ((hour & 0x1F) << 11) |
- ((minute & 0x3F) << 5) |
- ((second >> 1) & 0x1F)
- );
-#else
- return 0;
-#endif
-}
-
-
-u16 _FAT_filetime_getDateFromRTC (void) {
-#ifdef NDS
- int year, month, day;
-
- year = IPC->time.rtc.year;
- month = IPC->time.rtc.month;
- day = IPC->time.rtc.day;
-
- if ((year < MIN_YEAR) || (year > MAX_YEAR)) return 0;
- if ((month < MIN_MONTH) || (month > MAX_MONTH)) return 0;
- if ((day < MIN_DAY) || (day > MAX_DAY)) return 0;
-
- return (
- (((year + 20) & 0x7F) <<9) | // Adjust for MS-FAT base year (1980 vs 2000 for DS clock)
- ((month & 0xF) << 5) |
- (day & 0x1F)
- );
-#else
- return 0;
-#endif
-}
-
-time_t _FAT_filetime_to_time_t (u16 time, u16 date) {
- int hour, minute, second;
- int day, month, year;
-
- time_t result;
-
- hour = time >> 11;
- minute = (time >> 5) & 0x3F;
- second = (time & 0x1F) << 1;
-
- day = date & 0x1F;
- month = (date >> 5) & 0x0F;
- year = date >> 9;
-
- // Second values are averages, so time value won't be 100% accurate,
- // but should be within the correct month.
- result = second
- + minute * SECONDS_PER_MINUTE
- + hour * SECONDS_PER_HOUR
- + day * SECONDS_PER_DAY
- + month * SECONDS_PER_MONTH
- + year * SECONDS_PER_YEAR
- ;
-
- return result;
-}
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/filetime.h b/c/src/lib/libbsp/arm/nds/libfat/source/filetime.h
deleted file mode 100644
index a69521b4fc..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/filetime.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- filetime.h
- Conversion of file time and date values to various other types
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _FILETIME_H
-#define _FILETIME_H
-
-#include "common.h"
-#include <sys/types.h>
-
-u16 _FAT_filetime_getTimeFromRTC (void);
-u16 _FAT_filetime_getDateFromRTC (void);
-
-time_t _FAT_filetime_to_time_t (u16 time, u16 date);
-
-
-#endif // _FILETIME_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/libfat.c b/c/src/lib/libbsp/arm/nds/libfat/source/libfat.c
deleted file mode 100644
index 6b07236052..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/libfat.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- libfat.c
- Simple functionality for startup, mounting and unmounting of FAT-based devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
-
- 2006-08-14 - Chishm
- * Added extended devoptab_t functions
-
- 2007-01-10 - Chishm
- * fatInit now sets the correct path when setAsDefaultDevice
-
- 2007-01-11 - Chishm
- * Added missing #include <unistd.h>
-*/
-
-#include <sys/iosupport.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "partition.h"
-#include "fatfile.h"
-#include "fatdir.h"
-
-#define GBA_DEFAULT_CACHE_PAGES 2
-#define NDS_DEFAULT_CACHE_PAGES 8
-
-
-const devoptab_t dotab_fat = {
- "fat",
- sizeof (FILE_STRUCT),
- _FAT_open_r,
- _FAT_close_r,
- _FAT_write_r,
- _FAT_read_r,
- _FAT_seek_r,
- _FAT_fstat_r,
- _FAT_stat_r,
- _FAT_link_r,
- _FAT_unlink_r,
- _FAT_chdir_r,
- _FAT_rename_r,
- _FAT_mkdir_r,
- sizeof (DIR_STATE_STRUCT),
- _FAT_diropen_r,
- _FAT_dirreset_r,
- _FAT_dirnext_r,
- _FAT_dirclose_r
-};
-
-bool fatInit (u32 cacheSize, bool setAsDefaultDevice) {
-#ifdef NDS
- bool slot1Device, slot2Device;
-
- // Try mounting both slots
- slot1Device = _FAT_partition_mount (PI_SLOT_1, cacheSize);
- slot2Device = _FAT_partition_mount (PI_SLOT_2, cacheSize);
-
- // Choose the default device
- if (slot1Device) {
- _FAT_partition_setDefaultInterface (PI_SLOT_1);
- } else if (slot2Device) {
- _FAT_partition_setDefaultInterface (PI_SLOT_2);
- } else {
- return false;
- }
-
-#else // not defined NDS
- bool cartSlotDevice;
-
- cartSlotDevice = _FAT_partition_mount (PI_CART_SLOT, cacheSize);
-
- if (cartSlotDevice) {
- _FAT_partition_setDefaultInterface (PI_CART_SLOT);
- } else {
- return false;
- }
-
-#endif // defined NDS
-
- AddDevice (&dotab_fat);
-
- if (setAsDefaultDevice) {
- chdir ("fat:/");
- }
-
- return true;
-}
-
-bool fatInitDefault (void) {
-#ifdef NDS
- return fatInit (NDS_DEFAULT_CACHE_PAGES, true);
-#else
- return fatInit (GBA_DEFAULT_CACHE_PAGES, true);
-#endif
-}
-
-bool fatMountNormalInterface (PARTITION_INTERFACE partitionNumber, u32 cacheSize) {
- return _FAT_partition_mount (partitionNumber, cacheSize);
-}
-
-bool fatMountCustomInterface (const IO_INTERFACE* device, u32 cacheSize) {
- return _FAT_partition_mountCustomInterface (device, cacheSize);
-}
-
-bool fatUnmount (PARTITION_INTERFACE partitionNumber) {
- return _FAT_partition_unmount (partitionNumber);
-}
-
-
-bool fatUnsafeUnmount (PARTITION_INTERFACE partitionNumber) {
- return _FAT_partition_unsafeUnmount (partitionNumber);
-}
-
-bool fatSetDefaultInterface (PARTITION_INTERFACE partitionNumber) {
- return _FAT_partition_setDefaultInterface (partitionNumber);
-}
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/mem_allocate.h b/c/src/lib/libbsp/arm/nds/libfat/source/mem_allocate.h
deleted file mode 100644
index 056023716e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/mem_allocate.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- mem_allocate.h
- Memory allocation and destruction calls
- Replace these calls with custom allocators if
- malloc is unavailable
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _MEM_ALLOCATE_H
-#define _MEM_ALLOCATE_H
-
-#include <malloc.h>
-
-static inline void* _FAT_mem_allocate (size_t size) {
- return malloc (size);
-}
-
-static inline void _FAT_mem_free (void* mem) {
- return free (mem);
-}
-
-#endif // _MEM_ALLOCATE_H
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/partition.c b/c/src/lib/libbsp/arm/nds/libfat/source/partition.c
deleted file mode 100644
index 9d3862793e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/partition.c
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- partition.c
- Functions for mounting and dismounting partitions
- on various block devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-08-10 - Chishm
- * Fixed problem when openning files starting with "fat"
-
- 2006-10-28 - Chishm
- * _partitions changed to _FAT_partitions to maintain the same style of naming as the functions
-*/
-
-
-#include "partition.h"
-#include "bit_ops.h"
-#include "file_allocation_table.h"
-#include "directory.h"
-
-#include <string.h>
-#include <ctype.h>
-
-#include "mem_allocate.h"
-
-/*
-This device name, as known by DevKitPro
-*/
-const char* DEVICE_NAME = "fat";
-
-/*
-Data offsets
-*/
-
-// BIOS Parameter Block offsets
-enum BPB {
- BPB_jmpBoot = 0x00,
- BPB_OEMName = 0x03,
- // BIOS Parameter Block
- BPB_bytesPerSector = 0x0B,
- BPB_sectorsPerCluster = 0x0D,
- BPB_reservedSectors = 0x0E,
- BPB_numFATs = 0x10,
- BPB_rootEntries = 0x11,
- BPB_numSectorsSmall = 0x13,
- BPB_mediaDesc = 0x15,
- BPB_sectorsPerFAT = 0x16,
- BPB_sectorsPerTrk = 0x18,
- BPB_numHeads = 0x1A,
- BPB_numHiddenSectors = 0x1C,
- BPB_numSectors = 0x20,
- // Ext BIOS Parameter Block for FAT16
- BPB_FAT16_driveNumber = 0x24,
- BPB_FAT16_reserved1 = 0x25,
- BPB_FAT16_extBootSig = 0x26,
- BPB_FAT16_volumeID = 0x27,
- BPB_FAT16_volumeLabel = 0x2B,
- BPB_FAT16_fileSysType = 0x36,
- // Bootcode
- BPB_FAT16_bootCode = 0x3E,
- // FAT32 extended block
- BPB_FAT32_sectorsPerFAT32 = 0x24,
- BPB_FAT32_extFlags = 0x28,
- BPB_FAT32_fsVer = 0x2A,
- BPB_FAT32_rootClus = 0x2C,
- BPB_FAT32_fsInfo = 0x30,
- BPB_FAT32_bkBootSec = 0x32,
- // Ext BIOS Parameter Block for FAT32
- BPB_FAT32_driveNumber = 0x40,
- BPB_FAT32_reserved1 = 0x41,
- BPB_FAT32_extBootSig = 0x42,
- BPB_FAT32_volumeID = 0x43,
- BPB_FAT32_volumeLabel = 0x47,
- BPB_FAT32_fileSysType = 0x52,
- // Bootcode
- BPB_FAT32_bootCode = 0x5A,
- BPB_bootSig_55 = 0x1FE,
- BPB_bootSig_AA = 0x1FF
-};
-
-
-#ifdef NDS
-#define MAXIMUM_PARTITIONS 4
-PARTITION* _FAT_partitions[MAXIMUM_PARTITIONS] = {NULL};
-#else // not defined NDS
-#define MAXIMUM_PARTITIONS 1
-PARTITION* _FAT_partitions[MAXIMUM_PARTITIONS] = {NULL};
-#endif // defined NDS
-
-// Use a single static buffer for the partitions
-
-
-static PARTITION* _FAT_partition_constructor ( const IO_INTERFACE* disc, u32 cacheSize) {
- PARTITION* partition;
- int i;
- u32 bootSector;
- u8 sectorBuffer[BYTES_PER_READ] = {0};
-
- // Read first sector of disc
- if ( !_FAT_disc_readSectors (disc, 0, 1, sectorBuffer)) {
- return NULL;
- }
-
- // Make sure it is a valid MBR or boot sector
- if ( (sectorBuffer[BPB_bootSig_55] != 0x55) || (sectorBuffer[BPB_bootSig_AA] != 0xAA)) {
- return NULL;
- }
-
- // Check if there is a FAT string, which indicates this is a boot sector
- if ((sectorBuffer[0x36] == 'F') && (sectorBuffer[0x37] == 'A') && (sectorBuffer[0x38] == 'T')) {
- bootSector = 0;
- } else if ((sectorBuffer[0x52] == 'F') && (sectorBuffer[0x53] == 'A') && (sectorBuffer[0x54] == 'T')) {
- // Check for FAT32
- bootSector = 0;
- } else {
- // This is an MBR
- // Find first valid partition from MBR
- // First check for an active partition
- for (i=0x1BE; (i < 0x1FE) && (sectorBuffer[i] != 0x80); i+= 0x10);
- // If it didn't find an active partition, search for any valid partition
- if (i == 0x1FE) {
- for (i=0x1BE; (i < 0x1FE) && (sectorBuffer[i+0x04] == 0x00); i+= 0x10);
- }
-
- // Go to first valid partition
- if ( i != 0x1FE) {
- // Make sure it found a partition
- bootSector = u8array_to_u32(sectorBuffer, 0x8 + i);
- } else {
- bootSector = 0; // No partition found, assume this is a MBR free disk
- }
- }
-
- // Read in boot sector
- if ( !_FAT_disc_readSectors (disc, bootSector, 1, sectorBuffer)) {
- return NULL;
- }
-
- partition = (PARTITION*) _FAT_mem_allocate (sizeof(PARTITION));
- if (partition == NULL) {
- return NULL;
- }
-
- // Set partition's disc interface
- partition->disc = disc;
-
- // Store required information about the file system
- partition->fat.sectorsPerFat = u8array_to_u16(sectorBuffer, BPB_sectorsPerFAT);
- if (partition->fat.sectorsPerFat == 0) {
- partition->fat.sectorsPerFat = u8array_to_u32( sectorBuffer, BPB_FAT32_sectorsPerFAT32);
- }
-
- partition->numberOfSectors = u8array_to_u16( sectorBuffer, BPB_numSectorsSmall);
- if (partition->numberOfSectors == 0) {
- partition->numberOfSectors = u8array_to_u32( sectorBuffer, BPB_numSectors);
- }
-
- partition->bytesPerSector = BYTES_PER_READ; // Sector size is redefined to be 512 bytes
- partition->sectorsPerCluster = sectorBuffer[BPB_sectorsPerCluster] * u8array_to_u16(sectorBuffer, BPB_bytesPerSector) / BYTES_PER_READ;
- partition->bytesPerCluster = partition->bytesPerSector * partition->sectorsPerCluster;
- partition->fat.fatStart = bootSector + u8array_to_u16(sectorBuffer, BPB_reservedSectors);
-
- partition->rootDirStart = partition->fat.fatStart + (sectorBuffer[BPB_numFATs] * partition->fat.sectorsPerFat);
- partition->dataStart = partition->rootDirStart + (( u8array_to_u16(sectorBuffer, BPB_rootEntries) * DIR_ENTRY_DATA_SIZE) / partition->bytesPerSector);
-
- partition->totalSize = (partition->numberOfSectors - partition->dataStart) * partition->bytesPerSector;
-
- // Store info about FAT
- partition->fat.lastCluster = (partition->numberOfSectors - partition->dataStart) / partition->sectorsPerCluster;
- partition->fat.firstFree = CLUSTER_FIRST;
-
- if (partition->fat.lastCluster < CLUSTERS_PER_FAT12) {
- partition->filesysType = FS_FAT12; // FAT12 volume
- } else if (partition->fat.lastCluster < CLUSTERS_PER_FAT16) {
- partition->filesysType = FS_FAT16; // FAT16 volume
- } else {
- partition->filesysType = FS_FAT32; // FAT32 volume
- }
-
- if (partition->filesysType != FS_FAT32) {
- partition->rootDirCluster = FAT16_ROOT_DIR_CLUSTER;
- } else {
- // Set up for the FAT32 way
- partition->rootDirCluster = u8array_to_u32(sectorBuffer, BPB_FAT32_rootClus);
- // Check if FAT mirroring is enabled
- if (!(sectorBuffer[BPB_FAT32_extFlags] & 0x80)) {
- // Use the active FAT
- partition->fat.fatStart = partition->fat.fatStart + ( partition->fat.sectorsPerFat * (sectorBuffer[BPB_FAT32_extFlags] & 0x0F));
- }
- }
-
- // Create a cache to use
- partition->cache = _FAT_cache_constructor (cacheSize, partition->disc);
-
- // Set current directory to the root
- partition->cwdCluster = partition->rootDirCluster;
-
- // Check if this disc is writable, and set the readOnly property appropriately
- partition->readOnly = !(_FAT_disc_features(disc) & FEATURE_MEDIUM_CANWRITE);
-
- // There are currently no open files on this partition
- partition->openFileCount = 0;
-
- return partition;
-}
-
-static void _FAT_partition_destructor (PARTITION* partition) {
- _FAT_cache_destructor (partition->cache);
- _FAT_disc_shutdown (partition->disc);
- _FAT_mem_free (partition);
-}
-
-bool _FAT_partition_mount (PARTITION_INTERFACE partitionNumber, u32 cacheSize) {
-#ifdef NDS
- int i;
- const IO_INTERFACE* disc = NULL;
-
- if (_FAT_partitions[partitionNumber] != NULL) {
- return false;
- }
-
- switch (partitionNumber) {
- case PI_SLOT_1:
- // Mount the disc in slot 1
- disc = _FAT_disc_dsSlotFindInterface ();
- break;
- case PI_SLOT_2:
- // Mount the disc in slot 2
- disc = _FAT_disc_gbaSlotFindInterface ();
- break;
- case PI_DEFAULT:
- case PI_CUSTOM:
- default:
- // Anything else has to be handled specially
- return false;
- break;
- }
-
- if (disc == NULL) {
- return false;
- }
-
- // See if that disc is already in use, if so, then just copy the partition pointer
- for (i = 0; i < MAXIMUM_PARTITIONS; i++) {
- if ((_FAT_partitions[i] != NULL) && (_FAT_partitions[i]->disc == disc)) {
- _FAT_partitions[partitionNumber] = _FAT_partitions[i];
- return true;
- }
- }
-
- _FAT_partitions[partitionNumber] = _FAT_partition_constructor (disc, cacheSize);
-
- if (_FAT_partitions[partitionNumber] == NULL) {
- return false;
- }
-
-#else // not defined NDS
- const IO_INTERFACE* disc = NULL;
-
- if (_FAT_partitions[partitionNumber] != NULL) {
- return false;
- }
-
- // Only ever one partition on GBA
- disc = _FAT_disc_gbaSlotFindInterface ();
- _FAT_partitions[partitionNumber] = _FAT_partition_constructor (disc, cacheSize);
-
-#endif // defined NDS
-
- return true;
-}
-
-bool _FAT_partition_mountCustomInterface (const IO_INTERFACE* device, u32 cacheSize) {
-#ifdef NDS
- int i;
-
- if (_FAT_partitions[PI_CUSTOM] != NULL) {
- return false;
- }
-
- if (device == NULL) {
- return false;
- }
-
- // See if that disc is already in use, if so, then just copy the partition pointer
- for (i = 0; i < MAXIMUM_PARTITIONS; i++) {
- if ((_FAT_partitions[i] != NULL) && (_FAT_partitions[i]->disc == device)) {
- _FAT_partitions[PI_CUSTOM] = _FAT_partitions[i];
- return true;
- }
- }
-
- _FAT_partitions[PI_CUSTOM] = _FAT_partition_constructor (device, cacheSize);
-
- if (_FAT_partitions[PI_CUSTOM] == NULL) {
- return false;
- }
-
-#else // not defined NDS
- if (_FAT_partitions[PI_CART_SLOT] != NULL) {
- return false;
- }
-
- if (device == NULL) {
- return false;
- }
-
- // Only ever one partition on GBA
- _FAT_partitions[PI_CART_SLOT] = _FAT_partition_constructor (device, cacheSize);
-
-#endif // defined NDS
-
- return true;
-}
-
-bool _FAT_partition_setDefaultInterface (PARTITION_INTERFACE partitionNumber) {
-#ifdef NDS // Can only set the default partition when there is more than 1, so doesn't apply to GBA
- if ((partitionNumber < 1) || (partitionNumber >= MAXIMUM_PARTITIONS)) {
- return false;
- }
-
- if (_FAT_partitions[partitionNumber] == NULL) {
- return false;
- }
-
- _FAT_partitions[PI_DEFAULT] = _FAT_partitions[partitionNumber];
-#endif
- return true;
-}
-
-bool _FAT_partition_setDefaultPartition (PARTITION* partition) {
-#ifdef NDS // Can only set the default partition when there is more than 1, so doesn't apply to GBA
- int i;
-
- if (partition == NULL) {
- return false;
- }
-
- // Ensure that this device is already in the list
- for (i = 1; i < MAXIMUM_PARTITIONS; i++) {
- if (_FAT_partitions[i] == partition) {
- break;
- }
- }
-
- // It wasn't in the list, so fail
- if (i == MAXIMUM_PARTITIONS) {
- return false;
- }
-
- // Change the default partition / device to this one
- _FAT_partitions[PI_DEFAULT] = partition;
-
-#endif
- return true;
-}
-
-bool _FAT_partition_unmount (PARTITION_INTERFACE partitionNumber) {
- int i;
- PARTITION* partition = _FAT_partitions[partitionNumber];
-
- if (partition == NULL) {
- return false;
- }
-
- if (partition->openFileCount > 0) {
- // There are still open files that need closing
- return false;
- }
-
- // Remove all references to this partition
- for (i = 0; i < MAXIMUM_PARTITIONS; i++) {
- if (_FAT_partitions[i] == partition) {
- _FAT_partitions[i] = NULL;
- }
- }
-
- _FAT_partition_destructor (partition);
- return true;
-}
-
-bool _FAT_partition_unsafeUnmount (PARTITION_INTERFACE partitionNumber) {
- int i;
- PARTITION* partition = _FAT_partitions[partitionNumber];
-
- if (partition == NULL) {
- return false;
- }
-
- // Remove all references to this partition
- for (i = 0; i < MAXIMUM_PARTITIONS; i++) {
- if (_FAT_partitions[i] == partition) {
- _FAT_partitions[i] = NULL;
- }
- }
-
- _FAT_cache_invalidate (partition->cache);
- _FAT_partition_destructor (partition);
- return true;
-}
-
-PARTITION* _FAT_partition_getPartitionFromPath (const char* path) {
-#ifdef NDS
- int namelen;
- int partitionNumber;
-
- // Device name extraction code taken from DevKitPro
- namelen = strlen(DEVICE_NAME);
- if (strchr (path, ':') == NULL) {
- // No device specified
- partitionNumber = PI_DEFAULT;
- } else if( strncmp(DEVICE_NAME, path, namelen) == 0 ) {
- if ( path[namelen] == ':' ) {
- // Only the device name is specified
- partitionNumber = PI_DEFAULT;
- } else if (isdigit(path[namelen]) && path[namelen+1] ==':' ) {
- // Device name and number specified
- partitionNumber = path[namelen] - '0';
- } else {
- // Incorrect device name
- return NULL;
- }
- } else {
- // Incorrect device name
- return NULL;
- }
-
- if ((partitionNumber < 0) || (partitionNumber >= MAXIMUM_PARTITIONS)) {
- return NULL;
- }
-
- return _FAT_partitions[partitionNumber];
-#else // not defined NDS
- // Only one possible partition on GBA
- return _FAT_partitions[PI_CART_SLOT];
-#endif // defined NDS
-}
diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/partition.h b/c/src/lib/libbsp/arm/nds/libfat/source/partition.h
deleted file mode 100644
index 29f06f8a76..0000000000
--- a/c/src/lib/libbsp/arm/nds/libfat/source/partition.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- partition.h
- Functions for mounting and dismounting partitions
- on various block devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _PARTITION_H
-#define _PARTITION_H
-
-#include "common.h"
-
-#include "disc_io/disc.h"
-#include "cache.h"
-
-// Device name
-extern const char* DEVICE_NAME;
-
-// Filesystem type
-typedef enum {FS_UNKNOWN, FS_FAT12, FS_FAT16, FS_FAT32} FS_TYPE;
-
-#ifdef NDS
-typedef enum {PI_DEFAULT, PI_SLOT_1, PI_SLOT_2, PI_CUSTOM} PARTITION_INTERFACE;
-#else
-typedef enum {PI_CART_SLOT} PARTITION_INTERFACE;
-#endif
-
-typedef struct {
- u32 fatStart;
- u32 sectorsPerFat;
- u32 lastCluster;
- u32 firstFree;
-} FAT;
-
-typedef struct {
- const IO_INTERFACE* disc;
- CACHE* cache;
- // Info about the partition
- bool readOnly; // If this is set, then do not try writing to the disc
- FS_TYPE filesysType;
- u32 totalSize;
- u32 rootDirStart;
- u32 rootDirCluster;
- u32 numberOfSectors;
- u32 dataStart;
- u32 bytesPerSector;
- u32 sectorsPerCluster;
- u32 bytesPerCluster;
- FAT fat;
- // Values that may change after construction
- u32 cwdCluster; // Current working directory cluser
- u32 openFileCount;
-} PARTITION;
-
-/*
-Mount the device specified by partitionDevice
-PD_DEFAULT is not allowed, use _FAT_partition_setDefaultDevice
-PD_CUSTOM is not allowed, use _FAT_partition_mountCustomDevice
-*/
-bool _FAT_partition_mount (PARTITION_INTERFACE partitionNumber, u32 cacheSize);
-
-/*
-Mount a partition on a custom device
-*/
-bool _FAT_partition_mountCustomInterface (const IO_INTERFACE* device, u32 cacheSize);
-
-/*
-Unmount the partition specified by partitionNumber
-If there are open files, it will fail
-*/
-bool _FAT_partition_unmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Forcibly unmount the partition specified by partitionNumber
-Any open files on the partition will become invalid
-The cache will be invalidated, and any unflushed writes will be lost
-*/
-bool _FAT_partition_unsafeUnmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:,
-based on the device number
-*/
-bool _FAT_partition_setDefaultInterface (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:,
-based on the partition pointer
-*/
-bool _FAT_partition_setDefaultPartition (PARTITION* partition);
-
-/*
-Return the partition specified in a path
-For instance, "fat0:", "fat:", "/" and "fat:/" will all
-return the default partition
-*/
-PARTITION* _FAT_partition_getPartitionFromPath (const char* path);
-
-#endif // _PARTITION_H
diff --git a/c/src/lib/libbsp/arm/nds/libnds/Makefile.arm7 b/c/src/lib/libbsp/arm/nds/libnds/Makefile.arm7
deleted file mode 100644
index a0a53d6fdc..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/Makefile.arm7
+++ /dev/null
@@ -1,10 +0,0 @@
--include $(DEVKITARM)/base_rules
-
-CFLAGS := $(BASEFLAGS) $(ARM7FLAGS) $(ARM7INC)
-ASFLAGS := $(ARM7FLAGS)
-VPATH := $(ARM7_VPATH)
-DEPSDIR := $(DEPENDS)/arm7
-
-$(LIBDIR)/libnds7.a: $(ARM7OBJS)
-
--include $(DEPSDIR)/*.d
diff --git a/c/src/lib/libbsp/arm/nds/libnds/Makefile.arm9 b/c/src/lib/libbsp/arm/nds/libnds/Makefile.arm9
deleted file mode 100644
index a3569a519c..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/Makefile.arm9
+++ /dev/null
@@ -1,14 +0,0 @@
--include $(DEVKITARM)/base_rules
-
-CFLAGS := $(BASEFLAGS) $(ARM9FLAGS) $(ARM9INC)
-ASFLAGS := $(ARM9FLAGS)
-VPATH := $(ARM9_VPATH)
-DEPSDIR := $(DEPENDS)/arm9
-
-$(LIBDIR)/libnds9.a: $(ARM9OBJS)
-
--include $(DEPSDIR)/*.d
-
-%.o : %.bin
- @echo $(notdir $<)
- @$(bin2o)
diff --git a/c/src/lib/libbsp/arm/nds/libnds/basicARM7/source/defaultARM7.c b/c/src/lib/libbsp/arm/nds/libnds/basicARM7/source/defaultARM7.c
deleted file mode 100644
index 6cb092f04b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/basicARM7/source/defaultARM7.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- default ARM7 core
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#include <nds.h>
-
-//---------------------------------------------------------------------------------
-void startSound(int sampleRate, const void* data, u32 bytes, u8 channel, u8 vol, u8 pan, u8 format) {
-//---------------------------------------------------------------------------------
- SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate);
- SCHANNEL_SOURCE(channel) = (u32)data;
- SCHANNEL_LENGTH(channel) = bytes >> 2 ;
- SCHANNEL_CR(channel) = SCHANNEL_ENABLE | SOUND_ONE_SHOT | SOUND_VOL(vol) | SOUND_PAN(pan) | (format==1?SOUND_8BIT:SOUND_16BIT);
-}
-
-//---------------------------------------------------------------------------------
-s32 getFreeSoundChannel() {
-//---------------------------------------------------------------------------------
- int i;
- for (i=0; i<16; i++) {
- if ( (SCHANNEL_CR(i) & SCHANNEL_ENABLE) == 0 ) return i;
- }
- return -1;
-}
-
-
-touchPosition first,tempPos;
-
-//---------------------------------------------------------------------------------
-void VcountHandler() {
-//---------------------------------------------------------------------------------
- static int lastbut = -1;
-
- uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0;
-
- but = REG_KEYXY;
-
- if (!( (but ^ lastbut) & (1<<6))) {
-
- tempPos = touchReadXY();
-
- if ( tempPos.x == 0 || tempPos.y == 0 ) {
- but |= (1 <<6);
- lastbut = but;
- } else {
- x = tempPos.x;
- y = tempPos.y;
- xpx = tempPos.px;
- ypx = tempPos.py;
- z1 = tempPos.z1;
- z2 = tempPos.z2;
- }
-
- } else {
- lastbut = but;
- but |= (1 <<6);
- }
-
- IPC->touchX = x;
- IPC->touchY = y;
- IPC->touchXpx = xpx;
- IPC->touchYpx = ypx;
- IPC->touchZ1 = z1;
- IPC->touchZ2 = z2;
- IPC->buttons = but;
-
-}
-
-//---------------------------------------------------------------------------------
-void VblankHandler(void) {
-//---------------------------------------------------------------------------------
-
- u32 i;
-
- //sound code :)
- TransferSound *snd = IPC->soundData;
- IPC->soundData = 0;
-
- if (0 != snd) {
-
- for (i=0; i<snd->count; i++) {
- s32 chan = getFreeSoundChannel();
-
- if (chan >= 0) {
- startSound(snd->data[i].rate, snd->data[i].data, snd->data[i].len, chan, snd->data[i].vol, snd->data[i].pan, snd->data[i].format);
- }
- }
- }
-}
-
-
-//---------------------------------------------------------------------------------
-int main(int argc, char ** argv) {
-//---------------------------------------------------------------------------------
-
- // read User Settings from firmware
- readUserSettings();
-
- //enable sound
- powerON(POWER_SOUND);
- writePowerManagement(PM_CONTROL_REG, ( readPowerManagement(PM_CONTROL_REG) & ~PM_SOUND_MUTE ) | PM_SOUND_AMP );
- SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F);
-
- irqInit();
-
- // Start the RTC tracking IRQ
- initClockIRQ();
-
- SetYtrigger(80);
- irqSet(IRQ_VCOUNT, VcountHandler);
- irqSet(IRQ_VBLANK, VblankHandler);
-
- irqEnable( IRQ_VBLANK | IRQ_VCOUNT);
-
- // Keep the ARM7 mostly idle
- while (1) swiWaitForVBlank();
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/default_font_bin.h b/c/src/lib/libbsp/arm/nds/libnds/include/default_font_bin.h
deleted file mode 100644
index a7a1ccea75..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/default_font_bin.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef default_font_bin_h_
-#define default_font_bin_h_
-
-extern void *default_font_bin;
-static void *default_font_bin_ptr = &default_font_bin;
-
-#define default_font_bin default_font_bin_ptr
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/gbfs.h b/c/src/lib/libbsp/arm/nds/libnds/include/gbfs.h
deleted file mode 100644
index 84fbae5dc5..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/gbfs.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*---------------------------------------------------------------------------------
- access object in a GBFS file
-
- Copyright 2002-2004 Damian Yerrick
-
- Additional code Dave Murphy
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- IN THE SOFTWARE.
-
----------------------------------------------------------------------------------*/
-
-
-/* Dependency on prior include files
-
-Before you #include "gbfs.h", you should define the following types:
- typedef (unsigned 16-bit integer) u16;
- typedef (unsigned 32-bit integer) u32;
-Your system header should do this for you.
-*/
-
-#ifndef _INCLUDE_GBFS_H_
-#define _INCLUDE_GBFS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* to make a 300 KB space called samples do GBFS_SPACE(samples, 300) */
-
-#define GBFS_SPACE(filename, kbytes) \
- const char filename[(kbytes)*1024] __attribute__ ((aligned (16))) = \
- "PinEightGBFSSpace-" #filename "-" #kbytes ;
-
-typedef struct GBFS_FILE {
- char magic[16]; /* "PinEightGBFS\r\n\032\n" */
- u32 total_len; /* total length of archive */
- u16 dir_off; /* offset in bytes to directory */
- u16 dir_nmemb; /* number of files */
- char reserved[8]; /* for future use */
-} GBFS_FILE;
-
-typedef struct GBFS_ENTRY {
- char name[24]; /* filename, nul-padded */
- u32 len; /* length of object in bytes */
- u32 data_offset; /* in bytes from beginning of file */
-} GBFS_ENTRY;
-
-
-/*---------------------------------------------------------------------------------
- Set the search limits and stride for searching
----------------------------------------------------------------------------------*/
-void gbfs_search_range( u32 gbfs_1st_limit,
- u32 gbfs_2nd_start, u32 gbfs_2nd_limit,
- u32 gbfs_stride );
-
-const GBFS_FILE * find_first_gbfs_file(const void *start);
-
-const void *skip_gbfs_file(const GBFS_FILE * file);
-
-const void *gbfs_get_obj(const GBFS_FILE *file,
- const char *name,
- u32 *len);
-
-const void *gbfs_get_nth_obj(GBFS_FILE const * file,
- size_t n,
- char *name,
- u32 *len);
-
-void *gbfs_copy_obj(void *dst,
- const GBFS_FILE *file,
- const char *name);
-
-size_t gbfs_count_objs(const GBFS_FILE *file);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _INCLUDE_GBFS_H_
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds.h
deleted file mode 100644
index cf8d9e4606..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef NDS_INCLUDE
-#define NDS_INCLUDE
-
-#ifndef ARM7
-#ifndef ARM9
-#error Either ARM7 or ARM9 must be defined
-#endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <nds/jtypes.h>
-#include <nds/bios.h>
-#include <nds/card.h>
-#include <nds/dma.h>
-#include <nds/interrupts.h>
-#include <nds/ipc.h>
-#include <nds/memory.h>
-#include <nds/system.h>
-#include <nds/timers.h>
-
-//---------------------------------------------------------------------------------
-#ifdef ARM9
-//---------------------------------------------------------------------------------
-
-#include <nds/arm9/background.h>
-#include <nds/arm9/boxtest.h>
-#include <nds/arm9/cache.h>
-#include <nds/arm9/console.h>
-#include <nds/arm9/exceptions.h>
-#include <nds/arm9/image.h>
-#include <nds/arm9/input.h>
-#include <nds/arm9/math.h>
-#include <nds/arm9/pcx.h>
-#include <nds/arm9/rumble.h>
-#include <nds/arm9/sound.h>
-#include <nds/arm9/trig_lut.h>
-#include <nds/arm9/video.h>
-#include <nds/arm9/videoGL.h>
-#include <nds/arm9/sprite.h>
-
-#endif // #ifdef ARM9
-
-//---------------------------------------------------------------------------------
-#ifdef ARM7
-//---------------------------------------------------------------------------------
-
-#include <nds/arm7/audio.h>
-#include <nds/arm7/clock.h>
-#include <nds/arm7/serial.h>
-#include <nds/arm7/touch.h>
-
-#endif // #ifdef ARM7
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif // NDS_INCLUDE
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/audio.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/audio.h
deleted file mode 100644
index 9c0c2e4502..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/audio.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*---------------------------------------------------------------------------------
- ARM7 audio control
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef AUDIO_ARM7_INCLUDE
-#define AUDIO_ARM7_INCLUDE
-
-//---------------------------------------------------------------------------------
-// Sound (ARM7 only)
-//---------------------------------------------------------------------------------
-#ifndef ARM7
-#error Audio is only available on the ARM7
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <nds/arm7/serial.h>
-
-
-#define SOUND_VOL(n) (n)
-#define SOUND_FREQ(n) ((-0x1000000 / (n)))
-#define SOUND_ENABLE BIT(15)
-#define SOUND_REPEAT BIT(27)
-#define SOUND_ONE_SHOT BIT(28)
-#define SOUND_FORMAT_16BIT (1<<29)
-#define SOUND_FORMAT_8BIT (0<<29)
-#define SOUND_FORMAT_PSG (3<<29)
-#define SOUND_FORMAT_ADPCM (2<<29)
-#define SOUND_16BIT (1<<29)
-#define SOUND_8BIT (0)
-
-#define SOUND_PAN(n) ((n) << 16)
-
-#define SCHANNEL_ENABLE BIT(31)
-
-//---------------------------------------------------------------------------------
-// registers
-//---------------------------------------------------------------------------------
-#define SCHANNEL_CR(n) (*(vuint32*)(0x04000400 + ((n)<<4)))
-#define SCHANNEL_VOL(n) (*(vuint8*)(0x04000400 + ((n)<<4)))
-#define SCHANNEL_PAN(n) (*(vuint8*)(0x04000402 + ((n)<<4)))
-#define SCHANNEL_SOURCE(n) (*(vuint32*)(0x04000404 + ((n)<<4)))
-#define SCHANNEL_TIMER(n) (*(vint16*)(0x04000408 + ((n)<<4)))
-#define SCHANNEL_REPEAT_POINT(n) (*(vuint16*)(0x0400040A + ((n)<<4)))
-#define SCHANNEL_LENGTH(n) (*(vuint32*)(0x0400040C + ((n)<<4)))
-
-#define SOUND_CR (*(vuint16*)0x04000500)
-#define SOUND_MASTER_VOL (*(vuint8*)0x04000500)
-
-//---------------------------------------------------------------------------------
-// not sure on the following
-//---------------------------------------------------------------------------------
-#define SOUND_BIAS (*(vuint16*)0x04000504)
-#define SOUND508 (*(vuint16*)0x04000508)
-#define SOUND510 (*(vuint16*)0x04000510)
-#define SOUND514 (*(vuint16*)0x04000514)
-#define SOUND518 (*(vuint16*)0x04000518)
-#define SOUND51C (*(vuint16*)0x0400051C)
-
-
-/*---------------------------------------------------------------------------------
- microphone code based on neimod's microphone example.
- See: http://neimod.com/dstek/
- Chris Double (chris.double@double.co.nz)
- http://www.double.co.nz/nintendo_ds
----------------------------------------------------------------------------------*/
-
-
-/*---------------------------------------------------------------------------------
- Read a byte from the microphone
----------------------------------------------------------------------------------*/
-u8 MIC_ReadData(void);
-
-/*---------------------------------------------------------------------------------
- Fill the buffer with data from the microphone. The buffer will be
- signed sound data at 16kHz. Once the length of the buffer is
- reached, no more data will be stored. Uses ARM7 timer 0.
----------------------------------------------------------------------------------*/
-void StartRecording(u8* buffer, int length);
-
-/*---------------------------------------------------------------------------------
- Stop recording data, and return the length of data recorded.
----------------------------------------------------------------------------------*/
-int StopRecording(void);
-
-/* This must be called during IRQ_TIMER0 */
-void ProcessMicrophoneTimerIRQ(void);
-
-void PM_SetAmp(u8 control);
-
-//---------------------------------------------------------------------------------
-// Turn the microphone on
-//---------------------------------------------------------------------------------
-static inline void MIC_On(void) {
-//---------------------------------------------------------------------------------
- PM_SetAmp(PM_AMP_ON);
-}
-
-
-//---------------------------------------------------------------------------------
-// Turn the microphone off
-//---------------------------------------------------------------------------------
-static inline void MIC_Off(void) {
-//---------------------------------------------------------------------------------
- PM_SetAmp(PM_AMP_OFF);
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/clock.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/clock.h
deleted file mode 100644
index 57cba7c1ef..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/clock.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- ARM7 realtime clock
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef ARM7_CLOCK_INCLUDE
-#define ARM7_CLOCK_INCLUDE
-
-
-#ifndef ARM7
-#error The clock is only available on the ARM7
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#include <nds/arm7/serial.h>
-
-// RTC registers
-#define WRITE_STATUS_REG1 0x60
-#define READ_STATUS_REG1 0x61
-
-/*
- Status Register 1
- 0 W Reset (0=Normal, 1=Reset)
- 1 R/W 12/24 hour mode (0=12 hour, 1=24 hour)
- 2-3 R/W General purpose bits
- 4 R Interrupt 1 Flag (1=Yes) ;auto-cleared on read
- 5 R Interrupt 2 Flag (1=Yes) ;auto-cleared on read
- 6 R Power Low Flag (0=Normal, 1=Power is/was low) ;auto-cleared on read
- 7 R Power Off Flag (0=Normal, 1=Power was off) ;auto-cleared on read
- Power off indicates that the battery was removed or fully discharged,
- all registers are reset to 00h (or 01h), and must be re-initialized.
-*/
-#define STATUS_POC (1<<7) // read-only, cleared by reading (1 if just powered on)
-#define STATUS_BLD (1<<6) // read-only, cleared by reading (1 if power dropped below the safety threshold)
-#define STATUS_INT2 (1<<5) // read-only, INT2 has occured
-#define STATUS_INT1 (1<<4) // read-only, INT1 has occured
-#define STATUS_SC1 (1<<3) // R/W scratch bit
-#define STATUS_SC0 (1<<2) // R/W scratch bit
-#define STATUS_24HRS (1<<1) // 24 hour mode when 1, 12 hour mode when 0
-#define STATUS_RESET (1<<0) // write-only, reset when 1 written
-
-#define WRITE_STATUS_REG2 0x62
-#define READ_STATUS_REG2 0x63
-/*
- Status Register 2
- 0-3 R/W INT1 Mode/Enable
- 0000b Disable
- 0x01b Selected Frequency steady interrupt
- 0x10b Per-minute edge interrupt
- 0011b Per-minute steady interrupt 1 (duty 30.0 secomds)
- 0100b Alarm 1 interrupt
- 0111b Per-minute steady interrupt 2 (duty 0.0079 secomds)
- 1xxxb 32kHz output
- 4-5 R/W General purpose bits
- 6 R/W INT2 Enable
- 0b Disable
- 1b Alarm 2 interrupt
- 7 R/W Test Mode (0=Normal, 1=Test, don't use) (cleared on Reset)
-*/
-#define STATUS_TEST (1<<7) //
-#define STATUS_INT2AE (1<<6) //
-#define STATUS_SC3 (1<<5) // R/W scratch bit
-#define STATUS_SC2 (1<<4) // R/W scratch bit
-
-#define STATUS_32kE (1<<3) // Interrupt mode bits
-#define STATUS_INT1AE (1<<2) //
-#define STATUS_INT1ME (1<<1) //
-#define STATUS_INT1FE (1<<0) //
-
-// full 7 bytes for time and date
-#define WRITE_TIME_AND_DATE 0x64
-#define READ_TIME_AND_DATE 0x65
-
-// last 3 bytes of current time
-#define WRITE_TIME 0x66
-#define READ_TIME 0x67
-
-#define WRITE_INT_REG1 0x68
-#define READ_INT_REG1 0x69
-
-#define READ_INT_REG2 0x6A
-#define WRITE_INT_REG2 0x6B
-
-#define READ_CLOCK_ADJUST_REG 0x6C
-#define WRITE_CLOCK_ADJUST_REG 0x6D
-// clock-adjustment register
-
-#define READ_FREE_REG 0x6E
-#define WRITE_FREE_REG 0x6F
-
-
-void rtcReset(void);
-void rtcTransaction(uint8 * command, uint32 commandLength, uint8 * result, uint32 resultLength);
-
-void rtcGetTime(uint8 * time);
-void rtcSetTime(uint8 * time);
-
-void rtcGetTimeAndDate(uint8 * time);
-void rtcSetTimeAndDate(uint8 * time);
-
-void rtcGetData(uint8 * data, uint32 size);
-
-void BCDToInteger(uint8 * data, uint32 length);
-void integerToBCD(uint8 * data, uint32 length);
-
-void initClockIRQ(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/serial.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/serial.h
deleted file mode 100644
index 9814ecaec0..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/serial.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*---------------------------------------------------------------------------------
- ARM7 serial control
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef SERIAL_ARM7_INCLUDE
-#define SERIAL_ARM7_INCLUDE
-
-#ifndef ARM7
-#error Serial header is for ARM7 only
-#endif
-
-
-#include <nds/bios.h>
-
-
-// 'Networking'
-#define REG_RCNT (*(vuint16*)0x04000134)
-#define REG_KEYXY (*(vuint16*)0x04000136)
-#define RTC_CR (*(vuint16*)0x04000138)
-#define RTC_CR8 (*( vuint8*)0x04000138)
-
-#define REG_SIOCNT (*(vuint16*)0x04000128)
-
-#define SIO_DATA8 (*(vuint8*)0x0400012A)
-#define SIO_DATA32 (*(vuint32*)0x04000120)
-
-
-// Fixme: Does the hardware still support 16 bit comms mode?
-// BIOS makes use of 32 bit mode, so some regs still exist
-#define SIO_MULTI_0 (*(vuint16*)0x04000120)
-#define SIO_MULTI_1 (*(vuint16*)0x04000122)
-#define SIO_MULTI_2 (*(vuint16*)0x04000124)
-#define SIO_MULTI_3 (*(vuint16*)0x04000126)
-#define SIO_MULTI_SEND (*(vuint16*)0x0400012A)
-
-
-// SPI chain registers
-#define REG_SPICNT (*(vuint16*)0x040001C0)
-#define REG_SPIDATA (*(vuint16*)0x040001C2)
-
-#define SPI_ENABLE BIT(15)
-#define SPI_IRQ BIT(14)
-#define SPI_BUSY BIT(7)
-
-// Pick the SPI clock speed
-#define SPI_BAUD_4MHZ 0
-#define SPI_BAUD_2MHZ 1
-#define SPI_BAUD_1MHZ 2
-#define SPI_BAUD_512KHZ 3
-
-// meh
-#define SPI_BAUD_4MHz 0
-#define SPI_BAUD_2MHz 1
-#define SPI_BAUD_1MHz 2
-#define SPI_BAUD_512KHz 3
-
-// Pick the SPI transfer length
-#define SPI_BYTE_MODE (0<<10)
-#define SPI_HWORD_MODE (1<<10)
-
-// Pick the SPI device
-#define SPI_DEVICE_POWER (0 << 8)
-#define SPI_DEVICE_FIRMWARE (1 << 8)
-#define SPI_DEVICE_NVRAM (1 << 8)
-#define SPI_DEVICE_TOUCH (2 << 8)
-#define SPI_DEVICE_MICROPHONE (2 << 8)
-
-// When used, the /CS line will stay low after the transfer ends
-// i.e. when we're part of a continuous transfer
-#define SPI_CONTINUOUS BIT(11)
-
-// Fixme: does this stuff really belong in serial.h?
-
-// Power management registers
-#define PM_CONTROL_REG 0
-#define PM_BATTERY_REG 1
-#define PM_AMPLIFIER_REG 2
-#define PM_READ_REGISTER (1<<7)
-
-// PM control register bits - power control
-#define PM_SOUND_AMP BIT(0) // Power the sound hardware (needed to hear stuff in GBA mode too)
-#define PM_SOUND_MUTE BIT(1) // Mute the main speakers, headphone output will still work.
-#define PM_BACKLIGHT_BOTTOM BIT(2) // Enable the top backlight if set
-#define PM_BACKLIGHT_TOP BIT(3) // Enable the bottom backlight if set
-#define PM_SYSTEM_PWR BIT(6) // Turn the power *off* if set
-#define PM_POWER_DOWN BIT(6) // Same thing, I like this name better tho
-
-// PM control register bits - LED control
-#define PM_LED_CONTROL(m) ((m)<<4) // ?
-
-
-#define PM_LED_ON (0<<4) // Steady on
-#define PM_LED_SLEEP (1<<4) // Blinking, mostly off
-#define PM_LED_BLINK (3<<4) // Blinking, mostly on
-
-
-#define PM_AMP_OFFSET 2
-#define PM_AMP_ON 1
-#define PM_AMP_OFF 0
-
-// Fixme: does this stuff really belong in serial.h?
-
-// Firmware commands
-#define FIRMWARE_WREN 0x06
-#define FIRMWARE_WRDI 0x04
-#define FIRMWARE_RDID 0x9F
-#define FIRMWARE_RDSR 0x05
-#define FIRMWARE_READ 0x03
-#define FIRMWARE_PW 0x0A
-#define FIRMWARE_PP 0x02
-#define FIRMWARE_FAST 0x0B
-#define FIRMWARE_PE 0xDB
-#define FIRMWARE_SE 0xD8
-#define FIRMWARE_DP 0xB9
-#define FIRMWARE_RDP 0xAB
-
-
-static inline
-void SerialWaitBusy(void) {
- while (REG_SPICNT & SPI_BUSY)
- swiDelay(1);
-}
-
-
-// Warning: These functions use the SPI chain, and are thus 'critical'
-// sections, make sure to disable interrupts during the call if you've
-// got a VBlank IRQ polling the touch screen, etc...
-
-// Read/write a power management register
-int writePowerManagement(int reg, int command);
-
-static inline
-int readPowerManagement(int reg) {
- return writePowerManagement((reg)|PM_READ_REGISTER, 0);
-}
-
-// Read the firmware
-void readFirmware(uint32 address, void * destination, uint32 size);
-
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/touch.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/touch.h
deleted file mode 100644
index 91285d314d..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/touch.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*---------------------------------------------------------------------------------
- Microphone control for the ARM7
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef ARM7_TOUCH_INCLUDE
-#define ARM7_TOUCH_INCLUDE
-//---------------------------------------------------------------------------------
-
-
-#ifndef ARM7
-#error Touch screen is only available on the ARM7
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <nds/arm7/serial.h>
-
-
-#define SCREEN_WIDTH 256
-#define SCREEN_HEIGHT 192
-
-
-#define TSC_MEASURE_TEMP1 0x84
-#define TSC_MEASURE_Y 0x90
-#define TSC_MEASURE_BATTERY 0xA4
-#define TSC_MEASURE_Z1 0xB4
-#define TSC_MEASURE_Z2 0xC4
-#define TSC_MEASURE_X 0xD0
-#define TSC_MEASURE_AUX 0xE4
-#define TSC_MEASURE_TEMP2 0xF4
-
-
-
-touchPosition touchReadXY(void);
-
-uint16 touchRead(uint32 command);
-uint32 touchReadTemperature(int * t1, int * t2);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-//---------------------------------------------------------------------------------
-#endif // ARM7_TOUCH_INCLUDE
-//---------------------------------------------------------------------------------
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/background.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/background.h
deleted file mode 100644
index 4aa8287161..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/background.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- background.h -- definitions for DS backgrounds
-
- Copyright (C) 2007
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef _libnds_background_h_
-#define _libnds_background_h_
-
-#include <nds/jtypes.h>
-
-// Background control defines
-
-// BGxCNT defines ///
-#define BG_MOSAIC_ENABLE 0x40
-#define BG_COLOR_256 0x80
-#define BG_COLOR_16 0x00
-
-#define CHAR_BASE_BLOCK(n) (((n)*0x4000)+ 0x06000000)
-#define CHAR_BASE_BLOCK_SUB(n) (((n)*0x4000)+ 0x06200000)
-#define SCREEN_BASE_BLOCK(n) (((n)*0x800) + 0x06000000)
-#define SCREEN_BASE_BLOCK_SUB(n) (((n)*0x800) + 0x06200000)
-
-#define CHAR_SHIFT 2
-#define SCREEN_SHIFT 8
-#define TEXTBG_SIZE_256x256 0x0
-#define TEXTBG_SIZE_256x512 0x8000
-#define TEXTBG_SIZE_512x256 0x4000
-#define TEXTBG_SIZE_512x512 0xC000
-
-#define ROTBG_SIZE_128x128 0x0
-#define ROTBG_SIZE_256x256 0x4000
-#define ROTBG_SIZE_512x512 0x8000
-#define ROTBG_SIZE_1024x1024 0xC000
-
-#define WRAPAROUND 0x1
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/boxtest.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/boxtest.h
deleted file mode 100644
index 5591bddd72..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/boxtest.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*---------------------------------------------------------------------------------
-BoxTest.h -- Code for performing hardware box test against viewing frustrum
-
-Copyright (C) 2005
-Michael Noland (joat)
-Jason Rogers (dovoto)
-Dave Murphy (WinterMute)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you
-must not claim that you wrote the original software. If you use
-this software in a product, an acknowledgment in the product
-documentation would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-
-
----------------------------------------------------------------------------------*/
-#ifndef BOX_TEST_INCLUDE
-#define BOX_TEST_INCLUDE
-
-#include <nds/arm9/video.h>
-#include <nds/arm9/videoGL.h>
-
-/*! \file boxtest.h
-\brief Box Test Functions.
-
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*! \fn int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth)
-\brief Performs a test to determine if the provided box is in the view frustrum.
-\param x (x, y, z) point of a vertex on the box
-\param y (x, y, z) point of a vertex on the box
-\param z (x, y, z) point of a vertex on the box
-\param height (height, width, depth) describe the size of the box referenced from (x, y, z)
-\param width (height, width, depth) describe the size of the box referenced from (x, y, z)
-\param depth (height, width, depth) describe the size of the box referenced from (x, y, z)
-
-\return non zero if any or all of the box is in the view frustum
-*/
-int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth);
-
-/*! \fn int BoxTestf(float x, float y, float z, float width, float height, float depth)
-\brief Performs a test to determine if the provided box is in the view frustum.
-\param x (x, y, z) point of a vertex on the box
-\param y (x, y, z) point of a vertex on the box
-\param z (x, y, z) point of a vertex on the box
-\param width (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param height (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param depth (width, height, depth) describe the size of the box referenced from (x, y, z)
-
-\return non zero if any or all of the box is in the view frustum
-*/
-int BoxTestf(float x, float y, float z, float width, float height, float depth);
-
-/*! \fn void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth)
-\brief Performs a test to determine if the provided box is in the view frustum.
-\param x (x, y, z) point of a vertex on the box
-\param y (x, y, z) point of a vertex on the box
-\param z (x, y, z) point of a vertex on the box
-\param width (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param height (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param depth (width, height, depth) describe the size of the box referenced from (x, y, z)
-
-Performs a test to determine if the provided box is in the view frustum. BoxTestResult must be called to get the result of this
-operation.
-*/
-void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 height, v16 width, v16 depth);
-
-/*! \fn void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth)
-\brief Performs a test to determine if the provided box is in the view frustum.
-\param x (x, y, z) point of a vertex on the box
-\param y (x, y, z) point of a vertex on the box
-\param z (x, y, z) point of a vertex on the box
-\param width (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param height (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param depth (width, height, depth) describe the size of the box referenced from (x, y, z)
-
-Performs a test to determine if the provided box is in the view frustum. BoxTestResult must be called to get the result of this
-operation.
-*/
-void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth);
-
-/*! \fn void BoxTestResult(void)
-\brief Gets the result of the last box test. Needed for asynch box test calls.
-\return non zero if any or all of the box is in the view frustum
-
-*/
-int BoxTestResult(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/cache.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/cache.h
deleted file mode 100644
index d2ba67158f..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/cache.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*---------------------------------------------------------------------------------
- key input code -- provides slightly higher level input forming
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-/*! \file cache.h
-\brief ARM9 cache control functions.
-
-*/
-#ifndef _cache_h_
-#define _cache_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "nds/jtypes.h"
-
-
-/*! \fn IC_InvalidateAll(void)
- \brief invalidate entire instruction cache.
-*/
-void IC_InvalidateAll(void);
-
-
-/*! \fn IC_InvalidateRange(const void *base, u32 size)
- \brief invalidate the instruction cache for a range of addresses.
- \param base base address of the region to invalidate
- \param size size of the region to invalidate.
-*/
-void IC_InvalidateRange(const void *base, u32 size);
-
-
-/*! \fn DC_FlushAll(void)
- \brief flush the entire data cache to memory.
-*/
-void DC_FlushAll(void);
-
-
-/*! \fn DC_FlushRange(const void *base, u32 size)
- \brief flush the data cache for a range of addresses to memory.
- \param base base address of the region to flush.
- \param size size of the region to flush.
-*/
-void DC_FlushRange(const void *base, u32 size);
-
-
-/*! \fn DC_InvalidateAll(void)
- \brief invalidate the entire data cache.
-*/
-void DC_InvalidateAll(void);
-
-
-/*! \fn DC_InvalidateRange(const void *base, u32 size)
- \brief invalidate the data cache for a range of addresses.
- \param base base address of the region to invalidate
- \param size size of the region to invalidate.
-*/
-void DC_InvalidateRange(const void *base, u32 size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/console.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/console.h
deleted file mode 100644
index c258401070..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/console.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*---------------------------------------------------------------------------------
- console functions
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
-
----------------------------------------------------------------------------------*/
-
-/*! \file console.h
- \brief nds stdio support.
-*/
-
-#ifndef CONSOLE_H
-#define CONSOLE_H
-
-#define CONSOLE_USE_COLOR255 16
-
-#include <nds/jtypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*! \fn void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16* map, u8 pal, u8 bitDepth)
- \brief Initialise the console.
- \param font base address of the 16 color font to use
- \param charBase VRAM address to load the font
- \param numCharacters number of characters in the font
- \param charStart ascii code of the first character in the font
- \param map base address of the map to use for printing
- \param pal 16 color palette index to use
- \param bitDepth 256/16 color tile flag.
-
- Initializes the console with the given parameters. When pal is greater than 15 and
- bitDepth is 16 then all non zero entries in the font are set to index 255. When bitDepth
- is not 16 then the font tiles are created as 8bit (256 color).
-
-*/
-void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16* map, u8 pal, u8 bitDepth);
-/*! \fn void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth)
- \brief Initialize the console with some default parameters.
- \param charBase VRAM address to load the font
- \param map base address of the map to use for printing
- \param bitDepth 256/16 color tile flag
-
- This function calls consoleInit() with the default built in font and character ranges, the parameters given
- are as for that function.
-*/
-void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth);
-
-/*! \fn void consoleDemoInit(void)
-\brief Initialize the console to a default state for prototyping.
-This function sets the console to use sub display, VRAM_C, and BG0 and enables MODE_0_2D on the
-sub display. It is intended for use in prototyping applications which need print ability and not actual
-game use. Print functionality can be utilized with just this call.
-*/
-void consoleDemoInit(void);
-/*! \fn void consoleClear(void)
-\brief Clears the screan by iprintf("\x1b[2J");
-*/
-void consoleClear(void);
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/exceptions.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/exceptions.h
deleted file mode 100644
index 1127e3ff4c..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/exceptions.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef _exceptions_h_
-#define _exceptions_h_
-//---------------------------------------------------------------------------------
-
-#define EXCEPTION_VECTOR (*(VoidFunctionPointer *)(0x27FFD9C))
-
-
-extern VoidFunctionPointer exceptionC[] ;
-extern unsigned long exceptionStack ;
-extern signed long exceptionRegisters[];
-
-void enterException(void);
-void setExceptionHandler(VoidFunctionPointer handler);
-void defaultExceptionHandler(void);
-
-u32 getCPSR(void);
-
-//---------------------------------------------------------------------------------
-#endif // _exceptions_h_
-//---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/image.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/image.h
deleted file mode 100644
index b2a5d00821..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/image.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- Copyright (C) 2005
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef IMAGE_H
-#define IMAGE_H
-
-#include <nds/arm9/video.h>
-
-//holds a rgb triplet
- typedef struct
- {
- unsigned char r,g,b;
- }__attribute__ ((packed)) RGB_24;
-
- //holds a basic image type for loading image files
- typedef struct
- {
- short height,width;
- int bpp;
- unsigned short* palette;
-
- union
- {
- unsigned char* data8;
- unsigned short* data16;
- unsigned int* data32;
- } image;
-
- } sImage, *psImage;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void image24to16(sImage* img);
-void image8to16(sImage* img);
-void image8to16trans(sImage* img, u8 transperentColor);
-void imageDestroy(sImage* img);
-void imageTileData(sImage* img);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#include <nds/arm9/pcx.h>
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/input.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/input.h
deleted file mode 100644
index c08eed1e5d..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/input.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*---------------------------------------------------------------------------------
- key input code -- provides slightly higher level input forming
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Christian Auby (DesktopMan)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-//! NDS input support.
-/*! \file input.h
-*/
-
-//---------------------------------------------------------------------------------
-#ifndef INPUT_HEADER_INCLUDE
-#define INPUT_HEADER_INCLUDE
-//---------------------------------------------------------------------------------
-
-#include <nds/jtypes.h>
-
-// Keyboard
-
-//! Bit values for the keypad buttons.
-typedef enum KEYPAD_BITS {
- KEY_A = BIT(0), //!< Keypad A button.
- KEY_B = BIT(1), //!< Keypad B button.
- KEY_SELECT = BIT(2), //!< Keypad SELECT button.
- KEY_START = BIT(3), //!< Keypad START button.
- KEY_RIGHT = BIT(4), //!< Keypad RIGHT button.
- KEY_LEFT = BIT(5), //!< Keypad LEFT button.
- KEY_UP = BIT(6), //!< Keypad UP button.
- KEY_DOWN = BIT(7), //!< Keypad DOWN button.
- KEY_R = BIT(8), //!< Right shoulder button.
- KEY_L = BIT(9), //!< Left shoulder button.
- KEY_X = BIT(10), //!< Keypad X button.
- KEY_Y = BIT(11), //!< Keypad Y button.
- KEY_TOUCH = BIT(12), //!< Touchscreen pendown.
- KEY_LID = BIT(13) //!< Lid state.
-} KEYPAD_BITS;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//! Obtains the current keypad state.
-/*! Call this function once per main loop in order to use the keypad functions.
-*/
-void scanKeys(void);
-
-//! Obtains the current keypad held state.
-uint32 keysHeld(void);
-
-//! Obtains the current keypad pressed state.
-uint32 keysDown(void);
-
-//! Obtains the current keypad pressed or repeating state.
-uint32 keysDownRepeat(void);
-
-//! Sets the key repeat parameters.
-/*! \param setDelay Number of %scanKeys calls before keys start to repeat.
- \param setRepeat Number of %scanKeys calls before keys repeat.
-*/
-void keysSetRepeat( u8 setDelay, u8 setRepeat );
-
-//! Obtains the current keypad released state.
-uint32 keysUp(void);
-
-//! Obtains the current touchscreen co-ordinates.
-touchPosition touchReadXY(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-//---------------------------------------------------------------------------------
-#endif // INPUT_HEADER_INCLUDE
-//---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/math.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/math.h
deleted file mode 100644
index f1296a19fc..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/math.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*---------------------------------------------------------------------------------
- math functions
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef MATH_ARM9_INCLUDE
-#define MATH_ARM9_INCLUDE
-
-#include <nds/jtypes.h>
-
-// Math coprocessor register definitions
-
-#define DIV_CR (*(vuint16*)(0x04000280))
-#define DIV_NUMERATOR64 (*(vint64*) (0x04000290))
-#define DIV_NUMERATOR32 (*(vint32*) (0x04000290))
-#define DIV_DENOMINATOR64 (*(vint64*) (0x04000298))
-#define DIV_DENOMINATOR32 (*(vint32*) (0x04000298))
-#define DIV_RESULT64 (*(vint64*) (0x040002A0))
-#define DIV_RESULT32 (*(vint32*) (0x040002A0))
-#define DIV_REMAINDER64 (*(vint64*) (0x040002A8))
-#define DIV_REMAINDER32 (*(vint32*) (0x040002A8))
-
-#define SQRT_CR (*(vuint16*)(0x040002B0))
-#define SQRT_PARAM64 (*(vint64*) (0x040002B8))
-#define SQRT_RESULT32 (*(vint32*) (0x040002B4))
-#define SQRT_PARAM32 (*(vint32*) (0x040002B8))
-
-// Math coprocessor modes
-
-#define DIV_64_64 2
-#define DIV_64_32 1
-#define DIV_32_32 0
-#define DIV_BUSY (1<<15)
-
-#define SQRT_64 1
-#define SQRT_32 0
-#define SQRT_BUSY (1<<15)
-
-// Fixed Point versions
-
-// Fixed point divide
-// Takes 20.12 numerator and denominator
-// and returns 20.12 result
-static inline int32 divf32(int32 num, int32 den)
-{
- DIV_CR = DIV_64_32;
-
- while(DIV_CR & DIV_BUSY);
-
- DIV_NUMERATOR64 = ((int64)num) << 12;
- DIV_DENOMINATOR32 = den;
-
- while(DIV_CR & DIV_BUSY);
-
- return (DIV_RESULT32);
-}
-
-// Fixed point multiply
-// Takes 20.12 values and returns
-// 20.12 result
-static inline int32 mulf32(int32 a, int32 b)
-{
- long long result = (long long)a*(long long)b;
- return (int32)(result >> 12);
-}
-
-// Fixed point square root
-// Takes 20.12 fixed point value and
-// returns the fixed point result
-static inline int32 sqrtf32(int32 a)
-{
- SQRT_CR = SQRT_64;
-
- while(SQRT_CR & SQRT_BUSY);
-
- SQRT_PARAM64 = ((int64)a) << 12;
-
- while(SQRT_CR & SQRT_BUSY);
-
- return SQRT_RESULT32;
-}
-
-// Integer versions
-
-// Integer divide
-// Takes a 32 bit numerator and 32 bit
-// denominator and returns 32 bit result
-static inline int32 div32(int32 num, int32 den)
-{
- DIV_CR = DIV_32_32;
-
- while(DIV_CR & DIV_BUSY);
-
- DIV_NUMERATOR32 = num;
- DIV_DENOMINATOR32 = den;
-
- while(DIV_CR & DIV_BUSY);
-
- return (DIV_RESULT32);
-}
-
-// Integer divide
-// Takes a 32 bit numerator and 32 bit
-// denominator and returns 32 bit result
-static inline int32 mod32(int32 num, int32 den)
-{
- DIV_CR = DIV_32_32;
-
- while(DIV_CR & DIV_BUSY);
-
- DIV_NUMERATOR32 = num;
- DIV_DENOMINATOR32 = den;
-
- while(DIV_CR & DIV_BUSY);
-
- return (DIV_REMAINDER32);
-}
-
-// Integer divide
-// Takes a 64 bit numerator and 32 bit
-// denominator are returns 32 bit result
-static inline int32 div64(int64 num, int32 den)
-{
- DIV_CR = DIV_64_32;
-
- while(DIV_CR & DIV_BUSY);
-
- DIV_NUMERATOR64 = num;
- DIV_DENOMINATOR32 = den;
-
- while(DIV_CR & DIV_BUSY);
-
- return (DIV_RESULT32);
-}
-
-// Integer divide
-// Takes a 64 bit numerator and 32 bit
-// denominator are returns 32 bit result
-static inline int32 mod64(int64 num, int32 den)
-{
- DIV_CR = DIV_64_32;
-
- while(DIV_CR & DIV_BUSY);
-
- DIV_NUMERATOR64 = num;
- DIV_DENOMINATOR32 = den;
-
- while(DIV_CR & DIV_BUSY);
-
- return (DIV_REMAINDER32);
-}
-
-// Integer square root
-// takes a 32 bit integer and returns
-// 32 bit result
-static inline int32 sqrt32(int a)
-{
- SQRT_CR = SQRT_32;
-
- while(SQRT_CR & SQRT_BUSY);
-
- SQRT_PARAM32 = a;
-
- while(SQRT_CR & SQRT_BUSY);
-
- return SQRT_RESULT32;
-}
-
-// Trig Functions 1.19.12 fixed point
-
-// Cross product
-// x = Ay * Bz - By * Az
-// y = Az * Bx - Bz * Ax
-// z = Ax * By - Bx * Ay
-static inline void crossf32(int32 *a, int32 *b, int32 *result)
-{
- result[0] = mulf32(a[1], b[2]) - mulf32(b[1], a[2]);
- result[1] = mulf32(a[2], b[0]) - mulf32(b[2], a[0]);
- result[2] = mulf32(a[0], b[1]) - mulf32(b[0], a[1]);
-}
-
-// Dot Product
-// result = Ax * Bx + Ay * By + Az * Bz
-static inline int32 dotf32(int32 *a, int32 *b)
-{
- return mulf32(a[0], b[0]) + mulf32(a[1], b[1]) + mulf32(a[2], b[2]);
-}
-
-// Normalize
-// Ax = Ax / mag
-// Ay = Ay / mag
-// Az = Az / mag
-static inline void normalizef32(int32* a)
-{
- // magnitude = sqrt ( Ax^2 + Ay^2 + Az^2 )
- int32 magnitude = sqrtf32( mulf32(a[0], a[0]) + mulf32(a[1], a[1]) + mulf32(a[2], a[2]) );
-
- a[0] = divf32(a[0], magnitude);
- a[1] = divf32(a[1], magnitude);
- a[2] = divf32(a[2], magnitude);
-}
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/ndsmotion.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/ndsmotion.h
deleted file mode 100644
index f3940f5f2f..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/ndsmotion.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*---------------------------------------------------------------------------------
- DS Motion Card/DS Motion Pak functionality
-
- Copyright (C) 2007
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Keith Epstein (KeithE)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-/*! \file ndsmotion.h
-\brief interface code for the ds motion card, ds motion pak, MK6
-
-*/
-#ifndef NDS_MOTION_INCLUDE
-#define NDS_MOTION_INCLUDE
-//---------------------------------------------------------------------------------
-
-
-typedef struct
-{
- short xoff, yoff, zoff, goff;
- short xsens, ysens, zsens, gsens;
-}MotionCalibration;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*! \fn int motion_init(void)
-\brief Initializes the DS Motion Sensor.
-Run this before using any of the DS Motion Sensor functions
-save the return value and pass it to the other motion_ functions
-*/
-int motion_init(void);
-
-/*! \fn int motion_deinit(void)
-\brief Deinitializes the DS Motion Sensor
-*/
-void motion_deinit(void);
-
-/*! \fn signed int motion_read_x(void)
-\brief read the X acceleration
-*/
-signed int motion_read_x(void);
-
-/*! \fn signed int motion_read_y(void)
-\brief read the Y acceleration
-*/
-signed int motion_read_y(void);
-
-/*! \fn signed int motion_read_z(void)
-\brief read the Z acceleration
-*/
-signed int motion_read_z(void);
-
-/*! \fn signed int motion_read_gyro(void)
-\brief read the Z rotational speed
-*/
-signed int motion_read_gyro(void);
-
-/*! \fn int motion_acceleration_x(void)
-\brief gets acceleration value to mili G (where g is 9.8 m/s*s)
-*/
-int motion_acceleration_x(void);
-
-/*! \fn int motion_acceleration_y(void)
-\brief gets acceleration value to mili G (where g is 9.8 m/s*s)
-*/
-int motion_acceleration_y(void);
-
-/*! \fn int motion_acceleration_z(void)
-\brief gets acceleration value to mili G (where g is 9.8 m/s*s)
-*/
-int motion_acceleration_z(void);
-
-/*! \fn void motion_set_sens_x(int sens)
-\brief this should be passed the raw reading at 1g for accurate
-acceleration calculations. Default is 819
-*/
-void motion_set_sens_x(int sens);
-
-/*! \fn void motion_set_sens_y(int sens)
-\brief this should be passed the raw reading at 1g for accurate
-acceleration calculations. Default is 819
-*/
-void motion_set_sens_y(int sens);
-
-/*! \fn void motion_set_sens_z(int sens)
-\brief this should be passed the raw reading at 1g for accurate
-acceleration calculations. Default is 819
-*/
-void motion_set_sens_z(int sens);
-
-/*! \fn void motion_set_sens_x(int sens)
-\brief this should be passed the raw reading at 1g for accurate
-acceleration calculations. Default is 825
-*/
-void motion_set_sens_gyro(int sens);
-
-/*! \fn void motion_set_offs_x(void)
-\brief this should be called when the axis is under no acceleration
-default is 2048
-*/
-void motion_set_offs_x(void);
-
-/*! \fn void motion_set_offs_y(void)
-\brief this should be called when the axis is under no acceleration
-default is 2048
-*/
-void motion_set_offs_y(void);
-
-/*! \fn void motion_set_offs_z(void)
-\brief this should be called when the axis is under no acceleration
-default is 2048
-*/
-void motion_set_offs_z(void);
-
-/*! \fn void motion_set_offs_gyro(void)
-\brief this should be called when the axis is under no rotation
-default is 1680
-*/
-void motion_set_offs_gyro(void);
-
-/*! \fn int motion_rotation(void)
-\brief converts raw rotation value to degrees per second
-*/
-int motion_rotation(void);
-
-/*! \fn MotionCalibration* motion_get_calibration(void)void
-\brief This returns the current calibration settings for saving
-*/
-MotionCalibration* motion_get_calibration(void);
-
-/*! \fn void motion_set_calibration(MotionCalibration* cal)
-\brief This sets the calibration settings. Intended
-to restore saved calibration settings
-*/
-void motion_set_calibration(MotionCalibration* cal);
-
-/*! \fn MotionCalibration* motion_enable_ain_1(void)
-\brief This enables the analog input number 1.
-Required before reading analog input number 1.
-*/
-void motion_enable_ain_1(void);
-
-/*! \fn MotionCalibration* motion_enable_ain_2(void)
-\brief This enables the analog input number 2.
-Required before reading analog input number 2.
-*/
-void motion_enable_ain_2(void);
-
-/*! \fn MotionCalibration* motion_read_ain_1(void)
-\brief This reads the analog input number 1.
-analog input number 1 needs to be enabled before reading.
-*/
-int motion_read_ain_1(void);
-
-/*! \fn MotionCalibration* motion_read_ain_2(void)
-\brief This reads the analog input number 2.
-analog input number 2 needs to be enabled before reading.
-*/
-int motion_read_ain_2(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/pcx.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/pcx.h
deleted file mode 100644
index f050224cd0..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/pcx.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- Copyright (C) 2005
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef PCX_H
-#define PCX_H
-
-typedef struct
-{
- char manufacturer; //should be 0
- char version; //should be 5
- char encoding; //should be 1
- char bitsPerPixel; //should be 8
- short int xmin,ymin; //coordinates for top left,bottom right
- short int xmax,ymax;
- short int hres; //resolution
- short int vres;
- char palette16[48]; //16 color palette if 16 color image
- char reserved; //ignore
- char colorPlanes; //ignore
- short int bytesPerLine;
- short int paletteYype; //should be 2
- char filler[58]; //ignore
-}__attribute__ ((packed)) PCXHeader, *pPCXHeader;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int loadPCX(unsigned char* pcx, sImage* image);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/postest.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/postest.h
deleted file mode 100644
index e08b3f4702..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/postest.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*---------------------------------------------------------------------------------
-
-PosTest.c -- Code for performing hardware position testing
-
-Copyright (C) 2007
-Gabe Ghearing (gabebear)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you
-must not claim that you wrote the original software. If you use
-this software in a product, an acknowledgment in the product
-documentation would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef POS_TEST_INCLUDE
-#define POS_TEST_INCLUDE
-
-#include <nds/arm9/video.h>
-#include <nds/arm9/videoGL.h>
-
-/*! \brief true if the hardware is currently performing a position/vertex/box test.
-\return whether a test is being performed */
-GL_STATIC_INL bool PosTestBusy() {
- return (GFX_STATUS & BIT(0))!=0;
-}
-
-/*! \file postest.h
-\brief Position Test Functions.<BR>
-The position test multiplies a given vector by the position matrix and returns the coords(x,y,z,w). The position test is really quick, about 10x faster than a box test.
-*/
-
-/*! \brief Starts a position test asynchronously
-\param x specifies x offset from the current modelview matrix
-\param y specifies y offset from the current modelview matrix
-\param z specifies z offset from the current modelview matrix */
-GL_STATIC_INL void PosTest_Asynch(v16 x, v16 y, v16 z){
- GFX_POS_TEST = VERTEX_PACK(x, y);
- GFX_POS_TEST = z;
-}
-
-/*! \brief Performs a position test
-\param x specifies x offset from the current modelview matrix
-\param y specifies y offset from the current modelview matrix
-\param z specifies z offset from the current modelview matrix */
-GL_STATIC_INL void PosTest(v16 x, v16 y, v16 z) {
- PosTest_Asynch(x,y,z);
- while(PosTestBusy());
-}
-
-/*! \brief Returns the distance from the camera of the last position test, pretty darn useful
-\return W magnitude */
-GL_STATIC_INL int32 PosTestWresult() {
- return GFX_POS_RESULT[3];
-}
-
-/*! \brief Returns absolute X position of the last position test (location if the modelview matrix was identity)
-\return Absolute X position */
-GL_STATIC_INL int32 PosTestXresult() {
- return GFX_POS_RESULT[0];
-}
-
-/*! \brief Returns absolute Y position of the last position test (location if the modelview matrix was identity)
-\return Absolute Y position */
-GL_STATIC_INL int32 PosTestYresult() {
- return GFX_POS_RESULT[1];
-}
-
-/*! \brief Returns absolute Z position of the last position test (location if the modelview matrix was identity)
-\return Absolute Z position */
-GL_STATIC_INL int32 PosTestZresult() {
- return GFX_POS_RESULT[2];
-}
-
-#endif // ifndef POS_TEST_INCLUDE
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/rumble.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/rumble.h
deleted file mode 100644
index 0361052827..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/rumble.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Mike Parks (BigRedPimp)
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-/*! \file rumble.h
- \brief nds rumble option pak support.
-*/
-#ifndef RUMBLE_HEADER_INCLUDE
-#define RUMBLE_HEADER_INCLUDE
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define RUMBLE_PAK (*(vuint16 *)0x08000000)
-#define WARIOWARE_PAK (*(vuint16 *)0x080000C4)
-#define WARIOWARE_ENABLE (*(vuint16 *)0x080000C6)
-
-typedef enum {
- RUMBLE,
- WARIOWARE
-}RUMBLE_TYPE;
-
-/*! \fn bool isRumbleInserted(void);
- \brief Check for rumble option pak.
- Returns true if the cart in the GBA slot is a Rumble option pak.
-*/
-bool isRumbleInserted(void);
-
-/*! \fn void setRumble(bool position);
- \param position Alternates position of the actuator in the pak
- \brief Fires the rumble actuator.
-*/
-void setRumble(bool position);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sound.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sound.h
deleted file mode 100644
index 96b63f4405..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sound.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*---------------------------------------------------------------------------------
- Sound Functions
-
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef _sound_h_
-#define _sound_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <nds/ipc.h>
-
-void playSound( pTransferSoundData sound);
-void setGenericSound( u32 rate, u8 vol, u8 pan, u8 format);
-void playGenericSound(const void* data, u32 length);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _sound_h_
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sprite.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sprite.h
deleted file mode 100644
index bbfefad6a3..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sprite.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- sprite.h -- definitions for DS sprites
-
- Copyright (C) 2007
- Liran Nuna (LiraNuna)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef _libnds_sprite_h_
-#define _libnds_sprite_h_
-
-#ifndef ARM9
-#error Sprites are only available on the ARM9
-#endif
-
-#include <nds/jtypes.h>
-
-// Sprite control defines
-
-// Attribute 0 consists of 8 bits of Y plus the following flags:
-#define ATTR0_NORMAL (0<<8)
-#define ATTR0_ROTSCALE (1<<8)
-#define ATTR0_DISABLED (2<<8)
-#define ATTR0_ROTSCALE_DOUBLE (3<<8)
-
-#define ATTR0_TYPE_NORMAL (0<<10)
-#define ATTR0_TYPE_BLENDED (1<<10)
-#define ATTR0_TYPE_WINDOWED (2<<10)
-#define ATTR0_BMP (3<<10)
-
-#define ATTR0_MOSAIC (1<<12)
-
-#define ATTR0_COLOR_16 (0<<13) //16 color in tile mode...16 bit in bitmap mode
-#define ATTR0_COLOR_256 (1<<13)
-
-#define ATTR0_SQUARE (0<<14)
-#define ATTR0_WIDE (1<<14)
-#define ATTR0_TALL (2<<14)
-
-#define OBJ_Y(m) ((m)&0x00ff)
-
-// Atribute 1 consists of 9 bits of X plus the following flags:
-#define ATTR1_ROTDATA(n) ((n)<<9) // note: overlaps with flip flags
-#define ATTR1_FLIP_X (1<<12)
-#define ATTR1_FLIP_Y (1<<13)
-#define ATTR1_SIZE_8 (0<<14)
-#define ATTR1_SIZE_16 (1<<14)
-#define ATTR1_SIZE_32 (2<<14)
-#define ATTR1_SIZE_64 (3<<14)
-
-#define OBJ_X(m) ((m)&0x01ff)
-
-// Atribute 2 consists of the following:
-#define ATTR2_PRIORITY(n) ((n)<<10)
-#define ATTR2_PALETTE(n) ((n)<<12)
-#define ATTR2_ALPHA(n) ((n)<<12)
-
-/**
- * @enum tObjMode
- * @brief Sprite display mode.
- */
-typedef enum
-{
- OBJMODE_NORMAL, /**< No special mode is on - Normal sprite state. */
- OBJMODE_BLENDED, /**< Color blending is on - Sprite can use HW blending features. */
- OBJMODE_WINDOWED, /**< Sprite can be seen only inside the sprite window. */
- OBJMODE_BITMAP, /**< Sprite is not using tiles - per pixel image data. */
-
-} tObjMode;
-
-/**
- * @enum tObjShape
- * @brief Sprite shape mode.
- */
-typedef enum {
- OBJSHAPE_SQUARE, /**< Sprite shape is NxN (Height == Width). */
- OBJSHAPE_WIDE, /**< Sprite shape is NxM with N > M (Height < Width). */
- OBJSHAPE_TALL, /**< Sprite shape is NxM with N < M (Height > Width). */
- OBJSHAPE_FORBIDDEN, /**< Sprite shape is undefined. */
-} tObjShape;
-
-/**
- * @enum tObjSize
- * @brief Object shape mode.
- */
-typedef enum {
- OBJSIZE_8, /**< Major sprite size is 8px. */
- OBJSIZE_16, /**< Major sprite size is 16px. */
- OBJSIZE_32, /**< Major sprite size is 32px. */
- OBJSIZE_64, /**< Major sprite size is 64px. */
-} tObjSize;
-
-/**
- * @enum tObjColMode
- * @brief Object color mode.
- */
-typedef enum {
- OBJCOLOR_16, /**< sprite has 16 colors. */
- OBJCOLOR_256, /**< sprite has 256 colors. */
-} tObjColMode;
-
-/**
- * @enum tObjColMode
- * @brief Object color mode.
- */
-typedef enum {
- OBJPRIORITY_0, /**< sprite priority level 0 - highest. */
- OBJPRIORITY_1, /**< sprite priority level 1. */
- OBJPRIORITY_2, /**< sprite priority level 2. */
- OBJPRIORITY_3, /**< sprite priority level 3 - lowest. */
-} tObjPriority;
-
-// Sprite structures
-
-typedef union {
- struct {
-
- struct {
- u16 posY :8; /**< Sprite Y position. */
- union {
- struct {
- u8 :1;
- bool isHidden :1; /**< Sprite is hidden (isRotoscale cleared). */
- u8 :6;
- };
- struct {
- bool isRotoscale :1; /**< Sprite uses affine parameters if set. */
- bool rsDouble :1; /**< Sprite bounds is doubled (isRotoscale set). */
- tObjMode objMode :2; /**< Sprite object mode. */
- bool isMosaic :1; /**< Enables mosaic effect if set. */
- tObjColMode colMode :1; /**< Sprite color mode. */
- tObjShape objShape :2; /**< Sprite shape. */
- };
- };
- };
-
- union {
- struct {
- u16 posX :9; /**< Sprite X position. */
- u8 :7;
- };
- struct {
- u8 :8;
- union {
- struct {
- u8 :4;
- bool hFlip :1; /**< Flip sprite horizontally (isRotoscale cleared). */
- bool vFlip :1; /**< Flip sprite vertically (isRotoscale cleared).*/
- u8 :2;
- };
- struct {
- u8 :1;
- u8 rsMatrixIdx :5; /**< Affine parameter number to use (isRotoscale set). */
- tObjSize objSize :2; /**< Sprite size. */
- };
- };
- };
- };
-
- struct {
- u16 tileIdx :10;/**< Upper-left tile index. */
- tObjPriority objPriority :2; /**< Sprite priority. */
- u8 objPal :4; /**< Sprite palette to use in paletted color modes. */
- };
-
- u16 attribute3; /**< Four of those are used as a sprite rotation matrice */
- };
-
- struct {
- uint16 attribute[3];
- uint16 filler;
- };
-
-} SpriteEntry, * pSpriteEntry;
-
-
-typedef struct sSpriteRotation {
- uint16 filler1[3];
- int16 hdx;
-
- uint16 filler2[3];
- int16 hdy;
-
- uint16 filler3[3];
- int16 vdx;
-
- uint16 filler4[3];
- int16 vdy;
-} SpriteRotation, * pSpriteRotation;
-
-#define SPRITE_COUNT 128
-#define MATRIX_COUNT 32
-
-/**
- * @union tOAM
- * @brief Final OAM representation in memory
-*/
-typedef union {
- SpriteEntry spriteBuffer[SPRITE_COUNT];
- SpriteRotation matrixBuffer[MATRIX_COUNT];
-} tOAM;
-
-
-#endif // _libnds_sprite_h_
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/trig_lut.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/trig_lut.h
deleted file mode 100644
index 7d946bfafc..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/trig_lut.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*---------------------------------------------------------------------------------
- Trig_lut.h provides access to external precompiled trig look up tables
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef TRIG_LUT_H
-#define TRIG_LUT_H
-
-
-extern short COS_bin[];
-extern short SIN_bin[];
-extern short TAN_bin[];
-
-
-#define COS COS_bin
-#define SIN SIN_bin
-#define TAN TAN_bin
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/video.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/video.h
deleted file mode 100644
index 9e910c621f..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/video.h
+++ /dev/null
@@ -1,591 +0,0 @@
-/*---------------------------------------------------------------------------------
- Video registers and defines
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef VIDEO_ARM9_INCLUDE
-#define VIDEO_ARM9_INCLUDE
-
-
-#ifndef ARM9
-#error Video is only available on the ARM9
-#endif
-
-#include <nds/jtypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// macro creates a 15 bit color from 3x5 bit components
-#define RGB15(r,g,b) ((r)|((g)<<5)|((b)<<10))
-#define RGB5(r,g,b) ((r)|((g)<<5)|((b)<<10))
-#define RGB8(r,g,b) (((r)>>3)|(((g)>>3)<<5)|(((b)>>3)<<10))
-
-
-#define SCREEN_HEIGHT 192
-#define SCREEN_WIDTH 256
-// Vram Control
-#define VRAM_CR (*(vuint32*)0x04000240)
-#define VRAM_A_CR (*(vuint8*)0x04000240)
-#define VRAM_B_CR (*(vuint8*)0x04000241)
-#define VRAM_C_CR (*(vuint8*)0x04000242)
-#define VRAM_D_CR (*(vuint8*)0x04000243)
-#define VRAM_E_CR (*(vuint8*)0x04000244)
-#define VRAM_F_CR (*(vuint8*)0x04000245)
-#define VRAM_G_CR (*(vuint8*)0x04000246)
-#define WRAM_CR (*(vuint8*)0x04000247)
-#define VRAM_H_CR (*(vuint8*)0x04000248)
-#define VRAM_I_CR (*(vuint8*)0x04000249)
-
-#define VRAM_ENABLE (1<<7)
-
-#define VRAM_OFFSET(n) ((n)<<3)
-
-
-typedef enum {
- VRAM_A_LCD = 0,
- VRAM_A_MAIN_BG = 1,
- VRAM_A_MAIN_BG_0x06000000 = 1 | VRAM_OFFSET(0),
- VRAM_A_MAIN_BG_0x06020000 = 1 | VRAM_OFFSET(1),
- VRAM_A_MAIN_BG_0x06040000 = 1 | VRAM_OFFSET(2),
- VRAM_A_MAIN_BG_0x06060000 = 1 | VRAM_OFFSET(3),
- VRAM_A_MAIN_SPRITE = 2,
- VRAM_A_MAIN_SPRITE_0x06400000 = 2,
- VRAM_A_MAIN_SPRITE_0x06420000 = 2 | VRAM_OFFSET(1),
- VRAM_A_TEXTURE = 3,
- VRAM_A_TEXTURE_SLOT0 = 3 | VRAM_OFFSET(0),
- VRAM_A_TEXTURE_SLOT1 = 3 | VRAM_OFFSET(1),
- VRAM_A_TEXTURE_SLOT2 = 3 | VRAM_OFFSET(2),
- VRAM_A_TEXTURE_SLOT3 = 3 | VRAM_OFFSET(3)
-} VRAM_A_TYPE;
-
-typedef enum {
- VRAM_B_LCD = 0,
- VRAM_B_MAIN_BG = 1 | VRAM_OFFSET(1),
- VRAM_B_MAIN_BG_0x06000000 = 1 | VRAM_OFFSET(0),
- VRAM_B_MAIN_BG_0x06020000 = 1 | VRAM_OFFSET(1),
- VRAM_B_MAIN_BG_0x06040000 = 1 | VRAM_OFFSET(2),
- VRAM_B_MAIN_BG_0x06060000 = 1 | VRAM_OFFSET(3),
- VRAM_B_MAIN_SPRITE = 2 | VRAM_OFFSET(1),
- VRAM_B_MAIN_SPRITE_0x06400000 = 2,
- VRAM_B_MAIN_SPRITE_0x06420000 = 2 | VRAM_OFFSET(1),
- VRAM_B_TEXTURE = 3 | VRAM_OFFSET(1),
- VRAM_B_TEXTURE_SLOT0 = 3 | VRAM_OFFSET(0),
- VRAM_B_TEXTURE_SLOT1 = 3 | VRAM_OFFSET(1),
- VRAM_B_TEXTURE_SLOT2 = 3 | VRAM_OFFSET(2),
- VRAM_B_TEXTURE_SLOT3 = 3 | VRAM_OFFSET(3)
-} VRAM_B_TYPE;
-
-typedef enum {
- VRAM_C_LCD = 0,
- VRAM_C_MAIN_BG = 1 | VRAM_OFFSET(2),
- VRAM_C_MAIN_BG_0x06000000 = 1 | VRAM_OFFSET(0),
- VRAM_C_MAIN_BG_0x06020000 = 1 | VRAM_OFFSET(1),
- VRAM_C_MAIN_BG_0x06040000 = 1 | VRAM_OFFSET(2),
- VRAM_C_MAIN_BG_0x06060000 = 1 | VRAM_OFFSET(3),
- VRAM_C_ARM7 = 2,
- VRAM_C_ARM7_0x06000000 = 2,
- VRAM_C_ARM7_0x06020000 = 2 | VRAM_OFFSET(1),
- VRAM_C_SUB_BG = 4,
- VRAM_C_SUB_BG_0x06200000 = 4 | VRAM_OFFSET(0),
- VRAM_C_SUB_BG_0x06220000 = 4 | VRAM_OFFSET(1),
- VRAM_C_SUB_BG_0x06240000 = 4 | VRAM_OFFSET(2),
- VRAM_C_SUB_BG_0x06260000 = 4 | VRAM_OFFSET(3),
- VRAM_C_TEXTURE = 3 | VRAM_OFFSET(2),
- VRAM_C_TEXTURE_SLOT0 = 3 | VRAM_OFFSET(0),
- VRAM_C_TEXTURE_SLOT1 = 3 | VRAM_OFFSET(1),
- VRAM_C_TEXTURE_SLOT2 = 3 | VRAM_OFFSET(2),
- VRAM_C_TEXTURE_SLOT3 = 3 | VRAM_OFFSET(3)
-} VRAM_C_TYPE;
-
-typedef enum {
- VRAM_D_LCD = 0,
- VRAM_D_MAIN_BG = 1 | VRAM_OFFSET(3),
- VRAM_D_MAIN_BG_0x06000000 = 1 | VRAM_OFFSET(0),
- VRAM_D_MAIN_BG_0x06020000 = 1 | VRAM_OFFSET(1),
- VRAM_D_MAIN_BG_0x06040000 = 1 | VRAM_OFFSET(2),
- VRAM_D_MAIN_BG_0x06060000 = 1 | VRAM_OFFSET(3),
- VRAM_D_ARM7 = 2 | VRAM_OFFSET(1),
- VRAM_D_ARM7_0x06000000 = 2,
- VRAM_D_ARM7_0x06020000 = 2 | VRAM_OFFSET(1),
- VRAM_D_SUB_SPRITE = 4,
- VRAM_D_TEXTURE = 3 | VRAM_OFFSET(3),
- VRAM_D_TEXTURE_SLOT0 = 3 | VRAM_OFFSET(0),
- VRAM_D_TEXTURE_SLOT1 = 3 | VRAM_OFFSET(1),
- VRAM_D_TEXTURE_SLOT2 = 3 | VRAM_OFFSET(2),
- VRAM_D_TEXTURE_SLOT3 = 3 | VRAM_OFFSET(3)
-} VRAM_D_TYPE;
-
-typedef enum {
- VRAM_E_LCD = 0,
- VRAM_E_MAIN_BG = 1,
- VRAM_E_MAIN_SPRITE = 2,
- VRAM_E_TEX_PALETTE = 3,
- VRAM_E_BG_EXT_PALETTE = 4,
- VRAM_E_OBJ_EXT_PALETTE = 5,
-} VRAM_E_TYPE;
-
-typedef enum {
- VRAM_F_LCD = 0,
- VRAM_F_MAIN_BG = 1,
- VRAM_F_MAIN_SPRITE = 2,
- VRAM_F_MAIN_SPRITE_0x06000000 = 2,
- VRAM_F_MAIN_SPRITE_0x06004000 = 2 | VRAM_OFFSET(1),
- VRAM_F_MAIN_SPRITE_0x06010000 = 2 | VRAM_OFFSET(2),
- VRAM_F_MAIN_SPRITE_0x06014000 = 2 | VRAM_OFFSET(3),
- VRAM_F_TEX_PALETTE = 3,
- VRAM_F_BG_EXT_PALETTE = 4,
- VRAM_F_OBJ_EXT_PALETTE = 5,
-} VRAM_F_TYPE;
-
-typedef enum {
- VRAM_G_LCD = 0,
- VRAM_G_MAIN_BG = 1,
- VRAM_G_MAIN_SPRITE = 2,
- VRAM_G_MAIN_SPRITE_0x06000000 = 2,
- VRAM_G_MAIN_SPRITE_0x06004000 = 2 | VRAM_OFFSET(1),
- VRAM_G_MAIN_SPRITE_0x06010000 = 2 | VRAM_OFFSET(2),
- VRAM_G_MAIN_SPRITE_0x06014000 = 2 | VRAM_OFFSET(3),
- VRAM_G_TEX_PALETTE = 3,
- VRAM_G_BG_EXT_PALETTE = 4,
- VRAM_G_OBJ_EXT_PALETTE = 5,
-} VRAM_G_TYPE;
-
-typedef enum {
- VRAM_H_LCD = 0,
- VRAM_H_SUB_BG = 1,
- VRAM_H_SUB_BG_EXT_PALETTE = 2,
-} VRAM_H_TYPE;
-
-typedef enum {
- VRAM_I_LCD = 0,
- VRAM_I_SUB_BG = 1,
- VRAM_I_SUB_SPRITE = 2,
- VRAM_I_SUB_SPRITE_EXT_PALETTE = 3,
-}VRAM_I_TYPE;
-
-
-typedef u16 _palette[256];
-typedef _palette _ext_palette[16];
-
-#define VRAM_E_EXT_PALETTE ((_ext_palette *)VRAM_E)
-#define VRAM_F_EXT_PALETTE ((_ext_palette *)VRAM_F)
-#define VRAM_G_EXT_PALETTE ((_ext_palette *)VRAM_G)
-#define VRAM_H_EXT_PALETTE ((_ext_palette *)VRAM_H)
-
-
-uint32 vramSetMainBanks(VRAM_A_TYPE a, VRAM_B_TYPE b, VRAM_C_TYPE c, VRAM_D_TYPE d);
-void vramRestoreMainBanks(uint32 vramTemp);
-
-void vramSetBankA(VRAM_A_TYPE a);
-void vramSetBankB(VRAM_B_TYPE b);
-void vramSetBankC(VRAM_C_TYPE c);
-void vramSetBankD(VRAM_D_TYPE d);
-void vramSetBankE(VRAM_E_TYPE e);
-void vramSetBankF(VRAM_F_TYPE f);
-void vramSetBankG(VRAM_G_TYPE g);
-void vramSetBankH(VRAM_H_TYPE h);
-void vramSetBankI(VRAM_I_TYPE i);
-
-
-// Display control registers
-#define DISPLAY_CR (*(vuint32*)0x04000000)
-#define SUB_DISPLAY_CR (*(vuint32*)0x04001000)
-
-#define MODE_0_2D 0x10000
-#define MODE_1_2D 0x10001
-#define MODE_2_2D 0x10002
-#define MODE_3_2D 0x10003
-#define MODE_4_2D 0x10004
-#define MODE_5_2D 0x10005
-
-// main display only
-#define MODE_6_2D 0x10006
-#define MODE_FIFO (3<<16)
-
-#define ENABLE_3D (1<<3)
-
-#define DISPLAY_BG0_ACTIVE (1 << 8)
-#define DISPLAY_BG1_ACTIVE (1 << 9)
-#define DISPLAY_BG2_ACTIVE (1 << 10)
-#define DISPLAY_BG3_ACTIVE (1 << 11)
-#define DISPLAY_SPR_ACTIVE (1 << 12)
-#define DISPLAY_WIN0_ON (1 << 13)
-#define DISPLAY_WIN1_ON (1 << 14)
-#define DISPLAY_SPR_WIN_ON (1 << 15)
-
-
-// Main display only
-#define MODE_0_3D (MODE_0_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_1_3D (MODE_1_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_2_3D (MODE_2_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_3_3D (MODE_3_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_4_3D (MODE_4_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_5_3D (MODE_5_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_6_3D (MODE_6_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-
-#define MODE_FB0 (0x00020000)
-#define MODE_FB1 (0x00060000)
-#define MODE_FB2 (0x000A0000)
-#define MODE_FB3 (0x000E0000)
-
-#define DISPLAY_SPR_HBLANK (1 << 23)
-
-#define DISPLAY_SPR_1D_LAYOUT (1 << 4)
-
-#define DISPLAY_SPR_1D (1 << 4)
-#define DISPLAY_SPR_2D (0 << 4)
-#define DISPLAY_SPR_1D_BMP (4 << 4)
-#define DISPLAY_SPR_2D_BMP_128 (0 << 4)
-#define DISPLAY_SPR_2D_BMP_256 (2 << 4)
-
-
-#define DISPLAY_SPR_1D_SIZE_32 (0 << 20)
-#define DISPLAY_SPR_1D_SIZE_64 (1 << 20)
-#define DISPLAY_SPR_1D_SIZE_128 (2 << 20)
-#define DISPLAY_SPR_1D_SIZE_256 (3 << 20)
-#define DISPLAY_SPR_1D_BMP_SIZE_128 (0 << 22)
-#define DISPLAY_SPR_1D_BMP_SIZE_256 (1 << 22)
-
-
-#define DISPLAY_SPR_EXT_PALETTE (1 << 31)
-#define DISPLAY_BG_EXT_PALETTE (1 << 30)
-
-#define DISPLAY_SCREEN_OFF (1 << 7)
-
-// The next two defines only apply to MAIN 2d engine
-// In tile modes, this is multiplied by 64KB and added to BG_TILE_BASE
-// In all bitmap modes, it is not used.
-#define DISPLAY_CHAR_BASE(n) (((n)&7)<<24)
-
-// In tile modes, this is multiplied by 64KB and added to BG_MAP_BASE
-// In bitmap modes, this is multiplied by 64KB and added to BG_BMP_BASE
-// In large bitmap modes, this is not used
-#define DISPLAY_SCREEN_BASE(n) (((n)&7)<<27)
-
-static inline
-void videoSetMode( uint32 mode) { DISPLAY_CR = mode; }
-static inline
-void videoSetModeSub( uint32 mode) { SUB_DISPLAY_CR = mode; }
-
-#define BRIGHTNESS (*(vuint16*)0x0400006C)
-#define SUB_BRIGHTNESS (*(vuint16*)0x0400106C)
-
-#define BGCTRL ((vuint16*)0x04000008)
-#define BG0_CR (*(vuint16*)0x04000008)
-#define BG1_CR (*(vuint16*)0x0400000A)
-#define BG2_CR (*(vuint16*)0x0400000C)
-#define BG3_CR (*(vuint16*)0x0400000E)
-
-#define BGCTRL_SUB ((vuint16*)0x04001008)
-#define SUB_BG0_CR (*(vuint16*)0x04001008)
-#define SUB_BG1_CR (*(vuint16*)0x0400100A)
-#define SUB_BG2_CR (*(vuint16*)0x0400100C)
-#define SUB_BG3_CR (*(vuint16*)0x0400100E)
-
-#define BG_256_COLOR (BIT(7))
-#define BG_16_COLOR (0)
-
-#define BG_MOSAIC_ON (BIT(6))
-#define BG_MOSAIC_OFF (0)
-
-#define BG_PRIORITY(n) (n)
-#define BG_PRIORITY_0 (0)
-#define BG_PRIORITY_1 (1)
-#define BG_PRIORITY_2 (2)
-#define BG_PRIORITY_3 (3)
-
-#define BG_TILE_BASE(base) ((base) << 2)
-#define BG_MAP_BASE(base) ((base) << 8)
-#define BG_BMP_BASE(base) ((base) << 8)
-
-#define BG_MAP_RAM(base) (((base)*0x800) + 0x06000000)
-#define BG_MAP_RAM_SUB(base) (((base)*0x800) + 0x06200000)
-
-#define BG_TILE_RAM(base) (((base)*0x4000) + 0x06000000)
-#define BG_TILE_RAM_SUB(base) (((base)*0x4000) + 0x06200000)
-
-#define BG_BMP_RAM(base) (((base)*0x4000) + 0x06000000)
-#define BG_BMP_RAM_SUB(base) (((base)*0x4000) + 0x06200000)
-
-#define BG_WRAP_OFF (0)
-#define BG_WRAP_ON (1 << 13)
-
-#define BG_32x32 (0 << 14)
-#define BG_64x32 (1 << 14)
-#define BG_32x64 (2 << 14)
-#define BG_64x64 (3 << 14)
-
-#define BG_RS_16x16 (0 << 14)
-#define BG_RS_32x32 (1 << 14)
-#define BG_RS_64x64 (2 << 14)
-#define BG_RS_128x128 (3 << 14)
-
-#define BG_BMP8_128x128 (BG_RS_16x16 | BG_256_COLOR)
-#define BG_BMP8_256x256 (BG_RS_32x32 | BG_256_COLOR)
-#define BG_BMP8_512x256 (BG_RS_64x64 | BG_256_COLOR)
-#define BG_BMP8_512x512 (BG_RS_128x128 | BG_256_COLOR)
-#define BG_BMP8_1024x512 BIT(14)
-#define BG_BMP8_512x1024 0
-
-#define BG_BMP16_128x128 (BG_RS_16x16 | BG_256_COLOR | BIT(2))
-#define BG_BMP16_256x256 (BG_RS_32x32 | BG_256_COLOR | BIT(2))
-#define BG_BMP16_512x256 (BG_RS_64x64 | BG_256_COLOR | BIT(2))
-#define BG_BMP16_512x512 (BG_RS_128x128 | BG_256_COLOR | BIT(2))
-
-#define BG_PALETTE_SLOT0 0
-#define BG_PALETTE_SLOT1 0
-#define BG_PALETTE_SLOT2 BIT(13)
-#define BG_PALETTE_SLOT3 BIT(13)
-
-typedef struct {
- u16 x;
- u16 y;
-} bg_scroll;
-
-typedef struct {
- u16 xdx;
- u16 xdy;
- u16 ydx;
- u16 ydy;
- u32 centerX;
- u32 centerY;
-} bg_rotation;
-
-typedef struct {
- u16 control[4];
- bg_scroll scroll[4];
- bg_rotation bg2_rotation;
- bg_rotation bg3_rotation;
-} bg_attribute;
-
-#define BACKGROUND (*((bg_attribute *)0x04000008))
-#define BACKGROUND_SUB (*((bg_attribute *)0x04001008))
-
-#define BG_OFFSET ((bg_scroll *)(0x04000010))
-
-#define BG0_X0 (*(vuint16*)0x04000010)
-#define BG0_Y0 (*(vuint16*)0x04000012)
-#define BG1_X0 (*(vuint16*)0x04000014)
-#define BG1_Y0 (*(vuint16*)0x04000016)
-#define BG2_X0 (*(vuint16*)0x04000018)
-#define BG2_Y0 (*(vuint16*)0x0400001A)
-#define BG3_X0 (*(vuint16*)0x0400001C)
-#define BG3_Y0 (*(vuint16*)0x0400001E)
-
-#define BG2_XDX (*(vuint16*)0x04000020)
-#define BG2_XDY (*(vuint16*)0x04000022)
-#define BG2_YDX (*(vuint16*)0x04000024)
-#define BG2_YDY (*(vuint16*)0x04000026)
-#define BG2_CX (*(vuint32*)0x04000028)
-#define BG2_CY (*(vuint32*)0x0400002C)
-
-#define BG3_XDX (*(vuint16*)0x04000030)
-#define BG3_XDY (*(vuint16*)0x04000032)
-#define BG3_YDX (*(vuint16*)0x04000034)
-#define BG3_YDY (*(vuint16*)0x04000036)
-#define BG3_CX (*(vuint32*)0x04000038)
-#define BG3_CY (*(vuint32*)0x0400003C)
-
-#define SUB_BG0_X0 (*(vuint16*)0x04001010)
-#define SUB_BG0_Y0 (*(vuint16*)0x04001012)
-#define SUB_BG1_X0 (*(vuint16*)0x04001014)
-#define SUB_BG1_Y0 (*(vuint16*)0x04001016)
-#define SUB_BG2_X0 (*(vuint16*)0x04001018)
-#define SUB_BG2_Y0 (*(vuint16*)0x0400101A)
-#define SUB_BG3_X0 (*(vuint16*)0x0400101C)
-#define SUB_BG3_Y0 (*(vuint16*)0x0400101E)
-
-#define SUB_BG2_XDX (*(vuint16*)0x04001020)
-#define SUB_BG2_XDY (*(vuint16*)0x04001022)
-#define SUB_BG2_YDX (*(vuint16*)0x04001024)
-#define SUB_BG2_YDY (*(vuint16*)0x04001026)
-#define SUB_BG2_CX (*(vuint32*)0x04001028)
-#define SUB_BG2_CY (*(vuint32*)0x0400102C)
-
-#define SUB_BG3_XDX (*(vuint16*)0x04001030)
-#define SUB_BG3_XDY (*(vuint16*)0x04001032)
-#define SUB_BG3_YDX (*(vuint16*)0x04001034)
-#define SUB_BG3_YDY (*(vuint16*)0x04001036)
-#define SUB_BG3_CX (*(vuint32*)0x04001038)
-#define SUB_BG3_CY (*(vuint32*)0x0400103C)
-
-// Window 0
-#define WIN0_X0 (*(vuint8*)0x04000041)
-#define WIN0_X1 (*(vuint8*)0x04000040)
-#define WIN0_Y0 (*(vuint8*)0x04000045)
-#define WIN0_Y1 (*(vuint8*)0x04000044)
-
-// Window 1
-#define WIN1_X0 (*(vuint8*)0x04000042)
-#define WIN1_X1 (*(vuint8*)0x04000043)
-#define WIN1_Y0 (*(vuint8*)0x04000047)
-#define WIN1_Y1 (*(vuint8*)0x04000046)
-
-#define WIN_IN (*(vuint16*)0x04000048)
-#define WIN_OUT (*(vuint16*)0x0400004A)
-
-// Window 0
-#define SUB_WIN0_X0 (*(vuint8*)0x04001041)
-#define SUB_WIN0_X1 (*(vuint8*)0x04001040)
-#define SUB_WIN0_Y0 (*(vuint8*)0x04001045)
-#define SUB_WIN0_Y1 (*(vuint8*)0x04001044)
-
-// Window 1
-#define SUB_WIN1_X0 (*(vuint8*)0x04001042)
-#define SUB_WIN1_X1 (*(vuint8*)0x04001043)
-#define SUB_WIN1_Y0 (*(vuint8*)0x04001047)
-#define SUB_WIN1_Y1 (*(vuint8*)0x04001046)
-
-#define SUB_WIN_IN (*(vuint16*)0x04001048)
-#define SUB_WIN_OUT (*(vuint16*)0x0400104A)
-
-#define MOSAIC_CR (*(vuint16*)0x0400004C)
-#define SUB_MOSAIC_CR (*(vuint16*)0x0400104C)
-
-#define BLEND_CR (*(vuint16*)0x04000050)
-#define BLEND_AB (*(vuint16*)0x04000052)
-#define BLEND_Y (*(vuint16*)0x04000054)
-
-#define SUB_BLEND_CR (*(vuint16*)0x04001050)
-#define SUB_BLEND_AB (*(vuint16*)0x04001052)
-#define SUB_BLEND_Y (*(vuint16*)0x04001054)
-
-#define BLEND_NONE (0<<6)
-#define BLEND_ALPHA (1<<6)
-#define BLEND_FADE_WHITE (2<<6)
-#define BLEND_FADE_BLACK (3<<6)
-
-#define BLEND_SRC_BG0 (1<<0)
-#define BLEND_SRC_BG1 (1<<1)
-#define BLEND_SRC_BG2 (1<<2)
-#define BLEND_SRC_BG3 (1<<3)
-#define BLEND_SRC_SPRITE (1<<4)
-#define BLEND_SRC_BACKDROP (1<<5)
-
-#define BLEND_DST_BG0 (1<<8)
-#define BLEND_DST_BG1 (1<<9)
-#define BLEND_DST_BG2 (1<<10)
-#define BLEND_DST_BG3 (1<<11)
-#define BLEND_DST_SPRITE (1<<12)
-#define BLEND_DST_BACKDROP (1<<13)
-
-// Display capture control
-
-#define REG_DISPCAPCNT (*(vuint32*)0x04000064)
-#define REG_ DISP_MMEM_FIFO (*(vuint32*)0x04000068)
-
-#define DCAP_ENABLE BIT(31)
-#define DCAP_MODE(n) (((n) & 3) << 29)
-#define DCAP_DST(n) (((n) & 3) << 26)
-#define DCAP_SRC(n) (((n) & 3) << 24)
-#define DCAP_SIZE(n) (((n) & 3) << 20)
-#define DCAP_OFFSET(n) (((n) & 3) << 18)
-#define DCAP_BANK(n) (((n) & 3) << 16)
-#define DCAP_B(n) (((n) & 0x1F) << 8)
-#define DCAP_A(n) (((n) & 0x1F) << 0)
-
-
-// 3D core control
-
-#define GFX_CONTROL (*(vuint16*) 0x04000060)
-
-#define GFX_FIFO (*(vuint32*) 0x04000400)
-#define GFX_STATUS (*(vuint32*) 0x04000600)
-#define GFX_COLOR (*(vuint32*) 0x04000480)
-
-#define GFX_VERTEX10 (*(vuint32*) 0x04000490)
-#define GFX_VERTEX_XY (*(vuint32*) 0x04000494)
-#define GFX_VERTEX_XZ (*(vuint32*) 0x04000498)
-#define GFX_VERTEX_YZ (*(vuint32*) 0x0400049C)
-#define GFX_VERTEX_DIFF (*(vuint32*) 0x040004A0)
-
-#define GFX_VERTEX16 (*(vuint32*) 0x0400048C)
-#define GFX_TEX_COORD (*(vuint32*) 0x04000488)
-#define GFX_TEX_FORMAT (*(vuint32*) 0x040004A8)
-#define GFX_PAL_FORMAT (*(vuint32*) 0x040004AC)
-
-#define GFX_CLEAR_COLOR (*(vuint32*) 0x04000350)
-#define GFX_CLEAR_DEPTH (*(vuint16*) 0x04000354)
-
-#define GFX_LIGHT_VECTOR (*(vuint32*) 0x040004C8)
-#define GFX_LIGHT_COLOR (*(vuint32*) 0x040004CC)
-#define GFX_NORMAL (*(vuint32*) 0x04000484)
-
-#define GFX_DIFFUSE_AMBIENT (*(vuint32*) 0x040004C0)
-#define GFX_SPECULAR_EMISSION (*(vuint32*) 0x040004C4)
-#define GFX_SHININESS (*(vuint32*) 0x040004D0)
-
-#define GFX_POLY_FORMAT (*(vuint32*) 0x040004A4)
-#define GFX_ALPHA_TEST (*(vuint16*) 0x04000340)
-
-#define GFX_BEGIN (*(vuint32*) 0x04000500)
-#define GFX_END (*(vuint32*) 0x04000504)
-#define GFX_FLUSH (*(vuint32*) 0x04000540)
-#define GFX_VIEWPORT (*(vuint32*) 0x04000580)
-#define GFX_TOON_TABLE ((vuint16*) 0x04000380)
-#define GFX_EDGE_TABLE ((vuint16*) 0x04000330)
-#define GFX_FOG_COLOR (*(vuint32*) 0x04000358)
-#define GFX_FOG_OFFSET (*(vuint32*) 0x0400035C)
-#define GFX_FOG_TABLE ((vuint8*) 0x04000360)
-#define GFX_BOX_TEST (*(vint32*) 0x040005C0)
-#define GFX_POS_TEST (*(vuint32*) 0x040005C4)
-#define GFX_POS_RESULT ((vint32*) 0x04000620)
-
-#define GFX_BUSY (GFX_STATUS & BIT(27))
-
-#define GFX_VERTEX_RAM_USAGE (*(uint16*) 0x04000606)
-#define GFX_POLYGON_RAM_USAGE (*(uint16*) 0x04000604)
-
-#define GFX_CUTOFF_DEPTH (*(uint16*)0x04000610)
-
-// Matrix processor control
-
-#define MATRIX_CONTROL (*(vuint32*)0x04000440)
-#define MATRIX_PUSH (*(vuint32*)0x04000444)
-#define MATRIX_POP (*(vuint32*)0x04000448)
-#define MATRIX_SCALE (*(vint32*) 0x0400046C)
-#define MATRIX_TRANSLATE (*(vint32*) 0x04000470)
-#define MATRIX_RESTORE (*(vuint32*)0x04000450)
-#define MATRIX_STORE (*(vuint32*)0x0400044C)
-#define MATRIX_IDENTITY (*(vuint32*)0x04000454)
-#define MATRIX_LOAD4x4 (*(vint32*) 0x04000458)
-#define MATRIX_LOAD4x3 (*(vint32*) 0x0400045C)
-#define MATRIX_MULT4x4 (*(vint32*) 0x04000460)
-#define MATRIX_MULT4x3 (*(vint32*) 0x04000464)
-#define MATRIX_MULT3x3 (*(vint32*) 0x04000468)
-
-//matrix operation results
-#define MATRIX_READ_CLIP ((vint32*) (0x04000640))
-#define MATRIX_READ_VECTOR ((vint32*) (0x04000680))
-#define POINT_RESULT ((vint32*) (0x04000620))
-#define VECTOR_RESULT ((vuint16*)(0x04000630))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/videoGL.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/videoGL.h
deleted file mode 100644
index 0f402b434e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/videoGL.h
+++ /dev/null
@@ -1,1295 +0,0 @@
-/*---------------------------------------------------------------------------------
- videoGL.h -- Video API vaguely similar to OpenGL
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
-
----------------------------------------------------------------------------------*/
-/*! \file videoGL.h
-\brief openGL (ish) interface to DS 3D hardware.
-*/
-
-#ifndef VIDEOGL_ARM9_INCLUDE
-#define VIDEOGL_ARM9_INCLUDE
-
-//---------------------------------------------------------------------------------
-
-// for some reason doxygen doesn't like "static inline" but is fine with "GL_STATIC_INL"
-#define GL_STATIC_INL static inline
-
-#ifndef ARM9
-#error 3D hardware is only available from the ARM9
-#endif
-
-//---------------------------------------------------------------------------------
-#include <nds/jtypes.h>
-#include <nds/arm9/video.h>
-#include <nds/dma.h>
-#include <nds/memory.h>
-#include <nds/bios.h>
-#include <nds/arm9/math.h>
-#include <nds/arm9/trig_lut.h>
-#include <nds/arm9/cache.h>
-
-/*---------------------------------------------------------------------------------
- lut resolution for trig functions
- (must be power of two and must be the same as LUT resolution)
- in other words dont change unless you also change your LUTs
----------------------------------------------------------------------------------*/
-#define LUT_SIZE (512)
-#define LUT_MASK (0x1FF)
-
-////////////////////////////////////////////////////////////
-// Misc. constants
-////////////////////////////////////////////////////////////
-
-#define MAX_TEXTURES 2048 //this should be enough ! but feel free to change
-
-
-//////////////////////////////////////////////////////////////////////
-// Fixed point / floating point / integer conversion macros
-//////////////////////////////////////////////////////////////////////
-
-typedef uint16 fixed12d3; /*!< \brief Used for depth (glClearDepth, glCutoffDepth) */
-
-#define int_to_12d3(n) ((n) << 3) /*!< \brief convert int to fixed12d3 */
-#define float_to_12d3(n) ((fixed12d3)((n) * (1 << 3))) /*!< \brief convert float to fixed12d3 */
-#define GL_MAX_DEPTH 0x7FFF /*!< \brief the maximum value for type fixed12d3 */
-
-//////////////////////////////////////////////////////////////////////
-
-#define inttof32(n) ((n) << 12) /*!< \brief convert int to f32 */
-#define f32toint(n) ((n) >> 12) /*!< \brief convert f32 to int */
-#define floattof32(n) ((int32)((n) * (1 << 12))) /*!< \brief convert float to f32 */
-#define f32tofloat(n) (((float)(n)) / (float)(1<<12)) /*!< \brief convert f32 to float */
-
-typedef short int t16; /*!< \brief text coordinate 12.4 fixed point */
-#define f32tot16(n) ((t16)(n >> 8)) /*!< \brief convert f32 to t16 */
-#define inttot16(n) ((n) << 4) /*!< \brief convert int to t16 */
-#define t16toint(n) ((n) >> 4) /*!< \brief convert t16 to int */
-#define floattot16(n) ((t16)((n) * (1 << 4))) /*!< \brief convert float to t16 */
-#define TEXTURE_PACK(u,v) ((u & 0xFFFF) | ((v) << 16)) /*!< \brief Pack 2 t16 texture coordinate values into a 32bit value */
-
-typedef short int v16; /*!< \brief vertex 4.12 fixed format */
-#define inttov16(n) ((n) << 12) /*!< \brief convert int to v16 */
-#define f32tov16(n) (n) /*!< \brief f32 to v16 */
-#define v16toint(n) ((n) >> 12) /*!< \brief convert v16 to int */
-#define floattov16(n) ((v16)((n) * (1 << 12))) /*!< \brief convert float to v16 */
-#define VERTEX_PACK(x,y) (((x) & 0xFFFF) | ((y) << 16)) /*!< \brief Pack to v16 values into one 32bit value */
-
-typedef short int v10; /*!< \brief normal .10 fixed point, NOT USED FOR 10bit VERTEXES!!!*/
-#define inttov10(n) ((n) << 9) /*!< \brief convert int to v10 */
-#define f32tov10(n) ((v10)(n >> 3)) /*!< \brief convert f32 to v10 */
-#define v10toint(n) ((n) >> 9) /*!< \brief convert v10 to int */
-#define floattov10(n) ((n>.998) ? 0x1FF : ((v10)((n)*(1<<9)))) /*!< \brief convert float to v10 */
-#define NORMAL_PACK(x,y,z) (((x) & 0x3FF) | (((y) & 0x3FF) << 10) | ((z) << 20)) /*!< \brief Pack 3 v10 normals into a 32bit value */
-
-//////////////////////////////////////////////////////////////////////
-
-typedef unsigned short rgb; /*!< \brief Holds a color value. 1bit alpha, 5bits red, 5bits green, 5bits blue. */
-
-/*! \brief Holds a Matrix of 3x3 */
-typedef struct {
- int32 m[9]; /*!< array that holds matrix */
-} m3x3;
-
-/*! \brief Holds a Matrix of 4x4 */
-typedef struct {
- int32 m[16]; /*!< array that holds matrix */
-} m4x4;
-
-/*! \brief Holds a Matrix of 4x3 */
-typedef struct {
- int32 m[12]; /*!< array that holds matrix */
-} m4x3;
-
-/*! \brief Holds a Vector<BR>related functions: glScalev(), glTranslatev() */
-typedef struct {
- int32 x, y, z;
-} GLvector;
-
-//////////////////////////////////////////////////////////////////////
-
-#define GL_FALSE 0
-#define GL_TRUE 1
-
-/*! \brief Enums selecting polygon draw mode<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices</A><BR>
-related functions: glBegin() */
-typedef enum {
- GL_TRIANGLES = 0, /*!< draw triangles with each 3 vertices defining a triangle */
- GL_QUADS = 1, /*!< draw quads with each 4 vertices defining a quad */
- GL_TRIANGLE_STRIP = 2, /*!< draw triangles with the first triangle defined by 3 vertices, then each additional triangle being defined by one additional vertex */
- GL_QUAD_STRIP = 3, /*!< draw quads with the first quad being defined by 4 vertices, then each additional triangle being defined by 2 vertices. */
- GL_TRIANGLE = 0, /*!< same as GL_TRIANGLES, old non-OpenGL version */
- GL_QUAD = 1 /*!< same as GL_QUADS, old non-OpenGL version */
-} GL_GLBEGIN_ENUM;
-
-/*! \brief Enums selecting matrix mode<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A><BR>
-related functions: glMatrixMode() */
-typedef enum {
- GL_PROJECTION = 0, /*!< used to set the Projection Matrix */
- GL_POSITION = 1, /*!< used to set the Position Matrix */
- GL_MODELVIEW = 2, /*!< used to set the Modelview Matrix */
- GL_TEXTURE = 3 /*!< used to set the Texture Matrix */
-} GL_MATRIX_MODE_ENUM;
-
-/*! \brief Enums for setting up materials<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A><BR>
-related functions: glMaterialf() */
-typedef enum {
- GL_AMBIENT = 0x01, /*!< sets the ambient color for the material. The color when the normal is not facing light*/
- GL_DIFFUSE = 0x02, /*!< sets the diffuse color for the material. The color when the normal is facing light */
- GL_AMBIENT_AND_DIFFUSE = 0x03, /*!< sets the set ambient and diffuse colors for the material; just a two-in-one of the above.*/
- GL_SPECULAR = 0x04, /*!< sets the specular color for the material. The glossy(highlight) color of the polygon */
- GL_SHININESS = 0x08, /*!< sets the shininess color for the material. The color that shines back to the user. I have shiny pants! */
- GL_EMISSION = 0x10 /*!< sets the emission color for the material. bright color that is indepentant of normals and lights*/
-} GL_MATERIALS_ENUM;
-
-/*! \brief Enums for setting how polygons will be displayed<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes</A><BR>
-related functions: glPolyFmt(), glInit(), POLY_ALPHA(), POLY_ID() */
-enum GL_POLY_FORMAT_ENUM {
- POLY_FORMAT_LIGHT0 = (1<<0), /*!< enable light number 0 */
- POLY_FORMAT_LIGHT1 = (1<<1), /*!< enable light number 1 */
- POLY_FORMAT_LIGHT2 = (1<<2), /*!< enable light number 2 */
- POLY_FORMAT_LIGHT3 = (1<<3), /*!< enable light number 3 */
- POLY_MODULATION = (0<<4), /*!< enable modulation shading mode; this is the default */
- POLY_DECAL = (1<<4), /*!< enable decal shading */
- POLY_TOON_HIGHLIGHT = (2<<4), /*!< enable toon/highlight shading mode */
- POLY_SHADOW = (3<<4), /*!< enable shadow shading */
- POLY_CULL_FRONT = (1<<6), /*!< cull front polygons */
- POLY_CULL_BACK = (2<<6), /*!< cull rear polygons */
- POLY_CULL_NONE = (3<<6), /*!< don't cull any polygons */
- POLY_FOG = (1<<15) /*!< enable/disable fog for this polygon */
-};
-
-/*! \brief Enums for size of a texture, specify one for horizontal and one for vertical
-related functions: glTexImage2d(), glTexParameter() */
-enum GL_TEXTURE_SIZE_ENUM {
- TEXTURE_SIZE_8 = 0, /*!< 8 texels */
- TEXTURE_SIZE_16 = 1, /*!< 16 texels */
- TEXTURE_SIZE_32 = 2, /*!< 32 texels */
- TEXTURE_SIZE_64 = 3, /*!< 64 texels */
- TEXTURE_SIZE_128 = 4, /*!< 128 texels */
- TEXTURE_SIZE_256 = 5, /*!< 256 texels */
- TEXTURE_SIZE_512 = 6, /*!< 512 texels */
- TEXTURE_SIZE_1024 = 7 /*!< 1024 texels */
-};
-
-/*! \brief Enums for texture parameters, such as texture wrapping and texture coord stuff<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes</A><BR>
-related functions: glTexImage2d(), glTexParameter() */
-enum GL_TEXTURE_PARAM_ENUM {
- GL_TEXTURE_WRAP_S = (1 << 16), /*!< wrap(repeat) texture on S axis */
- GL_TEXTURE_WRAP_T = (1 << 17), /*!< wrap(repeat) texture on T axis */
- GL_TEXTURE_FLIP_S = (1 << 18), /*!< flip texture on S axis when wrapping */
- GL_TEXTURE_FLIP_T = (1 << 19), /*!< flip texture on T axis when wrapping */
- GL_TEXTURE_COLOR0_TRANSPARENT = (1<<29), /*!< interpret color 0 as clear, same as old GL_TEXTURE_ALPHA_MASK */
- TEXGEN_OFF = (0<<30), /*!< use unmodified texcoord */
- TEXGEN_TEXCOORD = (1<<30), /*!< multiply texcoords by the texture-matrix */
- TEXGEN_NORMAL = (2<<30), /*!< set texcoords equal to normal * texture-matrix, used for spherical reflection mapping */
- TEXGEN_POSITION = (3<<30) /*!< set texcoords equal to vertex * texture-matrix */
-};
-
-/*! \brief Enums for texture formats<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureformats">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureformats</A><BR>
-related functions: glTexImage2d(), glTexParameter() */
-typedef enum {
- GL_RGB32_A3 = 1, /*!< 32 color palette, 3 bits of alpha */
- GL_RGB4 = 2, /*!< 4 color palette */
- GL_RGB16 = 3, /*!< 16 color palette */
- GL_RGB256 = 4, /*!< 256 color palette */
- GL_COMPRESSED = 5, /*!< compressed texture */
- GL_RGB8_A5 = 6, /*!< 8 color palette, 5 bits of alpha */
- GL_RGBA = 7, /*!< 15 bit direct color, 1 bit of alpha */
- GL_RGB = 8 /*!< 15 bit direct color, manually sets alpha bit to 1 */
-} GL_TEXTURE_TYPE_ENUM;
-
-/*! \brief 3D Display Control Register Enums<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A><BR>
-related functions: glEnable(), glDisable(), glInit() */
-enum DISP3DCNT_ENUM {
- GL_TEXTURE_2D = (1<<0), /*!< enable/disable textures on the geometry engine */
- GL_TOON_HIGHLIGHT = (1<<1), /*!< enable = Highlight shading; disable = Toon shading */
- GL_ALPHA_TEST = (1<<2), /*!< whether to use the alpha threshold set in glAlphaFunc() */
- GL_BLEND = (1<<3), /*!< enable/disable alpha blending */
- GL_ANTIALIAS = (1<<4), /*!< nable/disable edge antialiasing; polygons must have different polygon IDs for the effect to work and the rear plane must be clear */
- GL_OUTLINE = (1<<5), /*!< enable/disable edge coloring; the high 3bits of the polygon ID determine the color; glSetOutlineColor() sets the available colors */
- GL_FOG_ONLY_ALPHA = (1<<6), /*!< enable = fade into background?; disable = don't fade? */
- GL_FOG = (1<<7), /*!< enables/disables fog */
- GL_COLOR_UNDERFLOW = (1<<12), /*!< enable = color buffer underflow, setting resets overflow flag; disable = no color buffer overflow */
- GL_POLY_OVERFLOW = (1<<13), /*!< enable = polygon/vertex buffer overflow, setting resets overflow flag; disable = no polygon/vertex buffer overflow */
- GL_CLEAR_BMP = (1<<14) /*!< rear/clear plane is in BMP mode; disable = rear/color plane is in clear mode */
-};
-
-/*! \brief Enums for reading stuff from the geometry engine<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3diomap">http://nocash.emubase.de/gbatek.htm#ds3diomap</A><BR>
-related functions: glGetInt(), glGetFixed()*/
-typedef enum {
- GL_GET_VERTEX_RAM_COUNT, /*!< returns a count of vertexes currently stored in hardware vertex ram. Use glGetInt() to retrieve */
- GL_GET_POLYGON_RAM_COUNT, /*!< returns a count of polygons currently stored in hardware polygon ram. Use glGetInt() to retrieve */
- GL_GET_MATRIX_VECTOR, /*!< returns the current 3x3 directional vector matrix. Use glGetFixed() to retrieve */
- GL_GET_MATRIX_POSITION, /*!< returns the current 4x4 position matrix. Use glGetFixed() to retrieve */
- GL_GET_MATRIX_PROJECTION, /*!< returns the current 4x4 projection matrix. Use glGetFixed() to retrieve */
- GL_GET_MATRIX_CLIP, /*!< returns the current 4x4 clip matrix. Use glGetFixed() to retrieve */
- GL_GET_TEXTURE_WIDTH, /*!< returns the width of the currently bound texture. Use glGetInt() to retrieve */
- GL_GET_TEXTURE_HEIGHT /*!< returns the height of the currently bound texture. Use glGetInt() to retrieve */
-} GL_GET_ENUM;
-
-
-/*! \brief Enums for glFlush()<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A><BR>
-related functions: glEnable(), glDisable(), glInit() */
-enum GLFLUSH_ENUM {
- GL_TRANS_MANUALSORT = (1<<0), /*!< enable manual sorting of translucent polygons, otherwise uses Y-sorting */
- GL_WBUFFERING = (1<<1) /*!< enable W depth buffering of vertices, otherwise uses Z depth buffering */
-};
-
-
-/*---------------------------------------------------------------------------------
-This struct hold hidden globals for videoGL. The structure is initialized in the
-.c file and returned by glGetGlobals() so that it can be used across compilation
-units without problem. This is automatically done by glInit() so don't worry too
-much about it. This is only an issue because of hte mix of inlined/real functions.
----------------------------------------------------------------------------------*/
-typedef struct {
- GL_MATRIX_MODE_ENUM matrixMode; // holds the current Matrix Mode
-
- // holds the current state of the clear color register
- uint32 clearColor; // state of clear color register
-
- // texture globals
- uint32 textures[MAX_TEXTURES];
- uint32 activeTexture;
- uint32* nextBlock;
- uint32 nextPBlock;
- int nameCount;
-
-} gl_hidden_globals;
-
-// Pointer to global data for videoGL
-static gl_hidden_globals* glGlob = 0;
-
-//---------------------------------------------------------------------------------
-//Fifo commands
-//---------------------------------------------------------------------------------
-
-#define FIFO_COMMAND_PACK(c1,c2,c3,c4) (((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1)) /*!< \brief packs four packed commands into a 32bit command for sending to the GFX FIFO */
-
-#define REG2ID(r) (u8)( ( ((u32)(&(r)))-0x04000400 ) >> 2 ) /*!< \brief converts a GFX command for use in a packed command list */
-
-#define FIFO_NOP REG2ID(GFX_FIFO) /*!< \brief packed command for nothing, just here to pad your command lists */
-#define FIFO_STATUS REG2ID(GFX_STATUS) /*!< \brief packed command for geometry engine status register<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dstatus">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dstatus</A> */
-#define FIFO_COLOR REG2ID(GFX_COLOR) /*!< \brief packed command for vertex color directly<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes</A> */
-
-#define FIFO_VERTEX16 REG2ID(GFX_VERTEX16) /*!< \brief packed command for a vertex with 3 16bit paramaters(and 16bits of padding)<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices</A> */
-#define FIFO_TEX_COORD REG2ID(GFX_TEX_COORD) /*!< \brief packed command for a texture coordinate<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtexturecoordinates">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtexturecoordinates</A> */
-#define FIFO_TEX_FORMAT REG2ID(GFX_TEX_FORMAT) /*!< \brief packed command for texture format<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureformats">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureformats</A> */
-#define FIFO_PAL_FORMAT REG2ID(GFX_PAL_FORMAT) /*!< \brief packed command for texture palette attributes<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes</A> */
-
-#define FIFO_CLEAR_COLOR REG2ID(GFX_CLEAR_COLOR) /*!< \brief packed command for clear color of the rear plane<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3drearplane">GBATEK http://nocash.emubase.de/gbatek.htm#ds3drearplane</A> */
-#define FIFO_CLEAR_DEPTH REG2ID(GFX_CLEAR_DEPTH) /*!< \brief sets depth of the rear plane<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3drearplane">GBATEK http://nocash.emubase.de/gbatek.htm#ds3drearplane</A> */
-
-#define FIFO_LIGHT_VECTOR REG2ID(GFX_LIGHT_VECTOR) /*!< \brief packed command for direction of a light source<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-#define FIFO_LIGHT_COLOR REG2ID(GFX_LIGHT_COLOR) /*!< \brief packed command for color for a light<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-#define FIFO_NORMAL REG2ID(GFX_NORMAL) /*!< \brief packed command for normal for following vertices<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-
-#define FIFO_DIFFUSE_AMBIENT REG2ID(GFX_DIFFUSE_AMBIENT) /*!< \brief packed command for setting diffuse and ambient material properties for the following vertices<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-#define FIFO_SPECULAR_EMISSION REG2ID(GFX_SPECULAR_EMISSION) /*!< \brief packed command for setting specular and emmissive material properties for the following vertices<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-#define FIFO_SHININESS REG2ID(GFX_SHININESS) /*!< \brief packed command for setting the shininess table to be used for the following vertices<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-
-#define FIFO_POLY_FORMAT REG2ID(GFX_POLY_FORMAT) /*!< \brief packed command for setting polygon attributes<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes</A> */
-
-#define FIFO_BEGIN REG2ID(GFX_BEGIN) /*!< \brief packed command that starts a polygon vertex list<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices</A>*/
-#define FIFO_END REG2ID(GFX_END) /*!< \brief packed command that has no discernable effect, it's probably best to never use it since it bloats the size of the list.<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices</A>*/
-#define FIFO_FLUSH REG2ID(GFX_FLUSH) /*!< \brief packed command that has the same effect as swiWaitForVBlank()<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A> */
-#define FIFO_VIEWPORT REG2ID(GFX_VIEWPORT) /*!< \brief packed command for setting viewport<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A> */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*! \brief Rotates the model view matrix by angle about the specified unit vector
-\param angle The angle to rotate by
-\param x X component of the unit vector axis.
-\param y Y component of the unit vector axis.
-\param z Z component of the unit vector axis. */
-void glRotatef32i(int angle, int32 x, int32 y, int32 z);
-
-/*! \brief Loads a 2D texture into texture memory and sets the currently bound texture ID to the attributes specified
-\param target not used, just here for OpenGL compatibility
-\param empty1 not used, just here for OpenGL compatibility
-\param type The format of the texture
-\param sizeX the horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM
-\param sizeY the vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM
-\param empty2 not used, just here for OpenGL compatibility
-\param param parameters for the texture
-\param texture pointer to the texture data to load */
-int glTexImage2D(int target, int empty1, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int empty2, int param, const uint8* texture);
-
-/*! \brief Loads a palette into the specified texture addr
-\param pal pointer to the palette to load
-\param count the size of the palette
-\param addr the offset in VRAM to load the palette */
-void glTexLoadPal(const u16* pal, u16 count, u32 addr );
-
-/*! \brief Loads a palette into the next available palette slot, returns the addr on success or -1
-\param pal pointer to the palette to load
-\param count the size of the palette
-\param format the format of the texture */
-int gluTexLoadPal(const u16* pal, u16 count, uint8 format);
-
-/*! \brief Set parameters for the current texture. Although named the same as its gl counterpart, it is not compatible. Effort may be made in the future to make it so.
-\param sizeX the horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM
-\param sizeY the vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM
-\param addr offset into VRAM where you put the texture
-\param mode the type of texture
-\param param paramaters for the texture */
-void glTexParameter( uint8 sizeX, uint8 sizeY,
- const uint32* addr,
- GL_TEXTURE_TYPE_ENUM mode,
- uint32 param) ;
-
-/*! \brief Returns the active texture parameter (constructed from internal call to glTexParameter) */
-u32 glGetTexParameter(void);
-
-/*! \brief returns the address alocated to the texure named by name
-\param name the name of the texture to get a pointer to */
-void* glGetTexturePointer( int name);
-
-/*! \brief glBindTexure sets the current named texture to the active texture. Target is ignored as all DS textures are 2D
-\param target ignored, only here for OpenGL compatability
-\param name the name(int value) to set to the current texture */
-void glBindTexture(int target, int name);
-
-/*! \brief glColorTable establishes the location of the current palette. Roughly follows glColorTableEXT. Association of palettes with named textures is left to the application. */
-void glColorTable(uint8 format, uint32 addr);
-
-/*! \brief Creates room for the specified number of textures
-\param n the number of textures to generate
-\param names pointer to the names array to fill */
-int glGenTextures(int n, int *names);
-
-/*! \brief Resets the gl texture state freeing all texture memory */
-void glResetTextures(void);
-
-/*! \brief Sets texture coordinates for following vertices<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes</A>
-\param u U(a.k.a. S) texture coordinate (0.0 - 1.0)
-\param v V(a.k.a. T) texture coordinate (0.0 - 1.0)*/
-void glTexCoord2f32(int32 u, int32 v);
-
-/*! \brief specify the material properties to be used in rendering lit polygons
-\param mode which material property to change
-\param color the color to set for that material property */
-void glMaterialf(GL_MATERIALS_ENUM mode, rgb color);
-
-// This handles initialization of the GL state; this is called from glInit to keep globals synced between compilation units
-void glInit_C(void);
-
-// This returns a pointer to the globals for videoGL
-gl_hidden_globals* glGetGlobals(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////// ////////////
-//////////// ////////////
-//////////// ////////////
-//////////// INLINED FUNCTIONS ////////////
-//////////// ////////////
-//////////// ////////////
-//////////// ////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-
-
-
-/*! \brief used in glPolyFmt() to set the alpha level for the following polygons, set to 0 for wireframe mode
-\param n the level of alpha (0-31) */
-GL_STATIC_INL uint32 POLY_ALPHA(int n) { return (uint32)((n) << 16); };
-
-/*! \brief used in glPolyFmt() to set the Polygon ID for the following polygons
-\param n the ID to set for following polygons (0-63) */
-GL_STATIC_INL uint32 POLY_ID(int n) { return (uint32)((n)<<24); };
-
-/*! \brief Starts a polygon group
-\param mode the draw mode for the polygon */
-GL_STATIC_INL void glBegin(GL_GLBEGIN_ENUM mode) { GFX_BEGIN = mode; }
-
-/*! \brief Ends a polygon group, this seems to be a dummy function that does absolutely nothing, feel free to never use it. */
-GL_STATIC_INL void glEnd(void) { GFX_END = 0; }
-
-/*! \brief reset the depth buffer to this value; generally set this to GL_MAX_DEPTH.<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3drearplane">GBATEK http://nocash.emubase.de/gbatek.htm#ds3drearplane</A>
-\param depth Something to do with the depth buffer, generally set to GL_MAX_DEPTH */
-GL_STATIC_INL void glClearDepth(fixed12d3 depth) { GFX_CLEAR_DEPTH = depth; }
-
-/*! \brief Set the color for following vertices
-\param red the red component (0-31)
-\param green the green component (0-31)
-\param blue the blue component (0-31) */
-
-GL_STATIC_INL void glColor3b(uint8 red, uint8 green, uint8 blue) { GFX_COLOR = (vuint32)RGB15(red>>3, green>>3, blue>>3); }
-
-/*! \brief Set the color for following vertices
-\param color the 15bit color value */
-GL_STATIC_INL void glColor(rgb color) { GFX_COLOR = (vuint32)color; }
-
-/*! \brief specifies a vertex
-\param x the x component for the vertex
-\param y the y component for the vertex
-\param z the z component for the vertex */
-GL_STATIC_INL void glVertex3v16(v16 x, v16 y, v16 z) {
- GFX_VERTEX16 = (y << 16) | (x & 0xFFFF);
- GFX_VERTEX16 = ((uint32)(uint16)z);
-}
-
-/*! \brief Sets texture coordinates for following vertices<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes</A>
-\param u U(a.k.a. S) texture coordinate in texels
-\param v V(a.k.a. T) texture coordinate in texels */
-GL_STATIC_INL void glTexCoord2t16(t16 u, t16 v) { GFX_TEX_COORD = TEXTURE_PACK(u,v); }
-
-/*! \brief Pushs the current matrix onto the stack<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack</A> */
-GL_STATIC_INL void glPushMatrix(void) { MATRIX_PUSH = 0; }
-
-/*! \brief Pops num matrices off the stack<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack</A>
-\param num the number to pop down the stack */
-GL_STATIC_INL void glPopMatrix(int32 num) { MATRIX_POP = num; }
-
-/*! \brief Restores the current matrix from a location in the stack<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack</A>
-\param index the place in the stack to restore to */
-GL_STATIC_INL void glRestoreMatrix(int32 index) { MATRIX_RESTORE = index; }
-
-/*! \brief Place the current matrix into the stack at a location<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack</A>
-\param index the place in the stack to put the current matrix */
-GL_STATIC_INL void glStoreMatrix(int32 index) { MATRIX_STORE = index; }
-
-/*! \brief multiply the current matrix by a translation matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\param v the vector to translate by */
-GL_STATIC_INL void glScalev(const GLvector* v) {
- MATRIX_SCALE = v->x;
- MATRIX_SCALE = v->y;
- MATRIX_SCALE = v->z;
-}
-
-/*! \brief multiply the current matrix by a translation matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\param v the vector to translate by */
-GL_STATIC_INL void glTranslatev(const GLvector* v) {
- MATRIX_TRANSLATE = v->x;
- MATRIX_TRANSLATE = v->y;
- MATRIX_TRANSLATE = v->z;
-}
-
-/*! \brief multiply the current matrix by a translation matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\param x translation on the x axis
-\param y translation on the y axis
-\param z translation on the z axis */
-GL_STATIC_INL void glTranslate3f32(int32 x, int32 y, int32 z) {
- MATRIX_TRANSLATE = x;
- MATRIX_TRANSLATE = y;
- MATRIX_TRANSLATE = z;
-}
-
-/*! \brief multiply the current matrix by a scale matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\param factor the factor to scale by */
-GL_STATIC_INL void glScalef32(int32 factor) {
- MATRIX_SCALE = factor;
- MATRIX_SCALE = factor;
- MATRIX_SCALE = factor;
-}
-
-/*! \brief set a light up. Only parallel light sources are supported on the DS<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A>
-\param id the number of the light to setup
-\param color the color of the light
-\param x the x component of the lights directional vector. Direction must be normalized
-\param y the y component of the lights directional vector. Direction must be normalized
-\param z the z component of the lights directional vector. Direction must be normalized */
-GL_STATIC_INL void glLight(int id, rgb color, v10 x, v10 y, v10 z) {
- id = (id & 3) << 30;
- GFX_LIGHT_VECTOR = id | ((z & 0x3FF) << 20) | ((y & 0x3FF) << 10) | (x & 0x3FF);
- GFX_LIGHT_COLOR = id | color;
-}
-
-/*! \brief the normal to use for following vertices<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A>
-\warning The nature of the format means that you can't represent the following normals exactly (0,0,1), (0,1,0), or (1,0,0)
-\param normal the packed normal(3 * 10bit x, y, z) */
-GL_STATIC_INL void glNormal(uint32 normal) { GFX_NORMAL = normal; }
-
-/*! \brief loads an identity matrix to the current matrix, same as glIdentity(void) */
-GL_STATIC_INL void glLoadIdentity(void) { MATRIX_IDENTITY = 0; }
-
-/*! \brief change the current matrix mode<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A><BR>
-\param mode the mode for the matrix */
-GL_STATIC_INL void glMatrixMode(GL_MATRIX_MODE_ENUM mode) { MATRIX_CONTROL = mode; }
-
-/*! \brief specify the viewport for following drawing, can be set several times per frame.<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A>
-\param x1 the left of the viewport
-\param y1 the bottom of the viewport
-\param x2 the right of the viewport
-\param y2 the top of the viewport */
-GL_STATIC_INL void glViewport(uint8 x1, uint8 y1, uint8 x2, uint8 y2) { GFX_VIEWPORT = (x1) + (y1 << 8) + (x2 << 16) + (y2 << 24); }
-
-/*! \brief Waits for a Vblank and swaps the buffers(like swiWaitForVBlank), but lets you specify some 3D options<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A>
-\param mode flags from GLFLUSH_ENUM for enabling Y-sorting of translucent polygons and W-Buffering of all vertices*/
-GL_STATIC_INL void glFlush(uint32 mode) { GFX_FLUSH = mode; }
-
-/*! \brief The DS uses a table for shinyness..this generates a half-ass one */
-GL_STATIC_INL void glMaterialShinyness(void) {
- uint32 shiny32[128/4];
- uint8 *shiny8 = (uint8*)shiny32;
-
- int i;
-
- for (i = 0; i < 128 * 2; i += 2)
- shiny8[i>>1] = i;
-
- for (i = 0; i < 128 / 4; i++)
- GFX_SHININESS = shiny32[i];
-}
-
-/*! \brief throws a packed list of commands into the graphics FIFO via asyncronous DMA<BR>
-The first 32bits is the length of the packed command list, followed by a the packed list.<BR>
-If you want to do this really fast then write your own code that that does this synchronously and only flushes the cache when the list is changed<BR>
-There is sometimes a problem when you pack the GFX_END command into a list, so don't. GFX_END is a dummy command and never needs called<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dgeometrycommands">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dgeometrycommands</A> */
-GL_STATIC_INL void glCallList(const u32* list) {
- u32 count = *list++;
-
- // flush the area that we are going to DMA
- DC_FlushRange(list, count*4);
-
- // don't start DMAing while anything else is being DMAed because FIFO DMA is touchy as hell
- // If anyone can explain this better that would be great. -- gabebear
- while((DMA_CR(0) & DMA_BUSY)||(DMA_CR(1) & DMA_BUSY)||(DMA_CR(2) & DMA_BUSY)||(DMA_CR(3) & DMA_BUSY));
-
- // send the packed list asynchronously via DMA to the FIFO
- DMA_SRC(0) = (uint32)list;
- DMA_DEST(0) = 0x4000400;
- DMA_CR(0) = DMA_FIFO | count;
- while(DMA_CR(0) & DMA_BUSY);
-}
-
-/*! \brief Set the parameters for polygons rendered on the current frame<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes</A>
-\param params the paramters to set for the polygons for the current frame. valid paramters are enumerated in GL_POLY_FORMAT_ENUM and in the functions POLY_ALPHA() and POLY_ID() */
-GL_STATIC_INL void glPolyFmt(uint32 params) { GFX_POLY_FORMAT = params; }
-
-/*! \brief Enables various gl states (blend, alpha test, etc..)
-\param bits bit mask of desired attributes, attributes are enumerated in DISP3DCNT_ENUM */
-GL_STATIC_INL void glEnable(int bits) { GFX_CONTROL |= bits; }
-
-/*! \brief Disables various gl states (blend, alpha test, etc..)
-\param bits bit mask of desired attributes, attributes are enumerated in DISP3DCNT_ENUM */
-GL_STATIC_INL void glDisable(int bits) { GFX_CONTROL &= ~bits; }
-
-/*! \brief Loads a 4x4 matrix into the current matrix
-\param m pointer to a 4x4 matrix */
-GL_STATIC_INL void glLoadMatrix4x4(const m4x4 *m) {
- MATRIX_LOAD4x4 = m->m[0];
- MATRIX_LOAD4x4 = m->m[1];
- MATRIX_LOAD4x4 = m->m[2];
- MATRIX_LOAD4x4 = m->m[3];
-
- MATRIX_LOAD4x4 = m->m[4];
- MATRIX_LOAD4x4 = m->m[5];
- MATRIX_LOAD4x4 = m->m[6];
- MATRIX_LOAD4x4 = m->m[7];
-
- MATRIX_LOAD4x4 = m->m[8];
- MATRIX_LOAD4x4 = m->m[9];
- MATRIX_LOAD4x4 = m->m[10];
- MATRIX_LOAD4x4 = m->m[11];
-
- MATRIX_LOAD4x4 = m->m[12];
- MATRIX_LOAD4x4 = m->m[13];
- MATRIX_LOAD4x4 = m->m[14];
- MATRIX_LOAD4x4 = m->m[15];
-}
-
-/*! \brief Loads a 4x3 matrix into the current matrix
-\param m pointer to a 4x4 matrix */
-GL_STATIC_INL void glLoadMatrix4x3(const m4x3 * m) {
- MATRIX_LOAD4x3 = m->m[0];
- MATRIX_LOAD4x3 = m->m[1];
- MATRIX_LOAD4x3 = m->m[2];
- MATRIX_LOAD4x3 = m->m[3];
-
- MATRIX_LOAD4x3 = m->m[4];
- MATRIX_LOAD4x3 = m->m[5];
- MATRIX_LOAD4x3 = m->m[6];
- MATRIX_LOAD4x3 = m->m[7];
-
- MATRIX_LOAD4x3 = m->m[8];
- MATRIX_LOAD4x3 = m->m[9];
- MATRIX_LOAD4x3 = m->m[10];
- MATRIX_LOAD4x3 = m->m[11];
-}
-
-/*! \brief Multiplies the current matrix by m
-\param m pointer to a 4x4 matrix */
-GL_STATIC_INL void glMultMatrix4x4(const m4x4 * m) {
- MATRIX_MULT4x4 = m->m[0];
- MATRIX_MULT4x4 = m->m[1];
- MATRIX_MULT4x4 = m->m[2];
- MATRIX_MULT4x4 = m->m[3];
-
- MATRIX_MULT4x4 = m->m[4];
- MATRIX_MULT4x4 = m->m[5];
- MATRIX_MULT4x4 = m->m[6];
- MATRIX_MULT4x4 = m->m[7];
-
- MATRIX_MULT4x4 = m->m[8];
- MATRIX_MULT4x4 = m->m[9];
- MATRIX_MULT4x4 = m->m[10];
- MATRIX_MULT4x4 = m->m[11];
-
- MATRIX_MULT4x4 = m->m[12];
- MATRIX_MULT4x4 = m->m[13];
- MATRIX_MULT4x4 = m->m[14];
- MATRIX_MULT4x4 = m->m[15];
-}
-
-/*! \brief multiplies the current matrix by
-\param m pointer to a 4x3 matrix */
-GL_STATIC_INL void glMultMatrix4x3(const m4x3 * m) {
- MATRIX_MULT4x3 = m->m[0];
- MATRIX_MULT4x3 = m->m[1];
- MATRIX_MULT4x3 = m->m[2];
- MATRIX_MULT4x3 = m->m[3];
-
- MATRIX_MULT4x3 = m->m[4];
- MATRIX_MULT4x3 = m->m[5];
- MATRIX_MULT4x3 = m->m[6];
- MATRIX_MULT4x3 = m->m[7];
-
- MATRIX_MULT4x3 = m->m[8];
- MATRIX_MULT4x3 = m->m[9];
- MATRIX_MULT4x3 = m->m[10];
- MATRIX_MULT4x3 = m->m[11];
-
-}
-
-/*! \brief multiplies the current matrix by m
-\param m pointer to a 3x3 matrix */
-GL_STATIC_INL void glMultMatrix3x3(const m3x3 * m) {
- MATRIX_MULT3x3 = m->m[0];
- MATRIX_MULT3x3 = m->m[1];
- MATRIX_MULT3x3 = m->m[2];
-
- MATRIX_MULT3x3 = m->m[3];
- MATRIX_MULT3x3 = m->m[4];
- MATRIX_MULT3x3 = m->m[5];
-
- MATRIX_MULT3x3 = m->m[6];
- MATRIX_MULT3x3 = m->m[7];
- MATRIX_MULT3x3 = m->m[8];
-}
-
-/*! \brief Rotates the current modelview matrix by angle about the x axis
-\param angle The angle to rotate by (angle is 0-511) */
-GL_STATIC_INL void glRotateXi(int angle) {
- int32 sine = SIN[angle & LUT_MASK];
- int32 cosine = COS[angle & LUT_MASK];
-
- MATRIX_MULT3x3 = inttof32(1);
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = 0;
-
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = cosine;
- MATRIX_MULT3x3 = sine;
-
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = -sine;
- MATRIX_MULT3x3 = cosine;
-}
-
-/*! \brief Rotates the current modelview matrix by angle about the y axis
-\param angle The angle to rotate by (angle is 0-511) */
-GL_STATIC_INL void glRotateYi(int angle) {
- int32 sine = SIN[angle & LUT_MASK];
- int32 cosine = COS[angle & LUT_MASK];
-
- MATRIX_MULT3x3 = cosine;
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = -sine;
-
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = inttof32(1);
- MATRIX_MULT3x3 = 0;
-
- MATRIX_MULT3x3 = sine;
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = cosine;
-}
-
-/*! \brief Rotates the current modelview matrix by angle about the z axis
-\param angle The angle to rotate by (angle is 0-511) */
-GL_STATIC_INL void glRotateZi(int angle) {
- int32 sine = SIN[angle & LUT_MASK];
- int32 cosine = COS[angle & LUT_MASK];
-
- MATRIX_MULT3x3 = cosine;
- MATRIX_MULT3x3 = sine;
- MATRIX_MULT3x3 = 0;
-
- MATRIX_MULT3x3 = - sine;
- MATRIX_MULT3x3 = cosine;
- MATRIX_MULT3x3 = 0;
-
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = inttof32(1);
-}
-
-
-/*! \brief Multiplies the current matrix into ortho graphic mode
-\param left left vertical clipping plane
-\param right right vertical clipping plane
-\param bottom bottom vertical clipping plane
-\param top top vertical clipping plane
-\param zNear near clipping plane
-\param zFar far clipping plane */
-GL_STATIC_INL void glOrthof32(int32 left, int32 right, int32 bottom, int32 top, int32 zNear, int32 zFar) {
- MATRIX_MULT4x4 = divf32(inttof32(2), right - left);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = divf32(inttof32(2), top - bottom);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = divf32(inttof32(-2), zFar - zNear);
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = -divf32(right + left, right - left);//0;
- MATRIX_MULT4x4 = -divf32(top + bottom, top - bottom); //0;
- MATRIX_MULT4x4 = -divf32(zFar + zNear, zFar - zNear);//0;
- MATRIX_MULT4x4 = floattof32(1.0F);
-}
-
-/*! \brief Places the camera at the specified location and orientation (fixed point version)
-\param eyex (eyex, eyey, eyez) Location of the camera.
-\param eyey (eyex, eyey, eyez) Location of the camera.
-\param eyez (eyex, eyey, eyez) Location of the camera.
-\param lookAtx (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param lookAty (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param lookAtz (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param upx <upx, upy, upz> Unit vector describing which direction is up for the camera.
-\param upy <upx, upy, upz> Unit vector describing which direction is up for the camera.
-\param upz <upx, upy, upz> Unit vector describing which direction is up for the camera. */
-GL_STATIC_INL void gluLookAtf32(int32 eyex, int32 eyey, int32 eyez, int32 lookAtx, int32 lookAty, int32 lookAtz, int32 upx, int32 upy, int32 upz) {
- int32 side[3], forward[3], up[3], eye[3];
-
- forward[0] = eyex - lookAtx;
- forward[1] = eyey - lookAty;
- forward[2] = eyez - lookAtz;
-
- normalizef32(forward);
-
- up[0] = upx;
- up[1] = upy;
- up[2] = upz;
- eye[0] = eyex;
- eye[1] = eyey;
- eye[2] = eyez;
-
- crossf32(up, forward, side);
-
- normalizef32(side);
-
- // Recompute local up
- crossf32(forward, side, up);
-
- glMatrixMode(GL_MODELVIEW);
-
-
- // should we use MATRIX_MULT4x3?
- MATRIX_MULT4x3 = side[0];
- MATRIX_MULT4x3 = up[0];
- MATRIX_MULT4x3 = forward[0];
-
- MATRIX_MULT4x3 = side[1];
- MATRIX_MULT4x3 = up[1];
- MATRIX_MULT4x3 = forward[1];
-
- MATRIX_MULT4x3 = side[2];
- MATRIX_MULT4x3 = up[2];
- MATRIX_MULT4x3 = forward[2];
-
- MATRIX_MULT4x3 = -dotf32(eye,side);
- MATRIX_MULT4x3 = -dotf32(eye,up);
- MATRIX_MULT4x3 = -dotf32(eye,forward);
-
-}
-
-
-/*! \brief Specifies the viewing frustum for the projection matrix (fixed point version)
-\param left left right top and bottom describe a rectangle located at the near clipping plane
-\param right left right top and bottom describe a rectangle located at the near clipping plane
-\param top left right top and bottom describe a rectangle located at the near clipping plane
-\param bottom left right top and bottom describe a rectangle located at the near clipping plane
-\param near Location of a the near clipping plane (parallel to viewing window)
-\param far Location of a the far clipping plane (parallel to viewing window) */
-GL_STATIC_INL void glFrustumf32(int32 left, int32 right, int32 bottom, int32 top, int32 near, int32 far) {
-/* MATRIX_MULT4x4 = divf32(2*near, right - left);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = divf32(right + left, right - left);
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = divf32(2*near, top - bottom);
- MATRIX_MULT4x4 = divf32(top + bottom, top - bottom);
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = -divf32(far + near, far - near);
- MATRIX_MULT4x4 = floattof32(-1.0F);
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = -divf32(2 * mulf32(far, near), far - near);
- MATRIX_MULT4x4 = 0;
-*/
-
-
- MATRIX_MULT4x4 = divf32(2*near, right - left);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = divf32(2*near, top - bottom);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = divf32(right + left, right - left);
- MATRIX_MULT4x4 = divf32(top + bottom, top - bottom);
- MATRIX_MULT4x4 = -divf32(far + near, far - near);
- MATRIX_MULT4x4 = floattof32(-1.0F);
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = -divf32(2 * mulf32(far, near), far - near);
- MATRIX_MULT4x4 = 0;
-
-}
-
-/*! \brief Utility function which sets up the projection matrix (fixed point version)
-\param fovy Specifies the field of view in degrees (0 -511)
-\param aspect Specifies the aspect ratio of the screen (normally screen width/screen height)
-\param zNear Specifies the near clipping plane
-\param zFar Specifies the far clipping plane */
-GL_STATIC_INL void gluPerspectivef32(int fovy, int32 aspect, int32 zNear, int32 zFar) {
- int32 xmin, xmax, ymin, ymax;
-
- ymax = mulf32(zNear, TAN[(fovy>>1) & LUT_MASK]);
- ymin = -ymax;
- xmin = mulf32(ymin, aspect);
- xmax = mulf32(ymax, aspect);
-
- glFrustumf32(xmin, xmax, ymin, ymax, zNear, zFar);
-}
-
-/*! \brief Utility function which generates a picking matrix for selection
-\param x 2D x of center (touch x normally)
-\param y 2D y of center (touch y normally)
-\param width width in pixels of the window (3 or 4 is a good number)
-\param height height in pixels of the window (3 or 4 is a good number)
-\param viewport the current viewport (normaly {0, 0, 255, 191}) */
-GL_STATIC_INL void gluPickMatrix(int x, int y, int width, int height, const int viewport[4]) {
- MATRIX_MULT4x4 = inttof32(viewport[2]) / width;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = inttof32(viewport[3]) / height;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = inttof32(1);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = inttof32(viewport[2] + ((viewport[0] - x)<<1)) / width;
- MATRIX_MULT4x4 = inttof32(viewport[3] + ((viewport[1] - y)<<1)) / height;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = inttof32(1);
-}
-
-/*! \brief Resets matrix stack to top level */
-GL_STATIC_INL void glResetMatrixStack(void) {
- // make sure there are no push/pops that haven't executed yet
- while(GFX_STATUS & BIT(14)){
- GFX_STATUS |= 1 << 15; // clear push/pop errors or push/pop busy bit never clears
- }
-
- // pop the projection stack to the top; poping 0 off an empty stack causes an error... weird?
- if((GFX_STATUS&(1<<13))!=0) {
- glMatrixMode(GL_PROJECTION);
- glPopMatrix(1);
- }
-
- // 31 deep modelview matrix; 32nd entry works but sets error flag
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix((GFX_STATUS >> 8) & 0x1F);
-
- // load identity to all the matrices
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
-}
-
-/*! \brief Specifies an edge color for polygons
-\param id which outline color to set (0-7)
-\param color the 15bit color to set */
-GL_STATIC_INL void glSetOutlineColor(int id, rgb color) { GFX_EDGE_TABLE[id] = color; }
-
-/*! \brief Loads a toon table
-\param pointer to the 32 color palette to load into the toon table*/
-GL_STATIC_INL void glSetToonTable(const uint16 *table) {
- int i;
- for(i = 0; i < 32; i++ )
- GFX_TOON_TABLE[i] = table[i];
-}
-
-/*! \brief Sets a range of colors on the toon table
-\param start the start of the range
-\param end the end of the range
-\param color the color to set for that range */
-GL_STATIC_INL void glSetToonTableRange(int start, int end, rgb color) {
- int i;
- for(i = start; i <= end; i++ )
- GFX_TOON_TABLE[i] = color;
-}
-
-/*! \brief Grabs fixed format of state variables<BR>
-OpenGL's modelview matrix is handled on the DS with two matrices. The combination of the DS's position matrix and directional vector matrix hold the data that is in OpenGL's one modelview matrix. (a.k.a. modelview = postion and vector)<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3diomap">http://nocash.emubase.de/gbatek.htm#ds3diomap</A>
-\param param The state variable to retrieve
-\param f pointer with room to hold the requested data */
-GL_STATIC_INL void glGetFixed(const GL_GET_ENUM param, int32* f) {
- int i;
- switch (param) {
- case GL_GET_MATRIX_VECTOR:
- while(GFX_BUSY); // wait until the graphics engine has stopped to read matrixes
- for(i = 0; i < 9; i++) f[i] = MATRIX_READ_VECTOR[i];
- break;
- case GL_GET_MATRIX_CLIP:
- while(GFX_BUSY); // wait until the graphics engine has stopped to read matrixes
- for(i = 0; i < 16; i++) f[i] = MATRIX_READ_CLIP[i];
- break;
- case GL_GET_MATRIX_PROJECTION:
- glMatrixMode(GL_POSITION);
- glPushMatrix(); // save the current state of the position matrix
- glLoadIdentity(); // load an identity matrix into the position matrix so that the clip matrix = projection matrix
- while(GFX_BUSY); // wait until the graphics engine has stopped to read matrixes
- for(i = 0; i < 16; i++) f[i] = MATRIX_READ_CLIP[i]; // read out the projection matrix
- glPopMatrix(1); // restore the position matrix
- break;
- case GL_GET_MATRIX_POSITION:
- glMatrixMode(GL_PROJECTION);
- glPushMatrix(); // save the current state of the projection matrix
- glLoadIdentity(); // load a identity matrix into the projection matrix so that the clip matrix = position matrix
- while(GFX_BUSY); // wait until the graphics engine has stopped to read matrixes
- for(i = 0; i < 16; i++) f[i] = MATRIX_READ_CLIP[i]; // read out the position matrix
- glPopMatrix(1); // restore the projection matrix
- break;
- default:
- break;
- }
-}
-
-/*! \brief set the minimum alpha value that will be used<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A>
-\param alphaThreshold minimum alpha value that will be used (0-15) */
-GL_STATIC_INL void glAlphaFunc(int alphaThreshold) { GFX_ALPHA_TEST = alphaThreshold; }
-
-/*! \brief Stop the drawing of polygons that are a certain distance from the camera.<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A>
-\param polygons that are beyond this W-value(distance from camera) will not be drawn; 15bit value. */
-GL_STATIC_INL void glCutoffDepth(fixed12d3 wVal) { GFX_CUTOFF_DEPTH = wVal; }
-
-/*! \brief Initializes the gl state machine (must be called once before using gl calls) */
-GL_STATIC_INL void glInit(void) {
- glGlob = glGetGlobals(); // make sure globals are synced between compilation units
- glInit_C(); // actually does the initialization
-}
-
-/*! \brief sets the color of the rear-plane(a.k.a Clear Color/Plane)
-\param red component (0-31)
-\param green component (0-31)
-\param blue component (0-31)
-\param alpha from 0(clear) to 31(opaque)*/
-GL_STATIC_INL void glClearColor(uint8 red, uint8 green, uint8 blue, uint8 alpha) {
- GFX_CLEAR_COLOR = glGlob->clearColor = ( glGlob->clearColor & 0xFFE08000) | (0x7FFF & RGB15(red, green, blue)) | ((alpha & 0x1F) << 16);
-}
-
-/*! \brief sets the polygon ID of the rear-plane(a.k.a. Clear/Color Plane), useful for antialiasing and edge coloring
-\param ID the polygon ID to give the rear-plane */
-GL_STATIC_INL void glClearPolyID(uint8 ID) {
- GFX_CLEAR_COLOR = glGlob->clearColor = ( glGlob->clearColor & 0xC0FFFFFF) | (( ID & 0x3F ) << 24 );
-}
-
-/*! \brief Grabs integer state variables from openGL
-\param param The state variable to retrieve
-\param i pointer with room to hold the requested data */
-GL_STATIC_INL void glGetInt(GL_GET_ENUM param, int* i) {
- switch (param) {
- case GL_GET_POLYGON_RAM_COUNT:
- *i = GFX_POLYGON_RAM_USAGE;
- break;
- case GL_GET_VERTEX_RAM_COUNT:
- *i = GFX_VERTEX_RAM_USAGE;
- break;
- case GL_GET_TEXTURE_WIDTH:
- *i = 8 << (((glGlob->textures[glGlob->activeTexture]) >> 20) & 7);
- break;
- case GL_GET_TEXTURE_HEIGHT:
- *i = 8 << (((glGlob->textures[glGlob->activeTexture]) >> 23) & 7);
- break;
- default:
- break;
- }
-}
-
-
-//---------------------------------------------------------------------------------
-// INLINED FlOAT WRAPPERS
-//
-// All floating point functions.
-//
-
-/*! \brief specifies a vertex location
-\warning FLOAT VERSION!!!! please use glVertex3v16()
-\param x the x component of the vertex
-\param y the y component of the vertex
-\param z the z component of the vertex */
-GL_STATIC_INL void glVertex3f(float x, float y, float z) {
- glVertex3v16(floattov16(x), floattov16(y), floattov16(z));
-}
-
-/*! \brief Rotate on an arbitrary axis
-\warning FLOAT VERSION!!!! please use glRotatef32i()
-\param angle the angle to rotate by
-\param x the x component of the axis to rotate on
-\param y the y component of the axis to rotate on
-\param z the z component of the axis to rotate on */
-GL_STATIC_INL void glRotatef32(float angle, int32 x, int32 y, int32 z) {
- glRotatef32i((int)(angle * LUT_SIZE / 360.0), x, y, z);
-}
-
-/*! \brief Rotate about an arbitrary axis
-\warning FLOAT VERSION!!!! please use glRotatef32i()
-\param angle the angle to rotate by
-\param x the x component of the axis to rotate on
-\param y the y component of the axis to rotate on
-\param z the z component of the axis to rotate on */
-GL_STATIC_INL void glRotatef(float angle, float x, float y, float z) {
- glRotatef32(angle, floattof32(x), floattof32(y), floattof32(z));
-}
-
-/*! \brief specify a color for following vertices
-\warning FLOAT VERSION!!!! please use glColor3b()
-\param r the red component of the color
-\param g the green component of the color
-\param b the blue component of the color */
-GL_STATIC_INL void glColor3f(float r, float g, float b) {
- glColor3b((uint8)(r*255), (uint8)(g*255), (uint8)(b*255));
-}
-
-/*! \brief multiply the current matrix by a scale matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\warning FLOAT VERSION!!!! please use glScalev() or glScalef32()
-\param x scaling on the x axis
-\param y scaling on the y axis
-\param z scaling on the z axis */
-GL_STATIC_INL void glScalef(float x, float y, float z) {
- MATRIX_SCALE = floattof32(x);
- MATRIX_SCALE = floattof32(y);
- MATRIX_SCALE = floattof32(z);
-}
-
-/*! \brief multiply the current matrix by a translation matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\warning FLOAT VERSION!!!! please use glTranslate3f32()
-\param x translation on the x axis
-\param y translation on the y axis
-\param z translation on the z axis */
-GL_STATIC_INL void glTranslatef(float x, float y, float z) {
- MATRIX_TRANSLATE = floattof32(x);
- MATRIX_TRANSLATE = floattof32(y);
- MATRIX_TRANSLATE = floattof32(z);
-}
-
-/*! \brief the normal to use for following vertices<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A>
-\warning FLOAT VERSION!!!! please use glNormal()
-\param x x component of the normal, vector must be normalized
-\param y y component of the normal, vector must be normalized
-\param z z component of the normal, vector must be normalized */
-GL_STATIC_INL void glNormal3f(float x, float y, float z) {
- glNormal(NORMAL_PACK(floattov10(x), floattov10(y), floattov10(z)));
-}
-
-/*! \brief Rotates the current modelview matrix by angle degrees about the x axis
-\warning FLOAT VERSION!!!! please use glRotateXi()
-\param angle The angle to rotate by */
-GL_STATIC_INL void glRotateX(float angle) {
- glRotateXi((int)(angle * LUT_SIZE / 360.0));
-}
-
-/*! \brief Rotates the current modelview matrix by angle degrees about the y axis
-\warning FLOAT VERSION!!!! please use glRotateYi()
-\param angle The angle to rotate by */
-GL_STATIC_INL void glRotateY(float angle) {
- glRotateYi((int)(angle * LUT_SIZE / 360.0));
-}
-
-/*! \brief Rotates the current modelview matrix by angle degrees about the z axis
-\warning FLOAT VERSION!!!! please use glRotateZi()
-\param angle The angle to rotate by */
-GL_STATIC_INL void glRotateZ(float angle) {
- glRotateZi((int)(angle * LUT_SIZE / 360.0));
-}
-
-/*! \brief Multiplies the current matrix into ortho graphic mode
-\warning FLOAT VERSION!!!! please use glOrthof32()
-\param left left vertical clipping plane
-\param right right vertical clipping plane
-\param bottom bottom vertical clipping plane
-\param top top vertical clipping plane
-\param zNear near clipping plane
-\param zFar far clipping plane */
-GL_STATIC_INL void glOrtho(float left, float right, float bottom, float top, float zNear, float zFar) {
- glOrthof32(floattof32(left), floattof32(right), floattof32(bottom), floattof32(top), floattof32(zNear), floattof32(zFar));
-}
-
-/*! \brief Places the camera at the specified location and orientation (floating point version)
-\warning FLOAT VERSION!!!! please use gluLookAtf32()
-\param eyex (eyex, eyey, eyez) Location of the camera.
-\param eyey (eyex, eyey, eyez) Location of the camera.
-\param eyez (eyex, eyey, eyez) Location of the camera.
-\param lookAtx (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param lookAty (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param lookAtz (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param upx <upx, upy, upz> Unit vector describing which direction is up for the camera.
-\param upy <upx, upy, upz> Unit vector describing which direction is up for the camera.
-\param upz <upx, upy, upz> Unit vector describing which direction is up for the camera. */
-GL_STATIC_INL void gluLookAt( float eyex, float eyey, float eyez,
- float lookAtx, float lookAty, float lookAtz,
- float upx, float upy, float upz) {
- gluLookAtf32(floattof32(eyex), floattof32(eyey), floattof32(eyez),
- floattof32(lookAtx), floattof32(lookAty), floattof32(lookAtz),
- floattof32(upx), floattof32(upy), floattof32(upz));
-}
-
-/*! \brief Specifies the viewing frustum for the projection matrix (floating point version)
-\warning FLOAT VERSION!!!! please use glFrustumf32()
-\param left left right top and bottom describe a rectangle located at the near clipping plane
-\param right left right top and bottom describe a rectangle located at the near clipping plane
-\param top left right top and bottom describe a rectangle located at the near clipping plane
-\param bottom left right top and bottom describe a rectangle located at the near clipping plane
-\param near Location of a the near clipping plane (parallel to viewing window)
-\param far Location of a the far clipping plane (parallel to viewing window) */
-GL_STATIC_INL void glFrustum(float left, float right, float bottom, float top, float near, float far) {
- glFrustumf32(floattof32(left), floattof32(right), floattof32(bottom), floattof32(top), floattof32(near), floattof32(far));
-}
-
-/*! \brief Utility function which sets up the projection matrix (floating point version)
-\warning FLOAT VERSION!!!! please use gluPerspectivef32()
-\param fovy Specifies the field of view in degrees
-\param aspect Specifies the aspect ratio of the screen (normally screen width/screen height)
-\param zNear Specifies the near clipping plane
-\param zFar Specifies the far clipping plane */
-GL_STATIC_INL void gluPerspective(float fovy, float aspect, float zNear, float zFar) {
- gluPerspectivef32((int)(fovy * LUT_SIZE / 360.0), floattof32(aspect), floattof32(zNear), floattof32(zFar));
-}
-
-/*! \brief Sets texture coordinates for following vertices<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes</A>
-\warning FLOAT VERSION!!!! please use glTexCoord2t16()
-\param s S(a.k.a. U) texture coordinate (0.0 - 1.0)
-\param t T(a.k.a. V) texture coordinate (0.0 - 1.0)*/
-GL_STATIC_INL void glTexCoord2f(float s, float t) {
- int x = ((glGlob->textures[glGlob->activeTexture]) >> 20) & 7;
- int y = ((glGlob->textures[glGlob->activeTexture]) >> 23) & 7;
-
- glTexCoord2t16(floattot16(s*(8 << x)), floattot16(t*(8<<y)));
-}
-
-
-#endif // #ifndef VIDEOGL_ARM9_INCLUDE
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/bios.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/bios.h
deleted file mode 100644
index 0b91c4cbef..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/bios.h
+++ /dev/null
@@ -1,365 +0,0 @@
-/*---------------------------------------------------------------------------------
- BIOS functions
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef BIOS_H_INCLUDE
-#define BIOS_H_INCLUDE
-
-/*! \file bios.h
-
- \brief Nintendo DS Bios functions
-*/
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#include <nds/jtypes.h>
-
-
-typedef struct DecompressionStream {
- int (*getSize)(uint8 * source, uint16 * dest, uint32 r2);
- int (*getResult)(uint8 * source); // can be NULL
- uint8 (*readByte)(uint8 * source);
-} PACKED TDecompressionStream;
-
-
-typedef struct UnpackStruct {
- uint16 sourceSize; // in bytes
- uint8 sourceWidth;
- uint8 destWidth;
- uint32 dataOffset;
-} PACKED TUnpackStruct, * PUnpackStruct;
-
-
-/*! \fn swiSoftReset(void)
- \brief reset the DS.
-
-*/
-void swiSoftReset(void);
-
-/*! \fn swiDelay( uint32 duration)
- \brief delay
-
- Delays for for a period X + Y*duration where X is the swi overhead and Y is a cycle of
-<CODE><PRE>
- loop:
- sub r0, #1
- bgt loop
-</PRE></CODE>
- of thumb fetches in BIOS memory
- \param duration
- length of delay
- \note
- Duration should be 1 or more, a duration of 0 is a huge delay
-
-*/
-void swiDelay(uint32 duration);
-
-/*! \fn swiIntrWait(int waitForSet, uint32 flags)
-
- \brief wait for interrupt(s) to occur
-
- \param waitForSet
- 0: Return if the interrupt has already occured
- 1: Wait until the interrupt has been set since the call
- \param flags
- interrupt mask to wait for
-
-*/
-
-void swiIntrWait(int waitForSet, uint32 flags);
-
-/*! \fn swiWaitForVBlank(void)
- \brief Wait for vblank interrupt
-
- Waits for a vertical blank interrupt
-
- \note Identical to calling swiIntrWait(1, 1)
-*/
-
-void swiWaitForVBlank(void);
-
-/*! \fn int swiDivide(int numerator, int divisor)
- \param numerator
- signed integer to divide
- \param divisor
- signed integer to divide by
- \return numerator / divisor
-
- \fn int swiRemainder(int numerator, int divisor)
- \param numerator
- signed integer to divide
- \param divisor
- signed integer to divide by
- \return numerator % divisor
-
- \fn void swiDivMod(int numerator, int divisor, int * result, int * remainder)
- \param numerator
- signed integer to divide
- \param divisor
- signed integer to divide by
- \param result
- pointer to integer set to numerator / divisor
- \param remainder
- pointer to integer set to numerator % divisor
-*/
-
-int swiDivide(int numerator, int divisor);
-int swiRemainder(int numerator, int divisor);
-void swiDivMod(int numerator, int divisor, int * result, int * remainder);
-
-/*! \fn swiCopy(const void * source, void * dest, int flags)
- \param source
- pointer to transfer source
- \param dest
- dest = pointer to transfer destination
- \param flags
- copy mode and size
-// flags(26) = transfer width (0: halfwords, 1: words)
-// flags(24) = transfer mode (0: copy, 1: fill)
-// flags(20..0) = transfer count (always in words)
-
- \fn swiFastCopy (const void * source, void * dest, int flags)
- \param source
- pointer to transfer source
- \param dest
- dest = pointer to transfer destination
- \param flags
- copy mode and size
-// flags(24) = transfer mode (0: copy, 1: fill)
-// flags(20..0) = transfer count (in words)
-
- \note Transfers more quickly than swiCopy, but has higher interrupt latency
-*/
-
-#define COPY_MODE_HWORD (0)
-#define COPY_MODE_WORD (1<<26)
-#define COPY_MODE_COPY (0)
-#define COPY_MODE_FILL (1<<24)
-
-void swiCopy(const void * source, void * dest, int flags);
-void swiFastCopy(const void * source, void * dest, int flags);
-
-// swiSqrt (swi 0x0D)
-
-int swiSqrt(int value);
-
-// swiCRC16(uint16 crc, void * data, uint32 size) (swi 0x0E)
-// crc - starting CRC-16
-// data - pointer to data (processed nibble by nibble)
-// size - size in bytes
-//
-// Returns the CRC-16 after the data has been processed
-
-uint16 swiCRC16(uint16 crc, void * data, uint32 size);
-
-// int swiIsDebugger(void)
-// Returns 0 if running on a debugger (8 MB of ram instead of 4 MB)
-//
-// Note: swi 0x0F on both CPUs
-
-int swiIsDebugger(void);
-
-// swiUnpackBits
-// source - Source address
-// destination - destination address (word aligned)
-// params - Unpack structure
-// uint16 sourceSize (in bytes)
-// uint8 sourceWidth (1,2,4,8)
-// uint8 destWidth (1,2,4,8,16,32)
-// uint32 dataOffset (bits 0..30 are added to all non-zero
-// destination writes, unless b31 is set,
-// which does it for zeros too)
-//
-// Unpack data stored multiple elements to a byte into a larger space
-// i.e. 8 elements per byte (i.e. b/w font), into 1 element per byte
-//
-// Note: swi 0x10 on both CPUs
-
-void swiUnpackBits(uint8 * source, uint32 * destination, PUnpackStruct params);
-
-// DecompressLZSSWram (swi 0x11)
-// source - pointer to a header word, followed by compressed data
-// word(31..8) = size of uncompressed data (in bytes)
-// word(7..0) = ignored
-// destination - destination address
-// Writes data a byte at a time
-//
-// DecompressLZSSVram (swi 0x12)
-// Writes data a halfword at a time
-// See DecompressRLEVram for parameter details
-
-void swiDecompressLZSSWram(void * source, void * destination);
-int swiDecompressLZSSVram(void * source, void * destination, uint32 toGetSize, TDecompressionStream * stream);
-
-// swiDecompressHuffman (swi 0x13)
-// See DecompressRLE for parameter details
-
-int swiDecompressHuffman(void * source, void * destination, uint32 toGetSize, TDecompressionStream * stream);
-
-// DecompressRLEWram (swi 0x14)
-// r0 - pointer to a header word, followed by compressed data
-// word(31..8) = size of uncompressed data (in bytes)
-// word(7..0) = ignored
-// r1 - destination address
-// Writes data a byte at a time
-//
-// DecompressRLEVram (swi 0x15)
-// r0 - pointer to compressed source data, maybe! (always goes through
-// the function pointers, so could just be an offset)
-// r1 - pointer to destination (halfword)
-// r2 - no idea, passed to getSize function
-// r3 - pointer to a structure
-// Writes data a halfword at a time
-//
-// Result of getSize is a word, with the size of decompressed data in
-// bits 31..8, and bits 7..0 are ignored. This value is also returned
-// by the swi, unless getResult is non-NULL and returns a neg. value
-//
-// getResult is used to provide a result for the swi, given the source
-// pointer after all data has been read (or if getSize < 0). It can
-// be NULL, unlike getSize and readByte. Its value is only returned
-// if negative, otherwise the typical result is used, so it is likely
-// some sort of error-checking procedure
-//
-// readByte is used in lieu of directly accessing memory
-//
-// compressed data format:
-// bit(7): 0: uncompressed, 1: compressed
-// bit(6..0) when uncompressed: run length - 1, followed by run_length bytes of true data
-// bit(6..0) when compressed: run length - 3, followed by one byte of true data, to be repeated
-
-void swiDecompressRLEWram(void * source, void * destination);
-int swiDecompressRLEVram(void * source, void * destination, uint32 toGetSize, TDecompressionStream * stream);
-
-// swiDecodeDelta8
-// source - pointer to a header word, followed by encoded data
-// word(31..8) = size of data (in bytes)
-// word(7..0) = ignored
-// destination - destination address
-// Writes data a byte at a time
-//
-// Note: ARM9 exclusive swi 0x16
-
-#ifdef ARM9
-
-/*! \fn swiWaitForIRQ
- \brief wait for any interrupt
-
- \note ARM9 exclusive
-*/
-void swiWaitForIRQ(void);
-
-void swiSetHaltCR(uint32 data);
-
-
-extern void swiDecodeDelta8(void * source, void * destination);
-
-// swiDecodeDelta16
-// source - pointer to a header word, followed by encoded data
-// word(31..8) = size of data (in bytes)
-// word(7..0) = ignored
-// destination - destination address
-// Writes data a halfword at a time
-//
-// Note: ARM9 exclusive swi 0x18
-
-void swiDecodeDelta16(void * source, void * destination);
-#endif
-
-
-#ifdef ARM7
-
-//
-// swiHalt (swi 0x06)
-// Same as swiSetHaltCR(0x80)
-//
-// swiSleep (swi 0x07)
-// Same as swiSetHaltCR(0xC0)
-//
-// swiSwitchToGBAMode (not a SWI)
-// Same as swiSetHaltCR(0x40)
-//
-// swiSetHaltCR (swi 0x1F)
-// Writes a byte of the data to 0x04000301:8
-//
-// Note: All of these are ARM7 exclusive
-//
-// swiSetHaltCR (swi 0x1F)
-// Writes a word of the data to 0x04000300:32
-//
-// Note: This is on the ARM9, but works differently to the ARM7 function!
-//
-
-void swiHalt(void);
-void swiSleep(void);
-void swiSwitchToGBAMode(void);
-void swiSetHaltCR(uint8 data);
-
-// swiGetSineTable(int index)
-// Returns an entry in the sine table (index = 0..63)
-//
-// Note: ARM7 exclusive swi 0x1A
-
-uint16 swiGetSineTable(int index);
-//
-// swiGetPitchTable(int index)
-// Returns an entry in the pitch table (index = 0..767)
-//
-// Note: ARM7 exclusive swi 0x1B
-
-uint16 swiGetPitchTable(int index);
-
-
-// swiGetVolumeTable(int index)
-// Returns an entry in the volume table (index = 0..723)
-//
-// Note: ARM7 exclusive swi 0x1C
-uint8 swiGetVolumeTable(int index);
-// swiChangeSoundBias(int enabled, int delay)
-// enabled
-// 0: decrement SOUND_BIAS once per delay until it reaches 0x000
-// 1: increment SOUND_BIAS once per delay until it reaches 0x200
-// delay is in the same units of time as swiDelay
-//
-// Note: ARM7 exclusive SWI 0x08
-
-void swiChangeSoundBias(int enabled, int delay);
-
-
-#endif //ARM7
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/card.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/card.h
deleted file mode 100644
index 7e82b2f693..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/card.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef NDS_CARD_INCLUDE
-#define NDS_CARD_INCLUDE
-
-
-#include "jtypes.h"
-
-// Card bus
-#define CARD_CR1 (*(vuint16*)0x040001A0)
-#define CARD_CR1H (*(vuint8*)0x040001A1)
-#define CARD_EEPDATA (*(vuint8*)0x040001A2)
-#define CARD_CR2 (*(vuint32*)0x040001A4)
-#define CARD_COMMAND ((vuint8*)0x040001A8)
-
-#define CARD_DATA_RD (*(vuint32*)0x04100010)
-
-#define CARD_1B0 (*(vuint32*)0x040001B0)
-#define CARD_1B4 (*(vuint32*)0x040001B4)
-#define CARD_1B8 (*(vuint16*)0x040001B8)
-#define CARD_1BA (*(vuint16*)0x040001BA)
-
-
-#define CARD_CR1_ENABLE 0x80 // in byte 1, i.e. 0x8000
-#define CARD_CR1_IRQ 0x40 // in byte 1, i.e. 0x4000
-
-
-// CARD_CR2 register:
-
-#define CARD_ACTIVATE (1<<31) // when writing, get the ball rolling
-// 1<<30
-#define CARD_nRESET (1<<29) // value on the /reset pin (1 = high out, not a reset state, 0 = low out = in reset)
-#define CARD_28 (1<<28) // when writing
-#define CARD_27 (1<<27) // when writing
-#define CARD_26 (1<<26)
-#define CARD_22 (1<<22)
-#define CARD_19 (1<<19)
-#define CARD_ENCRYPTED (1<<14) // when writing, this command should be encrypted
-#define CARD_13 (1<<13) // when writing
-#define CARD_4 (1<<4) // when writing
-
-// 3 bits in b10..b8 indicate something
-// read bits
-#define CARD_BUSY (1<<31) // when reading, still expecting incomming data?
-#define CARD_DATA_READY (1<<23) // when reading, CARD_DATA_RD or CARD_DATA has another word of data and is good to go
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-void cardWriteCommand(const uint8 * command);
-
-void cardPolledTransfer(uint32 flags, uint32 * destination, uint32 length, const uint8 * command);
-void cardStartTransfer(const uint8 * command, uint32 * destination, int channel, uint32 flags);
-uint32 cardWriteAndRead(const uint8 * command, uint32 flags);
-
-// These commands require the cart to not be initialized yet, which may mean the user
-// needs to eject and reinsert the cart or they will return random data.
-void cardRead00(uint32 address, uint32 * destination, uint32 length, uint32 flags);
-void cardReadHeader(uint8 * header);
-int cardReadID(uint32 flags);
-
-// Reads from the EEPROM
-void cardReadEeprom(uint32 address, uint8 *data, uint32 length, uint32 addrtype);
-
-// Writes to the EEPROM. TYPE 3 EEPROM must be erased first (I think?)
-void cardWriteEeprom(uint32 address, uint8 *data, uint32 length, uint32 addrtype);
-
-// Returns the ID of the EEPROM chip? Doesn't work well, most chips give ff,ff
-// i = 0 or 1
-uint8 cardEepromReadID(uint8 i);
-
-// Sends a command to the EEPROM
-uint8 cardEepromCommand(uint8 command, uint32 address);
-
-/*
- * -1:no card or no EEPROM
- * 0:unknown PassMe?
- * 1:TYPE 1 4Kbit(512Byte) EEPROM
- * 2:TYPE 2 64Kbit(8KByte)or 512kbit(64Kbyte) EEPROM
- * 3:TYPE 3 2Mbit(256KByte) FLASH MEMORY (some rare 4Mbit and 8Mbit chips also)
- */
-int cardEepromGetType(void);
-
-// Returns the size in bytes of EEPROM
-uint32 cardEepromGetSize(void);
-
-// Erases the entire chip. TYPE 3 chips MUST be erased before writing to them. (I think?)
-void cardEepromChipErase(void);
-
-// Erases a single sector of the TYPE 3 chip
-void cardEepromSectorErase(uint32 address);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/dma.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/dma.h
deleted file mode 100644
index e7b7f3ab7c..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/dma.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef NDS_DMA_INCLUDE
-#define NDS_DMA_INCLUDE
-
-
-#define DMA0_SRC (*(vuint32*)0x040000B0)
-#define DMA0_DEST (*(vuint32*)0x040000B4)
-#define DMA0_CR (*(vuint32*)0x040000B8)
-
-#define DMA1_SRC (*(vuint32*)0x040000BC)
-#define DMA1_DEST (*(vuint32*)0x040000C0)
-#define DMA1_CR (*(vuint32*)0x040000C4)
-
-#define DMA2_SRC (*(vuint32*)0x040000C8)
-#define DMA2_DEST (*(vuint32*)0x040000CC)
-#define DMA2_CR (*(vuint32*)0x040000D0)
-
-#define DMA3_SRC (*(vuint32*)0x040000D4)
-#define DMA3_DEST (*(vuint32*)0x040000D8)
-#define DMA3_CR (*(vuint32*)0x040000DC)
-
-#define DMA_SRC(n) (*(vuint32*)(0x040000B0+(n*12)))
-#define DMA_DEST(n) (*(vuint32*)(0x040000B4+(n*12)))
-#define DMA_CR(n) (*(vuint32*)(0x040000B8+(n*12)))
-
-
-// DMA control register contents
-// The defaults are 16-bit, increment source/dest addresses, no irq
-#define DMA_ENABLE BIT(31)
-#define DMA_BUSY BIT(31)
-#define DMA_IRQ_REQ BIT(30)
-
-#define DMA_START_NOW 0
-#define DMA_START_CARD (5<<27)
-
-#ifdef ARM7
-#define DMA_START_VBL BIT(27)
-#endif
-
-#ifdef ARM9
-#define DMA_START_HBL BIT(28)
-#define DMA_START_VBL BIT(27)
-#define DMA_START_FIFO (7<<27)
-#define DMA_DISP_FIFO (4<<27)
-#endif
-
-#define DMA_16_BIT 0
-#define DMA_32_BIT BIT(26)
-
-
-#define DMA_REPEAT BIT(25)
-
-#define DMA_SRC_INC (0)
-#define DMA_SRC_DEC BIT(23)
-#define DMA_SRC_FIX BIT(24)
-
-#define DMA_DST_INC (0)
-#define DMA_DST_DEC BIT(21)
-#define DMA_DST_FIX BIT(22)
-#define DMA_DST_RESET (3<<21)
-
-#define DMA_COPY_WORDS (DMA_ENABLE | DMA_32_BIT | DMA_START_NOW)
-#define DMA_COPY_HALFWORDS (DMA_ENABLE | DMA_16_BIT | DMA_START_NOW)
-#define DMA_FIFO (DMA_ENABLE | DMA_32_BIT | DMA_DST_FIX | DMA_START_FIFO)
-
-static inline void dmaCopyWords(uint8 channel, const void* src, void* dest, uint32 size) {
- DMA_SRC(channel) = (uint32)src;
- DMA_DEST(channel) = (uint32)dest;
- DMA_CR(channel) = DMA_COPY_WORDS | (size>>2);
- while(DMA_CR(channel) & DMA_BUSY);
-}
-
-static inline void dmaCopyHalfWords(uint8 channel, const void* src, void* dest, uint32 size) {
- DMA_SRC(channel) = (uint32)src;
- DMA_DEST(channel) = (uint32)dest;
- DMA_CR(channel) = DMA_COPY_HALFWORDS | (size>>1);
- while(DMA_CR(channel) & DMA_BUSY);
-}
-
-static inline void dmaCopy(const void * source, void * dest, uint32 size) {
- DMA_SRC(3) = (uint32)source;
- DMA_DEST(3) = (uint32)dest;
- DMA_CR(3) = DMA_COPY_HALFWORDS | (size>>1);
- while(DMA_CR(3) & DMA_BUSY);
-}
-
-static inline void dmaCopyWordsAsynch(uint8 channel, const void* src, void* dest, uint32 size) {
- DMA_SRC(channel) = (uint32)src;
- DMA_DEST(channel) = (uint32)dest;
- DMA_CR(channel) = DMA_COPY_WORDS | (size>>2);
-
-}
-
-static inline void dmaCopyHalfWordsAsynch(uint8 channel, const void* src, void* dest, uint32 size) {
- DMA_SRC(channel) = (uint32)src;
- DMA_DEST(channel) = (uint32)dest;
- DMA_CR(channel) = DMA_COPY_HALFWORDS | (size>>1);
-}
-
-static inline void dmaCopyAsynch(const void * source, void * dest, uint32 size) {
- DMA_SRC(3) = (uint32)source;
- DMA_DEST(3) = (uint32)dest;
- DMA_CR(3) = DMA_COPY_HALFWORDS | (size>>1);
-}
-
-static inline void dmaFillWords( const void* src, void* dest, uint32 size) {
- DMA_SRC(3) = (uint32)src;
- DMA_DEST(3) = (uint32)dest;
- DMA_CR(3) = DMA_SRC_FIX | DMA_COPY_WORDS | (size>>2);
- while(DMA_CR(3) & DMA_BUSY);
-}
-
-static inline void dmaFillHalfWords( const void* src, void* dest, uint32 size) {
- DMA_SRC(3) = (uint32)src;
- DMA_DEST(3) = (uint32)dest;
- DMA_CR(3) = DMA_SRC_FIX | DMA_COPY_HALFWORDS | (size>>1);
- while(DMA_CR(3) & DMA_BUSY);
-}
-
-static inline int dmaBusy(uint8 channel) {
- return (DMA_CR(channel) & DMA_BUSY)>>31;
-}
-
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/interrupts.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/interrupts.h
deleted file mode 100644
index 5f31190fda..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/interrupts.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*---------------------------------------------------------------------------------
- Interrupt registers and vector pointers
-
- Copyright (C) 2005
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
-
----------------------------------------------------------------------------------*/
-
-/*! \file interrupts.h
-
- \brief nds interrupt support.
-
-*/
-
-#ifndef NDS_INTERRUPTS_INCLUDE
-#define NDS_INTERRUPTS_INCLUDE
-
-#include <nds/jtypes.h>
-
-/*! \enum IRQ_MASKS
- \brief values allowed for REG_IE and REG_IF
-
-*/
-enum IRQ_MASKS {
- IRQ_VBLANK = BIT(0), /*!< vertical blank interrupt mask */
- IRQ_HBLANK = BIT(1), /*!< horizontal blank interrupt mask */
- IRQ_VCOUNT = BIT(2), /*!< vcount match interrupt mask */
- IRQ_TIMER0 = BIT(3), /*!< timer 0 interrupt mask */
- IRQ_TIMER1 = BIT(4), /*!< timer 1 interrupt mask */
- IRQ_TIMER2 = BIT(5), /*!< timer 2 interrupt mask */
- IRQ_TIMER3 = BIT(6), /*!< timer 3 interrupt mask */
- IRQ_NETWORK = BIT(7), /*!< serial interrupt mask */
- IRQ_DMA0 = BIT(8), /*!< DMA 0 interrupt mask */
- IRQ_DMA1 = BIT(9), /*!< DMA 1 interrupt mask */
- IRQ_DMA2 = BIT(10), /*!< DMA 2 interrupt mask */
- IRQ_DMA3 = BIT(11), /*!< DMA 3 interrupt mask */
- IRQ_KEYS = BIT(12), /*!< Keypad interrupt mask */
- IRQ_CART = BIT(13), /*!< GBA cartridge interrupt mask */
- IRQ_IPC_SYNC = BIT(16), /*!< IPC sync interrupt mask */
- IRQ_FIFO_EMPTY = BIT(17), /*!< Send FIFO empty interrupt mask */
- IRQ_FIFO_NOT_EMPTY = BIT(18), /*!< Receive FIFO empty interrupt mask */
- IRQ_CARD = BIT(19), /*!< interrupt mask */
- IRQ_CARD_LINE = BIT(20), /*!< interrupt mask */
- IRQ_GEOMETRY_FIFO = BIT(21), /*!< geometry FIFO interrupt mask */
- IRQ_LID = BIT(22), /*!< interrupt mask */
- IRQ_SPI = BIT(23), /*!< SPI interrupt mask */
- IRQ_WIFI = BIT(24), /*!< WIFI interrupt mask (ARM7)*/
- IRQ_ALL = (~0)
-};
-
-#define MAX_INTERRUPTS 25
-
-typedef enum IRQ_MASKS IRQ_MASK;
-
-/*! \def REG_IE
-
- \brief Interrupt Enable Register.
-
- This is the activation mask for the internal interrupts. Unless
- the corresponding bit is set, the IRQ will be masked out.
-*/
-#define REG_IE (*(vuint32*)0x04000210)
-
-/*! \def REG_IF
-
- \brief Interrupt Flag Register.
-
- Since there is only one hardware interrupt vector, the IF register
- contains flags to indicate when a particular of interrupt has occured.
- To acknowledge processing interrupts, set IF to the value of the
- interrupt handled.
-
-*/
-#define REG_IF (*(vuint32*)0x04000214)
-
-/*! \def REG_IME
-
- \brief Interrupt Master Enable Register.
-
- When bit 0 is clear, all interrupts are masked. When it is 1,
- interrupts will occur if not masked out in REG_IE.
-
-*/
-#define REG_IME (*(vuint16*)0x04000208)
-
-/*! \enum IME_VALUE
- \brief values allowed for REG_IME
-*/
-enum IME_VALUE {
- IME_DISABLE = 0, /*!< Disable all interrupts. */
- IME_ENABLE = 1, /*!< Enable all interrupts not masked out in REG_IE */
-};
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-extern VoidFunctionPointer __irq_vector[];
-extern vuint32 __irq_flags[];
-#define VBLANK_INTR_WAIT_FLAGS *(__irq_flags)
-#define IRQ_HANDLER *(__irq_vector)
-
-struct IntTable{IntFn handler; u32 mask;};
-
-/*! \fn irqInit(void)
- \brief Initialise the libnds interrupt system.
-
- Call this function at the start of any application which requires interrupt support.
- This function should be used in preference to irqInitHandler.
-
-*/
-void irqInit(void);
-/*! \fn irqSet(IRQ_MASK irq, VoidFunctionPointer handler)
- \brief Add a handler for the given interrupt mask.
-
- Specify the handler to use for the given interrupt. This only works with
- the default interrupt handler, do not mix the use of this routine with a
- user-installed IRQ handler.
- \param irq Mask associated with the interrupt.
- \param handler Address of the function to use as an interrupt service routine
- \note
- When any handler specifies using IRQ_VBLANK or IRQ_HBLANK, DISP_SR
- is automatically updated to include the corresponding DISP_VBLANK_IRQ or DISP_HBLANK_IRQ.
-
- \warning Only one IRQ_MASK can be specified with this function.
-*/
-void irqSet(IRQ_MASK irq, VoidFunctionPointer handler);
-/*! \fn irqClear(IRQ_MASK irq)
- \brief remove the handler associated with the interrupt mask irq.
- \param irq Mask associated with the interrupt.
-*/
-void irqClear(IRQ_MASK irq);
-/*! \fn irqInitHandler(VoidFunctionPointer handler)
- \brief Install a user interrupt dispatcher.
-
- This function installs the main interrupt function, all interrupts are serviced through this routine. For most
- purposes the libnds interrupt dispacther should be used in preference to user code unless you know *exactly* what you're doing.
-
- \param handler Address of the function to use as an interrupt dispatcher
- \note the function *must* be ARM code
-*/
-void irqInitHandler(VoidFunctionPointer handler);
-/*! \fn irqEnable(uint32 irq)
- \brief Allow the given interrupt to occur.
- \param irq The set of interrupt masks to enable.
- \note Specify multiple interrupts to enable by ORing several IRQ_MASKS.
-*/
-void irqEnable(uint32 irq);
-/*! \fn irqDisable(uint32 irq)
- \brief Prevent the given interrupt from occuring.
- \param irq The set of interrupt masks to disable.
- \note Specify multiple interrupts to disable by ORing several IRQ_MASKS.
-*/
-void irqDisable(uint32 irq);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //NDS_INTERRUPTS_INCLUDE
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/ipc.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/ipc.h
deleted file mode 100644
index 968d6c2ea5..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/ipc.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*---------------------------------------------------------------------------------
- Inter Processor Communication
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef NDS_IPC_INCLUDE
-#define NDS_IPC_INCLUDE
-
-#include <nds/jtypes.h>
-
-//---------------------------------------------------------------------------------
-typedef struct sTransferSoundData {
-//---------------------------------------------------------------------------------
- const void *data;
- u32 len;
- u32 rate;
- u8 vol;
- u8 pan;
- u8 format;
- u8 PADDING;
-} TransferSoundData, * pTransferSoundData;
-
-
-//---------------------------------------------------------------------------------
-typedef struct sTransferSound {
-//---------------------------------------------------------------------------------
- TransferSoundData data[16];
- u8 count;
- u8 PADDING[3];
-} TransferSound, * pTransferSound;
-
-
-//---------------------------------------------------------------------------------
-typedef struct sTransferRegion {
-//---------------------------------------------------------------------------------
- vint16 touchX, touchY; // TSC X, Y
- vint16 touchXpx, touchYpx; // TSC X, Y pixel values
- vint16 touchZ1, touchZ2; // TSC x-panel measurements
- vuint16 tdiode1, tdiode2; // TSC temperature diodes
- vuint32 temperature; // TSC computed temperature
-
- uint16 buttons; // X, Y, /PENIRQ buttons
-
- union {
- vuint8 curtime[8]; // current time response from RTC
-
- struct {
- vu8 command;
- vu8 year; //add 2000 to get 4 digit year
- vu8 month; //1 to 12
- vu8 day; //1 to (days in month)
-
- vu8 weekday; // day of week
- vu8 hours; //0 to 11 for AM, 52 to 63 for PM
- vu8 minutes; //0 to 59
- vu8 seconds; //0 to 59
- } rtc;
- } time;
- vint32 unixTime;
-
- uint16 battery; // battery life ?? hopefully. :)
- uint16 aux; // i have no idea...
-
- // Don't rely on these below, will change or be removed in the future
- pTransferSound soundData;
-
- vuint32 mailAddr;
- vuint32 mailData;
- vuint8 mailRead;
- vuint8 mailBusy;
- vuint32 mailSize;
-} TransferRegion, * pTransferRegion;
-
-
-static inline
-TransferRegion volatile * getIPC(void); // __attribute__ ((deprecated));
-
-static inline
-TransferRegion volatile * getIPC(void) {
- return (TransferRegion volatile *)(0x027FF000);
-}
-
-#define IPC getIPC()
-
-#define IPC_PEN_DOWN BIT(6)
-#define IPC_X BIT(0)
-#define IPC_Y BIT(1)
-#define IPC_LID_CLOSED BIT(7)
-
-//---------------------------------------------------------------------------------
-// Synchronization register
-//---------------------------------------------------------------------------------
-#define REG_IPC_SYNC (*(vuint16*)0x04000180)
-
-enum IPC_SYNC_BITS {
- IPC_SYNC_IRQ_ENABLE = BIT(14),
- IPC_SYNC_IRQ_REQUEST = BIT(13)
-};
-
-//---------------------------------------------------------------------------------
-static inline void IPC_SendSync(unsigned int sync) {
-//---------------------------------------------------------------------------------
- REG_IPC_SYNC = (REG_IPC_SYNC & 0xf0ff) | (((sync) & 0x0f) << 8) | IPC_SYNC_IRQ_REQUEST;
-}
-
-//---------------------------------------------------------------------------------
-static inline int IPC_GetSync(void) {
-//---------------------------------------------------------------------------------
- return REG_IPC_SYNC & 0x0f;
-}
-
-//---------------------------------------------------------------------------------
-// fifo
-//---------------------------------------------------------------------------------
-#define REG_IPC_FIFO_TX (*(vu32*)0x4000188)
-#define REG_IPC_FIFO_RX (*(vu32*)0x4100000)
-#define REG_IPC_FIFO_CR (*(vu16*)0x4000184)
-
-enum IPC_CONTROL_BITS {
- IPC_FIFO_SEND_EMPTY = (1<<0),
- IPC_FIFO_SEND_FULL = (1<<1),
- IPC_FIFO_SEND_IRQ = (1<<2),
- IPC_FIFO_SEND_CLEAR = (1<<3),
- IPC_FIFO_RECV_EMPTY = (1<<8),
- IPC_FIFO_RECV_FULL = (1<<9),
- IPC_FIFO_RECV_IRQ = (1<<10),
- IPC_FIFO_ERROR = (1<<14),
- IPC_FIFO_ENABLE = (1<<15)
-};
-
-#endif // NDS_IPC_INCLUDE
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/jtypes.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/jtypes.h
deleted file mode 100644
index afd93c6d05..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/jtypes.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*---------------------------------------------------------------------------------
- jtypes.h -- Common types (and a few useful macros)
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Chris Double (doublec)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef NDS_JTYPES_INCLUDE
-#define NDS_JTYPES_INCLUDE
-//---------------------------------------------------------------------------------
-
-
-#define PACKED __attribute__ ((packed))
-#define packed_struct struct PACKED
-
-//---------------------------------------------------------------------------------
-// libgba compatible section macros
-//---------------------------------------------------------------------------------
-#define ITCM_CODE __attribute__((section(".bsp_fast_text"), long_call))
-
-#define DTCM_DATA __attribute__((section(".bsp_fast_data")))
-#define DTCM_BSS __attribute__((section(".sbss")))
-#define ALIGN(m) __attribute__((aligned (m)))
-
-#define PACKED __attribute__ ((packed))
-#define packed_struct struct PACKED
-
-//---------------------------------------------------------------------------------
-// These are linked to the bin2o macro in the Makefile
-//---------------------------------------------------------------------------------
-#define GETRAW(name) (name)
-#define GETRAWSIZE(name) ((int)name##_size)
-#define GETRAWEND(name) ((int)name##_end)
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-#define BIT(n) (1 << (n))
-
-// define libnds types in terms of stdint
-#include <stdint.h>
-
-typedef uint8_t uint8;
-typedef uint16_t uint16;
-typedef uint32_t uint32;
-typedef uint64_t uint64;
-
-typedef int8_t int8;
-typedef int16_t int16;
-typedef int32_t int32;
-typedef int64_t int64;
-
-typedef float float32;
-typedef double float64;
-
-typedef volatile uint8_t vuint8;
-typedef volatile uint16_t vuint16;
-typedef volatile uint32_t vuint32;
-typedef volatile uint64_t vuint64;
-
-typedef volatile int8_t vint8;
-typedef volatile int16_t vint16;
-typedef volatile int32_t vint32;
-typedef volatile int64_t vint64;
-
-typedef volatile float32 vfloat32;
-typedef volatile float64 vfloat64;
-
-typedef uint8_t byte;
-
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-
-typedef int8_t s8;
-typedef int16_t s16;
-typedef int32_t s32;
-typedef int64_t s64;
-
-typedef volatile u8 vu8;
-typedef volatile u16 vu16;
-typedef volatile u32 vu32;
-typedef volatile u64 vu64;
-
-typedef volatile s8 vs8;
-typedef volatile s16 vs16;
-typedef volatile s32 vs32;
-typedef volatile s64 vs64;
-
-typedef struct touchPosition {
- int16 x;
- int16 y;
- int16 px;
- int16 py;
- int16 z1;
- int16 z2;
-} touchPosition;
-
-
-/** C++ compatible bool for C */
-#include <stdbool.h>
-
-// Handy function pointer typedefs
-typedef void ( * IntFn)(void);
-typedef void (* VoidFunctionPointer)(void);
-typedef void (* fp)(void);
-
-//---------------------------------------------------------------------------------
-#endif
-//---------------------------------------------------------------------------------
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/memory.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/memory.h
deleted file mode 100644
index 46864e50a7..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/memory.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- memory.h -- Declaration of memory regions
-
-
- Copyright (C) 2005 Michael Noland (joat) and Jason Rogers (dovoto)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef NDS_MEMORY_INCLUDE
-#define NDS_MEMORY_INCLUDE
-
-
-#include "jtypes.h"
-
-
-#ifdef ARM9
-#define REG_EXMEMCNT (*(vuint16*)0x04000204)
-#else
-#define REG_EXMEMSTAT (*(vuint16*)0x04000204)
-#endif
-
-#define ARM7_MAIN_RAM_PRIORITY BIT(15)
-#define ARM7_OWNS_CARD BIT(11)
-#define ARM7_OWNS_ROM BIT(7)
-
-
-// Protection register (write-once sadly)
-#ifdef ARM7
-#define PROTECTION (*(vuint32*)0x04000308)
-#endif
-
-
-#define ALLRAM ((uint8*)0x00000000)
-
-#define MAINRAM8 ((uint8*)0x02000000)
-#define MAINRAM16 ((uint16*)0x02000000)
-#define MAINRAM32 ((uint32*)0x02000000)
-
-// fixme: shared RAM
-
-// GBA_BUS is volatile, while GBAROM is not
-#define GBA_BUS ((vuint16 *)(0x08000000))
-#define GBAROM ((uint16*)0x08000000)
-
-#define SRAM ((uint8*)0x0A000000)
-
-
-#ifdef ARM9
-#define PALETTE ((uint16*)0x05000000)
-#define PALETTE_SUB ((uint16*)0x05000400)
-
-#define BG_PALETTE ((uint16*)0x05000000)
-#define BG_PALETTE_SUB ((uint16*)0x05000400)
-
-#define SPRITE_PALETTE ((uint16*)0x05000200)
-#define SPRITE_PALETTE_SUB ((uint16*)0x05000600)
-
-#define BG_GFX ((uint16*)0x6000000)
-#define BG_GFX_SUB ((uint16*)0x6200000)
-#define SPRITE_GFX ((uint16*)0x6400000)
-#define SPRITE_GFX_SUB ((uint16*)0x6600000)
-
-#define VRAM_0 ((uint16*)0x6000000)
-#define VRAM ((uint16*)0x6800000)
-#define VRAM_A ((uint16*)0x6800000)
-#define VRAM_B ((uint16*)0x6820000)
-#define VRAM_C ((uint16*)0x6840000)
-#define VRAM_D ((uint16*)0x6860000)
-#define VRAM_E ((uint16*)0x6880000)
-#define VRAM_F ((uint16*)0x6890000)
-#define VRAM_G ((uint16*)0x6894000)
-#define VRAM_H ((uint16*)0x6898000)
-#define VRAM_I ((uint16*)0x68A0000)
-
-#define OAM ((uint16*)0x07000000)
-#define OAM_SUB ((uint16*)0x07000400)
-#endif
-
-#ifdef ARM7
-#define VRAM ((uint16*)0x06000000)
-#endif
-
-
-typedef struct sGBAHeader {
- uint32 entryPoint;
- uint8 logo[156];
- char title[0xC];
- char gamecode[0x4];
- uint16 makercode;
- uint8 is96h;
- uint8 unitcode;
- uint8 devicecode;
- uint8 unused[7];
- uint8 version;
- uint8 complement;
- uint16 checksum;
-} __attribute__ ((__packed__)) tGBAHeader;
-
-#define GBA_HEADER (*(tGBAHeader *)0x08000000)
-
-
-typedef struct sNDSHeader {
- char gameTitle[12];
- char gameCode[4];
- char makercode[2];
- uint8 unitCode;
- uint8 deviceType; // type of device in the game card
- uint8 deviceSize; // device capacity (1<<n Mbit)
- uint8 reserved1[9];
- uint8 romversion;
- uint8 flags; // auto-boot flag
-
- uint32 arm9romSource;
- uint32 arm9executeAddress;
- uint32 arm9destination;
- uint32 arm9binarySize;
-
- uint32 arm7romSource;
- uint32 arm7executeAddress;
- uint32 arm7destination;
- uint32 arm7binarySize;
-
- uint32 filenameSource;
- uint32 filenameSize;
- uint32 fatSource;
- uint32 fatSize;
-
- uint32 arm9overlaySource;
- uint32 arm9overlaySize;
- uint32 arm7overlaySource;
- uint32 arm7overlaySize;
-
- uint32 cardControl13; // used in modes 1 and 3
- uint32 cardControlBF; // used in mode 2
- uint32 bannerOffset;
-
- uint16 secureCRC16;
-
- uint16 readTimeout;
-
- uint32 unknownRAM1;
- uint32 unknownRAM2;
-
- uint32 bfPrime1;
- uint32 bfPrime2;
- uint32 romSize;
-
- uint32 headerSize;
- uint32 zeros88[14];
- uint8 gbaLogo[156];
- uint16 logoCRC16;
- uint16 headerCRC16;
-
- uint32 debugRomSource;
- uint32 debugRomSize;
- uint32 debugRomDestination;
- uint32 offset_0x16C;
-
- uint8 zero[0x90];
-} __attribute__ ((__packed__)) tNDSHeader;
-
-#define NDSHeader (*(tNDSHeader *)0x027FFE00)
-
-
-typedef struct sNDSBanner {
- uint16 version;
- uint16 crc;
- uint8 reserved[28];
- uint8 icon[512];
- uint16 palette[16];
- uint16 titles[6][128];
-} __attribute__ ((__packed__)) tNDSBanner;
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef ARM9
-#define BUS_OWNER_ARM9 true
-#define BUS_OWNER_ARM7 false
-
-// Changes only the gba rom bus ownership
-static inline void sysSetCartOwner(bool arm9) {
- REG_EXMEMCNT = (REG_EXMEMCNT & ~ARM7_OWNS_ROM) | (arm9 ? 0 : ARM7_OWNS_ROM);
-}
-// Changes only the nds card bus ownership
-static inline void sysSetCardOwner(bool arm9) {
- REG_EXMEMCNT = (REG_EXMEMCNT & ~ARM7_OWNS_CARD) | (arm9 ? 0 : ARM7_OWNS_CARD);
-}
-
-// Changes all bus ownerships
-static inline void sysSetBusOwners(bool arm9rom, bool arm9card) {
- uint16 pattern = REG_EXMEMCNT & ~(ARM7_OWNS_CARD|ARM7_OWNS_ROM);
- pattern = pattern | (arm9card ? 0: ARM7_OWNS_CARD ) |
- (arm9rom ? 0: ARM7_OWNS_ROM );
- REG_EXMEMCNT = pattern;
-}
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/registers_alt.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/registers_alt.h
deleted file mode 100644
index 1c9eb33993..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/registers_alt.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Chris Double (doublec)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-/*
- This file should be deprecated.
-
- All hardware register defines should be replaced with REG_ for consistency and namespacing
-
- http://forum.gbadev.org/viewtopic.php?t=4993
-
-*/
-#ifndef NDS_REGISTERS_H
-#define NDS_REGISTERS_H
-
-
-#include <nds/jtypes.h>
-
-
-#define REG_DISPCNT (*(vu32*)0x4000000)
-
-#ifdef ARM9
-#define WAIT_CR REG_EXMEMCNT
-#else
-#define WAIT_CR REG_EXMEMSTAT
-#endif
-
-#define DISP_SR REG_DISPSTAT
-#define DISP_Y REG_VCOUNT
-
-#define REG_BGCTRL ( (vu16*)0x4000008)
-#define REG_BG0CNT (*(vu16*)0x4000008)
-#define REG_BG1CNT (*(vu16*)0x400000A)
-#define REG_BG2CNT (*(vu16*)0x400000C)
-#define REG_BG3CNT (*(vu16*)0x400000E)
-
-#define REG_BGOFFSETS ( (vu16*)0x4000010)
-#define REG_BG0HOFS (*(vu16*)0x4000010)
-#define REG_BG0VOFS (*(vu16*)0x4000012)
-#define REG_BG1HOFS (*(vu16*)0x4000014)
-#define REG_BG1VOFS (*(vu16*)0x4000016)
-#define REG_BG2HOFS (*(vu16*)0x4000018)
-#define REG_BG2VOFS (*(vu16*)0x400001A)
-#define REG_BG3HOFS (*(vu16*)0x400001C)
-#define REG_BG3VOFS (*(vu16*)0x400001E)
-
-#define REG_BG2PA (*(vu16*)0x4000020)
-#define REG_BG2PB (*(vu16*)0x4000022)
-#define REG_BG2PC (*(vu16*)0x4000024)
-#define REG_BG2PD (*(vu16*)0x4000026)
-
-#define REG_BG2X (*(vu32*)0x4000028)
-#define REG_BG2X_L (*(vu16*)0x4000028)
-#define REG_BG2X_H (*(vu16*)0x400002A)
-
-#define REG_BG2Y (*(vu32*)0x400002C)
-#define REG_BG2Y_L (*(vu16*)0x400002C)
-#define REG_BG2Y_H (*(vu16*)0x400002E)
-
-#define REG_BG3PA (*(vu16*)0x4000030)
-#define REG_BG3PB (*(vu16*)0x4000032)
-#define REG_BG3PC (*(vu16*)0x4000034)
-#define REG_BG3PD (*(vu16*)0x4000036)
-
-#define REG_BG3X (*(vu32*)0x4000038)
-#define REG_BG3X_L (*(vu16*)0x4000038)
-#define REG_BG3X_H (*(vu16*)0x400003A)
-#define REG_BG3Y (*(vu32*)0x400003C)
-#define REG_BG3Y_L (*(vu16*)0x400003C)
-#define REG_BG3Y_H (*(vu16*)0x400003E)
-
-#define REG_WIN0H (*(vu16*)0x4000040)
-#define REG_WIN1H (*(vu16*)0x4000042)
-#define REG_WIN0V (*(vu16*)0x4000044)
-#define REG_WIN1V (*(vu16*)0x4000046)
-#define REG_WININ (*(vu16*)0x4000048)
-#define REG_WINOUT (*(vu16*)0x400004A)
-
-#define REG_MOSAIC (*(vu32*)0x400004C)
-#define REG_MOSAIC_L (*(vu32*)0x400004C)
-#define REG_MOSAIC_H (*(vu32*)0x400004E)
-
-#define REG_BLDMOD (*(vu16*)0x4000050)
-#define REG_COLV (*(vu16*)0x4000052)
-#define REG_COLY (*(vu16*)0x4000054)
-
-#define SERIAL_CR REG_SPICNT
-#define SERIAL_DATA REG_SPIDATA
-#define SIO_CR REG_SIOCNT
-#define R_CR REG_RCNT
-
-#define DISP_CAPTURE REG_DISPCAPCNT
-
-
-/* secondary screen */
-#define REG_DISPCNT_SUB (*(vu32*)0x4001000)
-#define REG_BGCTRL_SUB ( (vu16*)0x4001008)
-#define REG_BG0CNT_SUB (*(vu16*)0x4001008)
-#define REG_BG1CNT_SUB (*(vu16*)0x400100A)
-#define REG_BG2CNT_SUB (*(vu16*)0x400100C)
-#define REG_BG3CNT_SUB (*(vu16*)0x400100E)
-
-#define REG_BGOFFSETS_SUB ( (vu16*)0x4001010)
-#define REG_BG0HOFS_SUB (*(vu16*)0x4001010)
-#define REG_BG0VOFS_SUB (*(vu16*)0x4001012)
-#define REG_BG1HOFS_SUB (*(vu16*)0x4001014)
-#define REG_BG1VOFS_SUB (*(vu16*)0x4001016)
-#define REG_BG2HOFS_SUB (*(vu16*)0x4001018)
-#define REG_BG2VOFS_SUB (*(vu16*)0x400101A)
-#define REG_BG3HOFS_SUB (*(vu16*)0x400101C)
-#define REG_BG3VOFS_SUB (*(vu16*)0x400101E)
-
-#define REG_BG2PA_SUB (*(vu16*)0x4001020)
-#define REG_BG2PB_SUB (*(vu16*)0x4001022)
-#define REG_BG2PC_SUB (*(vu16*)0x4001024)
-#define REG_BG2PD_SUB (*(vu16*)0x4001026)
-
-#define REG_BG2X_SUB (*(vu32*)0x4001028)
-#define REG_BG2Y_SUB (*(vu32*)0x400102C)
-
-#define REG_BG3PA_SUB (*(vu16*)0x4001030)
-#define REG_BG3PB_SUB (*(vu16*)0x4001032)
-#define REG_BG3PC_SUB (*(vu16*)0x4001034)
-#define REG_BG3PD_SUB (*(vu16*)0x4001036)
-
-#define REG_BG3X_SUB (*(vu32*)0x4001038)
-#define REG_BG3X_L_SUB (*(vu16*)0x4001038)
-#define REG_BG3X_H_SUB (*(vu16*)0x400103A)
-#define REG_BG3Y_SUB (*(vu32*)0x400103C)
-#define REG_BG3Y_L_SUB (*(vu16*)0x400103C)
-#define REG_BG3Y_H_SUB (*(vu16*)0x400103E)
-
-#define REG_WIN0H_SUB (*(vu16*)0x4001040)
-#define REG_WIN1H_SUB (*(vu16*)0x4001042)
-#define REG_WIN0V_SUB (*(vu16*)0x4001044)
-#define REG_WIN1V_SUB (*(vu16*)0x4001046)
-#define REG_WININ_SUB (*(vu16*)0x4001048)
-#define REG_WINOUT_SUB (*(vu16*)0x400104A)
-
-#define REG_MOSAIC_SUB (*(vu32*)0x400104C)
-#define REG_MOSAIC_L_SUB (*(vu32*)0x400104C)
-#define REG_MOSAIC_H_SUB (*(vu32*)0x400104E)
-
-#define REG_BLDMOD_SUB (*(vu16*)0x4001050)
-#define REG_COLV_SUB (*(vu16*)0x4001052)
-#define REG_COLY_SUB (*(vu16*)0x4001054)
-
-/*common*/
-#define REG_DMA ( (vu32*)0x40000B0)
-
-#define REG_DMA0SAD (*(vu32*)0x40000B0)
-#define REG_DMA0SAD_L (*(vu16*)0x40000B0)
-#define REG_DMA0SAD_H (*(vu16*)0x40000B2)
-#define REG_DMA0DAD (*(vu32*)0x40000B4)
-#define REG_DMA0DAD_L (*(vu16*)0x40000B4)
-#define REG_DMA0DAD_H (*(vu16*)0x40000B6)
-#define REG_DMA0CNT (*(vu32*)0x40000B8)
-#define REG_DMA0CNT_L (*(vu16*)0x40000B8)
-#define REG_DMA0CNT_H (*(vu16*)0x40000BA)
-
-#define REG_DMA1SAD (*(vu32*)0x40000BC)
-#define REG_DMA1SAD_L (*(vu16*)0x40000BC)
-#define REG_DMA1SAD_H (*(vu16*)0x40000BE)
-#define REG_DMA1DAD (*(vu32*)0x40000C0)
-#define REG_DMA1DAD_L (*(vu16*)0x40000C0)
-#define REG_DMA1DAD_H (*(vu16*)0x40000C2)
-#define REG_DMA1CNT (*(vu32*)0x40000C4)
-#define REG_DMA1CNT_L (*(vu16*)0x40000C4)
-#define REG_DMA1CNT_H (*(vu16*)0x40000C6)
-
-#define REG_DMA2SAD (*(vu32*)0x40000C8)
-#define REG_DMA2SAD_L (*(vu16*)0x40000C8)
-#define REG_DMA2SAD_H (*(vu16*)0x40000CA)
-#define REG_DMA2DAD (*(vu32*)0x40000CC)
-#define REG_DMA2DAD_L (*(vu16*)0x40000CC)
-#define REG_DMA2DAD_H (*(vu16*)0x40000CE)
-#define REG_DMA2CNT (*(vu32*)0x40000D0)
-#define REG_DMA2CNT_L (*(vu16*)0x40000D0)
-#define REG_DMA2CNT_H (*(vu16*)0x40000D2)
-
-#define REG_DMA3SAD (*(vu32*)0x40000D4)
-#define REG_DMA3SAD_L (*(vu16*)0x40000D4)
-#define REG_DMA3SAD_H (*(vu16*)0x40000D6)
-#define REG_DMA3DAD (*(vu32*)0x40000D8)
-#define REG_DMA3DAD_L (*(vu16*)0x40000D8)
-#define REG_DMA3DAD_H (*(vu16*)0x40000DA)
-#define REG_DMA3CNT (*(vu32*)0x40000DC)
-#define REG_DMA3CNT_L (*(vu16*)0x40000DC)
-#define REG_DMA3CNT_H (*(vu16*)0x40000DE)
-
-#define REG_TIME ( (vu16*)0x4000100)
-#define REG_TM0D (*(vu16*)0x4000100)
-#define REG_TM0CNT (*(vu16*)0x4000102)
-#define REG_TM1D (*(vu16*)0x4000106)
-#define REG_TM2D (*(vu16*)0x4000108)
-#define REG_TM2CNT (*(vu16*)0x400010A)
-#define REG_TM3D (*(vu16*)0x400010C)
-#define REG_TM3CNT (*(vu16*)0x400010E)
-
-
-#define REG_SIOCNT (*(vu16*)0x4000128)
-#define REG_SIOMLT_SEND (*(vu16*)0x400012A)
-
-#define KEYS REG_KEYINPUT
-#define KEYS_CR REG_KEYCNT
-//???
-#define REG_RCNT (*(vu16*)0x4000134)
-#define REG_HS_CTRL (*(vu16*)0x4000140)
-
-/* Interupt enable registers */
-#define IE REG_IE
-#define IF REG_IF
-#define IME REG_IME
-
-/*controls power 0x30f is all on */
-#define POWER_CR REG_POWERCNT
-
-/* ram controllers 0x8 is enabled, other bits have to do with mapping */
-#define REG_VRAM_A_CR (*(vu8*) 0x4000240)
-#define REG_VRAM_B_CR (*(vu8*) 0x4000241)
-#define REG_VRAM_C_CR (*(vu8*) 0x4000242)
-#define REG_VRAM_D_CR (*(vu8*) 0x4000243)
-#define REG_VRAM_E_CR (*(vu8*) 0x4000244)
-#define REG_VRAM_F_CR (*(vu8*) 0x4000245)
-#define REG_VRAM_G_CR (*(vu8*) 0x4000246)
-#define REG_VRAM_H_CR (*(vu8*) 0x4000248)
-#define REG_VRAM_I_CR (*(vu8*) 0x4000249)
-#define REG_WRAM_CNT (*(vu8*) 0x4000247)
-
-
-
-
-/*3D graphics suff*/
-#define REG_GFX_FIFO (*(vu32*) 0x4000400)
-#define REG_GFX_STATUS (*(vu32*) 0x4000600)
-#define REG_GFX_CONTROL (*(vu16*) 0x4000060)
-#define REG_COLOR (*(vu32*) 0x4000480)
-#define REG_VERTEX16 (*(vu32*) 0x400048C)
-#define REG_TEXT_COORD (*(vu32*) 0x4000488)
-#define REG_TEXT_FORMAT (*(vu32*) 0x40004A8)
-
-
-#define REG_CLEAR_COLOR (*(vu32*) 0x4000350)
-#define REG_CLEAR_DEPTH (*(vu16*) 0x4000354)
-
-#define REG_LIGHT_VECTOR (*(vu32*) 0x40004C8)
-#define REG_LIGHT_COLOR (*(vu32*) 0x40004CC)
-#define REG_NORMAL (*(vu32*) 0x4000484)
-
-#define REG_DIFFUSE_AMBIENT (*(vu32*) 0x40004C0)
-#define REG_SPECULAR_EMISSION (*(vu32*) 0x40004C4)
-#define REG_SHININESS (*(vu32*) 0x40004D0)
-
-#define REG_POLY_FORMAT (*(vu32*) 0x40004A4)
-
-#define REG_GFX_BEGIN (*(vu32*) 0x4000500)
-#define REG_GFX_END (*(vu32*) 0x4000504)
-#define REG_GFX_FLUSH (*(vu32*) 0x4000540)
-#define REG_GFX_VIEWPORT (*(vu32*) 0x4000580)
-
-#define REG_MTX_CONTROL (*(vu32*) 0x4000440)
-#define REG_MTX_PUSH (*(vu32*) 0x4000444)
-#define REG_MTX_POP (*(vu32*) 0x4000448)
-#define REG_MTX_SCALE (*(vint32*) 0x400046C)
-#define REG_MTX_TRANSLATE (*(vint32*) 0x4000470)
-#define REG_MTX_RESTORE (*(vu32*) 0x4000450)
-#define REG_MTX_STORE (*(vu32*) 0x400044C)
-#define REG_MTX_IDENTITY (*(vu32*) 0x4000454)
-#define REG_MTX_LOAD4x4 (*(volatile f32*) 0x4000458)
-#define REG_MTX_LOAD4x3 (*(volatile f32*) 0x400045C)
-#define REG_MTX_MULT4x4 (*(volatile f32*) 0x4000460)
-#define REG_MTX_MULT4x3 (*(volatile f32*) 0x4000464)
-#define REG_MTX_MULT3x3 (*(volatile f32*) 0x4000468)
-
-// Card bus
-
-#define REG_CARD_CR1 (*(vu32*)0x040001A0)
-#define REG_CARD_CR1H (*(vu8*)0x040001A1)
-#define REG_CARD_CR2 (*(vu32*)0x040001A4)
-#define REG_CARD_COMMAND ((vu8*)0x040001A8)
-
-#define REG_CARD_DATA (*(vu32*)0x04100000)
-#define REG_CARD_DATA_RD (*(vu32*)0x04100010)
-
-#define REG_CARD_1B0 (*(vu32*)0x040001B0)
-#define REG_CARD_1B4 (*(vu32*)0x040001B4)
-#define REG_CARD_1B8 (*(vu16*)0x040001B8)
-#define REG_CARD_1BA (*(vu16*)0x040001BA)
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/reload.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/reload.h
deleted file mode 100644
index c95ae3aaa4..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/reload.h
+++ /dev/null
@@ -1,79 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-// reload.h -- Provides an ability to return to the main menu when used
-// with darkains loader or compatible system.
-//
-// Contributed by Darkain
-//
-// version 0.1, June 5, 2005
-//
-// Copyright (C) 2005 Michael Noland (joat) and Jason Rogers (dovoto)
-//
-// This software is provided 'as-is', without any express or implied
-// warranty. In no event will the authors be held liable for any
-// damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any
-// purpose, including commercial applications, and to alter it and
-// redistribute it freely, subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented; you
-// must not claim that you wrote the original software. If you use
-// this software in a product, an acknowledgment in the product
-// documentation would be appreciated but is not required.
-// 2. Altered source versions must be plainly marked as such, and
-// must not be misrepresented as being the original software.
-// 3. This notice may not be removed or altered from any source
-// distribution.
-//
-// Changelog:
-// 0.1: First version
-//
-//////////////////////////////////////////////////////////////////////
-
-
-#ifndef _NDS_LOAD_H_
-#define _NDS_LOAD_H_
-
-
-typedef void __attribute__ ((long_call)) (*COPYFUNC)(const char*);
-typedef u32 __attribute__ ((long_call)) (*QUERYFUNC)(u32);
-
-typedef struct {
- u32 VERSION; // contains version information about loader
- QUERYFUNC QUERY; // used to retreive extended information from loader
- COPYFUNC ARM7FUNC; // a pointer to the ARM7 load function
- COPYFUNC ARM9FUNC; // a pointer to the ARM9 load function
- const char *PATH; // THIS VALUE IS SET FOR YOU, DONT TOUCH IT
- u32 RESERVED; // reserved for future expansion
-} LOADER_DATA;
-
-#define LOADNDS ((volatile LOADER_DATA*)(0x02800000-48))
-#define BOOT_NDS ((const char*)-1)
-
-
-
-/*
-dump this near the begining of your ARM7's main function
-
-LOADNDS->PATH = 0;
-
-
-inside of your ARM7's main loop or VBlank IRQ or what-ever, add this code:
-
-if (LOADNDS->PATH != 0) {
- LOADNDS->ARM7FUNC(LOADNDS->PATH);
-}
-
-
-//////////////////////////////////////
-
-in your ARM9 code, to return to the menu, call this function:
-
-WAIT_CR &= ~0x8080;
-LOADNDS->ARM9FUNC(BOOT_NDS);
-
-*/
-
-
-#endif //_NDS_LOAD_H_
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/system.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/system.h
deleted file mode 100644
index 8e4e5b5920..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/system.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*---------------------------------------------------------------------------------
- Power control, keys, and HV clock registers
-
- Copyright (C) 2005
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-//! NDS hardware definitions.
-/*! \file system.h
-
- These definitions are usually only touched during
- the initialization of the program.
-*/
-
-#ifndef NDS_SYSTEM_INCLUDE
-#define NDS_SYSTEM_INCLUDE
-
-//! LCD status register.
-#define REG_DISPSTAT (*(vu16*)0x04000004)
-
-//! The display currently in a vertical blank.
-#define DISP_IN_VBLANK BIT(0)
-
-//! The display currently in a horizontal blank.
-#define DISP_IN_HBLANK BIT(1)
-
-//! Current scanline and %DISP_Y match.
-#define DISP_YTRIGGERED BIT(2)
-
-//! Interrupt on vertical blank.
-#define DISP_VBLANK_IRQ BIT(3)
-
-//! Interrupt on horizontal blank.
-#define DISP_HBLANK_IRQ BIT(4)
-
-//! Interrupt when current scanline and %DISP_Y match.
-#define DISP_YTRIGGER_IRQ BIT(5)
-
-static inline
-void SetYtrigger(int Yvalue) {
- REG_DISPSTAT = (REG_DISPSTAT & 0x007F ) | (Yvalue << 8) | (( Yvalue & 0x100 ) >> 2) ;
-}
-
-//! Current display scanline.
-#define REG_VCOUNT (*(vu16*)0x4000006)
-
-
-//! Halt control register.
-/*! Writing 0x40 to HALT_CR activates GBA mode.
- %HALT_CR can only be accessed via the BIOS.
-*/
-#define HALT_CR (*(vuint16*)0x04000300)
-
-//! Power control register.
-/*! This register controls what hardware should
- be turned on or off.
-*/
-#define REG_POWERCNT *(vu16*)0x4000304
-
-//! Turns on specified hardware.
-/*! This function should only be called after %powerSET.
-
- \param on What to power on.
-*/
-static inline
-void powerON(int on) { REG_POWERCNT |= on;}
-
-//! Turns on only the specified hardware.
-/*! Use this function to power on basic hardware types you
- wish to use throughout your program.
-
- \param on What to power on.
-*/
-static inline void powerSET(int on) { REG_POWERCNT = on;}
-
-//! Turns off the specified hardware.
-/*! \param off What to power off.
-*/
-static inline void powerOFF(int off) { REG_POWERCNT &= ~off;}
-
-#ifdef ARM9
-#ifdef DOXYGEN
-//! Power-controlled hardware devices accessable to the ARM9.
-/*! Used with %powerON, %powerSET, and %powerOFF functions.
- Note that these should only be used when programming for
- the ARM9. Trying to boot up these hardware devices via
- the ARM7 would lead to unexpected results.
-*/
-enum ARM9_power
-{
- POWER_LCD, //!< Controls the power for both LCD screens.
- POWER_2D_A, //!< Controls the power for the main 2D core.
- POWER_MATRIX, //!< Controls the power for the 3D matrix.
- POWER_3D_CORE, //!< Controls the power for the main 3D core.
- POWER_2D_B, //!< Controls the power for the sub 2D core.
- POWER_SWAP_LCDS, //!< Controls which screen should use the main core.
-};
-#else
-#define POWER_LCD BIT(0)
-#define POWER_2D_A BIT(1)
-#define POWER_MATRIX BIT(2)
-#define POWER_3D_CORE BIT(3)
-#define POWER_2D_B BIT(9)
-#define POWER_SWAP_LCDS BIT(15)
-#endif /* DOXYGEN */
-
-//! Enables power to all hardware required for 2D video.
-#define POWER_ALL_2D (POWER_LCD |POWER_2D_A |POWER_2D_B)
-
-//! Enables power to all hardware required for 3D video.
-#define POWER_ALL (POWER_ALL_2D | POWER_3D_CORE | POWER_MATRIX)
-
-//! Switches the screens.
-static inline void lcdSwap(void) { REG_POWERCNT ^= POWER_SWAP_LCDS; }
-
-//! Forces the main core to display on the top.
-static inline void lcdMainOnTop(void) { REG_POWERCNT |= POWER_SWAP_LCDS; }
-
-//! Forces the main core to display on the bottom.
-static inline void lcdMainOnBottom(void) { REG_POWERCNT &= ~POWER_SWAP_LCDS; }
-#endif
-
-#ifdef ARM7
-#ifdef DOXYGEN
-//! Power-controlled hardware devices accessable to the ARM7.
-/*! Note that these should only be used when programming for
- the ARM7. Trying to boot up these hardware devices via
- the ARM9 would lead to unexpected results.
-*/
-enum ARM7_power
-{
- POWER_SOUND, //!< Controls the power for the sound controller.
- POWER_UNKNOWN, //!< Controls the power for an unknown device.
-};
-#else
-#define POWER_SOUND BIT(0)
-#define POWER_UNKNOWN BIT(1)
-#endif /* DOXYGEN */
-
-void readUserSettings(void);
-
-#endif /* ARM7 */
-
-//! User's DS settings.
-/*! \struct tPERSONAL_DATA
-
- Defines the structure the DS firmware uses for transfer
- of the user's settings to the booted program.
-*/
-typedef struct tPERSONAL_DATA {
- u8 RESERVED0[2]; //!< ??? (0x05 0x00).
-
- u8 theme; //!< The user's theme color (0-15).
- u8 birthMonth; //!< The user's birth month (1-12).
- u8 birthDay; //!< The user's birth day (1-31).
-
- u8 RESERVED1[1]; //!< ???
-
- s16 name[10]; //!< The user's name in UTF-16 format.
- u16 nameLen; //!< The length of the user's name in characters.
-
- s16 message[26]; //!< The user's message.
- u16 messageLen; //!< The length of the user's message in characters.
-
- u8 alarmHour; //!< What hour the alarm clock is set to (0-23).
- u8 alarmMinute; //!< What minute the alarm clock is set to (0-59).
- //0x027FFCD3 alarm minute
-
- u8 RESERVED2[4]; //!< ???
- //0x027FFCD4 ??
-
- u16 calX1; //!< Touchscreen calibration: first X touch
- u16 calY1; //!< Touchscreen calibration: first Y touch
- u8 calX1px; //!< Touchscreen calibration: first X touch pixel
- u8 calY1px; //!< Touchscreen calibration: first X touch pixel
-
- u16 calX2; //!< Touchscreen calibration: second X touch
- u16 calY2; //!< Touchscreen calibration: second Y touch
- u8 calX2px; //!< Touchscreen calibration: second X touch pixel
- u8 calY2px; //!< Touchscreen calibration: second Y touch pixel
-
- packed_struct {
- unsigned language : 3; //!< User's language.
- unsigned gbaScreen : 1; //!< GBA screen selection (lower screen if set, otherwise upper screen).
- unsigned defaultBrightness : 2; //!< Brightness level at power on, dslite.
- unsigned autoMode : 1; //!< The DS should boot from the DS cart or GBA cart automatically if one is inserted.
- unsigned RESERVED1 : 2; //!< ???
- unsigned settingsLost : 1; //!< User Settings Lost (0=Normal, 1=Prompt/Settings Lost)
- unsigned RESERVED2 : 6; //!< ???
- } _user_data;
-
- u16 RESERVED3;
- u32 rtcOffset;
- u32 RESERVED4;
-} PACKED PERSONAL_DATA ;
-
-//! Key input register.
-/*! On the ARM9, the hinge "button," the touch status, and the
- X and Y buttons cannot be accessed directly.
-*/
-#define REG_KEYINPUT (*(vuint16*)0x04000130)
-
-//! Key input control register.
-#define REG_KEYCNT (*(vuint16*)0x04000132)
-
-//! Default location for the user's personal data (see %PERSONAL_DATA).
-#define PersonalData ((PERSONAL_DATA*)0x27FFC80)
-
-//! argv structure
-/*! \struct __argv
-
- structure used to set up argc/argv on the DS
-
-*/
-struct __argv {
- int argvMagic; //!< argv magic number, set to 0x5f617267 ('_arg') if valid
- char *commandLine; //!< base address of command line, set of null terminated strings
- int length; //!< total length of command line
-};
-
-//! Default location for the libnds argv structure.
-#define libnds_argv ((struct __argv *)0x027FFF70)
-
-// argv struct magic number
-#define argvMagic 0x5f617267
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h
deleted file mode 100644
index 12f94b582a..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-
-/*! \file timers.h
- \brief Contains defines and macros for ARM7 and ARM9 timer operation.
-
- The timers are fed with a 33.4 MHz source on the ARM9. The ARM7
- timing hasn't been tested yet, but is likely to be the same.
-*/
-
-//---------------------------------------------------------------------------------
-#ifndef NDS_TIMERS_INCLUDE
-#define NDS_TIMERS_INCLUDE
-//---------------------------------------------------------------------------------
-
-
-//---------------------------------------------------------------------------------
-#ifdef __cplusplus
-extern "C" {
-#endif
-//---------------------------------------------------------------------------------
-
-
-#include <nds/jtypes.h>
-
-// Timers
-
-//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
-/*! Use the appropriate macro depending on clock divider: \n
- <ul>
- <li> %TIMER_FREQ(f) </li>
- <li> %TIMER_FREQ_64(f) </li>
- <li> %TIMER_FREQ_256(f) </li>
- <li> %TIMER_FREQ_1024(f) </li>
- </ul>
- Clock divider is controlled by %TIMER_CR(n) \n
- \n
- <b>Example Usage:</b>
-
- %TIMER_DATA(0) = %TIMER_FREQ(freq_in_hz); \n
- %TIMER_CR(0) = %TIMER_DIV1 | %TIMER_ENABLE; \n
- \n
- Max frequency is: 33554432Hz\n
- Min frequency is: 512Hz\n
-*/
-#define TIMER_FREQ(n) (-0x2000000/(n))
-
-//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
-/*! Use the appropriate macro depending on clock divider: \n
- <ul>
- <li> %TIMER_FREQ(f) </li>
- <li> %TIMER_FREQ_64(f) </li>
- <li> %TIMER_FREQ_256(f) </li>
- <li> %TIMER_FREQ_1024(f) </li>
- </ul>
-
-
- Clock divider is controlled by %TIMER_CR(n) \n
- \n
- <b>Example Usage:</b>
- %TIMER_DATA(x) = %TIMER_FREQ_64(freq_in_hz)\n
- \n
- Max frequency is: 524288Hz\n
- Min frequency is: 8Hz\n
-*/
-#define TIMER_FREQ_64(n) (-(0x2000000>>6)/(n))
-
-//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
-/*! Use the appropriate macro depending on clock divider: \n
- <ul>
- <li> %TIMER_FREQ(f) </li>
- <li> %TIMER_FREQ_64(f) </li>
- <li> %TIMER_FREQ_256(f) </li>
- <li> %TIMER_FREQ_1024(f) </li>
- </ul> <p>
-
- Clock divider is controlled by %TIMER_CR(n) \n
- \n
- <b>Example Usage:</b>
- %TIMER_DATA(x) = %TIMER_FREQ_256(freq_in_hz)\n
- \n
- Max frequency is: 131072Hz\n
- Min frequency is: 2Hz\n
-*/
-#define TIMER_FREQ_256(n) (-(0x2000000>>8)/(n))
-
-//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
-/*! Use the appropriate macro depending on clock divider: \n
- <ul>
- <li> %TIMER_FREQ(f) </li>
- <li> %TIMER_FREQ_64(f) </li>
- <li> %TIMER_FREQ_256(f) </li>
- <li> TIMER_FREQ_1024(f) </li>
- </ul>
-
- Clock divider is controlled by %TIMER_CR(n) \n
- \n
- <b>Example Usage:</b>
- %TIMER_DATA(x) = %TIMER_FREQ_1024(freq_in_hz)\n
- \n
- Max frequency is: 32768Hz\n
- Min frequency is: 0.5Hz\n
-*/
-#define TIMER_FREQ_1024(n) (-(0x2000000>>10)/(n))
-
-
-//! Same as %TIMER_DATA(0).
-#define TIMER0_DATA (*(vuint16*)0x04000100)
-//! Same as %TIMER_DATA(1).
-#define TIMER1_DATA (*(vuint16*)0x04000104)
-//! Same as %TIMER_DATA(2).
-#define TIMER2_DATA (*(vuint16*)0x04000108)
-//! Same as %TIMER_DATA(3).
-#define TIMER3_DATA (*(vuint16*)0x0400010C)
-
-//! Returns a dereferenced pointer to the data register for timer number "n".
-/*! \see TIMER_CR(n)
- \see TIMER_FREQ(n)
-
- %TIMER_DATA(n) when set will latch that value into the counter. Everytime the
- counter rolls over %TIMER_DATA(0) will return to the latched value. This allows
- you to control the frequency of the timer using the following formula:\n
- %TIMER_DATA(x) = -(0x2000000/(freq * divider)); \n
- \n
- <b>Example Usage:</b>
- %TIMER_DATA(0) = value; were 0 can be 0 through 3 and value is 16 bits.
-*/
-#define TIMER_DATA(n) (*(vuint16*)(0x04000100+((n)<<2)))
-
-// Timer control registers
-//! Same as %TIMER_CR(0).
-#define TIMER0_CR (*(vuint16*)0x04000102)
-//! Same as %TIMER_CR(1).
-#define TIMER1_CR (*(vuint16*)0x04000106)
-//! Same as %TIMER_CR(2).
-#define TIMER2_CR (*(vuint16*)0x0400010A)
-//! Same as %TIMER_CR(3).
-#define TIMER3_CR (*(vuint16*)0x0400010E)
-
-//! Returns a dereferenced pointer to the data register for timer control Register.
-/*! <b>Example Usage:</b> %TIMER_CR(x) = %TIMER_ENABLE | %TIMER_DIV_64; \n
- \n
- Possible bit defines: \n
-
- \see TIMER_ENABLE
- \see TIMER_IRQ_REQ
- \see TIMER_DIV_1
- \see TIMER_DIV_64
- \see TIMER_DIV_256
- \see TIMER_DIV_1024
-*/
-#define TIMER_CR(n) (*(vuint16*)(0x04000102+((n)<<2)))
-
-//! Enables the timer.
-#define TIMER_ENABLE (1<<7)
-
-//! Causes the timer to request an Interupt on overflow.
-#define TIMER_IRQ_REQ (1<<6)
-
-//! When set will cause the timer to count when the timer below overflows (unavailable for timer 0).
-#define TIMER_CASCADE (1<<2)
-
-//! Causes the timer to count at 33.514Mhz.
-#define TIMER_DIV_1 (0)
-//! Causes the timer to count at (33.514 / 64) Mhz.
-#define TIMER_DIV_64 (1)
-//! Causes the timer to count at (33.514 / 256) Mhz.
-#define TIMER_DIV_256 (2)
-//! Causes the timer to count at (33.514 / 1024)Mhz.
-#define TIMER_DIV_1024 (3)
-
-//---------------------------------------------------------------------------------
-#ifdef __cplusplus
-}
-#endif
-//---------------------------------------------------------------------------------
-
-//---------------------------------------------------------------------------------
-#endif
-//---------------------------------------------------------------------------------
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/libnds_license.txt b/c/src/lib/libbsp/arm/nds/libnds/libnds_license.txt
deleted file mode 100644
index ed1a562f50..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/libnds_license.txt
+++ /dev/null
@@ -1,18 +0,0 @@
- Copyright (C) 2005 Michael Noland (joat) and Jason Rogers (dovoto)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/audio.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/audio.c
deleted file mode 100644
index 7fc380f9ef..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/audio.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include "nds/arm7/audio.h"
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/clock.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/clock.c
deleted file mode 100644
index bd75197d6b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/clock.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (Joat)
- Jason Rogers (Dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include "nds/bios.h"
-#include "nds/arm7/clock.h"
-#include "nds/interrupts.h"
-#include "nds/ipc.h"
-
-#include <time.h>
-
-/*
- * forward declaration to avoid warning
- */
-void syncRTC(void);
-
-// Delay (in swiDelay units) for each bit transfer
-#define RTC_DELAY 48
-
-// Pin defines on RTC_CR
-#define CS_0 (1<<6)
-#define CS_1 ((1<<6) | (1<<2))
-#define SCK_0 (1<<5)
-#define SCK_1 ((1<<5) | (1<<1))
-#define SIO_0 (1<<4)
-#define SIO_1 ((1<<4) | (1<<0))
-#define SIO_out (1<<4)
-#define SIO_in (1)
-
-//---------------------------------------------------------------------------------
-void BCDToInteger(uint8 * data, uint32 length) {
-//---------------------------------------------------------------------------------
- u32 i;
- for (i = 0; i < length; i++) {
- data[i] = (data[i] & 0xF) + ((data[i] & 0xF0)>>4)*10;
- }
-}
-
-
-//---------------------------------------------------------------------------------
-void integerToBCD(uint8 * data, uint32 length) {
-//---------------------------------------------------------------------------------
- u32 i;
- for (i = 0; i < length; i++) {
- int high, low;
- swiDivMod(data[i], 10, &high, &low);
- data[i] = (high<<4) | low;
- }
-}
-
-//---------------------------------------------------------------------------------
-void rtcTransaction(uint8 * command, uint32 commandLength, uint8 * result, uint32 resultLength) {
-//---------------------------------------------------------------------------------
- uint32 bit;
- uint8 data;
-
- // Raise CS
- RTC_CR8 = CS_0 | SCK_1 | SIO_1;
- swiDelay(RTC_DELAY);
- RTC_CR8 = CS_1 | SCK_1 | SIO_1;
- swiDelay(RTC_DELAY);
-
- // Write command byte (high bit first)
- data = *command++;
-
- for (bit = 0; bit < 8; bit++) {
- RTC_CR8 = CS_1 | SCK_0 | SIO_out | (data>>7);
- swiDelay(RTC_DELAY);
-
- RTC_CR8 = CS_1 | SCK_1 | SIO_out | (data>>7);
- swiDelay(RTC_DELAY);
-
- data = data << 1;
- }
- // Write parameter bytes (low bit first)
- for ( ; commandLength > 1; commandLength--) {
- data = *command++;
-
- for (bit = 0; bit < 8; bit++) {
- RTC_CR8 = CS_1 | SCK_0 | SIO_out | (data & 1);
- swiDelay(RTC_DELAY);
-
- RTC_CR8 = CS_1 | SCK_1 | SIO_out | (data & 1);
- swiDelay(RTC_DELAY);
-
- data = data >> 1;
- }
- }
-
- // Read result bytes (low bit first)
- for ( ; resultLength > 0; resultLength--) {
- data = 0;
-
- for (bit = 0; bit < 8; bit++) {
- RTC_CR8 = CS_1 | SCK_0;
- swiDelay(RTC_DELAY);
-
- RTC_CR8 = CS_1 | SCK_1;
- swiDelay(RTC_DELAY);
-
- if (RTC_CR8 & SIO_in) data |= (1 << bit);
- }
- *result++ = data;
- }
-
- // Finish up by dropping CS low
- RTC_CR8 = CS_0 | SCK_1;
- swiDelay(RTC_DELAY);
-}
-
-
-//---------------------------------------------------------------------------------
-void rtcReset(void) {
-//---------------------------------------------------------------------------------
- uint8 status;
- uint8 command[2];
-
- // Read the first status register
- command[0] = READ_STATUS_REG1;
- rtcTransaction(command, 1, &status, 1);
-
- // Reset the RTC if needed
- if (status & (STATUS_POC | STATUS_BLD)) {
- command[0] = WRITE_STATUS_REG1;
- command[1] = status | STATUS_RESET;
- rtcTransaction(command, 2, 0, 0);
- }
-}
-
-
-//---------------------------------------------------------------------------------
-void rtcGetTimeAndDate(uint8 * time) {
-//---------------------------------------------------------------------------------
- uint8 command, status;
-
- command = READ_TIME_AND_DATE;
- rtcTransaction(&command, 1, time, 7);
-
- command = READ_STATUS_REG1;
- rtcTransaction(&command, 1, &status, 1);
-
- if ( status & STATUS_24HRS ) {
- time[4] &= 0x3f;
- } else {
-
- }
- BCDToInteger(time,7);
-}
-
-//---------------------------------------------------------------------------------
-void rtcSetTimeAndDate(uint8 * time) {
-//---------------------------------------------------------------------------------
- uint8 command[8 + 1];
-
- int i;
- for ( i=0; i< 8; i++ ) {
- command[i+1] = time[i];
- }
- command[0] = WRITE_TIME_AND_DATE;
- // fixme: range checking on the data we tell it
- rtcTransaction(command, 8, 0, 0);
-}
-
-//---------------------------------------------------------------------------------
-void rtcGetTime(uint8 * time) {
-//---------------------------------------------------------------------------------
- uint8 command, status;
-
- command = READ_TIME;
- rtcTransaction(&command, 1, time, 3);
-
- command = READ_STATUS_REG1;
- rtcTransaction(&command, 1, &status, 1);
- if ( status & STATUS_24HRS ) {
- time[0] &= 0x3f;
- } else {
-
- }
- BCDToInteger(time,3);
-
-}
-
-//---------------------------------------------------------------------------------
-void rtcSetTime(uint8 * time) {
-//---------------------------------------------------------------------------------
- uint8 command[4];
-
- int i;
- for ( i=0; i< 3; i++ ) {
- command[i+1] = time[i];
- }
- command[0] = WRITE_TIME;
- // fixme: range checking on the data we tell it
- rtcTransaction(command, 4, 0, 0);
-}
-
-//---------------------------------------------------------------------------------
-void syncRTC(void) {
-//---------------------------------------------------------------------------------
- if (++IPC->time.rtc.seconds == 60 ) {
- IPC->time.rtc.seconds = 0;
- if (++IPC->time.rtc.minutes == 60) {
- IPC->time.rtc.minutes = 0;
- if (++IPC->time.rtc.hours == 24) {
- rtcGetTimeAndDate((uint8 *)&(IPC->time.rtc.year));
- }
- }
- }
-
- IPC->unixTime++;
-}
-
-//---------------------------------------------------------------------------------
-void initClockIRQ() {
-//---------------------------------------------------------------------------------
-
- REG_RCNT = 0x8100;
- irqSet(IRQ_NETWORK, syncRTC);
- // Reset the clock if needed
- rtcReset();
-
- uint8 command[4];
- command[0] = READ_STATUS_REG2;
- rtcTransaction(command, 1, &command[1], 1);
-
- command[0] = WRITE_STATUS_REG2;
- command[1] = 0x41;
- rtcTransaction(command, 2, 0, 0);
-
- command[0] = WRITE_INT_REG1;
- command[1] = 0x01;
- rtcTransaction(command, 2, 0, 0);
-
- command[0] = WRITE_INT_REG2;
- command[1] = 0x00;
- command[2] = 0x21;
- command[3] = 0x35;
- rtcTransaction(command, 4, 0, 0);
-
- // Read all time settings on first start
- rtcGetTimeAndDate((uint8 *)&(IPC->time.rtc.year));
-
-
- struct tm currentTime;
-
- currentTime.tm_sec = IPC->time.rtc.seconds;
- currentTime.tm_min = IPC->time.rtc.minutes;
- currentTime.tm_hour = IPC->time.rtc.hours;
-
- currentTime.tm_mday = IPC->time.rtc.day;
- currentTime.tm_mon = IPC->time.rtc.month - 1;
- currentTime.tm_year = IPC->time.rtc.year + 100;
-
- currentTime.tm_isdst = -1;
-
- IPC->unixTime = mktime(&currentTime);
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/microphone.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/microphone.c
deleted file mode 100644
index bec98fdc22..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/microphone.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*---------------------------------------------------------------------------------
- Microphone control for the ARM7
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Chris Double (doublec)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#include <nds/arm7/audio.h>
-#include <nds/timers.h>
-
-//---------------------------------------------------------------------------------
-// Turn on the Microphone Amp. Code based on neimod's example.
-//---------------------------------------------------------------------------------
-void PM_SetAmp(u8 control) {
-//---------------------------------------------------------------------------------
- SerialWaitBusy();
- REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz | SPI_CONTINUOUS;
- REG_SPIDATA = PM_AMP_OFFSET;
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz;
- REG_SPIDATA = control;
-}
-
-//---------------------------------------------------------------------------------
-// Read a byte from the microphone. Code based on neimod's example.
-//---------------------------------------------------------------------------------
-u8 MIC_ReadData() {
-//---------------------------------------------------------------------------------
- u16 result, result2;
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_DEVICE_MICROPHONE | SPI_BAUD_2MHz | SPI_CONTINUOUS;
- REG_SPIDATA = 0xEC; // Touchscreen command format for AUX
-
- SerialWaitBusy();
-
- REG_SPIDATA = 0x00;
-
- SerialWaitBusy();
-
- result = REG_SPIDATA;
- REG_SPICNT = SPI_ENABLE | SPI_DEVICE_TOUCH | SPI_BAUD_2MHz;
- REG_SPIDATA = 0x00;
-
- SerialWaitBusy();
-
- result2 = REG_SPIDATA;
-
- return (((result & 0x7F) << 1) | ((result2>>7)&1));
-}
-
-static u8* microphone_buffer = 0;
-static int microphone_buffer_length = 0;
-static int current_length = 0;
-
-
-//---------------------------------------------------------------------------------
-void StartRecording(u8* buffer, int length) {
-//---------------------------------------------------------------------------------
- microphone_buffer = buffer;
- microphone_buffer_length = length;
- current_length = 0;
-
- MIC_On();
-
- // Setup a 16kHz timer
- TIMER0_DATA = 0xF7CF;
- TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ;
-}
-
-//---------------------------------------------------------------------------------
-int StopRecording() {
-//---------------------------------------------------------------------------------
- TIMER0_CR &= ~TIMER_ENABLE;
- MIC_Off();
- microphone_buffer = 0;
- return current_length;
-}
-
-//---------------------------------------------------------------------------------
-void ProcessMicrophoneTimerIRQ() {
-//---------------------------------------------------------------------------------
- if(microphone_buffer && microphone_buffer_length > 0) {
- // Read data from the microphone. Data from the Mic is unsigned, flipping
- // the highest bit makes it signed.
- *microphone_buffer++ = MIC_ReadData() ^ 0x80;
- --microphone_buffer_length;
- current_length++;
- }
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/spi.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/spi.c
deleted file mode 100644
index f7f9a312cf..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/spi.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- Copyright (C) 2005
- Michael Noland (joat)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include <nds/arm7/serial.h>
-
-
-//---------------------------------------------------------------------------------
-int writePowerManagement(int reg, int command) {
-//---------------------------------------------------------------------------------
- // Write the register / access mode (bit 7 sets access mode)
- while (REG_SPICNT & SPI_BUSY);
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHZ | SPI_BYTE_MODE | SPI_CONTINUOUS | SPI_DEVICE_POWER;
- REG_SPIDATA = reg;
-
- // Write the command / start a read
- while (REG_SPICNT & SPI_BUSY);
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHZ | SPI_BYTE_MODE | SPI_DEVICE_POWER;
- REG_SPIDATA = command;
-
- // Read the result
- while (REG_SPICNT & SPI_BUSY);
- return REG_SPIDATA & 0xFF;
-}
-
-
-//---------------------------------------------------------------------------------
-void readFirmware(uint32 address, void * destination, uint32 size) {
-//---------------------------------------------------------------------------------
- uint8 * buffer = (uint8 *)destination;
-
- // Read command
- while (REG_SPICNT & SPI_BUSY);
- REG_SPICNT = SPI_ENABLE | SPI_BYTE_MODE | SPI_CONTINUOUS | SPI_DEVICE_FIRMWARE;
- REG_SPIDATA = FIRMWARE_READ;
- while (REG_SPICNT & SPI_BUSY);
-
- // Set the address
- REG_SPIDATA = (address>>16) & 0xFF;
- while (REG_SPICNT & SPI_BUSY);
- REG_SPIDATA = (address>>8) & 0xFF;
- while (REG_SPICNT & SPI_BUSY);
- REG_SPIDATA = (address>>0) & 0xFF;
- while (REG_SPICNT & SPI_BUSY);
-
- // Read the data
- while (size--) {
- REG_SPIDATA = 0;
- while (REG_SPICNT & SPI_BUSY);
- *buffer++ = (REG_SPIDATA & 0xFF);
- }
-
- REG_SPICNT = 0;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c
deleted file mode 100644
index 65de47ef6b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*---------------------------------------------------------------------------------
- Touch screen control for the ARM7
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include <nds/jtypes.h>
-#include <nds/system.h>
-#include <nds/arm7/touch.h>
-#include <nds/interrupts.h>
-
-#include <stdlib.h>
-
-static u8 last_time_touched = 0;
-
-static u8 range_counter_1 = 0;
-static u8 range_counter_2 = 0;
-static u8 range = 20;
-static u8 min_range = 20;
-
-//---------------------------------------------------------------------------------
-static u8 CheckStylus(void){
-//---------------------------------------------------------------------------------
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH | SPI_CONTINUOUS; //0x8A01;
- REG_SPIDATA = TSC_MEASURE_TEMP1;
-
- SerialWaitBusy();
-
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH;// 0x8201;
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
-
- if(last_time_touched == 1){
- if( !(REG_KEYXY & 0x40) )
- return 1;
- else{
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH | SPI_CONTINUOUS;
- REG_SPIDATA = TSC_MEASURE_TEMP1;
-
- SerialWaitBusy();
-
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH;
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
-
- return !(REG_KEYXY & 0x40) ? 2 : 0;
- }
- }else{
- return !(REG_KEYXY & 0x40) ? 1 : 0;
- }
-}
-
-//---------------------------------------------------------------------------------
-uint16 touchRead(uint32 command) {
-//---------------------------------------------------------------------------------
- uint16 result, result2;
-
- uint32 oldIME = REG_IME;
-
- REG_IME = 0;
-
- SerialWaitBusy();
-
- // Write the command and wait for it to complete
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH | SPI_CONTINUOUS; //0x8A01;
- REG_SPIDATA = command;
- SerialWaitBusy();
-
- // Write the second command and clock in part of the data
- REG_SPIDATA = 0;
- SerialWaitBusy();
- result = REG_SPIDATA;
-
- // Clock in the rest of the data (last transfer)
- REG_SPICNT = SPI_ENABLE | 0x201;
- REG_SPIDATA = 0;
- SerialWaitBusy();
-
- result2 = REG_SPIDATA >>3;
-
- REG_IME = oldIME;
-
- // Return the result
- return ((result & 0x7F) << 5) | result2;
-}
-
-
-//---------------------------------------------------------------------------------
-uint32 touchReadTemperature(int * t1, int * t2) {
-//---------------------------------------------------------------------------------
- *t1 = touchRead(TSC_MEASURE_TEMP1);
- *t2 = touchRead(TSC_MEASURE_TEMP2);
- return 8490 * (*t2 - *t1) - 273*4096;
-}
-
-
-static bool touchInit = false;
-static s32 xscale, yscale;
-static s32 xoffset, yoffset;
-
-//---------------------------------------------------------------------------------
-static int16 readTouchValue(uint32 command, int16 *dist_max, u8 *err){
-//---------------------------------------------------------------------------------
- int16 values[5];
- int32 aux1, aux2, aux3, dist, dist2, result = 0;
- u8 i, j, k;
-
- *err = 1;
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH | SPI_CONTINUOUS;
- REG_SPIDATA = command;
-
- SerialWaitBusy();
-
- for(i=0; i<5; i++){
- REG_SPIDATA = 0;
- SerialWaitBusy();
-
- aux1 = REG_SPIDATA;
- aux1 = aux1 & 0xFF;
- aux1 = aux1 << 16;
- aux1 = aux1 >> 8;
-
- values[4-i] = aux1;
-
- REG_SPIDATA = command;
- SerialWaitBusy();
-
- aux1 = REG_SPIDATA;
- aux1 = aux1 & 0xFF;
- aux1 = aux1 << 16;
-
- aux1 = values[4-i] | (aux1 >> 16);
- values[4-i] = ((aux1 & 0x7FF8) >> 3);
- }
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH;
- REG_SPIDATA = 0;
- SerialWaitBusy();
-
- dist = 0;
- for(i=0; i<4; i++){
- aux1 = values[i];
-
- for(j=i+1; j<5; j++){
- aux2 = values[j];
- aux2 = abs(aux1 - aux2);
- if(aux2>dist) dist = aux2;
- }
- }
-
- *dist_max = dist;
-
- for(i=0; i<3; i++){
- aux1 = values[i];
-
- for(j=i+1; j<4; j++){
- aux2 = values[j];
- dist = abs(aux1 - aux2);
-
- if( dist <= range ){
- for(k=j+1; k<5; k++){
- aux3 = values[k];
- dist2 = abs(aux1 - aux3);
-
- if( dist2 <= range ){
- result = aux2 + (aux1 << 1);
- result = result + aux3;
- result = result >> 2;
- result = result & (~7);
-
- *err = 0;
-
- break;
- }
- }
- }
- }
- }
-
- if((*err) == 1){
- result = values[0] + values[4];
- result = result >> 1;
- result = result & (~7);
- }
-
- return (result & 0xFFF);
-}
-
-//---------------------------------------------------------------------------------
-static void UpdateRange(uint8 *this_range, int16 last_dist_max, u8 data_error, u8 tsc_touched){
-//---------------------------------------------------------------------------------
- //range_counter_1 = counter_0x380A98C
- //range_counter_2 = counter_0x380A990
- //Initial values:
- // range = 20
- // min_range = 20
-
- if(tsc_touched != 0){
- if( data_error == 0){
- range_counter_2 = 0;
-
- if( last_dist_max >= ((*this_range) >> 1)){
- range_counter_1 = 0;
- }else{
- range_counter_1++;
-
- if(range_counter_1 >= 4){
- range_counter_1 = 0;
-
- if((*this_range) > min_range){
- (*this_range)--;
- range_counter_2 = 3;
- }
- }
- }
- }else{
- range_counter_1 = 0;
- range_counter_2++;
-
- if(range_counter_2 >= 4){
-
- range_counter_2 = 0;
-
- if((*this_range) < 35){ //0x23 = 35
- *this_range = (*this_range) + 1;
- }
- }
- }
- }else{
- range_counter_2 = 0;
- range_counter_1 = 0;
- }
-}
-
-//---------------------------------------------------------------------------------
-// reading pixel position:
-//---------------------------------------------------------------------------------
-touchPosition touchReadXY() {
-//---------------------------------------------------------------------------------
-
- int16 dist_max_y, dist_max_x, dist_max;
- u8 error, error_where, first_check, i;
-
- touchPosition touchPos = { 0, 0, 0, 0, 0, 0 };
-
- if ( !touchInit ) {
-
- xscale = ((PersonalData->calX2px - PersonalData->calX1px) << 19) / ((PersonalData->calX2) - (PersonalData->calX1));
- yscale = ((PersonalData->calY2px - PersonalData->calY1px) << 19) / ((PersonalData->calY2) - (PersonalData->calY1));
-
- xoffset = ((PersonalData->calX1 + PersonalData->calX2) * xscale - ((PersonalData->calX1px + PersonalData->calX2px) << 19) ) / 2;
- yoffset = ((PersonalData->calY1 + PersonalData->calY2) * yscale - ((PersonalData->calY1px + PersonalData->calY2px) << 19) ) / 2;
- touchInit = true;
- }
-
- uint32 oldIME = REG_IME;
-
- REG_IME = 0;
-
- first_check = CheckStylus();
- if(first_check != 0){
- error_where = 0;
-
- touchPos.z1 = readTouchValue(TSC_MEASURE_Z1 | 1, &dist_max, &error);
- touchPos.z2 = readTouchValue(TSC_MEASURE_Z2 | 1, &dist_max, &error);
-
- touchPos.x = readTouchValue(TSC_MEASURE_X | 1, &dist_max_x, &error);
- if(error==1) error_where += 1;
-
- touchPos.y = readTouchValue(TSC_MEASURE_Y | 1, &dist_max_y, &error);
- if(error==1) error_where += 2;
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH | SPI_CONTINUOUS;
- for(i=0; i<12; i++){
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
- }
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH;
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
-
- if(first_check == 2) error_where = 3;
-
- switch( CheckStylus() ){
- case 0:
- last_time_touched = 0;
- break;
- case 1:
- last_time_touched = 1;
-
- if(dist_max_x > dist_max_y)
- dist_max = dist_max_x;
- else
- dist_max = dist_max_y;
-
- break;
- case 2:
- last_time_touched = 0;
- error_where = 3;
-
- break;
- }
-
- s16 px = ( touchPos.x * xscale - xoffset + xscale/2 ) >>19;
- s16 py = ( touchPos.y * yscale - yoffset + yscale/2 ) >>19;
-
- if ( px < 0) px = 0;
- if ( py < 0) py = 0;
- if ( px > (SCREEN_WIDTH -1)) px = SCREEN_WIDTH -1;
- if ( py > (SCREEN_HEIGHT -1)) py = SCREEN_HEIGHT -1;
-
- touchPos.px = px;
- touchPos.py = py;
-
-
- }else{
- error_where = 3;
- touchPos.x = 0;
- touchPos.y = 0;
- last_time_touched = 0;
- }
-
- UpdateRange(&range, dist_max, error_where, last_time_touched);
-
- REG_IME = oldIME;
-
-
- return touchPos;
-
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/userSettings.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/userSettings.c
deleted file mode 100644
index ef2a09e2b3..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/userSettings.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include <nds/arm7/serial.h>
-#include <nds/system.h>
-#include <string.h>
-
-//---------------------------------------------------------------------------------
-void readUserSettings() {
-//---------------------------------------------------------------------------------
-
- PERSONAL_DATA slot1;
- PERSONAL_DATA slot2;
-
- short slot1count, slot2count;
- short slot1CRC, slot2CRC;
-
- uint32 userSettingsBase;
- readFirmware( 0x20, &userSettingsBase,2);
-
- uint32 slot1Address = userSettingsBase * 8;
- uint32 slot2Address = userSettingsBase * 8 + 0x100;
-
- readFirmware( slot1Address , &slot1, sizeof(PERSONAL_DATA));
- readFirmware( slot2Address , &slot2, sizeof(PERSONAL_DATA));
- readFirmware( slot1Address + 0x70, &slot1count, 2);
- readFirmware( slot2Address + 0x70, &slot2count, 2);
- readFirmware( slot1Address + 0x72, &slot1CRC, 2);
- readFirmware( slot2Address + 0x72, &slot2CRC, 2);
-
- // default to slot 1 user Settings
- void *currentSettings = &slot1;
-
- short calc1CRC = swiCRC16( 0xffff, &slot1, sizeof(PERSONAL_DATA));
- short calc2CRC = swiCRC16( 0xffff, &slot2, sizeof(PERSONAL_DATA));
-
- // bail out if neither slot is valid
- if ( calc1CRC != slot1CRC && calc2CRC != slot2CRC) return;
-
- // if both slots are valid pick the most recent
- if ( calc1CRC == slot1CRC && calc2CRC == slot2CRC ) {
- currentSettings = (slot2count == (( slot2count + 1 ) & 0x7f) ? &slot2 : &slot1);
- } else {
- if ( calc2CRC == slot2CRC )
- currentSettings = &slot2;
- }
- memcpy ( PersonalData, currentSettings, sizeof(PERSONAL_DATA));
-
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S
deleted file mode 100644
index 405e9f74a6..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Generated by BIN2S - please don't edit directly */
- .section .rodata
- .balign 4
- .global COS_bin_size
-COS_bin_size: .int 1024
- .global COS_bin
-COS_bin:
- .byte 0, 16,255, 15,254, 15,253, 15,251, 15,248, 15,244, 15,240, 15
- .byte 236, 15,231, 15,225, 15,218, 15,211, 15,203, 15,195, 15,186, 15
- .byte 177, 15,167, 15,156, 15,145, 15,133, 15,120, 15,107, 15, 93, 15
- .byte 79, 15, 64, 15, 49, 15, 33, 15, 16, 15,255, 14,237, 14,219, 14
- .byte 200, 14,180, 14,160, 14,139, 14,118, 14, 96, 14, 74, 14, 51, 14
- .byte 28, 14, 4, 14,235, 13,210, 13,185, 13,159, 13,132, 13,105, 13
- .byte 77, 13, 49, 13, 20, 13,247, 12,217, 12,187, 12,157, 12,125, 12
- .byte 94, 12, 62, 12, 29, 12,252, 11,218, 11,184, 11,150, 11,115, 11
- .byte 80, 11, 44, 11, 8, 11,227, 10,190, 10,153, 10,115, 10, 77, 10
- .byte 38, 10,255, 9,215, 9,176, 9,135, 9, 95, 9, 54, 9, 13, 9
- .byte 227, 8,185, 8,143, 8,100, 8, 57, 8, 14, 8,226, 7,183, 7
- .byte 138, 7, 94, 7, 49, 7, 4, 7,215, 6,169, 6,123, 6, 77, 6
- .byte 31, 6,240, 5,194, 5,147, 5, 99, 5, 52, 5, 4, 5,213, 4
- .byte 165, 4,116, 4, 68, 4, 19, 4,227, 3,178, 3,129, 3, 80, 3
- .byte 31, 3,237, 2,188, 2,138, 2, 89, 2, 39, 2,245, 1,195, 1
- .byte 145, 1, 95, 1, 45, 1,251, 0,200, 0,150, 0,100, 0, 50, 0
- .byte 0, 0,206,255,156,255,106,255, 56,255, 5,255,211,254,161,254
- .byte 111,254, 61,254, 11,254,217,253,167,253,118,253, 68,253, 19,253
- .byte 225,252,176,252,127,252, 78,252, 29,252,237,251,188,251,140,251
- .byte 91,251, 43,251,252,250,204,250,157,250,109,250, 62,250, 16,250
- .byte 225,249,179,249,133,249, 87,249, 41,249,252,248,207,248,162,248
- .byte 118,248, 73,248, 30,248,242,247,199,247,156,247,113,247, 71,247
- .byte 29,247,243,246,202,246,161,246,121,246, 80,246, 41,246, 1,246
- .byte 218,245,179,245,141,245,103,245, 66,245, 29,245,248,244,212,244
- .byte 176,244,141,244,106,244, 72,244, 38,244, 4,244,227,243,194,243
- .byte 162,243,131,243, 99,243, 69,243, 39,243, 9,243,236,242,207,242
- .byte 179,242,151,242,124,242, 97,242, 71,242, 46,242, 21,242,252,241
- .byte 228,241,205,241,182,241,160,241,138,241,117,241, 96,241, 76,241
- .byte 56,241, 37,241, 19,241, 1,241,240,240,223,240,207,240,192,240
- .byte 177,240,163,240,149,240,136,240,123,240,111,240,100,240, 89,240
- .byte 79,240, 70,240, 61,240, 53,240, 45,240, 38,240, 31,240, 25,240
- .byte 20,240, 16,240, 12,240, 8,240, 5,240, 3,240, 2,240, 1,240
- .byte 0,240, 1,240, 2,240, 3,240, 5,240, 8,240, 12,240, 16,240
- .byte 20,240, 25,240, 31,240, 38,240, 45,240, 53,240, 61,240, 70,240
- .byte 79,240, 89,240,100,240,111,240,123,240,136,240,149,240,163,240
- .byte 177,240,192,240,207,240,223,240,240,240, 1,241, 19,241, 37,241
- .byte 56,241, 76,241, 96,241,117,241,138,241,160,241,182,241,205,241
- .byte 228,241,252,241, 21,242, 46,242, 71,242, 97,242,124,242,151,242
- .byte 179,242,207,242,236,242, 9,243, 39,243, 69,243, 99,243,131,243
- .byte 162,243,194,243,227,243, 4,244, 38,244, 72,244,106,244,141,244
- .byte 176,244,212,244,248,244, 29,245, 66,245,103,245,141,245,179,245
- .byte 218,245, 1,246, 41,246, 80,246,121,246,161,246,202,246,243,246
- .byte 29,247, 71,247,113,247,156,247,199,247,242,247, 30,248, 73,248
- .byte 118,248,162,248,207,248,252,248, 41,249, 87,249,133,249,179,249
- .byte 225,249, 16,250, 62,250,109,250,157,250,204,250,252,250, 43,251
- .byte 91,251,140,251,188,251,237,251, 29,252, 78,252,127,252,176,252
- .byte 225,252, 19,253, 68,253,118,253,167,253,217,253, 11,254, 61,254
- .byte 111,254,161,254,211,254, 5,255, 56,255,106,255,156,255,206,255
- .byte 0, 0, 50, 0,100, 0,150, 0,200, 0,251, 0, 45, 1, 95, 1
- .byte 145, 1,195, 1,245, 1, 39, 2, 89, 2,138, 2,188, 2,237, 2
- .byte 31, 3, 80, 3,129, 3,178, 3,227, 3, 19, 4, 68, 4,116, 4
- .byte 165, 4,213, 4, 4, 5, 52, 5, 99, 5,147, 5,194, 5,240, 5
- .byte 31, 6, 77, 6,123, 6,169, 6,215, 6, 4, 7, 49, 7, 94, 7
- .byte 138, 7,183, 7,226, 7, 14, 8, 57, 8,100, 8,143, 8,185, 8
- .byte 227, 8, 13, 9, 54, 9, 95, 9,135, 9,176, 9,215, 9,255, 9
- .byte 38, 10, 77, 10,115, 10,153, 10,190, 10,227, 10, 8, 11, 44, 11
- .byte 80, 11,115, 11,150, 11,184, 11,218, 11,252, 11, 29, 12, 62, 12
- .byte 94, 12,125, 12,157, 12,187, 12,217, 12,247, 12, 20, 13, 49, 13
- .byte 77, 13,105, 13,132, 13,159, 13,185, 13,210, 13,235, 13, 4, 14
- .byte 28, 14, 51, 14, 74, 14, 96, 14,118, 14,139, 14,160, 14,180, 14
- .byte 200, 14,219, 14,237, 14,255, 14, 16, 15, 33, 15, 49, 15, 64, 15
- .byte 79, 15, 93, 15,107, 15,120, 15,133, 15,145, 15,156, 15,167, 15
- .byte 177, 15,186, 15,195, 15,203, 15,211, 15,218, 15,225, 15,231, 15
- .byte 236, 15,240, 15,244, 15,248, 15,251, 15,253, 15,254, 15,255, 15
-
- .global COS_bin_end
-COS_bin_end:
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S
deleted file mode 100644
index 7a9723b39b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Generated by BIN2S - please don't edit directly */
- .section .rodata
- .balign 4
- .global SIN_bin_size
-SIN_bin_size: .int 1024
- .global SIN_bin
-SIN_bin:
- .byte 0, 0, 50, 0,100, 0,150, 0,200, 0,251, 0, 45, 1, 95, 1
- .byte 145, 1,195, 1,245, 1, 39, 2, 89, 2,138, 2,188, 2,237, 2
- .byte 31, 3, 80, 3,129, 3,178, 3,227, 3, 19, 4, 68, 4,116, 4
- .byte 165, 4,213, 4, 4, 5, 52, 5, 99, 5,147, 5,194, 5,240, 5
- .byte 31, 6, 77, 6,123, 6,169, 6,215, 6, 4, 7, 49, 7, 94, 7
- .byte 138, 7,183, 7,226, 7, 14, 8, 57, 8,100, 8,143, 8,185, 8
- .byte 227, 8, 13, 9, 54, 9, 95, 9,135, 9,176, 9,215, 9,255, 9
- .byte 38, 10, 77, 10,115, 10,153, 10,190, 10,227, 10, 8, 11, 44, 11
- .byte 80, 11,115, 11,150, 11,184, 11,218, 11,252, 11, 29, 12, 62, 12
- .byte 94, 12,125, 12,157, 12,187, 12,217, 12,247, 12, 20, 13, 49, 13
- .byte 77, 13,105, 13,132, 13,159, 13,185, 13,210, 13,235, 13, 4, 14
- .byte 28, 14, 51, 14, 74, 14, 96, 14,118, 14,139, 14,160, 14,180, 14
- .byte 200, 14,219, 14,237, 14,255, 14, 16, 15, 33, 15, 49, 15, 64, 15
- .byte 79, 15, 93, 15,107, 15,120, 15,133, 15,145, 15,156, 15,167, 15
- .byte 177, 15,186, 15,195, 15,203, 15,211, 15,218, 15,225, 15,231, 15
- .byte 236, 15,240, 15,244, 15,248, 15,251, 15,253, 15,254, 15,255, 15
- .byte 0, 16,255, 15,254, 15,253, 15,251, 15,248, 15,244, 15,240, 15
- .byte 236, 15,231, 15,225, 15,218, 15,211, 15,203, 15,195, 15,186, 15
- .byte 177, 15,167, 15,156, 15,145, 15,133, 15,120, 15,107, 15, 93, 15
- .byte 79, 15, 64, 15, 49, 15, 33, 15, 16, 15,255, 14,237, 14,219, 14
- .byte 200, 14,180, 14,160, 14,139, 14,118, 14, 96, 14, 74, 14, 51, 14
- .byte 28, 14, 4, 14,235, 13,210, 13,185, 13,159, 13,132, 13,105, 13
- .byte 77, 13, 49, 13, 20, 13,247, 12,217, 12,187, 12,157, 12,125, 12
- .byte 94, 12, 62, 12, 29, 12,252, 11,218, 11,184, 11,150, 11,115, 11
- .byte 80, 11, 44, 11, 8, 11,227, 10,190, 10,153, 10,115, 10, 77, 10
- .byte 38, 10,255, 9,215, 9,176, 9,135, 9, 95, 9, 54, 9, 13, 9
- .byte 227, 8,185, 8,143, 8,100, 8, 57, 8, 14, 8,226, 7,183, 7
- .byte 138, 7, 94, 7, 49, 7, 4, 7,215, 6,169, 6,123, 6, 77, 6
- .byte 31, 6,240, 5,194, 5,147, 5, 99, 5, 52, 5, 4, 5,213, 4
- .byte 165, 4,116, 4, 68, 4, 19, 4,227, 3,178, 3,129, 3, 80, 3
- .byte 31, 3,237, 2,188, 2,138, 2, 89, 2, 39, 2,245, 1,195, 1
- .byte 145, 1, 95, 1, 45, 1,251, 0,200, 0,150, 0,100, 0, 50, 0
- .byte 0, 0,206,255,156,255,106,255, 56,255, 5,255,211,254,161,254
- .byte 111,254, 61,254, 11,254,217,253,167,253,118,253, 68,253, 19,253
- .byte 225,252,176,252,127,252, 78,252, 29,252,237,251,188,251,140,251
- .byte 91,251, 43,251,252,250,204,250,157,250,109,250, 62,250, 16,250
- .byte 225,249,179,249,133,249, 87,249, 41,249,252,248,207,248,162,248
- .byte 118,248, 73,248, 30,248,242,247,199,247,156,247,113,247, 71,247
- .byte 29,247,243,246,202,246,161,246,121,246, 80,246, 41,246, 1,246
- .byte 218,245,179,245,141,245,103,245, 66,245, 29,245,248,244,212,244
- .byte 176,244,141,244,106,244, 72,244, 38,244, 4,244,227,243,194,243
- .byte 162,243,131,243, 99,243, 69,243, 39,243, 9,243,236,242,207,242
- .byte 179,242,151,242,124,242, 97,242, 71,242, 46,242, 21,242,252,241
- .byte 228,241,205,241,182,241,160,241,138,241,117,241, 96,241, 76,241
- .byte 56,241, 37,241, 19,241, 1,241,240,240,223,240,207,240,192,240
- .byte 177,240,163,240,149,240,136,240,123,240,111,240,100,240, 89,240
- .byte 79,240, 70,240, 61,240, 53,240, 45,240, 38,240, 31,240, 25,240
- .byte 20,240, 16,240, 12,240, 8,240, 5,240, 3,240, 2,240, 1,240
- .byte 0,240, 1,240, 2,240, 3,240, 5,240, 8,240, 12,240, 16,240
- .byte 20,240, 25,240, 31,240, 38,240, 45,240, 53,240, 61,240, 70,240
- .byte 79,240, 89,240,100,240,111,240,123,240,136,240,149,240,163,240
- .byte 177,240,192,240,207,240,223,240,240,240, 1,241, 19,241, 37,241
- .byte 56,241, 76,241, 96,241,117,241,138,241,160,241,182,241,205,241
- .byte 228,241,252,241, 21,242, 46,242, 71,242, 97,242,124,242,151,242
- .byte 179,242,207,242,236,242, 9,243, 39,243, 69,243, 99,243,131,243
- .byte 162,243,194,243,227,243, 4,244, 38,244, 72,244,106,244,141,244
- .byte 176,244,212,244,248,244, 29,245, 66,245,103,245,141,245,179,245
- .byte 218,245, 1,246, 41,246, 80,246,121,246,161,246,202,246,243,246
- .byte 29,247, 71,247,113,247,156,247,199,247,242,247, 30,248, 73,248
- .byte 118,248,162,248,207,248,252,248, 41,249, 87,249,133,249,179,249
- .byte 225,249, 16,250, 62,250,109,250,157,250,204,250,252,250, 43,251
- .byte 91,251,140,251,188,251,237,251, 29,252, 78,252,127,252,176,252
- .byte 225,252, 19,253, 68,253,118,253,167,253,217,253, 11,254, 61,254
- .byte 111,254,161,254,211,254, 5,255, 56,255,106,255,156,255,206,255
-
- .global SIN_bin_end
-SIN_bin_end:
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S
deleted file mode 100644
index c30a88de43..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Generated by BIN2S - please don't edit directly */
- .section .rodata
- .balign 4
- .global TAN_bin_size
-TAN_bin_size: .int 1024
- .global TAN_bin
-TAN_bin:
- .byte 0, 0, 50, 0,100, 0,150, 0,201, 0,251, 0, 46, 1, 96, 1
- .byte 147, 1,198, 1,249, 1, 44, 2, 95, 2,147, 2,198, 2,250, 2
- .byte 46, 3, 99, 3,151, 3,204, 3, 1, 4, 55, 4,109, 4,163, 4
- .byte 218, 4, 17, 5, 73, 5,129, 5,185, 5,242, 5, 44, 6,102, 6
- .byte 160, 6,219, 6, 23, 7, 84, 7,145, 7,207, 7, 13, 8, 77, 8
- .byte 141, 8,206, 8, 16, 9, 83, 9,151, 9,219, 9, 33, 10,104, 10
- .byte 176, 10,250, 10, 68, 11,144, 11,221, 11, 44, 12,124, 12,206, 12
- .byte 33, 13,118, 13,205, 13, 37, 14,128, 14,220, 14, 59, 15,156, 15
- .byte 255, 15,101, 16,206, 16, 57, 17,167, 17, 24, 18,140, 18, 3, 19
- .byte 126, 19,253, 19,128, 20, 7, 21,146, 21, 34, 22,183, 22, 82, 23
- .byte 242, 23,152, 24, 68, 25,247, 25,177, 26,115, 27, 62, 28, 17, 29
- .byte 239, 29,214, 30,201, 31,200, 32,212, 33,238, 34, 24, 36, 83, 37
- .byte 160, 38, 2, 40,122, 41, 11, 43,183, 44,130, 46,110, 48,129, 50
- .byte 190, 52, 44, 55,209, 57,180, 60,224, 63, 95, 67, 64, 71,147, 75
- .byte 111, 80,239, 85, 53, 92,112, 99,220,107,206,117,185,129, 70,144
- .byte 115,162,204,185,232,216,110, 4,175, 69,103,178,196,139,187, 23
- .byte 80,248, 69,232, 60,116,153, 77, 81,186,146,251, 24, 39, 52, 70
- .byte 141, 93,186,111, 71,126, 50,138, 36,148,144,156,203,163, 17,170
- .byte 145,175,109,180,192,184,161,188, 32,192, 76,195, 47,198,212,200
- .byte 66,203,127,205,146,207,126,209, 73,211,245,212,134,214,254,215
- .byte 96,217,173,218,232,219, 18,221, 44,222, 56,223, 55,224, 42,225
- .byte 17,226,239,226,194,227,141,228, 79,229, 9,230,188,230,104,231
- .byte 14,232,174,232, 73,233,222,233,110,234,249,234,128,235, 3,236
- .byte 130,236,253,236,116,237,232,237, 89,238,199,238, 50,239,155,239
- .byte 0,240,100,240,197,240, 36,241,128,241,219,241, 51,242,138,242
- .byte 223,242, 50,243,132,243,212,243, 35,244,112,244,188,244, 6,245
- .byte 80,245,152,245,223,245, 37,246,105,246,173,246,240,246, 50,247
- .byte 115,247,179,247,243,247, 49,248,111,248,172,248,233,248, 37,249
- .byte 96,249,154,249,212,249, 14,250, 71,250,127,250,183,250,239,250
- .byte 38,251, 93,251,147,251,201,251,255,251, 52,252,105,252,157,252
- .byte 210,252, 6,253, 58,253,109,253,161,253,212,253, 7,254, 58,254
- .byte 109,254,160,254,210,254, 5,255, 55,255,106,255,156,255,206,255
- .byte 0, 0, 50, 0,100, 0,150, 0,201, 0,251, 0, 46, 1, 96, 1
- .byte 147, 1,198, 1,249, 1, 44, 2, 95, 2,147, 2,198, 2,250, 2
- .byte 46, 3, 99, 3,151, 3,204, 3, 1, 4, 55, 4,109, 4,163, 4
- .byte 218, 4, 17, 5, 73, 5,129, 5,185, 5,242, 5, 44, 6,102, 6
- .byte 160, 6,219, 6, 23, 7, 84, 7,145, 7,207, 7, 13, 8, 77, 8
- .byte 141, 8,206, 8, 16, 9, 83, 9,151, 9,219, 9, 33, 10,104, 10
- .byte 176, 10,250, 10, 68, 11,144, 11,221, 11, 44, 12,124, 12,206, 12
- .byte 33, 13,118, 13,205, 13, 37, 14,128, 14,220, 14, 59, 15,156, 15
- .byte 255, 15,101, 16,206, 16, 57, 17,167, 17, 24, 18,140, 18, 3, 19
- .byte 126, 19,253, 19,128, 20, 7, 21,146, 21, 34, 22,183, 22, 82, 23
- .byte 242, 23,152, 24, 68, 25,247, 25,177, 26,115, 27, 62, 28, 17, 29
- .byte 239, 29,214, 30,201, 31,200, 32,212, 33,238, 34, 24, 36, 83, 37
- .byte 160, 38, 2, 40,122, 41, 11, 43,183, 44,130, 46,110, 48,129, 50
- .byte 190, 52, 44, 55,209, 57,180, 60,224, 63, 95, 67, 64, 71,147, 75
- .byte 111, 80,239, 85, 53, 92,112, 99,220,107,206,117,185,129, 70,144
- .byte 115,162,204,185,232,216,110, 4,175, 69,103,178,196,139,187, 23
- .byte 196,128, 69,232, 60,116,153, 77, 81,186,146,251, 24, 39, 52, 70
- .byte 141, 93,186,111, 71,126, 50,138, 36,148,144,156,203,163, 17,170
- .byte 145,175,109,180,192,184,161,188, 32,192, 76,195, 47,198,212,200
- .byte 66,203,127,205,146,207,126,209, 73,211,245,212,134,214,254,215
- .byte 96,217,173,218,232,219, 18,221, 44,222, 56,223, 55,224, 42,225
- .byte 17,226,239,226,194,227,141,228, 79,229, 9,230,188,230,104,231
- .byte 14,232,174,232, 73,233,222,233,110,234,249,234,128,235, 3,236
- .byte 130,236,253,236,116,237,232,237, 89,238,199,238, 50,239,155,239
- .byte 0,240,100,240,197,240, 36,241,128,241,219,241, 51,242,138,242
- .byte 223,242, 50,243,132,243,212,243, 35,244,112,244,188,244, 6,245
- .byte 80,245,152,245,223,245, 37,246,105,246,173,246,240,246, 50,247
- .byte 115,247,179,247,243,247, 49,248,111,248,172,248,233,248, 37,249
- .byte 96,249,154,249,212,249, 14,250, 71,250,127,250,183,250,239,250
- .byte 38,251, 93,251,147,251,201,251,255,251, 52,252,105,252,157,252
- .byte 210,252, 6,253, 58,253,109,253,161,253,212,253, 7,254, 58,254
- .byte 109,254,160,254,210,254, 5,255, 55,255,106,255,156,255,206,255
-
- .global TAN_bin_end
-TAN_bin_end:
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c
deleted file mode 100644
index 8335635c33..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*---------------------------------------------------------------------------------
- BoxTest.c -- Code for performing hardware box test against viewing frustrum
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include <nds/arm9/video.h>
-#include <nds/arm9/videoGL.h>
-
-/*
- * Prototypes
- *
- * NOTE: This code appears to be externally available test code.
- */
-void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth);
-int BoxTestf(float x, float y, float z, float width, float height, float depth);
-void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth);
-int BoxTestResult(void);
-int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth);
-
-//---------------------------------------------------------------------------------
-void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth)
-//---------------------------------------------------------------------------------
-{
- glPolyFmt(BIT(12) | BIT(13));
- glBegin(GL_TRIANGLES);
- glEnd();
-
- GFX_BOX_TEST = VERTEX_PACK(x, y);
- GFX_BOX_TEST = VERTEX_PACK(z, width);
- GFX_BOX_TEST = VERTEX_PACK(height, depth);
-}
-
-//---------------------------------------------------------------------------------
-void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth)
-//---------------------------------------------------------------------------------
-{
- BoxTest_Asynch(floattov16(x), floattov16(y), floattov16(z),
- floattov16(width), floattov16(height), floattov16(depth));
-}
-
-//---------------------------------------------------------------------------------
-int BoxTestResult(void)
-//---------------------------------------------------------------------------------
-{
- while(GFX_STATUS & BIT(0));
-
- return (GFX_STATUS & BIT(1));
-}
-
-//---------------------------------------------------------------------------------
-int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth)
-//---------------------------------------------------------------------------------
-{
- glPolyFmt(BIT(12) | BIT(13));
- glBegin(GL_TRIANGLES);
- glEnd();
-
- GFX_BOX_TEST = VERTEX_PACK(x, y);
- GFX_BOX_TEST = VERTEX_PACK(z, width);
- GFX_BOX_TEST = VERTEX_PACK(height, depth);
-
- while(GFX_STATUS & BIT(0));
-
- return (GFX_STATUS & BIT(1));
-}
-
-//---------------------------------------------------------------------------------
-int BoxTestf(float x, float y, float z, float width, float height, float depth)
-//---------------------------------------------------------------------------------
-{
- return BoxTest(floattov16(x), floattov16(y), floattov16(z),
- floattov16(width), floattov16(height), floattov16(depth));
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c
deleted file mode 100644
index 23adf4c0c2..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include <nds/jtypes.h>
-#include <nds/memory.h>
-#include <nds/arm9/console.h>
-#include <nds/arm9/video.h>
-#include <nds/arm9/background.h>
-#include <default_font_bin.h>
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <sys/iosupport.h>
-
-// global console variables
-
-#define CONSOLE_WIDTH 32
-#define CONSOLE_HEIGHT 24
-#define TAB_SIZE 3
-
-// map to print to
-static u16* fontMap;
-
-// location of cursor
-static int row, col;
-static int savedX, savedY;
-
-// font may not start on a character base boundry
-static u16 fontOffset;
-
-// the first character in the set (0 if you have a full set)
-static u16 fontStart;
-
-// the 16-color palette to use
-bool fontBold = false;
-static u16 fontPal;
-
-static int consoleInitialised = 0;
-
-void consolePrintChar(char c);
-
-
-//---------------------------------------------------------------------------------
-static void consoleCls(char mode) {
-//---------------------------------------------------------------------------------
-
- int i = 0;
- int colTemp,rowTemp;
-
- switch (mode)
- {
- case '0':
- {
- colTemp = col;
- rowTemp = row;
-
- while(i++ < ((CONSOLE_HEIGHT * CONSOLE_WIDTH) - (rowTemp * CONSOLE_WIDTH + colTemp))) consolePrintChar(' ');
-
- col = colTemp;
- row = rowTemp;
- break;
- }
- case '1':
- {
- colTemp = col;
- rowTemp = row;
-
- row = 0;
- col = 0;
-
- while (i++ < (rowTemp * CONSOLE_WIDTH + colTemp)) consolePrintChar(' ');
-
- col = colTemp;
- row = rowTemp;
- break;
- }
- case '2':
- {
- row = 0;
- col = 0;
-
- while(i++ < CONSOLE_HEIGHT * CONSOLE_WIDTH) consolePrintChar(' ');
-
- row = 0;
- col = 0;
- break;
- }
- }
-}
-//---------------------------------------------------------------------------------
-static void consoleClearLine(char mode) {
-//---------------------------------------------------------------------------------
-
- int i = 0;
- int colTemp;
-
- switch (mode)
- {
- case '0':
- {
- colTemp = col;
-
- while(i++ < (CONSOLE_WIDTH - colTemp)) {
- consolePrintChar(' ');
- }
-
- col = colTemp;
-
- break;
- }
- case '1':
- {
- colTemp = col;
-
- col = 0;
-
- while(i++ < ((CONSOLE_WIDTH - colTemp)-2)) {
- consolePrintChar(' ');
- }
-
- col = colTemp;
-
- break;
- }
- case '2':
- {
- colTemp = col;
-
- col = 0;
-
- while(i++ < CONSOLE_WIDTH) {
- consolePrintChar(' ');
- }
-
- col = colTemp;
-
- break;
- }
- default:
- {
- colTemp = col;
-
- while(i++ < (CONSOLE_WIDTH - colTemp)) {
- consolePrintChar(' ');
- }
-
- col = colTemp;
-
- break;
- }
- }
-}
-//---------------------------------------------------------------------------------
-static int con_write(struct _reent *r,int fd,const char *ptr,int len) {
-//---------------------------------------------------------------------------------
-
- if (!consoleInitialised) return -1;
-
- char chr;
-
- int i, count = 0;
- char *tmp = (char*)ptr;
-
- if(!tmp || len<=0) return -1;
-
- i = 0;
- while(*tmp!='\0' && i<len) {
-
- chr = *(tmp++);
- i++; count++;
-
- if ( chr == 0x1b && *tmp == '[' ) {
- bool escaping = true;
- char *escapeseq = tmp;
- int escapelen = 0;
-
- do {
- chr = *(tmp++);
- i++; count++; escapelen++;
- int parameter;
-
- switch (chr) {
- /////////////////////////////////////////
- // Cursor directional movement
- /////////////////////////////////////////
- case 'A':
- siscanf(escapeseq,"[%dA", &parameter);
- row = (row - parameter) < 0 ? 0 : row - parameter;
- escaping = false;
- break;
- case 'B':
- siscanf(escapeseq,"[%dB", &parameter);
- row = (row + parameter) > CONSOLE_HEIGHT - 1 ? CONSOLE_HEIGHT - 1 : row + parameter;
- escaping = false;
- break;
- case 'C':
- siscanf(escapeseq,"[%dC", &parameter);
- col = (col + parameter) > CONSOLE_WIDTH - 1 ? CONSOLE_WIDTH - 1 : col + parameter;
- escaping = false;
- break;
- case 'D':
- siscanf(escapeseq,"[%dC", &parameter);
- col = (col - parameter) < 0 ? 0 : col - parameter;
- escaping = false;
- break;
- /////////////////////////////////////////
- // Cursor position movement
- /////////////////////////////////////////
- case 'H':
- case 'f':
- siscanf(escapeseq,"[%d;%df", &row, &col);
- escaping = false;
- break;
- /////////////////////////////////////////
- // Screen clear
- /////////////////////////////////////////
- case 'J':
- consoleCls(escapeseq[escapelen-2]);
- escaping = false;
- break;
- /////////////////////////////////////////
- // Line clear
- /////////////////////////////////////////
- case 'K':
- consoleClearLine(escapeseq[escapelen-2]);
- escaping = false;
- break;
- /////////////////////////////////////////
- // Save cursor position
- /////////////////////////////////////////
- case 's':
- savedX = col;
- savedY = row;
- escaping = false;
- break;
- /////////////////////////////////////////
- // Load cursor position
- /////////////////////////////////////////
- case 'u':
- col = savedX;
- row = savedY;
- escaping = false;
- break;
- }
- } while (escaping);
- continue;
- }
-
- consolePrintChar(chr);
- }
-
- return count;
-}
-
-const devoptab_t dotab_stdout = {
- "con",
- NULL,
- NULL,
- con_write,
- NULL,
- NULL,
- NULL
-};
-
-
-/*---------------------------------------------------------------------------------
- consoleInit
- param:
- font: 16 color font
- charBase: the location the font data will be loaded to
- numCharacters: count of characters in the font
- charStart: The ascii number of the first character in the font set
- if you have a full set this will be zero
- map: pointer to the map you will be printing to.
- pal: specifies the 16 color palette to use, if > 15 it will change all non-zero
- entries in the font to use palette index 255
----------------------------------------------------------------------------------*/
-void consoleInit( u16* font, u16* charBase,
- u16 numCharacters, u8 charStart,
- u16* map, u8 pal, u8 bitDepth) {
-//---------------------------------------------------------------------------------
- int i;
-
- row = col = 0;
-
- fontStart = charStart;
-
- fontOffset = 0;
-
- fontMap = map;
-
- if(bitDepth == 16)
- {
- if(pal < 16)
- {
- fontPal = pal << 12;
-
- for (i = 0; i < numCharacters * 16; i++)
- charBase[i] = font[i];
- }
- else
- {
- fontPal = 15 << 12;
-
- for (i = 0; i < numCharacters * 16; i++)
- {
- u16 temp = 0;
-
- if(font[i] & 0xF)
- temp |= 0xF;
- if(font[i] & 0xF0)
- temp |= 0xF0;
- if(font[i] & 0xF00)
- temp |= 0xF00;
- if(font[i] & 0xF000)
- temp |= 0xF000;
-
- charBase[i] = temp;
- }
- }
- }//end if bitdepth
- else
- {
- fontPal = 0;
- for(i = 0; i < numCharacters * 16; i++)
- {
- u32 temp = 0;
-
- if(font[i] & 0xF)
- temp = 255;
- if(font[i] & 0xF0)
- temp |= 255 << 8;
- if(font[i] & 0xF00)
- temp |= 255 << 16;
- if(font[i] & 0xF000)
- temp |= 255 << 24;
-
- ((u32*)charBase)[i] = temp;
-
- }
- }
-
- devoptab_list[STD_OUT] = &dotab_stdout;
- devoptab_list[STD_ERR] = &dotab_stdout;
- setvbuf(stderr, NULL , _IONBF, 0);
- setvbuf(stdout, NULL , _IONBF, 0);
- consoleCls('2');
- consoleInitialised = 1;
-
-}
-
-//---------------------------------------------------------------------------------
-// Places the console in a default mode using bg0 of the sub display, and vram c for
-// font and map..this is provided for rapid prototyping and nothing more
-void consoleDemoInit(void) {
-//---------------------------------------------------------------------------------
- videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); //sub bg 0 will be used to print text
- vramSetBankC(VRAM_C_SUB_BG);
-
- SUB_BG0_CR = BG_MAP_BASE(31);
-
- BG_PALETTE_SUB[255] = RGB15(31,31,31); //by default font will be rendered with color 255
-
- //consoleInit() is a lot more flexible but this gets you up and running quick
- consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
-}
-
-//---------------------------------------------------------------------------------
-void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth) {
-//---------------------------------------------------------------------------------
- consoleInit((u16*)default_font_bin, charBase, 256, 0, map, CONSOLE_USE_COLOR255, bitDepth);
-}
-
-//void consoleInitColorDefault(u16* map, u16* charBase) {
-// consoleInit((u16*)default_font_bin, charBase, 256, 0, map, CONSOLE_USE_COLOR255, bitDepth);
-//}
-
-//---------------------------------------------------------------------------------
-static void newRow(void) {
-//---------------------------------------------------------------------------------
- int i;
- row++;
- if(row >= CONSOLE_HEIGHT) {
- row--;
-
- for(i = CONSOLE_WIDTH; i < CONSOLE_HEIGHT * CONSOLE_WIDTH; i++) fontMap[i - CONSOLE_WIDTH] = fontMap[i];
-
- for(i = 0; i < CONSOLE_WIDTH; i++) fontMap[i + (CONSOLE_HEIGHT-1)*CONSOLE_WIDTH] = fontPal | (u16)(' ' + fontOffset - fontStart);
-
- }
-}
-
-
-//---------------------------------------------------------------------------------
-void consolePrintChar(char c) {
-//---------------------------------------------------------------------------------
-
- if(col >= CONSOLE_WIDTH) {
- col = 0;
-
- newRow();
- }
-
- switch(c) {
- /*
- The only special characters we will handle are tab (\t), carriage return (\r) & line feed (\n).
- Carriage return & line feed will function the same: go to next line and put cursor at the beginning.
- For everything else, use VT sequences.
-
- Reason: VT sequences are more specific to the task of cursor placement.
- The special escape sequences \b \f & \v are archaic and non-portable.
- */
- case 9:
- col += TAB_SIZE;
- break;
- case 10:
- case 13:
- newRow();
- col = 0;
- break;
- default:
- fontMap[col + row * CONSOLE_WIDTH] = fontPal | (u16)(c + fontOffset - fontStart);
- ++col;
- break;
- }
-}
-
-//---------------------------------------------------------------------------------
-void consoleClear(void) {
-//---------------------------------------------------------------------------------
- iprintf("\x1b[2J");
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S
deleted file mode 100644
index 85f409b2be..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S
+++ /dev/null
@@ -1,92 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#define ICACHE_SIZE 0x2000
-#define DCACHE_SIZE 0x1000
-#define CACHE_LINE_SIZE 32
-//---------------------------------------------------------------------------------
- .arm
-//---------------------------------------------------------------------------------
- .global DC_FlushAll
-//---------------------------------------------------------------------------------
-DC_FlushAll:
-/*---------------------------------------------------------------------------------
- Clean and invalidate entire data cache
----------------------------------------------------------------------------------*/
- mov r1, #0
-outer_loop:
- mov r0, #0
-inner_loop:
- orr r2, r1, r0 @ generate segment and line address
- mcr p15, 0, r2, c7, c14, 2 @ clean and flush the line
- add r0, r0, #CACHE_LINE_SIZE
- cmp r0, #DCACHE_SIZE/4
- bne inner_loop
- add r1, r1, #0x40000000
- cmp r1, #0
- bne outer_loop
- bx lr
-
-//---------------------------------------------------------------------------------
- .global DC_FlushRange
-//---------------------------------------------------------------------------------
-DC_FlushRange:
-/*---------------------------------------------------------------------------------
- Clean and invalidate a range
----------------------------------------------------------------------------------*/
- add r1, r1, r0
- bic r0, r0, #(CACHE_LINE_SIZE - 1)
-.flush:
- mcr p15, 0, r0, c7, c14, 1 @ clean and flush address
- add r0, r0, #CACHE_LINE_SIZE
- cmp r0, r1
- blt .flush
- bx lr
-
-//---------------------------------------------------------------------------------
- .global DC_InvalidateAll
-//---------------------------------------------------------------------------------
-DC_InvalidateAll:
-/*---------------------------------------------------------------------------------
- Clean and invalidate entire data cache
----------------------------------------------------------------------------------*/
- mov r0, #0
- mcr p15, 0, r0, c7, c6, 0
- bx lr
-
-//---------------------------------------------------------------------------------
- .global DC_InvalidateRange
-//---------------------------------------------------------------------------------
-DC_InvalidateRange:
-/*---------------------------------------------------------------------------------
- Invalidate a range
----------------------------------------------------------------------------------*/
- add r1, r1, r0
- bic r0, r0, #CACHE_LINE_SIZE - 1
-.invalidate:
- mcr p15, 0, r0, c7, c6, 1
- add r0, r0, #CACHE_LINE_SIZE
- cmp r0, r1
- blt .invalidate
- bx lr
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S
deleted file mode 100644
index 743677700e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S
+++ /dev/null
@@ -1,523 +0,0 @@
-/* Generated by BIN2S - please don't edit directly */
- .section .rodata
- .balign 4
- .global default_font_bin_size
-default_font_bin_size: .int 8192
- .global default_font_bin
-default_font_bin:
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 1, 1, 0, 0, 16, 1, 1, 16, 16, 1, 0, 0, 16
- .byte 1, 17, 17, 16, 1, 16, 1, 16, 1, 0, 0, 16, 16, 17, 17, 1
- .byte 16, 17, 17, 1, 17, 17, 17, 17, 17, 16, 1, 17, 17, 17, 17, 17
- .byte 17, 0, 0, 17, 17, 1, 16, 17, 17, 17, 17, 17, 16, 17, 17, 1
- .byte 16, 1, 17, 0, 17, 17, 17, 1, 17, 17, 17, 1, 17, 17, 17, 1
- .byte 16, 17, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 0, 0, 0, 17, 1, 0, 16, 17, 17, 0, 17, 17, 17, 1
- .byte 16, 17, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 17, 0, 0, 17, 17, 0, 0, 16, 1, 0, 17, 17, 17, 17
- .byte 17, 1, 16, 17, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 0, 0, 0, 17, 1, 0, 16, 17, 17, 0, 17, 17, 17, 1
- .byte 17, 1, 17, 1, 0, 16, 0, 0, 0, 17, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 0, 0, 17, 17, 0
- .byte 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 0, 0, 17
- .byte 17, 0, 0, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17
- .byte 0, 0, 0, 0, 0, 17, 17, 0, 16, 1, 16, 1, 16, 0, 0, 1
- .byte 16, 0, 0, 1, 16, 1, 16, 1, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 17, 0, 0, 17, 1, 16, 1, 16, 1, 17, 17, 16
- .byte 1, 17, 17, 16, 1, 16, 1, 16, 17, 0, 0, 17, 17, 17, 17, 17
- .byte 0, 0, 17, 17, 0, 0, 16, 17, 0, 0, 17, 17, 16, 17, 17, 16
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0
- .byte 0, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1
- .byte 0, 17, 17, 0, 0, 16, 1, 0, 16, 17, 17, 1, 0, 16, 1, 0
- .byte 0, 0, 1, 0, 0, 0, 17, 0, 0, 0, 1, 1, 0, 0, 1, 1
- .byte 0, 0, 1, 0, 16, 17, 1, 0, 17, 17, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 16, 0, 0, 16, 1, 1, 0, 16, 16, 1
- .byte 16, 17, 0, 1, 17, 1, 0, 1, 0, 0, 17, 1, 0, 16, 17, 0
- .byte 0, 16, 0, 0, 16, 16, 16, 0, 0, 17, 1, 0, 17, 1, 17, 1
- .byte 0, 17, 1, 0, 16, 16, 16, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 1, 0, 0, 0, 17, 1, 0, 0, 17, 17, 1, 0, 17, 17, 17, 1
- .byte 17, 17, 1, 0, 17, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 1, 0, 0, 17, 1, 0, 17, 17, 1, 17, 17, 17, 1
- .byte 0, 17, 17, 1, 0, 0, 17, 1, 0, 0, 0, 1, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 17, 0, 16, 16, 1, 1, 0, 16, 1, 0
- .byte 16, 16, 1, 1, 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1
- .byte 16, 1, 16, 1, 0, 0, 0, 0, 16, 1, 16, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 17, 17, 16, 1, 17, 17, 16, 1, 17, 17, 16, 1, 17
- .byte 16, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 0, 0, 0
- .byte 0, 16, 17, 0, 0, 1, 0, 1, 0, 17, 1, 0, 16, 0, 16, 0
- .byte 16, 0, 16, 0, 0, 17, 1, 0, 1, 0, 1, 0, 16, 17, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 1, 16, 17, 17, 1, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 17, 0, 16, 16, 1, 1, 0, 16, 1, 0
- .byte 16, 16, 1, 1, 0, 17, 17, 0, 0, 16, 1, 0, 16, 17, 17, 1
- .byte 0, 16, 1, 0, 0, 17, 17, 0, 16, 16, 1, 1, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 16, 16, 1, 1, 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 17, 17, 17, 1
- .byte 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 16, 1, 0, 0, 17, 17, 17, 1
- .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0
- .byte 17, 0, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 1, 16, 0, 16, 0, 0, 1, 17, 17, 17, 17
- .byte 16, 0, 0, 1, 0, 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 1, 0, 16, 17, 17, 0
- .byte 17, 17, 17, 1, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 17, 17, 17, 1, 17, 17, 17, 1, 16, 17, 17, 0
- .byte 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 16, 1, 17, 0, 0, 1, 16, 0, 0, 1, 16, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 16, 1, 17, 0, 16, 1, 17, 0, 17, 17, 17, 1, 16, 1, 17, 0
- .byte 17, 17, 17, 1, 16, 1, 17, 0, 16, 1, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 0, 0, 16, 17, 17, 0, 17, 16, 0, 0, 16, 17, 17, 0
- .byte 0, 16, 16, 1, 17, 17, 17, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 16, 1, 16, 1, 1, 1, 17, 0, 17, 16, 1, 0
- .byte 0, 17, 16, 1, 16, 1, 1, 1, 17, 0, 17, 0, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 16, 0, 17, 0, 0, 17, 1, 0, 16, 17, 1, 0
- .byte 17, 0, 17, 1, 17, 0, 17, 0, 16, 17, 1, 1, 0, 0, 0, 0
- .byte 0, 17, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0
- .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 16, 1, 16, 1, 0, 17, 17, 0, 17, 17, 17, 17
- .byte 0, 17, 17, 0, 16, 1, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 17, 17, 17, 0
- .byte 0, 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 1, 0, 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 16, 1, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 1, 17, 16, 17, 1, 17, 17, 16, 1
- .byte 17, 1, 16, 1, 17, 1, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 1, 0, 16, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 0
- .byte 16, 17, 0, 0, 17, 0, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 0
- .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 17, 0, 0, 17, 17, 0, 16, 1, 17, 0, 17, 0, 17, 0
- .byte 17, 17, 17, 1, 0, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 17, 17, 17, 0, 0, 0, 16, 1
- .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 17, 17, 17, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 17, 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 1
- .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0
- .byte 0, 0, 17, 0, 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0
- .byte 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0
- .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 1, 0, 17, 0, 17, 0, 0, 0, 17, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 1, 16, 17, 1, 1, 1, 16, 1
- .byte 1, 16, 17, 1, 1, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 17, 0, 0, 0
- .byte 17, 0, 0, 0, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 16, 1, 0, 1, 16, 1, 1, 0, 16, 17, 1, 0
- .byte 16, 1, 1, 0, 16, 1, 0, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 16, 1, 0, 1, 16, 1, 1, 0, 16, 17, 1, 0
- .byte 16, 1, 1, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 0, 0
- .byte 17, 0, 17, 1, 17, 0, 16, 1, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 17, 17, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 17, 1, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0, 0, 0, 0, 0
- .byte 17, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 0, 16, 17, 1, 0
- .byte 16, 1, 17, 0, 16, 1, 16, 1, 17, 1, 16, 1, 0, 0, 0, 0
- .byte 17, 17, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0
- .byte 16, 1, 0, 1, 16, 1, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 1, 0, 0, 1, 17, 0, 16, 1, 17, 1, 17, 1, 17, 17, 17, 1
- .byte 17, 16, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 17, 1, 16, 1, 17, 17, 16, 1, 17, 16, 17, 1
- .byte 17, 0, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0
- .byte 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 16, 16, 1, 17, 16, 17, 1, 16, 17, 17, 0, 0, 0, 16, 1
- .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 16, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 16, 17, 17, 0
- .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 1, 16, 16, 1, 1, 16, 16, 1, 1, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 16, 1, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 16, 16, 1, 17, 17, 17, 1
- .byte 17, 1, 17, 1, 17, 0, 16, 1, 1, 0, 0, 1, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 16, 1, 17, 0, 0, 17, 1, 0, 0, 17, 1, 0
- .byte 0, 17, 1, 0, 16, 1, 17, 0, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 0, 17, 17, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 17, 0, 16, 1, 1, 0, 17, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 1, 16, 1, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 1, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0
- .byte 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 1, 0, 0, 0, 0, 0
- .byte 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0
- .byte 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 1, 0, 0, 0, 0
- .byte 16, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 1, 0, 0, 0, 0, 0
- .byte 0, 16, 0, 0, 0, 17, 1, 0, 16, 1, 17, 0, 17, 0, 16, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17
- .byte 0, 17, 0, 0, 0, 1, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 17, 0
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 0, 0, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0, 16, 17, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 17, 0, 0, 17, 16, 1, 0, 17, 0, 0, 16, 17, 1, 0
- .byte 0, 17, 0, 0, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 16, 1, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 16, 17, 1, 0
- .byte 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 17, 0, 16, 17, 16, 1
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 16, 1, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 16, 17, 0
- .byte 0, 0, 17, 0, 0, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0
- .byte 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 16, 1, 16, 1, 17, 0
- .byte 16, 17, 1, 0, 16, 1, 17, 0, 17, 1, 16, 1, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 17, 17, 1
- .byte 17, 16, 16, 1, 17, 16, 16, 1, 17, 16, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 16, 17, 0, 16, 1, 16, 1
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 16, 17, 0, 16, 1, 16, 1
- .byte 16, 1, 16, 1, 16, 17, 17, 0, 16, 1, 0, 0, 17, 17, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 0, 16, 17, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 16, 17, 1, 16, 17, 16, 1
- .byte 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 0, 0
- .byte 16, 17, 17, 0, 0, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 0, 0, 0, 17, 0, 0, 17, 17, 17, 0, 0, 17, 0, 0
- .byte 0, 17, 0, 0, 0, 17, 16, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 16, 1, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 16, 1, 17, 16, 16, 1
- .byte 17, 16, 16, 1, 17, 17, 17, 1, 16, 1, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 16, 1, 16, 1, 17, 0
- .byte 0, 17, 1, 0, 16, 1, 17, 0, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 17, 17, 1, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0, 1, 16, 1, 0
- .byte 0, 17, 0, 0, 16, 1, 16, 0, 17, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 17, 1, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 0, 17, 0, 0, 17, 1, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 16, 1, 17, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 1, 0, 16, 1, 17, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 17, 0, 0, 0
- .byte 17, 0, 16, 1, 16, 17, 17, 0, 0, 16, 1, 0, 16, 17, 0, 0
- .byte 17, 0, 17, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 0, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 17, 0, 17, 0, 0, 0, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 16, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 17, 0, 0, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 0, 0
- .byte 17, 0, 0, 0, 16, 17, 17, 0, 0, 16, 1, 0, 16, 17, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 0, 0, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 0, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 16, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 0, 17, 1, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 17, 17, 17, 1, 16, 1, 0, 0
- .byte 16, 17, 1, 0, 16, 1, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 0, 16, 0, 1
- .byte 16, 17, 17, 1, 17, 16, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 1, 17, 0, 1, 0, 17, 0, 1, 0, 17, 17, 17, 1
- .byte 17, 0, 1, 0, 17, 0, 1, 0, 17, 0, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 16, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 17, 0, 17, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 17, 17, 1, 0
- .byte 17, 0, 16, 1, 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 0, 0, 0, 0, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 16, 17, 17, 0, 17, 16, 16, 1, 17, 16, 0, 0
- .byte 17, 16, 16, 1, 16, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 0, 0, 17, 17, 0, 0
- .byte 16, 1, 0, 0, 17, 17, 0, 1, 17, 16, 17, 0, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 0, 17, 17, 0, 0, 16, 1, 0, 16, 17, 17, 1
- .byte 0, 16, 1, 0, 16, 17, 17, 1, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 17, 17, 1, 0, 17, 0, 17, 0, 17, 17, 1, 0, 17, 0, 16, 0
- .byte 17, 0, 17, 0, 17, 16, 17, 1, 17, 0, 17, 0, 0, 0, 16, 1
- .byte 0, 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 0, 0, 17, 17, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 16, 1, 0, 16, 17, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 1, 16, 1, 0, 17, 16, 17, 0, 16, 1, 16, 1
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 1, 16, 1, 0, 17, 1, 16, 1, 17, 17, 16, 1
- .byte 17, 16, 17, 1, 17, 0, 17, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 0, 0, 17, 0, 0, 17, 17, 0, 0, 17, 16, 0
- .byte 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 17, 0, 0, 17, 1, 0
- .byte 0, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 16, 1, 0, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0
- .byte 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0
- .byte 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 0, 0, 0, 17, 0, 1, 0, 17, 16, 0, 0, 17, 17, 17, 1
- .byte 16, 0, 16, 1, 1, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 0
- .byte 17, 0, 0, 0, 17, 0, 1, 0, 17, 16, 0, 0, 17, 1, 17, 0
- .byte 16, 16, 17, 0, 1, 17, 17, 1, 0, 0, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 17, 17, 0, 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 16, 1, 16, 1, 17, 0, 17, 16, 1, 0
- .byte 16, 1, 17, 0, 0, 17, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 17, 16, 1, 0, 16, 1, 17, 0, 0, 17, 16, 1
- .byte 16, 1, 17, 0, 17, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0
- .byte 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0
- .byte 16, 16, 16, 16, 1, 1, 1, 1, 16, 16, 16, 16, 1, 1, 1, 1
- .byte 16, 16, 16, 16, 1, 1, 1, 1, 16, 16, 16, 16, 1, 1, 1, 1
- .byte 17, 16, 1, 17, 16, 17, 16, 17, 17, 16, 1, 17, 17, 1, 17, 1
- .byte 17, 16, 1, 17, 16, 17, 16, 17, 17, 16, 1, 17, 17, 1, 17, 1
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 17, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 1, 0, 0, 16, 1
- .byte 17, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 1, 0, 0, 16, 1
- .byte 17, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 1, 0, 0, 16, 1
- .byte 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 17, 0, 16, 1, 0
- .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 17, 0, 17, 0, 0
- .byte 0, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0, 17, 0, 0
- .byte 0, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 17, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 0, 0, 0, 0
- .byte 17, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 17, 0, 17, 0, 0
- .byte 0, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 17, 0, 0, 0, 0
- .byte 17, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 17, 17, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 17, 0, 16, 1, 0
- .byte 0, 16, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 16, 1, 0
- .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 17, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 17, 17, 17, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 17, 17, 0, 16, 1, 0
- .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17
- .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17
- .byte 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0
- .byte 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0
- .byte 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17
- .byte 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17
- .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 16, 0, 17, 0, 17, 0
- .byte 17, 0, 1, 0, 17, 16, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 16, 17, 1, 0, 17, 0, 17, 0, 17, 16, 1, 0, 17, 0, 17, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 16, 17, 0, 16, 0, 0, 0
- .byte 17, 17, 17, 1, 16, 1, 0, 1, 16, 1, 0, 0, 16, 1, 0, 0
- .byte 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 1, 16, 17, 17, 1, 17, 1, 17, 0
- .byte 16, 1, 17, 0, 16, 1, 17, 0, 16, 0, 1, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 16, 1, 0, 1, 0, 17, 0, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 16, 1, 0, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 1, 17, 16, 0, 0
- .byte 17, 0, 1, 0, 17, 0, 1, 0, 16, 17, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 17, 17, 1, 0, 1, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 1, 17, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 0, 16, 0, 0, 16, 17, 17, 0, 17, 16, 16, 1
- .byte 17, 16, 16, 1, 16, 17, 17, 0, 0, 16, 0, 0, 0, 17, 1, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 16, 1, 17, 0, 0, 1, 1, 0, 17, 1, 17, 1, 0, 0, 0, 0
- .byte 0, 17, 17, 0, 0, 1, 0, 1, 0, 16, 1, 0, 16, 17, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 16, 1, 1, 16, 1, 16
- .byte 1, 16, 1, 16, 16, 1, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 16, 1, 16, 17, 17, 0, 1, 16, 17, 1
- .byte 17, 17, 0, 1, 16, 17, 17, 0, 17, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 0, 0
- .byte 17, 17, 1, 0, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0, 17, 17, 17, 1
- .byte 0, 0, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 17, 1, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 16, 17, 0, 0
- .byte 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0, 16, 17, 17, 1
- .byte 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 16, 17, 16, 1, 17, 16, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 16, 1, 17, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 16, 1, 17, 0, 0, 17, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 17, 17, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0
- .byte 17, 1, 17, 0, 16, 1, 17, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 16, 1, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 0, 0, 0, 17, 0, 0, 17, 0, 0, 0, 17, 17, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 0, 0, 17, 17, 0
- .byte 0, 17, 17, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-
- .global default_font_bin_end
-default_font_bin_end:
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S
deleted file mode 100644
index 74711537eb..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S
+++ /dev/null
@@ -1,109 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
- .text
-
- .arm
-
-@---------------------------------------------------------------------------------
- .global getCPSR
-@---------------------------------------------------------------------------------
-getCPSR:
-@---------------------------------------------------------------------------------
- mrs r0,cpsr
- bx r14
-
-@---------------------------------------------------------------------------------
- .global enterException
-@---------------------------------------------------------------------------------
-enterException:
-@---------------------------------------------------------------------------------
- // store context
- ldr r12,=exceptionRegisters
- stmia r12,{r0-r11}
- str r13,[r12,#oldStack - exceptionRegisters]
- // assign a stack
- ldr r13,=exceptionStack
- ldr r13,[r13]
-
- // renable MPU
- mrc p15,0,r0,c1,c0,0
- orr r0,r0,#1
- mcr p15,0,r0,c1,c0,0
-
- // bios exception stack
- ldr r0, =0x027FFD90
-
- // grab r15 from bios exception stack
- ldr r2,[r0,#8]
- str r2,[r12,#reg15 - exceptionRegisters]
-
- // grab stored r12 and SPSR from bios exception stack
- ldmia r0,{r2,r12}
-
-
- // grab banked registers from correct processor mode
- mrs r3,cpsr
- bic r4,r3,#0x1F
- and r2,r2,#0x1F
- orr r4,r4,r2
- msr cpsr,r4
- ldr r0,=reg12
- stmia r0,{r12-r14}
- msr cpsr,r3
-
- // Get C function & call it
- ldr r12,=exceptionC
- ldr r12,[r12,#0]
- bxne r12
-
- // restore registers
- ldr r12,=exceptionRegisters
- ldmia r12,{r0-r11}
- ldr r13,[r12,#oldStack - exceptionRegisters]
-
- // return through bios
- mov pc,lr
-
-@---------------------------------------------------------------------------------
- .global exceptionC
-@---------------------------------------------------------------------------------
-exceptionC:
-@---------------------------------------------------------------------------------
- .word 0x00000000
-@---------------------------------------------------------------------------------
- .global exceptionStack
-@---------------------------------------------------------------------------------
-exceptionStack:
-@---------------------------------------------------------------------------------
- .word 0x00000000
-@---------------------------------------------------------------------------------
- .global exceptionRegisters
-@---------------------------------------------------------------------------------
-exceptionRegisters:
-@---------------------------------------------------------------------------------
- .space 12 * 4
-reg12: .word 0
-reg13: .word 0
-reg14: .word 0
-reg15: .word 0
-oldStack: .word 0
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c
deleted file mode 100644
index 94c2d7c19b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include <nds/jtypes.h>
-#include <nds/arm9/exceptions.h>
-
-//---------------------------------------------------------------------------------
-void setExceptionHandler(VoidFunctionPointer handler) {
-//---------------------------------------------------------------------------------
- exceptionStack = (u32)0x23EFFFC ;
- EXCEPTION_VECTOR = enterException ;
- *exceptionC = handler ;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c
deleted file mode 100644
index f0bd2bb41a..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include <nds/jtypes.h>
-#include <nds/memory.h>
-
-#include <nds/arm9/video.h>
-#include <nds/arm9/console.h>
-#include <nds/arm9/exceptions.h>
-#include <nds/arm9/background.h>
-
-#include <stdio.h>
-#include <inttypes.h>
-
-#include <bsp/linker-symbols.h>
-
-//---------------------------------------------------------------------------------
-static unsigned long ARMShift(unsigned long value,unsigned char shift) {
-//---------------------------------------------------------------------------------
- // no shift at all
- if (shift == 0x0B) return value ;
- int index ;
- if (shift & 0x01) {
- // shift index is a register
- index = exceptionRegisters[(shift >> 4) & 0x0F];
- } else {
- // constant shift index
- index = ((shift >> 3) & 0x1F) ;
- } ;
- int i ;
- bool isN ;
- switch (shift & 0x06) {
- case 0x00:
- // logical left
- return (value << index) ;
- case 0x02:
- // logical right
- return (value >> index) ;
- case 0x04:
- // arithmetical right
- isN = (value & 0x80000000) ;
- value = value >> index ;
- if (isN) {
- for (i=31;i>31-index;i--) {
- value = value | (1 << i) ;
- } ;
- } ;
- return value ;
- case 0x06:
- // rotate right
- index = index & 0x1F;
- value = (value >> index) | (value << (32-index));
- return value;
- };
- return value;
-}
-
-
-//---------------------------------------------------------------------------------
-static u32 getExceptionAddress( u32 opcodeAddress, u32 thumbState) {
-//---------------------------------------------------------------------------------
-
- int Rf, Rb, Rd, Rn, Rm;
-
- if (thumbState) {
- // Thumb
-
- unsigned short opcode = *(unsigned short *)opcodeAddress ;
- // ldr r,[pc,###] 01001ddd ffffffff
- // ldr r,[r,r] 0101xx0f ffbbbddd
- // ldrsh 0101xx1f ffbbbddd
- // ldr r,[r,imm] 011xxfff ffbbbddd
- // ldrh 1000xfff ffbbbddd
- // ldr r,[sp,###] 1001xddd ffffffff
- // push 1011x10l llllllll
- // ldm 1100xbbb llllllll
-
-
- if ((opcode & 0xF800) == 0x4800) {
- // ldr r,[pc,###]
- s8 offset = opcode & 0xff;
- return exceptionRegisters[15] + offset;
- } else if ((opcode & 0xF200) == 0x5000) {
- // ldr r,[r,r]
- Rb = (opcode >> 3) & 0x07 ;
- Rf = (opcode >> 6) & 0x07 ;
- return exceptionRegisters[Rb] + exceptionRegisters[Rf];
-
- } else if ((opcode & 0xF200) == 0x5200) {
- // ldrsh
- Rb = (opcode >> 3) & 0x07;
- Rf = (opcode >> 6) & 0x03;
- return exceptionRegisters[Rb] + exceptionRegisters[Rf];
-
- } else if ((opcode & 0xE000) == 0x6000) {
- // ldr r,[r,imm]
- Rb = (opcode >> 3) & 0x07;
- Rf = (opcode >> 6) & 0x1F ;
- return exceptionRegisters[Rb] + (Rf << 2);
- } else if ((opcode & 0xF000) == 0x8000) {
- // ldrh
- Rb = (opcode >> 3) & 0x07 ;
- Rf = (opcode >> 6) & 0x1F ;
- return exceptionRegisters[Rb] + (Rf << 2);
- } else if ((opcode & 0xF000) == 0x9000) {
- // ldr r,[sp,#imm]
- s8 offset = opcode & 0xff;
- return exceptionRegisters[13] + offset;
- } else if ((opcode & 0xF700) == 0xB500) {
- // push/pop
- return exceptionRegisters[13];
- } else if ((opcode & 0xF000) == 0xC000) {
- // ldm/stm
- Rd = (opcode >> 8) & 0x07;
- return exceptionRegisters[Rd];
- }
- } else {
- // arm32
- unsigned long opcode = *(unsigned long *)opcodeAddress ;
-
- // SWP xxxx0001 0x00nnnn dddd0000 1001mmmm
- // STR/LDR xxxx01xx xxxxnnnn ddddffff ffffffff
- // STRH/LDRH xxxx000x x0xxnnnn dddd0000 1xx1mmmm
- // STRH/LDRH xxxx000x x1xxnnnn ddddffff 1xx1ffff
- // STM/LDM xxxx100x xxxxnnnn llllllll llllllll
-
- if ((opcode & 0x0FB00FF0) == 0x01000090) {
- // SWP
- Rn = (opcode >> 16) & 0x0F;
- return exceptionRegisters[Rn];
- } else if ((opcode & 0x0C000000) == 0x04000000) {
- // STR/LDR
- Rn = (opcode >> 16) & 0x0F;
- if (opcode & 0x02000000) {
- // Register offset
- Rm = opcode & 0x0F;
- if (opcode & 0x01000000) {
- unsigned short shift = (unsigned short)((opcode >> 4) & 0xFF) ;
- // pre indexing
- long Offset = ARMShift(exceptionRegisters[Rm],shift);
- // add or sub the offset depending on the U-Bit
- return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset);
- } else {
- // post indexing
- return exceptionRegisters[Rn];
- }
- } else {
- // Immediate offset
- unsigned long Offset = (opcode & 0xFFF) ;
- if (opcode & 0x01000000) {
- // pre indexing
- // add or sub the offset depending on the U-Bit
- return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset);
- } else {
- // post indexing
- return exceptionRegisters[Rn];
- }
- }
- } else if ((opcode & 0x0E400F90) == 0x00000090) {
- // LDRH/STRH with register Rm
- Rn = (opcode >> 16) & 0x0F;
- Rd = (opcode >> 12) & 0x0F;
- Rm = opcode & 0x0F;
- unsigned short shift = (unsigned short)((opcode >> 4) & 0xFF);
- long Offset = ARMShift(exceptionRegisters[Rm],shift);
- // add or sub the offset depending on the U-Bit
- return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset);
- } else if ((opcode & 0x0E400F90) == 0x00400090) {
- // LDRH/STRH with immediate offset
- Rn = (opcode >> 16) & 0x0F;
- Rd = (opcode >> 12) & 0x0F;
- unsigned long Offset = (opcode & 0xF) | ((opcode & 0xF00)>>8) ;
- // add or sub the offset depending on the U-Bit
- return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset) ;
- } else if ((opcode & 0x0E000000) == 0x08000000) {
- // LDM/STM
- Rn = (opcode >> 16) & 0x0F;
- return exceptionRegisters[Rn];
- }
- }
- return 0;
-}
-
-static const char *registerNames[] =
- { "r0","r1","r2","r3","r4","r5","r6","r7",
- "r8 ","r9 ","r10","r11","r12","sp ","lr ","pc " };
-
-//---------------------------------------------------------------------------------
-static void defaultHandler(void) {
-//---------------------------------------------------------------------------------
- videoSetMode(0);
- videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
- vramSetBankC(VRAM_C_SUB_BG);
-
- SUB_BG0_CR = BG_MAP_BASE(31);
-
- BG_PALETTE_SUB[0] = RGB15(31,0,0);
- BG_PALETTE_SUB[255] = RGB15(31,31,31);
-
- consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
-
- iprintf("\x1b[5CGuru Meditation Error!\n");
- u32 currentMode = getCPSR() & 0x1f;
- u32 thumbState = ((*(u32*)0x027FFD90) & 0x20);
-
- u32 codeAddress, exceptionAddress = 0;
-
- int offset = 8;
-
- if ( currentMode == 0x17 ) {
- iprintf ("\x1b[10Cdata abort!\n\n");
- codeAddress = exceptionRegisters[15] - offset;
- if ( (codeAddress > 0x02000000 && codeAddress < 0x02400000) ||
- (codeAddress > (u32)bsp_section_fast_text_begin && codeAddress < (u32)(bsp_section_fast_text_begin + 32768)) )
- exceptionAddress = getExceptionAddress( codeAddress, thumbState);
- else
- exceptionAddress = codeAddress;
-
- } else {
- if (thumbState)
- offset = 2;
- else
- offset = 4;
- iprintf("\x1b[5Cundefined instruction!\n\n");
- codeAddress = exceptionRegisters[15] - offset;
- exceptionAddress = codeAddress;
- }
-
- iprintf(" pc: %08" PRIX32 " addr: %08" PRIX32 "\n\n",codeAddress,exceptionAddress);
-
- int i;
- for ( i=0; i < 8; i++ ) {
- iprintf( " %s: %08" PRIX32 " %s: %08" PRIX32 "\n",
- registerNames[i], exceptionRegisters[i],
- registerNames[i+8],exceptionRegisters[i+8]);
- }
- iprintf("\n");
- u32 *stack = (u32 *)exceptionRegisters[13];
- for ( i=0; i<10; i++ ) {
- iprintf( "\x1b[%d;2H%08" PRIX32 ": %08" PRIX32 " %08" PRIX32 "", i + 14, (u32)&stack[i*2],stack[i*2], stack[(i*2)+1] );
- }
- while(1);
-
-}
-
-//---------------------------------------------------------------------------------
-void defaultExceptionHandler() {
-//---------------------------------------------------------------------------------
- setExceptionHandler(defaultHandler) ;
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S
deleted file mode 100644
index 19a89573ec..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#define ICACHE_SIZE 0x2000
-#define DCACHE_SIZE 0x1000
-#define CACHE_LINE_SIZE 32
-//---------------------------------------------------------------------------------
- .arm
-//---------------------------------------------------------------------------------
- .global IC_InvalidateAll
-//---------------------------------------------------------------------------------
-IC_InvalidateAll:
-/*---------------------------------------------------------------------------------
- Clean and invalidate entire data cache
----------------------------------------------------------------------------------*/
- mov r0, #0
- mcr p15, 0, r0, c7, c5, 0
- bx lr
-
-//---------------------------------------------------------------------------------
- .global IC_InvalidateRange
-//---------------------------------------------------------------------------------
-IC_InvalidateRange:
-/*---------------------------------------------------------------------------------
- Invalidate a range
----------------------------------------------------------------------------------*/
- add r1, r1, r0
- bic r0, r0, #CACHE_LINE_SIZE - 1
-.invalidate:
- mcr p15, 0, r0, c7, c5, 1
- add r0, r0, #CACHE_LINE_SIZE
- cmp r0, r1
- blt .invalidate
- bx lr
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c
deleted file mode 100644
index bef1fa2fc0..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#include <nds/jtypes.h>
-#include <nds/arm9/image.h>
-#include <nds/dma.h>
-
-
-#include <malloc.h>
-
-//---------------------------------------------------------------------------------
-void image24to16(sImage* img) {
-//---------------------------------------------------------------------------------
-
- int x;
- int y;
-
- u16* temp = (u16*)malloc(img->height*img->width*2);
-
- for(y=0;y<img->height;y++)
- {
- for(x=0;x<img->width;x++)
- temp[x+y*img->width]=(1<<15)|RGB15(img->image.data8[x*3+y*img->width*3]>>3, \
- img->image.data8[x*3+y*img->width*3+1]>>3, img->image.data8[x*3+y*img->width*3+2]>>3);
- }
-
- free(img->image.data8);
-
- img->bpp=16;
- img->image.data16 = temp;
-}
-
-//---------------------------------------------------------------------------------
-void image8to16(sImage* img) {
-//---------------------------------------------------------------------------------
- int i;
-
- u16* temp = (u16*)malloc(img->height*img->width*2);
-
- for(i = 0; i < img->height * img->width; i++)
- temp[i] = img->palette[img->image.data8[i]] | (1<<15);
-
- free (img->image.data8);
- free (img->palette);
-
- img->bpp = 16;
- img->image.data16 = temp;
-}
-
-//---------------------------------------------------------------------------------
-void image8to16trans(sImage* img, u8 transparentColor) {
-//---------------------------------------------------------------------------------
- int i;
- u8 c;
-
- u16* temp = (u16*)malloc(img->height*img->width*2);
-
- for(i = 0; i < img->height * img->width; i++) {
-
- c = img->image.data8[i];
-
- if(c != transparentColor)
- temp[i] = img->palette[c] | (1<<15);
- else
- temp[i] = img->palette[c];
- }
-
- free (img->image.data8);
- free (img->palette);
-
- img->bpp = 16;
- img->image.data16 = temp;
-}
-//---------------------------------------------------------------------------------
-void imageTileData(sImage* img) {
-//---------------------------------------------------------------------------------
- u32* temp;
-
- int ix, iy, tx, ty;
-
- int th, tw;
-
- int i = 0;
-
- //can only tile 8 bit data that is a multiple of 8 in dimention
- if(img->bpp != 8 || (img->height & 3) != 0 || (img->width & 3) != 0) return;
-
- th = img->height >> 3;
- tw = img->width >> 3;
-
- //buffer to hold data
- temp = (u32*)malloc(img->height * img->width);
-
- for(ty = 0; ty < th; ty++)
- for(tx = 0; tx < tw; tx++)
- for(iy = 0; iy < 8; iy++)
- for(ix = 0; ix < 2; ix++)
- temp[i++] = img->image.data32[ix + tx * 2 + (iy + ty * 8) * tw * 2 ];
-
- free(img->image.data32);
-
- img->image.data32 = (unsigned int *)temp;
-}
-
-//---------------------------------------------------------------------------------
-void imageDestroy(sImage* img) {
-//---------------------------------------------------------------------------------
- if(img->image.data8) free (img->image.data8);
- if(img->palette && img->bpp == 8) free (img->palette);
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c
deleted file mode 100644
index da401ac506..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- initSystem.c -- Code for initialising the DS
-
- Copyright (C) 2007
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#include <nds/jtypes.h>
-#include <nds/system.h>
-#include <nds/memory.h>
-#include <nds/timers.h>
-#include <nds/dma.h>
-#include <nds/ipc.h>
-#include <nds/arm9/video.h>
-
-#include <time.h>
-
-/*
- * Prototypes
- *
- * NOTE: Called from start.S
- */
-void initSystem(void);
-
-extern time_t *punixTime;
-
-//---------------------------------------------------------------------------------
-// Reset the DS registers to sensible defaults
-//---------------------------------------------------------------------------------
-void initSystem(void) {
-//---------------------------------------------------------------------------------
- register int i;
-
- //clear out ARM9 DMA channels
- for (i=0; i<4; i++) {
- DMA_CR(i) = 0;
- DMA_SRC(i) = 0;
- DMA_DEST(i) = 0;
- TIMER_CR(i) = 0;
- TIMER_DATA(i) = 0;
- }
-
- VRAM_CR = 0x80808080;
- VRAM_E_CR = 0x80;
- VRAM_F_CR = 0x80;
- VRAM_G_CR = 0x80;
- VRAM_H_CR = 0x80;
- VRAM_I_CR = 0x80;
-
- (*(vu32*)0x027FFE04) = 0; // temporary variable
- PALETTE[0] = 0xFFFF;
- dmaFillWords((void*)0x027FFE04, PALETTE+1, (2*1024)-2);
- dmaFillWords((void*)0x027FFE04, OAM, 2*1024);
- dmaFillWords((void*)0x027FFE04, (void*)0x04000000, 0x56); //clear main display registers
- dmaFillWords((void*)0x027FFE04, (void*)0x04001000, 0x56); //clear sub display registers
- dmaFillWords((void*)0x027FFE04, VRAM, 656*1024);
-
- REG_DISPSTAT = 0;
- videoSetMode(0);
- videoSetModeSub(0);
- VRAM_A_CR = 0;
- VRAM_B_CR = 0;
- VRAM_C_CR = 0;
- VRAM_D_CR = 0;
- VRAM_E_CR = 0;
- VRAM_F_CR = 0;
- VRAM_G_CR = 0;
- VRAM_H_CR = 0;
- VRAM_I_CR = 0;
- VRAM_CR = 0x03000000;
-
- punixTime = (time_t*)&IPC->unixTime;
-
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c
deleted file mode 100644
index 8f71d96682..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*------------------------------------------------------------------------------
- key input code -- provides slightly higher level input forming
-
- Copyright (C) 2005
- Christian Auby (DesktopMan)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
-------------------------------------------------------------------------------*/
-
-#include <stdlib.h>
-
-#include <nds/ipc.h>
-#include <nds/system.h>
-#include <nds/arm9/input.h>
-
-//------------------------------------------------------------------------------
-
-#define KEYS_CUR (( ((~REG_KEYINPUT)&0x3ff) | (((~IPC->buttons)&3)<<10) | (((~IPC->buttons)<<6) & (KEY_TOUCH|KEY_LID) ))^KEY_LID)
-
-static uint16 keys = 0;
-static uint16 keysold = 0;
-static uint16 keysrepeat = 0;
-
-static u8 delay = 60, repeat = 30, count = 60;
-
-//------------------------------------------------------------------------------
-void scanKeys(void) {
-//------------------------------------------------------------------------------
- keysold = keys;
- keys = KEYS_CUR;
-
- if ( delay != 0 ) {
- if ( keys != keysold ) {
- count = delay ;
- keysrepeat = keysDown() ;
- }
- count--;
- if ( count == 0 ) {
- count = repeat;
- keysrepeat = keys;
- }
- }
-}
-
-//------------------------------------------------------------------------------
-uint32 keysHeld(void) {
-//------------------------------------------------------------------------------
- return keys;
-}
-
-//------------------------------------------------------------------------------
-uint32 keysDown(void) {
-//------------------------------------------------------------------------------
- return (keys ^ keysold) & keys;
-}
-
-//------------------------------------------------------------------------------
-uint32 keysDownRepeat(void) {
-//------------------------------------------------------------------------------
- uint32 tmp = keysrepeat;
-
- keysrepeat = 0;
-
- return tmp;
-}
-
-//------------------------------------------------------------------------------
-void keysSetRepeat( u8 setDelay, u8 setRepeat ) {
-//------------------------------------------------------------------------------
- delay = setDelay ;
- repeat = setRepeat ;
- count = delay ;
- keysrepeat = 0 ;
-}
-
-//------------------------------------------------------------------------------
-uint32 keysUp(void) {
-//------------------------------------------------------------------------------
- return (keys ^ keysold) & (~keys);
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c
deleted file mode 100644
index 1faadcd5de..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/*---------------------------------------------------------------------------------
- DS Motion Card/DS Motion Pak functionality
-
- Copyright (C) 2007
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Keith Epstein (KeithE)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include <nds/card.h>
-#include <nds/system.h>
-#include <nds/memory.h>
-#include <nds/bios.h>
-#include <nds/arm9/ndsmotion.h>
-
-#define WAIT_CYCLES 185
-
-#define CARD_WaitBusy() while (CARD_CR1 & /*BUSY*/0x80);
-
-// enables SPI bus at 4.19 MHz
-#define SPI_On() CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40 | 0;
-
-// disables SPI bus
-#define SPI_Off() CARD_CR1 = 0;
-
-// Volatile GBA bus SRAM for reading from DS Motion Pak
-#define V_SRAM ((volatile unsigned char*)0x0A000000)
-
-
-int card_type = -1;
-
-//these are the default calibration values for sensitivity and offset
-MotionCalibration calibration = {2048, 2048, 2048, 1680, 819, 819, 819, 825};
-
-// sends and receives 1 byte on the SPI bus
-static unsigned char motion_spi(unsigned char in_byte){
-
- unsigned char out_byte;
- CARD_EEPDATA = in_byte; // send the output byte to the SPI bus
- CARD_WaitBusy(); // wait for transmission to complete
- out_byte=CARD_EEPDATA; // read the input byte from the SPI bus
- return out_byte;
-}
-
-
-static void motion_MK6_sensor_mode(void) {
- // send some commands on the SPI bus
- SPI_On()
- motion_spi(0xFE);
- SPI_Off()
- SPI_On()
- motion_spi(0xFD);
- SPI_Off()
- SPI_On()
- motion_spi(0xFB);
- SPI_Off()
- SPI_On()
- motion_spi(0xF8);
- SPI_Off()
-}
-
-static void motion_MK6_EEPROM_mode(void) {
- // send some commands on the SPI bus
- SPI_On()
- motion_spi(0xFE);
- SPI_Off()
- SPI_On()
- motion_spi(0xFD);
- SPI_Off()
- SPI_On()
- motion_spi(0xFB);
- SPI_Off()
- SPI_On()
- motion_spi(0xF9);
- SPI_Off()
-}
-
-// checks whether a DS Motion Pak is plugged in
-static int motion_pak_is_inserted(void){
- int motion_pak = 0;
- unsigned char return_byte = V_SRAM[10]; // read first byte of DS Motion Pak check
- swiDelay(WAIT_CYCLES);
- return_byte = V_SRAM[0];
- swiDelay(WAIT_CYCLES);
- if (return_byte==0xF0) { // DS Motion Pak returns 0xF0
- return_byte = V_SRAM[0]; // read second byte of DS Motion Pak check
- swiDelay(WAIT_CYCLES);
- if(return_byte==0x0F) { // DS Motion Pak returns 0x0F
- motion_pak = 1;
- }
- }
- return motion_pak;
-}
-
-// checks whether a DS Motion Card is plugged in
-// this only works after motion_init()
-// it will return false if it is run before motion_init()
-static int motion_card_is_inserted(void){
- // send 0x03 to read from DS Motion Card control register
- SPI_On()
- motion_spi(0x03); // command to read from control register
- // if the control register is 0x04 then the enable was successful
- if( motion_spi(0x00) == 0x04)
- {
- SPI_Off()
- return 1;
- }
- SPI_Off();
- return 0;
-}
-
-// turn on the DS Motion Sensor (DS Motion Pak or DS Motion Card)
-// Requires knowing which type is present (can be found by using motion_init)
-static int motion_enable(int card_type) {
- switch (card_type)
- {
- case 1: // DS Motion Pak - automatically enabled on powerup
- // check to see whether Motion Pak is alive
- return motion_pak_is_inserted();
- break;
- case 2: // DS Motion Card
- // send 0x04, 0x04 to enable
- SPI_On()
- motion_spi(0x04); // command to write to control register
- motion_spi(0x04); // enable
- SPI_Off()
- // check to see whether Motion Card is alive
- return motion_card_is_inserted();
- break;
- case 3: // MK6 - same command as DS Motion Card
- // send 0x04, 0x04 to enable
- SPI_On()
- motion_spi(0x04); // command to write to control register
- motion_spi(0x04); // enable
- SPI_Off()
- // check to see whether Motion Card is alive
- return motion_card_is_inserted();
- break;
- default: // if input parameter is not recognized, return 0
- return 0;
- break;
- }
-}
-
-// Initialize the DS Motion Sensor
-// Determines which DS Motion Sensor is present
-// Turns it on
-// Does not require knowing which type is present
-int motion_init(void) {
- sysSetBusOwners(true, true);
- // first, check for the DS Motion Pak - type 1
- if( motion_pak_is_inserted() == 1 )
- {
- card_type = 1;
- return 1;
- }// next, check for DS Motion Card - type 2
- if( motion_enable(2) == 1 )
- {
- card_type = 2;
- return 2;
- }
-
- motion_MK6_sensor_mode(); // send command to switch MK6 to sensor mode
-
- if( motion_enable(3) == 1 )
- {
- card_type = 3;
- return 3;
- }// if neither cases are true, then return 0 to indicate no DS Motion Sensor
- return 0;
-}
-
-// Deinitialize the DS Motion Sensor
-// In the case of a DS Motion Pak, do nothing - there is nothing to de-init
-// In the case of a DS Motion Card, turns off the accelerometer
-// In the case of an MK6, turns off accelerometer and switches out of sensor mode into EEPROM mode
-void motion_deinit(void) {
- // DS Motion Card - turn off accelerometer
- SPI_On()
- motion_spi(0x04); // command to write to control register
- motion_spi(0x00); // turn it off
- SPI_Off()
- // MK6 - switch to EEPROM mode
- motion_MK6_EEPROM_mode(); // switch MK6 to EEPROM mode
-}
-
-// read the X acceleration
-signed int motion_read_x(void) {
- unsigned char High_byte = 0;
- unsigned char Low_byte = 0;
- signed int output = 0;
- switch(card_type)
- {
- case 1: // DS Motion Pak
- High_byte = V_SRAM[2]; // Command to load X High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
- break;
- case 2: // DS Motion Card
- SPI_On()
- motion_spi(0x00); // command to convert X axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- case 3: // MK6 - same command as DS Motion Card
- SPI_On()
- motion_spi(0x00); // command to convert X axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- default:
- return 0;
- break;
- }
-}
-
-// read the Y acceleration
-signed int motion_read_y(void) {
- unsigned char High_byte = 0;
- unsigned char Low_byte = 0;
- signed int output = 0;
- switch (card_type)
- {
- case 1: // DS Motion Pak
- High_byte = V_SRAM[4]; // Command to load Y High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
- break;
- case 2: // DS Motion Card
- SPI_On()
- motion_spi(0x02); // command to convert Y axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- case 3: // MK6 - same command as DS Motion Card
- SPI_On()
- motion_spi(0x02); // command to convert Y axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- default:
- return 0;
- break;
- }
-}
-
-// read the Z acceleration
-signed int motion_read_z(void) {
- unsigned char High_byte = 0;
- unsigned char Low_byte = 0;
- signed int output = 0;
- switch (card_type)
- {
- case 1: // DS Motion Pak
- High_byte = V_SRAM[6]; // Command to load Z High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
- break;
- case 2: // DS Motion Card
- SPI_On()
- motion_spi(0x01); // command to convert Z axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- case 3: // MK6 - same command as DS Motion Card
- SPI_On()
- motion_spi(0x01); // command to convert Z axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- default:
- return 0;
- break;
- }
-}
-
-// read the Z rotation (gyro)
-signed int motion_read_gyro(void) {
- unsigned char High_byte = 0;
- unsigned char Low_byte = 0;
- signed int output = 0;
- switch (card_type)
- {
- case 1: // DS Motion Pak
- High_byte = V_SRAM[8]; // Command to load Gyro High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
- break;
- case 2: // DS Motion Card
- SPI_On()
- motion_spi(0x07); // command to convert Gyro axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- case 3: // MK6 - same command as DS Motion Card
- SPI_On()
- motion_spi(0x07); // command to convert Gyro axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- default:
- return 0;
- break;
- }
-}
-
-//gets acceleration value in mili G (where g is 9.8 m/s*s)
-int motion_acceleration_x(void){
- int accel = motion_read_x();
- return (accel - calibration.xoff) * 1000 / calibration.xsens;
-}
-
-//gets acceleration value in mili G (where g is 9.8 m/s*s)
-int motion_acceleration_y(void){
- int accel = motion_read_y();
- return (accel - calibration.yoff) * 1000 / calibration.ysens;
-}
-//gets acceleration value in mili G (where g is 9.8 m/s*s)
-int motion_acceleration_z(void){
- int accel = motion_read_z();
- return (accel - calibration.zoff) * 1000 / calibration.zsens;
-}
-
-//converts raw rotation value to degrees per second
-int motion_rotation(void){
- int rotation = motion_read_gyro();
- return (rotation - calibration.goff) * 1000 / calibration.gsens;
-}
-
-//this should be passed the raw reading at 1g for accurate
-//acceleration calculations. Default is 819
-void motion_set_sens_x(int sens){
- calibration.xsens = sens - calibration.xoff;
-}
-
-//this should be passed the raw reading at 1g for accurate
-//acceleration calculations. Default is 819
-void motion_set_sens_y(int sens){
- calibration.ysens = sens - calibration.yoff;
-}
-
-//this should be passed the raw reading at 1g for accurate
-//acceleration calculations. Default is 819
-void motion_set_sens_z(int sens){
- calibration.zsens = sens - calibration.zoff;
-}
-
-//this should be passed the raw reading at 1g for accurate
-//acceleration calculations. Default is 825
-void motion_set_sens_gyro(int sens){
- calibration.gsens = sens;
-}
-
-//this should be called when the axis is under no acceleration
-//default is 2048
-void motion_set_offs_x(void){
- calibration.xoff = motion_read_x();
-}
-
-//this should be called when the axis is under no acceleration
-//default is 2048
-void motion_set_offs_y(void){
- calibration.yoff = motion_read_y();
-}
-
-//this should be called when the axis is under no acceleration
-//default is 2048
-void motion_set_offs_z(void){
- calibration.zoff = motion_read_z();
-}
-
-//this should be called when the axis is under no acceleration
-//default is 1680
-void motion_set_offs_gyro(void){
- calibration.goff = motion_read_gyro();
-}
-
-MotionCalibration* motion_get_calibration(void){
- return &calibration;
-}
-
-void motion_set_calibration(MotionCalibration* cal){
- calibration.xsens = cal->xsens;
- calibration.ysens = cal->ysens;
- calibration.zsens = cal->zsens;
- calibration.gsens = cal->gsens;
- calibration.xoff = cal->xoff;
- calibration.yoff = cal->yoff;
- calibration.zoff = cal->zoff;
- calibration.goff = cal->goff;
-}
-
-// enable analog input number 1 (ain_1)
-void motion_enable_ain_1(void){
- unsigned char return_byte;
- (void) return_byte; /* avoid set but unused warning */
- return_byte = V_SRAM[16];
- swiDelay(WAIT_CYCLES);
-}
-
-// enable analog input number 2 (ain_2)
-void motion_enable_ain_2(void){
- unsigned char return_byte;
- (void) return_byte; /* avoid set but unused warning */
- return_byte = V_SRAM[18];
- swiDelay(WAIT_CYCLES);
-}
-
-// read from the analog input number 1 - requires enabling ain_1 first
-int motion_read_ain_1(void){
- unsigned char High_byte = V_SRAM[12]; // Command to load AIN_1 High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- unsigned char Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- signed int output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
-}
-
-// read from the analog input number 2 - requires enabling ain_2 first
-int motion_read_ain_2(void){
- unsigned char High_byte = V_SRAM[14]; // Command to load AIN_1 High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- unsigned char Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- signed int output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c
deleted file mode 100644
index 292f70fb6c..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#include <nds/jtypes.h>
-#include <nds/arm9/video.h>
-#include <nds/arm9/image.h>
-#include <malloc.h>
-
-//---------------------------------------------------------------------------------
-int loadPCX(unsigned char* pcx, sImage* image) {
-//---------------------------------------------------------------------------------
- //struct rgb {unsigned char b,g,r;};
- RGB_24* pal;
-
- PCXHeader* hdr = (PCXHeader*) pcx;
-
- pcx += sizeof(PCXHeader);
-
- unsigned char c;
- int size;
- int count;
- int run;
- int i;
-
- image->width = hdr->xmax - hdr->xmin + 1 ;
- image->height = hdr->ymax - hdr->ymin + 1;
-
- size = image->width *image->height;
-
- image->image.data8 = (unsigned char*)malloc(size);
- image->palette = (unsigned short*)malloc(256 * 2);
-
- if(hdr->bitsPerPixel != 8)
- return 0;
-
- count = 0;
-
- while(count < size) {
- c = *pcx++;
-
- if(c < 192) {
- image->image.data8[count++] = c;
- } else {
- run = c - 192;
-
- c = *pcx++;
-
- for(i = 0; i < run; i++)
- image->image.data8[count++] = c;
- }
- }
-
- pal = (RGB_24*)(pcx + 1);
-
- image->bpp = 8;
-
- for(i = 0; i < 256; i++)
- {
- u8 r = (pal[i].r + 4 > 255) ? 255 : (pal[i].r + 4);
- u8 g = (pal[i].g + 4 > 255) ? 255 : (pal[i].g + 4);
- u8 b = (pal[i].b + 4 > 255) ? 255 : (pal[i].b + 4);
- image->palette[i] = RGB15(r >> 3 , g >> 3 , b >> 3) ;
- }
- return 1;
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c
deleted file mode 100644
index fc340cd07a..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Mike Parks (BigRedPimp)
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#include <nds/jtypes.h>
-#include <nds/memory.h>
-#include <nds/arm9/rumble.h>
-
-static RUMBLE_TYPE rumbleType;
-
-//---------------------------------------------------------------------------------
-bool isRumbleInserted(void) {
-//---------------------------------------------------------------------------------
- uint16 four[4];
- sysSetCartOwner(BUS_OWNER_ARM9);
- // First, check for 0x96 to see if it's a GBA game
- if (GBA_HEADER.is96h == 0x96) {
-
- //if it is a game, we check the game code
- //to see if it is warioware twisted
- if ( (GBA_HEADER.gamecode[0] == 'R') &&
- (GBA_HEADER.gamecode[1] == 'Z') &&
- (GBA_HEADER.gamecode[2] == 'W') &&
- (GBA_HEADER.gamecode[3] == 'E')
- )
- {
- rumbleType = WARIOWARE;
- WARIOWARE_ENABLE = 8;
- return true;
- }
- return false;
-
- } else {
-
- rumbleType = RUMBLE;
- // Now check to see if it's true open bus, or if D1 is pulled low
- four[0] = GBA_BUS[0] & 0xFF;
- four[1] = GBA_BUS[1] & 0xFF;
- four[2] = GBA_BUS[2] & 0xFF;
- four[3] = GBA_BUS[3] & 0xFF;
- return (four[0] == 0x00) && (four[2] == 0x00) && (four[1] == 0x01) && (four[3] == 0x01);
- }
-}
-//---------------------------------------------------------------------------------
-void setRumble(bool position) {
-//---------------------------------------------------------------------------------
-
- if( rumbleType == WARIOWARE) {
- WARIOWARE_PAK = (position ? 8 : 0);
- } else {
- RUMBLE_PAK = (position ? 2 : 0);
- }
-
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c
deleted file mode 100644
index 7f03f69f19..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*---------------------------------------------------------------------------------
- Sound Functions
-
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#include <nds/arm9/sound.h>
-#include <nds/arm9/cache.h>
-#include <string.h>
-
-//---------------------------------------------------------------------------------
-static void playSoundBlock(TransferSound *snd) {
-//---------------------------------------------------------------------------------
- DC_FlushRange( snd, sizeof(TransferSound) );
-
- IPC->soundData = snd;
-}
-
-//---------------------------------------------------------------------------------
-static TransferSound Snd;
-static TransferSoundData SndDat = { (void *)0 , 0, 11025, 64, 64, 1 };
-
-//---------------------------------------------------------------------------------
-void setGenericSound( u32 rate, u8 vol, u8 pan, u8 format) {
-//---------------------------------------------------------------------------------
-
- SndDat.rate = rate;
- SndDat.vol = vol;
- SndDat.pan = pan;
- SndDat.format = format;
-}
-
-//---------------------------------------------------------------------------------
-void playSound( pTransferSoundData sound) {
-//---------------------------------------------------------------------------------
- Snd.count = 1;
-
- memcpy( &Snd.data[0], sound, sizeof(TransferSoundData) );
-
- playSoundBlock(&Snd);
-
-}
-
-//---------------------------------------------------------------------------------
-void playGenericSound(const void* data, u32 length) {
-//---------------------------------------------------------------------------------
- Snd.count = 1;
-
- memcpy( &Snd.data[0], &SndDat, sizeof(TransferSoundData) );
- Snd.data[0].data = data;
- Snd.data[0].len = length;
-
- playSoundBlock(&Snd);
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c
deleted file mode 100644
index aea29bad69..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*---------------------------------------------------------------------------------
-
-system.c -- System code
-
-Copyright (C) 2005
-Michael Noland (joat)
-Jason Rogers (dovoto)
-Dave Murphy (WinterMute)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you
-must not claim that you wrote the original software. If you use
-this software in a product, an acknowledgment in the product
-documentation would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-
----------------------------------------------------------------------------------*/
-
-#include <nds/memory.h>
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c
deleted file mode 100644
index 9417d03577..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*---------------------------------------------------------------------------------
- touch screen input code
-
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-//#include <nds.h>
-
-#include <nds/ipc.h>
-#include <nds/arm9/input.h>
-
-//---------------------------------------------------------------------------------
-touchPosition touchReadXY() {
-//---------------------------------------------------------------------------------
-
- touchPosition touchPos;
-
- touchPos.x = IPC->touchX;
- touchPos.y = IPC->touchY;
-
- touchPos.px = IPC->touchXpx;
- touchPos.py = IPC->touchYpx;
-
- return touchPos;
-
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c
deleted file mode 100644
index 6b516db57c..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c
+++ /dev/null
@@ -1,122 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-// video.cpp -- Vram control
-//
-// version 0.1, February 19, 2005
-//
-// Copyright (C) 2005 Michael Noland (joat) and Jason Rogers (dovoto)
-//
-// This software is provided 'as-is', without any express or implied
-// warranty. In no event will the authors be held liable for any
-// damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any
-// purpose, including commercial applications, and to alter it and
-// redistribute it freely, subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented; you
-// must not claim that you wrote the original software. If you use
-// this software in a product, an acknowledgment in the product
-// documentation would be appreciated but is not required.
-// 2. Altered source versions must be plainly marked as such, and
-// must not be misrepresented as being the original software.
-// 3. This notice may not be removed or altered from any source
-// distribution.
-//
-// Changelog:
-// 0.1: First version
-//
-//////////////////////////////////////////////////////////////////////
-
-#include <nds/jtypes.h>
-#include <nds/arm9/video.h>
-
-//////////////////////////////////////////////////////////////////////
-
-uint32 vramSetMainBanks(VRAM_A_TYPE a, VRAM_B_TYPE b, VRAM_C_TYPE c, VRAM_D_TYPE d)
-{
- uint32 vramTemp = VRAM_CR;
-
- VRAM_A_CR = VRAM_ENABLE | a;
- VRAM_B_CR = VRAM_ENABLE | b;
- VRAM_C_CR = VRAM_ENABLE | c;
- VRAM_D_CR = VRAM_ENABLE | d;
-
- return vramTemp;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////
-
-void vramRestoreMainBanks(uint32 vramTemp); /* used in videoGL.c */
-void vramRestoreMainBanks(uint32 vramTemp)
-{
- VRAM_CR = vramTemp;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankA(VRAM_A_TYPE a)
-{
- VRAM_A_CR = VRAM_ENABLE | a;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankB(VRAM_B_TYPE b)
-{
- VRAM_B_CR = VRAM_ENABLE | b;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankC(VRAM_C_TYPE c)
-{
- VRAM_C_CR = VRAM_ENABLE | c;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankD(VRAM_D_TYPE d)
-{
- VRAM_D_CR = VRAM_ENABLE | d;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankE(VRAM_E_TYPE e)
-{
- VRAM_E_CR = VRAM_ENABLE | e;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankF(VRAM_F_TYPE f)
-{
- VRAM_F_CR = VRAM_ENABLE | f;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankG(VRAM_G_TYPE g)
-{
- VRAM_G_CR = VRAM_ENABLE | g;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankH(VRAM_H_TYPE h)
-{
- VRAM_H_CR = VRAM_ENABLE | h;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankI(VRAM_I_TYPE i)
-{
- VRAM_I_CR = VRAM_ENABLE | i;
-}
-
-//////////////////////////////////////////////////////////////////////
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c
deleted file mode 100644
index 013e666acd..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c
+++ /dev/null
@@ -1,424 +0,0 @@
-/*---------------------------------------------------------------------------------
- Video API vaguely similar to OpenGL
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
-
----------------------------------------------------------------------------------*/
-
-#include <nds/jtypes.h>
-#include <nds/memory.h>
-#include <nds/bios.h>
-#include <nds/arm9/math.h>
-#include <nds/arm9/video.h>
-#include <nds/arm9/videoGL.h>
-#include <nds/arm9/trig_lut.h>
-
-// this is the actual data of the globals for videoGL
-// Please use the glGlob pointer to access this data since that makes it easier to move stuff in/out of the header.
-static gl_hidden_globals glGlobalData;
-
-// This returns the pointer to the globals for videoGL
-gl_hidden_globals* glGetGlobals() {
- return &glGlobalData;
-}
-
-//---------------------------------------------------------------------------------
-void glRotatef32i(int angle, int32 x, int32 y, int32 z) {
-//---------------------------------------------------------------------------------
- int32 axis[3];
- int32 sine = SIN[angle & LUT_MASK];
- int32 cosine = COS[angle & LUT_MASK];
- int32 one_minus_cosine = inttof32(1) - cosine;
-
- axis[0]=x;
- axis[1]=y;
- axis[2]=z;
-
- normalizef32(axis); // should require passed in normalized?
-
- MATRIX_MULT3x3 = cosine + mulf32(one_minus_cosine, mulf32(axis[0], axis[0]));
- MATRIX_MULT3x3 = mulf32(one_minus_cosine, mulf32(axis[0], axis[1])) - mulf32(axis[2], sine);
- MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[0]), axis[2]) + mulf32(axis[1], sine);
-
- MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[0]), axis[1]) + mulf32(axis[2], sine);
- MATRIX_MULT3x3 = cosine + mulf32(mulf32(one_minus_cosine, axis[1]), axis[1]);
- MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[1]), axis[2]) - mulf32(axis[0], sine);
-
- MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[0]), axis[2]) - mulf32(axis[1], sine);
- MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[1]), axis[2]) + mulf32(axis[0], sine);
- MATRIX_MULT3x3 = cosine + mulf32(mulf32(one_minus_cosine, axis[2]), axis[2]);
-}
-
-
-
-
-//---------------------------------------------------------------------------------
-void glMaterialf(GL_MATERIALS_ENUM mode, rgb color) {
-//---------------------------------------------------------------------------------
- static uint32 diffuse_ambient = 0;
- static uint32 specular_emission = 0;
-
- switch(mode) {
- case GL_AMBIENT:
- diffuse_ambient = (color << 16) | (diffuse_ambient & 0xFFFF);
- break;
- case GL_DIFFUSE:
- diffuse_ambient = color | (diffuse_ambient & 0xFFFF0000);
- break;
- case GL_AMBIENT_AND_DIFFUSE:
- diffuse_ambient= color + (color << 16);
- break;
- case GL_SPECULAR:
- specular_emission = color | (specular_emission & 0xFFFF0000);
- break;
- case GL_SHININESS:
- break;
- case GL_EMISSION:
- specular_emission = (color << 16) | (specular_emission & 0xFFFF);
- break;
- }
-
- GFX_DIFFUSE_AMBIENT = diffuse_ambient;
- GFX_SPECULAR_EMISSION = specular_emission;
-}
-
-//---------------------------------------------------------------------------------
-void glInit_C(void) {
-//---------------------------------------------------------------------------------
- glGlob = glGetGlobals();
-
- glGlob->clearColor = 0;
-
- // init texture globals
- glGlob->activeTexture = 0;
- glGlob->nextBlock = (uint32*)0x06800000;
- glGlob->nextPBlock = 0;
- glGlob->nameCount = 1;
-
- while (GFX_STATUS & (1<<27)); // wait till gfx engine is not busy
-
- // Clear the FIFO
- GFX_STATUS |= (1<<29);
-
- // Clear overflows from list memory
- glResetMatrixStack();
-
- // prime the vertex/polygon buffers
- glFlush(0);
-
- // reset the control bits
- GFX_CONTROL = 0;
-
- // reset the rear-plane(a.k.a. clear color) to black, ID=0, and opaque
- glClearColor(0,0,0,31);
- glClearPolyID(0);
-
- // reset stored texture locations
- glResetTextures();
-
- // reset the depth to it's max
- glClearDepth(GL_MAX_DEPTH);
-
- GFX_TEX_FORMAT = 0;
- GFX_POLY_FORMAT = 0;
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
-}
-
-//---------------------------------------------------------------------------------
-void glResetTextures(void) {
-//---------------------------------------------------------------------------------
- glGlob->activeTexture = 0;
- glGlob->nextBlock = (uint32*)0x06800000;
- glGlob->nextPBlock = 0;
- glGlob->nameCount = 1;
-}
-
-//---------------------------------------------------------------------------------
-// glGenTextures creates integer names for your table
-// takes n as the number of textures to generate and
-// a pointer to the names array that it needs to fill.
-// Returns 1 if succesful and 0 if out of texture names
-//---------------------------------------------------------------------------------
-
-int glGenTextures(int n, int *names) {
-//---------------------------------------------------------------------------------
- int index = 0;
- for(index = 0; index < n; index++) {
- if(glGlob->nameCount >= MAX_TEXTURES)
- return 0;
- else
- names[index] = glGlob->nameCount++;
- }
- return 1;
-}
-
-//---------------------------------------------------------------------------------
-// glBindTexure sets the current named
-// texture to the active texture. Target
-// is ignored as all DS textures are 2D
-//---------------------------------------------------------------------------------
-void glBindTexture(int target, int name) {
-//---------------------------------------------------------------------------------
- if (name == 0)
- GFX_TEX_FORMAT = 0;
- else
- GFX_TEX_FORMAT = glGlob->textures[name];
-
-
- glGlob->activeTexture = name;
-}
-//---------------------------------------------------------------------------------
-// glColorTable establishes the location of the current palette.
-// Roughly follows glColorTableEXT. Association of palettes with
-// named textures is left to the application.
-//---------------------------------------------------------------------------------
-void glColorTable( uint8 format, uint32 addr ) {
-//---------------------------------------------------------------------------------
- GFX_PAL_FORMAT = addr>>(4-(format==GL_RGB4));
-}
-
-//---------------------------------------------------------------------------------
-//---------------------------------------------------------------------------------
-void glTexCoord2f32(int32 u, int32 v) {
-//---------------------------------------------------------------------------------
- int x, y;
-
- x = ((glGlob->textures[glGlob->activeTexture]) >> 20) & 7;
- y = ((glGlob->textures[glGlob->activeTexture]) >> 23) & 7;
-
- glTexCoord2t16(f32tot16 (mulf32(u,inttof32(8<<x))), f32tot16 (mulf32(v,inttof32(8<<y))));
-}
-
-//---------------------------------------------------------------------------------
-// glTexParameter although named the same
-// as its gl counterpart it is not compatible
-// Effort may be made in the future to make it so.
-//---------------------------------------------------------------------------------
-void glTexParameter( uint8 sizeX, uint8 sizeY,
- const uint32* addr,
- GL_TEXTURE_TYPE_ENUM mode,
- uint32 param) {
-//---------------------------------------------------------------------------------
- glGlob->textures[glGlob->activeTexture] = param | (sizeX << 20) | (sizeY << 23) | (((uint32)addr >> 3) & 0xFFFF) | (mode << 26);
-}
-//---------------------------------------------------------------------------------
-//glGetTexturePointer gets a pointer to vram which contains the texture
-//
-//---------------------------------------------------------------------------------
-void* glGetTexturePointer( int name) {
-//---------------------------------------------------------------------------------
- return (void*) ((glGlob->textures[name] & 0xFFFF) << 3);
-}
-
-//---------------------------------------------------------------------------------
-u32 glGetTexParameter(){
-//---------------------------------------------------------------------------------
- return glGlob->textures[glGlob->activeTexture];
-}
-
-
-//---------------------------------------------------------------------------------
-static inline uint32 alignVal( uint32 val, uint32 to ) {
- return (val & (to-1))? (val & ~(to-1)) + to : val;
-}
-
-//---------------------------------------------------------------------------------
-static int getNextPaletteSlot(u16 count, uint8 format) {
-//---------------------------------------------------------------------------------
- // ensure the result aligns on a palette block for this format
- uint32 result = alignVal(glGlob->nextPBlock, 1<<(4-(format==GL_RGB4)));
-
- // convert count to bytes and align to next (smallest format) palette block
- count = alignVal( count<<1, 1<<3 );
-
- // ensure that end is within palette video mem
- if( result+count > 0x10000 ) // VRAM_F - VRAM_E
- return -1;
-
- glGlob->nextPBlock = result+count;
- return (int)result;
-}
-
-//---------------------------------------------------------------------------------
-static uint16* vramGetBank(uint16 *addr) {
-//---------------------------------------------------------------------------------
- if(addr >= VRAM_A && addr < VRAM_B)
- return VRAM_A;
- else if(addr >= VRAM_B && addr < VRAM_C)
- return VRAM_B;
- else if(addr >= VRAM_C && addr < VRAM_D)
- return VRAM_C;
- else if(addr >= VRAM_D && addr < VRAM_E)
- return VRAM_D;
- else if(addr >= VRAM_E && addr < VRAM_F)
- return VRAM_E;
- else if(addr >= VRAM_F && addr < VRAM_G)
- return VRAM_F;
- else if(addr >= VRAM_G && addr < VRAM_H)
- return VRAM_H;
- else if(addr >= VRAM_H && addr < VRAM_I)
- return VRAM_H;
- else return VRAM_I;
-}
-
-
-//---------------------------------------------------------------------------------
-static int vramIsTextureBank(uint16 *addr) {
-//---------------------------------------------------------------------------------
- uint16* vram = vramGetBank(addr);
-
- if(vram == VRAM_A)
- {
- if((VRAM_A_CR & 3) == ((VRAM_A_TEXTURE) & 3))
- return 1;
- else return 0;
- }
- else if(vram == VRAM_B)
- {
- if((VRAM_B_CR & 3) == ((VRAM_B_TEXTURE) & 3))
- return 1;
- else return 0;
- }
- else if(vram == VRAM_C)
- {
- if((VRAM_C_CR & 3) == ((VRAM_C_TEXTURE) & 3))
- return 1;
- else return 0;
- }
- else if(vram == VRAM_D)
- {
- if((VRAM_D_CR & 3) == ((VRAM_D_TEXTURE) & 3))
- return 1;
- else return 0;
- }
- else
- return 0;
-}
-//---------------------------------------------------------------------------------
-static uint32* getNextTextureSlot(int size) {
-//---------------------------------------------------------------------------------
- uint32* result = glGlob->nextBlock;
- glGlob->nextBlock += size >> 2;
-
- //uh-oh...out of texture memory in this bank...find next one assigned to textures
- while(!vramIsTextureBank((uint16*)glGlob->nextBlock - 1) && glGlob->nextBlock <= (uint32*)VRAM_E)
- {
- glGlob->nextBlock = (uint32*)vramGetBank((uint16*)result) + (0x20000 >> 2); //next bank
- result = glGlob->nextBlock;
- glGlob->nextBlock += size >> 2;
- }
-
- if(glGlob->nextBlock > (uint32*)VRAM_E) {
- result = 0;
- }
- return result;
-}
-
-//---------------------------------------------------------------------------------
-// Similer to glTextImage2D from gl it takes a pointer to data
-// Empty fields and target are unused but provided for code compatibility.
-// type is simply the texture type (GL_RGB, GL_RGB8 ect...)
-//---------------------------------------------------------------------------------
-int glTexImage2D(int target, int empty1, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int empty2, int param, const uint8* texture) {
-//---------------------------------------------------------------------------------
- uint32 size = 0;
- uint32* addr;
- uint32 vramTemp;
-
- size = 1 << (sizeX + sizeY + 6);
-
-
- switch (type) {
- case GL_RGB:
- case GL_RGBA:
- size = size << 1;
- break;
- case GL_RGB4:
- size = size >> 2;
- break;
- case GL_RGB16:
- size = size >> 1;
- break;
- default:
- break;
- }
-
- addr = getNextTextureSlot(size);
-
- if(!addr)
- return 0;
-
- // unlock texture memory
- vramTemp = vramSetMainBanks(VRAM_A_LCD,VRAM_B_LCD,VRAM_C_LCD,VRAM_D_LCD);
-
- if (type == GL_RGB) {
- // We do GL_RGB as GL_RGBA, but we set each alpha bit to 1 during the copy
- u16 * src = (u16*)texture;
- u16 * dest = (u16*)addr;
-
- glTexParameter(sizeX, sizeY, addr, GL_RGBA, param);
-
- while (size--) {
- *dest++ = *src | (1 << 15);
- src++;
- }
- } else {
- // For everything else, we do a straight copy
- glTexParameter(sizeX, sizeY, addr, type, param);
- swiCopy((uint32*)texture, addr , size / 4 | COPY_MODE_WORD);
- }
- vramRestoreMainBanks(vramTemp);
- return 1;
-}
-
-//---------------------------------------------------------------------------------
-void glTexLoadPal(const u16* pal, u16 count, u32 addr) {
-//---------------------------------------------------------------------------------
- vramSetBankE(VRAM_E_LCD);
- swiCopy( pal, &VRAM_E[addr>>1] , count / 2 | COPY_MODE_WORD);
- vramSetBankE(VRAM_E_TEX_PALETTE);
-}
-
-//---------------------------------------------------------------------------------
-int gluTexLoadPal(const u16* pal, u16 count, uint8 format) {
-//---------------------------------------------------------------------------------
- int addr = getNextPaletteSlot(count, format);
- if( addr>=0 )
- glTexLoadPal(pal, count, (u32) addr);
-
- return addr;
-}
-
-
-
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/biosCalls.S b/c/src/lib/libbsp/arm/nds/libnds/source/common/biosCalls.S
deleted file mode 100644
index 94e0bc908b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/common/biosCalls.S
+++ /dev/null
@@ -1,333 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
- .text
- .align 4
-
- .thumb
-
-@---------------------------------------------------------------------------------
- .global swiSoftReset
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSoftReset:
-@---------------------------------------------------------------------------------
- swi 0x00
- bx lr
-
-
-@---------------------------------------------------------------------------------
- .global swiDelay
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDelay:
-@---------------------------------------------------------------------------------
- swi 0x03
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiIntrWait
- .thumb_func
-@---------------------------------------------------------------------------------
-swiIntrWait:
-@---------------------------------------------------------------------------------
- swi 0x04
- bx lr
-
-
-@---------------------------------------------------------------------------------
- .global swiWaitForVBlank
- .thumb_func
-@---------------------------------------------------------------------------------
-swiWaitForVBlank:
-@---------------------------------------------------------------------------------
- swi 0x05
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiSleep
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSleep:
-@---------------------------------------------------------------------------------
- swi 0x07
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiChangeSoundBias
- .thumb_func
-@---------------------------------------------------------------------------------
-swiChangeSoundBias:
-@---------------------------------------------------------------------------------
- swi 0x08
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDivide
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDivide:
-@---------------------------------------------------------------------------------
- swi 0x09
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiRemainder
- .thumb_func
-@---------------------------------------------------------------------------------
-swiRemainder:
-@---------------------------------------------------------------------------------
- swi 0x09
- mov r0, r1
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDivMod
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDivMod:
-@---------------------------------------------------------------------------------
- push {r2, r3}
- swi 0x09
- pop {r2, r3}
- str r0, [r2]
- str r1, [r3]
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiCopy
- .thumb_func
-@---------------------------------------------------------------------------------
-swiCopy:
-@---------------------------------------------------------------------------------
- swi 0x0B
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiFastCopy
- .thumb_func
-@---------------------------------------------------------------------------------
-swiFastCopy:
-@---------------------------------------------------------------------------------
- swi 0x0C
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiSqrt
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSqrt:
-@---------------------------------------------------------------------------------
- swi 0x0D
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiCRC16
- .thumb_func
-@---------------------------------------------------------------------------------
-swiCRC16:
-@---------------------------------------------------------------------------------
- swi 0x0E
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiIsDebugger
- .thumb_func
-@---------------------------------------------------------------------------------
-swiIsDebugger:
-@---------------------------------------------------------------------------------
- swi 0x0F
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiUnpackBits
- .thumb_func
-@---------------------------------------------------------------------------------
-swiUnpackBits:
-@---------------------------------------------------------------------------------
- swi 0x10
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecompressLZSSWram
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecompressLZSSWram:
-@---------------------------------------------------------------------------------
- swi 0x11
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecompressLZSSVram
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecompressLZSSVram:
-@---------------------------------------------------------------------------------
- swi 0x12
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecompressHuffman
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecompressHuffman:
-@---------------------------------------------------------------------------------
- swi 0x13
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecompressRLEWram
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecompressRLEWram:
-@---------------------------------------------------------------------------------
- swi 0x14
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecompressRLEVram
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecompressRLEVram:
-@---------------------------------------------------------------------------------
- swi 0x15
- bx lr
-
-@---------------------------------------------------------------------------------
-@ ARM7 only bios calls
-@---------------------------------------------------------------------------------
-#ifdef ARM7
-
-@---------------------------------------------------------------------------------
- .global swiHalt
- .thumb_func
-@---------------------------------------------------------------------------------
-swiHalt:
-@---------------------------------------------------------------------------------
- swi 0x06
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiGetSineTable
- .thumb_func
-@---------------------------------------------------------------------------------
-swiGetSineTable:
-@---------------------------------------------------------------------------------
- swi 0x1A
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiGetPitchTable
- .thumb_func
-@---------------------------------------------------------------------------------
-swiGetPitchTable:
-@---------------------------------------------------------------------------------
- swi 0x1B
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiGetVolumeTable
- .thumb_func
-@---------------------------------------------------------------------------------
-swiGetVolumeTable:
-@---------------------------------------------------------------------------------
- swi 0x1C
- bx lr
-
-
-@ ARM7 function, but no real point in exposing it, at least not
-@ without adding a way to get the 3 arguments back into C
-@ .global swiGetFptrs
-@ .thumb_func
-@swiGetFptrs:
-@ swi 0x1D
-@ bx lr
-
-
-@---------------------------------------------------------------------------------
- .global swiSwitchToGBAMode
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSwitchToGBAMode:
-@---------------------------------------------------------------------------------
- mov r0, #0x40
- swi 0x1F
-@ does not return, of course
-
-@---------------------------------------------------------------------------------
- .global swiSetHaltCR
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSetHaltCR:
-@---------------------------------------------------------------------------------
- mov r2, r0
- swi 0x1F
- bx lr
-
-#endif // ARM7
-
-@---------------------------------------------------------------------------------
-@ ARM9 only bios calls
-@---------------------------------------------------------------------------------
-#ifdef ARM9
-
-@---------------------------------------------------------------------------------
- .global swiWaitForIRQ
- .thumb_func
-@---------------------------------------------------------------------------------
-swiWaitForIRQ:
-@---------------------------------------------------------------------------------
- swi 0x06
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecodeDelta8
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecodeDelta8:
-@---------------------------------------------------------------------------------
- swi 0x16
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecodeDelta16
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecodeDelta16:
-@---------------------------------------------------------------------------------
- swi 0x18
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiSetHaltCR
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSetHaltCR:
-@---------------------------------------------------------------------------------
- swi 0x1F
- bx lr
-
-#endif // ARM9
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/card.c b/c/src/lib/libbsp/arm/nds/libnds/source/common/card.c
deleted file mode 100644
index 523bb6ca68..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/common/card.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
-
----------------------------------------------------------------------------------*/
-#include "nds/card.h"
-#include "nds/dma.h"
-#include "nds/memory.h"
-
-
-//---------------------------------------------------------------------------------
-void cardWriteCommand(const uint8 * command) {
-//---------------------------------------------------------------------------------
- int index;
-
- CARD_CR1H = CARD_CR1_ENABLE | CARD_CR1_IRQ;
-
- for (index = 0; index < 8; index++) {
- CARD_COMMAND[7-index] = command[index];
- }
-}
-
-
-//---------------------------------------------------------------------------------
-void cardPolledTransfer(uint32 flags, uint32 * destination, uint32 length, const uint8 * command) {
-//---------------------------------------------------------------------------------
- u32 data;
- cardWriteCommand(command);
- CARD_CR2 = flags;
- uint32 * target = destination + length;
- do {
- // Read data if available
- if (CARD_CR2 & CARD_DATA_READY) {
- data=CARD_DATA_RD;
- if (destination < target)
- *destination = data;
- destination++;
- }
- } while (CARD_CR2 & CARD_BUSY);
-}
-
-
-//---------------------------------------------------------------------------------
-void cardStartTransfer(const uint8 * command, uint32 * destination, int channel, uint32 flags) {
-//---------------------------------------------------------------------------------
- cardWriteCommand(command);
-
- // Set up a DMA channel to transfer a word every time the card makes one
- DMA_SRC(channel) = (uint32)&CARD_DATA_RD;
- DMA_DEST(channel) = (uint32)destination;
- DMA_CR(channel) = DMA_ENABLE | DMA_START_CARD | DMA_32_BIT | DMA_REPEAT | DMA_SRC_FIX | 0x0001;
-
- CARD_CR2 = flags;
-}
-
-
-//---------------------------------------------------------------------------------
-uint32 cardWriteAndRead(const uint8 * command, uint32 flags) {
-//---------------------------------------------------------------------------------
- cardWriteCommand(command);
- CARD_CR2 = flags | CARD_ACTIVATE | CARD_nRESET | 0x07000000;
- while (!(CARD_CR2 & CARD_DATA_READY)) ;
- return CARD_DATA_RD;
-}
-
-
-//---------------------------------------------------------------------------------
-void cardRead00(uint32 address, uint32 * destination, uint32 length, uint32 flags) {
-//---------------------------------------------------------------------------------f
- uint8 command[8];
- command[7] = 0;
- command[6] = (address >> 24) & 0xff;
- command[5] = (address >> 16) & 0xff;
- command[4] = (address >> 8) & 0xff;
- command[3] = address & 0xff;
- command[2] = 0;
- command[1] = 0;
- command[0] = 0;
- cardPolledTransfer(flags, destination, length, command);
-}
-
-
-//---------------------------------------------------------------------------------
-void cardReadHeader(uint8 * header) {
-//---------------------------------------------------------------------------------
- cardRead00(0, (uint32 *)header, 512, 0xA93F1FFF);
-}
-
-
-//---------------------------------------------------------------------------------
-int cardReadID(uint32 flags) {
-//---------------------------------------------------------------------------------
- uint8 command[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90};
- return cardWriteAndRead(command, flags);
-}
-
-
-//---------------------------------------------------------------------------------
-static inline void EepromWaitBusy(void) {
-//---------------------------------------------------------------------------------
- while (CARD_CR1 & /*BUSY*/0x80);
-}
-
-//---------------------------------------------------------------------------------
-uint8 cardEepromReadID(uint8 i) {
-//---------------------------------------------------------------------------------
- return cardEepromCommand(/*READID*/0xAB, i&1);
-}
-
-//---------------------------------------------------------------------------------
-uint8 cardEepromCommand(uint8 command, uint32 address) {
-//---------------------------------------------------------------------------------
- uint8 retval;
- int k;
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
-
- CARD_CR1 = 0xFFFF;
- CARD_EEPDATA = command;
-
- EepromWaitBusy();
-
- CARD_EEPDATA = (address >> 16) & 0xFF;
- EepromWaitBusy();
-
- CARD_EEPDATA = (address >> 8) & 0xFF;
- EepromWaitBusy();
-
- CARD_EEPDATA = (address) & 0xFF;
- EepromWaitBusy();
-
- for(k=0;k<256;k++)
- {
- retval = CARD_EEPDATA;
- if(retval!=0xFF)
- break;
- EepromWaitBusy();
- }
-
- CARD_CR1 = /*MODE*/0x40;
- return retval;
-}
-
-//---------------------------------------------------------------------------------
-int cardEepromGetType(void)
-//---------------------------------------------------------------------------------
-{
- uint8 c00;
- uint8 c05;
- uint8 c9f;
- uint8 c03;
-
-#ifdef ARM9
- sysSetBusOwners(BUS_OWNER_ARM9, BUS_OWNER_ARM9);
-#endif
-
- (void) c03; /* avoid set but not used warning */
- c03=cardEepromCommand(0x03,0);
- c05=cardEepromCommand(0x05,0);
- c9f=cardEepromCommand(0x9f,0);
- c00=cardEepromCommand(0x00,0);
-
- if((c00==0x00) && (c9f==0x00)) return 0; // PassMe?
- if((c00==0xff) && (c05==0xff) && (c9f==0xff))return -1;
-
- if((c00==0xff) && (c05 & 0xFD) == 0xF0 && (c9f==0xff))return 1;
- if((c00==0xff) && (c05 & 0xFD) == 0x00 && (c9f==0xff))return 2;
- if((c00==0xff) && (c05 & 0xFD) == 0x00 && (c9f==0x00))return 3;
- if((c00==0xff) && (c05 & 0xFD) == 0x00 && (c9f==0x12))return 3; // NEW TYPE 3
- if((c00==0xff) && (c05 & 0xFD) == 0x00 && (c9f==0x13))return 3; // NEW TYPE 3+ 4Mbit
- if((c00==0xff) && (c05 & 0xFD) == 0x00 && (c9f==0x14))return 3; // NEW TYPE 3++ 8Mbit MK4-FLASH Memory
-
- return 0;
-}
-
-//---------------------------------------------------------------------------------
-uint32 cardEepromGetSize() {
-//---------------------------------------------------------------------------------
-
- int type = cardEepromGetType();
-
- if(type == -1)
- return 0;
- if(type == 0)
- return 8192;
- if(type == 1)
- return 512;
- if(type == 2) {
- static const uint32 offset0 = (8*1024-1); // 8KB
- static const uint32 offset1 = (2*8*1024-1); // 16KB
- u8 buf1; // +0k data read -> write
- u8 buf2; // +8k data read -> read
- u8 buf3; // +0k ~data write
- u8 buf4; // +8k data new comp buf2
- cardReadEeprom(offset0,&buf1,1,type);
- cardReadEeprom(offset1,&buf2,1,type);
- buf3=~buf1;
- cardWriteEeprom(offset0,&buf3,1,type);
- cardReadEeprom (offset1,&buf4,1,type);
- cardWriteEeprom(offset0,&buf1,1,type);
- if(buf4!=buf2) // +8k
- return 8*1024; // 8KB(64kbit)
- else
- return 64*1024; // 64KB(512kbit)
- }
- if(type == 3) {
- uint8 c9f;
- c9f=cardEepromCommand(0x9f,0);
-
- if(c9f==0x14)
- return 1024*1024; // NEW TYPE 3++ 8Mbit(1024KByte)
-
- if(c9f==0x13)
- return 512*1024; // NEW TYPE 3+ 4Mbit(512KByte)
-
- return 256*1024; // TYPE 3 2Mbit(256KByte)
- }
-
- return 0;
-}
-
-
-//---------------------------------------------------------------------------------
-void cardReadEeprom(uint32 address, uint8 *data, uint32 length, uint32 addrtype) {
-//---------------------------------------------------------------------------------
-
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0x03 | ((addrtype == 1) ? address>>8<<3 : 0);
- EepromWaitBusy();
-
- if (addrtype == 3) {
- CARD_EEPDATA = (address >> 16) & 0xFF;
- EepromWaitBusy();
- }
-
- if (addrtype >= 2) {
- CARD_EEPDATA = (address >> 8) & 0xFF;
- EepromWaitBusy();
- }
-
-
- CARD_EEPDATA = (address) & 0xFF;
- EepromWaitBusy();
-
- while (length > 0) {
- CARD_EEPDATA = 0;
- EepromWaitBusy();
- *data++ = CARD_EEPDATA;
- length--;
- }
-
- EepromWaitBusy();
- CARD_CR1 = /*MODE*/0x40;
-}
-
-
-//---------------------------------------------------------------------------------
-void cardWriteEeprom(uint32 address, uint8 *data, uint32 length, uint32 addrtype) {
-//---------------------------------------------------------------------------------
-
- uint32 address_end = address + length;
- int i;
- int maxblocks = 32;
- if(addrtype == 1) maxblocks = 16;
- if(addrtype == 2) maxblocks = 32;
- if(addrtype == 3) maxblocks = 256;
-
- while (address < address_end) {
- // set WEL (Write Enable Latch)
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0x06; EepromWaitBusy();
- CARD_CR1 = /*MODE*/0x40;
-
- // program maximum of 32 bytes
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
-
- if(addrtype == 1) {
- // WRITE COMMAND 0x02 + A8 << 3
- CARD_EEPDATA = 0x02 | (address & BIT(8)) >> (8-3) ;
- EepromWaitBusy();
- CARD_EEPDATA = address & 0xFF;
- EepromWaitBusy();
- }
- else if(addrtype == 2) {
- CARD_EEPDATA = 0x02;
- EepromWaitBusy();
- CARD_EEPDATA = address >> 8;
- EepromWaitBusy();
- CARD_EEPDATA = address & 0xFF;
- EepromWaitBusy();
- }
- else if(addrtype == 3) {
- CARD_EEPDATA = 0x02;
- EepromWaitBusy();
- CARD_EEPDATA = (address >> 16) & 0xFF;
- EepromWaitBusy();
- CARD_EEPDATA = (address >> 8) & 0xFF;
- EepromWaitBusy();
- CARD_EEPDATA = address & 0xFF;
- EepromWaitBusy();
- }
-
- for (i=0; address<address_end && i<maxblocks; i++, address++) {
- CARD_EEPDATA = *data++;
- EepromWaitBusy();
- }
- CARD_CR1 = /*MODE*/0x40;
-
- // wait programming to finish
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0x05; EepromWaitBusy();
- do { CARD_EEPDATA = 0; EepromWaitBusy(); } while (CARD_EEPDATA & 0x01); // WIP (Write In Progress) ?
- EepromWaitBusy();
- CARD_CR1 = /*MODE*/0x40;
- }
-}
-
-
-// Chip Erase : clear FLASH MEMORY (TYPE 3 ONLY)
-//---------------------------------------------------------------------------------
-void cardEepromChipErase(void) {
-//---------------------------------------------------------------------------------
- int sz;
- sz=cardEepromGetSize();
- cardEepromSectorErase(0x00000);
- cardEepromSectorErase(0x10000);
- cardEepromSectorErase(0x20000);
- cardEepromSectorErase(0x30000);
- if(sz==512*1024)
- {
- cardEepromSectorErase(0x40000);
- cardEepromSectorErase(0x50000);
- cardEepromSectorErase(0x60000);
- cardEepromSectorErase(0x70000);
- }
-}
-
-// COMMAND Sec.erase 0xD8
-void cardEepromSectorErase(uint32 address)
-{
- // set WEL (Write Enable Latch)
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0x06;
- EepromWaitBusy();
-
- CARD_CR1 = /*MODE*/0x40;
-
- // SectorErase 0xD8
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0xD8;
- EepromWaitBusy();
- CARD_EEPDATA = (address >> 16) & 0xFF;
- EepromWaitBusy();
- CARD_EEPDATA = (address >> 8) & 0xFF;
- EepromWaitBusy();
- CARD_EEPDATA = address & 0xFF;
- EepromWaitBusy();
-
- CARD_CR1 = /*MODE*/0x40;
-
- // wait erase to finish
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0x05;
- EepromWaitBusy();
-
- do
- {
- CARD_EEPDATA = 0;
- EepromWaitBusy();
- } while (CARD_EEPDATA & 0x01); // WIP (Write In Progress) ?
- CARD_CR1 = /*MODE*/0x40;
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c b/c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c
deleted file mode 100644
index 7f174e4c84..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*---------------------------------------------------------------------------------
- access object in a GBFS file
-
- Copyright 2002-2005 Damian Yerrick
-
- Additional code Dave Murphy
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- IN THE SOFTWARE.
-
----------------------------------------------------------------------------------*/
-
-
-/*---------------------------------------------------------------------------------
- This code assumes a LITTLE ENDIAN target. It'll need a boatload
- of itohs and itohl calls if converted to run on Sega Genesis. It
- also assumes that the target uses 16-bit short and 32-bit longs.
----------------------------------------------------------------------------------*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <nds/jtypes.h>
-#include "gbfs.h"
-
-/*---------------------------------------------------------------------------------
- change this to the end of your ROM,
- or to 0x02040000 for gba multiboot
- or to 0x24000000 for nds main ram
----------------------------------------------------------------------------------*/
-
-static const u32 * GBFS_1ST_SEARCH_LIMIT = (const u32 *)0x02400000;
-static const u32 * GBFS_2ND_SEARCH_START = (const u32 *)0x08000000;
-static const u32 * GBFS_2ND_SEARCH_LIMIT = (const u32 *)0x0a000000;
-/*---------------------------------------------------------------------------------
- a power of two, less than or equal to the argument passed to
- padbin. Increasing the stride makes find_first_gbfs_file()
- faster at the cost of a slightly larger binary.
----------------------------------------------------------------------------------*/
-static int GBFS_STRIDE = 256;
-
-/*---------------------------------------------------------------------------------
- Set the search limits and stride for searching
----------------------------------------------------------------------------------*/
-void gbfs_search_range(
- u32 gbfs_1st_limit,
- u32 gbfs_2nd_start, u32 gbfs_2nd_limit,
- u32 gbfs_stride
-) {
-//---------------------------------------------------------------------------------
- if ( 0 != gbfs_1st_limit ) GBFS_1ST_SEARCH_LIMIT = (u32 *)gbfs_1st_limit;
- if ( 0 != gbfs_2nd_limit ) GBFS_2ND_SEARCH_LIMIT = (u32 *)gbfs_2nd_limit;
- if ( 0 != gbfs_2nd_start ) GBFS_2ND_SEARCH_START = (u32 *)gbfs_2nd_start;
- if ( 0 != gbfs_stride ) GBFS_STRIDE = gbfs_stride;
-
-}
-
-//---------------------------------------------------------------------------------
-const GBFS_FILE * find_first_gbfs_file(const void *start) {
-//---------------------------------------------------------------------------------
- /* align the pointer */
- const u32 *here = (const u32 *)
- ((unsigned long)start & (-GBFS_STRIDE));
- const char rest_of_magic[] = "ightGBFS\r\n\x1a\n";
-
- /* Linear-search first in multiboot space. */
- while(here < GBFS_1ST_SEARCH_LIMIT)
- {
- /* We have to keep the magic code in two pieces; otherwise,
- this function may find itself and think it's a GBFS file.
- This obviously won't work if your compiler stores this
- numeric literal just before the literal string, but Devkit
- Advance R4 and R5 seem to keep numeric constant pools
- separate enough from string pools for this to work.
- */
- if(*here == 0x456e6950) { /* ASCII code for little endian "PinE" */
- /* We've matched the first four bytes.
- If the rest of the magic matches, then we've found a file. */
- if(!memcmp(here + 1, rest_of_magic, 12))
- return (const GBFS_FILE *)here;
- }
- here += GBFS_STRIDE / sizeof(here);
- }
-
- /* Now search in ROM space. */
- if(here < GBFS_2ND_SEARCH_START)
- here = GBFS_2ND_SEARCH_START;
- while(here < GBFS_2ND_SEARCH_LIMIT) {
- /* Search loop same as above. */
- if(*here == 0x456e6950) { /* ASCII code for little endian "PinE" */
- if(!memcmp(here + 1, rest_of_magic, 12))
- return (const GBFS_FILE *)here;
- }
- here += GBFS_STRIDE / sizeof(*here);
- }
- return 0;
-}
-
-
-//---------------------------------------------------------------------------------
-const void *skip_gbfs_file(const GBFS_FILE *file) {
-//---------------------------------------------------------------------------------
- return ((char *)file + file->total_len);
-}
-
-
-//---------------------------------------------------------------------------------
-static int namecmp(const void *a, const void *b) {
-//---------------------------------------------------------------------------------
- return memcmp(a, b, 24);
-}
-
-
-//---------------------------------------------------------------------------------
-const void *gbfs_get_obj( const GBFS_FILE *file,
- const char *name,
- u32 *len) {
-//---------------------------------------------------------------------------------
- char key[24] = {0};
-
- const GBFS_ENTRY *dirbase = (const GBFS_ENTRY *)((const char *)file + file->dir_off);
- size_t n_entries = file->dir_nmemb;
- const GBFS_ENTRY *here;
-
- strncpy(key, name, 24);
-
- here = bsearch( key, dirbase,
- n_entries, sizeof(GBFS_ENTRY),
- namecmp);
- if(!here)
- return NULL;
-
- if(len)
- *len = here->len;
- return (char *)file + here->data_offset;
-}
-
-
-//---------------------------------------------------------------------------------
-const void *gbfs_get_nth_obj( const GBFS_FILE *file,
- size_t n,
- char *name,
- u32 *len)
-//---------------------------------------------------------------------------------
-{
- const GBFS_ENTRY *dirbase = (const GBFS_ENTRY *)((const char *)file + file->dir_off);
- size_t n_entries = file->dir_nmemb;
- const GBFS_ENTRY *here = dirbase + n;
-
- if(n >= n_entries)
- return NULL;
-
- if(name) {
- strncpy(name, here->name, 24);
- name[24] = 0;
- }
-
- if(len)
- *len = here->len;
-
- return (char *)file + here->data_offset;
-}
-
-
-//---------------------------------------------------------------------------------
-void *gbfs_copy_obj( void *dst,
- const GBFS_FILE *file,
- const char *name) {
-//---------------------------------------------------------------------------------
- u32 len;
- const void *src = gbfs_get_obj(file, name, &len);
-
- if(!src)
- return NULL;
-
- memcpy(dst, src, len);
- return dst;
-}
-
-
-//---------------------------------------------------------------------------------
-size_t gbfs_count_objs(const GBFS_FILE *file) {
-//---------------------------------------------------------------------------------
- return file ? file->dir_nmemb : 0;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/interruptDispatcher.S b/c/src/lib/libbsp/arm/nds/libnds/source/common/interruptDispatcher.S
deleted file mode 100644
index 927fa74e65..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/common/interruptDispatcher.S
+++ /dev/null
@@ -1,117 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifdef ARM7
- .text
-#endif
-
-#ifdef ARM9
- .section .bsp_fast_text,"ax",%progbits
-#endif
-
- .extern irqTable
- .code 32
-
- .global IntrMain
-@---------------------------------------------------------------------------------
-IntrMain:
-@---------------------------------------------------------------------------------
- mov r3, #0x4000000 @ REG_BASE
-
- ldr r1, [r3, #0x208] @ r1 = IME
- str r3, [r3, #0x208] @ disable IME
- mrs r0, spsr
- stmfd sp!, {r0-r1,r3,lr} @ {spsr, IME, REG_BASE, lr_irq}
-
- ldr r1, [r3,#0x210] @ REG_IE
- ldr r2, [r3,#0x214] @ REG_IF
- and r1,r1,r2
-
- ldr r0,=__irq_flags @ defined by linker script
-
- ldr r2,[r0]
- orr r2,r2,r1
- str r2,[r0]
-
- ldr r2,=irqTable
-@---------------------------------------------------------------------------------
-findIRQ:
-@---------------------------------------------------------------------------------
- ldr r0, [r2, #4]
- cmp r0,#0
- beq no_handler
- ands r0, r0, r1
- bne jump_intr
- add r2, r2, #8
- b findIRQ
-
-@---------------------------------------------------------------------------------
-no_handler:
-@---------------------------------------------------------------------------------
- str r1, [r3, #0x0214] @ IF Clear
- ldmfd sp!, {r0-r1,r3,lr} @ {spsr, IME, REG_BASE, lr_irq}
- str r1, [r3, #0x208] @ restore REG_IME
- mov pc,lr
-
-@---------------------------------------------------------------------------------
-jump_intr:
-@---------------------------------------------------------------------------------
- ldr r1, [r2] @ user IRQ handler address
- cmp r1, #0
- bne got_handler
- mov r1, r0
- b no_handler
-@---------------------------------------------------------------------------------
-got_handler:
-@---------------------------------------------------------------------------------
-
- mrs r2, cpsr
- bic r2, r2, #0xdf @ \__
- orr r2, r2, #0x1f @ / --> Enable IRQ & FIQ. Set CPU mode to System.
- msr cpsr,r2
-
- str r0, [r3, #0x0214] @ IF Clear
-
- push {lr}
- adr lr, IntrRet
- bx r1
-
-@---------------------------------------------------------------------------------
-IntrRet:
-@---------------------------------------------------------------------------------
- mov r3, #0x4000000 @ REG_BASE
- str r3, [r3, #0x208] @ disable IME
- pop {lr}
-
- mrs r3, cpsr
- bic r3, r3, #0xdf @ \__
- orr r3, r3, #0x92 @ / --> Disable IRQ. Enable FIQ. Set CPU mode to IRQ.
- msr cpsr, r3
-
- ldmfd sp!, {r0-r1,r3,lr} @ {spsr, IME, REG_BASE, lr_irq}
- msr spsr, r0 @ restore spsr
- str r1, [r3, #0x208] @ restore REG_IME
- mov pc,lr
-
- .pool
- .end
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c b/c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c
deleted file mode 100644
index 7e42ebf942..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#include <nds/interrupts.h>
-#include <nds/system.h>
-
-void IntrMain(void); // Prototype for assembly interrupt dispatcher
-
-static void irqDummy(void) {}
-
-
-#ifdef ARM9
-#define INT_TABLE_SECTION __attribute__((section(".bsp_fast_text")))
-#else
-#define INT_TABLE_SECTION
-#endif
-
-struct IntTable irqTable[MAX_INTERRUPTS] INT_TABLE_SECTION;
-
-//---------------------------------------------------------------------------------
-void irqSet(int mask, IntFn handler) {
-//---------------------------------------------------------------------------------
- if (!mask) return;
-
- int i;
-
- for (i=0;i<MAX_INTERRUPTS;i++)
- if (!irqTable[i].mask || irqTable[i].mask == mask) break;
-
- if ( i == MAX_INTERRUPTS ) return;
-
- irqTable[i].handler = handler;
- irqTable[i].mask = mask;
-
- if(mask & IRQ_VBLANK)
- REG_DISPSTAT |= DISP_VBLANK_IRQ ;
- if(mask & IRQ_HBLANK)
- REG_DISPSTAT |= DISP_HBLANK_IRQ ;
-
- REG_IE |= mask;
-}
-
-//---------------------------------------------------------------------------------
-void irqInit() {
-//---------------------------------------------------------------------------------
- int i;
-
- // Set all interrupts to dummy functions.
- for(i = 0; i < MAX_INTERRUPTS; i ++)
- {
- irqTable[i].handler = irqDummy;
- irqTable[i].mask = 0;
- }
-
- IRQ_HANDLER = IntrMain;
-
- REG_IE = 0; // disable all interrupts
- REG_IF = IRQ_ALL; // clear all pending interrupts
- REG_IME = 1; // enable global interrupt
-
-}
-
-
-//---------------------------------------------------------------------------------
-void irqClear(int mask) {
-//---------------------------------------------------------------------------------
- int i = 0;
-
- for (i=0;i<MAX_INTERRUPTS;i++)
- if (irqTable[i].mask == mask) break;
-
- if ( i == MAX_INTERRUPTS ) return;
-
- irqTable[i].handler = irqDummy;
-
- if (mask & IRQ_VBLANK)
- REG_DISPSTAT &= ~DISP_VBLANK_IRQ ;
- if (mask & IRQ_HBLANK)
- REG_DISPSTAT &= ~DISP_HBLANK_IRQ ;
- if (mask & IRQ_VCOUNT)
- REG_DISPSTAT &= ~DISP_YTRIGGER_IRQ;
-
- REG_IE &= ~mask;
-}
-
-
-//---------------------------------------------------------------------------------
-void irqInitHandler(IntFn handler) {
-//---------------------------------------------------------------------------------
- REG_IME = 0;
- REG_IF = ~0;
- REG_IE = 0;
-
- IRQ_HANDLER = handler;
-
- REG_IME = 1;
-}
-
-//---------------------------------------------------------------------------------
-void irqEnable(uint32 irq) {
-//---------------------------------------------------------------------------------
- if (irq & IRQ_VBLANK)
- REG_DISPSTAT |= DISP_VBLANK_IRQ ;
- if (irq & IRQ_HBLANK)
- REG_DISPSTAT |= DISP_HBLANK_IRQ ;
- if (irq & IRQ_VCOUNT)
- REG_DISPSTAT |= DISP_YTRIGGER_IRQ;
-
- REG_IE |= irq;
- REG_IME = 1;
-}
-
-//---------------------------------------------------------------------------------
-void irqDisable(uint32 irq) {
-//---------------------------------------------------------------------------------
- if (irq & IRQ_VBLANK)
- REG_DISPSTAT &= ~DISP_VBLANK_IRQ ;
- if (irq & IRQ_HBLANK)
- REG_DISPSTAT &= ~DISP_HBLANK_IRQ ;
- if (irq & IRQ_VCOUNT)
- REG_DISPSTAT &= ~DISP_YTRIGGER_IRQ;
-
- REG_IE &= ~irq;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/make/custom/nds.cfg b/c/src/lib/libbsp/arm/nds/make/custom/nds.cfg
deleted file mode 100644
index 76cde26eb5..0000000000
--- a/c/src/lib/libbsp/arm/nds/make/custom/nds.cfg
+++ /dev/null
@@ -1,34 +0,0 @@
-##
-## Config file for Nintendo DS BSP.
-##
-
-include $(RTEMS_ROOT)/make/custom/default.cfg
-
-RTEMS_CPU=arm
-RTEMS_CPU_MODEL=arm9tdmi
-
-# This contains the compiler options necessary to select the CPU model
-# and (hopefully) optimize for it.
-#
-CPU_CFLAGS = -mcpu=$(RTEMS_CPU_MODEL)
-
-# optimize flag: typically -O2
-#CFLAGS_OPTIMIZE_V = -O0 -ggdb
-CFLAGS_OPTIMIZE_V = -O2
-#CFLAGS_OPTIMIZE_V = -Os
-
-NDSTOOL = $(PROJECT_TOOLS)/ndstool
-
-ifeq ($(RTEMS_MAKEFILE_PATH),)
- COPROC_ELF_PATH = $(abs_builddir)/../../../lib/libbsp/arm/nds/
-else
- COPROC_ELF_PATH = $(RTEMS_MAKEFILE_PATH)/lib
-endif
-
-define bsp-post-link
- $(default-bsp-post-link)
- $(OBJCOPY) -O binary $(basename $@)$(EXEEXT) $(basename $@).bin
- $(NDSTOOL) -c $(basename $@).nds -9 $(basename $@).bin \
- -7 $(COPROC_ELF_PATH)/coproc.bin
- rm -f $(basename $@).bin
-endef
diff --git a/c/src/lib/libbsp/arm/nds/mk_libnds.sh b/c/src/lib/libbsp/arm/nds/mk_libnds.sh
deleted file mode 100755
index 2100e598e3..0000000000
--- a/c/src/lib/libbsp/arm/nds/mk_libnds.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-[ -d "$1" ] || ( echo "usage: $0 <srcdir>"; exit 1 )
-
-cd "$1"
-
-echo "Symlinking assembly files..."
-ln -sf icache.s libnds/source/arm9/icache.S
-ln -sf dcache.s libnds/source/arm9/dcache.S
-ln -sf exceptionHandler.s libnds/source/arm9/exceptionHandler.S
-ln -sf biosCalls.s libnds/source/common/biosCalls.S
-ln -sf interruptDispatcher.s libnds/source/common/interruptDispatcher.S
-
-echo "Creating font header..."
-cat > libnds/include/default_font_bin.h <<EOF
-#ifndef default_font_bin_h_
-#define default_font_bin_h_
-
-extern void *default_font_bin;
-static void *default_font_bin_ptr = &default_font_bin;
-
-#define default_font_bin default_font_bin_ptr
-
-#endif
-EOF
-
-echo "Removing socket.h..."
-rm -f dswifi/include/sys/socket.h
-
-echo "Patching libnds..."
-patch -p0 < patch.libnds
-
-echo "Done."
-
-cd -
diff --git a/c/src/lib/libbsp/arm/nds/patch.libnds b/c/src/lib/libbsp/arm/nds/patch.libnds
deleted file mode 100644
index 0f123e4df2..0000000000
--- a/c/src/lib/libbsp/arm/nds/patch.libnds
+++ /dev/null
@@ -1,11 +0,0 @@
---- libnds/source/arm9/exceptionHandler.S 2008-02-19 10:48:10.000000000 -0800
-+++ libnds/source/arm9/exceptionHandler.S 2008-02-19 10:47:58.000000000 -0800
-@@ -88,7 +88,7 @@
- // Get C function & call it
- ldr r12,=exceptionC
- ldr r12,[r12,#0]
-- blxne r12
-+ bxne r12
-
- // restore registers
- ldr r12,=exceptionRegisters
diff --git a/c/src/lib/libbsp/arm/nds/preinstall.am b/c/src/lib/libbsp/arm/nds/preinstall.am
deleted file mode 100644
index 4d1cc3a719..0000000000
--- a/c/src/lib/libbsp/arm/nds/preinstall.am
+++ /dev/null
@@ -1,244 +0,0 @@
-## Automatically generated by ampolish3 - Do not edit
-
-if AMPOLISH3
-$(srcdir)/preinstall.am: Makefile.am
- $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
-endif
-
-PREINSTALL_DIRS =
-DISTCLEANFILES += $(PREINSTALL_DIRS)
-
-all-am: $(PREINSTALL_FILES)
-
-PREINSTALL_FILES =
-CLEANFILES = $(PREINSTALL_FILES)
-
-all-local: $(TMPINSTALL_FILES)
-
-TMPINSTALL_FILES =
-CLEANFILES += $(TMPINSTALL_FILES)
-
-$(PROJECT_LIB)/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_LIB)
- @: > $(PROJECT_LIB)/$(dirstamp)
-PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
-
-$(PROJECT_INCLUDE)/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_INCLUDE)
- @: > $(PROJECT_INCLUDE)/$(dirstamp)
-PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
-
-$(PROJECT_INCLUDE)/bsp/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_INCLUDE)/bsp
- @: > $(PROJECT_INCLUDE)/bsp/$(dirstamp)
-PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp)
-
-$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
-PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
-
-$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
-
-$(PROJECT_INCLUDE)/tm27.h: ../../shared/include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
-
-$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
-
-$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
-
-$(PROJECT_INCLUDE)/bsp/bootcard.h: ../../shared/include/bootcard.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/bootcard.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/bootcard.h
-
-$(PROJECT_INCLUDE)/bsp/irq.h: irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
-
-$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
-TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
-
-$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
-PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
-
-$(PROJECT_INCLUDE)/nds/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_INCLUDE)/nds
- @: > $(PROJECT_INCLUDE)/nds/$(dirstamp)
-PREINSTALL_DIRS += $(PROJECT_INCLUDE)/nds/$(dirstamp)
-
-$(PROJECT_INCLUDE)/nds/touchscreen.h: touchscreen/touchscreen.h $(PROJECT_INCLUDE)/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/nds/touchscreen.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/nds/touchscreen.h
-
-$(PROJECT_INCLUDE)/nds/sound.h: sound/sound.h $(PROJECT_INCLUDE)/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/nds/sound.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/nds/sound.h
-
-$(PROJECT_INCLUDE)/libnds/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_INCLUDE)/libnds
- @: > $(PROJECT_INCLUDE)/libnds/$(dirstamp)
-PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libnds/$(dirstamp)
-
-$(PROJECT_INCLUDE)/libnds/gbfs.h: libnds/include/gbfs.h $(PROJECT_INCLUDE)/libnds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/gbfs.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/gbfs.h
-
-$(PROJECT_INCLUDE)/libnds/nds.h: libnds/include/nds.h $(PROJECT_INCLUDE)/libnds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds.h
-
-$(PROJECT_INCLUDE)/libnds/nds/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_INCLUDE)/libnds/nds
- @: > $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
-PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
-
-$(PROJECT_INCLUDE)/libnds/nds/memory.h: libnds/include/nds/memory.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/memory.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/memory.h
-
-$(PROJECT_INCLUDE)/libnds/nds/system.h: libnds/include/nds/system.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/system.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/system.h
-
-$(PROJECT_INCLUDE)/libnds/nds/bios.h: libnds/include/nds/bios.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/bios.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/bios.h
-
-$(PROJECT_INCLUDE)/libnds/nds/registers_alt.h: libnds/include/nds/registers_alt.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/registers_alt.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/registers_alt.h
-
-$(PROJECT_INCLUDE)/libnds/nds/interrupts.h: libnds/include/nds/interrupts.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/interrupts.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/interrupts.h
-
-$(PROJECT_INCLUDE)/libnds/nds/card.h: libnds/include/nds/card.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/card.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/card.h
-
-$(PROJECT_INCLUDE)/libnds/nds/ipc.h: libnds/include/nds/ipc.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/ipc.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/ipc.h
-
-$(PROJECT_INCLUDE)/libnds/nds/timers.h: libnds/include/nds/timers.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/timers.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/timers.h
-
-$(PROJECT_INCLUDE)/libnds/nds/dma.h: libnds/include/nds/dma.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/dma.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/dma.h
-
-$(PROJECT_INCLUDE)/libnds/nds/reload.h: libnds/include/nds/reload.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/reload.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/reload.h
-
-$(PROJECT_INCLUDE)/libnds/nds/jtypes.h: libnds/include/nds/jtypes.h $(PROJECT_INCLUDE)/libnds/nds/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/jtypes.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/jtypes.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_INCLUDE)/libnds/nds/arm9
- @: > $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
-PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/ndsmotion.h: libnds/include/nds/arm9/ndsmotion.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/ndsmotion.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/ndsmotion.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/pcx.h: libnds/include/nds/arm9/pcx.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/pcx.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/pcx.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/input.h: libnds/include/nds/arm9/input.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/input.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/input.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/math.h: libnds/include/nds/arm9/math.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/math.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/math.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/console.h: libnds/include/nds/arm9/console.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/console.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/console.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/sprite.h: libnds/include/nds/arm9/sprite.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/sprite.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/sprite.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/videoGL.h: libnds/include/nds/arm9/videoGL.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/videoGL.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/videoGL.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/cache.h: libnds/include/nds/arm9/cache.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/cache.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/cache.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/image.h: libnds/include/nds/arm9/image.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/image.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/image.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/trig_lut.h: libnds/include/nds/arm9/trig_lut.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/trig_lut.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/trig_lut.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/video.h: libnds/include/nds/arm9/video.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/video.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/video.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/exceptions.h: libnds/include/nds/arm9/exceptions.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/exceptions.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/exceptions.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/rumble.h: libnds/include/nds/arm9/rumble.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/rumble.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/rumble.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/background.h: libnds/include/nds/arm9/background.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/background.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/background.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/boxtest.h: libnds/include/nds/arm9/boxtest.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/boxtest.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/boxtest.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/postest.h: libnds/include/nds/arm9/postest.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/postest.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/postest.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm9/sound.h: libnds/include/nds/arm9/sound.h $(PROJECT_INCLUDE)/libnds/nds/arm9/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm9/sound.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm9/sound.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm7/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_INCLUDE)/libnds/nds/arm7
- @: > $(PROJECT_INCLUDE)/libnds/nds/arm7/$(dirstamp)
-PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libnds/nds/arm7/$(dirstamp)
-
-$(PROJECT_INCLUDE)/libnds/nds/arm7/serial.h: libnds/include/nds/arm7/serial.h $(PROJECT_INCLUDE)/libnds/nds/arm7/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm7/serial.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm7/serial.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm7/audio.h: libnds/include/nds/arm7/audio.h $(PROJECT_INCLUDE)/libnds/nds/arm7/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm7/audio.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm7/audio.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm7/clock.h: libnds/include/nds/arm7/clock.h $(PROJECT_INCLUDE)/libnds/nds/arm7/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm7/clock.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm7/clock.h
-
-$(PROJECT_INCLUDE)/libnds/nds/arm7/touch.h: libnds/include/nds/arm7/touch.h $(PROJECT_INCLUDE)/libnds/nds/arm7/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libnds/nds/arm7/touch.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libnds/nds/arm7/touch.h
-
-$(PROJECT_LIB)/coproc.bin: coproc.bin $(PROJECT_LIB)/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_LIB)/coproc.bin
-TMPINSTALL_FILES += $(PROJECT_LIB)/coproc.bin
-
diff --git a/c/src/lib/libbsp/arm/nds/rtc/rtc.c b/c/src/lib/libbsp/arm/nds/rtc/rtc.c
deleted file mode 100644
index da0f23263d..0000000000
--- a/c/src/lib/libbsp/arm/nds/rtc/rtc.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * RTEMS for Nintendo DS realtime clock driver.
- */
-
-/*
- * Copyright (c) 2008 by Cedric Gestes <ctaf42@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <rtems.h>
-#include <libchip/rtc.h>
-#include <bsp.h>
-#include <nds.h>
-
-rtems_device_minor_number RTC_Minor;
-size_t RTC_Count = 1;
-
-/*
- * probe for a rtc. we always claim to have one.
- */
-static bool
-nds_rtc_probe (int minor)
-{
- return true;
-}
-
-/*
- * initialize the nds rtc.
- */
-static void
-nds_rtc_init (int minor)
-{
- /* nothing to do here (already done in the arm7 main) */
- printk ("[+] rtc started\n");
-}
-
-/*
- * read current time from nds real-time clock chip and convert it
- * to the rtems_time_of_day structure.
- */
-static int
-nds_rtc_get_time (int minor, rtems_time_of_day * time)
-{
- time->year = 2000 + IPC->time.rtc.year;
- time->month = IPC->time.rtc.month;
- time->day = IPC->time.rtc.day;
- time->hour = IPC->time.rtc.hours;
- time->minute = IPC->time.rtc.minutes;
- time->second = IPC->time.rtc.seconds;
- time->ticks = 0;
-
- return 0;
-}
-
-/*
- * set time to the arm7 nds rtc.
- * NOTE: this is not supported.
- */
-static int
-nds_rtc_set_time (int minor, const rtems_time_of_day * time)
-{
- return -1;
-}
-
-/*
- * driver function table.
- */
-rtc_fns nds_rtc_fns = {
- nds_rtc_init,
- nds_rtc_get_time,
- nds_rtc_set_time
-};
-
-/*
- * the following table configures the RTC drivers used in this BSP
- */
-
-rtc_tbl RTC_Table[] = {
- {
- "/dev/rtc", /* sDeviceName */
- RTC_CUSTOM, /* deviceType */
- &nds_rtc_fns, /* pDeviceFns */
- nds_rtc_probe, /* deviceProbe */
- NULL, /* pDeviceParams */
- 0, /* ulCtrlPort1 */
- 0, /* ulDataPort */
- NULL, /* getRegister */
- NULL /* setRegister */
- }
-};
diff --git a/c/src/lib/libbsp/arm/nds/sound/sound.c b/c/src/lib/libbsp/arm/nds/sound/sound.c
deleted file mode 100644
index 57fce47bb3..0000000000
--- a/c/src/lib/libbsp/arm/nds/sound/sound.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * RTEMS for Nintendo DS sound driver.
- *
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-
-#include <bsp.h>
-#include <rtems/irq.h>
-#include <rtems/libio.h>
-#include <nds.h>
-
-#include "sound.h"
-#include "../include/my_ipc.h"
-
-/*
- * default values.
- */
-
-static int volume = 64;
-static int pan = 64;
-static int freq = 11025;
-static int format = 0; // 0 is 8 bits and 1 is 16 bits
-static int offset = 0;
-
-/*
- * sound device driver initialize entry point.
- */
-
-rtems_device_driver
-sound_initialize (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_status_code status;
-
- printk ("[+] sound started\n");
-
- /* register the devices */
- status = rtems_io_register_name ("/dev/pcm", major, 0);
- if (status != RTEMS_SUCCESSFUL) {
- printk ("[!] error registering sound\n");
- rtems_fatal_error_occurred (status);
- }
-
- /* reset IPCs structs */
- IPC->soundData = NULL;
- memset ((void *)my_IPC, 0, sizeof (*my_IPC));
- DC_FlushAll ();
-
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * sound device driver open operation.
- */
-
-rtems_device_driver
-sound_open (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * sound device driver close operation.
- */
-
-rtems_device_driver
-sound_close (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * sound device driver read operation. read data from recorded microphone
- * samples.
- */
-
-rtems_device_driver
-sound_read (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) arg;
-
- /* check end of file */
- if (offset >= my_IPC->recorded_length) {
- rw_args->bytes_moved = 0;
-
- return RTEMS_SUCCESSFUL;
- }
-
- /* read buffer */
- memcpy ((void *)rw_args->buffer, (void *)my_IPC->record_buffer + offset, rw_args->count);
- offset += rw_args->count;
- rw_args->bytes_moved = rw_args->count;
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * sound device driver write operation. read a pcm sound.
- */
-
-rtems_device_driver
-sound_write (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) arg;
- static TransferSound snd;
-
- /* XXX not exclusive */
- while (IPC->soundData != NULL);
-
- snd.count = 1;
- snd.data[0].data = rw_args->buffer;
- snd.data[0].len = rw_args->count;
- snd.data[0].rate = freq;
- snd.data[0].vol = volume;
- snd.data[0].pan = pan;
- snd.data[0].format = format;
-
- IPC->soundData = &snd;
- DC_FlushAll ();
-
- rw_args->bytes_moved = rw_args->count;
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * ioctl entry point.
- */
-
-rtems_device_driver
-sound_control (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_libio_ioctl_args_t *args = arg;
- uint32_t *val = (uint32_t *) args->buffer;
-
- switch (args->command) {
- /* sound volume management */
- case SOUND_SVOL:
- volume = *val;
- break;
- case SOUND_GVOL:
- *val = volume;
- break;
- /* sound format settings */
- case SOUND_SFMT:
- switch (*val & SOUND_FREQ_MASK) {
- case SOUND_FREQ_11025:
- freq = 11025;
- break;
- case SOUND_FREQ_22050:
- freq = 22050;
- break;
- case SOUND_FREQ_44100:
- freq = 44100;
- break;
- case SOUND_FREQ_RECORD:
- freq = 16384;
- break;
- }
- format = (*val & SOUND_FORMAT_16) ? 1 : 0;
- printk ("[+] pcm %d bits @ %d hz\n", format ? 16 : 8, freq);
- break;
- case SOUND_GFMT:
- if (freq == 11025) {
- *val = SOUND_FREQ_11025;
- } else if (freq == 22050) {
- *val = SOUND_FREQ_22050;
- } else if (freq == 44100) {
- *val = SOUND_FREQ_44100;
- } else if (freq == 16384) {
- *val = SOUND_FREQ_RECORD;
- }
- *val |= format ? SOUND_FORMAT_16 : SOUND_FORMAT_8;
- break;
- /* sound pan settings */
- case SOUND_SPAN:
- pan = *val;
- break;
- case SOUND_GPAN:
- *val = pan;
- break;
- /* set recording buffer length */
- case SOUND_SRECLEN:
- my_IPC->record_buffer = malloc (*val);
- my_IPC->record_length_max = *val;
- printk ("[+] mic buffer %u B @ %p\n", my_IPC->record_length_max,
- my_IPC->record_buffer);
- break;
- /* start recording */
- case SOUND_STARTREC:
- my_IPC->recorded_length = 0;
- my_IPC->record = 1;
- break;
- /* stop recording */
- case SOUND_STOPREC:
- if (!my_IPC->record) {
- printk ("[!] STOPREC while not recording\n");
- }
- my_IPC->record = 0;
- while (my_IPC->recorded_length == 0);
- offset = 0;
- if (val != NULL) {
- *val = my_IPC->recorded_length;
- }
- break;
- default:
- break;
- }
- return RTEMS_SUCCESSFUL;
-}
diff --git a/c/src/lib/libbsp/arm/nds/sound/sound.h b/c/src/lib/libbsp/arm/nds/sound/sound.h
deleted file mode 100644
index def7e723d7..0000000000
--- a/c/src/lib/libbsp/arm/nds/sound/sound.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#ifndef _SOUND_H_
-#define _SOUND_H_
-
-/* ioctls for sound management. 0x53 is 'S' */
-#define SOUND_SVOL 0x5301 /* set sound volume */
-#define SOUND_GVOL 0x5302 /* get sound volume */
-#define SOUND_SFMT 0x5303 /* set output format */
-#define SOUND_GFMT 0x5304 /* get output format */
-#define SOUND_SPAN 0x5305 /* set pan */
-#define SOUND_GPAN 0x5306 /* get pan */
-
-#define SOUND_SRECLEN 0x5307 /* set recording buffer length (in bytes) */
-#define SOUND_STARTREC 0x5308 /* start recording */
-#define SOUND_STOPREC 0x5309 /* stop recording */
-
-#define SOUND_FREQ_MASK 0x3
-#define SOUND_FREQ_11025 0
-#define SOUND_FREQ_22050 1
-#define SOUND_FREQ_44100 2
-#define SOUND_FREQ_RECORD 3 /* special value to play microphone
- recorded data */
-
-#define SOUND_FORMAT_8 (0 << 2)
-#define SOUND_FORMAT_16 (1 << 2)
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- /*
- * sound prototype entry points
- */
- rtems_device_driver sound_initialize (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver sound_open (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver sound_control (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver sound_close (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver sound_read (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver sound_write (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver sound_control (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
-#define SOUND_DRIVER_TABLE_ENTRY \
- { sound_initialize, sound_open, sound_close, \
- sound_read, sound_write, sound_control }
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/start/start.S b/c/src/lib/libbsp/arm/nds/start/start.S
deleted file mode 100644
index 5e6df11261..0000000000
--- a/c/src/lib/libbsp/arm/nds/start/start.S
+++ /dev/null
@@ -1,280 +0,0 @@
-#include <bsp/linker-symbols.h>
-
-@---------------------------------------------------------------------------------
-@ DS processor selection
-@---------------------------------------------------------------------------------
- .arch armv5te
- .cpu arm946e-s
-@---------------------------------------------------------------------------------
-#define PAGE_4K (0b01011 << 1)
-#define PAGE_8K (0b01100 << 1)
-#define PAGE_16K (0b01101 << 1)
-#define PAGE_32K (0b01110 << 1)
-#define PAGE_64K (0b00111 << 1)
-#define PAGE_128K (0b10000 << 1)
-#define PAGE_256K (0b10001 << 1)
-#define PAGE_512K (0b10010 << 1)
-#define PAGE_1M (0b10011 << 1)
-#define PAGE_2M (0b10100 << 1)
-#define PAGE_4M (0b10101 << 1)
-#define PAGE_8M (0b10110 << 1)
-#define PAGE_16M (0b10111 << 1)
-#define PAGE_32M (0b11000 << 1)
-#define PAGE_64M (0b11001 << 1)
-#define PAGE_128M (0b11010 << 1)
-#define PAGE_256M (0b11011 << 1)
-#define PAGE_512M (0b11100 << 1)
-#define PAGE_1G (0b11101 << 1)
-#define PAGE_2G (0b11110 << 1)
-#define PAGE_4G (0b11111 << 1)
-
-#define ITCM_LOAD (1<<19)
-#define ITCM_ENABLE (1<<18)
-#define DTCM_LOAD (1<<17)
-#define DTCM_ENABLE (1<<16)
-#define DISABLE_TBIT (1<<15)
-#define ROUND_ROBIN (1<<14)
-#define ALT_VECTORS (1<<13)
-#define ICACHE_ENABLE (1<<12)
-#define BIG_ENDIAN (1<<7)
-#define DCACHE_ENABLE (1<<2)
-#define PROTECT_ENABLE (1<<0)
-
- .equ _libnds_argv,0x027FFF70
-
-@---------------------------------------------------------------------------------
- .section ".bsp_start_text", "ax"
- .global _start
-@---------------------------------------------------------------------------------
- .align 4
- .arm
-@---------------------------------------------------------------------------------
-_start:
-@---------------------------------------------------------------------------------
- mov r0, #0x04000000 @ IME = 0;
- str r0, [r0, #0x208]
-
-@---------------------------------------------------------------------------------
-@ turn the power on for M3
-@---------------------------------------------------------------------------------
- ldr r1, =0x8203
- add r0,r0,#0x304
- strh r1, [r0]
-
- ldr r1, =0x00002078 @ disable TCM and protection unit
- mcr p15, 0, r1, c1, c0
-
-@---------------------------------------------------------------------------------
-@ Protection Unit Setup added by Sasq
-@---------------------------------------------------------------------------------
- @ Disable cache
- mov r0, #0
- mcr p15, 0, r0, c7, c5, 0 @ Instruction cache
- mcr p15, 0, r0, c7, c6, 0 @ Data cache
-
- @ Wait for write buffer to empty
- mcr p15, 0, r0, c7, c10, 4
-
- ldr r0, =bsp_section_fast_data_begin
- orr r0,r0,#0x0a
- mcr p15, 0, r0, c9, c1,0 @ DTCM base = bsp_section_fast_data_begin, size = 16 KB
-
- mov r0,#0x20
- mcr p15, 0, r0, c9, c1,1 @ ITCM base = 0 , size = 32 MB
-
-@---------------------------------------------------------------------------------
-@ Setup memory regions similar to Release Version
-@---------------------------------------------------------------------------------
-
- @-------------------------------------------------------------------------
- @ Region 0 - IO registers
- @-------------------------------------------------------------------------
- ldr r0,=( PAGE_64M | 0x04000000 | 1)
- mcr p15, 0, r0, c6, c0, 0
-
- @-------------------------------------------------------------------------
- @ Region 1 - Main Memory
- @-------------------------------------------------------------------------
- ldr r0,=( PAGE_4M | 0x02000000 | 1)
- mcr p15, 0, r0, c6, c1, 0
-
- @-------------------------------------------------------------------------
- @ Region 2 - iwram
- @-------------------------------------------------------------------------
- ldr r0,=( PAGE_32K | 0x037F8000 | 1)
- mcr p15, 0, r0, c6, c2, 0
-
- @-------------------------------------------------------------------------
- @ Region 3 - DS Accessory (GBA Cart)
- @-------------------------------------------------------------------------
- ldr r0,=( PAGE_128M | 0x08000000 | 1)
- mcr p15, 0, r0, c6, c3, 0
-
- @-------------------------------------------------------------------------
- @ Region 4 - DTCM
- @-------------------------------------------------------------------------
- ldr r0,=bsp_section_fast_data_begin
- orr r0,r0,#(PAGE_16K | 1)
- mcr p15, 0, r0, c6, c4, 0
-
- @-------------------------------------------------------------------------
- @ Region 5 - ITCM
- @-------------------------------------------------------------------------
- ldr r0,=bsp_section_fast_text_begin
- orr r0,r0,#(PAGE_32K | 1)
- mcr p15, 0, r0, c6, c5, 0
-
- @-------------------------------------------------------------------------
- @ Region 6 - System ROM
- @-------------------------------------------------------------------------
- ldr r0,=( PAGE_32K | 0xFFFF0000 | 1)
- mcr p15, 0, r0, c6, c6, 0
-
- @-------------------------------------------------------------------------
- @ Region 7 - non cacheable main ram
- @-------------------------------------------------------------------------
- ldr r0,=( PAGE_4M | 0x02400000 | 1)
- mcr p15, 0, r0, c6, c7, 0
-
- @-------------------------------------------------------------------------
- @ Write buffer enable
- @-------------------------------------------------------------------------
- ldr r0,=0b00000010
- mcr p15, 0, r0, c3, c0, 0
-
- @-------------------------------------------------------------------------
- @ DCache & ICache enable
- @-------------------------------------------------------------------------
- ldr r0,=0b01000010
- mcr p15, 0, r0, c2, c0, 0
- mcr p15, 0, r0, c2, c0, 1
-
- @-------------------------------------------------------------------------
- @ IAccess
- @-------------------------------------------------------------------------
- ldr r0,=0x36636333
- mcr p15, 0, r0, c5, c0, 3
-
- @-------------------------------------------------------------------------
- @ DAccess
- @-------------------------------------------------------------------------
- ldr r0,=0x36333333
- mcr p15, 0, r0, c5, c0, 2
-
- @-------------------------------------------------------------------------
- @ Enable ICache, DCache, ITCM & DTCM
- @-------------------------------------------------------------------------
- mrc p15, 0, r0, c1, c0, 0
- ldr r1,= ITCM_ENABLE | DTCM_ENABLE | ICACHE_ENABLE | DCACHE_ENABLE | PROTECT_ENABLE
- orr r0,r0,r1
- mcr p15, 0, r0, c1, c0, 0
-
- mov r0, #0x12 @ Switch to IRQ Mode
- msr cpsr, r0
- ldr sp, =bsp_stack_irq_end @ Set IRQ stack
-
- mov r0, #0x1f @ Switch to SVC Mode
- msr cpsr, r0
- ldr sp, =bsp_stack_svc_end @ Set user stack
-
- ldr r1, =bsp_section_fast_text_load_begin @ Copy instruction tightly coupled memory (itcm section) from LMA to VMA (ROM to RAM)
- ldr r2, =bsp_section_fast_text_begin
- ldr r4, =bsp_section_fast_text_end
- bl CopyMemCheck
-
- ldr r1, =bsp_section_fast_data_load_begin @ Copy data tightly coupled memory (dtcm section) from LMA to VMA (ROM to RAM)
- ldr r2, =bsp_section_fast_data_begin
- ldr r4, =bsp_section_fast_data_end
- bl CopyMemCheck
-
- ldr r0, =bsp_section_bss_begin @ Clear BSS section
- ldr r1, =bsp_section_bss_end
- sub r1, r1, r0
- bl ClearMem
-
- ldr r0, =__sbss_start @ Clear SBSS section
- ldr r1, =__sbss_end
- sub r1, r1, r0
- bl ClearMem
-
- ldr r3, =__libc_init_array @ global constructors
- blx r3
-
- ldr r3, =initSystem
- blx r3 @ jump to user code
-
- mov r0, #0 @ command line
- ldr r3, =boot_card
- blx r3 @ jump to user code
-
- @ If the user ever returns, go back to passme loop
- ldr r0, =ILoop
- ldr r0, [r0]
- ldr r1, =0x027FFE78
- str r0, [r1]
- bx r1
-ILoop:
- b ILoop
-
-
-@---------------------------------------------------------------------------------
-@ Clear memory to 0x00 if length != 0
-@ r0 = Start Address
-@ r1 = Length
-@---------------------------------------------------------------------------------
-ClearMem:
-@---------------------------------------------------------------------------------
- mov r2, #3 @ Round down to nearest word boundary
- add r1, r1, r2 @ Shouldn't be needed
- bics r1, r1, r2 @ Clear 2 LSB (and set Z)
- bxeq lr @ Quit if copy size is 0
-
- mov r2, #0
-ClrLoop:
- stmia r0!, {r2}
- subs r1, r1, #4
- bne ClrLoop
-
- bx lr
-
-@---------------------------------------------------------------------------------
-@ Copy memory if length != 0
-@ r1 = Source Address
-@ r2 = Dest Address
-@ r4 = Dest Address + Length
-@---------------------------------------------------------------------------------
-CopyMemCheck:
-@---------------------------------------------------------------------------------
- sub r3, r4, r2 @ Is there any data to copy?
-@---------------------------------------------------------------------------------
-@ Copy memory
-@ r1 = Source Address
-@ r2 = Dest Address
-@ r3 = Length
-@---------------------------------------------------------------------------------
-CopyMem:
-@---------------------------------------------------------------------------------
- mov r0, #3 @ These commands are used in cases where
- add r3, r3, r0 @ the length is not a multiple of 4,
- bics r3, r3, r0 @ even though it should be.
- bxeq lr @ Length is zero, so exit
-CIDLoop:
- ldmia r1!, {r0}
- stmia r2!, {r0}
- subs r3, r3, #4
- bne CIDLoop
-
- bx lr
-
-
- .global SWI_Handler
- .global do_data_abort
-SWI_Handler:
-do_data_abort:
- mov pc, lr
-
-@---------------------------------------------------------------------------------
- .align
- .pool
- .end
-@---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/startup/bspreset.c b/c/src/lib/libbsp/arm/nds/startup/bspreset.c
deleted file mode 100644
index ebc8d45966..0000000000
--- a/c/src/lib/libbsp/arm/nds/startup/bspreset.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * RTEMS for Nintendo DS platform initialization.
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <bsp.h>
-#include <bsp/bootcard.h>
-#include <nds.h>
-
-void bsp_reset(void)
-{
- swiSoftReset();
-}
diff --git a/c/src/lib/libbsp/arm/nds/startup/bspstart.c b/c/src/lib/libbsp/arm/nds/startup/bspstart.c
deleted file mode 100644
index 5a7ff1ab81..0000000000
--- a/c/src/lib/libbsp/arm/nds/startup/bspstart.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * RTEMS for Nintendo DS platform initialization.
- */
-
-/*
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <bsp.h>
-#include <bsp/bootcard.h>
-#include <bsp/linker-symbols.h>
-#include <bsp/irq.h>
-#include <nds.h>
-
-extern void defaultExceptionHandler(void);
-
-/*
- * start the platform.
- */
-void bsp_start (void)
-{
- /* initialize irq management */
- BSP_rtems_irq_mngt_init ();
-
- /* setup console mode for lower screen */
- irqEnable (IRQ_VBLANK);
- videoSetMode (0);
- videoSetModeSub (MODE_0_2D | DISPLAY_BG0_ACTIVE);
- vramSetBankC (VRAM_C_SUB_BG);
-
- SUB_BG0_CR = BG_MAP_BASE (31);
- BG_PALETTE_SUB[255] = RGB15 (31, 31, 31);
- consoleInitDefault ((u16 *) SCREEN_BASE_BLOCK_SUB (31),
- (u16 *) CHAR_BASE_BLOCK_SUB (0), 16);
-
- /* print status message */
- printk ("[+] kernel console started\n");
-
- /* set the cpu mode to system user */
- arm_cpu_mode = 0x1f;
-
- defaultExceptionHandler ();
-}
-
-/*
- * A few symbols needed by libnds but not used.
- */
-
-#include "../include/sys/iosupport.h"
-const devoptab_t *devoptab_list[STD_MAX];
-void *punixTime;
diff --git a/c/src/lib/libbsp/arm/nds/startup/linkcmds b/c/src/lib/libbsp/arm/nds/startup/linkcmds
deleted file mode 100644
index 5d38b6571f..0000000000
--- a/c/src/lib/libbsp/arm/nds/startup/linkcmds
+++ /dev/null
@@ -1,40 +0,0 @@
-MEMORY {
- ROM : ORIGIN = 0x08000000, LENGTH = 32M
- EWRAM : ORIGIN = 0x02000000, LENGTH = 4M - 4k
- DTCM : ORIGIN = 0x0b000000, LENGTH = 16k
- ITCM : ORIGIN = 0x01000000, LENGTH = 32k
-}
-
-REGION_ALIAS ("REGION_START", EWRAM);
-REGION_ALIAS ("REGION_VECTOR", DTCM);
-REGION_ALIAS ("REGION_TEXT", EWRAM);
-REGION_ALIAS ("REGION_TEXT_LOAD", EWRAM);
-REGION_ALIAS ("REGION_RODATA", EWRAM);
-REGION_ALIAS ("REGION_RODATA_LOAD", EWRAM);
-REGION_ALIAS ("REGION_DATA", EWRAM);
-REGION_ALIAS ("REGION_DATA_LOAD", EWRAM);
-REGION_ALIAS ("REGION_FAST_TEXT", ITCM);
-REGION_ALIAS ("REGION_FAST_TEXT_LOAD", EWRAM);
-REGION_ALIAS ("REGION_FAST_DATA", DTCM);
-REGION_ALIAS ("REGION_FAST_DATA_LOAD", EWRAM);
-REGION_ALIAS ("REGION_BSS", EWRAM);
-REGION_ALIAS ("REGION_WORK", EWRAM);
-REGION_ALIAS ("REGION_STACK", EWRAM);
-REGION_ALIAS ("REGION_NOCACHE", EWRAM);
-REGION_ALIAS ("REGION_NOCACHE_LOAD", EWRAM);
-
-__dtcm_top = ORIGIN (DTCM) + LENGTH (DTCM);
-__irq_flags = __dtcm_top - 0x08;
-__irq_vector = __dtcm_top - 0x04;
-
-SECTIONS {
- .sbss : {
- __sbss_start = ABSOLUTE(.);
- __sbss_start__ = ABSOLUTE(.);
- *(.sbss)
- . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
- __sbss_end = ABSOLUTE(.);
- } > DTCM
-}
-
-INCLUDE linkcmds.armv4
diff --git a/c/src/lib/libbsp/arm/nds/timer/timer.c b/c/src/lib/libbsp/arm/nds/timer/timer.c
deleted file mode 100644
index 8c0eda35e2..0000000000
--- a/c/src/lib/libbsp/arm/nds/timer/timer.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * RTEMS for Nintendo DS performance timer driver.
- *
- * Copyright (c) 2008 by Benjamin Ratier <agho.pwn@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <rtems.h>
-#include <rtems/btimer.h>
-#include <bsp.h>
-#include <nds.h>
-
-bool benchmark_timer_find_average_overhead;
-
-void
-benchmark_timer_initialize (void)
-{
- TIMER_CR (1) = 0x0000;
- TIMER_CR (2) = 0x0000;
- TIMER_DATA (1) = TIMER_FREQ (1000000);
- TIMER_DATA (2) = 0x0000;
- TIMER_CR (1) = TIMER_ENABLE | TIMER_DIV_1;
- TIMER_CR (2) = TIMER_ENABLE | TIMER_CASCADE;
-}
-
-/*
- * values taken out from gba bsp.
- */
-
-#define AVG_OVERHEAD 3
-#define LEAST_VALID 1
-
-uint32_t
-benchmark_timer_read (void)
-{
- uint32_t ticks;
-
- /* stop counters */
- TIMER_CR (1) = 0x0000;
- TIMER_CR (2) = 0x0000;
-
- /* read counter */
- ticks = (TIMER_DATA (2) << 16) | TIMER_DATA (1);
- return ticks;
-}
-
-void
-benchmark_timer_disable_subtracting_average_overhead (bool find_flag)
-{
- benchmark_timer_find_average_overhead = find_flag;
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/Makefile.am b/c/src/lib/libbsp/arm/nds/tools/Makefile.am
deleted file mode 100644
index cc5017cc66..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/Makefile.am
+++ /dev/null
@@ -1,58 +0,0 @@
-ACLOCAL_AMFLAGS = -I ../../../../../aclocal
-
-transform =
-bsptools_bindir = ${exec_prefix}/@RTEMS_BSP@/build-tools
-bsptools_bin_SCRIPTS = runtest
-bsptools_bin_PROGRAMS = ndstool
-
-## HACK: install to build-tree
-all-local: $(TMPINSTALL_FILES)
-
-TMPINSTALL_FILES =
-
-$(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_ROOT)/@RTEMS_BSP@/tests
- @: > $(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp)
-TMPINSTALL_FILES += $(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp)
-
-$(PROJECT_ROOT)/@RTEMS_BSP@/tests/runtest: runtest $(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp)
- $(INSTALL_SCRIPT) $< $(PROJECT_ROOT)/@RTEMS_BSP@/tests/runtest
-TMPINSTALL_FILES += $(PROJECT_ROOT)/@RTEMS_BSP@/tests/runtest
-
-CLEANFILES = $(TMPINSTALL_FILES)
-
-ndstool_SOURCES = ndstool/source/arm7_sha1_homebrew.c \
- ndstool/source/arm7_sha1_nintendo.c \
- ndstool/source/banner.cpp \
- ndstool/source/bigint.cpp \
- ndstool/source/compile_date.c \
- ndstool/source/crc.cpp \
- ndstool/source/default_icon.c \
- ndstool/source/encryption.cpp \
- ndstool/source/header.cpp \
- ndstool/source/hook.cpp \
- ndstool/source/loadme.c \
- ndstool/source/logo.cpp \
- ndstool/source/ndscodes.cpp \
- ndstool/source/ndscreate.cpp \
- ndstool/source/ndsextract.cpp \
- ndstool/source/ndstool.cpp \
- ndstool/source/ndstree.cpp \
- ndstool/source/passme.cpp \
- ndstool/source/passme_sram.c \
- ndstool/source/raster.cpp \
- ndstool/source/sha1.cpp
-ndstool_CPPFLAGS = -I$(srcdir)/ndstool/include -DVERSION="\"compiled for rtems\""
-ndstool_CFLAGS =
-ndstool_CXXFLAGS =
-
-$(PROJECT_ROOT)/@RTEMS_BSP@/build-tools/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_ROOT)/@RTEMS_BSP@/build-tools
- @: > $(PROJECT_ROOT)/@RTEMS_BSP@/build-tools/$(dirstamp)
-TMPINSTALL_FILES += $(PROJECT_ROOT)/@RTEMS_BSP@/build-tools/$(dirstamp)
-
-$(PROJECT_ROOT)/@RTEMS_BSP@/build-tools/ndstool$(EXEEXT): ndstool$(EXEEXT) $(PROJECT_ROOT)/@RTEMS_BSP@/build-tools/$(dirstamp)
- $(INSTALL_PROGRAM) $< $(PROJECT_ROOT)/@RTEMS_BSP@/build-tools/ndstool$(EXEEXT)
-TMPINSTALL_FILES += $(PROJECT_ROOT)/@RTEMS_BSP@/build-tools/ndstool$(EXEEXT)
-
-include $(top_srcdir)/../../../../../automake/host.am
diff --git a/c/src/lib/libbsp/arm/nds/tools/bin2s.c b/c/src/lib/libbsp/arm/nds/tools/bin2s.c
deleted file mode 100644
index 9c58309ce8..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/bin2s.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*---------------------------------------------------------------------------------
- bin2s: convert a binary file to a gcc asm-module
- for gfx/foo.bin it'll write foo_bin (an array of char)
- foo_bin_end, and foo_bin_len (an unsigned int)
- for 4bit.chr it'll write _4bit_chr, _4bit_chr_end, and
- _4bit_chr_len
-
-
- Copyright 2003 - 2005 Damian Yerrick
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- IN THE SOFTWARE.
-
----------------------------------------------------------------------------------*/
-
-
-
-/*
-.align
-.global SomeLabel_len
-.int 1234
-.global SomeLabel
-.byte blah,blah,blah,blah...
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-/*---------------------------------------------------------------------------------
- Print the closest valid C identifier to a given word.
----------------------------------------------------------------------------------*/
-void strnident(FILE *fout, const char *src) {
-//---------------------------------------------------------------------------------
- char got_first = 0;
-
- while(*src != 0) {
-
- int s = *src++;
-
- /* initial digit */
- if(isdigit(s) && !got_first)
- fputc('_', fout); /* stick a '_' before an initial digit */
-
- /* convert only out-of-range characters */
- if(!isalpha(s) && !isdigit(s) && (s != '_')) {
- if(s == '-' || s == '.' || s == '/') s = '_';
- else
- s = 0;
- }
-
- if(s) {
- fputc(s, fout);
- got_first = 1;
- }
- }
-}
-
-
-//---------------------------------------------------------------------------------
-int main(int argc, char **argv) {
-//---------------------------------------------------------------------------------
- FILE *fin;
- size_t filelen;
- int linelen;
- int arg;
- int alignment = 4;
- if(argc < 2) {
- fputs( "bin2s - convert binary files to assembly language\n"
- "typical usage: bin2s foo.bin bar.bin baz.bin > foo.s\n", stderr);
- return 1;
- }
-
- for(arg = 1; arg < argc; arg++) {
-
- if (argv[arg][0] == '-')
- {
- switch (argv[arg][1])
- {
- case 'a':
-
- alignment = (argc > arg) ? strtoul(argv[++arg], 0, 0) : 0;
-
- if ( alignment == 0 ) alignment =4;
- break;
- }
- continue;
- }
-
-
- fin = fopen(argv[arg], "rb");
-
- if(!fin) {
- fputs("bin2s: could not open ", stderr);
- perror(argv[arg]);
- return 1;
- }
-
- fseek(fin, 0, SEEK_END);
- filelen = ftell(fin);
- rewind(fin);
-
- if(filelen == 0) {
- fclose(fin);
- fprintf(stderr, "bin2s: warning: skipping empty file %s\n", argv[arg]);
- continue;
- }
-
- char *ptr = argv[arg];
- char chr;
- char *filename = NULL;
-
- while ( (chr=*ptr) ) {
-
- if ( chr == '\\' || chr == '/') {
-
- filename = ptr;
- }
-
- ptr++;
- }
-
- if ( NULL != filename ) {
- filename++;
- } else {
- filename = argv[arg];
- }
-
- /*---------------------------------------------------------------------------------
- Generate the prolog for each included file. It has two purposes:
-
- 1. provide length info, and
- 2. align to user defined boundary, default is 32bit
-
- ---------------------------------------------------------------------------------*/
- fprintf( stdout, "/* Generated by BIN2S - please don't edit directly */\n"
- "\t.section .rodata\n"
- "\t.balign %d\n"
- "\t.global ", alignment);
- strnident(stdout, filename);
- fputs("_size\n", stdout);
- strnident(stdout, filename);
- printf("_size: .int %lu\n\t.global ", (unsigned long)filelen);
- strnident(stdout, filename);
- fputs("\n", stdout);
- strnident(stdout, filename);
- fputs(":\n\t.byte ", stdout);
-
- linelen = 0;
-
- while(filelen > 0) {
- unsigned char c = fgetc(fin);
-
- printf("%3u", (unsigned int)c);
- filelen--;
-
- /* don't put a comma after the last item */
- if(filelen) {
-
- /* break after every 16th number */
- if(++linelen >= 16) {
- linelen = 0;
- fputs("\n\t.byte ", stdout);
- } else {
- fputc(',', stdout);
- }
- }
- }
-
- fputs("\n\n\t.global ", stdout);
- strnident(stdout, filename);
- fputs("_end\n", stdout);
- strnident(stdout, filename);
- fputs("_end:\n\n", stdout);
-
-
- fclose(fin);
- }
-
- return 0;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/tools/configure.ac b/c/src/lib/libbsp/arm/nds/tools/configure.ac
deleted file mode 100644
index 629d9cbb11..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/configure.ac
+++ /dev/null
@@ -1,24 +0,0 @@
-AC_PREREQ([2.69])
-AC_INIT([rtems-c-src-lib-libbsp-arm-nds-tools],[_RTEMS_VERSION],[https://devel.rtems.org/newticket])
-AC_CONFIG_SRCDIR([runtest])
-RTEMS_TOP(../../../../../../..)
-
-# HACK: so we use the default native flags and do not inherit cross cflags
-# HACK: I really hope we get a better solution soon. --joel
-CFLAGS=
-AC_PROG_CC
-AC_PROG_CXX
-
-## RTEMS_CANONICAL_TARGET_CPU
-
-AM_INIT_AUTOMAKE([no-define foreign 1.12.2])
-AM_MAINTAINER_MODE
-
-RTEMS_ENV_RTEMSBSP
-
-RTEMS_PROJECT_ROOT
-RTEMS_TOOLPATHS
-
-# Explicitly list all Makefiles here
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/arm7_sha1_homebrew.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/arm7_sha1_homebrew.h
deleted file mode 100644
index 268b55ffcb..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/arm7_sha1_homebrew.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- This file was autogenerated by raw2c.
-Visit http://www.devkitpro.org
-*/
-
-//---------------------------------------------------------------------------------
-#ifndef _arm7_sha1_homebrew_h_
-#define _arm7_sha1_homebrew_h_
-//---------------------------------------------------------------------------------
-extern const unsigned char arm7_sha1_homebrew[];
-extern const int arm7_sha1_homebrew_size;
-//---------------------------------------------------------------------------------
-#endif //_arm7_sha1_homebrew_h_
-//---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/arm7_sha1_nintendo.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/arm7_sha1_nintendo.h
deleted file mode 100644
index 2b44b7a1ca..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/arm7_sha1_nintendo.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- This file was autogenerated by raw2c.
-Visit http://www.devkitpro.org
-*/
-
-//---------------------------------------------------------------------------------
-#ifndef _arm7_sha1_nintendo_h_
-#define _arm7_sha1_nintendo_h_
-//---------------------------------------------------------------------------------
-extern const unsigned char arm7_sha1_nintendo[];
-extern const int arm7_sha1_nintendo_size;
-//---------------------------------------------------------------------------------
-#endif //_arm7_sha1_nintendo_h_
-//---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/banner.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/banner.h
deleted file mode 100644
index e880636bdf..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/banner.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma pack(1)
-
-struct Banner
-{
- unsigned_short version;
- unsigned_short crc;
- unsigned char reserved[28];
- unsigned char tile_data[4][4][8][4];
- unsigned_short palette[16];
- unsigned_short title[6][128]; // max. 3 lines. seperated by linefeed character
-};
-
-#pragma pack()
-
-extern const char *bannerLanguages[];
-
-int InsertTitleString(char *String, FILE *file);
-unsigned short CalcBannerCRC(Banner &banner);
-void IconFromBMP();
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/bigint.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/bigint.h
deleted file mode 100644
index 27d01a26b8..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/bigint.h
+++ /dev/null
@@ -1,11 +0,0 @@
-struct BigInt
-{
- unsigned char data[129*2]; // 128*2 doesn't seem to be enough for 1024 bit keys
-
- int Sub(BigInt &a, BigInt &b, int b_shift);
- void MulMod(BigInt &a, BigInt &b, BigInt &m);
- void PowMod(BigInt &n, BigInt &m);
- void print();
- void Set(unsigned char *data, unsigned int length);
- void Get(unsigned char *data, unsigned int length);
-};
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/crc.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/crc.h
deleted file mode 100644
index 9dbbc71e2b..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/crc.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- Cyclic Redundancy Code (CRC) functions
- by Rafael Vuijk (aka DarkFader)
-*/
-
-#ifndef __CRC_H
-#define __CRC_H
-
-//#include "little.h" // FixCrc is not yet big endian compatible
-
-/*
- * Data
- */
-extern unsigned short ccitt16tab[];
-extern unsigned short crc16tab[];
-extern unsigned long crc32tab[];
-
-/*
- * Defines
- */
-#define CRC_TEMPLATE template <typename CrcType, CrcType *crcTable>
-
-/*
- * CalcCcitt
- * Does not perform final inversion.
- */
-#define CalcCcitt_ CalcCcitt<CrcType, crcTable>
-#define CalcCcitt16 CalcCcitt<typeof(*ccitt16tab), ccitt16tab>
-CRC_TEMPLATE inline CrcType CalcCcitt(unsigned char *data, unsigned int length, CrcType crc = (CrcType)0)
-{
- for (unsigned int i=0; i<length; i++)
- {
- crc = (crc << 8) ^ crcTable[(crc >> 8) ^ data[i]];
- }
- return crc;
-}
-
-/*
- * CalcCrc
- * Does not perform final inversion.
- */
-#define CalcCrc_ CalcCrc<CrcType, crcTable>
-#define CalcCrc16 CalcCrc<typeof(*crc16tab), crc16tab>
-#define CalcCrc32 CalcCrc<typeof(*crc32tab), crc32tab>
-CRC_TEMPLATE inline CrcType CalcCrc(unsigned char *data, unsigned int length, CrcType crc = (CrcType)~0)
-{
- for (unsigned int i=0; i<length; i++)
- {
- crc = (crc >> 8) ^ crcTable[(crc ^ data[i]) & 0xFF];
- }
- return crc;
-}
-
-/*
- * FCalcCrc
- * Does not perform final inversion.
- */
-#define FCalcCrc_ FCalcCrc<CrcType, crcTable>
-#define FCalcCrc16 FCalcCrc<typeof(*crc16tab), crc16tab>
-#define FCalcCrc32 FCalcCrc<typeof(*crc32tab), crc32tab>
-CRC_TEMPLATE inline CrcType FCalcCrc(FILE *f, unsigned int offset, unsigned int length, CrcType crc = (CrcType)~0)
-{
- fseek(f, offset, SEEK_SET);
- for (unsigned int i=0; i<length; i++)
- {
- crc = (crc >> 8) ^ crcTable[(crc ^ fgetc(f)) & 0xFF];
- }
- return crc;
-}
-
-/*
- * RevCrc
- * Reverse table lookup.
- */
-#define RevCrc_ RevCrc<CrcType, crcTable>
-CRC_TEMPLATE inline unsigned char RevCrc(unsigned char x, CrcType *value = 0)
-{
- for (int y=0; y<256; y++)
- {
- if ((crcTable[y] >> (8*sizeof(CrcType)-8)) == x)
- {
- if (value) *value = crcTable[y];
- return y;
- }
- }
- return 0;
-}
-
-/*
- * FixCrc
- */
-#define FixCrc_ FixCrc<CrcType, crcTable>
-#define FixCrc16 FixCrc<typeof(*crc16tab), crc16tab>
-#define FixCrc32 FixCrc<typeof(*crc32tab), crc32tab>
-CRC_TEMPLATE void FixCrc
-(
- unsigned char *data, // data to be patched
- unsigned int patch_offset, unsigned char *patch_data, unsigned int patch_length, // patch data
- unsigned int fix_offset = 0, // position to write the fix. by default, it is immediately after the patched data
- CrcType initial_crc = (CrcType)~0 // useful when manually calculating leading data
-)
-{
- if (!fix_offset) fix_offset = patch_offset + patch_length;
-
- // calculate CRC after leading data
- initial_crc = CalcCrc_(data, patch_offset, initial_crc);
-
- // calculate CRC before fix
- unsigned char buf[2*sizeof(CrcType)];
- CrcType crc_before_fix = CalcCrc_(data + patch_offset, fix_offset - patch_offset);
- *(CrcType *)(buf + 0) = crc_before_fix;
-
- // patch
- memcpy(data + patch_offset, patch_data, patch_length);
-
- // calculate CRC after unfixed
- CrcType crc_after_unfix = CalcCrc_(data + patch_offset, fix_offset - patch_offset + sizeof(CrcType));
- *(CrcType *)(buf + sizeof(CrcType)) = crc_after_unfix;
-
- // fix it
- for (int i=sizeof(CrcType); i>=1; i--)
- {
- CrcType value;
- unsigned char index = RevCrc_(buf[i + sizeof(CrcType) - 1], &value);
- *(CrcType *)(buf + i) ^= value;
- buf[i - 1] ^= index;
- }
- memcpy(data + fix_offset, buf, sizeof(CrcType));
-}
-
-/*
- * FFixCrc
- */
-#define FFixCrc_ FFixCrc<CrcType, crcTable>
-#define FFixCrc16 FFixCrc<typeof(*crc16tab), crc16tab>
-#define FFixCrc32 FFixCrc<typeof(*crc32tab), crc32tab>
-CRC_TEMPLATE void FFixCrc
-(
- FILE *f, // file to be patched
- unsigned int patch_offset, unsigned char *patch_data, unsigned int patch_length, // patch data
- unsigned int fix_offset = 0, // position to write the fix. by default, it is immediately after the patched data
- CrcType initial_crc = (CrcType)~0 // useful when manually calculating leading data
-)
-{
- if (!fix_offset) fix_offset = patch_offset + patch_length;
-
- // calculate CRC after leading data
- initial_crc = FCalcCrc_(f, 0, patch_offset, initial_crc);
-
- // calculate CRC before fix
- unsigned char buf[2*sizeof(CrcType)];
- CrcType crc_before_fix = FCalcCrc_(f, patch_offset, fix_offset - patch_offset);
- *(CrcType *)(buf + 0) = crc_before_fix;
-
- // patch
- fseek(f, patch_offset, SEEK_SET);
- fwrite(patch_data, 1, patch_length, f);
-
- // calculate CRC after unfixed
- CrcType crc_after_unfix = FCalcCrc_(f, patch_offset, fix_offset - patch_offset + sizeof(CrcType));
- *(CrcType *)(buf + sizeof(CrcType)) = crc_after_unfix;
-
- // fix it
- for (int i=sizeof(CrcType); i>=1; i--)
- {
- CrcType value;
- unsigned char index = RevCrc_(buf[i + sizeof(CrcType) - 1], &value);
- *(CrcType *)(buf + i) ^= value;
- buf[i - 1] ^= index;
- }
- fseek(f, fix_offset, SEEK_SET);
- fwrite(buf, sizeof(CrcType), 1, f);
-}
-
-#endif // __CRC_H
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/default_icon.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/default_icon.h
deleted file mode 100644
index 87894e07c6..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/default_icon.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- This file was autogenerated by raw2c.
-Visit http://www.devkitpro.org
-*/
-
-//---------------------------------------------------------------------------------
-#ifndef _default_icon_h_
-#define _default_icon_h_
-//---------------------------------------------------------------------------------
-extern const unsigned char default_icon[];
-extern const int default_icon_size;
-//---------------------------------------------------------------------------------
-#endif //_default_icon_h_
-//---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/encryption.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/encryption.h
deleted file mode 100644
index c34e3fb553..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/encryption.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __ENCRYPTION_H
-#define __ENCRYPTION_H
-
-#include "types.h"
-
-extern void EnDecryptSecureArea(char *ndsfilename, char endecrypt_option);
-extern void encrypt_arm9(u32 cardheader_gamecode, unsigned char *data);
-extern void decrypt_arm9(u32 cardheader_gamecode, unsigned char *data);
-
-#endif // __ENCRYPTION_H
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/header.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/header.h
deleted file mode 100644
index f6bbfcac64..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/header.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#pragma pack(1)
-
-struct Header
-{
- char title[0xC];
- char gamecode[0x4];
- char makercode[2];
- unsigned char unitcode; // product code. 0 = Nintendo DS
- unsigned char devicetype; // device code. 0 = normal
- unsigned char devicecap; // device size. (1<<n Mbit)
- unsigned char reserved1[0x9]; // 0x015..0x01D
- unsigned char romversion;
- unsigned char reserved2; // 0x01F
- unsigned_int arm9_rom_offset; // points to libsyscall and rest of ARM9 binary
- unsigned_int arm9_entry_address;
- unsigned_int arm9_ram_address;
- unsigned_int arm9_size;
- unsigned_int arm7_rom_offset;
- unsigned_int arm7_entry_address;
- unsigned_int arm7_ram_address;
- unsigned_int arm7_size;
- unsigned_int fnt_offset;
- unsigned_int fnt_size;
- unsigned_int fat_offset;
- unsigned_int fat_size;
- unsigned_int arm9_overlay_offset;
- unsigned_int arm9_overlay_size;
- unsigned_int arm7_overlay_offset;
- unsigned_int arm7_overlay_size;
- unsigned_int rom_control_info1; // 0x00416657 for OneTimePROM
- unsigned_int rom_control_info2; // 0x081808F8 for OneTimePROM
- unsigned_int banner_offset;
- unsigned_short secure_area_crc;
- unsigned_short rom_control_info3; // 0x0D7E for OneTimePROM
- unsigned_int offset_0x70; // magic1 (64 bit encrypted magic code to disable LFSR)
- unsigned_int offset_0x74; // magic2
- unsigned_int offset_0x78; // unique ID for homebrew
- unsigned_int offset_0x7C; // unique ID for homebrew
- unsigned_int application_end_offset; // rom size
- unsigned_int rom_header_size;
- unsigned_int offset_0x88; // reserved... ?
- unsigned_int offset_0x8C;
-
- // reserved
- unsigned_int offset_0x90;
- unsigned_int offset_0x94;
- unsigned_int offset_0x98;
- unsigned_int offset_0x9C;
- unsigned_int offset_0xA0;
- unsigned_int offset_0xA4;
- unsigned_int offset_0xA8;
- unsigned_int offset_0xAC;
- unsigned_int offset_0xB0;
- unsigned_int offset_0xB4;
- unsigned_int offset_0xB8;
- unsigned_int offset_0xBC;
-
- unsigned char logo[156]; // character data
- unsigned_short logo_crc;
- unsigned_short header_crc;
-
- // 0x160..0x17F reserved
- unsigned_int offset_0x160;
- unsigned_int offset_0x164;
- unsigned_int offset_0x168;
- unsigned_int offset_0x16C;
- unsigned char zero[0x90];
-};
-
-#pragma pack()
-
-
-struct Country
-{
- const char countrycode;
- const char *name;
-};
-
-struct Maker
-{
- const char *makercode;
- const char *name;
-};
-
-extern Country countries[];
-extern int NumCountries;
-
-extern Maker makers[];
-extern int NumMakers;
-
-unsigned short CalcHeaderCRC(Header &header);
-unsigned short CalcLogoCRC(Header &header);
-void FixHeaderCRC(char *ndsfilename);
-void ShowInfo(char *ndsfilename);
-int HashAndCompareWithList(char *filename, unsigned char sha1[]);
-int DetectRomType();
-unsigned short CalcSecureAreaCRC(bool encrypt);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/hook.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/hook.h
deleted file mode 100644
index 7004bdd067..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/hook.h
+++ /dev/null
@@ -1 +0,0 @@
-void Hook(char *ndsfilename, char *arm7filename);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/little.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/little.h
deleted file mode 100644
index 06ab14acea..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/little.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#pragma pack(1)
-
-#include "types.h"
-
-#ifndef BYTE_ORDER
- #error "BYTE_ORDER not defined"
-#endif
-
-#if BYTE_ORDER != BIG_ENDIAN
- #define NOSWAP
-#endif
-
-//template <typename T> struct Blah32
-//{
-// unsigned T i;
-// #ifdef NOSWAP
-// operator T () { return i; }
-// T & operator = (T i) { return this->i = i; }
-// #else
-// operator T () { return i<<24 | i<<8&0xFF0000 | i>>8&0xFF00 | i>>24; }
-// T & operator = (T i) { return this->i = i<<24 | i<<8&0xFF0000 | i>>8&0xFF00 | i>>24; }
-// #endif
-// Blah() {}
-// Blah(T i) { *this = i; }
-//};
-
-struct unsigned_int
-{
- unsigned int i;
- #ifdef NOSWAP
- operator unsigned int () { return i; }
- unsigned int & operator = (unsigned int i) { return this->i = i; }
- #else
- operator unsigned int () { return i<<24 | i<<8&0xFF0000 | i>>8&0xFF00 | i>>24; }
- unsigned int & operator = (unsigned int i) { return this->i = i<<24 | i<<8&0xFF0000 | i>>8&0xFF00 | i>>24; }
- #endif
- unsigned_int() {}
- unsigned_int(unsigned int i) { *this = i; }
-};
-
-struct unsigned_long
-{
- unsigned long i;
- #ifdef NOSWAP
- operator unsigned long () { return i; }
- unsigned long & operator = (unsigned long i) { return this->i = i; }
- #else
- operator unsigned long () { return i<<24 | i<<8&0xFF0000 | i>>8&0xFF00 | i>>24; }
- unsigned long & operator = (unsigned long i) { return this->i = i<<24 | i<<8&0xFF0000 | i>>8&0xFF00 | i>>24; }
- #endif
- unsigned_long() {}
- unsigned_long(unsigned long i) { *this = i; }
-};
-
-struct unsigned_short
-{
- unsigned short i;
- #ifdef NOSWAP
- operator unsigned short () { return i; }
- unsigned short & operator = (unsigned short i) { return this->i = i; }
- #else
- operator unsigned short () { return i>>8 | i<<8; }
- unsigned short & operator = (unsigned short i) { return this->i = i>>8 | i<<8; }
- #endif
- unsigned_short() {}
- unsigned_short(unsigned short i) { *this = i; }
-};
-
-struct signed_int
-{
- unsigned int i;
- #ifdef NOSWAP
- operator signed int () { return i; }
- signed int & operator = (signed int i) { return (signed int &)this->i = i; }
- #else
- operator signed int () { return i<<24 | i<<8&0xFF0000 | i>>8&0xFF00 | i>>24; }
- signed int & operator = (signed int i) { return (signed int &)this->i = i<<24 | i<<8&0xFF0000 | i>>8&0xFF00 | i>>24; }
- #endif
- signed_int() {}
- signed_int(signed int i) { *this = i; }
-};
-
-struct signed_long
-{
- unsigned long i;
- #ifdef NOSWAP
- operator signed long () { return i; }
- signed long & operator = (signed long i) { return (signed long &)this->i = i; }
- #else
- operator signed long () { return i<<24 | i<<8&0xFF0000 | i>>8&0xFF00 | i>>24; }
- signed long & operator = (signed long i) { return (signed long &)this->i = i<<24 | i<<8&0xFF0000 | i>>8&0xFF00 | i>>24; }
- #endif
- signed_long() {}
- signed_long(signed long i) { *this = i; }
-};
-
-struct signed_short
-{
- unsigned short i;
- #ifdef NOSWAP
- operator signed short () { return i; }
- signed short & operator = (unsigned short i) { return (signed short &)this->i = i; }
- #else
- operator signed short () { return i>>8 | i<<8; }
- signed short & operator = (unsigned short i) { return (signed short &)this->i = i>>8 | i<<8; }
- #endif
- signed_short() {}
- signed_short(signed short i) { *this = i; }
-};
-
-#pragma pack()
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/loadme.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/loadme.h
deleted file mode 100644
index d73df9bd86..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/loadme.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- This file was autogenerated by raw2c.
-Visit http://www.devkitpro.org
-*/
-
-//---------------------------------------------------------------------------------
-#ifndef _loadme_h_
-#define _loadme_h_
-//---------------------------------------------------------------------------------
-extern const unsigned char loadme[];
-extern const int loadme_size;
-//---------------------------------------------------------------------------------
-#endif //_loadme_h_
-//---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/logo.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/logo.h
deleted file mode 100644
index e01c2c4dfd..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/logo.h
+++ /dev/null
@@ -1 +0,0 @@
-int LogoConvert(unsigned char *srcp, unsigned char *dstp, unsigned char white);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndscreate.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndscreate.h
deleted file mode 100644
index 679adada47..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndscreate.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "ndstree.h"
-
-void AddFile(char *rootdir, char *prefix, char *entry_name, unsigned int file_id, unsigned int alignmask);
-void AddDirectory(TreeNode *node, char *prefix, unsigned int this_dir_id, unsigned int _parent_id, unsigned int alignmask);
-void Create();
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndsextract.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndsextract.h
deleted file mode 100644
index 5b30f56ff7..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndsextract.h
+++ /dev/null
@@ -1,3 +0,0 @@
-void ExtractFiles(char *ndsfilename);
-void ExtractOverlayFiles();
-void Extract(char *outfilename, bool indirect_offset, unsigned int offset, bool indirect_size, unsigned size, bool with_footer = false);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndstool.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndstool.h
deleted file mode 100644
index aae1ffdca8..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndstool.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <fcntl.h>
-//#include <libelf.h>
-#include "little.h"
-#include "header.h"
-
-#define ROMTYPE_HOMEBREW 0
-#define ROMTYPE_MULTIBOOT 1
-#define ROMTYPE_NDSDUMPED 2 // decrypted secure area
-#define ROMTYPE_ENCRSECURE 3
-#define ROMTYPE_MASKROM 4 // unknown layout
-
-#define MAX_FILEMASKS 16
-
-enum { BANNER_BINARY, BANNER_IMAGE };
-
-extern unsigned int free_file_id;
-extern unsigned int file_end;
-
-extern unsigned int free_dir_id;
-extern unsigned int directory_count;
-extern unsigned int file_count;
-extern unsigned int total_name_size;
-
-extern unsigned int free_file_id;
-extern unsigned int _entry_start;
-extern unsigned int file_top;
-
-extern int verbose;
-extern Header header;
-extern FILE *fNDS;
-extern char *romlistfilename;
-extern char *filemasks[MAX_FILEMASKS];
-extern int filemask_num;
-extern char *ndsfilename;
-extern char *arm7filename;
-extern char *arm9filename;
-extern char *filerootdir;
-extern char *overlaydir;
-extern char *arm7ovltablefilename;
-extern char *arm9ovltablefilename;
-extern char *bannerfilename;
-extern char *bannertext;
-extern int bannertype;
-//extern bool compatibility;
-extern char *headerfilename_or_size;
-extern char *uniquefilename;
-extern char *logofilename;
-extern unsigned int arm9RamAddress;
-extern unsigned int arm7RamAddress;
-extern unsigned int arm9Entry;
-extern unsigned int arm7Entry;
-extern char *title;
-extern char *makercode;
-extern char *gamecode;
-extern int latency1;
-extern int latency2;
-extern int romversion;
-
-extern const char CompileDate[];
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndstree.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndstree.h
deleted file mode 100644
index 5d86e8cac7..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/ndstree.h
+++ /dev/null
@@ -1,60 +0,0 @@
-inline int cmp(const char *a, bool a_isdir, const char *b, bool b_isdir)
-{
- // oh... directory sort doesn't matter since we write out dir- and filenames seperately
- //if (a_isdir && !b_isdir) return -1;
- //if (b_isdir && !a_isdir) return +1;
- return strcmp(a, b);
-}
-
-struct TreeNode
-{
- unsigned int dir_id; // directory ID in case of directory entry
- const char *name; // file or directory name
- TreeNode *directory; // nonzero indicates directory. first directory node is a dummy
- TreeNode *prev, *next; // linked list
-
- TreeNode()
- {
- dir_id = 0;
- name = "";
- directory = 0;
- prev = next = 0;
- }
-
- // new entry in same directory
- TreeNode *New(const char *name, bool isdir)
- {
- TreeNode *newNode = new TreeNode();
- newNode->name = strdup(name);
-
- TreeNode *node = this;
-
- if (cmp(name, isdir, node->name, node->dir_id) < 0) // prev
- {
- while (cmp(name, isdir, node->name, node->dir_id) < 0)
- {
- if (node->prev)
- node = node->prev;
- else
- break; // insert after dummy node
- }
- }
- else
- {
- while (node->next && (cmp(name, isdir, node->next->name, node->next->dir_id) >= 0))
- {
- node = node->next;
- }
- }
-
- // insert after current node
- newNode->prev = node;
- newNode->next = node->next;
- if (node->next) node->next->prev = newNode;
- node->next = newNode;
-
- return newNode;
- }
-};
-
-TreeNode *ReadDirectory(TreeNode *node, char *path);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/overlay.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/overlay.h
deleted file mode 100644
index 56c5da7db0..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/overlay.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma pack(1)
-
-struct OverlayEntry
-{
- unsigned int id;
- unsigned int ram_address;
- unsigned int ram_size;
- unsigned int bss_size;
- unsigned int sinit_init;
- unsigned int sinit_init_end;
- unsigned int file_id;
- unsigned int reserved;
-};
-
-#pragma pack()
-
-#define OVERLAY_FMT "overlay_%04u.bin"
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme.h
deleted file mode 100644
index 7b612b9b85..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme.h
+++ /dev/null
@@ -1 +0,0 @@
-int PassMe(char *ndsfilename, char *vhdfilename, char *sramfilename);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_sram.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_sram.h
deleted file mode 100644
index 2088c3741f..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_sram.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- This file was autogenerated by raw2c.
-Visit http://www.devkitpro.org
-*/
-
-//---------------------------------------------------------------------------------
-#ifndef _passme_sram_h_
-#define _passme_sram_h_
-//---------------------------------------------------------------------------------
-extern const unsigned char passme_sram[];
-extern const int passme_sram_size;
-//---------------------------------------------------------------------------------
-#endif //_passme_sram_h_
-//---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_vhd1.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_vhd1.h
deleted file mode 100644
index 37d1c4c3c4..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_vhd1.h
+++ /dev/null
@@ -1,55 +0,0 @@
-"-- standard libraries\n"
-"library IEEE;\n"
-"use IEEE.STD_LOGIC_1164.ALL;\n"
-"use IEEE.STD_LOGIC_ARITH.ALL;\n"
-"use IEEE.STD_LOGIC_UNSIGNED.ALL;\n"
-"\n"
-"entity PassMe is\n"
-"\tport\n"
-"\t(\n"
-"\t\tDSSLOT_CLK\t\t: in std_logic;\n"
-"\t\tDSSLOT_ROMCS\t: in std_logic;\n"
-"\t\tDSSLOT_RESET\t: in std_logic;\n"
-"\t\tDSSLOT_EEPCS\t: in std_logic;\n"
-"\t\tDSSLOT_IRQ\t\t: out std_logic;\n"
-"\t\tDSSLOT_IO\t\t: inout std_logic_vector(7 downto 0);\n"
-"\t\t\n"
-"\t\tDSCART_CLK\t\t: out std_logic;\n"
-"\t\tDSCART_ROMCS\t: out std_logic;\n"
-"\t\tDSCART_RESET\t: out std_logic;\n"
-"\t\tDSCART_EEPCS\t: out std_logic;\n"
-"\t\tDSCART_IRQ \t\t: in std_logic;\n"
-"\t\tDSCART_IO \t\t: inout std_logic_vector(7 downto 0);\n"
-"\t\t\n"
-"\t\tLED0 \t\t\t: out std_logic\n"
-"\t);\n"
-"end entity;\n"
-"\n"
-"architecture rtl of passme is\n"
-"\n"
-"\t-- removes Xilinx mapping errors\n"
-"\tattribute CLOCK_BUFFER : string;\n"
-"\tattribute CLOCK_BUFFER of DSSLOT_CLK: signal is \"ibuf\";\n"
-"\tattribute CLOCK_BUFFER of DSCART_CLK: signal is \"obuf\";\n"
-"\n"
-"\tsignal is_command\t\t: boolean;\n"
-"\tsignal cmddata_cnt \t\t: natural range 0 to 511;\t\t-- 8 + 504\n"
-"\tsignal patched_data\t\t: std_logic_vector(7 downto 0);\n"
-"\tsignal patch_en\t\t\t: boolean;\n"
-"\n"
-"begin\n"
-"\n"
-"\t-- direct passthrough\n"
-"\tDSCART_CLK <= DSSLOT_CLK;\n"
-"\tDSCART_ROMCS <= DSSLOT_ROMCS;\n"
-"\tDSCART_RESET <= DSSLOT_RESET;\n"
-"\tDSSLOT_IRQ <= DSCART_IRQ;\n"
-"\tDSCART_EEPCS <= DSSLOT_EEPCS;\n"
-"\n"
-"\t-- activity LED\n"
-"\tLED0 <= not DSSLOT_ROMCS;\n"
-"\n"
-"\t-- patch\n"
-"\tprocess (cmddata_cnt)\n"
-"\tbegin\n"
-"\t\tcase (cmddata_cnt - 8) is\n"
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_vhd2.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_vhd2.h
deleted file mode 100644
index 7b2f106d92..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/passme_vhd2.h
+++ /dev/null
@@ -1,58 +0,0 @@
-"\n"
-"\t\t\twhen others => \tpatched_data <= DSCART_IO;\n"
-"\t\tend case;\n"
-"\tend process;\n"
-"\n"
-"\t-- dataswitcher\n"
-"\tprocess (DSSLOT_RESET, DSSLOT_ROMCS, DSSLOT_EEPCS, DSSLOT_IO, DSCART_IO, patched_data)\n"
-"\tbegin\n"
-"\t\tDSSLOT_IO <= (others => 'Z');\t\t\t\t-- default is high impedance\n"
-"\t\tDSCART_IO <= (others => 'Z');\t\t\t\t-- default is high impedance\n"
-"\n"
-"\t\tif (DSSLOT_RESET='1') then\t\t\t\t\t-- if not reset\n"
-"\t\t\tif (DSSLOT_ROMCS='0') then\t\t\t\t-- ROM is selected\n"
-"\t\t\t\tif (is_command) then\t\t\t\t-- is command byte\n"
-"\t\t\t\t\tDSCART_IO <= DSSLOT_IO;\t\t\t-- from DS to cartridge\n"
-"\t\t\t\telse\t\t\t\t\t\t\t\t-- is data byte\n"
-"\t\t\t\t\tif (patch_en) then\t\t\t\t-- patch enabled\n"
-"\t\t\t\t\t\tDSSLOT_IO <= patched_data;\n"
-"\t\t\t\t\telse\n"
-"\t\t\t\t\t\tDSSLOT_IO <= DSCART_IO;\n"
-"\t\t\t\t\tend if;\n"
-"\t\t\t\tend if;\n"
-"\t\t\telsif (DSSLOT_EEPCS='0') then\t\t\t-- EEPROM is selected\n"
-"\t\t\t\tDSCART_IO(7) <= DSSLOT_IO(7);\t\t-- pass serial data\n"
-"\t\t\t\tDSSLOT_IO(6) <= DSCART_IO(6);\t\t-- pass serial data in opposite direction\n"
-"\t\t\tend if;\n"
-"\t\tend if;\n"
-"\tend process;\n"
-"\n"
-"\t-- patch_en\n"
-"\tprocess (DSSLOT_RESET, DSSLOT_CLK)\n"
-"\tbegin\n"
-"\t\tif (DSSLOT_RESET='0') then\n"
-"\t\t\tpatch_en <= true;\t\t\t\t\t\t-- patch header\n"
-"\t\telsif (rising_edge(DSSLOT_CLK)) then\n"
-"\t\t\tif (is_command) then\n"
-"\t\t\t\tif (DSCART_IO(5) = '1') then\t\t-- detect 3C command, assume other command bytes are 00\n"
-"\t\t\t\t\tpatch_en <= false;\t\t\t\t-- do not patch other data\n"
-"\t\t\t\tend if;\n"
-"\t\t\tend if;\n"
-"\t\tend if;\n"
-"\tend process;\n"
-"\n"
-"\t-- cmddata_cnt, is_command\n"
-"\tprocess (DSSLOT_ROMCS, DSSLOT_CLK)\n"
-"\tbegin\n"
-"\t\tif (DSSLOT_ROMCS='1') then\n"
-"\t\t\tcmddata_cnt <= 0;\t\t\t\t\t\t-- new transfer\n"
-"\t\t\tis_command <= true;\t\t\t\t\t\t-- start with command\n"
-"\t\telsif (rising_edge(DSSLOT_CLK)) then\n"
-"\t\t\tif (cmddata_cnt mod 8 = 7) then\n"
-"\t\t\t\tis_command <= false;\t\t\t\t-- next byte is data\n"
-"\t\t\tend if;\n"
-"\t\t\tcmddata_cnt <= cmddata_cnt + 1;\t\t\t-- next byte\n"
-"\t\tend if;\n"
-"\tend process;\n"
-"\n"
-"end architecture;\n"
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/raster.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/raster.h
deleted file mode 100644
index db929feafe..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/raster.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#pragma pack(2)
-
-typedef struct tagRGBQUAD
-{
- unsigned char rgbBlue;
- unsigned char rgbGreen;
- unsigned char rgbRed;
- unsigned char rgbReserved;
-} RGBQUAD;
-
-typedef struct tagBITMAPINFOHEADER
-{
- unsigned_int biSize;
- signed_int biWidth;
- signed_int biHeight;
- unsigned_short biPlanes;
- unsigned_short biBitCount;
- unsigned_int biCompression;
- unsigned_int biSizeImage;
- signed_int biXPelsPerMeter;
- signed_int biYPelsPerMeter;
- unsigned_int biClrUsed;
- unsigned_int biClrImportant;
-} BITMAPINFOHEADER;
-
-typedef struct tagBITMAPINFO
-{
- BITMAPINFOHEADER bmiHeader;
- RGBQUAD bmiColors[256];
-} BITMAPINFO, *PBITMAPINFO;
-
-typedef struct tagBITMAPFILEHEADER
-{
- unsigned char bfType[2];
- unsigned_int bfSize;
- unsigned_short bfReserved1;
- unsigned_short bfReserved2;
- unsigned_int bfOffBits;
-} BITMAPFILEHEADER, *PBITMAPFILEHEADER;
-
-#pragma pack()
-
-
-struct CRaster
-{
- unsigned int width, height;
- unsigned char *raster;
- RGBQUAD palette[256];
-
- int LoadBMP(char *filename);
-
- unsigned char * operator [] (unsigned int y)
- {
- return raster + y*width;
- }
-};
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/sha1.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/sha1.h
deleted file mode 100644
index 36d9fdadc0..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/sha1.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- ---------------------------------------------------------------------------
- Copyright (c) 2002, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
- All rights reserved.
-
- LICENSE TERMS
-
- The free distribution and use of this software in both source and binary
- form is allowed (with or without changes) provided that:
-
- 1. distributions of this source code include the above copyright
- notice, this list of conditions and the following disclaimer;
-
- 2. distributions in binary form include the above copyright
- notice, this list of conditions and the following disclaimer
- in the documentation and/or other associated materials;
-
- 3. the copyright holder's name is not used to endorse products
- built using this software without specific written permission.
-
- ALTERNATIVELY, provided that this notice is retained in full, this product
- may be distributed under the terms of the GNU General Public License (GPL),
- in which case the provisions of the GPL apply INSTEAD OF those given above.
-
- DISCLAIMER
-
- This software is provided 'as is' with no explicit or implied warranties
- in respect of its properties, including, but not limited to, correctness
- and/or fitness for purpose.
- ---------------------------------------------------------------------------
-Issue Date: 30/11/2002
-*/
-
-#ifndef _SHA1_H
-#define _SHA1_H
-
-
-typedef unsigned int sha1_32t;
-
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-#define SHA1_BLOCK_SIZE 64
-#define SHA1_DIGEST_SIZE 20
-#define SHA2_GOOD 0
-#define SHA2_BAD 1
-
-/* type to hold the SHA256 context */
-
-typedef struct
-{ sha1_32t count[2];
- sha1_32t hash[5];
- sha1_32t wbuf[16];
-} sha1_ctx;
-
-void sha1_compile(sha1_ctx ctx[1]);
-
-void sha1_begin(sha1_ctx ctx[1]);
-void sha1_hash(const unsigned char data[], unsigned int len, sha1_ctx ctx[1]);
-void sha1_end(unsigned char hval[], sha1_ctx ctx[1]);
-void sha1(unsigned char hval[], const unsigned char data[], unsigned int len);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif // _SHA1_H
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/types.h b/c/src/lib/libbsp/arm/nds/tools/ndstool/include/types.h
deleted file mode 100644
index 2736ec9844..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/include/types.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __TYPES_H
-#define __TYPES_H
-
-typedef unsigned long long u64;
-typedef unsigned long u32;
-typedef unsigned short u16;
-typedef unsigned char u8;
-typedef signed long long s64;
-typedef signed long s32;
-typedef signed short s16;
-typedef signed char s8;
-
-#endif // __TYPES_H
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/arm7_sha1_homebrew.c b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/arm7_sha1_homebrew.c
deleted file mode 100644
index 56082618ec..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/arm7_sha1_homebrew.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- This file was autogenerated by raw2c.
-Visit http://www.devkitpro.org
-*/
-
-const unsigned char arm7_sha1_homebrew[] = {
- 0x30, 0x38, 0x37, 0x30, 0x30, 0x43, 0x42, 0x31, 0x41, 0x45, 0x36, 0x39, 0x30, 0x41, 0x34, 0x31,
- 0x35, 0x42, 0x41, 0x34, 0x33, 0x33, 0x35, 0x33, 0x46, 0x32, 0x46, 0x34, 0x34, 0x41, 0x38, 0x37,
- 0x33, 0x34, 0x36, 0x36, 0x36, 0x43, 0x31, 0x32, 0x0a, 0x31, 0x33, 0x36, 0x46, 0x34, 0x39, 0x35,
- 0x45, 0x35, 0x35, 0x44, 0x42, 0x42, 0x43, 0x38, 0x42, 0x32, 0x39, 0x32, 0x45, 0x42, 0x45, 0x39,
- 0x44, 0x37, 0x38, 0x30, 0x43, 0x42, 0x33, 0x33, 0x36, 0x31, 0x43, 0x30, 0x30, 0x44, 0x32, 0x36,
- 0x37, 0x0a, 0x31, 0x38, 0x42, 0x34, 0x44, 0x41, 0x32, 0x46, 0x36, 0x32, 0x31, 0x31, 0x33, 0x46,
- 0x34, 0x44, 0x39, 0x34, 0x35, 0x43, 0x44, 0x46, 0x31, 0x38, 0x39, 0x36, 0x44, 0x46, 0x42, 0x30,
- 0x38, 0x41, 0x44, 0x34, 0x34, 0x38, 0x34, 0x44, 0x34, 0x45, 0x0a, 0x33, 0x31, 0x33, 0x33, 0x37,
- 0x44, 0x44, 0x37, 0x42, 0x39, 0x33, 0x30, 0x43, 0x35, 0x45, 0x34, 0x42, 0x45, 0x34, 0x33, 0x46,
- 0x38, 0x31, 0x46, 0x42, 0x38, 0x32, 0x42, 0x45, 0x38, 0x32, 0x36, 0x45, 0x32, 0x41, 0x38, 0x37,
- 0x31, 0x33, 0x44, 0x0a, 0x33, 0x35, 0x39, 0x45, 0x35, 0x33, 0x36, 0x37, 0x41, 0x39, 0x37, 0x30,
- 0x31, 0x35, 0x44, 0x44, 0x41, 0x46, 0x44, 0x33, 0x44, 0x32, 0x41, 0x41, 0x39, 0x42, 0x41, 0x42,
- 0x32, 0x42, 0x37, 0x38, 0x45, 0x45, 0x43, 0x39, 0x30, 0x35, 0x38, 0x44, 0x0a, 0x33, 0x37, 0x37,
- 0x45, 0x41, 0x38, 0x31, 0x42, 0x31, 0x45, 0x34, 0x33, 0x43, 0x41, 0x37, 0x31, 0x37, 0x45, 0x38,
- 0x42, 0x45, 0x37, 0x37, 0x36, 0x38, 0x37, 0x33, 0x46, 0x43, 0x43, 0x42, 0x41, 0x43, 0x33, 0x44,
- 0x33, 0x42, 0x44, 0x30, 0x44, 0x0a, 0x33, 0x44, 0x35, 0x30, 0x33, 0x36, 0x41, 0x30, 0x30, 0x36,
- 0x46, 0x38, 0x37, 0x36, 0x46, 0x30, 0x38, 0x44, 0x39, 0x32, 0x42, 0x41, 0x37, 0x38, 0x35, 0x39,
- 0x38, 0x30, 0x42, 0x39, 0x38, 0x46, 0x45, 0x35, 0x42, 0x30, 0x39, 0x30, 0x39, 0x35, 0x0a, 0x33,
- 0x46, 0x42, 0x38, 0x38, 0x30, 0x33, 0x34, 0x37, 0x31, 0x43, 0x32, 0x32, 0x39, 0x37, 0x39, 0x36,
- 0x33, 0x44, 0x32, 0x38, 0x43, 0x43, 0x31, 0x46, 0x45, 0x36, 0x34, 0x44, 0x43, 0x43, 0x33, 0x38,
- 0x38, 0x32, 0x31, 0x31, 0x42, 0x41, 0x43, 0x0a, 0x37, 0x32, 0x39, 0x44, 0x33, 0x46, 0x31, 0x46,
- 0x37, 0x30, 0x45, 0x34, 0x38, 0x37, 0x33, 0x45, 0x31, 0x35, 0x41, 0x41, 0x38, 0x35, 0x43, 0x46,
- 0x37, 0x41, 0x41, 0x41, 0x37, 0x39, 0x39, 0x45, 0x41, 0x43, 0x42, 0x30, 0x34, 0x38, 0x42, 0x38,
- 0x0a, 0x37, 0x35, 0x38, 0x31, 0x34, 0x36, 0x35, 0x44, 0x44, 0x30, 0x42, 0x33, 0x42, 0x45, 0x36,
- 0x30, 0x36, 0x31, 0x38, 0x41, 0x42, 0x32, 0x37, 0x35, 0x30, 0x38, 0x33, 0x44, 0x39, 0x33, 0x37,
- 0x46, 0x44, 0x42, 0x35, 0x45, 0x36, 0x36, 0x45, 0x39, 0x0a, 0x37, 0x35, 0x46, 0x46, 0x38, 0x44,
- 0x44, 0x32, 0x37, 0x38, 0x36, 0x44, 0x30, 0x43, 0x36, 0x34, 0x33, 0x33, 0x44, 0x45, 0x43, 0x35,
- 0x32, 0x38, 0x38, 0x42, 0x42, 0x36, 0x36, 0x32, 0x35, 0x45, 0x45, 0x32, 0x35, 0x45, 0x35, 0x42,
- 0x44, 0x42, 0x0a, 0x37, 0x37, 0x30, 0x34, 0x37, 0x42, 0x41, 0x31, 0x38, 0x36, 0x32, 0x45, 0x45,
- 0x35, 0x46, 0x38, 0x35, 0x46, 0x41, 0x36, 0x38, 0x39, 0x38, 0x31, 0x38, 0x42, 0x43, 0x33, 0x45,
- 0x39, 0x45, 0x39, 0x35, 0x41, 0x38, 0x32, 0x45, 0x39, 0x33, 0x45, 0x0a, 0x39, 0x32, 0x32, 0x43,
- 0x33, 0x37, 0x46, 0x46, 0x35, 0x35, 0x42, 0x35, 0x33, 0x33, 0x46, 0x34, 0x39, 0x45, 0x46, 0x34,
- 0x32, 0x39, 0x46, 0x38, 0x30, 0x33, 0x31, 0x36, 0x46, 0x37, 0x30, 0x31, 0x32, 0x41, 0x36, 0x32,
- 0x42, 0x46, 0x43, 0x38, 0x0a, 0x39, 0x32, 0x42, 0x35, 0x46, 0x43, 0x43, 0x41, 0x44, 0x33, 0x39,
- 0x45, 0x43, 0x45, 0x43, 0x45, 0x35, 0x38, 0x34, 0x33, 0x33, 0x41, 0x39, 0x45, 0x33, 0x36, 0x35,
- 0x44, 0x41, 0x32, 0x33, 0x33, 0x38, 0x43, 0x39, 0x31, 0x31, 0x46, 0x43, 0x30, 0x0a, 0x41, 0x38,
- 0x36, 0x42, 0x31, 0x32, 0x30, 0x33, 0x44, 0x39, 0x44, 0x46, 0x44, 0x45, 0x37, 0x39, 0x34, 0x39,
- 0x32, 0x35, 0x39, 0x30, 0x36, 0x42, 0x32, 0x37, 0x32, 0x32, 0x35, 0x35, 0x39, 0x33, 0x42, 0x33,
- 0x39, 0x43, 0x44, 0x46, 0x41, 0x39, 0x0a, 0x42, 0x42, 0x41, 0x37, 0x36, 0x39, 0x31, 0x36, 0x35,
- 0x39, 0x46, 0x33, 0x35, 0x32, 0x42, 0x32, 0x41, 0x34, 0x41, 0x32, 0x34, 0x36, 0x32, 0x34, 0x45,
- 0x42, 0x37, 0x32, 0x45, 0x39, 0x30, 0x32, 0x41, 0x31, 0x36, 0x31, 0x39, 0x42, 0x36, 0x45, 0x0a,
- 0x43, 0x37, 0x43, 0x37, 0x39, 0x32, 0x38, 0x30, 0x34, 0x42, 0x31, 0x38, 0x45, 0x34, 0x32, 0x34,
- 0x33, 0x45, 0x45, 0x46, 0x41, 0x30, 0x46, 0x36, 0x37, 0x37, 0x39, 0x42, 0x37, 0x45, 0x43, 0x38,
- 0x30, 0x45, 0x39, 0x36, 0x35, 0x39, 0x44, 0x45, 0x0a, 0x43, 0x42, 0x30, 0x39, 0x39, 0x41, 0x43,
- 0x38, 0x35, 0x44, 0x37, 0x36, 0x38, 0x42, 0x42, 0x31, 0x44, 0x30, 0x33, 0x36, 0x30, 0x39, 0x38,
- 0x38, 0x41, 0x42, 0x31, 0x34, 0x46, 0x34, 0x35, 0x35, 0x37, 0x36, 0x41, 0x30, 0x43, 0x39, 0x33,
- 0x35, 0x0a, 0x43, 0x44, 0x30, 0x30, 0x41, 0x38, 0x36, 0x31, 0x35, 0x44, 0x42, 0x33, 0x35, 0x30,
- 0x46, 0x34, 0x30, 0x39, 0x41, 0x36, 0x38, 0x45, 0x41, 0x33, 0x32, 0x39, 0x42, 0x43, 0x36, 0x46,
- 0x45, 0x43, 0x43, 0x38, 0x31, 0x43, 0x43, 0x42, 0x32, 0x46, 0x0a, 0x44, 0x39, 0x31, 0x31, 0x39,
- 0x39, 0x46, 0x45, 0x41, 0x36, 0x42, 0x36, 0x30, 0x32, 0x35, 0x34, 0x35, 0x37, 0x39, 0x38, 0x33,
- 0x38, 0x45, 0x38, 0x38, 0x43, 0x33, 0x38, 0x36, 0x44, 0x41, 0x45, 0x38, 0x31, 0x41, 0x37, 0x41,
- 0x43, 0x36, 0x44, 0x0a, 0x44, 0x43, 0x44, 0x43, 0x42, 0x31, 0x32, 0x33, 0x41, 0x44, 0x46, 0x42,
- 0x32, 0x39, 0x38, 0x42, 0x42, 0x39, 0x33, 0x46, 0x32, 0x34, 0x43, 0x30, 0x34, 0x41, 0x35, 0x32,
- 0x45, 0x31, 0x43, 0x30, 0x45, 0x30, 0x38, 0x36, 0x30, 0x36, 0x44, 0x36, 0x0a, 0x45, 0x30, 0x42,
- 0x37, 0x32, 0x30, 0x41, 0x46, 0x31, 0x36, 0x44, 0x32, 0x33, 0x31, 0x45, 0x30, 0x45, 0x36, 0x37,
- 0x46, 0x41, 0x35, 0x46, 0x36, 0x45, 0x36, 0x35, 0x30, 0x33, 0x39, 0x46, 0x32, 0x39, 0x42, 0x38,
- 0x30, 0x38, 0x36, 0x45, 0x43, 0x0a, 0x45, 0x45, 0x45, 0x44, 0x32, 0x31, 0x33, 0x36, 0x46, 0x33,
- 0x31, 0x42, 0x45, 0x37, 0x44, 0x41, 0x36, 0x44, 0x32, 0x46, 0x34, 0x31, 0x39, 0x33, 0x31, 0x42,
- 0x35, 0x31, 0x36, 0x34, 0x36, 0x45, 0x31, 0x31, 0x45, 0x30, 0x38, 0x30, 0x42, 0x30, 0x0a, 0x45,
- 0x46, 0x30, 0x36, 0x31, 0x36, 0x32, 0x32, 0x32, 0x31, 0x35, 0x41, 0x36, 0x35, 0x45, 0x30, 0x38,
- 0x45, 0x36, 0x36, 0x38, 0x44, 0x37, 0x46, 0x30, 0x43, 0x35, 0x33, 0x32, 0x31, 0x35, 0x45, 0x46,
- 0x45, 0x31, 0x43, 0x39, 0x36, 0x36, 0x42, 0x0a
-};
-const int arm7_sha1_homebrew_size = sizeof(arm7_sha1_homebrew);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/arm7_sha1_nintendo.c b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/arm7_sha1_nintendo.c
deleted file mode 100644
index e096ed8df5..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/arm7_sha1_nintendo.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- This file was autogenerated by raw2c.
-Visit http://www.devkitpro.org
-*/
-
-const unsigned char arm7_sha1_nintendo[] = {
- 0x30, 0x44, 0x43, 0x37, 0x42, 0x38, 0x41, 0x41, 0x37, 0x36, 0x41, 0x33, 0x45, 0x30, 0x46, 0x30,
- 0x34, 0x46, 0x41, 0x33, 0x37, 0x43, 0x45, 0x39, 0x35, 0x42, 0x38, 0x32, 0x36, 0x34, 0x44, 0x38,
- 0x46, 0x42, 0x38, 0x42, 0x35, 0x33, 0x35, 0x33, 0x0a, 0x30, 0x45, 0x46, 0x42, 0x43, 0x32, 0x44,
- 0x34, 0x33, 0x44, 0x30, 0x41, 0x37, 0x41, 0x45, 0x34, 0x41, 0x30, 0x38, 0x37, 0x34, 0x37, 0x32,
- 0x46, 0x44, 0x30, 0x45, 0x43, 0x37, 0x43, 0x41, 0x32, 0x38, 0x37, 0x35, 0x45, 0x43, 0x38, 0x36,
- 0x35, 0x0a, 0x31, 0x31, 0x31, 0x32, 0x41, 0x32, 0x41, 0x35, 0x38, 0x32, 0x37, 0x30, 0x32, 0x44,
- 0x38, 0x45, 0x42, 0x39, 0x44, 0x45, 0x41, 0x37, 0x37, 0x46, 0x36, 0x37, 0x31, 0x42, 0x39, 0x43,
- 0x34, 0x33, 0x33, 0x39, 0x41, 0x39, 0x45, 0x45, 0x44, 0x37, 0x0a, 0x31, 0x32, 0x30, 0x35, 0x35,
- 0x31, 0x39, 0x30, 0x30, 0x32, 0x43, 0x32, 0x31, 0x36, 0x41, 0x41, 0x37, 0x46, 0x39, 0x39, 0x35,
- 0x45, 0x46, 0x39, 0x35, 0x33, 0x31, 0x38, 0x43, 0x37, 0x45, 0x32, 0x37, 0x46, 0x31, 0x46, 0x35,
- 0x38, 0x41, 0x41, 0x0a, 0x31, 0x45, 0x37, 0x31, 0x30, 0x38, 0x41, 0x38, 0x44, 0x42, 0x41, 0x31,
- 0x42, 0x36, 0x32, 0x33, 0x39, 0x34, 0x43, 0x33, 0x44, 0x32, 0x42, 0x32, 0x30, 0x36, 0x36, 0x39,
- 0x42, 0x42, 0x39, 0x43, 0x34, 0x41, 0x34, 0x36, 0x32, 0x37, 0x37, 0x31, 0x0a, 0x32, 0x34, 0x39,
- 0x36, 0x35, 0x33, 0x36, 0x36, 0x46, 0x45, 0x34, 0x46, 0x36, 0x44, 0x33, 0x46, 0x33, 0x37, 0x43,
- 0x41, 0x36, 0x39, 0x38, 0x37, 0x39, 0x42, 0x39, 0x37, 0x38, 0x43, 0x42, 0x45, 0x41, 0x46, 0x34,
- 0x41, 0x39, 0x36, 0x38, 0x42, 0x0a, 0x32, 0x39, 0x32, 0x41, 0x42, 0x39, 0x41, 0x46, 0x36, 0x41,
- 0x41, 0x31, 0x30, 0x37, 0x32, 0x37, 0x37, 0x38, 0x36, 0x43, 0x39, 0x46, 0x36, 0x31, 0x43, 0x37,
- 0x44, 0x39, 0x32, 0x34, 0x46, 0x31, 0x43, 0x43, 0x41, 0x43, 0x43, 0x39, 0x42, 0x39, 0x0a, 0x33,
- 0x34, 0x46, 0x38, 0x42, 0x34, 0x46, 0x32, 0x39, 0x30, 0x42, 0x31, 0x39, 0x45, 0x42, 0x45, 0x33,
- 0x46, 0x41, 0x34, 0x43, 0x46, 0x41, 0x31, 0x37, 0x38, 0x45, 0x44, 0x42, 0x43, 0x39, 0x42, 0x39,
- 0x43, 0x38, 0x33, 0x37, 0x41, 0x35, 0x45, 0x0a, 0x33, 0x39, 0x45, 0x46, 0x35, 0x38, 0x41, 0x32,
- 0x41, 0x36, 0x43, 0x33, 0x37, 0x32, 0x42, 0x30, 0x33, 0x31, 0x36, 0x45, 0x33, 0x39, 0x43, 0x32,
- 0x30, 0x34, 0x42, 0x41, 0x45, 0x32, 0x36, 0x37, 0x45, 0x31, 0x38, 0x45, 0x46, 0x35, 0x42, 0x37,
- 0x0a, 0x34, 0x30, 0x39, 0x35, 0x30, 0x42, 0x35, 0x43, 0x39, 0x37, 0x38, 0x42, 0x37, 0x33, 0x37,
- 0x36, 0x32, 0x43, 0x34, 0x35, 0x45, 0x42, 0x37, 0x38, 0x44, 0x31, 0x43, 0x41, 0x42, 0x31, 0x42,
- 0x37, 0x45, 0x42, 0x41, 0x42, 0x39, 0x46, 0x36, 0x31, 0x0a, 0x34, 0x41, 0x31, 0x46, 0x41, 0x36,
- 0x31, 0x33, 0x37, 0x31, 0x33, 0x39, 0x39, 0x33, 0x32, 0x43, 0x34, 0x41, 0x46, 0x37, 0x42, 0x36,
- 0x31, 0x32, 0x38, 0x39, 0x42, 0x33, 0x33, 0x44, 0x41, 0x33, 0x45, 0x45, 0x31, 0x39, 0x38, 0x30,
- 0x38, 0x46, 0x0a, 0x35, 0x42, 0x44, 0x41, 0x46, 0x43, 0x42, 0x44, 0x38, 0x39, 0x30, 0x42, 0x38,
- 0x37, 0x34, 0x38, 0x33, 0x39, 0x37, 0x44, 0x42, 0x45, 0x33, 0x31, 0x42, 0x37, 0x44, 0x34, 0x39,
- 0x38, 0x43, 0x35, 0x37, 0x34, 0x46, 0x38, 0x42, 0x42, 0x46, 0x31, 0x0a, 0x35, 0x44, 0x41, 0x34,
- 0x45, 0x46, 0x35, 0x36, 0x34, 0x36, 0x44, 0x30, 0x42, 0x33, 0x44, 0x37, 0x30, 0x30, 0x33, 0x38,
- 0x45, 0x43, 0x36, 0x39, 0x41, 0x38, 0x44, 0x46, 0x42, 0x46, 0x36, 0x33, 0x35, 0x32, 0x39, 0x44,
- 0x43, 0x39, 0x34, 0x37, 0x0a, 0x36, 0x35, 0x31, 0x35, 0x41, 0x38, 0x34, 0x30, 0x41, 0x34, 0x39,
- 0x41, 0x45, 0x32, 0x34, 0x44, 0x44, 0x41, 0x32, 0x39, 0x34, 0x36, 0x31, 0x35, 0x39, 0x39, 0x30,
- 0x46, 0x39, 0x45, 0x39, 0x46, 0x37, 0x46, 0x45, 0x32, 0x36, 0x32, 0x39, 0x43, 0x0a, 0x36, 0x36,
- 0x43, 0x38, 0x31, 0x35, 0x44, 0x42, 0x32, 0x36, 0x42, 0x37, 0x38, 0x45, 0x44, 0x30, 0x37, 0x30,
- 0x43, 0x42, 0x32, 0x34, 0x46, 0x41, 0x39, 0x38, 0x37, 0x43, 0x37, 0x34, 0x38, 0x35, 0x34, 0x32,
- 0x42, 0x43, 0x30, 0x41, 0x36, 0x32, 0x0a, 0x37, 0x31, 0x46, 0x42, 0x33, 0x38, 0x44, 0x35, 0x34,
- 0x37, 0x43, 0x33, 0x43, 0x44, 0x32, 0x34, 0x31, 0x43, 0x45, 0x31, 0x45, 0x31, 0x43, 0x39, 0x30,
- 0x41, 0x31, 0x34, 0x44, 0x30, 0x35, 0x36, 0x35, 0x36, 0x33, 0x37, 0x31, 0x30, 0x46, 0x41, 0x0a,
- 0x37, 0x33, 0x32, 0x32, 0x39, 0x30, 0x41, 0x39, 0x32, 0x32, 0x45, 0x45, 0x31, 0x31, 0x31, 0x46,
- 0x42, 0x31, 0x42, 0x33, 0x45, 0x32, 0x38, 0x43, 0x30, 0x34, 0x44, 0x39, 0x44, 0x36, 0x34, 0x45,
- 0x43, 0x45, 0x33, 0x38, 0x35, 0x43, 0x33, 0x38, 0x0a, 0x37, 0x34, 0x45, 0x32, 0x42, 0x35, 0x35,
- 0x36, 0x38, 0x42, 0x35, 0x42, 0x42, 0x33, 0x46, 0x31, 0x44, 0x42, 0x32, 0x34, 0x46, 0x32, 0x36,
- 0x43, 0x35, 0x32, 0x45, 0x33, 0x30, 0x41, 0x33, 0x37, 0x30, 0x36, 0x33, 0x30, 0x34, 0x33, 0x42,
- 0x45, 0x0a, 0x37, 0x45, 0x41, 0x33, 0x32, 0x39, 0x45, 0x45, 0x32, 0x41, 0x44, 0x34, 0x39, 0x42,
- 0x37, 0x41, 0x31, 0x35, 0x42, 0x46, 0x38, 0x42, 0x46, 0x38, 0x34, 0x37, 0x38, 0x44, 0x30, 0x46,
- 0x33, 0x35, 0x30, 0x38, 0x37, 0x38, 0x30, 0x34, 0x44, 0x43, 0x0a, 0x38, 0x32, 0x45, 0x36, 0x43,
- 0x42, 0x45, 0x37, 0x35, 0x45, 0x43, 0x35, 0x36, 0x42, 0x43, 0x36, 0x32, 0x33, 0x42, 0x35, 0x32,
- 0x39, 0x44, 0x42, 0x36, 0x31, 0x38, 0x31, 0x42, 0x41, 0x30, 0x45, 0x37, 0x30, 0x36, 0x30, 0x33,
- 0x33, 0x37, 0x43, 0x0a, 0x38, 0x33, 0x30, 0x43, 0x42, 0x37, 0x45, 0x43, 0x42, 0x35, 0x30, 0x34,
- 0x31, 0x35, 0x37, 0x41, 0x39, 0x33, 0x43, 0x32, 0x38, 0x34, 0x43, 0x35, 0x32, 0x45, 0x39, 0x43,
- 0x35, 0x43, 0x34, 0x38, 0x37, 0x41, 0x46, 0x31, 0x41, 0x34, 0x38, 0x31, 0x0a, 0x38, 0x33, 0x31,
- 0x45, 0x39, 0x33, 0x35, 0x32, 0x35, 0x38, 0x39, 0x41, 0x46, 0x35, 0x31, 0x31, 0x36, 0x32, 0x30,
- 0x36, 0x36, 0x33, 0x37, 0x46, 0x37, 0x39, 0x35, 0x37, 0x44, 0x44, 0x42, 0x32, 0x32, 0x34, 0x33,
- 0x42, 0x39, 0x35, 0x33, 0x33, 0x0a, 0x38, 0x43, 0x44, 0x46, 0x38, 0x45, 0x42, 0x31, 0x35, 0x31,
- 0x35, 0x33, 0x42, 0x30, 0x42, 0x33, 0x30, 0x43, 0x30, 0x30, 0x35, 0x38, 0x42, 0x44, 0x41, 0x30,
- 0x39, 0x41, 0x43, 0x36, 0x42, 0x44, 0x45, 0x36, 0x36, 0x45, 0x33, 0x32, 0x35, 0x33, 0x0a, 0x38,
- 0x46, 0x43, 0x35, 0x30, 0x30, 0x34, 0x46, 0x35, 0x34, 0x36, 0x30, 0x32, 0x31, 0x46, 0x41, 0x43,
- 0x44, 0x37, 0x37, 0x37, 0x31, 0x31, 0x31, 0x37, 0x30, 0x32, 0x43, 0x42, 0x46, 0x43, 0x38, 0x37,
- 0x33, 0x34, 0x35, 0x38, 0x44, 0x39, 0x34, 0x0a, 0x39, 0x30, 0x37, 0x30, 0x45, 0x35, 0x45, 0x36,
- 0x46, 0x36, 0x39, 0x39, 0x38, 0x33, 0x34, 0x35, 0x35, 0x36, 0x35, 0x38, 0x42, 0x42, 0x39, 0x33,
- 0x33, 0x34, 0x39, 0x37, 0x35, 0x46, 0x41, 0x31, 0x37, 0x33, 0x41, 0x43, 0x39, 0x34, 0x44, 0x30,
- 0x0a, 0x39, 0x42, 0x42, 0x41, 0x44, 0x36, 0x41, 0x45, 0x45, 0x43, 0x43, 0x30, 0x34, 0x39, 0x43,
- 0x36, 0x31, 0x44, 0x42, 0x38, 0x32, 0x38, 0x35, 0x33, 0x38, 0x35, 0x38, 0x31, 0x34, 0x46, 0x45,
- 0x31, 0x42, 0x42, 0x30, 0x41, 0x37, 0x31, 0x36, 0x44, 0x0a, 0x39, 0x46, 0x36, 0x36, 0x34, 0x36,
- 0x42, 0x31, 0x45, 0x38, 0x30, 0x31, 0x30, 0x41, 0x42, 0x32, 0x34, 0x31, 0x37, 0x33, 0x42, 0x30,
- 0x38, 0x32, 0x39, 0x42, 0x43, 0x42, 0x30, 0x44, 0x34, 0x36, 0x43, 0x36, 0x44, 0x38, 0x44, 0x33,
- 0x31, 0x45, 0x0a, 0x41, 0x30, 0x33, 0x34, 0x30, 0x32, 0x46, 0x30, 0x38, 0x38, 0x42, 0x42, 0x45,
- 0x34, 0x41, 0x30, 0x45, 0x46, 0x30, 0x30, 0x36, 0x44, 0x36, 0x32, 0x46, 0x42, 0x31, 0x39, 0x45,
- 0x41, 0x30, 0x46, 0x42, 0x42, 0x43, 0x38, 0x30, 0x43, 0x30, 0x30, 0x0a, 0x41, 0x34, 0x46, 0x36,
- 0x32, 0x31, 0x42, 0x41, 0x37, 0x35, 0x31, 0x43, 0x43, 0x39, 0x32, 0x43, 0x38, 0x38, 0x38, 0x45,
- 0x42, 0x42, 0x35, 0x46, 0x33, 0x33, 0x33, 0x35, 0x38, 0x42, 0x39, 0x34, 0x38, 0x32, 0x39, 0x34,
- 0x39, 0x30, 0x46, 0x34, 0x0a, 0x42, 0x35, 0x36, 0x31, 0x38, 0x35, 0x45, 0x39, 0x45, 0x32, 0x39,
- 0x32, 0x42, 0x38, 0x44, 0x41, 0x43, 0x37, 0x32, 0x32, 0x32, 0x46, 0x30, 0x37, 0x39, 0x41, 0x34,
- 0x46, 0x37, 0x39, 0x41, 0x39, 0x46, 0x43, 0x33, 0x41, 0x44, 0x31, 0x36, 0x31, 0x0a, 0x43, 0x45,
- 0x45, 0x46, 0x38, 0x42, 0x38, 0x39, 0x33, 0x30, 0x46, 0x30, 0x38, 0x45, 0x36, 0x43, 0x41, 0x34,
- 0x30, 0x37, 0x45, 0x33, 0x36, 0x33, 0x45, 0x41, 0x33, 0x35, 0x43, 0x37, 0x42, 0x37, 0x30, 0x41,
- 0x38, 0x36, 0x46, 0x31, 0x45, 0x43, 0x0a, 0x44, 0x31, 0x32, 0x43, 0x41, 0x37, 0x42, 0x31, 0x45,
- 0x41, 0x37, 0x34, 0x32, 0x30, 0x32, 0x45, 0x39, 0x32, 0x33, 0x34, 0x34, 0x36, 0x34, 0x44, 0x36,
- 0x45, 0x34, 0x37, 0x43, 0x32, 0x39, 0x43, 0x44, 0x34, 0x43, 0x39, 0x35, 0x30, 0x37, 0x45, 0x0a,
- 0x44, 0x31, 0x41, 0x38, 0x35, 0x33, 0x34, 0x36, 0x44, 0x31, 0x38, 0x30, 0x41, 0x41, 0x35, 0x30,
- 0x46, 0x45, 0x46, 0x42, 0x37, 0x33, 0x30, 0x38, 0x43, 0x30, 0x42, 0x41, 0x36, 0x42, 0x31, 0x46,
- 0x44, 0x38, 0x37, 0x35, 0x32, 0x32, 0x36, 0x35, 0x0a, 0x44, 0x33, 0x44, 0x36, 0x35, 0x38, 0x33,
- 0x33, 0x35, 0x39, 0x34, 0x41, 0x44, 0x39, 0x43, 0x30, 0x36, 0x37, 0x33, 0x38, 0x41, 0x38, 0x38,
- 0x34, 0x34, 0x46, 0x35, 0x32, 0x45, 0x34, 0x34, 0x41, 0x45, 0x45, 0x37, 0x36, 0x33, 0x46, 0x45,
- 0x42, 0x0a, 0x46, 0x32, 0x44, 0x37, 0x39, 0x35, 0x46, 0x42, 0x30, 0x38, 0x35, 0x30, 0x30, 0x35,
- 0x33, 0x39, 0x42, 0x33, 0x33, 0x31, 0x42, 0x36, 0x37, 0x36, 0x38, 0x36, 0x45, 0x46, 0x43, 0x42,
- 0x37, 0x45, 0x34, 0x34, 0x44, 0x43, 0x39, 0x33, 0x33, 0x41, 0x0a, 0x46, 0x33, 0x37, 0x45, 0x43,
- 0x43, 0x30, 0x43, 0x41, 0x30, 0x39, 0x42, 0x38, 0x30, 0x42, 0x45, 0x32, 0x30, 0x36, 0x38, 0x43,
- 0x45, 0x37, 0x38, 0x39, 0x35, 0x35, 0x44, 0x42, 0x45, 0x38, 0x33, 0x36, 0x36, 0x34, 0x32, 0x39,
- 0x36, 0x37, 0x37, 0x0a, 0x46, 0x38, 0x37, 0x42, 0x33, 0x32, 0x43, 0x37, 0x43, 0x41, 0x44, 0x39,
- 0x41, 0x36, 0x37, 0x30, 0x41, 0x34, 0x39, 0x46, 0x41, 0x45, 0x37, 0x46, 0x31, 0x44, 0x45, 0x30,
- 0x35, 0x35, 0x31, 0x30, 0x33, 0x43, 0x34, 0x43, 0x44, 0x35, 0x38, 0x30, 0x0a, 0x46, 0x39, 0x41,
- 0x46, 0x33, 0x36, 0x35, 0x35, 0x42, 0x31, 0x39, 0x34, 0x30, 0x34, 0x30, 0x36, 0x37, 0x36, 0x44,
- 0x35, 0x33, 0x37, 0x37, 0x41, 0x31, 0x43, 0x31, 0x41, 0x39, 0x41, 0x42, 0x42, 0x31, 0x42, 0x35,
- 0x45, 0x46, 0x41, 0x33, 0x46, 0x0a, 0x46, 0x42, 0x39, 0x33, 0x33, 0x42, 0x41, 0x38, 0x45, 0x46,
- 0x46, 0x35, 0x30, 0x43, 0x45, 0x39, 0x38, 0x35, 0x37, 0x41, 0x37, 0x38, 0x43, 0x35, 0x43, 0x32,
- 0x42, 0x38, 0x36, 0x33, 0x38, 0x31, 0x39, 0x31, 0x44, 0x32, 0x42, 0x39, 0x33, 0x37, 0x0a
-};
-const int arm7_sha1_nintendo_size = sizeof(arm7_sha1_nintendo);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/banner.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/banner.cpp
deleted file mode 100644
index 9eeacc4fa1..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/banner.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-#include "ndstool.h"
-#include "raster.h"
-#include "banner.h"
-#include "crc.h"
-
-const char *bannerLanguages[] = { "Japanese", "English", "French", "German", "Italian", "Spanish" };
-
-#define RGB16(r,g,b) ((r) | (g<<5) | (b<<10))
-
-/*
- * RGBQuadToRGB16
- */
-inline unsigned short RGBQuadToRGB16(RGBQUAD quad)
-{
- unsigned short r = quad.rgbRed;
- unsigned short g = quad.rgbGreen;
- unsigned short b = quad.rgbBlue;
- return RGB16(r>>3, g>>3, b>>3);
-}
-
-/*
- * CalcBannerCRC
- */
-unsigned short CalcBannerCRC(Banner &banner)
-{
- return CalcCrc16((unsigned char *)&banner + 32, 0x840 - 32);
-}
-
-/*
- * IconFromBMP
- */
-void IconFromBMP()
-{
- CRaster bmp;
- int rval = bmp.LoadBMP(bannerfilename);
- if (rval < 0) exit(1);
-
- if (bmp.width != 32 || bmp.height != 32) {
- fprintf(stderr, "Image should be 32 x 32.\n");
- exit(1);
- }
-
- Banner banner;
- memset(&banner, 0, sizeof(banner));
- banner.version = 1;
-
- // tile data (4 bit / tile, 4x4 total tiles)
- // 32 bytes per tile (in 4 bit mode)
- for (int row=0; row<4; row++)
- {
- for (int col=0; col<4; col++)
- {
- for (int y=0; y<8; y++)
- {
- for (int x=0; x<8; x+=2)
- {
- unsigned char b0 = bmp[row*8 + y][col*8 + x + 0];
- unsigned char b1 = bmp[row*8 + y][col*8 + x + 1];
- banner.tile_data[row][col][y][x/2] = (b1 << 4) | b0;
- }
- }
- }
- }
-
- // palette
- for (int i = 0; i < 16; i++)
- {
- banner.palette[i] = RGBQuadToRGB16(bmp.palette[i]);
- }
-
- // put title
- for (int i=0; bannertext[i]; i++)
- {
- char c = bannertext[i];
- if (c == ';') c = 0x0A;
- for (int l=0; l<6; l++)
- {
- banner.title[l][i] = c;
- }
- }
-
- // calculate CRC
- banner.crc = CalcBannerCRC(banner);
-
- fwrite(&banner, 1, sizeof(banner), fNDS);
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/bigint.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/bigint.cpp
deleted file mode 100644
index e868852300..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/bigint.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- big integer class for RSA calculation
- Numbers stored in big endian order.
-*/
-
-/*
- * Includes
- */
-#include <stdio.h>
-#include <string.h>
-#include "bigint.h"
-
-/*
- * Sub
- * Subtract (shifted) b from a.
- */
-int BigInt::Sub(BigInt &a, BigInt &b, int b_shift)
-{
- unsigned int b_byte = sizeof(data) - 1 + (b_shift / 8);
- int b_bit = (b_shift % 8);
- int carry = 0;
- for (int ia=sizeof(data)-1; ia>=0; ia--)
- {
- unsigned char b_data_shifted = 0;
- if (b_byte + 1 < sizeof(b.data)) b_data_shifted |= b.data[b_byte + 1] >> (8 - b_bit);
- if (b_byte + 0 < sizeof(b.data)) b_data_shifted |= b.data[b_byte + 0] << b_bit;
- b_byte--;
- int r = a.data[ia] - b_data_shifted + carry;
- data[ia] = r;
- carry = r>>8;
- }
- return carry;
-}
-
-/*
- * MulMod
- * Multiply two numbers and perform modulo.
- */
-void BigInt::MulMod(BigInt &a, BigInt &b, BigInt &m)
-{
- memset(this, 0, sizeof(*this));
- for (unsigned int ia=sizeof(data) - 1; ia>=sizeof(data)/2; ia--)
- {
- int carry = 0;
- for (unsigned int ib=sizeof(data) - 1; ib>=sizeof(data)/2; ib--)
- {
- int iab = ia + ib - sizeof(data) + 1;
- unsigned int r = a.data[ia] * b.data[ib] + carry + data[iab];
- data[iab] = r;
- carry = r>>8;
- }
- }
-
- for (int shift=sizeof(data)/2*8; shift>=0; shift--)
- {
- BigInt subbed;
- if (!subbed.Sub(*this, m, shift)) // positive?
- {
- memcpy(this, &subbed, sizeof(*this));
- }
- }
-}
-
-/*
- * PowMod
- * Raise to power 65537 and perform modulo.
- */
-void BigInt::PowMod(BigInt &n, BigInt &m)
-{
- BigInt n65536;
- memcpy(&n65536, &n, sizeof(n));
- for (int i=0; i<16; i++) // 16 times n^2 = n^65536
- {
- BigInt tmp;
- tmp.MulMod(n65536, n65536, m);
- memcpy(&n65536, &tmp, sizeof(n));
- }
- MulMod(n, n65536, m); // final result: n^1 * n^65536
-}
-
-/*
- * print
- */
-void BigInt::print()
-{
- printf("0x");
- bool show = false;
- for (unsigned int i=0; i<sizeof(data); i++)
- {
- if (data[i]) show = true;
- if (show) printf("%02X", data[i]);
- }
- printf(show ? "\n" : "0\n");
-}
-
-/*
- * Set
- */
-void BigInt::Set(unsigned char *data, unsigned int length)
-{
- memset(this, 0, sizeof(*this));
- memcpy(this->data + sizeof(this->data) - length, data, length);
-}
-
-/*
- * Get
- */
-void BigInt::Get(unsigned char *data, unsigned int length)
-{
- memcpy(data, this->data + sizeof(this->data) - length, length);
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/compile_date.c b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/compile_date.c
deleted file mode 100644
index 56debaaf57..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/compile_date.c
+++ /dev/null
@@ -1 +0,0 @@
-const char CompileDate[] = __DATE__;
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/crc.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/crc.cpp
deleted file mode 100644
index f33aac9c55..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/crc.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- Cyclic Redundancy Code (CRC) functions
- by Rafael Vuijk (aka DarkFader)
-*/
-
-unsigned short ccitt16tab[] =
-{
- 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
- 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
- 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
- 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
- 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
- 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
- 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
- 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
- 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
- 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
- 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
- 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
- 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
- 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
- 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
- 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
- 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
- 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
- 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
- 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
- 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
- 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
- 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
- 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
- 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
- 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
- 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
- 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
- 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
- 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
- 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
- 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
-};
-
-unsigned short crc16tab[] =
-{
- 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
- 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
- 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
- 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
- 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
- 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
- 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
- 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
- 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
- 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
- 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
- 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
- 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
- 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
- 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
- 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
- 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
- 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
- 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
- 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
- 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
- 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
- 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
- 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
- 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
- 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
- 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
- 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
- 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
- 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
- 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
- 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
-};
-
-unsigned long crc32tab[] =
-{
- 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL,
- 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L,
- 0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L,
- 0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L, 0x90BF1D91L,
- 0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL,
- 0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L,
- 0x136C9856L, 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL,
- 0x14015C4FL, 0x63066CD9L, 0xFA0F3D63L, 0x8D080DF5L,
- 0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L, 0xA2677172L,
- 0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL,
- 0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L,
- 0x32D86CE3L, 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L,
- 0x26D930ACL, 0x51DE003AL, 0xC8D75180L, 0xBFD06116L,
- 0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L, 0xB8BDA50FL,
- 0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L,
- 0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL,
- 0x76DC4190L, 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL,
- 0x71B18589L, 0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L,
- 0x7807C9A2L, 0x0F00F934L, 0x9609A88EL, 0xE10E9818L,
- 0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L,
- 0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL,
- 0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L,
- 0x65B0D9C6L, 0x12B7E950L, 0x8BBEB8EAL, 0xFCB9887CL,
- 0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L,
- 0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L,
- 0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL,
- 0x4369E96AL, 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L,
- 0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL, 0xDD0D7CC9L,
- 0x5005713CL, 0x270241AAL, 0xBE0B1010L, 0xC90C2086L,
- 0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL,
- 0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L,
- 0x59B33D17L, 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL,
- 0xEDB88320L, 0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL,
- 0xEAD54739L, 0x9DD277AFL, 0x04DB2615L, 0x73DC1683L,
- 0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L,
- 0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L,
- 0xF00F9344L, 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL,
- 0xF762575DL, 0x806567CBL, 0x196C3671L, 0x6E6B06E7L,
- 0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL,
- 0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L,
- 0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L,
- 0xD1BB67F1L, 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL,
- 0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L, 0x41047A60L,
- 0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL, 0x4669BE79L,
- 0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L,
- 0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL,
- 0xC5BA3BBEL, 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L,
- 0xC2D7FFA7L, 0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL,
- 0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL, 0x026D930AL,
- 0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L,
- 0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L,
- 0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L,
- 0x86D3D2D4L, 0xF1D4E242L, 0x68DDB3F8L, 0x1FDA836EL,
- 0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L, 0x18B74777L,
- 0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL,
- 0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L,
- 0xA00AE278L, 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L,
- 0xA7672661L, 0xD06016F7L, 0x4969474DL, 0x3E6E77DBL,
- 0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L, 0x37D83BF0L,
- 0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L,
- 0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L,
- 0xBAD03605L, 0xCDD70693L, 0x54DE5729L, 0x23D967BFL,
- 0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L,
- 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL
-};
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/default_icon.c b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/default_icon.c
deleted file mode 100644
index 42b8d97456..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/default_icon.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- This file was autogenerated by raw2c.
-Visit http://www.devkitpro.org
-*/
-
-const unsigned char default_icon[] = {
- 0x42, 0x4d, 0x6c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x28, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x0d, 0x00,
- 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xea, 0xfc, 0x00, 0xf4, 0xf2,
- 0xfc, 0x00, 0xc4, 0xaa, 0xfc, 0x00, 0xd4, 0xc2, 0xfc, 0x00, 0xac, 0x82, 0xfc, 0x00, 0x74, 0x2e,
- 0xf4, 0x00, 0x94, 0x56, 0xfc, 0x00, 0x6c, 0x12, 0xfc, 0x00, 0xe4, 0xd2, 0xfc, 0x00, 0xec, 0xde,
- 0xfc, 0x00, 0xfc, 0xf6, 0xfc, 0x00, 0xfc, 0xfa, 0xfc, 0x00, 0x00, 0x0b, 0x94, 0x44, 0x99, 0x99,
- 0x99, 0x99, 0x99, 0x10, 0x00, 0x00, 0x95, 0x3a, 0x00, 0x00, 0x00, 0xa6, 0x88, 0x88, 0x88, 0x88,
- 0x88, 0x88, 0x88, 0x87, 0x20, 0x03, 0x88, 0x86, 0x30, 0x00, 0x00, 0x78, 0x88, 0x88, 0x88, 0x88,
- 0x88, 0x88, 0x88, 0x88, 0x70, 0xa6, 0x88, 0x88, 0x61, 0x00, 0x0b, 0x68, 0x79, 0x44, 0x44, 0x44,
- 0x44, 0x43, 0x33, 0x68, 0x8b, 0x38, 0x88, 0x88, 0x84, 0x00, 0x0b, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x82, 0x48, 0x88, 0x88, 0x84, 0x00, 0x0b, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x82, 0xc7, 0x88, 0x88, 0x7c, 0x00, 0x0b, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x82, 0x01, 0x76, 0x67, 0x10, 0x00, 0x0b, 0x68, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x82, 0x00, 0xc1, 0x1c, 0x00, 0x00, 0x0b, 0x68, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x8b, 0x00, 0x0b, 0xb0, 0x00, 0x00, 0x0b, 0x68, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x8b, 0x00, 0x05, 0x70, 0x00, 0x00, 0x0b, 0x68, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x8b, 0x00, 0x05, 0x61, 0x00, 0x00, 0x02, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x8b, 0x00, 0x07, 0x89, 0x00, 0x00, 0x02, 0x88, 0x74, 0x44, 0x44, 0x44,
- 0x99, 0x99, 0x99, 0x68, 0x6c, 0x00, 0x26, 0x83, 0x00, 0x00, 0x00, 0x78, 0x88, 0x88, 0x88, 0x88,
- 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, 0xa6, 0x85, 0x00, 0x00, 0x00, 0x17, 0x88, 0x88, 0x88, 0x88,
- 0x88, 0x88, 0x88, 0x87, 0x10, 0x00, 0x48, 0x85, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xaa, 0x99, 0x99,
- 0x99, 0x44, 0x44, 0x90, 0x00, 0x00, 0x38, 0x87, 0xb0, 0x00, 0x00, 0x0b, 0x94, 0x44, 0x49, 0x99,
- 0x99, 0x99, 0x99, 0x10, 0x00, 0x00, 0x58, 0x86, 0xa0, 0x00, 0x00, 0x96, 0x88, 0x88, 0x88, 0x88,
- 0x88, 0x88, 0x88, 0x87, 0x20, 0x00, 0x58, 0x88, 0x40, 0x00, 0x00, 0x68, 0x88, 0x88, 0x88, 0x88,
- 0x88, 0x88, 0x88, 0x88, 0x70, 0x0c, 0x78, 0x88, 0x50, 0x00, 0x0a, 0x88, 0x79, 0x44, 0x44, 0x44,
- 0x44, 0x43, 0x33, 0x68, 0x8b, 0x0b, 0x68, 0x88, 0x50, 0x00, 0x0a, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x82, 0x0a, 0x68, 0x88, 0x6b, 0x00, 0x0a, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x82, 0x04, 0x88, 0x88, 0x6a, 0x00, 0x0a, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x82, 0x03, 0x88, 0x88, 0x83, 0x00, 0x0a, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x82, 0x03, 0x88, 0x88, 0x85, 0x00, 0x0a, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x8b, 0x05, 0x88, 0x88, 0x85, 0x00, 0x0a, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x8b, 0x07, 0x88, 0x88, 0x87, 0xc0, 0x0a, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x8b, 0xb7, 0x88, 0x88, 0x86, 0xa0, 0x0a, 0x88, 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x78, 0x8c, 0x16, 0x88, 0x88, 0x88, 0x90, 0x02, 0x88, 0x74, 0x44, 0x44, 0x44,
- 0x99, 0x99, 0x99, 0x68, 0x6c, 0xc7, 0x88, 0x88, 0x86, 0x10, 0x00, 0x78, 0x88, 0x88, 0x88, 0x88,
- 0x88, 0x88, 0x88, 0x88, 0x50, 0x03, 0x88, 0x88, 0x85, 0x00, 0x00, 0x17, 0x88, 0x88, 0x88, 0x88,
- 0x88, 0x88, 0x88, 0x87, 0x20, 0x00, 0x36, 0x86, 0x5b, 0x00, 0x00, 0x00, 0x2a, 0xaa, 0x99, 0x99,
- 0x99, 0x44, 0x44, 0x90, 0x00, 0x00, 0x02, 0x9a, 0x00, 0x00, 0x00, 0x00
-};
-const int default_icon_size = sizeof(default_icon);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/encryption.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/encryption.cpp
deleted file mode 100644
index cbec6e2e09..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/encryption.cpp
+++ /dev/null
@@ -1,574 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "ndstool.h"
-#include "crc.h"
-
-const unsigned char encr_data[] =
-{
- 0x99,0xD5,0x20,0x5F,0x57,0x44,0xF5,0xB9,0x6E,0x19,0xA4,0xD9,0x9E,0x6A,0x5A,0x94,
- 0xD8,0xAE,0xF1,0xEB,0x41,0x75,0xE2,0x3A,0x93,0x82,0xD0,0x32,0x33,0xEE,0x31,0xD5,
- 0xCC,0x57,0x61,0x9A,0x37,0x06,0xA2,0x1B,0x79,0x39,0x72,0xF5,0x55,0xAE,0xF6,0xBE,
- 0x5F,0x1B,0x69,0xFB,0xE5,0x9D,0xF1,0xE9,0xCE,0x2C,0xD9,0xA1,0x5E,0x32,0x05,0xE6,
- 0xFE,0xD3,0xFE,0xCF,0xD4,0x62,0x04,0x0D,0x8B,0xF5,0xEC,0xB7,0x2B,0x60,0x79,0xBB,
- 0x12,0x95,0x31,0x0D,0x6E,0x3F,0xDA,0x2B,0x88,0x84,0xF0,0xF1,0x3D,0x12,0x7E,0x25,
- 0x45,0x22,0xF1,0xBB,0x24,0x06,0x1A,0x06,0x11,0xAD,0xDF,0x28,0x8B,0x64,0x81,0x34,
- 0x2B,0xEB,0x33,0x29,0x99,0xAA,0xF2,0xBD,0x9C,0x14,0x95,0x9D,0x9F,0xF7,0xF5,0x8C,
- 0x72,0x97,0xA1,0x29,0x9D,0xD1,0x5F,0xCF,0x66,0x4D,0x07,0x1A,0xDE,0xD3,0x4A,0x4B,
- 0x85,0xC9,0xA7,0xA3,0x17,0x95,0x05,0x3A,0x3D,0x49,0x0A,0xBF,0x0A,0x89,0x8B,0xA2,
- 0x4A,0x82,0x49,0xDD,0x27,0x90,0xF1,0x0B,0xE9,0xEB,0x1C,0x6A,0x83,0x76,0x45,0x05,
- 0xBA,0x81,0x70,0x61,0x17,0x3F,0x4B,0xDE,0xAE,0xCF,0xAB,0x39,0x57,0xF2,0x3A,0x56,
- 0x48,0x11,0xAD,0x8A,0x40,0xE1,0x45,0x3F,0xFA,0x9B,0x02,0x54,0xCA,0xA6,0x93,0xFB,
- 0xEF,0x4D,0xFE,0x6F,0xA3,0xD8,0x87,0x9C,0x08,0xBA,0xD5,0x48,0x6A,0x8D,0x2D,0xFD,
- 0x6E,0x15,0xF8,0x74,0xBD,0xBE,0x52,0x8B,0x18,0x22,0x8A,0x9E,0xFB,0x74,0x37,0x07,
- 0x1B,0x36,0x6C,0x4A,0x19,0xBA,0x42,0x62,0xB9,0x79,0x91,0x10,0x7B,0x67,0x65,0x96,
- 0xFE,0x02,0x23,0xE8,0xEE,0x99,0x8C,0x77,0x3E,0x5C,0x86,0x64,0x4D,0x6D,0x78,0x86,
- 0xA5,0x4F,0x65,0xE2,0x1E,0xB2,0xDF,0x5A,0x0A,0xD0,0x7E,0x08,0x14,0xB0,0x71,0xAC,
- 0xBD,0xDB,0x83,0x1C,0xB9,0xD7,0xA1,0x62,0xCD,0xC6,0x63,0x7C,0x52,0x69,0xC3,0xE6,
- 0xBF,0x75,0xCE,0x12,0x44,0x5D,0x21,0x04,0xFA,0xFB,0xD3,0x3C,0x38,0x11,0x63,0xD4,
- 0x95,0x85,0x41,0x49,0x46,0x09,0xF2,0x08,0x43,0x11,0xDC,0x1F,0x76,0xC0,0x15,0x6D,
- 0x1F,0x3C,0x63,0x70,0xEA,0x87,0x80,0x6C,0xC3,0xBD,0x63,0x8B,0xC2,0x37,0x21,0x37,
- 0xDC,0xEE,0x09,0x23,0x2E,0x37,0x6A,0x4D,0x73,0x90,0xF7,0x50,0x30,0xAC,0x1C,0x92,
- 0x04,0x10,0x23,0x91,0x4F,0xD2,0x07,0xAA,0x68,0x3E,0x4F,0x9A,0xC9,0x64,0x60,0x6A,
- 0xC8,0x14,0x21,0xF3,0xD6,0x22,0x41,0x12,0x44,0x24,0xCF,0xE6,0x8A,0x56,0xDD,0x0D,
- 0x53,0x4D,0xE1,0x85,0x1E,0x8C,0x52,0x5A,0x9C,0x19,0x84,0xC2,0x03,0x57,0xF1,0x6F,
- 0xE3,0x00,0xBE,0x58,0xF6,0x4C,0xED,0xD5,0x21,0x64,0x9C,0x1F,0xBE,0x55,0x03,0x3C,
- 0x4A,0xDC,0xFF,0xAA,0xC9,0xDA,0xE0,0x5D,0x5E,0xBF,0xE6,0xDE,0xF5,0xD8,0xB1,0xF8,
- 0xFF,0x36,0xB3,0xB9,0x62,0x67,0x95,0xDB,0x31,0x5F,0x37,0xED,0x4C,0x70,0x67,0x99,
- 0x90,0xB5,0x18,0x31,0x6C,0x3D,0x99,0x99,0xE4,0x42,0xDA,0xD3,0x25,0x42,0x13,0xA0,
- 0xAE,0xD7,0x70,0x6C,0xB1,0x55,0xCF,0xC7,0xD7,0x46,0xD5,0x43,0x61,0x17,0x3D,0x44,
- 0x28,0xE9,0x33,0x85,0xD5,0xD0,0xA2,0x93,0xAA,0x25,0x12,0x1F,0xFB,0xC5,0x0B,0x46,
- 0xF5,0x97,0x76,0x56,0x45,0xA6,0xBE,0x87,0xB1,0x94,0x6B,0xE8,0xB1,0xFE,0x33,0x99,
- 0xAE,0x1F,0x3E,0x6C,0x39,0x71,0x1D,0x09,0x00,0x90,0x37,0xE4,0x10,0x3E,0x75,0x74,
- 0xFF,0x8C,0x83,0x3B,0xB0,0xF1,0xB0,0xF9,0x01,0x05,0x47,0x42,0x95,0xF1,0xD6,0xAC,
- 0x7E,0x38,0xE6,0x9E,0x95,0x74,0x26,0x3F,0xB4,0x68,0x50,0x18,0xD0,0x43,0x30,0xB4,
- 0x4C,0x4B,0xE3,0x68,0xBF,0xE5,0x4D,0xB6,0x95,0x8B,0x0A,0xA0,0x74,0x25,0x32,0x77,
- 0xCF,0xA1,0xF7,0x2C,0xD8,0x71,0x13,0x5A,0xAB,0xEA,0xC9,0x51,0xE8,0x0D,0xEE,0xEF,
- 0xE9,0x93,0x7E,0x19,0xA7,0x1E,0x43,0x38,0x81,0x16,0x2C,0xA1,0x48,0xE3,0x73,0xCC,
- 0x29,0x21,0x6C,0xD3,0x5D,0xCE,0xA0,0xD9,0x61,0x71,0x43,0xA0,0x15,0x13,0xB5,0x64,
- 0x92,0xCF,0x2A,0x19,0xDC,0xAD,0xB7,0xA5,0x9F,0x86,0x65,0xF8,0x1A,0x9F,0xE7,0xFB,
- 0xF7,0xFD,0xB8,0x13,0x6C,0x27,0xDB,0x6F,0xDF,0x35,0x1C,0xF7,0x8D,0x2C,0x5B,0x9B,
- 0x12,0xAB,0x38,0x64,0x06,0xCC,0xDE,0x31,0xE8,0x4E,0x75,0x11,0x64,0xE3,0xFA,0xEA,
- 0xEB,0x34,0x54,0xC2,0xAD,0x3F,0x34,0xEB,0x93,0x2C,0x7D,0x26,0x36,0x9D,0x56,0xF3,
- 0x5A,0xE1,0xF6,0xB3,0x98,0x63,0x4A,0x9E,0x32,0x83,0xE4,0x9A,0x84,0x60,0x7D,0x90,
- 0x2E,0x13,0x0E,0xEE,0x93,0x4B,0x36,0xA2,0x85,0xEC,0x16,0x38,0xE8,0x88,0x06,0x02,
- 0xBF,0xF0,0xA0,0x3A,0xED,0xD7,0x6A,0x9A,0x73,0xE1,0x57,0xCF,0xF8,0x44,0xB8,0xDC,
- 0x2E,0x23,0x59,0xD1,0xDF,0x95,0x52,0x71,0x99,0x61,0xA0,0x4B,0xD5,0x7F,0x6E,0x78,
- 0xBA,0xA9,0xC5,0x30,0xD3,0x40,0x86,0x32,0x9D,0x32,0x0C,0x9C,0x37,0xB7,0x02,0x2F,
- 0xBA,0x54,0x98,0xA9,0xC4,0x13,0x04,0xC9,0x8D,0xBE,0xC8,0xE7,0x5D,0x97,0x50,0x2E,
- 0x93,0xD6,0x22,0x59,0x0C,0x27,0xBC,0x22,0x92,0xE0,0xA7,0x20,0x0F,0x93,0x6F,0x7F,
- 0x4C,0x9F,0xD3,0xB5,0xA6,0x2A,0x0B,0x74,0x67,0x49,0x7D,0x10,0x26,0xCB,0xD1,0xC5,
- 0x86,0x71,0xE7,0x8C,0xA0,0x9C,0xE9,0x5B,0xB2,0x1A,0xF6,0x01,0xEE,0x8C,0x9E,0x5E,
- 0x83,0xF2,0x1A,0xDB,0xE6,0xE5,0xEA,0x84,0x59,0x76,0xD2,0x7C,0xF6,0x8D,0xA5,0x49,
- 0x36,0x48,0xC2,0x16,0x52,0xBB,0x83,0xA3,0x74,0xB9,0x07,0x0C,0x3B,0xFF,0x61,0x28,
- 0xE1,0x61,0xE9,0xE4,0xEF,0x6E,0x15,0xAA,0x4E,0xBA,0xE8,0x5D,0x05,0x96,0xBB,0x32,
- 0x56,0xB0,0xFB,0x72,0x52,0x0F,0x0E,0xC8,0x42,0x25,0x65,0x76,0x89,0xAF,0xF2,0xDE,
- 0x10,0x27,0xF0,0x01,0x4B,0x74,0xA7,0x97,0x07,0xD5,0x26,0x54,0x54,0x09,0x1F,0x82,
- 0x0A,0x86,0x7D,0x30,0x39,0x0E,0xB3,0x26,0x9B,0x0B,0x57,0xBB,0x36,0x06,0x31,0xAF,
- 0xFD,0x79,0xFC,0xD9,0x30,0x10,0x2B,0x0C,0xB3,0xE1,0x9B,0xD7,0x7B,0xDC,0x5F,0xEF,
- 0xD2,0xF8,0x13,0x45,0x4D,0x47,0x75,0xBD,0x46,0x96,0x3C,0x7E,0x75,0xF3,0x3E,0xB5,
- 0x67,0xC5,0x9A,0x3B,0xB0,0x5B,0x29,0x6B,0xDE,0x80,0x5B,0xC8,0x15,0x05,0xB1,0x31,
- 0xB6,0xCE,0x49,0xDD,0xAD,0x84,0xB5,0xAE,0x60,0xDC,0x67,0x31,0x34,0x30,0xFE,0x4E,
- 0xBD,0x80,0x2F,0xA6,0xBF,0x63,0x39,0x21,0x86,0xD9,0x35,0x7F,0x16,0x68,0x22,0x05,
- 0x54,0xE9,0x90,0x26,0x8C,0x07,0x6C,0x51,0xA4,0x31,0x55,0xD7,0x09,0x07,0xA8,0x3E,
- 0x2E,0x53,0x66,0xC1,0xF8,0xF2,0x7B,0xC4,0xF2,0x58,0xCF,0xF1,0x87,0xC5,0xA2,0xE7,
- 0x27,0x8F,0x30,0x87,0x58,0xA0,0x64,0x62,0x23,0x18,0xB9,0x88,0x7C,0xFA,0xCE,0xC4,
- 0x98,0xAE,0xAD,0x17,0xCC,0x4A,0x5B,0xF3,0xE9,0x48,0xD5,0x56,0xD3,0x0D,0xF2,0xC8,
- 0x92,0x73,0x8C,0xDB,0xD7,0x2F,0x56,0xAC,0x81,0xF9,0x92,0x69,0x4D,0xC6,0x32,0xF6,
- 0xE6,0xC0,0x8D,0x21,0xE2,0x76,0x80,0x61,0x11,0xBC,0xDC,0x6C,0x93,0xAF,0x19,0x69,
- 0x9B,0xD0,0xBF,0xB9,0x31,0x9F,0x02,0x67,0xA3,0x51,0xEE,0x83,0x06,0x22,0x7B,0x0C,
- 0xAB,0x49,0x42,0x40,0xB8,0xD5,0x01,0x7D,0xCE,0x5E,0xF7,0x55,0x53,0x39,0xC5,0x99,
- 0x46,0xD8,0x87,0x9F,0xBA,0xF7,0x64,0xB4,0xE3,0x9A,0xFA,0xA1,0x6D,0x90,0x68,0x10,
- 0x30,0xCA,0x8A,0x54,0xA7,0x9F,0x60,0xC3,0x19,0xF5,0x6B,0x0D,0x7A,0x51,0x98,0xE6,
- 0x98,0x43,0x51,0xB4,0xD6,0x35,0xE9,0x4F,0xC3,0xDF,0x0F,0x7B,0xD6,0x2F,0x5C,0xBD,
- 0x3A,0x15,0x61,0x19,0xF1,0x4B,0xCB,0xAA,0xDC,0x6D,0x64,0xC9,0xD3,0xC6,0x1E,0x56,
- 0xEF,0x38,0x4C,0x50,0x71,0x86,0x75,0xCC,0x0D,0x0D,0x4E,0xE9,0x28,0xF6,0x06,0x5D,
- 0x70,0x1B,0xAA,0xD3,0x45,0xCF,0xA8,0x39,0xAC,0x95,0xA6,0x2E,0xB4,0xE4,0x22,0xD4,
- 0x74,0xA8,0x37,0x5F,0x48,0x7A,0x04,0xCC,0xA5,0x4C,0x40,0xD8,0x28,0xB4,0x28,0x08,
- 0x0D,0x1C,0x72,0x52,0x41,0xF0,0x7D,0x47,0x19,0x3A,0x53,0x4E,0x58,0x84,0x62,0x6B,
- 0x93,0xB5,0x8A,0x81,0x21,0x4E,0x0D,0xDC,0xB4,0x3F,0xA2,0xC6,0xFC,0xC9,0x2B,0x40,
- 0xDA,0x38,0x04,0xE9,0x5E,0x5A,0x86,0x6B,0x0C,0x22,0x25,0x85,0x68,0x11,0x8D,0x7C,
- 0x92,0x1D,0x95,0x55,0x4D,0xAB,0x8E,0xBB,0xDA,0xA6,0xE6,0xB7,0x51,0xB6,0x32,0x5A,
- 0x05,0x41,0xDD,0x05,0x2A,0x0A,0x56,0x50,0x91,0x17,0x47,0xCC,0xC9,0xE6,0x7E,0xB5,
- 0x61,0x4A,0xDB,0x73,0x67,0x51,0xC8,0x33,0xF5,0xDA,0x6E,0x74,0x2E,0x54,0xC3,0x37,
- 0x0D,0x6D,0xAF,0x08,0xE8,0x15,0x8A,0x5F,0xE2,0x59,0x21,0xCD,0xA8,0xDE,0x0C,0x06,
- 0x5A,0x77,0x6B,0x5F,0xDB,0x18,0x65,0x3E,0xC8,0x50,0xDE,0x78,0xE0,0xB8,0x82,0xB3,
- 0x5D,0x4E,0x72,0x32,0x07,0x4F,0xC1,0x34,0x23,0xBA,0x96,0xB7,0x67,0x4E,0xA4,0x28,
- 0x1E,0x34,0x62,0xEB,0x2D,0x6A,0x70,0xE9,0x2F,0x42,0xC4,0x70,0x4E,0x5A,0x31,0x9C,
- 0xF9,0x5B,0x47,0x28,0xAA,0xDA,0x71,0x6F,0x38,0x1F,0xB3,0x78,0xC4,0x92,0x6B,0x1C,
- 0x9E,0xF6,0x35,0x9A,0xB7,0x4D,0x0E,0xBF,0xCC,0x18,0x29,0x41,0x03,0x48,0x35,0x5D,
- 0x55,0xD0,0x2B,0xC6,0x29,0xAF,0x5C,0x60,0x74,0x69,0x8E,0x5E,0x9B,0x7C,0xD4,0xBD,
- 0x7B,0x44,0x64,0x7D,0x3F,0x92,0x5D,0x69,0xB6,0x1F,0x00,0x4B,0xD4,0x83,0x35,0xCF,
- 0x7E,0x64,0x4E,0x17,0xAE,0x8D,0xD5,0x2E,0x9A,0x28,0x12,0x4E,0x2E,0x2B,0x49,0x08,
- 0x5C,0xAE,0xC6,0x46,0x85,0xAE,0x41,0x61,0x1E,0x6F,0x82,0xD2,0x51,0x37,0x16,0x1F,
- 0x0B,0xF6,0x59,0xA4,0x9A,0xCA,0x5A,0xAF,0x0D,0xD4,0x33,0x8B,0x20,0x63,0xF1,0x84,
- 0x80,0x5C,0xCB,0xCF,0x08,0xB4,0xB9,0xD3,0x16,0x05,0xBD,0x62,0x83,0x31,0x9B,0x56,
- 0x51,0x98,0x9F,0xBA,0xB2,0x5B,0xAA,0xB2,0x22,0x6B,0x2C,0xB5,0xD4,0x48,0xFA,0x63,
- 0x2B,0x5F,0x58,0xFA,0x61,0xFA,0x64,0x09,0xBB,0x38,0xE0,0xB8,0x9D,0x92,0x60,0xA8,
- 0x0D,0x67,0x6F,0x0E,0x37,0xF5,0x0D,0x01,0x9F,0xC2,0x77,0xD4,0xFE,0xEC,0xF1,0x73,
- 0x30,0x39,0xE0,0x7D,0xF5,0x61,0x98,0xE4,0x2C,0x28,0x55,0x04,0x56,0x55,0xDB,0x2F,
- 0x6B,0xEC,0xE5,0x58,0x06,0xB6,0x64,0x80,0x6A,0x2A,0x1A,0x4E,0x5B,0x0F,0xD8,0xC4,
- 0x0A,0x2E,0x52,0x19,0xD9,0x62,0xF5,0x30,0x48,0xBE,0x8C,0x7B,0x4F,0x38,0x9B,0xA2,
- 0xC3,0xAF,0xC9,0xD3,0xC7,0xC1,0x62,0x41,0x86,0xB9,0x61,0x21,0x57,0x6F,0x99,0x4F,
- 0xC1,0xBA,0xCE,0x7B,0xB5,0x3B,0x4D,0x5E,0x8A,0x8B,0x44,0x57,0x5F,0x13,0x5F,0x70,
- 0x6D,0x5B,0x29,0x47,0xDC,0x38,0xE2,0xEC,0x04,0x55,0x65,0x12,0x2A,0xE8,0x17,0x43,
- 0xE1,0x8E,0xDD,0x2A,0xB3,0xE2,0x94,0xF7,0x09,0x6E,0x5C,0xE6,0xEB,0x8A,0xF8,0x6D,
- 0x89,0x49,0x54,0x48,0xF5,0x2F,0xAD,0xBF,0xEA,0x94,0x4B,0xCA,0xFC,0x39,0x87,0x82,
- 0x5F,0x8A,0x01,0xF2,0x75,0xF2,0xE6,0x71,0xD6,0xD8,0x42,0xDE,0xF1,0x2D,0x1D,0x28,
- 0xA6,0x88,0x7E,0xA3,0xA0,0x47,0x1D,0x30,0xD9,0xA3,0x71,0xDF,0x49,0x1C,0xCB,0x01,
- 0xF8,0x36,0xB1,0xF2,0xF0,0x22,0x58,0x5D,0x45,0x6B,0xBD,0xA0,0xBB,0xB2,0x88,0x42,
- 0xC7,0x8C,0x28,0xCE,0x93,0xE8,0x90,0x63,0x08,0x90,0x7C,0x89,0x3C,0xF5,0x7D,0xB7,
- 0x04,0x2D,0x4F,0x55,0x51,0x16,0xFD,0x7E,0x79,0xE8,0xBE,0xC1,0xF2,0x12,0xD4,0xF8,
- 0xB4,0x84,0x05,0x23,0xA0,0xCC,0xD2,0x2B,0xFD,0xE1,0xAB,0xAD,0x0D,0xD1,0x55,0x6C,
- 0x23,0x41,0x94,0x4D,0x77,0x37,0x4F,0x05,0x28,0x0C,0xBF,0x17,0xB3,0x12,0x67,0x6C,
- 0x8C,0xC3,0x5A,0xF7,0x41,0x84,0x2A,0x6D,0xD0,0x94,0x12,0x27,0x2C,0xB4,0xED,0x9C,
- 0x4D,0xEC,0x47,0x82,0x97,0xD5,0x67,0xB9,0x1B,0x9D,0xC0,0x55,0x07,0x7E,0xE5,0x8E,
- 0xE2,0xA8,0xE7,0x3E,0x12,0xE4,0x0E,0x3A,0x2A,0x45,0x55,0x34,0xA2,0xF9,0x2D,0x5A,
- 0x1B,0xAB,0x52,0x7C,0x83,0x10,0x5F,0x55,0xD2,0xF1,0x5A,0x43,0x2B,0xC6,0xA7,0xA4,
- 0x89,0x15,0x95,0xE8,0xB4,0x4B,0x9D,0xF8,0x75,0xE3,0x9F,0x60,0x78,0x5B,0xD6,0xE6,
- 0x0D,0x44,0xE6,0x21,0x06,0xBD,0x47,0x22,0x53,0xA4,0x00,0xAD,0x8D,0x43,0x13,0x85,
- 0x39,0xF7,0xAA,0xFC,0x38,0xAF,0x7B,0xED,0xFC,0xE4,0x2B,0x54,0x50,0x98,0x4C,0xFC,
- 0x85,0x80,0xF7,0xDF,0x3C,0x80,0x22,0xE1,0x94,0xDA,0xDE,0x24,0xC6,0xB0,0x7A,0x39,
- 0x38,0xDC,0x0F,0xA1,0xA7,0xF4,0xF9,0x6F,0x63,0x18,0x57,0x8B,0x84,0x41,0x2A,0x2E,
- 0xD4,0x53,0xF2,0xD9,0x00,0x0F,0xD0,0xDD,0x99,0x6E,0x19,0xA6,0x0A,0xD0,0xEC,0x5B,
- 0x58,0x24,0xAB,0xC0,0xCB,0x06,0x65,0xEC,0x1A,0x13,0x38,0x94,0x0A,0x67,0x03,0x2F,
- 0x3F,0xF7,0xE3,0x77,0x44,0x77,0x33,0xC6,0x14,0x39,0xD0,0xE3,0xC0,0xA2,0x08,0x79,
- 0xBB,0x40,0x99,0x57,0x41,0x0B,0x01,0x90,0xCD,0xE1,0xCC,0x48,0x67,0xDB,0xB3,0xAF,
- 0x88,0x74,0xF3,0x4C,0x82,0x8F,0x72,0xB1,0xB5,0x23,0x29,0xC4,0x12,0x6C,0x19,0xFC,
- 0x8E,0x46,0xA4,0x9C,0xC4,0x25,0x65,0x87,0xD3,0x6D,0xBE,0x8A,0x93,0x11,0x03,0x38,
- 0xED,0x83,0x2B,0xF3,0x46,0xA4,0x93,0xEA,0x3B,0x53,0x85,0x1D,0xCE,0xD4,0xF1,0x08,
- 0x83,0x27,0xED,0xFC,0x9B,0x1A,0x18,0xBC,0xF9,0x8B,0xAE,0xDC,0x24,0xAB,0x50,0x38,
- 0xE9,0x72,0x4B,0x10,0x22,0x17,0x7B,0x46,0x5D,0xAB,0x59,0x64,0xF3,0x40,0xAE,0xF8,
- 0xBB,0xE5,0xC8,0xF9,0x26,0x03,0x4E,0x55,0x7D,0xEB,0xEB,0xFE,0xF7,0x39,0xE6,0xE0,
- 0x0A,0x11,0xBE,0x2E,0x28,0xFF,0x98,0xED,0xC0,0xC9,0x42,0x56,0x42,0xC3,0xFD,0x00,
- 0xF6,0xAF,0x87,0xA2,0x5B,0x01,0x3F,0x32,0x92,0x47,0x95,0x9A,0x72,0xA5,0x32,0x3D,
- 0xAE,0x6B,0xD0,0x9B,0x07,0xD2,0x49,0x92,0xE3,0x78,0x4A,0xFA,0xA1,0x06,0x7D,0xF2,
- 0x41,0xCF,0x77,0x74,0x04,0x14,0xB2,0x0C,0x86,0x84,0x64,0x16,0xD5,0xBB,0x51,0xA1,
- 0xE5,0x6F,0xF1,0xD1,0xF2,0xE2,0xF7,0x5F,0x58,0x20,0x4D,0xB8,0x57,0xC7,0xCF,0xDD,
- 0xC5,0xD8,0xBE,0x76,0x3D,0xF6,0x5F,0x7E,0xE7,0x2A,0x8B,0x88,0x24,0x1B,0x38,0x3F,
- 0x0E,0x41,0x23,0x77,0xF5,0xF0,0x4B,0xD4,0x0C,0x1F,0xFA,0xA4,0x0B,0x80,0x5F,0xCF,
- 0x45,0xF6,0xE0,0xDA,0x2F,0x34,0x59,0x53,0xFB,0x20,0x3C,0x52,0x62,0x5E,0x35,0xB5,
- 0x62,0xFE,0x8B,0x60,0x63,0xE3,0x86,0x5A,0x15,0x1A,0x6E,0xD1,0x47,0x45,0xBC,0x32,
- 0xB4,0xEB,0x67,0x38,0xAB,0xE4,0x6E,0x33,0x3A,0xB5,0xED,0xA3,0xAD,0x67,0xE0,0x4E,
- 0x41,0x95,0xEE,0x62,0x62,0x71,0x26,0x1D,0x31,0xEF,0x62,0x30,0xAF,0xD7,0x82,0xAC,
- 0xC2,0xDC,0x05,0x04,0xF5,0x97,0x07,0xBF,0x11,0x59,0x23,0x07,0xC0,0x64,0x02,0xE8,
- 0x97,0xE5,0x3E,0xAF,0x18,0xAC,0x59,0xA6,0x8B,0x4A,0x33,0x90,0x1C,0x6E,0x7C,0x9C,
- 0x20,0x7E,0x4C,0x3C,0x3E,0x61,0x64,0xBB,0xC5,0x6B,0x7C,0x7E,0x3E,0x9F,0xC5,0x4C,
- 0x9F,0xEA,0x73,0xF5,0xD7,0x89,0xC0,0x4C,0xF4,0xFB,0xF4,0x2D,0xEC,0x14,0x1B,0x51,
- 0xD5,0xC1,0x12,0xC8,0x10,0xDF,0x0B,0x4A,0x8B,0x9C,0xBC,0x93,0x45,0x6A,0x3E,0x3E,
- 0x7D,0xC1,0xA9,0xBA,0xCD,0xC1,0xB4,0x07,0xE4,0xE1,0x68,0x86,0x43,0xB2,0x6D,0x38,
- 0xF3,0xFB,0x0C,0x5C,0x66,0x37,0x71,0xDE,0x56,0xEF,0x6E,0xA0,0x10,0x40,0x65,0xA7,
- 0x98,0xF7,0xD0,0xBE,0x0E,0xC8,0x37,0x36,0xEC,0x10,0xCA,0x7C,0x9C,0xAB,0x84,0x1E,
- 0x05,0x17,0x76,0x02,0x1C,0x4F,0x52,0xAA,0x5F,0xC1,0xC6,0xA0,0x56,0xB9,0xD8,0x04,
- 0x84,0x44,0x4D,0xA7,0x59,0xD8,0xDE,0x60,0xE6,0x38,0x0E,0x05,0x8F,0x03,0xE1,0x3B,
- 0x6D,0x81,0x04,0x33,0x6F,0x30,0x0B,0xCE,0x69,0x05,0x21,0x33,0xFB,0x26,0xBB,0x89,
- 0x7D,0xB6,0xAE,0x87,0x7E,0x51,0x07,0xE0,0xAC,0xF7,0x96,0x0A,0x6B,0xF9,0xC4,0x5C,
- 0x1D,0xE4,0x44,0x47,0xB8,0x5E,0xFA,0xE3,0x78,0x84,0x55,0x42,0x4B,0x48,0x5E,0xF7,
- 0x7D,0x47,0x35,0x86,0x1D,0x2B,0x43,0x05,0x03,0xEC,0x8A,0xB8,0x1E,0x06,0x3C,0x76,
- 0x0C,0x48,0x1A,0x43,0xA7,0xB7,0x8A,0xED,0x1E,0x13,0xC6,0x43,0xEE,0x10,0xEF,0xDB,
- 0xEC,0xFB,0x3C,0x83,0xB2,0x95,0x44,0xEF,0xD8,0x54,0x51,0x4E,0x2D,0x11,0x44,0x1D,
- 0xFB,0x36,0x59,0x1E,0x7A,0x34,0xC1,0xC3,0xCA,0x57,0x00,0x61,0xEA,0x67,0xA5,0x16,
- 0x9B,0x55,0xD0,0x55,0xE1,0x7F,0xD9,0x36,0xD2,0x40,0x76,0xAE,0xDC,0x01,0xCE,0xB0,
- 0x7A,0x83,0xD5,0xCB,0x20,0x98,0xEC,0x6B,0xC1,0x72,0x92,0x34,0xF3,0x82,0x57,0x37,
- 0x62,0x8A,0x32,0x36,0x0C,0x90,0x43,0xAE,0xAE,0x5C,0x9B,0x78,0x8E,0x13,0x65,0x02,
- 0xFD,0x68,0x71,0xC1,0xFE,0xB0,0x31,0xA0,0x24,0x82,0xB0,0xC3,0xB1,0x79,0x69,0xA7,
- 0xF5,0xD2,0xEB,0xD0,0x82,0xC0,0x32,0xDC,0x9E,0xC7,0x26,0x3C,0x6D,0x8D,0x98,0xC1,
- 0xBB,0x22,0xD4,0xD0,0x0F,0x33,0xEC,0x3E,0xB9,0xCC,0xE1,0xDC,0x6A,0x4C,0x77,0x36,
- 0x14,0x1C,0xF9,0xBF,0x81,0x9F,0x28,0x5F,0x71,0x85,0x32,0x29,0x90,0x75,0x48,0xC4,
- 0xB3,0x4A,0xCE,0xD8,0x44,0x8F,0x14,0x2F,0xFD,0x40,0x57,0xEF,0xAA,0x08,0x75,0xD9,
- 0x46,0xD1,0xD6,0x6E,0x32,0x55,0x1F,0xC3,0x18,0xFE,0x84,0x1F,0xFC,0x84,0xD5,0xFF,
- 0x71,0x5E,0x1B,0x48,0xC3,0x86,0x95,0x0E,0x28,0x08,0x27,0xD3,0x38,0x83,0x71,0x7B,
- 0x4C,0x80,0x63,0x54,0x9A,0x56,0xB0,0xAC,0xCF,0x80,0xCA,0x31,0x09,0xEF,0xFE,0xF3,
- 0xBE,0xAF,0x24,0x7E,0xA6,0xFE,0x53,0x3F,0xC2,0x8D,0x4A,0x33,0x68,0xD1,0x22,0xA6,
- 0x66,0xAD,0x7B,0xEA,0xDE,0xB6,0x43,0xB0,0xA1,0x25,0x95,0x00,0xA3,0x3F,0x75,0x46,
- 0x14,0x11,0x44,0xEC,0xD7,0x95,0xBC,0x92,0xF0,0x4F,0xA9,0x16,0x53,0x62,0x97,0x60,
- 0x2A,0x0F,0x41,0xF1,0x71,0x24,0xBE,0xEE,0x94,0x7F,0x08,0xCD,0x60,0x93,0xB3,0x85,
- 0x5B,0x07,0x00,0x3F,0xD8,0x0F,0x28,0x83,0x9A,0xD1,0x69,0x9F,0xD1,0xDA,0x2E,0xC3,
- 0x90,0x01,0xA2,0xB9,0x6B,0x4E,0x2A,0x66,0x9D,0xDA,0xAE,0xA6,0xEA,0x2A,0xD3,0x68,
- 0x2F,0x0C,0x0C,0x9C,0xD2,0x8C,0x4A,0xED,0xE2,0x9E,0x57,0x65,0x9D,0x09,0x87,0xA3,
- 0xB4,0xC4,0x32,0x5D,0xC9,0xD4,0x32,0x2B,0xB1,0xE0,0x71,0x1E,0x64,0x4D,0xE6,0x90,
- 0x71,0xE3,0x1E,0x40,0xED,0x7D,0xF3,0x84,0x0E,0xED,0xC8,0x78,0x76,0xAE,0xC0,0x71,
- 0x27,0x72,0xBB,0x05,0xEA,0x02,0x64,0xFB,0xF3,0x48,0x6B,0xB5,0x42,0x93,0x3F,0xED,
- 0x9F,0x13,0x53,0xD2,0xF7,0xFE,0x2A,0xEC,0x1D,0x47,0x25,0xDB,0x3C,0x91,0x86,0xC6,
- 0x8E,0xF0,0x11,0xFD,0x23,0x74,0x36,0xF7,0xA4,0xF5,0x9E,0x7A,0x7E,0x53,0x50,0x44,
- 0xD4,0x47,0xCA,0xD3,0xEB,0x38,0x6D,0xE6,0xD9,0x71,0x94,0x7F,0x4A,0xC6,0x69,0x4B,
- 0x11,0xF4,0x52,0xEA,0x22,0xFE,0x8A,0xB0,0x36,0x67,0x8B,0x59,0xE8,0xE6,0x80,0x2A,
- 0xEB,0x65,0x04,0x13,0xEE,0xEC,0xDC,0x9E,0x5F,0xB1,0xEC,0x05,0x6A,0x59,0xE6,0x9F,
- 0x5E,0x59,0x6B,0x89,0xBF,0xF7,0x1A,0xCA,0x44,0xF9,0x5B,0x6A,0x71,0x85,0x03,0xE4,
- 0x29,0x62,0xE0,0x70,0x6F,0x41,0xC4,0xCF,0xB2,0xB1,0xCC,0xE3,0x7E,0xA6,0x07,0xA8,
- 0x87,0xE7,0x7F,0x84,0x93,0xDB,0x52,0x4B,0x6C,0xEC,0x7E,0xDD,0xD4,0x24,0x48,0x10,
- 0x69,0x9F,0x04,0x60,0x74,0xE6,0x48,0x18,0xF3,0xE4,0x2C,0xB9,0x4F,0x2E,0x50,0x7A,
- 0xDF,0xD4,0x54,0x69,0x2B,0x8B,0xA7,0xF3,0xCE,0xFF,0x1F,0xF3,0x3E,0x26,0x01,0x39,
- 0x17,0x95,0x84,0x89,0xB0,0xF0,0x4C,0x4B,0x82,0x91,0x9F,0xC4,0x4B,0xAC,0x9D,0xA5,
- 0x74,0xAF,0x17,0x25,0xC9,0xCA,0x32,0xD3,0xBC,0x89,0x8A,0x84,0x89,0xCC,0x0D,0xAE,
- 0x7C,0xA2,0xDB,0x9C,0x6A,0x78,0x91,0xEE,0xEA,0x76,0x5D,0x4E,0x87,0x60,0xF5,0x69,
- 0x15,0x67,0xD4,0x02,0xCF,0xAF,0x48,0x36,0x07,0xEA,0xBF,0x6F,0x66,0x2D,0x06,0x8F,
- 0xC4,0x9A,0xFE,0xF9,0xF6,0x90,0x87,0x75,0xB8,0xF7,0xAD,0x0F,0x76,0x10,0x5A,0x3D,
- 0x59,0xB0,0x2E,0xB3,0xC7,0x35,0x2C,0xCC,0x70,0x56,0x2B,0xCB,0xE3,0x37,0x96,0xC5,
- 0x2F,0x46,0x1B,0x8A,0x22,0x46,0xC7,0x88,0xA7,0x26,0x32,0x98,0x61,0xDF,0x86,0x22,
- 0x8A,0xF4,0x1C,0x2F,0x87,0xA1,0x09,0xAA,0xCC,0xA9,0xAE,0xD3,0xBD,0x00,0x45,0x1C,
- 0x9A,0x54,0x87,0x86,0x52,0x87,0xEF,0xFF,0x1E,0x8F,0xA1,0x8F,0xC1,0x89,0x5C,0x35,
- 0x1B,0xDA,0x2D,0x3A,0x2C,0x16,0xB2,0xC2,0xF1,0x56,0xE2,0x78,0xC1,0x6B,0x63,0x97,
- 0xC5,0x56,0x8F,0xC9,0x32,0x7F,0x2C,0xAA,0xAF,0xA6,0xA8,0xAC,0x20,0x91,0x22,0x88,
- 0xDE,0xE4,0x60,0x8B,0xF9,0x4B,0x42,0x25,0x1A,0xE3,0x7F,0x9C,0x2C,0x19,0x89,0x3A,
- 0x7E,0x05,0xD4,0x36,0xCC,0x69,0x58,0xC2,0xC1,0x32,0x8B,0x2F,0x90,0x85,0xEB,0x7A,
- 0x39,0x50,0xA5,0xA1,0x27,0x92,0xC5,0x66,0xB0,0x20,0x4F,0x58,0x7E,0x55,0x83,0x43,
- 0x2B,0x45,0xE2,0x9C,0xE4,0xD8,0x12,0x90,0x2C,0x16,0x83,0x56,0x16,0x79,0x03,0xB3,
- 0xAD,0x2D,0x61,0x18,0x1A,0x13,0x1F,0x37,0xE2,0xE1,0x9C,0x73,0x7B,0x80,0xD5,0xFD,
- 0x2D,0x51,0x87,0xFC,0x7B,0xAA,0xD7,0x1F,0x2C,0x7A,0x8E,0xAF,0xF4,0x8D,0xBB,0xCD,
- 0x95,0x11,0x7C,0x72,0x0B,0xEE,0x6F,0xE2,0xB9,0xAF,0xDE,0x37,0x83,0xDE,0x8C,0x8D,
- 0x62,0x05,0x67,0xB7,0x96,0xC6,0x8D,0x56,0xB6,0x0D,0xD7,0x62,0xBA,0xD6,0x46,0x36,
- 0xBD,0x8E,0xC8,0xE6,0xEA,0x2A,0x6C,0x10,0x14,0xFF,0x6B,0x5B,0xFA,0x82,0x3C,0x46,
- 0xB1,0x30,0x43,0x46,0x51,0x8A,0x7D,0x9B,0x92,0x3E,0x83,0x79,0x5B,0x55,0x5D,0xB2,
- 0x6C,0x5E,0xCE,0x90,0x62,0x8E,0x53,0x98,0xC9,0x0D,0x6D,0xE5,0x2D,0x57,0xCD,0xC5,
- 0x81,0x57,0xBA,0xE1,0xE8,0xB8,0x8F,0x72,0xE5,0x4F,0x13,0xDC,0xEA,0x9D,0x71,0x15,
- 0x10,0xB2,0x11,0x88,0xD5,0x09,0xD4,0x7F,0x5B,0x65,0x7F,0x2C,0x3B,0x38,0x4C,0x11,
- 0x68,0x50,0x8D,0xFB,0x9E,0xB0,0x59,0xBF,0x94,0x80,0x89,0x4A,0xC5,0x1A,0x18,0x12,
- 0x89,0x53,0xD1,0x4A,0x10,0x29,0xE8,0x8C,0x1C,0xEC,0xB6,0xEA,0x46,0xC7,0x17,0x8B,
- 0x25,0x15,0x31,0xA8,0xA2,0x6B,0x43,0xB1,0x9D,0xE2,0xDB,0x0B,0x87,0x9B,0xB0,0x11,
- 0x04,0x0E,0x71,0xD2,0x29,0x77,0x89,0x82,0x0A,0x66,0x41,0x7F,0x1D,0x0B,0x48,0xFF,
- 0x72,0xBB,0x24,0xFD,0xC2,0x48,0xA1,0x9B,0xFE,0x7B,0x7F,0xCE,0x88,0xDB,0x86,0xD9,
- 0x85,0x3B,0x1C,0xB0,0xDC,0xA8,0x33,0x07,0xBF,0x51,0x2E,0xE3,0x0E,0x9A,0x00,0x97,
- 0x1E,0x06,0xC0,0x97,0x43,0x9D,0xD8,0xB6,0x45,0xC4,0x86,0x67,0x5F,0x00,0xF8,0x88,
- 0x9A,0xA4,0x52,0x9E,0xC7,0xAA,0x8A,0x83,0x75,0xEC,0xC5,0x18,0xAE,0xCE,0xC3,0x2F,
- 0x1A,0x2B,0xF9,0x18,0xFF,0xAE,0x1A,0xF5,0x53,0x0B,0xB5,0x33,0x51,0xA7,0xFD,0xE8,
- 0xA8,0xE1,0xA2,0x64,0xB6,0x22,0x17,0x43,0x80,0xCC,0x0A,0xD8,0xAE,0x3B,0xBA,0x40,
- 0xD7,0xD9,0x92,0x4A,0x89,0xDF,0x04,0x10,0xEE,0x9B,0x18,0x2B,0x6A,0x77,0x69,0x8A,
- 0x68,0xF4,0xF9,0xB9,0xA2,0x21,0x15,0x6E,0xE6,0x1E,0x3B,0x03,0x62,0x30,0x9B,0x60,
- 0x41,0x7E,0x25,0x9B,0x9E,0x8F,0xC5,0x52,0x10,0x08,0xF8,0xC2,0x69,0xA1,0x21,0x11,
- 0x88,0x37,0x5E,0x79,0x35,0x66,0xFF,0x10,0x42,0x18,0x6E,0xED,0x97,0xB6,0x6B,0x1C,
- 0x4E,0x36,0xE5,0x6D,0x7D,0xB4,0xE4,0xBF,0x20,0xB9,0xE0,0x05,0x3A,0x69,0xD5,0xB8,
- 0xE3,0xD5,0xDC,0xE0,0xB9,0xAC,0x53,0x3E,0x07,0xA4,0x57,0xAD,0x77,0xFF,0x48,0x18,
- 0x76,0x2A,0xAC,0x49,0x2A,0x8E,0x47,0x75,0x6D,0x9F,0x67,0x63,0x30,0x35,0x8C,0x39,
- 0x05,0x39,0xD5,0x6F,0x64,0x3A,0x5B,0xAD,0xCA,0x0B,0xBB,0x82,0x52,0x99,0x45,0xB1,
- 0x93,0x36,0x36,0x99,0xAF,0x13,0x20,0x44,0x36,0xD8,0x02,0x44,0x09,0x39,0x92,0x85,
- 0xFF,0x4A,0x4A,0x97,0x87,0xA6,0x63,0xD7,0xC7,0xB5,0xB5,0x24,0xED,0x0F,0xB4,0x6F,
- 0x0C,0x58,0x52,0x14,0xD9,0xA6,0x7B,0xD3,0x79,0xBC,0x38,0x58,0xA1,0xBD,0x3B,0x84,
- 0x06,0xD8,0x1A,0x06,0xFD,0x6B,0xA8,0xEA,0x4B,0x69,0x28,0x04,0x37,0xAD,0x82,0x99,
- 0xFB,0x0E,0x1B,0x85,0xBD,0xA8,0x5D,0x73,0xCD,0xDC,0x58,0x75,0x0A,0xBE,0x63,0x6C,
- 0x48,0xE7,0x4C,0xE4,0x30,0x2B,0x04,0x60,0xB9,0x15,0xD8,0xDA,0x86,0x81,0x75,0x8F,
- 0x96,0xD4,0x8D,0x1C,0x5D,0x70,0x85,0x7C,0x1C,0x67,0x7B,0xD5,0x08,0x67,0xA6,0xCE,
- 0x4B,0x0A,0x66,0x70,0xB7,0xE5,0x63,0xD4,0x5B,0x8A,0x82,0xEA,0x10,0x67,0xCA,0xE2,
- 0xF4,0xEF,0x17,0x85,0x2F,0x2A,0x5F,0x8A,0x97,0x82,0xF8,0x6A,0xD6,0x34,0x10,0xEA,
- 0xEB,0xC9,0x5C,0x3C,0xE1,0x49,0xF8,0x46,0xEB,0xDE,0xBD,0xF6,0xA9,0x92,0xF1,0xAA,
- 0xA6,0xA0,0x18,0xB0,0x3A,0xD3,0x0F,0x1F,0xF3,0x6F,0xFF,0x31,0x45,0x43,0x44,0xD3,
- 0x50,0x9A,0xF7,0x88,0x09,0x96,0xC1,0xCE,0x76,0xCC,0xF2,0x2C,0x2C,0xBA,0xAD,0x82,
- 0x77,0x8F,0x18,0x84,0xC0,0xD2,0x07,0x9C,0x36,0x90,0x83,0x4E,0x0B,0xA5,0x4F,0x43,
- 0x3E,0x04,0xAB,0x78,0x4F,0xD6,0xFB,0x09,0x01,0x24,0x90,0xDA,0x6F,0x3C,0x3A,0x61,
- 0x0D,0x7F,0x69,0x4A,0xEB,0x2B,0x30,0x02,0xB4,0xDB,0xE0,0x84,0xA9,0xEC,0xD7,0x35,
- 0xBF,0x37,0x7D,0x85,0x58,0xCE,0xA9,0x4E,0xE4,0x80,0xC7,0xA8,0xD3,0x30,0x67,0x48,
- 0xEB,0x29,0xAF,0x2F,0x74,0x6A,0xB4,0xA7,0x3F,0x0F,0x3F,0x92,0xAF,0xF3,0xCA,0xAC,
- 0xAF,0x4B,0xD9,0x94,0xC0,0x43,0xCA,0x81,0x0D,0x2F,0x48,0xA1,0xB0,0x27,0xD5,0xD2,
- 0xEF,0x4B,0x05,0x85,0xA3,0xDE,0x4D,0x93,0x30,0x3C,0xF0,0xBB,0x4A,0x8F,0x30,0x27,
- 0x4C,0xEB,0xE3,0x3E,0x64,0xED,0x9A,0x2F,0x3B,0xF1,0x82,0xF0,0xBA,0xF4,0xCF,0x7F,
- 0x40,0xCB,0xB0,0xE1,0x7F,0xBC,0xAA,0x57,0xD3,0xC9,0x74,0xF2,0xFA,0x43,0x0D,0x22,
- 0xD0,0xF4,0x77,0x4E,0x93,0xD7,0x85,0x70,0x1F,0x99,0xBF,0xB6,0xDE,0x35,0xF1,0x30,
- 0xA7,0x5E,0x71,0xF0,0x6B,0x01,0x2D,0x7B,0x64,0xF0,0x33,0x53,0x0A,0x39,0x88,0xF3,
- 0x6B,0x3A,0xA6,0x6B,0x35,0xD2,0x2F,0x43,0xCD,0x02,0xFD,0xB5,0xE9,0xBC,0x5B,0xAA,
- 0xD8,0xA4,0x19,0x7E,0x0E,0x5D,0x94,0x81,0x9E,0x6F,0x77,0xAD,0xD6,0x0E,0x74,0x93,
- 0x96,0xE7,0xC4,0x18,0x5F,0xAD,0xF5,0x19,
-};
-
-u32 card_hash[0x412];
-int cardheader_devicetype = 0;
-u32 global3_x00, global3_x04; // RTC value
-u32 global3_rand1;
-u32 global3_rand3;
-
-u32 lookup(u32 *magic, u32 v)
-{
- u32 a = (v >> 24) & 0xFF;
- u32 b = (v >> 16) & 0xFF;
- u32 c = (v >> 8) & 0xFF;
- u32 d = (v >> 0) & 0xFF;
-
- a = magic[a+18+0];
- b = magic[b+18+256];
- c = magic[c+18+512];
- d = magic[d+18+768];
-
- return d + (c ^ (b + a));
-}
-
-void encrypt(u32 *magic, u32 *arg1, u32 *arg2)
-{
- u32 a,b,c;
- a = *arg1;
- b = *arg2;
- for (int i=0; i<16; i++)
- {
- c = magic[i] ^ a;
- a = b ^ lookup(magic, c);
- b = c;
- }
- *arg2 = a ^ magic[16];
- *arg1 = b ^ magic[17];
-}
-
-void decrypt(u32 *magic, u32 *arg1, u32 *arg2)
-{
- u32 a,b,c;
- a = *arg1;
- b = *arg2;
- for (int i=17; i>1; i--)
- {
- c = magic[i] ^ a;
- a = b ^ lookup(magic, c);
- b = c;
- }
- *arg1 = b ^ magic[0];
- *arg2 = a ^ magic[1];
-}
-
-void encrypt(u32 *magic, u64 &cmd)
-{
- encrypt(magic, (u32 *)&cmd + 1, (u32 *)&cmd + 0);
-}
-
-void decrypt(u32 *magic, u64 &cmd)
-{
- decrypt(magic, (u32 *)&cmd + 1, (u32 *)&cmd + 0);
-}
-
-void update_hashtable(u32* magic, u8 arg1[8])
-{
- for (int j=0;j<18;j++)
- {
- u32 r3=0;
- for (int i=0;i<4;i++)
- {
- r3 <<= 8;
- r3 |= arg1[(j*4 + i) & 7];
- }
- magic[j] ^= r3;
- }
-
- u32 tmp1 = 0;
- u32 tmp2 = 0;
- for (int i=0; i<18; i+=2)
- {
- encrypt(magic,&tmp1,&tmp2);
- magic[i+0] = tmp1;
- magic[i+1] = tmp2;
- }
- for (int i=0; i<0x400; i+=2)
- {
- encrypt(magic,&tmp1,&tmp2);
- magic[i+18+0] = tmp1;
- magic[i+18+1] = tmp2;
- }
-}
-
-u32 arg2[3];
-
-void init2(u32 *magic, u32 a[3])
-{
- encrypt(magic, a+2, a+1);
- encrypt(magic, a+1, a+0);
- update_hashtable(magic, (u8*)a);
-}
-
-void init1(u32 cardheader_gamecode)
-{
- memcpy(card_hash, &encr_data, 4*(1024 + 18));
- arg2[0] = *(u32 *)&cardheader_gamecode;
- arg2[1] = (*(u32 *)&cardheader_gamecode) >> 1;
- arg2[2] = (*(u32 *)&cardheader_gamecode) << 1;
- init2(card_hash, arg2);
- init2(card_hash, arg2);
-}
-
-void init0(u32 cardheader_gamecode)
-{
- init1(cardheader_gamecode);
- encrypt(card_hash, (u32*)&global3_x04, (u32*)&global3_x00);
- global3_rand1 = global3_x00 ^ global3_x04; // more RTC
- global3_rand3 = global3_x04 ^ 0x0380FEB2;
- encrypt(card_hash, (u32*)&global3_rand3, (u32*)&global3_rand1);
-}
-
-// ARM9 decryption check values
-#define MAGIC30 0x72636E65
-#define MAGIC34 0x6A624F79
-
-/*
- * decrypt_arm9
- */
-void decrypt_arm9(u32 cardheader_gamecode, unsigned char *data)
-{
- u32 *p = (u32*)data;
-
- init1(cardheader_gamecode);
- decrypt(card_hash, p+1, p);
- arg2[1] <<= 1;
- arg2[2] >>= 1;
- init2(card_hash, arg2);
- decrypt(card_hash, p+1, p);
-
- if (p[0] != MAGIC30 || p[1] != MAGIC34)
- {
- fprintf(stderr, "Decryption failed!\n");
- exit(1);
- }
-
- *p++ = 0xE7FFDEFF;
- *p++ = 0xE7FFDEFF;
- u32 size = 0x800 - 8;
- while (size > 0)
- {
- decrypt(card_hash, p+1, p);
- p += 2;
- size -= 8;
- }
-}
-
-/*
- * encrypt_arm9
- */
-void encrypt_arm9(u32 cardheader_gamecode, unsigned char *data)
-{
- u32 *p = (u32*)data;
- if (p[0] != 0xE7FFDEFF || p[1] != 0xE7FFDEFF)
- {
- fprintf(stderr, "Encryption failed!\n");
- exit(1);
- }
- p += 2;
-
- init1(cardheader_gamecode);
-
- arg2[1] <<= 1;
- arg2[2] >>= 1;
-
- init2(card_hash, arg2);
-
- u32 size = 0x800 - 8;
- while (size > 0)
- {
- encrypt(card_hash, p+1, p);
- p += 2;
- size -= 8;
- }
-
- // place header
-
- p = (u32*)data;
- p[0] = MAGIC30;
- p[1] = MAGIC34;
- encrypt(card_hash, p+1, p);
- init1(cardheader_gamecode);
- encrypt(card_hash, p+1, p);
-}
-
-/*
- * EnDecryptSecureArea
- */
-void EnDecryptSecureArea(char *ndsfilename, char endecrypt_option)
-{
- fNDS = fopen(ndsfilename, "r+b");
- if (!fNDS) { fprintf(stderr, "Cannot open file '%s'.\n", ndsfilename); exit(1); }
- fread(&header, 512, 1, fNDS);
- int romType = DetectRomType();
- unsigned char data[0x4000];
- fseek(fNDS, 0x4000, SEEK_SET);
- fread(data, 1, 0x4000, fNDS);
-
- bool do_decrypt = (endecrypt_option == 'd');
- bool do_encrypt = (endecrypt_option == 'e') || (endecrypt_option == 'E');
- unsigned int rounds_offsets = (endecrypt_option == 'E') ? 0x2000 : 0x1600;
- unsigned int sbox_offsets = (endecrypt_option == 'E') ? 0x2400 : 0x2800;
-
- // check if ROM is already encrypted
- if (romType == ROMTYPE_NDSDUMPED)
- {
- if (do_decrypt)
- {
- printf("Already decrypted.\n");
- }
- else
- {
- encrypt_arm9(*(u32 *)header.gamecode, data);
- header.secure_area_crc = CalcCrc16(data, 0x4000);
- header.header_crc = CalcHeaderCRC(header);
-
- init0(*(u32 *)header.gamecode);
- srand(*(u32 *)header.gamecode);
-
- // clear data after header
- fseek(fNDS, 0x200, SEEK_SET);
- for (unsigned int i=0x200; i<0x1000; i++) fputc(0, fNDS);
-
-/* // random data
- fseek(fNDS, 0x1000, SEEK_SET);
- for (unsigned int i=0x1000; i<0x4000; i++) fputc(rand(), fNDS);
-*/
- // rounds table
- fseek(fNDS, rounds_offsets, SEEK_SET);
- fwrite(card_hash + 0, 4, 18, fNDS);
-
- // S-boxes
- for (int i=0; i<4; i++)
- {
- fseek(fNDS, sbox_offsets + 4*256*i, SEEK_SET);
- fwrite(card_hash + 18 + i*256, 4, 256, fNDS); // s
- }
-
- // test patterns
- fseek(fNDS, 0x3000, SEEK_SET);
- for (int i=0x3000; i<0x3008; i++) fputc("\xFF\x00\xFF\x00\xAA\x55\xAA\x55"[i - 0x3000], fNDS);
- for (int i=0x3008; i<0x3200; i++) fputc((u8)i, fNDS);
- for (int i=0x3200; i<0x3400; i++) fputc((u8)(0xFF-i), fNDS);
- for (int i=0x3400; i<0x3600; i++) fputc(0x00, fNDS);
- for (int i=0x3600; i<0x3800; i++) fputc(0xFF, fNDS);
- for (int i=0x3800; i<0x3A00; i++) fputc(0x0F, fNDS);
- for (int i=0x3A00; i<0x3C00; i++) fputc(0xF0, fNDS);
- for (int i=0x3C00; i<0x3E00; i++) fputc(0x55, fNDS);
- for (int i=0x3E00; i<0x4000-1; i++) fputc(0xAA, fNDS);
- fputc(0x00, fNDS);
-
- // write secure 0x800
- fseek(fNDS, 0x4000, SEEK_SET);
- fwrite(data, 1, 0x800, fNDS);
-
- // calculate CRCs and write header
- header.secure_area_crc = CalcSecureAreaCRC(false);
- header.logo_crc = CalcLogoCRC(header);
- header.header_crc = CalcHeaderCRC(header);
- fseek(fNDS, 0, SEEK_SET);
- fwrite(&header, 512, 1, fNDS);
-
- printf("Encrypted.\n");
- }
- }
- else if (romType >= ROMTYPE_ENCRSECURE) // includes ROMTYPE_MASKROM
- {
- if (do_encrypt)
- {
- printf("Already encrypted.\n");
- }
- else
- {
- decrypt_arm9(*(u32 *)header.gamecode, data);
-
- // clear data after header
- fseek(fNDS, 0x200, SEEK_SET);
- for (unsigned int i=0x200; i<0x4000; i++) fputc(0, fNDS);
-
- // write secure 0x800
- fseek(fNDS, 0x4000, SEEK_SET);
- fwrite(data, 1, 0x800, fNDS);
-
- // write header
- fseek(fNDS, 0, SEEK_SET);
- fwrite(&header, 512, 1, fNDS);
-
- printf("Decrypted.\n");
- }
- }
- else
- {
- fprintf(stderr, "File doesn't appear to have a secure area!\n"); exit(1);
- }
-
- fclose(fNDS);
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/header.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/header.cpp
deleted file mode 100644
index 6bab434fc3..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/header.cpp
+++ /dev/null
@@ -1,648 +0,0 @@
-#include "ndstool.h"
-#include "banner.h"
-#include "sha1.h"
-#include "crc.h"
-#include "bigint.h"
-#include "arm7_sha1_homebrew.h"
-#include "arm7_sha1_nintendo.h"
-#include "encryption.h"
-
-/*
- * Data
- */
-unsigned char publicKeyNintendo[] =
-{
- 0x9E, 0xC1, 0xCC, 0xC0, 0x4A, 0x6B, 0xD0, 0xA0, 0x6D, 0x62, 0xED, 0x5F, 0x15, 0x67, 0x87, 0x12,
- 0xE6, 0xF4, 0x77, 0x1F, 0xD8, 0x5C, 0x81, 0xCE, 0x0C, 0xD0, 0x22, 0x31, 0xF5, 0x89, 0x08, 0xF5,
- 0xBE, 0x04, 0xCB, 0xC1, 0x4F, 0x63, 0xD9, 0x5A, 0x98, 0xFF, 0xEB, 0x36, 0x0F, 0x9C, 0x5D, 0xAD,
- 0x15, 0xB9, 0x99, 0xFB, 0xC6, 0x86, 0x2C, 0x0A, 0x0C, 0xFC, 0xE6, 0x86, 0x03, 0x60, 0xD4, 0x87,
- 0x28, 0xD5, 0x66, 0x42, 0x9C, 0xF7, 0x04, 0x14, 0x4E, 0x6F, 0x73, 0x20, 0xC3, 0x3E, 0x3F, 0xF5,
- 0x82, 0x2E, 0x78, 0x18, 0xD6, 0xCD, 0xD5, 0xC2, 0xDC, 0xAA, 0x1D, 0x34, 0x91, 0xEC, 0x99, 0xC9,
- 0xF7, 0xBF, 0xBF, 0xA0, 0x0E, 0x1E, 0xF0, 0x25, 0xF8, 0x66, 0x17, 0x54, 0x34, 0x28, 0x2D, 0x28,
- 0xA3, 0xAE, 0xF0, 0xA9, 0xFA, 0x3A, 0x70, 0x56, 0xD2, 0x34, 0xA9, 0xC5, 0x9E, 0x5D, 0xF5, 0xE1,
-};
-
-/*
- * CalcHeaderCRC
- */
-unsigned short CalcHeaderCRC(Header &header)
-{
- return CalcCrc16((unsigned char *)&header, 0x15E);
-}
-
-/*
- * CalcLogoCRC
- */
-unsigned short CalcLogoCRC(Header &header)
-{
- return CalcCrc16((unsigned char *)&header + 0xC0, 156);
-}
-
-/*
- * DetectRomType
- */
-int DetectRomType()
-{
- fseek(fNDS, 0x4000, SEEK_SET);
- unsigned int data[3];
- fread(data, 1, sizeof(data), fNDS);
- if (header.arm9_rom_offset < 0x4000) return ROMTYPE_HOMEBREW;
- if (data[0] == 0x00000000 && data[1] == 0x00000000) return ROMTYPE_MULTIBOOT;
- if (data[0] == 0xE7FFDEFF && data[1] == 0xE7FFDEFF) return ROMTYPE_NDSDUMPED;
- fseek(fNDS, 0x200, SEEK_SET);
- for (int i=0x200; i<0x4000; i++)
- if (fgetc(fNDS)) return ROMTYPE_MASKROM; // found something odd ;)
- return ROMTYPE_ENCRSECURE;
-}
-
-/*
- * CalcSecureAreaCRC
- */
-unsigned short CalcSecureAreaCRC(bool encrypt)
-{
- fseek(fNDS, 0x4000, SEEK_SET);
- unsigned char data[0x4000];
- fread(data, 1, 0x4000, fNDS);
- if (encrypt) encrypt_arm9(*(u32 *)header.gamecode, data);
- return CalcCrc16(data, 0x4000);
-}
-
-/*
- * CalcSecurityDataCRC
- */
-unsigned short CalcSecurityDataCRC()
-{
- fseek(fNDS, 0x1000, SEEK_SET);
- unsigned char data[0x2000];
- fread(data, 1, 0x2000, fNDS);
- return CalcCrc16(data, 0x2000);
-}
-
-/*
- * CalcSegment3CRC
- */
-unsigned short CalcSegment3CRC()
-{
- fseek(fNDS, 0x3000, SEEK_SET);
- unsigned char data[0x1000];
- fread(data, 1, 0x1000, fNDS);
- for (int i=0; i<0x1000; i+=2) // swap bytes
- {
- unsigned char t = data[i+1]; data[i+1] = data[i]; data[i] = t;
- }
- return CalcCcitt16(data, 0x1000); // why would they use CRC16-CCITT ?
-}
-
-/*
- * FixHeaderCRC
- */
-void FixHeaderCRC(char *ndsfilename)
-{
- fNDS = fopen(ndsfilename, "r+b");
- if (!fNDS) { fprintf(stderr, "Cannot open file '%s'.\n", ndsfilename); exit(1); }
- fread(&header, 512, 1, fNDS);
- header.header_crc = CalcHeaderCRC(header);
- fseek(fNDS, 0, SEEK_SET);
- fwrite(&header, 512, 1, fNDS);
- fclose(fNDS);
-}
-
-/*
- * ShowHeaderInfo
- */
-void ShowHeaderInfo(Header &header, int romType, unsigned int length = 0x200)
-{
- printf("0x00\t%-25s\t", "Game title");
-
- for (unsigned int i=0; i<sizeof(header.title); i++)
- if (header.title[i]) putchar(header.title[i]); printf("\n");
-
- printf("0x0C\t%-25s\t", "Game code");
- for (unsigned int i=0; i<sizeof(header.gamecode); i++)
- if (header.gamecode[i]) putchar(header.gamecode[i]);
- for (int i=0; i<NumCountries; i++)
- {
- if (countries[i].countrycode == header.gamecode[3])
- {
- printf(" (NTR-");
- for (unsigned int j=0; j<sizeof(header.gamecode); j++)
- if (header.gamecode[j]) putchar(header.gamecode[j]);
- printf("-%s)", countries[i].name);
- break;
- }
- }
- printf("\n");
-
- printf("0x10\t%-25s\t", "Maker code"); for (unsigned int i=0; i<sizeof(header.makercode); i++)
- if (header.makercode[i]) putchar(header.makercode[i]);
- for (int j=0; j<NumMakers; j++)
- {
- if ((makers[j].makercode[0] == header.makercode[0]) && (makers[j].makercode[1] == header.makercode[1]))
- {
- printf(" (%s)", makers[j].name);
- break;
- }
- }
- printf("\n");
-
- printf("0x12\t%-25s\t0x%02X\n", "Unit code", header.unitcode);
- printf("0x13\t%-25s\t0x%02X\n", "Device type", header.devicetype);
- printf("0x14\t%-25s\t0x%02X (%d Mbit)\n", "Device capacity", header.devicecap, 1<<header.devicecap);
- printf("0x15\t%-25s\t", "reserved 1"); for (unsigned int i=0; i<sizeof(header.reserved1); i++) printf("%02X", header.reserved1[i]); printf("\n");
- printf("0x1E\t%-25s\t0x%02X\n", "ROM version", header.romversion);
- printf("0x1F\t%-25s\t0x%02X\n", "reserved 2", header.reserved2);
- printf("0x20\t%-25s\t0x%X\n", "ARM9 ROM offset", (int)header.arm9_rom_offset);
- printf("0x24\t%-25s\t0x%X\n", "ARM9 entry address", (int)header.arm9_entry_address);
- printf("0x28\t%-25s\t0x%X\n", "ARM9 RAM address", (int)header.arm9_ram_address);
- printf("0x2C\t%-25s\t0x%X\n", "ARM9 code size", (int)header.arm9_size);
- printf("0x30\t%-25s\t0x%X\n", "ARM7 ROM offset", (int)header.arm7_rom_offset);
- printf("0x34\t%-25s\t0x%X\n", "ARM7 entry address", (int)header.arm7_entry_address);
- printf("0x38\t%-25s\t0x%X\n", "ARM7 RAM address", (int)header.arm7_ram_address);
- printf("0x3C\t%-25s\t0x%X\n", "ARM7 code size", (int)header.arm7_size);
- printf("0x40\t%-25s\t0x%X\n", "File name table offset", (int)header.fnt_offset);
- printf("0x44\t%-25s\t0x%X\n", "File name table size", (int)header.fnt_size);
- printf("0x48\t%-25s\t0x%X\n", "FAT offset", (int)header.fat_offset);
- printf("0x4C\t%-25s\t0x%X\n", "FAT size", (int)header.fat_size);
- printf("0x50\t%-25s\t0x%X\n", "ARM9 overlay offset", (int)header.arm9_overlay_offset);
- printf("0x54\t%-25s\t0x%X\n", "ARM9 overlay size", (int)header.arm9_overlay_size);
- printf("0x58\t%-25s\t0x%X\n", "ARM7 overlay offset", (int)header.arm7_overlay_offset);
- printf("0x5C\t%-25s\t0x%X\n", "ARM7 overlay size", (int)header.arm7_overlay_size);
- printf("0x60\t%-25s\t0x%08X\n", "ROM control info 1", (int)header.rom_control_info1);
- printf("0x64\t%-25s\t0x%08X\n", "ROM control info 2", (int)header.rom_control_info2);
- printf("0x68\t%-25s\t0x%X\n", "Icon/title offset", (int)header.banner_offset);
- unsigned short secure_area_crc = CalcSecureAreaCRC((romType == ROMTYPE_NDSDUMPED));
- const char *s1, *s2 = "";
- if (romType == ROMTYPE_HOMEBREW) s1 = "-";
- else if (secure_area_crc == header.secure_area_crc) s1 = "OK";
- else
- {
- s1 = "INVALID";
- }
- switch (romType)
- {
- case ROMTYPE_HOMEBREW: s2 = "homebrew"; break;
- case ROMTYPE_MULTIBOOT: s2 = "multiboot"; break;
- case ROMTYPE_NDSDUMPED: s2 = "decrypted"; break;
- case ROMTYPE_ENCRSECURE: s2 = "encrypted"; break;
- case ROMTYPE_MASKROM: s2 = "mask ROM"; break;
- }
- printf("0x6C\t%-25s\t0x%04X (%s, %s)\n", "Secure area CRC", (int)header.secure_area_crc, s1, s2);
- printf("0x6E\t%-25s\t0x%04X\n", "ROM control info 3", (int)header.rom_control_info3);
- printf("0x70\t%-25s\t0x%X\n", "ARM9 ?", (int)header.offset_0x70);
- printf("0x74\t%-25s\t0x%X\n", "ARM7 ?", (int)header.offset_0x74);
- printf("0x78\t%-25s\t0x%08X\n", "Magic 1", (int)header.offset_0x78);
- printf("0x7C\t%-25s\t0x%08X\n", "Magic 2", (int)header.offset_0x7C);
- printf("0x80\t%-25s\t0x%08X\n", "Application end offset", (int)header.application_end_offset);
- printf("0x84\t%-25s\t0x%08X\n", "ROM header size", (int)header.rom_header_size);
- for (unsigned int i=0x88; i<0xC0; i+=4)
- {
- unsigned_int &x = ((unsigned_int *)&header)[i/4];
- if (x != 0) printf("0x%02X\t%-25s\t0x%08X\n", i, "?", (int)x);
- }
- unsigned short logo_crc = CalcLogoCRC(header);
- printf("0x15C\t%-25s\t0x%04X (%s)\n", "Logo CRC", (int)header.logo_crc, (logo_crc == header.logo_crc) ? "OK" : "INVALID");
- unsigned short header_crc = CalcHeaderCRC(header);
- printf("0x15E\t%-25s\t0x%04X (%s)\n", "Header CRC", (int)header.header_crc, (header_crc == header.header_crc) ? "OK" : "INVALID");
- for (unsigned int i=0x160; i<length; i+=4)
- {
- unsigned_int &x = ((unsigned_int *)&header)[i/4];
- if (x != 0) printf("0x%02X\t%-25s\t0x%08X\n", i, "?", (int)x);
- }
-}
-
-/*
- * HeaderSha1
- */
-void HeaderSha1(FILE *fNDS, unsigned char *header_sha1, int romType)
-{
- sha1_ctx m_sha1;
- sha1_begin(&m_sha1);
- unsigned char buf[32 + 0x200];
- fseek(fNDS, 0x200, SEEK_SET); // check for 32 bytes text + alternate header
- fread(buf, 1, sizeof(buf), fNDS);
- if (!memcmp(buf, "DS DOWNLOAD PLAY", 16)) // found?
- {
- sha1_hash(buf + 0x20, 0x160, &m_sha1); // alternate header
- if (verbose >= 2)
- {
- printf("{ DS Download Play(TM) / Wireless MultiBoot header information:\n");
- ShowHeaderInfo(*(Header *)(buf + 0x20), romType, 0x160);
- printf("}\n");
- }
- }
- else
- {
- fseek(fNDS, 0, SEEK_SET);
- fread(buf, 1, sizeof(buf), fNDS);
- sha1_hash(buf, 0x160, &m_sha1);
- }
- sha1_end(header_sha1, &m_sha1);
-}
-
-/*
- * Arm9Sha1Multiboot
- */
-void Arm9Sha1Multiboot(FILE *fNDS, unsigned char *arm9_sha1)
-{
- sha1_ctx m_sha1;
- sha1_begin(&m_sha1);
- fseek(fNDS, header.arm9_rom_offset, SEEK_SET);
- unsigned int len = header.arm9_size;
- unsigned char *buf = new unsigned char [len];
- fread(buf, 1, len, fNDS);
- //printf("%u\n", len);
- sha1_hash(buf, len, &m_sha1);
- delete [] buf;
- sha1_end(arm9_sha1, &m_sha1);
-}
-
-/*
-C:\NitroSDK\tools\bin>emuchild.exe -d AMFE.bin C:\NitroSDK\build\demos\mb\cloneboot\etc\libsyscall_child.bin AMFE.bi
-option -d: No ARG
-argc=3 optind=2
-004B0020 16777216 bytes ReadFile 'AMFE.bin'
-00475200 2048 bytes ReadFile 'C:\NitroSDK\build\demos\mb\cloneboot\etc\libsyscall_child.bin'
-004B0020 16777216 bytes WriteFile 'AMFE.bi'
-
-
- -a I_OFFSET Default 0x4000. Location to insert syscall.
- -A I_SIZE Default 0x0800. Size to insert.
- -c C_OFFSET Default 0x5000. Location to clear romimage.
- -C C_SIZE Default 0x2000. Size to clear.
- -d Show debug messages (for test purpose)
- -h Show this message
-
-*/
-
-/*
- * Arm9Sha1ClearedOutArea
- */
-void Arm9Sha1ClearedOutArea(FILE *fNDS, unsigned char *arm9_sha1)
-{
- sha1_ctx m_sha1;
- sha1_begin(&m_sha1);
- fseek(fNDS, header.arm9_rom_offset, SEEK_SET);
- unsigned int len = header.arm9_size;
- unsigned char *buf = new unsigned char [len];
-
- int len1 = (0x5000 - header.arm9_rom_offset); // e.g. 0x5000 - 0x4000 = 0x1000
- int len3 = header.arm9_size - (0x7000 - header.arm9_rom_offset); // e.g. 0x10000 - (0x7000 - 0x4000) = 0xD000
- int len2 = header.arm9_size - len1 - len3; // e.g. 0x10000 - 0x1000 - 0xD000 = 0x2000
- if (len1 > 0) fread(buf, 1, len1, fNDS);
- if (len2 > 0) { memset(buf + len1, 0, len2); fseek(fNDS, len2, SEEK_CUR); } // gets cleared for security?
- if (len3 > 0) fread(buf + len1 + len2, 1, len3, fNDS);
-// printf("%X %X %X\n", len1, len2, len3);
-
-// memset(buf, 0, 0x800); // clear "secure area" too
-
- sha1_hash(buf, len, &m_sha1);
- delete [] buf;
- sha1_end(arm9_sha1, &m_sha1);
-}
-
-/*
- * Arm7Sha1
- */
-void Arm7Sha1(FILE *fNDS, unsigned char *arm7_sha1)
-{
- sha1_ctx m_sha1;
- sha1_begin(&m_sha1);
- fseek(fNDS, header.arm7_rom_offset, SEEK_SET);
- unsigned int len = header.arm7_size;
- unsigned char *buf = new unsigned char [len];
- fread(buf, 1, len, fNDS);
- //printf("%u\n", len);
- sha1_hash(buf, len, &m_sha1);
- delete [] buf;
- sha1_end(arm7_sha1, &m_sha1);
-}
-
-/*
- * CompareSha1WithList
- */
-int CompareSha1WithList(unsigned char *arm7_sha1, const unsigned char *text, unsigned int textSize)
-{
- while (1)
- {
- //printf("\n");
- for (int i=0; i<SHA1_DIGEST_SIZE; i++)
- {
- unsigned char b = 0;
- for (int n=0; n<2; n++)
- {
- //printf("%c", *text);
- if (!*text) return -1;
- b = b << 4 | ((*text > '9') ? ((*text - 'A') & 7) + 10 : *text - '0');
- text++;
- }
- //printf("%02X", b);
- if (b != arm7_sha1[i]) break; else if (i == 19) return 0;
- }
- while (*text && (*text >= ' ')) text++; // line end
- while (*text && (*text < ' ')) text++; // new line
- }
-}
-
-/*
- * HashAndCompareWithList
- * -1=error, 0=match, 1=no match
- */
-int HashAndCompareWithList(char *filename, unsigned char sha1[])
-{
- FILE *f = fopen(filename, "rb");
- if (!f) return -1;
- sha1_ctx m_sha1;
- sha1_begin(&m_sha1);
- unsigned char buf[1024];
- unsigned int r;
- do
- {
- r = fread(buf, 1, 1024, f);
- sha1_hash(buf, r, &m_sha1);
- } while (r > 0);
- fclose(f);
- sha1_end(sha1, &m_sha1);
- if (CompareSha1WithList(sha1, arm7_sha1_homebrew, arm7_sha1_homebrew_size)) return 1; // not yet in list
- return 0;
-}
-
-/*
- * strsepc
- */
-char *strsepc(char **s, char d)
-{
- char *r = *s;
- for (char *p = *s; ; p++)
- {
- if (*p == 0) { *s = p; break; }
- if (*p == d) { *s = p+1; *p = 0; break; }
- }
- return r;
-}
-
-/*
- * RomListInfo
- */
-void RomListInfo(unsigned int crc32_match)
-{
- if (!romlistfilename) return;
- FILE *fRomList = fopen(romlistfilename, "rt");
- if (!fRomList) { fprintf(stderr, "Cannot open file '%s'.\n", romlistfilename); exit(1); }
- char s[1024];
- while (fgets(s, 1024, fRomList)) // empty, title, title, title, title, filename, CRC32
- {
- char *p = s;
- if (strlen(strsepc(&p, '\xAC')) == 0)
- {
- char *title = strsepc(&p, '\xAC');
- unsigned int index = strtoul(title, 0, 10);
- title += 7;
- char *b1 = strchr(title, '(');
- char *b2 = b1 ? strchr(b1+1, ')') : 0;
- char *b3 = b2 ? strchr(b2+1, '(') : 0;
- char *b4 = b3 ? strchr(b3+1, ')') : 0;
- char *group = 0;
- if (b1 + 2 == b2) if (b3 && b4) { *b3 = 0; *b4 = 0; group = b3+1; } // remove release group name
- strsepc(&p, '\xAC'); strsepc(&p, '\xAC');
- strsepc(&p, '\xAC'); strsepc(&p, '\xAC');
- unsigned long crc32 = strtoul(strsepc(&p, '\xAC'), 0, 16);
- if (crc32 == crc32_match)
- {
- printf("Release index: \t%u\n", index);
- printf("Release title: \t%s\n", title);
- printf("Release group: \t%s\n", group ? group : "");
- }
- //for (int i=0; i<10; i++) printf("%d %s\n", i, strsepc(&p, '\xAC'));
- }
- }
-}
-
-/*
- * ShowVerboseInfo
- */
-void ShowVerboseInfo(FILE *fNDS, Header &header, int romType)
-{
- // calculate SHA1 of ARM7 binary
- unsigned char arm7_sha1[SHA1_DIGEST_SIZE];
- Arm7Sha1(fNDS, arm7_sha1);
-
- // find signature data
- unsigned_int signature_id = 0;
- fseek(fNDS, header.application_end_offset, SEEK_SET);
- fread(&signature_id, sizeof(signature_id), 1, fNDS);
- if (signature_id != 0x00016361)
- {
- fseek(fNDS, header.application_end_offset - 136, SEEK_SET); // try again
- fread(&signature_id, sizeof(signature_id), 1, fNDS);
- }
- if (signature_id == 0x00016361)
- {
- printf("\n");
-
- unsigned char signature[128];
- fread(signature, 1, sizeof(signature), fNDS);
-
- unsigned char sha_parts[3*SHA1_DIGEST_SIZE + 4];
- fread(sha_parts + 3*SHA1_DIGEST_SIZE, 4, 1, fNDS); // some number
-
- //printf("%08X\n", *(unsigned int *)(sha_parts + 3*SHA1_DIGEST_SIZE));
-
- unsigned char header_sha1[SHA1_DIGEST_SIZE];
- HeaderSha1(fNDS, header_sha1, romType);
- memcpy(sha_parts + 0*SHA1_DIGEST_SIZE, header_sha1, SHA1_DIGEST_SIZE);
-
- unsigned char arm9_sha1[SHA1_DIGEST_SIZE];
- if (romType == ROMTYPE_MULTIBOOT)
- {
- Arm9Sha1Multiboot(fNDS, arm9_sha1);
- }
- else
- {
- Arm9Sha1ClearedOutArea(fNDS, arm9_sha1);
- }
- memcpy(sha_parts + 1*SHA1_DIGEST_SIZE, arm9_sha1, SHA1_DIGEST_SIZE);
-
- memcpy(sha_parts + 2*SHA1_DIGEST_SIZE, arm7_sha1, SHA1_DIGEST_SIZE);
-
- unsigned char sha_final[SHA1_DIGEST_SIZE];
- {
- sha1_ctx m_sha1;
- sha1_begin(&m_sha1);
- unsigned int len = sizeof(sha_parts);
- unsigned char *buf = sha_parts;
- sha1_hash(buf, len, &m_sha1);
- sha1_end(sha_final, &m_sha1);
- }
-
- // calculate SHA1 from signature
- unsigned char sha1_from_sig[SHA1_DIGEST_SIZE];
- {
- BigInt _signature;
- _signature.Set(signature, sizeof(signature));
- //printf("signature: "); _signature.print();
-
- BigInt _publicKey;
- _publicKey.Set(publicKeyNintendo, sizeof(publicKeyNintendo));
- //printf("public key: "); _publicKey.print();
-
- BigInt big_sha1;
- big_sha1.PowMod(_signature, _publicKey);
- //printf("big_sha1: "); big_sha1.print();
- big_sha1.Get(sha1_from_sig, sizeof(sha1_from_sig));
- }
-
- bool ok = (memcmp(sha_final, sha1_from_sig, SHA1_DIGEST_SIZE) == 0);
- printf("DS Download Play(TM) / Wireless MultiBoot signature: %s\n", ok ? "OK" : "INVALID");
- if (!ok)
- {
- printf("header hash: \t"); for (int i=0; i<SHA1_DIGEST_SIZE; i++) printf("%02X", (sha_parts + 0*SHA1_DIGEST_SIZE)[i]); printf("\n");
- printf("ARM9 hash: \t"); for (int i=0; i<SHA1_DIGEST_SIZE; i++) printf("%02X", (sha_parts + 1*SHA1_DIGEST_SIZE)[i]); printf("\n");
- printf("ARM7 hash: \t"); for (int i=0; i<SHA1_DIGEST_SIZE; i++) printf("%02X", (sha_parts + 2*SHA1_DIGEST_SIZE)[i]); printf("\n");
- printf("combined hash: \t"); for (int i=0; i<SHA1_DIGEST_SIZE; i++) printf("%02X", sha_final[i]); printf("\n");
- printf("signature hash: \t"); for (int i=0; i<SHA1_DIGEST_SIZE; i++) printf("%02X", sha1_from_sig[i]); printf("\n");
- }
- }
-
- // CRC32
- {
- unsigned char *buf = new unsigned char [0x10000];
- fseek(fNDS, 0, SEEK_SET);
- unsigned long crc32 = ~0;
- int r;
- while ((r = fread(buf, 1, 0x10000, fNDS)) > 0)
- {
- crc32 = CalcCrc32(buf, r, crc32);
- }
- crc32 = ~crc32;
- delete [] buf;
-
- printf("\nFile CRC32: \t%08X\n", (unsigned int)crc32);
- RomListInfo(crc32);
- }
-
- // ROM dumper 1.0 bad data
- {
- unsigned char buf[0x200];
- fseek(fNDS, 0x7E00, SEEK_SET);
- fread(buf, 1, 0x200, fNDS);
- unsigned long crc32 = ~CalcCrc32(buf, 0x200);
- printf("\nSMT dumper v1.0 corruption check: \t%s\n", (crc32 == 0x7E8B456F) ? "CORRUPTED" : "OK");
- }
-
- // Verify ARM7 SHA1 hash against known default binaries
- int bKnownArm7 = 0;
- {
- printf("\nARM7 binary hash : \t"); for (int i=0; i<SHA1_DIGEST_SIZE; i++) printf("%02X", arm7_sha1[i]); printf("\n");
-
- if (CompareSha1WithList(arm7_sha1, arm7_sha1_homebrew, arm7_sha1_homebrew_size) == 0)
- {
- bKnownArm7 = 1; printf("ARM7 binary is homebrew verified.\n");
- }
- if (CompareSha1WithList(arm7_sha1, arm7_sha1_nintendo, arm7_sha1_nintendo_size) == 0)
- {
- bKnownArm7 = 2; printf("ARM7 binary is Nintendo verified.\n");
- }
- if (!bKnownArm7) printf("WARNING! ARM7 binary is NOT verified!\n");
- }
-
- // check ARM7 RAM address
- if (bKnownArm7 != 2)
- if ((header.arm7_ram_address < 0x03000000) || (header.arm7_ram_address >= 0x04000000))
- {
- printf("\nWARNING! ARM7 RAM address does not point to shared memory!\n");
- }
-
- // check ARM7 entry address
- if ((header.arm7_entry_address < header.arm7_ram_address) ||
- (header.arm7_entry_address > header.arm7_ram_address + header.arm7_size))
- {
- printf("\nWARNING! ARM7 entry address points outside of ARM7 binary!\n");
- }
-}
-
-/*
- * ShowInfo
- */
-void ShowInfo(char *ndsfilename)
-{
- fNDS = fopen(ndsfilename, "rb");
- if (!fNDS) { fprintf(stderr, "Cannot open file '%s'.\n", ndsfilename); exit(1); }
- fread(&header, 512, 1, fNDS);
-
- int romType = DetectRomType();
-
- printf("Header information:\n");
- ShowHeaderInfo(header, romType);
-
- // banner info
- if (header.banner_offset)
- {
- Banner banner;
- fseek(fNDS, header.banner_offset, SEEK_SET);
- if (fread(&banner, 1, sizeof(banner), fNDS))
- {
- unsigned short banner_crc = CalcBannerCRC(banner);
- printf("\n");
- printf("Banner CRC: \t0x%04X (%s)\n", (int)banner.crc, (banner_crc == banner.crc) ? "OK" : "INVALID");
-
- for (int language=1; language<=1; language++)
- {
- int line = 1;
- bool nextline = true;
- for (int i=0; i<128; i++)
- {
- unsigned short c = banner.title[language][i];
- if (c >= 128) c = '_';
- if (c == 0x00) { printf("\n"); break; }
- if (c == 0x0A)
- {
- nextline = true;
- }
- else
- {
- if (nextline)
- {
- if (line != 1) printf("\n");
- printf("%s banner text, line %d:", bannerLanguages[language], line);
- for (unsigned int i=0; i<11 - strlen(bannerLanguages[language]); i++) putchar(' ');
- printf("\t");
- nextline = false;
- line++;
- }
- putchar(c);
- }
- }
- }
- }
- }
-
- // ARM9 footer
- fseek(fNDS, header.arm9_rom_offset + header.arm9_size, SEEK_SET);
- unsigned_int nitrocode;
- if (fread(&nitrocode, sizeof(nitrocode), 1, fNDS) && (nitrocode == 0xDEC00621))
- {
- printf("\n");
- printf("ARM9 footer found.\n");
- unsigned_int x;
- fread(&x, sizeof(x), 1, fNDS);
- fread(&x, sizeof(x), 1, fNDS);
- }
-
- // show security CRCs
- if (romType >= ROMTYPE_NDSDUMPED)
- {
- printf("\n");
- unsigned short securitydata_crc = CalcSecurityDataCRC();
- printf("Security data CRC (0x1000-0x2FFF) 0x%04X\n", (int)securitydata_crc);
- unsigned short segment3_crc = CalcSegment3CRC();
- printf("Segment3 CRC (0x3000-0x3FFF) 0x%04X (%s)\n", (int)segment3_crc, (segment3_crc == 0x0254) ? "OK" : "INVALID");
- }
-
- // more information
- if (verbose >= 1)
- {
- ShowVerboseInfo(fNDS, header, romType);
- }
-
- fclose(fNDS);
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/hook.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/hook.cpp
deleted file mode 100644
index b99210c633..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/hook.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// tests... don't mind these
-// make && cp ASNE.nds 1.nds && ndstool -v -i -k -i 1.nds -7 c:\work\ds\dummyhook\dummyhook.bin | grep CRC32
-// C:\work\DS\buildscripts\tools\nds\ndstool>make && cp submarine_tech_demo_e3_2005.nds 1.nds && ndstool -v -i -T 1.nds -i -7 c:\work\ds\dummyhook\dummyhook.bin
-
-#include <ndstool.h>
-#include "crc.h"
-
-/*
- * Hook
- * Append own ARM7 code without affecting CRC32 of the file and patchability
- * This could be used for trainers
- */
-void Hook(char *ndsfilename, char *arm7filename)
-{
- fNDS = fopen(ndsfilename, "r+b");
- if (!fNDS) { fprintf(stderr, "Cannot open file '%s'.\n", ndsfilename); exit(1); }
- fseek(fNDS, 0, SEEK_SET);
- fread(&header, 512, 1, fNDS);
-
- // load additional ARM7 code
- FILE *fARM7 = fopen(arm7filename, "rb");
- if (!fARM7) { fprintf(stderr, "Cannot open file '%s'.\n", arm7filename); exit(1); }
- fseek(fARM7, 0, SEEK_END);
- unsigned int add_arm7_size = (ftell(fARM7) + 3) &~ 3;
- unsigned char *add_arm7 = new unsigned char [add_arm7_size];
- fseek(fARM7, 0, SEEK_SET);
- fread(add_arm7, 1, add_arm7_size, fARM7);
- fclose(fARM7);
-
- // restore backup of original header if found
- if (header.offset_0x160)
- {
- fseek(fNDS, header.offset_0x78, SEEK_SET);
- Header originalHeader;
- fread(&originalHeader, 512, 1, fNDS);
- if (*(unsigned int *)header.gamecode == *(unsigned int *)originalHeader.gamecode) header = originalHeader;
- }
-
- // calculate new offsets
- unsigned int new_arm7_offset = (header.application_end_offset + 0x100 + 0x1FF) &~ 0x1FF;
- unsigned int add_arm7_offset = new_arm7_offset + header.arm7_size;
- unsigned int header_backup_offset = add_arm7_offset + add_arm7_size;
- unsigned int new_application_end_offset = header_backup_offset + 0x200;
-
- // read original ARM7 code
- unsigned char *arm7 = new unsigned char [header.arm7_size];
- fseek(fNDS, header.arm7_rom_offset, SEEK_SET);
- fread(arm7, 1, header.arm7_size, fNDS);
-
- // write original header, original ARM7 code and append own ARM7 code
- //fseek(fNDS, new_arm7_offset, SEEK_SET);
- //fwrite(arm7, 1, header.arm7_size, fNDS);
- FFixCrc32(fNDS, new_arm7_offset, arm7, header.arm7_size);
- //fseek(fNDS, add_arm7_offset, SEEK_SET);
- //fwrite(add_arm7, 1, add_arm7_size, fNDS);
- FFixCrc32(fNDS, add_arm7_offset, add_arm7, add_arm7_size);
- //fseek(fNDS, header_backup_offset, SEEK_SET);
- //fwrite(&header, 1, 0x200, fNDS);
- FFixCrc32(fNDS, header_backup_offset, (unsigned char *)&header, 0x200);
-
- // write new header information
- header.offset_0x78 = header_backup_offset; // ROM offset of header backup
- header.offset_0x7C = header.arm7_ram_address + header.arm7_size + add_arm7_size; // RAM location of header backup
- header.arm7_entry_address = header.arm7_entry_address + header.arm7_size;
- header.arm9_entry_address = 0x027FFE18;
- *(unsigned_int *)(header.reserved1 + 3) = 0xE59FF004;
- header.arm7_rom_offset = new_arm7_offset;
- header.arm7_size = header.arm7_size + add_arm7_size + 0x200; // also load our code and the original header into memory
- header.application_end_offset = new_application_end_offset;
- header.header_crc = CalcHeaderCRC(header);
- //fseek(fNDS, 0, SEEK_SET);
- //fwrite(&header, 1, 0x200, fNDS);
- FFixCrc32(fNDS, 0, (unsigned char *)&header, 0x200, header.application_end_offset);
-
- fclose(fNDS);
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/loadme.c b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/loadme.c
deleted file mode 100644
index 5a70104199..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/loadme.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- This file was autogenerated by raw2c.
-Visit http://www.devkitpro.org
-*/
-
-const unsigned char loadme[] = {
- 0xc8, 0x60, 0x4f, 0xe2, 0x01, 0x70, 0x8f, 0xe2, 0x17, 0xff, 0x2f, 0xe1, 0x12, 0x4f, 0x11, 0x48,
- 0x12, 0x4c, 0x20, 0x60, 0x64, 0x60, 0x7c, 0x62, 0x30, 0x1c, 0x39, 0x1c, 0x10, 0x4a, 0x00, 0xf0,
- 0x14, 0xf8, 0x30, 0x6a, 0x80, 0x19, 0xb1, 0x6a, 0xf2, 0x6a, 0x00, 0xf0, 0x0b, 0xf8, 0x30, 0x6b,
- 0x80, 0x19, 0xb1, 0x6b, 0xf2, 0x6b, 0x00, 0xf0, 0x08, 0xf8, 0x70, 0x6a, 0x77, 0x6b, 0x07, 0x4c,
- 0x60, 0x60, 0x38, 0x47, 0x07, 0x4b, 0xd2, 0x18, 0x9a, 0x43, 0x07, 0x4b, 0x92, 0x08, 0xd2, 0x18,
- 0x0c, 0xdf, 0xf7, 0x46, 0x04, 0xf0, 0x1f, 0xe5, 0x00, 0xfe, 0x7f, 0x02, 0xf0, 0xff, 0x7f, 0x02,
- 0xf0, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-const int loadme_size = sizeof(loadme);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/logo.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/logo.cpp
deleted file mode 100644
index 58572cd366..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/logo.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-costs per 4 pixels: (# = black)
-
-1 bit:
-----
-
-4 bits:
-#---
-##--
---##
-####
-
-5 bits:
----#
-#-##
--###
--#--
---#-
-
-6 bits:
-#-#-
--##-
-###-
-#--#
--#-#
-##-#
-*/
-
-#include <stdio.h>
-
-void LogoPackBits(unsigned char *srcp, unsigned char *destp)
-{
- unsigned int destbit = 0;
- unsigned int destvalue = 0;
- unsigned int d = 0;
- for (unsigned int s=0; s<1664; s++)
- {
- if (srcp[s]) destvalue |= 1<<destbit;
- if (++destbit == 8)
- {
- destp[d++] = destvalue;
- destbit = 0;
- destvalue = 0;
- }
- }
-}
-
-struct LogoPattern
-{
- unsigned int value;
- unsigned int bits;
-} logoPatterns[16] =
-{
- {0x01, 1}, {0x06, 4}, {0x0A, 5}, {0x04, 4},
- {0x02, 5}, {0x1E, 6}, {0x16, 6}, {0x06, 6},
- {0x06, 5}, {0x1F, 6}, {0x17, 6}, {0x07, 6},
- {0x02, 4}, {0x0E, 5}, {0x07, 5}, {0x00, 4},
-};
-
-int LogoCompress(unsigned char *src, unsigned char *dst)
-{
- unsigned int data_out = 0;
- unsigned int outbit = 31;
- unsigned int outbitcnt = 0;
-
- for (int i=0; i<212; i++)
- {
- unsigned int data = *src++;
- for (int j=0; j<8; j+=4)
- {
- LogoPattern &lh = logoPatterns[data >> j & 0xF];
- outbitcnt += lh.bits;
- for (int b=lh.bits-1; b>=0; b--)
- {
- data_out |= (lh.value >> b & 1) << outbit;
- if (outbit == 0)
- {
- if (outbitcnt <= 156*8)
- {
- *dst++ = data_out >> 0;
- *dst++ = data_out >> 8;
- *dst++ = data_out >> 16;
- *dst++ = data_out >> 24;
- }
- outbit = 31;
- data_out = 0;
- }
- else
- {
- outbit--;
- }
- }
- }
- }
-
- if (outbit != 31)
- {
- if (outbitcnt <= 156*8)
- {
- *dst++ = data_out >> 0;
- *dst++ = data_out >> 8;
- *dst++ = data_out >> 16;
- *dst++ = data_out >> 24;
- }
- }
-
- return 156*8 - outbitcnt;
-};
-
-void LogoDiff(unsigned char *srcp, unsigned char *dstp)
-{
- unsigned int *intp_dst = (unsigned int *)dstp;
- *intp_dst++ = 0xD0 << 8 | 0x80 | 2; // header
-
- unsigned short *shortp_dst = (unsigned short *)intp_dst;
- unsigned short *shortp_src = (unsigned short *)srcp;
- unsigned short prev = 0;
- for (unsigned int i=0; i<0xD0; i+=2)
- {
- *shortp_dst++ = *shortp_src - prev;
- prev = *shortp_src++;
- }
-}
-
-int LogoConvert(unsigned char *srcp, unsigned char *dstp, unsigned char white)
-{
- // convert to tiles
- unsigned char tiles[1664];
- for (int ty=0; ty<2; ty++)
- {
- for (int y=0; y<8; y++)
- {
- for (int tx=0; tx<13; tx++)
- {
- for (int x=0; x<8; x++)
- {
- tiles[(ty*13 + tx)*64 + y*8 + x] = (*srcp++ == white) ? 0 : 1;
- }
- }
- }
- }
-
- // bitpack
- unsigned char bitpacked[1664/8];
- LogoPackBits(tiles, bitpacked);
-
- // diff
- unsigned char diffed[4 + 1664/8];
- LogoDiff(bitpacked, diffed);
-
- // compress
- int r = LogoCompress(diffed, dstp);
- if (r < 0)
- {
- fprintf(stderr, "Compressed logo is %u bit(s) too big. Please simplify.\n", -r);
- return -1;
- }
-
- return 0;
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndscodes.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndscodes.cpp
deleted file mode 100644
index 8ee2b7caba..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndscodes.cpp
+++ /dev/null
@@ -1,334 +0,0 @@
-#include "ndstool.h"
-
-Country countries[] =
-{
- { 'J', "JPN" },
- { 'E', "USA" } ,
- { 'P', "EUR" },
- { 'D', "NOE" },
- { 'F', "NOE" },
- { 'I', "ITA" },
- { 'S', "SPA" },
- { 'H', "HOL" },
- { 'K', "KOR" },
- { 'X', "EUU" },
-};
-int NumCountries = sizeof(countries) / sizeof(countries[0]);
-
-Maker makers[] =
-{
- { "01", "Nintendo" },
- { "02", "Rocket Games, Ajinomoto" },
- { "03", "Imagineer-Zoom" },
- { "04", "Gray Matter?" },
- { "05", "Zamuse" },
- { "06", "Falcom" },
- { "07", "Enix?" },
- { "08", "Capcom" },
- { "09", "Hot B Co." },
- { "0A", "Jaleco" },
- { "0B", "Coconuts Japan" },
- { "0C", "Coconuts Japan/G.X.Media" },
- { "0D", "Micronet?" },
- { "0E", "Technos" },
- { "0F", "Mebio Software" },
- { "0G", "Shouei System" },
- { "0H", "Starfish" },
- { "0J", "Mitsui Fudosan/Dentsu" },
- { "0L", "Warashi Inc." },
- { "0N", "Nowpro" },
- { "0P", "Game Village" },
- { "10", "?????????????" },
- { "12", "Infocom" },
- { "13", "Electronic Arts Japan" },
- { "15", "Cobra Team" },
- { "16", "Human/Field" },
- { "17", "KOEI" },
- { "18", "Hudson Soft" },
- { "19", "S.C.P." },
- { "1A", "Yanoman" },
- { "1C", "Tecmo Products" },
- { "1D", "Japan Glary Business" },
- { "1E", "Forum/OpenSystem" },
- { "1F", "Virgin Games" },
- { "1G", "SMDE" },
- { "1J", "Daikokudenki" },
- { "1P", "Creatures Inc." },
- { "1Q", "TDK Deep Impresion" },
- { "20", "Destination Software, KSS" },
- { "21", "Sunsoft/Tokai Engineering??" },
- { "22", "POW, VR 1 Japan??" },
- { "23", "Micro World" },
- { "25", "San-X" },
- { "26", "Enix" },
- { "27", "Loriciel/Electro Brain" },
- { "28", "Kemco Japan" },
- { "29", "Seta" },
- { "2A", "Culture Brain" },
- { "2C", "Palsoft" },
- { "2D", "Visit Co.,Ltd." },
- { "2E", "Intec" },
- { "2F", "System Sacom" },
- { "2G", "Poppo" },
- { "2H", "Ubisoft Japan" },
- { "2J", "Media Works" },
- { "2K", "NEC InterChannel" },
- { "2L", "Tam" },
- { "2M", "Jordan" },
- { "2N", "Smilesoft ???, Rocket ???" },
- { "2Q", "Mediakite" },
- { "30", "Viacom" },
- { "31", "Carrozzeria" },
- { "32", "Dynamic" },
- // { "33", "NOT A COMPANY!" },
- { "34", "Magifact" },
- { "35", "Hect" },
- { "36", "Codemasters" },
- { "37", "Taito/GAGA Communications" },
- { "38", "Laguna" },
- { "39", "Telstar Fun & Games, Event/Taito" },
- { "3B", "Arcade Zone Ltd" },
- { "3C", "Entertainment International/Empire Software?" },
- { "3D", "Loriciel" },
- { "3E", "Gremlin Graphics" },
- { "3F", "K.Amusement Leasing Co." },
- { "40", "Seika Corp." },
- { "41", "Ubi Soft Entertainment" },
- { "42", "Sunsoft US?" },
- { "44", "Life Fitness" },
- { "46", "System 3" },
- { "47", "Spectrum Holobyte" },
- { "49", "IREM" },
- { "4B", "Raya Systems" },
- { "4C", "Renovation Products" },
- { "4D", "Malibu Games" },
- { "4F", "Eidos (was U.S. Gold <=1995)" },
- { "4G", "Playmates Interactive?" },
- { "4J", "Fox Interactive" },
- { "4K", "Time Warner Interactive" },
- { "4Q", "Disney Interactive" },
- { "4S", "Black Pearl" },
- { "4U", "Advanced Productions" },
- { "4X", "GT Interactive" },
- { "4Y", "RARE?" },
- { "4Z", "Crave Entertainment" },
- { "50", "Absolute Entertainment" },
- { "51", "Acclaim" },
- { "52", "Activision" },
- { "53", "American Sammy" },
- { "54", "Take 2 Interactive (before it was GameTek)" },
- { "55", "Hi Tech" },
- { "56", "LJN LTD." },
- { "58", "Mattel" },
- { "5A", "Mindscape, Red Orb Entertainment?" },
- { "5B", "Romstar" },
- { "5C", "Taxan" },
- { "5D", "Midway (before it was Tradewest)" },
- { "5F", "American Softworks" },
- { "5G", "Majesco Sales Inc" },
- { "5H", "3DO" },
- { "5K", "Hasbro" },
- { "5L", "NewKidCo" },
- { "5M", "Telegames" },
- { "5N", "Metro3D" },
- { "5P", "Vatical Entertainment" },
- { "5Q", "LEGO Media" },
- { "5S", "Xicat Interactive" },
- { "5T", "Cryo Interactive" },
- { "5W", "Red Storm Entertainment" },
- { "5X", "Microids" },
- { "5Z", "Conspiracy/Swing" },
- { "60", "Titus" },
- { "61", "Virgin Interactive" },
- { "62", "Maxis" },
- { "64", "LucasArts Entertainment" },
- { "67", "Ocean" },
- { "69", "Electronic Arts" },
- { "6B", "Laser Beam" },
- { "6E", "Elite Systems" },
- { "6F", "Electro Brain" },
- { "6G", "The Learning Company" },
- { "6H", "BBC" },
- { "6J", "Software 2000" },
- { "6L", "BAM! Entertainment" },
- { "6M", "Studio 3" },
- { "6Q", "Classified Games" },
- { "6S", "TDK Mediactive" },
- { "6U", "DreamCatcher" },
- { "6V", "JoWood Produtions" },
- { "6W", "SEGA" },
- { "6X", "Wannado Edition" },
- { "6Y", "LSP" },
- { "6Z", "ITE Media" },
- { "70", "Infogrames" },
- { "71", "Interplay" },
- { "72", "JVC" },
- { "73", "Parker Brothers" },
- { "75", "Sales Curve" },
- { "78", "THQ" },
- { "79", "Accolade" },
- { "7A", "Triffix Entertainment" },
- { "7C", "Microprose Software" },
- { "7D", "Universal Interactive, Sierra, Simon & Schuster?" },
- { "7F", "Kemco" },
- { "7G", "Rage Software" },
- { "7H", "Encore" },
- { "7J", "Zoo" },
- { "7K", "BVM" },
- { "7L", "Simon & Schuster Interactive" },
- { "7M", "Asmik Ace Entertainment Inc./AIA" },
- { "7N", "Empire Interactive?" },
- { "7Q", "Jester Interactive" },
- { "7T", "Scholastic" },
- { "7U", "Ignition Entertainment" },
- { "7W", "Stadlbauer" },
- { "80", "Misawa" },
- { "81", "Teichiku" },
- { "82", "Namco Ltd." },
- { "83", "LOZC" },
- { "84", "KOEI" },
- { "86", "Tokuma Shoten Intermedia" },
- { "87", "Tsukuda Original" },
- { "88", "DATAM-Polystar" },
- { "8B", "Bulletproof Software" },
- { "8C", "Vic Tokai Inc." },
- { "8E", "Character Soft" },
- { "8F", "I'Max" },
- { "8G", "Saurus" },
- { "8J", "General Entertainment" },
- { "8N", "Success" },
- { "8P", "SEGA Japan" },
- { "90", "Takara Amusement" },
- { "91", "Chun Soft" },
- { "92", "Video System, McO'River???" },
- { "93", "BEC" },
- { "95", "Varie" },
- { "96", "Yonezawa/S'pal" },
- { "97", "Kaneko" },
- { "99", "Victor Interactive Software, Pack in Video" },
- { "9A", "Nichibutsu/Nihon Bussan" },
- { "9B", "Tecmo" },
- { "9C", "Imagineer" },
- { "9F", "Nova" },
- { "9G", "Den'Z" },
- { "9H", "Bottom Up" },
- { "9J", "TGL" },
- { "9L", "Hasbro Japan?" },
- { "9N", "Marvelous Entertainment" },
- { "9P", "Keynet Inc." },
- { "9Q", "Hands-On Entertainment" },
- { "A0", "Telenet" },
- { "A1", "Hori" },
- { "A4", "Konami" },
- { "A5", "K.Amusement Leasing Co." },
- { "A6", "Kawada" },
- { "A7", "Takara" },
- { "A9", "Technos Japan Corp." },
- { "AA", "JVC, Victor Musical Indutries" },
- { "AC", "Toei Animation" },
- { "AD", "Toho" },
- { "AF", "Namco" },
- { "AG", "Media Rings Corporation" },
- { "AH", "J-Wing" },
- { "AJ", "Pioneer LDC" },
- { "AK", "KID" },
- { "AL", "Mediafactory" },
- { "AP", "Infogrames Hudson" },
- { "AQ", "Kiratto. Ludic Inc" },
- { "B0", "Acclaim Japan" },
- { "B1", "ASCII (was Nexoft?)" },
- { "B2", "Bandai" },
- { "B4", "Enix" },
- { "B6", "HAL Laboratory" },
- { "B7", "SNK" },
- { "B9", "Pony Canyon" },
- { "BA", "Culture Brain" },
- { "BB", "Sunsoft" },
- { "BC", "Toshiba EMI" },
- { "BD", "Sony Imagesoft" },
- { "BF", "Sammy" },
- { "BG", "Magical" },
- { "BH", "Visco" },
- { "BJ", "Compile " },
- { "BL", "MTO Inc." },
- { "BN", "Sunrise Interactive" },
- { "BP", "Global A Entertainment" },
- { "BQ", "Fuuki" },
- { "C0", "Taito" },
- { "C2", "Kemco" },
- { "C3", "Square" },
- { "C4", "Tokuma Shoten" },
- { "C5", "Data East" },
- { "C6", "Tonkin House (was Tokyo Shoseki)" },
- { "C8", "Koei" },
- { "CA", "Konami/Ultra/Palcom" },
- { "CB", "NTVIC/VAP" },
- { "CC", "Use Co.,Ltd." },
- { "CD", "Meldac" },
- { "CE", "Pony Canyon" },
- { "CF", "Angel, Sotsu Agency/Sunrise" },
- { "CJ", "Boss" },
- { "CG", "Yumedia/Aroma Co., Ltd" },
- { "CK", "Axela/Crea-Tech?" },
- { "CL", "Sekaibunka-Sha, Sumire kobo?, Marigul Management Inc.?" },
- { "CM", "Konami Computer Entertainment Osaka" },
- { "CP", "Enterbrain" },
- { "D0", "Taito/Disco" },
- { "D1", "Sofel" },
- { "D2", "Quest, Bothtec" },
- { "D3", "Sigma, ?????" },
- { "D4", "Ask Kodansha" },
- { "D6", "Naxat" },
- { "D7", "Copya System" },
- { "D8", "Capcom Co., Ltd." },
- { "D9", "Banpresto" },
- { "DA", "TOMY" },
- { "DB", "LJN Japan" },
- { "DD", "NCS" },
- { "DE", "Human Entertainment" },
- { "DF", "Altron" },
- { "DG", "Jaleco???" },
- { "DH", "Gaps Inc." },
- { "DL", "????" },
- { "DN", "Elf" },
- { "E0", "Jaleco" },
- { "E1", "????" },
- { "E2", "Yutaka" },
- { "E3", "Varie" },
- { "E4", "T&ESoft" },
- { "E5", "Epoch" },
- { "E7", "Athena" },
- { "E8", "Asmik" },
- { "E9", "Natsume" },
- { "EA", "King Records" },
- { "EB", "Atlus" },
- { "EC", "Epic/Sony Records" },
- { "EE", "IGS" },
- { "EG", "Chatnoir" },
- { "EH", "Right Stuff" },
- { "EJ", "????" },
- { "EL", "Spike" },
- { "EM", "Konami Computer Entertainment Tokyo" },
- { "EN", "Alphadream Corporation" },
- { "F0", "A Wave" },
- { "F1", "Motown Software" },
- { "F2", "Left Field Entertainment" },
- { "F3", "Extreme Ent. Grp." },
- { "F4", "TecMagik" },
- { "F9", "Cybersoft" },
- { "FB", "Psygnosis" },
- { "FE", "Davidson/Western Tech." },
- { "G1", "PCCW Japan" },
- { "G4", "KiKi Co Ltd" },
- { "G5", "Open Sesame Inc???" },
- { "G6", "Sims" },
- { "G7", "Broccoli" },
- { "G8", "Avex" },
- { "G9", "D3 Publisher" },
- { "GB", "Konami Computer Entertainment Japan" },
- { "GD", "Square-Enix" },
- { "IH", "Yojigen" }
-};
-
-int NumMakers = sizeof(makers) / sizeof(makers[0]);
-
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndscreate.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndscreate.cpp
deleted file mode 100644
index 51e751af94..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndscreate.cpp
+++ /dev/null
@@ -1,606 +0,0 @@
-#include <time.h>
-#include <ndstool.h>
-#include "logo.h"
-#include "raster.h"
-#include "banner.h"
-#include "overlay.h"
-#include "loadme.h"
-#include "ndstree.h"
-
-unsigned int arm9_align = 0x1FF;
-unsigned int arm7_align = 0x1FF;
-unsigned int fnt_align = 0x1FF; // 0x3 0x1FF
-unsigned int fat_align = 0x1FF; // 0x3 0x1FF
-unsigned int banner_align = 0x1FF;
-unsigned int file_align = 0x1FF; // 0x3 0x1FF
-
-unsigned int overlay_files = 0;
-
-unsigned char romcontrol[] = { 0x00,0x60,0x58,0x00,0xF8,0x08,0x18,0x00 };
-
-const unsigned char nintendo_logo[] =
-{
- 0x24,0xFF,0xAE,0x51,0x69,0x9A,0xA2,0x21,0x3D,0x84,0x82,0x0A,0x84,0xE4,0x09,0xAD,
- 0x11,0x24,0x8B,0x98,0xC0,0x81,0x7F,0x21,0xA3,0x52,0xBE,0x19,0x93,0x09,0xCE,0x20,
- 0x10,0x46,0x4A,0x4A,0xF8,0x27,0x31,0xEC,0x58,0xC7,0xE8,0x33,0x82,0xE3,0xCE,0xBF,
- 0x85,0xF4,0xDF,0x94,0xCE,0x4B,0x09,0xC1,0x94,0x56,0x8A,0xC0,0x13,0x72,0xA7,0xFC,
- 0x9F,0x84,0x4D,0x73,0xA3,0xCA,0x9A,0x61,0x58,0x97,0xA3,0x27,0xFC,0x03,0x98,0x76,
- 0x23,0x1D,0xC7,0x61,0x03,0x04,0xAE,0x56,0xBF,0x38,0x84,0x00,0x40,0xA7,0x0E,0xFD,
- 0xFF,0x52,0xFE,0x03,0x6F,0x95,0x30,0xF1,0x97,0xFB,0xC0,0x85,0x60,0xD6,0x80,0x25,
- 0xA9,0x63,0xBE,0x03,0x01,0x4E,0x38,0xE2,0xF9,0xA2,0x34,0xFF,0xBB,0x3E,0x03,0x44,
- 0x78,0x00,0x90,0xCB,0x88,0x11,0x3A,0x94,0x65,0xC0,0x7C,0x63,0x87,0xF0,0x3C,0xAF,
- 0xD6,0x25,0xE4,0x8B,0x38,0x0A,0xAC,0x72,0x21,0xD4,0xF8,0x07,
-};
-
-/*
- * HasElfExtension
- */
-bool HasElfExtension(char *filename)
-{
- char *p = strrchr(filename, '.');
- if (!p) return false;
- return (strcmp(p, ".elf") == 0);
-}
-
-/*
- * CopyFromBin
- */
-int CopyFromBin(char *binFilename, unsigned int *size = 0, unsigned int *size_without_footer = 0)
-{
- FILE *fi = fopen(binFilename, "rb");
- if (!fi) { fprintf(stderr, "Cannot open file '%s'.\n", binFilename); exit(1); }
- unsigned int _size = 0;
- while (1)
- {
- unsigned char buffer[1024];
- int bytesread = fread(buffer, 1, sizeof(buffer), fi);
- if (bytesread <= 0) break;
- fwrite(buffer, 1, bytesread, fNDS);
- _size += bytesread;
- }
- if (size) *size = _size;
-
- // check footer
- if (size_without_footer)
- {
- fseek(fi, _size - 3*4, SEEK_SET);
- unsigned_int nitrocode;
- fread(&nitrocode, sizeof(nitrocode), 1, fi);
- if (nitrocode == 0xDEC00621)
- *size_without_footer = _size - 3*4;
- else
- *size_without_footer = _size;
- }
-
- fclose(fi);
- return 0;
-}
-
-/*
- * CopyFromElf
- */
-#if 0
-int CopyFromElf(char *elfFilename, unsigned int *entry, unsigned int *ram_address, unsigned int *size)
-{
- int fd = open(elfFilename, O_RDONLY);
- if (fd < 0) { fprintf(stderr, "Cannot open file '%s'.\n", elfFilename); exit(1); }
- if (elf_version(EV_CURRENT) == EV_NONE) { fprintf(stderr, "libelf out of date!\n"); exit(1); }
- Elf *elf;
- if ((elf = elf_begin(fd, ELF_C_READ, 0)) == 0) { fprintf(stderr, "Cannot open ELF file!\n"); exit(1); }
- Elf32_Ehdr *ehdr;
- if ((ehdr = elf32_getehdr(elf)) == 0) { fprintf(stderr, "Cannot read ELF header!\n"); exit(1); }
- if (ehdr->e_machine != EM_ARM) { fprintf(stderr, "Not an ARM ELF file!\n"); exit(1); }
-
- *entry = ehdr->e_entry;
- *size = 0;
- *ram_address = 0;
-// printf("entry = 0x%X\n", ehdr->e_entry);
-
- Elf_Scn *scn = elf_getscn(elf, 0);
- Elf32_Shdr *shdr = elf32_getshdr(scn);
- while (shdr)
- {
- if (shdr->sh_flags & SHF_ALLOC)
- {
-/* char *name;
- if (!(name = elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name))) name = "???";
- printf("%s\n", name);*/
-
- if (!*ram_address) *ram_address = shdr->sh_addr; // use first address (assume it's .text)
-
-// don't mind the garbage here
-
-// printf("sh_addr=0x%X sh_offset=0x%X sh_size=0x%X sh_link=%u sh_entsize=%u sh_addralign=%u\n", shdr->sh_addr, shdr->sh_offset, shdr->sh_size, shdr->sh_link, shdr->sh_entsize, shdr->sh_addralign);
- // Elf32_Word sh_name;
- // Elf32_Word sh_type;
- // Elf32_Word sh_flags;
- // Elf32_Addr sh_addr;
- // Elf32_Off sh_offset;
- // Elf32_Word sh_size;
- // Elf32_Word sh_link;
- // Elf32_Word sh_info;
- // Elf32_Word sh_addralign;
- // Elf32_Word sh_entsize;
-
- Elf_Data *data;
- if ((data = elf_getdata(scn, NULL)))
- {
- /*for (int i=0; i<data->d_size; i++)
- {
- printf("%02X ", ((unsigned char *)data->d_buf)[i]);
- }
- printf("\n");*/
- fwrite(data->d_buf, 1, data->d_size, fNDS);
- *size += data->d_size;
- }
- }
-
- scn = elf_nextscn(elf, scn);
- shdr = elf32_getshdr(scn);
- }
-
- elf_end(elf);
-
- return 0;
-}
-#endif
-
-/*
- * AddFile
- */
-void AddFile(char *rootdir, const char *prefix, const char *entry_name, unsigned int file_id)
-{
- // make filename
- char strbuf[MAXPATHLEN];
- strcpy(strbuf, rootdir);
- strcat(strbuf, prefix);
- strcat(strbuf, entry_name);
-
- //unsigned int file_end = ftell(fNDS);
-
- file_top = (file_top + file_align) &~ file_align;
- fseek(fNDS, file_top, SEEK_SET);
-
- FILE *fi = fopen(strbuf, "rb");
- if (!fi) { fprintf(stderr, "Cannot open file '%s'.\n", strbuf); exit(1); }
- fseek(fi, 0, SEEK_END);
- unsigned int size = ftell(fi);
- unsigned int file_bottom = file_top + size;
- fseek(fi, 0, SEEK_SET);
-
- // print
- if (verbose)
- {
- printf("%5u 0x%08X 0x%08X %9u %s%s\n", file_id, file_top, file_bottom, size, prefix, entry_name);
- }
-
- // write data
- unsigned int sizeof_copybuf = 256*1024;
- unsigned char *copybuf = new unsigned char [sizeof_copybuf];
- while (size > 0)
- {
- unsigned int size2 = (size >= sizeof_copybuf) ? sizeof_copybuf : size;
- fread(copybuf, 1, size2, fi);
- fwrite(copybuf, 1, size2, fNDS);
- size -= size2;
- }
- delete [] copybuf;
- fclose(fi);
- if ((unsigned int)ftell(fNDS) > file_end) file_end = ftell(fNDS);
-
- // write fat
- fseek(fNDS, header.fat_offset + 8*file_id, SEEK_SET);
- unsigned_int top = file_top;
- fwrite(&top, 1, sizeof(top), fNDS);
- unsigned_int bottom = file_bottom;
- fwrite(&bottom, 1, sizeof(bottom), fNDS);
-
- file_top = file_bottom;
-}
-
-/*
- * AddDirectory
- * Walks the tree and adds files to NDS
- */
-void AddDirectory(TreeNode *node, const char *prefix, unsigned int this_dir_id, unsigned int _parent_id)
-{
- // skip dummy node
- node = node->next;
-
- if (verbose) printf("%s\n", prefix);
-
- // write directory info
- fseek(fNDS, header.fnt_offset + 8*(this_dir_id & 0xFFF), SEEK_SET);
- unsigned_int entry_start = _entry_start; // reference location of entry name
- fwrite(&entry_start, 1, sizeof(entry_start), fNDS);
- unsigned int _top_file_id = free_file_id;
- unsigned_short top_file_id = _top_file_id; // file ID of top entry
- fwrite(&top_file_id, 1, sizeof(top_file_id), fNDS);
- unsigned_short parent_id = _parent_id; // ID of parent directory or directory count (root)
- fwrite(&parent_id, 1, sizeof(parent_id), fNDS);
-
- //printf("dir %X file_id %u +\n", this_dir_id, (int)top_file_id);
-
- // directory entrynames
- {
- // start of directory entrynames
- fseek(fNDS, header.fnt_offset + _entry_start, SEEK_SET);
-
- // write filenames
- for (TreeNode *t=node; t; t=t->next)
- {
- if (!t->directory)
- {
- int namelen = strlen(t->name);
- fputc(t->directory ? namelen | 128 : namelen, fNDS); _entry_start += 1;
- fwrite(t->name, 1, namelen, fNDS); _entry_start += namelen;
-
- //printf("[ %s -> %u ]\n", t->name, free_file_id);
-
- free_file_id++;
- }
- }
-
- // write directorynames
- for (TreeNode *t=node; t; t=t->next)
- {
- if (t->directory)
- {
- //printf("*entry %s\n", t->name);
-
- int namelen = strlen(t->name);
- fputc(t->directory ? namelen | 128 : namelen, fNDS); _entry_start += 1;
- fwrite(t->name, 1, namelen, fNDS); _entry_start += namelen;
-
- //printf("[ %s -> %X ]\n", t->name, t->dir_id);
-
- unsigned_short _dir_id_tmp = t->dir_id;
- fwrite(&_dir_id_tmp, 1, sizeof(_dir_id_tmp), fNDS);
- _entry_start += sizeof(_dir_id_tmp);
- }
- }
-
- fputc(0, fNDS); _entry_start += 1; // end of directory entrynames
- }
-
- // add files
- unsigned int local_file_id = _top_file_id;
- for (TreeNode *t=node; t; t=t->next)
- {
- //printf("*2* %s\n", t->name);
-
- if (!t->directory)
- {
- AddFile(filerootdir, prefix, t->name, local_file_id++);
- }
- }
-
- // add subdirectories
- for (TreeNode *t=node; t; t=t->next)
- {
- //printf("*2* %s\n", t->name);
-
- if (t->directory)
- {
- char strbuf[MAXPATHLEN];
- strcpy(strbuf, prefix);
- strcat(strbuf, t->name);
- strcat(strbuf, "/");
- AddDirectory(t->directory, strbuf, t->dir_id, this_dir_id);
- }
- }
-}
-
-/*
- * Create
- */
-void Create()
-{
- fNDS = fopen(ndsfilename, "wb");
- if (!fNDS) { fprintf(stderr, "Cannot open file '%s'.\n", ndsfilename); exit(1); }
-
- bool bSecureSyscalls = false;
- char *headerfilename = (headerfilename_or_size && (strtoul(headerfilename_or_size,0,0) == 0)) ? headerfilename_or_size : 0;
- u32 headersize = headerfilename_or_size ? strtoul(headerfilename_or_size,0,0) : 0x200;
-
- // initial header data
- if (headerfilename)
- {
- // header template
- FILE *fi = fopen(headerfilename, "rb");
- if (!fi) { fprintf(stderr, "Cannot open file '%s'.\n", headerfilename); exit(1); }
- fread(&header, 1, 0x200, fi);
- fclose(fi);
-
- if ((header.arm9_ram_address + 0x800 == header.arm9_entry_address) || (header.rom_header_size > 0x200))
- {
- bSecureSyscalls = true;
- }
- }
- else // set header default values
- {
- // clear header
- memset(&header, 0, 0x200);
- memcpy(header.gamecode, "####", 4);
-
- if ((arm9RamAddress + 0x800 == arm9Entry) || (headersize > 0x200))
- {
- bSecureSyscalls = true;
- }
- else
- {
- header.reserved2 = 0x04; // autostart
- *(unsigned_int *)(((unsigned char *)&header) + 0x0) = 0xEA00002E; // for PassMe's that start @ 0x08000000
- }
- *(unsigned_int *)(((unsigned char *)&header) + 0x60) = 1<<22 | latency2<<16 | 1<<14 | 1<<13 | latency1; // ROM control info 1
- *(unsigned_int *)(((unsigned char *)&header) + 0x64) = 1<<29 | latency2<<16 | latency1; // ROM control info 2
- *(unsigned_short *)(((unsigned char *)&header) + 0x6E) = 0x051E; // ROM control info 3
- }
- if (headersize) header.rom_header_size = headersize;
- if (header.rom_header_size == 0) header.rom_header_size = bSecureSyscalls ? 0x4000 : 0x200;
-
- // load a logo
- if (logofilename)
- {
- char *p = strrchr(logofilename, '.');
- if (!strcmp(p, ".bmp"))
- {
- CRaster raster;
- if (raster.LoadBMP(logofilename) < 0) exit(1);
- unsigned char white = (raster.palette[0].rgbGreen >= 128) ? 0 : 1;
- if (LogoConvert(raster.raster, header.logo, white) < 0) exit(1);
- }
- else
- {
- FILE *fi = fopen(logofilename, "rb");
- if (!fi) { fprintf(stderr, "Cannot open file '%s'.\n", logofilename); exit(1); }
- fread(&header.logo, 1, 156, fi);
- fclose(fi);
- }
- }
- else if (bSecureSyscalls) // use Nintendo logo
- {
- memcpy(((unsigned char *)&header) + 0xC0, nintendo_logo, sizeof(nintendo_logo));
- }
- else // add small NDS loader
- {
- if (loadme_size != 156) { fprintf(stderr, "loadme size error\n"); exit(1); }
- memcpy(header.logo, loadme, loadme_size); // self-contained NDS loader for *Me GBA cartridge boot
- memcpy(&header.offset_0xA0, "SRAM_V110", 9); // allow GBA cartridge SRAM backup
- memcpy(&header.offset_0xAC, "PASS01\x96", 7); // automatically start with FlashMe, make it look more like a GBA rom
- }
-
- // override default title/game/maker codes
- if (title) strncpy(header.title, title, 12);
- if (gamecode) strncpy(header.gamecode, gamecode, 4);
- if (makercode) strncpy((char *)header.makercode, makercode, 2);
-
- // --------------------------
-
- fseek(fNDS, header.rom_header_size, SEEK_SET);
-
- // ARM9 binary
- if (arm9filename)
- {
- header.arm9_rom_offset = (ftell(fNDS) + arm9_align) &~ arm9_align;
- fseek(fNDS, header.arm9_rom_offset, SEEK_SET);
-
- unsigned int entry_address = arm9Entry ? arm9Entry : (unsigned int)header.arm9_entry_address; // template
- unsigned int ram_address = arm9RamAddress ? arm9RamAddress : (unsigned int)header.arm9_ram_address; // template
- if (!ram_address && entry_address) ram_address = entry_address;
- if (!entry_address && ram_address) entry_address = ram_address;
- if (!ram_address) { ram_address = entry_address = 0x02000000; }
-
- // add dummy area for secure syscalls
- header.arm9_size = 0;
- if (bSecureSyscalls)
- {
- unsigned_int x;
- FILE *fARM9 = fopen(arm9filename, "rb");
- if (fARM9)
- {
- fread(&x, sizeof(x), 1, fARM9);
- fclose(fARM9);
- if (x != 0xE7FFDEFF) // not already exist?
- {
- x = 0xE7FFDEFF;
- for (int i=0; i<0x800/4; i++) fwrite(&x, sizeof(x), 1, fNDS);
- header.arm9_size = 0x800;
- }
- }
- }
-
- unsigned int size = 0;
-#if 0
- if (HasElfExtension(arm9filename))
- CopyFromElf(arm9filename, &entry_address, &ram_address, &size);
- else
-#endif
- CopyFromBin(arm9filename, 0, &size);
- header.arm9_entry_address = entry_address;
- header.arm9_ram_address = ram_address;
- header.arm9_size = header.arm9_size + ((size + 3) &~ 3);
- }
- else
- {
- fprintf(stderr, "ARM9 binary file required.\n");
- exit(1);
- }
-
- // ARM9 overlay table
- if (arm9ovltablefilename)
- {
- unsigned_int x1 = 0xDEC00621; fwrite(&x1, sizeof(x1), 1, fNDS); // 0x2106c0de magic
- unsigned_int x2 = 0x00000AD8; fwrite(&x2, sizeof(x2), 1, fNDS); // ???
- unsigned_int x3 = 0x00000000; fwrite(&x3, sizeof(x3), 1, fNDS); // ???
-
- header.arm9_overlay_offset = ftell(fNDS); // do not align
- fseek(fNDS, header.arm9_overlay_offset, SEEK_SET);
- unsigned int size = 0;
- CopyFromBin(arm9ovltablefilename, &size);
- header.arm9_overlay_size = size;
- overlay_files += size / sizeof(OverlayEntry);
- if (!size) header.arm9_overlay_offset = 0;
- }
-
- // COULD BE HERE: ARM9 overlay files, no padding before or between. end is padded with 0xFF's and then followed by ARM7 binary
- // fseek(fNDS, 1388772, SEEK_CUR); // test for ASME
-
- // ARM7 binary
- header.arm7_rom_offset = (ftell(fNDS) + arm7_align) &~ arm7_align;
- fseek(fNDS, header.arm7_rom_offset, SEEK_SET);
-
- char *devkitProPATH;
- devkitProPATH = getenv("DEVKITPRO");
-
- #ifdef __WIN32__
- // convert to standard windows path
- if ( devkitProPATH && devkitProPATH[0] == '/' ) {
- devkitProPATH[0] = devkitProPATH[1];
- devkitProPATH[1] = ':';
- }
- #endif
-
- if ( !arm7filename) {
- char arm7PathName[MAXPATHLEN];
-
- if (!devkitProPATH) {
- fprintf(stderr,"No arm7 specified and DEVKITPRO missing from environment!\n");
- exit(1);
- }
-
- strcpy(arm7PathName,devkitProPATH);
- strcat(arm7PathName,"/libnds/basic.arm7");
- arm7filename = arm7PathName;
- }
-
- unsigned int entry_address = arm7Entry ? arm7Entry : (unsigned int)header.arm7_entry_address; // template
- unsigned int ram_address = arm7RamAddress ? arm7RamAddress : (unsigned int)header.arm7_ram_address; // template
- if (!ram_address && entry_address) ram_address = entry_address;
- if (!entry_address && ram_address) entry_address = ram_address;
- if (!ram_address) { ram_address = entry_address = 0x037f8000; }
-
- unsigned int size = 0;
- CopyFromBin(arm7filename, &size);
-
- header.arm7_entry_address = entry_address;
- header.arm7_ram_address = ram_address;
- header.arm7_size = ((size + 3) &~ 3);
-
- // ARM7 overlay table
- if (arm7ovltablefilename)
- {
- header.arm7_overlay_offset = ftell(fNDS); // do not align
- fseek(fNDS, header.arm7_overlay_offset, SEEK_SET);
- unsigned int size = 0;
- CopyFromBin(arm7ovltablefilename, &size);
- header.arm7_overlay_size = size;
- overlay_files += size / sizeof(OverlayEntry);
- if (!size) header.arm7_overlay_offset = 0;
- }
-
- // COULD BE HERE: probably ARM7 overlay files, just like for ARM9
- //
-
- if (overlay_files && !overlaydir)
- {
- fprintf(stderr, "Overlay directory required!.\n");
- exit(1);
- }
-
- // filesystem
- //if (filerootdir || overlaydir)
- {
- // read directory structure
- free_file_id = overlay_files;
- free_dir_id++;
- directory_count++;
- TreeNode *filetree;
- if (filerootdir)
- filetree = ReadDirectory(new TreeNode(), filerootdir);
- else
- filetree = new TreeNode(); // dummy root node 0xF000
-
- // calculate offsets required for FNT and FAT
- _entry_start = 8*directory_count; // names come after directory structs
- header.fnt_offset = (ftell(fNDS) + fnt_align) &~ fnt_align;
- header.fnt_size =
- _entry_start + // directory structs
- total_name_size + // total number of name characters for dirs and files
- directory_count*4 + // directory: name length (1), dir id (2), end-character (1)
- file_count*1 + // files: name length (1)
- - 3; // root directory only has an end-character
- file_count += overlay_files; // didn't take overlay files into FNT size, but have to be calculated into FAT size
- header.fat_offset = (header.fnt_offset + header.fnt_size + fat_align) &~ fat_align;
- header.fat_size = file_count * 8; // each entry contains top & bottom offset
-
- // banner after FNT/FAT
- if (bannerfilename)
- {
- header.banner_offset = (header.fat_offset + header.fat_size + banner_align) &~ banner_align;
- file_top = header.banner_offset + 0x840;
- fseek(fNDS, header.banner_offset, SEEK_SET);
- if (bannertype == BANNER_IMAGE)
- {
- IconFromBMP();
- }
- else
- {
- CopyFromBin(bannerfilename, 0);
- }
- }
- else
- {
- file_top = header.fat_offset + header.fat_size;
- header.banner_offset = 0;
- }
-
- file_end = file_top; // no file data as yet
-
- // add (hidden) overlay files
- for (unsigned int i=0; i<overlay_files; i++)
- {
- char s[32]; sprintf(s, OVERLAY_FMT, i/*free_file_id*/);
- AddFile(overlaydir, "/", s, i/*free_file_id*/);
- //free_file_id++; // incremented up to overlay_files
- }
-
- // add all other (visible) files
- AddDirectory(filetree, "/", 0xF000, directory_count);
- fseek(fNDS, file_end, SEEK_SET);
-
- if (verbose)
- {
- printf("%u directories.\n", directory_count);
- printf("%u normal files.\n", file_count - overlay_files);
- printf("%u overlay files.\n", overlay_files);
- }
- }
-
- // --------------------------
-
- // align file size
- unsigned int newfilesize = file_end; //ftell(fNDS);
- newfilesize = (newfilesize + 3) &~ 3; // align to 4 bytes
- header.application_end_offset = newfilesize;
- fseek(fNDS, newfilesize-1, SEEK_SET); int c = fgetc(fNDS);
- fseek(fNDS, newfilesize-1, SEEK_SET); fputc((c >= 0) ? c : 0, fNDS);
-
- // calculate device capacity
- newfilesize |= newfilesize >> 16; newfilesize |= newfilesize >> 8;
- newfilesize |= newfilesize >> 4; newfilesize |= newfilesize >> 2;
- newfilesize |= newfilesize >> 1; newfilesize++;
- if (newfilesize <= 128*1024) newfilesize = 128*1024;
- int devcap = -18;
- unsigned int x = newfilesize;
- while (x != 0) { x >>= 1; devcap++; }
- header.devicecap = (devcap < 0) ? 0 : devcap;
-
- // fix up header CRCs and write header
- header.logo_crc = CalcLogoCRC(header);
- header.header_crc = CalcHeaderCRC(header);
- fseek(fNDS, 0, SEEK_SET);
- fwrite(&header, 0x200, 1, fNDS);
-
- fclose(fNDS);
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndsextract.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndsextract.cpp
deleted file mode 100644
index 204d5bb47c..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndsextract.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
-#include "ndstool.h"
-#include "overlay.h"
-#include <errno.h>
-
-/*
- * MkDir
- */
-void MkDir(char *name)
-{
-#ifdef __MINGW32__
- if (mkdir(name))
-#else
- if (mkdir(name, S_IRWXU))
-#endif
- {
- if (errno != EEXIST)
- {
- fprintf(stderr, "Cannot create directory '%s'.\n", name);
- exit(1);
- }
- }
-}
-
-/*
- * ExtractFile
- * if rootdir==0 nothing will be written
- */
-void ExtractFile(char *rootdir, const char *prefix, char *entry_name, unsigned int file_id)
-{
- unsigned int save_filepos = ftell(fNDS);
-
- // read FAT data
- fseek(fNDS, header.fat_offset + 8*file_id, SEEK_SET);
- unsigned_int top;
- fread(&top, 1, sizeof(top), fNDS);
- unsigned_int bottom;
- fread(&bottom, 1, sizeof(bottom), fNDS);
- unsigned int size = bottom - top;
- if (size > (1U << (17 + header.devicecap))) { fprintf(stderr, "File %u: Size is too big. FAT offset 0x%X contains invalid data.\n", file_id, header.fat_offset + 8*file_id); exit(1); }
-
- // print file info
- if (!rootdir || verbose)
- {
- printf("%5u 0x%08X 0x%08X %9u %s%s\n", file_id, (int)top, (int)bottom, size, prefix, entry_name);
- }
-
- // extract file
- if (rootdir)
- {
- // make filename
- char filename[MAXPATHLEN];
- strcpy(filename, rootdir);
- strcat(filename, prefix);
- strcat(filename, entry_name);
-
- fseek(fNDS, top, SEEK_SET);
- FILE *fo = fopen(filename, "wb");
- if (!fo) { fprintf(stderr, "Cannot create file '%s'.\n", filename); exit(1); }
- while (size > 0)
- {
- unsigned char copybuf[1024];
- unsigned int size2 = (size >= sizeof(copybuf)) ? sizeof(copybuf) : size;
- fread(copybuf, 1, size2, fNDS);
- fwrite(copybuf, 1, size2, fo);
- size -= size2;
- }
- fclose(fo);
- }
-
- fseek(fNDS, save_filepos, SEEK_SET);
-}
-
-/*
- * MatchName
- */
-bool MatchName(char *name, char *mask, int level=0)
-{
- char *a = name;
- char *b = mask;
- //for (int i=0; i<level; i++) printf(" "); printf("matching a='%s' b='%s'\n", a, b);
- while (1)
- {
- //for (int i=0; i<level; i++) printf("a=%s b=%s\n", a, b);
- if (*b == '*')
- {
- while (*b == '*') b++;
- //for (int i=0; i<level; i++) printf(" "); printf("* '%s' '%s'\n", a, b);
- bool match = false;
- char *a2 = a;
- do
- {
- if (MatchName(a2, b, level+1)) { a = a2; match = true; break; }
- } while (*a2++);
- if (!match) return false;
- //for (int i=0; i<level; i++) printf(" "); printf("matched a='%s' b='%s'\n", a, b);
- }
- //for (int i=0; i<level; i++) printf(" "); printf("a=%s b=%s\n", a, b);
- if (!*a && !*b) return true;
- if (*a && !*b) return false;
- if (!*a && *b) return false;
- if (*b != '?' && *a != *b) return false;
- a++; b++;
- }
-}
-
-/*
- * ExtractDirectory
- * filerootdir can be 0 for just listing files
- */
-void ExtractDirectory(const char *prefix, unsigned int dir_id)
-{
- char strbuf[MAXPATHLEN];
- unsigned int save_filepos = ftell(fNDS);
-
- fseek(fNDS, header.fnt_offset + 8*(dir_id & 0xFFF), SEEK_SET);
- unsigned_int entry_start; // reference location of entry name
- fread(&entry_start, 1, sizeof(entry_start), fNDS);
- unsigned_short top_file_id; // file ID of top entry
- fread(&top_file_id, 1, sizeof(top_file_id), fNDS);
- unsigned_short parent_id; // ID of parent directory or directory count (root)
- fread(&parent_id, 1, sizeof(parent_id), fNDS);
-
- fseek(fNDS, header.fnt_offset + entry_start, SEEK_SET);
-
- // print directory name
- //printf("%04X ", dir_id);
- if (!filerootdir || verbose)
- {
- printf("%s\n", prefix);
- }
-
- for (unsigned int file_id=top_file_id; ; file_id++)
- {
- unsigned char entry_type_name_length;
- fread(&entry_type_name_length, 1, sizeof(entry_type_name_length), fNDS);
- unsigned int name_length = entry_type_name_length & 127;
- bool entry_type_directory = (entry_type_name_length & 128) ? true : false;
- if (name_length == 0) break;
-
- char entry_name[128];
- memset(entry_name, 0, 128);
- fread(entry_name, 1, entry_type_name_length & 127, fNDS);
- if (entry_type_directory)
- {
- unsigned_short dir_id;
- fread(&dir_id, 1, sizeof(dir_id), fNDS);
-
- if (filerootdir)
- {
- strcpy(strbuf, filerootdir);
- strcat(strbuf, prefix);
- strcat(strbuf, entry_name);
- MkDir(strbuf);
- }
-
- strcpy(strbuf, prefix);
- strcat(strbuf, entry_name);
- strcat(strbuf, "/");
- ExtractDirectory(strbuf, dir_id);
- }
- else
- {
- if (1)
- {
- bool match = (filemask_num == 0);
- for (int i=0; i<filemask_num; i++)
- {
- //printf("%s %s\n", entry_name, filemasks[i]);
- if (MatchName(entry_name, filemasks[i])) { match = true; break; }
- }
-
- //if (!directorycreated)
- //{
- //}
-
- //printf("%d\n", match);
-
- if (match) ExtractFile(filerootdir, prefix, entry_name, file_id);
- }
- }
- }
-
- fseek(fNDS, save_filepos, SEEK_SET);
-}
-
-/*
- * ExtractFiles
- */
-void ExtractFiles(char *ndsfilename)
-{
-//printf("%d\n", MatchName("hello", "h*el*lo")); exit(0); // TEST
- fNDS = fopen(ndsfilename, "rb");
- if (!fNDS) { fprintf(stderr, "Cannot open file '%s'.\n", ndsfilename); exit(1); }
- fread(&header, 512, 1, fNDS);
-
- if (filerootdir)
- {
- MkDir(filerootdir);
- }
-
- ExtractDirectory("/", 0xF000); // list or extract
-
- fclose(fNDS);
-}
-
-/*
- * ExtractOverlayFiles2
- */
- void ExtractOverlayFiles2(unsigned int overlay_offset, unsigned int overlay_size)
- {
- OverlayEntry overlayEntry;
-
- if (overlay_size)
- {
- fseek(fNDS, overlay_offset, SEEK_SET);
- for (unsigned int i=0; i<overlay_size; i+=sizeof(OverlayEntry))
- {
- fread(&overlayEntry, 1, sizeof(overlayEntry), fNDS);
- char s[32]; sprintf(s, OVERLAY_FMT, overlayEntry.file_id);
- ExtractFile(overlaydir, "/", s, overlayEntry.file_id);
- }
- }
-}
-
-/*
- * ExtractOverlayFiles
- */
-void ExtractOverlayFiles()
-{
- fNDS = fopen(ndsfilename, "rb");
- if (!fNDS) { fprintf(stderr, "Cannot open file '%s'.\n", ndsfilename); exit(1); }
- fread(&header, 512, 1, fNDS);
-
- if (overlaydir)
- {
- MkDir(overlaydir);
- }
-
- ExtractOverlayFiles2(header.arm9_overlay_offset, header.arm9_overlay_size);
- ExtractOverlayFiles2(header.arm7_overlay_offset, header.arm7_overlay_size);
-
- fclose(fNDS);
-}
-
-/*
- * Extract
- */
-void Extract(char *outfilename, bool indirect_offset, unsigned int offset, bool indirect_size, unsigned size, bool with_footer)
-{
- fNDS = fopen(ndsfilename, "rb");
- if (!fNDS) { fprintf(stderr, "Cannot open file '%s'.\n", ndsfilename); exit(1); }
- fread(&header, 512, 1, fNDS);
-
- if (indirect_offset) offset = *((unsigned int *)&header + offset/4);
- if (indirect_size) size = *((unsigned int *)&header + size/4);
-
- fseek(fNDS, offset, SEEK_SET);
-
- FILE *fo = fopen(outfilename, "wb");
- if (!fo) { fprintf(stderr, "Cannot create file '%s'.\n", outfilename); exit(1); }
-
- unsigned char copybuf[1024];
- while (size > 0)
- {
- unsigned int size2 = (size >= sizeof(copybuf)) ? sizeof(copybuf) : size;
- fread(copybuf, 1, size2, fNDS);
- fwrite(copybuf, 1, size2, fo);
- size -= size2;
- }
-
- if (with_footer)
- {
- unsigned_int nitrocode;
- fread(&nitrocode, sizeof(nitrocode), 1, fNDS);
- if (nitrocode == 0xDEC00621)
- {
- // 0x2106C0DE, version info, reserved?
- for (int i=0; i<3; i++) // write additional 3 words
- {
- fwrite(&nitrocode, sizeof(nitrocode), 1, fo);
- fread(&nitrocode, sizeof(nitrocode), 1, fNDS); // next field
- }
- }
- }
-
- fclose(fo);
- fclose(fNDS);
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndstool.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndstool.cpp
deleted file mode 100644
index c5b1a5dbb1..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndstool.cpp
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- Nintendo DS rom tool
- by Rafael Vuijk (aka DarkFader)
-*/
-
-#include <unistd.h>
-#include "ndstool.h"
-#include "sha1.h"
-#include "ndscreate.h"
-#include "ndsextract.h"
-#include "passme.h"
-#include "hook.h"
-#include "encryption.h"
-
-/*
- * Variables
- */
-int verbose = 0;
-Header header;
-FILE *fNDS = 0;
-char *romlistfilename = 0;
-char *filemasks[MAX_FILEMASKS];
-int filemask_num = 0;
-char *ndsfilename = 0;
-char *arm7filename = 0;
-char *arm9filename = 0;
-char *filerootdir = 0;
-char *overlaydir = 0;
-char *arm7ovltablefilename = 0;
-char *arm9ovltablefilename = 0;
-char *bannerfilename = 0;
-char *bannertext = 0;
-//bool compatibility = false;
-char *headerfilename_or_size = 0;
-//char *uniquefilename = 0;
-char *logofilename = 0;
-char *title = 0;
-char *makercode = 0;
-char *gamecode = 0;
-char *vhdfilename = 0;
-char *sramfilename = 0;
-int latency1 = 0x1FFF; //0x8F8;
-int latency2 = 0x3F; //0x18;
-int romversion = 0;
-char endecrypt_option = 0;
-
-int bannertype;
-unsigned int arm9RamAddress = 0;
-unsigned int arm7RamAddress = 0;
-unsigned int arm9Entry = 0;
-unsigned int arm7Entry = 0;
-
-
-/*
- * Title
- */
-void Title()
-{
- printf("Nintendo DS rom tool "VERSION" - %s\nby Rafael Vuijk, Dave Murphy, Alexei Karpenko\n",CompileDate);
-}
-
-/*
- * Help data
- */
-struct HelpLine
-{
- const char *option_char;
- const char *text;
-
- void Print()
- {
- char s[1024];
- strcpy(s, text);
- printf("%-22s ", strtok(s, "\n"));
- char *p = strtok(0, "\n"); if (p) printf("%-30s ", p);
- for (int i=0; ; i++)
- {
- char *p = strtok(0, "\n");
- if (!p) { printf("\n"); break; }
- if (i) printf("\n%54s", "");
- printf("%s", p);
- }
- }
-};
-
-HelpLine helplines[] =
-{
- {"", "Parameter\nSyntax\nComments"},
- {"", "---------\n------\n--------"},
- {"?", "Show this help:\n-?[option]\nAll or single help for an option."},
- {"i", "Show information:\n-i [file.nds]\nHeader information."},
- {"v", " Show more info\n-v [roms_rc.dat]\nChecksums, warnings, release info"},
- {"p", "PassMe:\n-p [file.nds] [passme.vhd] [passme.sav]\nGenerates PassMe2 files."},
- {"k", "Hook ARM7 executable\n-k [file.nds]\nCurrently not tested."},
- {"f", "Fix header CRC\n-f [file.nds]\nYou only need this after manual editing."},
- //{"T", "Test\n-T [file.nds]"},
- {"s", "En/decrypt secure area\n-s[e|E|d] [file.nds]\nEn/decrypt the secure area and\nput/remove card encryption tables and test patterns.\nOptionally add: d for decryption, e/E for encryption.\n(e: Nintendo offsets, E: others)"},
- //{"@", "Hash file & compare:\n-@ [arm7.bin]"}, // used in buildscript
- {"1", "List files:\n-l [file.nds]\nGive a list of contained files."},
- {"v", " Show offsets/sizes\n-v"},
- {"cx", "Create/Extract\n-c/-x [file.nds]"},
- {"v", " Show more info\n-v[v...]\nShow filenames and more header info.\nUse multiple v's for more information."},
- {"9", " ARM9 executable\n-9 file.bin"},
- {"7", " ARM7 executable\n-7 file.bin"},
- {"y9", " ARM9 overlay table\n-y9 file.bin"},
- {"y7", " ARM7 overlay table\n-y7 file.bin"},
- {"d", " Data files\n-d directory"},
- {"y", " Overlay files\n-y directory"},
- {"b", " Banner bitmap/text\n-b file.bmp \"text;text;text\"\nThe three lines are shown at different sizes."},
- {"t", " Banner binary\n-t file.bin"},
- {"h", " Header template\n-h file.bin\nUse the header from another ROM as a template."},
- {"h", " Header size\n-h size\nA header size of 0x4000 is default for real cards, 0x200 for homebrew."},
- {"n", " Latency\n-n [L1] [L2]\ndefault=maximum"},
- {"o", " Logo bitmap/binary\n-o file.bmp/file.bin"},
- {"g", " Game info\n-g gamecode [makercode] [title] [rom ver]\nSets game-specific information.\nGame code is 4 characters. Maker code is 2 characters.\nTitle can be up to 12 characters."},
- {"r", " ARM9 RAM address\n-r9 address"},
- {"r", " ARM7 RAM address\n-r7 address"},
- {"e", " ARM9 RAM entry\n-e9 address"},
- {"e", " ARM7 RAM entry\n-e7 address"},
- {"w", " Wildcard filemask(s)\n-w [filemask]...\n* and ? are wildcard characters."},
-};
-
-/*
- * Help
- */
-void Help(char *specificoption = 0)
-{
- Title();
- printf("\n");
-
- if (specificoption)
- {
- bool found = false;
- for (unsigned int i=0; i<(sizeof(helplines) / sizeof(helplines[0])); i++)
- {
- for (const char *o = helplines[i].option_char; *o; o++)
- {
- if (*o == *specificoption) { helplines[i].Print(); found = true; }
- }
- }
- if (!found)
- {
- printf("Unknown option: %s\n\n", specificoption);
- }
- }
- else
- {
- for (unsigned int i=0; i<(sizeof(helplines) / sizeof(helplines[0])); i++)
- {
- helplines[i].Print();
- }
- printf("\n");
- printf("You only need to specify the NDS filename once if you want to perform multiple actions.\n");
- printf("Actions are performed in the specified order.\n");
- printf("Addresses can be prefixed with '0x' to use hexadecimal format.\n");
- }
-}
-
-
-#define REQUIRED(var) var = ((argc > a+1) ? argv[++a] : 0) // must precede OPTIONAL
-#define OPTIONAL(var) { /*fprintf(stderr, "'%s'\n", argv[a]);*/ char *t = ((argc > a+1) && (argv[a+1][0] != '-') ? argv[++a] : 0); if (!var) var = t; else if (t) fprintf(stderr, "%s is already specified!\n", #var); } // final paramter requirement checks are done when performing actions
-#define OPTIONAL_INT(var) { char *t = ((argc > a+1) && (argv[a+1][0] != '-') ? argv[++a] : 0); if (t) var = strtoul(t,0,0); } // like OPTIONAL, but for (positive) integers
-#define MAX_ACTIONS 32
-#define ADDACTION(a) { if (num_actions < MAX_ACTIONS) actions[num_actions++] = a; }
-
-enum {
- ACTION_SHOWINFO,
- ACTION_FIXHEADERCRC,
- ACTION_ENCRYPTSECUREAREA,
- ACTION_PASSME,
- ACTION_LISTFILES,
- ACTION_EXTRACT,
- ACTION_CREATE,
- ACTION_HASHFILE,
- ACTION_HOOK,
-};
-
-/*
- * main
- */
-int main(int argc, char *argv[])
-{
- #ifdef _NDSTOOL_P_H
- if (sizeof(Header) != 0x200) { fprintf(stderr, "Header size %d != %d\n", sizeof(Header), 0x200); return 1; }
- #endif
-
- if (argc < 2) { Help(); return 0; }
-
- int num_actions = 0;
- int actions[MAX_ACTIONS];
-
- /*
- * parse parameters to actions
- */
-
- for (int a=1; a<argc; a++)
- {
- if (argv[a][0] == '-')
- {
- switch (argv[a][1])
- {
- case 'i': // show information
- {
- ADDACTION(ACTION_SHOWINFO);
- OPTIONAL(ndsfilename);
- break;
- }
-
- case 'f': // fix header CRC
- {
- ADDACTION(ACTION_FIXHEADERCRC);
- OPTIONAL(ndsfilename);
- break;
- }
-
- case 's': // en-/decrypt secure area
- {
- ADDACTION(ACTION_ENCRYPTSECUREAREA);
- endecrypt_option = argv[a][2];
- OPTIONAL(ndsfilename);
- break;
- }
-
- case 'p': // PassMe
- {
- ADDACTION(ACTION_PASSME);
- OPTIONAL(ndsfilename);
- OPTIONAL(vhdfilename);
- OPTIONAL(sramfilename);
- break;
- }
-
- case 'l': // list files
- {
- ADDACTION(ACTION_LISTFILES);
- OPTIONAL(ndsfilename);
- break;
- }
-
- case 'x': // extract
- {
- ADDACTION(ACTION_EXTRACT);
- OPTIONAL(ndsfilename);
- break;
- }
-
- case 'w': // wildcard filemasks
- {
- while (1)
- {
- char *filemask = 0;
- OPTIONAL(filemask);
- if (!(filemasks[filemask_num] = filemask)) break;
- if (++filemask_num >= MAX_FILEMASKS) return 1;
- }
- break;
- }
-
- case 'c': // create
- {
- ADDACTION(ACTION_CREATE);
- OPTIONAL(ndsfilename);
- break;
- }
-
- // file root directory
- case 'd': REQUIRED(filerootdir); break;
-
- // ARM7 filename
- case '7': REQUIRED(arm7filename); break;
-
- // ARM9 filename
- case '9': REQUIRED(arm9filename); break;
-
- // hash file
- case '@':
- {
- ADDACTION(ACTION_HASHFILE);
- OPTIONAL(arm7filename);
- break;
- }
-
- // hook ARM7 executable
- case 'k':
- {
- ADDACTION(ACTION_HOOK);
- OPTIONAL(ndsfilename);
- break;
- }
-
- case 't':
- REQUIRED(bannerfilename);
- bannertype = BANNER_BINARY;
- break;
-
- case 'b':
- bannertype = BANNER_IMAGE;
- REQUIRED(bannerfilename);
- REQUIRED(bannertext);
- break;
-
- case 'o':
- REQUIRED(logofilename);
- break;
-
- case 'h': // load header or header size
- REQUIRED(headerfilename_or_size);
- break;
-
- /*case 'u': // unique ID file
- REQUIRED(uniquefilename);
- break;*/
-
- case 'v': // verbose
- for (char *p=argv[a]; *p; p++) if (*p == 'v') verbose++;
- OPTIONAL(romlistfilename);
- break;
-
- case 'n': // latency
- //compatibility = true;
- OPTIONAL_INT(latency1);
- OPTIONAL_INT(latency2);
- break;
-
- case 'r': // RAM address
- switch (argv[a][2])
- {
- case '7': arm7RamAddress = (argc > a) ? strtoul(argv[++a], 0, 0) : 0; break;
- case '9': arm9RamAddress = (argc > a) ? strtoul(argv[++a], 0, 0) : 0; break;
- default: Help(argv[a]); return 1;
- }
- break;
-
- case 'e': // entry point
- switch (argv[a][2])
- {
- case '7': arm7Entry = (argc > a) ? strtoul(argv[++a], 0, 0) : 0; break;
- case '9': arm9Entry = (argc > a) ? strtoul(argv[++a], 0, 0) : 0; break;
- default: Help(argv[a]); return 1;
- }
- break;
-
- case 'm': // maker code
- REQUIRED(makercode);
- break;
-
- case 'g': // game code
- REQUIRED(gamecode);
- OPTIONAL(makercode);
- OPTIONAL(title);
- OPTIONAL_INT(romversion);
- break;
-
- case 'y': // overlay table file / directory
- switch (argv[a][2])
- {
- case '7': REQUIRED(arm7ovltablefilename); break;
- case '9': REQUIRED(arm9ovltablefilename); break;
- case 0: REQUIRED(overlaydir); break;
- default: Help(argv[a]); return 1;
- }
- break;
-
- case '?': // global or specific help
- {
- Help(argv[a][2] ? argv[a]+2 : 0); // 0=global help
- return 0; // do not perform any other actions
- }
-
- default:
- {
- Help(argv[a]);
- return 1;
- }
- }
- }
- else
- {
- //Help();
- if (ndsfilename)
- {
- fprintf(stderr, "NDS filename is already given!\n");
- return 1;
- }
- ndsfilename = argv[a];
- break;
- }
- }
-
- Title();
-
- /*
- * sanity checks
- */
-
- if (gamecode)
- {
- if (strlen(gamecode) != 4)
- {
- fprintf(stderr, "Game code must be 4 characters!\n");
- return 1;
- }
- for (int i=0; i<4; i++) if ((gamecode[i] >= 'a') && (gamecode[i] <= 'z'))
- {
- fprintf(stderr, "Warning: Gamecode contains lowercase characters.\n");
- break;
- }
- if (gamecode[0] == 'A')
- {
- fprintf(stderr, "Warning: Gamecode starts with 'A', which might be used for another commercial product.\n");
- }
- }
- if (makercode && (strlen(makercode) != 2))
- {
- fprintf(stderr, "Maker code must be 2 characters!\n");
- return 1;
- }
- if (title && (strlen(title) > 12))
- {
- fprintf(stderr, "Title can be no more than 12 characters!\n");
- return 1;
- }
-
- /*
- * perform actions
- */
-
- int status = 0;
- for (int i=0; i<num_actions; i++)
- {
-//printf("action %d\n", actions[i]);
- switch (actions[i])
- {
- case ACTION_SHOWINFO:
- ShowInfo(ndsfilename);
- break;
-
- case ACTION_FIXHEADERCRC:
- FixHeaderCRC(ndsfilename);
- break;
-
- case ACTION_EXTRACT:
- if (arm9filename) Extract(arm9filename, true, 0x20, true, 0x2C, true);
- if (arm7filename) Extract(arm7filename, true, 0x30, true, 0x3C);
- if (bannerfilename) Extract(bannerfilename, true, 0x68, false, 0x840);
- if (headerfilename_or_size) Extract(headerfilename_or_size, false, 0x0, false, 0x200);
- if (logofilename) Extract(logofilename, false, 0xC0, false, 156); // *** bin only
- if (arm9ovltablefilename) Extract(arm9ovltablefilename, true, 0x50, true, 0x54);
- if (arm7ovltablefilename) Extract(arm7ovltablefilename, true, 0x58, true, 0x5C);
- if (overlaydir) ExtractOverlayFiles();
- if (filerootdir) ExtractFiles(ndsfilename);
- break;
-
- case ACTION_CREATE:
- Create();
- break;
-
- case ACTION_PASSME:
- status = PassMe(ndsfilename, vhdfilename, sramfilename);
- break;
-
- case ACTION_LISTFILES:
- filerootdir = 0;
- /*status =*/ ExtractFiles(ndsfilename);
- break;
-
- case ACTION_HASHFILE:
- {
- char *filename = arm7filename;
- if (!filename) filename = ndsfilename;
- if (!filename) return 1;
- unsigned char sha1[SHA1_DIGEST_SIZE];
- int r = HashAndCompareWithList(filename, sha1);
- status = -1;
- if (r > 0)
- {
- for (int i=0; i<SHA1_DIGEST_SIZE; i++) printf("%02X", sha1[i]);
- printf("\n");
- status = 0;
- }
- break;
- }
-
- case ACTION_HOOK:
- {
- Hook(ndsfilename, arm7filename);
- break;
- }
-
- case ACTION_ENCRYPTSECUREAREA:
- {
- /*status =*/ EnDecryptSecureArea(ndsfilename, endecrypt_option);
- break;
- }
- }
- }
-
- return (status < 0) ? 1 : 0;
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndstree.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndstree.cpp
deleted file mode 100644
index 99929e2ca4..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/ndstree.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "ndstool.h"
-#include "ndstree.h"
-
-/*
- * Variables
- */
-unsigned int _entry_start; // current position in name entry table
-unsigned int file_top; // current position to write new file to
-unsigned int free_dir_id = 0xF000; // incremented in ReadDirectory
-unsigned int directory_count = 0; // incremented in ReadDirectory
-unsigned int file_count = 0; // incremented in ReadDirectory
-unsigned int total_name_size = 0; // incremented in ReadDirectory
-unsigned int file_end = 0; // end of all file data. updated in AddFile
-unsigned int free_file_id = 0; // incremented in AddDirectory
-
-/*
- * ReadDirectory
- * Read directory tree into memory structure
- * returns first (dummy) node
- */
-TreeNode *ReadDirectory(TreeNode *node, char *path)
-{
- //printf("%s\n", path);
-
- DIR *dir = opendir(path);
- if (!dir) { fprintf(stderr, "Cannot open directory '%s'.\n", path); exit(1); }
-
- struct dirent *de;
- while ((de = readdir(dir)))
- {
- if (!strcmp(de->d_name, ".")) continue;
- if (!strcmp(de->d_name, "..")) continue;
-
- char strbuf[MAXPATHLEN];
- strcpy(strbuf, path);
- strcat(strbuf, "/");
- strcat(strbuf, de->d_name);
- //printf("%s\n", strbuf);
-
- struct stat st;
- if (stat(strbuf, &st)) { fprintf(stderr, "Cannot get stat of '%s'.\n", strbuf); exit(1); }
-
- //if (S_ISDIR(st.st_mode) && !subdirs) continue; // skip subdirectories
-
- total_name_size += strlen(de->d_name);
-
- if (S_ISDIR(st.st_mode))
- {
- node = node->New(de->d_name, true);
- node->dir_id = free_dir_id++;
- directory_count++;
- node->directory = ReadDirectory(new TreeNode(), strbuf);
- }
- else if (S_ISREG(st.st_mode))
- {
- node = node->New(de->d_name, false);
- file_count++;
- }
- else
- {
- fprintf(stderr, "'%s' is not a file or directory!\n", strbuf);
- exit(1);
- }
- }
- closedir(dir);
-
- while (node->prev) node = node->prev; // return first
- return node;
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/passme.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/passme.cpp
deleted file mode 100644
index 831547f6ef..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/passme.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Includes
- */
-#include "ndstool.h"
-#include "crc.h"
-#include "passme_sram.h"
-
-/*
- *
- */
-#define DS_RAM 0x02000000
-#define RAM_SIZE (4*1024*1024)
-unsigned char *pc_ram;
-
-/*
- * Find
- */
-template <typename T> unsigned long Find(FILE *f, const char *fmt, unsigned long begin, unsigned long end, T data, T mask, int thumb, int armnr)
-{
- for (unsigned long i=begin; i<end; i+=sizeof(T))
- {
- T w = *(T *)(pc_ram + i - DS_RAM);
- w &= mask;
- if (w == data)
- {
- if (armnr == 7)
- header.arm7_entry_address = i + thumb; // ARM7 entry
- else
- header.arm9_entry_address = i + thumb; // ARM9 entry
- if (f) fprintf(f, fmt, i + thumb);
- printf(fmt, i + thumb);
- return i;
- }
- }
- return 0;
-}
-
-/*
- * PassMe
- */
-int PassMe(char *ndsfilename, char *vhdfilename, char *sramfilename)
-{
- fNDS = fopen(ndsfilename, "rb");
- if (!fNDS) { fprintf(stderr, "Cannot open file '%s'.\n", ndsfilename); exit(1); }
-
- FILE *fVHD = fopen(vhdfilename, "wt");
- if (vhdfilename && !fVHD) { fprintf(stderr, "Cannot open file '%s'.\n", vhdfilename); exit(1); }
-
- fread(&header, 512, 1, fNDS);
-
- if (fVHD)
- {
- fprintf(fVHD, "-- PassMe generated CPLD code\n");
- fprintf(fVHD, "-- Game code: \t"); for (unsigned int i=0; i<sizeof(header.gamecode); i++) fprintf(fVHD, "%c", header.gamecode[i]); fprintf(fVHD, "\n");
- fprintf(fVHD, "-- ROM version: \t"); fprintf(fVHD, "%d\n", header.romversion);
- fprintf(fVHD, "-- Game title: \t"); for (unsigned int i=0; i<sizeof(header.title); i++) if (header.title[i]) fprintf(fVHD, "%c", header.title[i]);
- fprintf(fVHD, "\n\n");
- }
-
- pc_ram = new unsigned char[RAM_SIZE];
-
- // load ARM7 binary
- fseek(fNDS, header.arm7_rom_offset, SEEK_SET);
- fread(pc_ram + header.arm7_ram_address - DS_RAM, 1, header.arm7_size, fNDS);
-
- // load ARM9 binary
- fseek(fNDS, header.arm9_rom_offset, SEEK_SET);
- fread(pc_ram + header.arm9_ram_address - DS_RAM, 1, header.arm9_size, fNDS);
-
-
- header.arm7_entry_address = 0x55555555;
- header.arm9_entry_address = 0x55555555;
-
-
- unsigned char old_header[512];
- memcpy(old_header, &header, 512);
-
- bool bError = false;
-
- unsigned int begin9 = 0x02000000, end9 = 0x02280000;
- //unsigned int begin9 = header.arm9_ram_address, end9 = header.arm9_ram_address + header.arm9_size;
- if (!Find<unsigned long>(fVHD, "-- BX LR @ 0x%08X\n", begin9, end9, 0xE120001E, 0xFFF000FF, 0, 9)) // BX LR
-// if (!Find<unsigned short>(fVHD, "-- BX LR @ 0x%08X\n", begin9, end9, 0x4770, 0xFFFF, 1, 9)) // BX LR
- { printf("BX LR instruction not found!\n"); bError = true; }
-
- unsigned int begin7 = 0x02000000, end7 = 0x023FE000;
- //unsigned int begin7 = header.arm7_ram_address, end7 = header.arm7_ram_address + header.arm7_size;
-// if (!Find<unsigned long>(fVHD, "-- SWI 0xAF @ 0x%08X\n", begin7, end7, 0xEFAF0000, 0xFFFF0000, 0, 7)) // SWI
-// if (!Find<unsigned long>(fVHD, "-- SWI 0xFF @ 0x%08X\n", begin7, end7, 0xEFFF0000, 0xFFFF0000, 0, 7)) // SWI
-// if (!Find<unsigned long>(fVHD, "-- SWI 0xA4 @ 0x%08X\n", begin7, end7, 0xEFA40000, 0xFFFF0000, 0, 7)) // SWI
-// if (!Find<unsigned long>(fVHD, "-- SWI 0xEA @ 0x%08X\n", begin7, end7, 0xEFEA0000, 0xFFFF0000, 0, 7)) // SWI
- if (!Find<unsigned short>(fVHD, "-- SWI 0xAF @ 0x%08X\n", begin7, end7, 0xDFAF, 0xFFFF, 1, 7)) // SWI
- if (!Find<unsigned short>(fVHD, "-- SWI 0xFF @ 0x%08X\n", begin7, end7, 0xDFFF, 0xFFFF, 1, 7)) // SWI
- if (!Find<unsigned short>(fVHD, "-- SWI 0xA4 @ 0x%08X\n", begin7, end7, 0xDFA4, 0xFFFF, 1, 7)) // SWI
- if (!Find<unsigned short>(fVHD, "-- SWI 0xEA @ 0x%08X\n", begin7, end7, 0xDFEA, 0xFFFF, 1, 7)) // SWI
- { printf("SWI instruction not found!\n"); bError = true; }
-
- //Find<unsigned long>("%08X\n", 0x037F8000, 0x0380F000, 0xEFEA0000, 0xFFFF0000, 0); // SWI
- //...
-
- //Find<unsigned short>("%08X\n", 0x037F8000, 0x0380F000, 0xDFA4, 0xFFFF, 1); // SWI
- //...
-
- if (bError)
- {
- printf("Cannot patch.\n");
- return -1;
- }
- else
- {
- /*
- * VHD
- */
-
- header.reserved2 |= 0x04; // set autostart bit
-
- bool forcepatch[512];
- memset(forcepatch, 0, sizeof(forcepatch));
-
- // ldr pc, 0x027FFE24
- ((unsigned char *)&header)[0x4] = 0x18;
- ((unsigned char *)&header)[0x5] = 0xF0;
- ((unsigned char *)&header)[0x6] = 0x9F;
- ((unsigned char *)&header)[0x7] = 0xE5;
-
- header.header_crc = CalcCrc16((unsigned char *)&header, 0x15E);
-
- if (fVHD) fputs(
- #include "passme_vhd1.h"
- , fVHD
- );
-
- for (int i=0; i<512; i++)
- {
- if (((unsigned char *)&header)[i] != old_header[i])
- {
- printf("Patch:\t0x%03X\t0x%02X\n", i, ((unsigned char *)&header)[i]);
- if (fVHD) fprintf(fVHD, "\t\t\twhen 16#%03X# => patched_data <= X\"%02X\";\n", i, ((unsigned char *)&header)[i]);
- }
- }
-
- if (fVHD) fputs(
- #include "passme_vhd2.h"
- , fVHD
- );
-
- if (fVHD) fclose(fVHD);
-
- /*
- * SRAM
- */
-
- printf("ARM9 patched entry address: \t0x%08X\n", (unsigned int)header.arm9_entry_address);
-
- FILE *fSRAM = fopen(sramfilename, "wb");
- if (sramfilename && !fSRAM) { fprintf(stderr, "Cannot open file '%s'.\n", sramfilename); exit(1); }
- if (fSRAM)
- {
- for (int i=0; i<passme_sram_size; i++)
- {
- unsigned char c = passme_sram[i];
- // patch with address of ARM9 loop so it can be redirected by the code in SRAM.
- if ((i &~ 1) == 0x764) c = header.arm9_entry_address >> 0 & 0xFF;
- if ((i &~ 1) == 0x796) c = header.arm9_entry_address >> 8 & 0xFF;
- if ((i &~ 1) == 0x7C8) c = header.arm9_entry_address >> 16 & 0xFF;
- if ((i &~ 1) == 0x7FA) c = header.arm9_entry_address >> 24 & 0xFF;
- fputc(c, fSRAM);
- }
- fclose(fSRAM);
- }
- }
-
- fclose(fNDS);
-
- return 0;
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/passme_sram.c b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/passme_sram.c
deleted file mode 100644
index c2655f80a4..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/passme_sram.c
+++ /dev/null
@@ -1,2057 +0,0 @@
-/*
- This file was autogenerated by raw2c.
-Visit http://www.devkitpro.org
-*/
-
-const unsigned char passme_sram[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa5, 0x4c, 0x4c,
- 0x20, 0x20, 0xc3, 0xc3, 0xc3, 0xc3, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0xe0, 0xe0,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xe3, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x49, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x51, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x47,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe5, 0xe5, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x1b, 0x1b, 0x1b,
- 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32,
- 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b,
- 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e,
- 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57,
- 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77,
- 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32,
- 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b,
- 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e,
- 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57,
- 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77,
- 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32,
- 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b,
- 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e,
- 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57,
- 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77,
- 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32,
- 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b,
- 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e,
- 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57,
- 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77, 0x1b, 0x1b, 0x57, 0x57, 0x32, 0x32, 0x1e, 0x1e, 0x77, 0x77,
- 0x1b, 0x1b, 0x3b, 0x3b, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
- 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1c, 0x1c, 0xa1, 0xa1,
- 0x8d, 0x8d, 0xb4, 0xb4, 0xb4, 0xb4, 0xbd, 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-
-};
-const int passme_sram_size = sizeof(passme_sram);
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/raster.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/raster.cpp
deleted file mode 100644
index 36019e8339..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/raster.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "ndstool.h"
-#include "raster.h"
-
-
-int CRaster::LoadBMP(char *filename)
-{
- // open file
- FILE *f = fopen(filename, "rb");
- if (!f) { fprintf(stderr, "Could not open '%s'.\n", filename); return -1; }
-
- // load bitmap fileheader & infoheader
- BITMAPFILEHEADER bmfh;
- fread((char*)&bmfh, 1, sizeof(bmfh), f);
- BITMAPINFO bmi;
- fread((char*)&bmi, 1, sizeof(bmi), f);
- BITMAPINFOHEADER &bmih = bmi.bmiHeader;
- memcpy(palette, bmi.bmiColors, sizeof(palette));
-
- // check filetype signature
- if ((bmfh.bfType[0] != 'B') || (bmfh.bfType[1] != 'M')) { fprintf(stderr, "Not a bitmap file.\n"); return -2; }
- if (bmih.biBitCount > 8) { fprintf(stderr, "Bitmap must have a palette.\n"); return -3; }
-
- // assign some short variables:
- width = bmih.biWidth;
- height = (bmih.biHeight > 0) ? (int)bmih.biHeight : -(int)bmih.biHeight; // absoulte value
- int pitch = width * bmih.biBitCount / 8;
- pitch += (4 - pitch%4) % 4;
-
- // load raster
- unsigned int pixelsPerByte = 8 / bmih.biBitCount;
- unsigned int biBitCount_mask = (1<<bmih.biBitCount)-1;
- raster = new unsigned char [width * height];
- for (unsigned int y=0; y<height; y++)
- {
- if (bmih.biHeight > 0) // if height is positive the bmp is bottom-up, read it reversed
- fseek(f, bmfh.bfOffBits + pitch*(height-1-y), SEEK_SET);
- else
- fseek(f, bmfh.bfOffBits + pitch*y, SEEK_SET);
- for (unsigned int x=0; x<width; x+=pixelsPerByte)
- {
- unsigned char data = fgetc(f);
- unsigned int shift = 8;
- for (unsigned int p=0; p<pixelsPerByte; p++)
- {
- shift -= bmih.biBitCount;
- (*this)[y][x+p] = data >> shift & biBitCount_mask;
- }
- }
- }
-
- fclose(f);
-
- return 0;
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/sha1.cpp b/c/src/lib/libbsp/arm/nds/tools/ndstool/source/sha1.cpp
deleted file mode 100644
index 9e0dd52703..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/ndstool/source/sha1.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-#include <string.h>
-#include "sha1.h"
-
-#define SHA_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
-#define SHA_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
-
-#include <sys/param.h>
-
-#ifndef BYTE_ORDER
- #error "BYTE_ORDER not defined"
-#endif
-
-#if BYTE_ORDER != BIG_ENDIAN
- #define PLATFORM_BYTE_ORDER SHA_LITTLE_ENDIAN
-#else
- #define PLATFORM_BYTE_ORDER SHA_BIG_ENDIAN
-#endif
-
-
-
-#if !defined(PLATFORM_BYTE_ORDER)
-# error Please set undetermined byte order (lines 87 or 89 of sha1.c).
-#endif
-
-#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n)))
-
-#if (PLATFORM_BYTE_ORDER == SHA_BIG_ENDIAN)
-#define swap_b32(x) (x)
-#elif defined(bswap_32)
-#define swap_b32(x) bswap_32(x)
-#else
-#define swap_b32(x) ((rotl32((x), 8) & 0x00ff00ff) | (rotl32((x), 24) & 0xff00ff00))
-#endif
-
-#define SHA1_MASK (SHA1_BLOCK_SIZE - 1)
-
-/* reverse byte order in 32-bit words */
-
-#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z)))
-#define parity(x,y,z) ((x) ^ (y) ^ (z))
-#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
-
-/* A normal version as set out in the FIPS. This version uses */
-/* partial loop unrolling and is optimised for the Pentium 4 */
-
-#define rnd(f,k) \
- t = a; a = rotl32(a,5) + f(b,c,d) + e + k + w[i]; \
- e = d; d = c; c = rotl32(b, 30); b = t
-
-void sha1_compile(sha1_ctx ctx[1])
-{ sha1_32t w[80], i, a, b, c, d, e, t;
-
- /* note that words are compiled from the buffer into 32-bit */
- /* words in big-endian order so an order reversal is needed */
- /* here on little endian machines */
- for(i = 0; i < SHA1_BLOCK_SIZE / 4; ++i)
- w[i] = swap_b32(ctx->wbuf[i]);
-
- for(i = SHA1_BLOCK_SIZE / 4; i < 80; ++i)
- w[i] = rotl32(w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16], 1);
-
- a = ctx->hash[0];
- b = ctx->hash[1];
- c = ctx->hash[2];
- d = ctx->hash[3];
- e = ctx->hash[4];
-
- for(i = 0; i < 20; ++i)
- {
- rnd(ch, 0x5a827999);
- }
-
- for(i = 20; i < 40; ++i)
- {
- rnd(parity, 0x6ed9eba1);
- }
-
- for(i = 40; i < 60; ++i)
- {
- rnd(maj, 0x8f1bbcdc);
- }
-
- for(i = 60; i < 80; ++i)
- {
- rnd(parity, 0xca62c1d6);
- }
-
- ctx->hash[0] += a;
- ctx->hash[1] += b;
- ctx->hash[2] += c;
- ctx->hash[3] += d;
- ctx->hash[4] += e;
-}
-
-void sha1_begin(sha1_ctx ctx[1])
-{
- ctx->count[0] = ctx->count[1] = 0;
- ctx->hash[0] = 0x67452301;
- ctx->hash[1] = 0xefcdab89;
- ctx->hash[2] = 0x98badcfe;
- ctx->hash[3] = 0x10325476;
- ctx->hash[4] = 0xc3d2e1f0;
-}
-
-/* SHA1 hash data in an array of bytes into hash buffer and call the */
-/* hash_compile function as required. */
-
-void sha1_hash(const unsigned char data[], unsigned int len, sha1_ctx ctx[1])
-{ sha1_32t pos = (sha1_32t)(ctx->count[0] & SHA1_MASK),
- space = SHA1_BLOCK_SIZE - pos;
- const unsigned char *sp = data;
-
- if((ctx->count[0] += len) < len)
- ++(ctx->count[1]);
-
- while(len >= space) /* tranfer whole blocks while possible */
- {
- memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space);
- sp += space; len -= space; space = SHA1_BLOCK_SIZE; pos = 0;
- sha1_compile(ctx);
- }
-
- memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len);
-}
-
-/* SHA1 final padding and digest calculation */
-
-#if (PLATFORM_BYTE_ORDER == SHA_LITTLE_ENDIAN)
-sha1_32t mask[4] =
- { 0x00000000, 0x000000ff, 0x0000ffff, 0x00ffffff };
-sha1_32t bits[4] =
- { 0x00000080, 0x00008000, 0x00800000, 0x80000000 };
-#else
-sha1_32t mask[4] =
- { 0x00000000, 0xff000000, 0xffff0000, 0xffffff00 };
-sha1_32t bits[4] =
- { 0x80000000, 0x00800000, 0x00008000, 0x00000080 };
-#endif
-
-void sha1_end(unsigned char hval[], sha1_ctx ctx[1])
-{ sha1_32t i = (sha1_32t)(ctx->count[0] & SHA1_MASK);
-
- /* mask out the rest of any partial 32-bit word and then set */
- /* the next byte to 0x80. On big-endian machines any bytes in */
- /* the buffer will be at the top end of 32 bit words, on little */
- /* endian machines they will be at the bottom. Hence the AND */
- /* and OR masks above are reversed for little endian systems */
- /* Note that we can always add the first padding byte at this */
- /* because the buffer always contains at least one empty slot */
- ctx->wbuf[i >> 2] = (ctx->wbuf[i >> 2] & mask[i & 3]) | bits[i & 3];
-
- /* we need 9 or more empty positions, one for the padding byte */
- /* (above) and eight for the length count. If there is not */
- /* enough space pad and empty the buffer */
- if(i > SHA1_BLOCK_SIZE - 9)
- {
- if(i < 60) ctx->wbuf[15] = 0;
- sha1_compile(ctx);
- i = 0;
- }
- else /* compute a word index for the empty buffer positions */
- i = (i >> 2) + 1;
-
- while(i < 14) /* and zero pad all but last two positions */
- ctx->wbuf[i++] = 0;
-
- /* assemble the eight byte counter in in big-endian format */
- ctx->wbuf[14] = swap_b32((ctx->count[1] << 3) | (ctx->count[0] >> 29));
- ctx->wbuf[15] = swap_b32(ctx->count[0] << 3);
-
- sha1_compile(ctx);
-
- /* extract the hash value as bytes in case the hash buffer is */
- /* misaligned for 32-bit words */
- for(i = 0; i < SHA1_DIGEST_SIZE; ++i)
- hval[i] = (unsigned char)(ctx->hash[i >> 2] >> 8 * (~i & 3));
-}
-
-void sha1(unsigned char hval[], const unsigned char data[], unsigned int len)
-{ sha1_ctx cx[1];
-
- sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx);
-}
diff --git a/c/src/lib/libbsp/arm/nds/tools/runtest b/c/src/lib/libbsp/arm/nds/tools/runtest
deleted file mode 100755
index fff704604c..0000000000
--- a/c/src/lib/libbsp/arm/nds/tools/runtest
+++ /dev/null
@@ -1,249 +0,0 @@
-#!/bin/sh -p
-#
-# Run rtems tests on the powerpc simulator
-# This program generates a simulator script to run each test
-# Typically the test is then run, although it can be generated
-# and left as a file using -s
-#
-# COPYRIGHT (c) 1989-1999.
-# On-Line Applications Research Corporation (OAR).
-#
-# The license and distribution terms for this file may be
-# found in the file LICENSE in this distribution or at
-# http://www.rtems.org/license/LICENSE.
-
-# progname=`basename $0`
-progname=${0##*/} # fast basename hack for ksh, bash
-
-USAGE=\
-"usage: $progname [ -opts ] test [ test ... ]
- -o options -- specify options to be passed to simulator
- -v -- verbose
- -d -- generate device tree file (as 'test'.device) and exit
- -l logdir -- specify log directory (default is 'logdir')
-
- Specify test as 'test' or 'test.exe'.
- All multiprocessing tests *must* be specified simply as 'mp01', etc.
-"
-
-# export everything
-set -a
-
-# log an error to stderr
-prerr()
-{
- echo "$*" >&2
-}
-
-fatal() {
- [ "$1" ] && prerr $*
- prerr "$USAGE"
- exit 1
-}
-
-warn() {
- [ "$1" ] && prerr $*
-}
-
-# print args, 1 per line
-ml_echo()
-{
- for l
- do
- echo "$l"
- done
-}
-
-# run at normal and signalled exit
-test_exit()
-{
- exit_code=$1
-
- rm -f ${logfile}.tmp*
- [ "$sim_pid" ] && kill -9 $sim_pid
-
- exit $exit_code
-}
-
-#
-# process the options
-#
-# defaults for getopt vars
-#
-# max_run_time is defaulted to 5 minutes
-#
-
-verbose=""
-extra_options=""
-device_and_exit=""
-stdio_setup="yes"
-run_to_completion="yes"
-logdir=log
-update_on_tick="no"
-max_run_time=$((5 * 60))
-using_print_buffer="yes"
-simulator=desmume
-
-while getopts vdl:o:s: OPT
-do
- case "$OPT" in
- v)
- verbose="yes";;
- d)
- device_and_exit="yes"
- run_to_completion="no"
- stdio_setup="no";;
- l)
- logdir="$OPTARG";;
- o)
- extra_options="$OPTARG";;
- s)
- simulator="$OPTARG";;
- *)
- fatal;;
- esac
-done
-
-let $((shiftcount = $OPTIND - 1))
-shift $shiftcount
-
-args=$*
-
-#
-# Check some parameters
-#
-
-#
-# Run the tests
-#
-
-tests="$args"
-if [ ! "$tests" ]
-then
- set -- `echo *.exe`
- tests="$*"
-fi
-
-[ -d $logdir ] ||
- mkdir $logdir || fatal "could not create log directory ($logdir)"
-
-# where the tmp files go
-trap "test_exit" 1 2 3 13 14 15
-
-for tfile in $tests
-do
-
- tname=`basename $tfile .exe`
- cpus="1"
- TEST_TYPE="single"
-
- case $tname in
- # size is no longer interactive.
- capture* | monitor* | termios* | fileio* | pppd*)
- if [ $run_to_completion = "yes" ]
- then
- warn "Skipping $tname; it is interactive"
- continue
- fi
- ;;
- *-node2*)
- warn "Skipping $tname; 'runtest' runs both nodes when for *-node1"
- continue
- ;;
- *-node1*)
- warn "Skipping $tname; is multiprocessor"
- continue
- ;;
- minimum*|stackchk*|spfatal*|termio*)
- continue
- ;;
- esac
-
- if [ $TEST_TYPE = "single" ]
- then
- logfile=`pwd`/debug.log
- infofile=$logfile.info
-
- rm -f ${logfile}.tmp*
-
- date=`date`
- echo "Starting $tname at $date"
-
- # Generate a device file to get the work done.
- # The device file must do the following:
- #
- # arrange for more memory (2 Mb)
-
- if [ "$device_and_exit" = "yes" ]
- then
- fatal "Cannot currently generate device files"
- fi
-
- # Spin off the simulator in the background
-
- ${simulator} `basename $tfile .exe`.nds 2>&1 >/dev/null &
- pid=$!
-
- # Make sure it won't run forever...
- time_run=0
- while [ $time_run -lt $max_run_time ]
- do
- # sleep 5s at a time waiting for job to finish or timer to expire
- # if job has exited, then we exit, too.
- sleep 5
- kill -0 $pid 2> /dev/null
- running=$?
- if [ $running -eq 0 ]
- then
- time_run=$((time_run + 5))
- if [ $time_run -ge $max_run_time ]
- then
- kill -9 $pid 2> /dev/null
- ran_too_long="yes"
- fi
- else
- ran_too_long="no"
- break
- fi
- done
- fi
-
- # Create the info files
- for cpu in $cpus
- do
- {
- echo "$date"
- echo "Test run on: `uname -n`"
- echo "Host Information:"
- echo `uname -a`
- echo
-
- j=`grep -n '\*\*\* ' debug.log | head -1 | cut -d':' -f1`
- k=`wc -l debug.log | cut -d' ' -f1`
-
- tail -$((k-j+1)) debug.log | head -$((k-j))| sed 's/\r//g'
-
- if [ "$ran_too_long" = "yes" ]
- then
- echo "Test did NOT finish normally; killed after $max_run_time seconds"
- fi
-
- echo
- date;
- } > ${logdir}/${tname}_${cpu}.info
- done
-
- if [ "$cpus" = "1" ]
- then
- mv ${logfile} $logdir/${tname}
- fi
-
-done
-
-echo "Tests completed at " `date`
-test_exit 0
-
-# Local Variables: ***
-# mode:ksh ***
-# End: ***
-
diff --git a/c/src/lib/libbsp/arm/nds/touchscreen/README.reco b/c/src/lib/libbsp/arm/nds/touchscreen/README.reco
deleted file mode 100644
index 6a1a0b30e1..0000000000
--- a/c/src/lib/libbsp/arm/nds/touchscreen/README.reco
+++ /dev/null
@@ -1,3 +0,0 @@
-Files reco.c and reco.h come from PALib.
-
-Visit http://www.palib.info/ for more information.
diff --git a/c/src/lib/libbsp/arm/nds/touchscreen/parser.c b/c/src/lib/libbsp/arm/nds/touchscreen/parser.c
deleted file mode 100644
index b103c615d1..0000000000
--- a/c/src/lib/libbsp/arm/nds/touchscreen/parser.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * RTEMS for Nintendo DS input parser.
- *
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <rtems.h>
-
-#include <nds.h>
-
-#include <rtems/mw_uid.h>
-
-/*
- * from console/console.c
- */
-
-extern void console_push (char c);
-extern void register_kbd_msg_queue (char *q_name);
-extern void unregister_kbd_msg_queue (void);
-
-/*
- * from reco.c
- */
-
-extern char PA_CheckLetter (int down, int x, int y);
-
-/*
- * message queue for touchscreen and graffiti events.
- */
-extern void register_mou_msg_queue (char *q_name);
-extern void unregister_mou_msg_queue (void);
-static rtems_id mou_queue_id = 0;
-static rtems_id kbd_queue_id = 0;
-
-/*
- * old position.
- */
-
-static int old_x = 0;
-static int old_y = 0;
-static int old_btns = 0;
-
-/*
- * hand mode.
- */
-
-static int hand = 0;
-
-/*
- * Shared methods
- */
-void update_touchscreen (void);
-void touchscreen_sethand (int h);
-
-/*
- * update touchscreen position
- */
-void
-update_touchscreen (void)
-{
- static int graffiti = 0;
- struct MW_UID_MESSAGE m;
- int x, y, k, kh, btns = 0;
- touchPosition pos;
- char c;
-
- /* update keypad & touchscreen */
- scanKeys ();
- pos = touchReadXY ();
- x = pos.px;
- y = pos.py;
- k = keysDown ();
- kh = keysHeld ();
-
- /* check for character recognition */
- if ((kh & KEY_L) || (kh & KEY_R)) {
- graffiti = 1;
- c = PA_CheckLetter ((kh & KEY_TOUCH ? 1 : 0), x, y);
- if (c) {
- /* signal the console driver */
- console_push (c);
- if (kbd_queue_id != 0) {
- /* send the read character */
- m.type = MV_UID_KBD;
- m.m.kbd.code = c;
- m.m.kbd.modifiers = 0;
- m.m.kbd.mode = MV_KEY_MODE_ASCII;
- rtems_message_queue_send (kbd_queue_id, (void *) &m,
- sizeof (struct MW_UID_MESSAGE));
- }
- }
- } else {
- if (graffiti == 1) {
- x = old_x;
- y = old_y;
- }
- graffiti = 0;
- }
-
- if (mou_queue_id == 0)
- return;
-
- if (hand == 1) {
- if (k & KEY_LEFT) {
- btns = MV_BUTTON_LEFT;
- }
- if (k & KEY_RIGHT) {
- btns = MV_BUTTON_RIGHT;
- }
- } else {
- if (k & KEY_A) {
- btns = MV_BUTTON_LEFT;
- }
- if (k & KEY_B) {
- btns = MV_BUTTON_RIGHT;
- }
- }
-
- if (!((kh & KEY_L) || (kh & KEY_R)) && (kh & KEY_TOUCH)
- && (x != old_x || y != old_y || btns)) {
- /* send the read position */
- m.type = MV_UID_ABS_POS;
- old_btns = m.m.pos.btns = btns;
- old_x = m.m.pos.x = x;
- old_y = m.m.pos.y = y;
- m.m.pos.z = 0;
- rtems_message_queue_send (mou_queue_id, (void *) &m,
- sizeof (struct MW_UID_MESSAGE));
- }
-}
-
-/*
- * register a message queue for touchscreen events.
- */
-
-void
-register_mou_msg_queue (char *q_name)
-{
- rtems_name queue_name;
- rtems_status_code status;
-
- queue_name = rtems_build_name (q_name[0], q_name[1], q_name[2], q_name[3]);
- status = rtems_message_queue_ident (queue_name, RTEMS_LOCAL, &mou_queue_id);
- if (status != RTEMS_SUCCESSFUL) {
- printk ("[!] cannot create queue %d\n", status);
- return;
- }
-
- update_touchscreen ();
-}
-
-/*
- * unregister the message queue.
- */
-
-void
-unregister_mou_msg_queue (void)
-{
- /* nothing here */
-}
-
-/*
- * register a message queue for graffiti events.
- */
-
-void
-register_kbd_msg_queue (char *q_name)
-{
- rtems_name queue_name;
- rtems_status_code status;
-
- queue_name = rtems_build_name (q_name[0], q_name[1], q_name[2], q_name[3]);
- status = rtems_message_queue_ident (queue_name, RTEMS_LOCAL, &kbd_queue_id);
- if (status != RTEMS_SUCCESSFUL) {
- printk ("[!] cannot create queue %d\n", status);
- return;
- }
-}
-
-/*
- * unregister the message queue.
- */
-
-void
-unregister_kbd_msg_queue (void)
-{
- /* nothing here */
-}
-
-/*
- * set hand mode.
- */
-
-void
-touchscreen_sethand (int h)
-{
- hand = h;
-}
diff --git a/c/src/lib/libbsp/arm/nds/touchscreen/reco.c b/c/src/lib/libbsp/arm/nds/touchscreen/reco.c
deleted file mode 100644
index 540720038f..0000000000
--- a/c/src/lib/libbsp/arm/nds/touchscreen/reco.c
+++ /dev/null
@@ -1,245 +0,0 @@
-#include <nds.h>
-#include "reco.h"
-
-/*
- * Prototype
- *
- * NOTE: These appear to be part of a public interface.
- */
-char PA_CheckLetter(int down, int x, int y);
-
-PA_StylusPosition PA_StylusPos[20000];
-
-PA_RecoValues PA_Reco;
-
-char PA_RecoShape[16];
-
-u8 PA_UseGraffiti = true;
-
-u8 PA_CustomReco = 0; // number of custom shapes
-PA_FormType PA_CustomShape[200];
-
-PA_RecoInfos PA_RecoInfo;
-
-PA_FormType PA_Graffiti[PA_RECOTESTS] = {
- {' ', "AAAAAAAAAAAAAAA"},
- {'a', "FGGGGGFB;:;;;;;"},
- {'b', "JJJJJIGC>:8=<62"},
- {'c', "01234689;<>?@BC"},
- {'d', "=995KJIFB?=;853"},
- {'e', "1236;>@136;=?@A"},
- {'f', "121111399998779"},
- {'g', "235689;=@CFIJEA"},
- {'h', "8999999;HFEA><:"},
- {'i', "999999999999999"},
- {'j', "999999998653100"},
- {'k', "654320NIDCA?==="},
- {'l', "999999988<AA@@@"},
- {'m', "HGGEA<;EFDA=;99"},
- {'n', "HHHIE<;;;<GIHHH"},
- {'o', "4689;<?BDFHKMO0"},
- {'p', "<KJIIIHGEB>;853"},
- {'q', "4679<?CDFHKMJBA"},
- {'r', "999IIIIGC?:53<="},
- {'s', "0235:>?>>;73100"},
- {'t', "AAAA@@@;8999999"},
- {'u', "899:;<>ACEGHHIH"},
- {'v', ";;:::::?FGGHHGF"},
- {'w', "::;=BA<<@CDEFGH"},
- {'x', ";;;;;;;;;;;;;;;"},
- {'y', ">;=AFF899974OIF"},
- {'z', ">A@@>843348?@AA"},
- {'0', "35789;=AEGHIJKM"},
- {'1', "CDEFFE988889999"},
- {'2', "GDB@>:6546>AAAA"},
- {'3', "CA>833A@=953210"},
- {'4', "55558>@A@>97778"},
- {'5', "00037:@@=;7310O"},
- {'6', "346779;>@CFKN02"},
- {'7', "AAAAAA@>9655556"},
- {'8', "37;=;71MIECCGM1"},
- {'9', "8<@CGL28<<;6311"},
- {PA_BACKSPACE, "000000000000000"},
- {PA_ENTER, "555555555555555"},
- // {'?', "FCA@><8655799::"},
- {'.', "LLLLLLLLLLLLLLL"}
-};
-
-
-
-static void PA_AddStylusPos(u8 x, u8 y){
- if (!((x == PA_StylusPos[PA_Reco.nvalues-1].x) && (y == PA_StylusPos[PA_Reco.nvalues-1].y))){
- PA_StylusPos[PA_Reco.nvalues].x = x;
- PA_StylusPos[PA_Reco.nvalues].y = y;
- PA_Reco.nvalues++;
- }
-}
-
-
-static void PA_StylusLine(u8 x1, u8 y1, u8 x2, u8 y2){
- int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py;
-
- dx=x2-x1; /* the horizontal distance of the line */
- dy=y2-y1; /* the vertical distance of the line */
- dxabs = dx;
- sdx = 1;
- if (dx < 0) {
- dxabs = -dx;
- sdx = -1;
- }
- dyabs = dy;
- sdy = 1;
- if (dy < 0) {
- dyabs = -dy;
- sdy = -1;
- }
-
- x=dyabs>>1;
- y=dxabs>>1;
- px=x1;
- py=y1;
-
- PA_AddStylusPos(px, py);
-
-
- if (dxabs>=dyabs) {
- for(i=0;i<dxabs;i++) {
- y+=dyabs;
- if (y>=dxabs) {
- y-=dxabs;
- py+=sdy;
- }
- px+=sdx;
- PA_AddStylusPos(px, py);
- }
- }
- else {
- for(i=0;i<dyabs;i++) {
- x+=dxabs;
- if (x>=dyabs) {
- x-=dyabs;
- px+=sdx;
- }
- py+=sdy;
- PA_AddStylusPos(px, py);
- }
- }
-}
-
-
-#define PA_ShapeAddPoint(i, value){ \
- points[i] = PA_StylusPos[value]; \
- if (points[i].x < PA_RecoInfo.minX) PA_RecoInfo.minX = points[i].x; \
- else if (points[i].x > PA_RecoInfo.maxX) PA_RecoInfo.maxX = points[i].x; \
- if (points[i].y < PA_RecoInfo.minY) PA_RecoInfo.minY = points[i].y; \
- else if (points[i].y > PA_RecoInfo.maxY) PA_RecoInfo.maxY = points[i].y; }
-
-
-
-
-static char PA_AnalyzeShape(void){
- s32 i;
- // for (i = 0; i < 32; i++) PA_OutputSimpleText(1, 0, i, " ");
-
- PA_StylusPosition points[17];
- for (i = 0; i < 16; i++){
- PA_ShapeAddPoint(i, (PA_Reco.nvalues*i)>>4)
- }
- PA_ShapeAddPoint(16, PA_Reco.nvalues-1)
- //points[16] = PA_StylusPos[PA_Reco.nvalues-1];
- PA_RecoInfo.endX = PA_StylusPos[PA_Reco.nvalues-1].x; // last values
- PA_RecoInfo.endY = PA_StylusPos[PA_Reco.nvalues-1].y; // last values
- PA_RecoInfo.Length = PA_Reco.nvalues; // Total length
- PA_RecoInfo.Angle = PA_GetAngle(points[0].x, points[0].y, points[16].x, points[16].y);
-
- //Better values
- if (PA_RecoInfo.minX > 1) PA_RecoInfo.minX-=2;
- if (PA_RecoInfo.maxX <254) PA_RecoInfo.maxX+=2;
- if (PA_RecoInfo.minY > 1) PA_RecoInfo.minY-=2;
- if (PA_RecoInfo.maxY <190) PA_RecoInfo.maxY+=2;
-
- u16 angles[15];
- for (i = 0; i < 15; i++) angles[i] = PA_GetAngle(points[i+2].x, points[i+2].y, points[i].x, points[i].y);
-
- for (i = 0; i < 15; i++) PA_RecoShape[i] = '0' + (((angles[i]+16)&511)>>4);
- PA_RecoShape[15] = 0;
- // printk("%s\n", PA_RecoShape);
-
- u8 letter = 0; // 0 par défaut
- s32 diff = 65000; // Diff max par défaut
-
- u8 j;
-
- if(PA_UseGraffiti){
- for (j = 0; j < PA_RECOTESTS; j++){
- s32 tempvalue = 0;
- s32 tempdiff = 0;
- for (i = 0; i < 15; i++) {
- tempvalue = (PA_RecoShape[i]-PA_Graffiti[j].code[i])&31;
- tempvalue -= (tempvalue >> 4)<<5; // normalise
- if (tempvalue < 0) tempvalue = -tempvalue;
- tempdiff += tempvalue; // value
- }
-
- if (tempdiff < diff){ // Nouvelle lettre !
- diff = tempdiff;
- letter = PA_Graffiti[j].letter;
- }
- }
- }
- if (PA_CustomReco > 0){
- for (j = 0; j < PA_CustomReco; j++){
- s32 tempvalue = 0;
- s32 tempdiff = 0;
- for (i = 0; i < 15; i++) {
- tempvalue = (PA_RecoShape[i]-PA_CustomShape[j].code[i])&31;
- tempvalue -= (tempvalue >> 4)<<5; // normalise
- if (tempvalue < 0) tempvalue = -tempvalue;
- tempdiff += tempvalue; // value
- }
-
- if (tempdiff < diff){ // Nouvelle lettre !
- diff = tempdiff;
- letter = PA_CustomShape[j].letter;
- }
- }
-
- }
- PA_RecoInfo.Difference = diff; // Difference to perfect shape
- PA_RecoInfo.Shape = letter;
-
- return letter;
-}
-
-int old_down = 0;
-
-char PA_CheckLetter(int down, int x, int y){
- if(!old_down && down){
- PA_Reco.nvalues = 0; // Start over again
- PA_Reco.oldn = 0;
- PA_Reco.veryold = 0;
-
- PA_RecoInfo.startX = PA_StylusPos[PA_Reco.nvalues].x = x; // start values
- PA_RecoInfo.startY = PA_StylusPos[PA_Reco.nvalues].y = y;
- PA_RecoInfo.minX = PA_RecoInfo.maxX = PA_RecoInfo.startX;
- PA_RecoInfo.minY = PA_RecoInfo.maxY = PA_RecoInfo.startY;
- PA_Reco.nvalues++;
- }
- else if(old_down && down) {
- PA_StylusLine(PA_StylusPos[PA_Reco.nvalues-1].x, PA_StylusPos[PA_Reco.nvalues-1].y, x, y);
-
- }
-
-
- if(old_down && !down){ // Start analyzing...
- PA_Reco.nvalues = PA_Reco.veryold;
- old_down = down;
- return PA_AnalyzeShape();
- }
- PA_Reco.veryold = PA_Reco.oldn;
- PA_Reco.oldn = PA_Reco.nvalues;
- old_down = down;
- return 0;
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/touchscreen/reco.h b/c/src/lib/libbsp/arm/nds/touchscreen/reco.h
deleted file mode 100644
index d9c00cd6e7..0000000000
--- a/c/src/lib/libbsp/arm/nds/touchscreen/reco.h
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef RECO_H
-#define RECO_H
-
-#include <nds.h>
-
-#define PA_RECOTESTS 40
-
-#define PA_BACKSPACE 1 // On va dire que la touche backspace a pour valeur 1...
-#define PA_ENTER '\n' // 3 pour Enter
-
-
-typedef struct{
- u8 x, y;
-} PA_StylusPosition;
-
-typedef struct{
- u32 nvalues, oldn, veryold;
-} PA_RecoValues;
-
-typedef struct{
- u32 Length;
- u8 minX, minY, maxX, maxY; // Shape limits
- u8 startX, startY, endX, endY; // Start and end position
- s16 Angle;
- s32 Difference;
- u8 Shape;
-} PA_RecoInfos;
-
-typedef struct{
- char letter;
- char code[16];
-} PA_FormType;
-
-static inline u64 PA_Distance(s32 x1, s32 y1, s32 x2, s32 y2) {
- s64 h = x1 - x2;
- s64 v = y1 - y2;
- return(h*h + v*v);
-}
-
-#define PA_Cos(angle) PA_SIN[((angle) + 128)&511]
-#define PA_Sin(angle) PA_SIN[((angle))&511]
-
-static const s16 PA_SIN[512] = {
- 0x0000,0x0003,0x0006,0x0009,0x000D,0x0010,0x0013,0x0016, 0x0019,0x001C,0x001F,0x0022,0x0026,0x0029,0x002C,0x002F,
- 0x0032,0x0035,0x0038,0x003B,0x003E,0x0041,0x0044,0x0047, 0x004A,0x004D,0x0050,0x0053,0x0056,0x0059,0x005C,0x005F,
- 0x0062,0x0065,0x0068,0x006B,0x006D,0x0070,0x0073,0x0076, 0x0079,0x007B,0x007E,0x0081,0x0084,0x0086,0x0089,0x008C,
- 0x008E,0x0091,0x0093,0x0096,0x0098,0x009B,0x009D,0x00A0, 0x00A2,0x00A5,0x00A7,0x00AA,0x00AC,0x00AE,0x00B1,0x00B3,
-
- 0x00B5,0x00B7,0x00B9,0x00BC,0x00BE,0x00C0,0x00C2,0x00C4, 0x00C6,0x00C8,0x00CA,0x00CC,0x00CE,0x00CF,0x00D1,0x00D3,
- 0x00D5,0x00D7,0x00D8,0x00DA,0x00DC,0x00DD,0x00DF,0x00E0, 0x00E2,0x00E3,0x00E5,0x00E6,0x00E7,0x00E9,0x00EA,0x00EB,
- 0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4, 0x00F5,0x00F6,0x00F7,0x00F8,0x00F8,0x00F9,0x00FA,0x00FA,
- 0x00FB,0x00FC,0x00FC,0x00FD,0x00FD,0x00FE,0x00FE,0x00FE, 0x00FF,0x00FF,0x00FF,0x0100,0x0100,0x0100,0x0100,0x0100,
-
- 0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x00FF,0x00FF, 0x00FF,0x00FE,0x00FE,0x00FE,0x00FD,0x00FD,0x00FC,0x00FC,
- 0x00FB,0x00FA,0x00FA,0x00F9,0x00F8,0x00F8,0x00F7,0x00F6, 0x00F5,0x00F4,0x00F3,0x00F2,0x00F1,0x00F0,0x00EF,0x00EE,
- 0x00ED,0x00EB,0x00EA,0x00E9,0x00E7,0x00E6,0x00E5,0x00E3, 0x00E2,0x00E0,0x00DF,0x00DD,0x00DC,0x00DA,0x00D8,0x00D7,
- 0x00D5,0x00D3,0x00D1,0x00CF,0x00CE,0x00CC,0x00CA,0x00C8, 0x00C6,0x00C4,0x00C2,0x00C0,0x00BE,0x00BC,0x00B9,0x00B7,
-
- 0x00B5,0x00B3,0x00B1,0x00AE,0x00AC,0x00AA,0x00A7,0x00A5, 0x00A2,0x00A0,0x009D,0x009B,0x0098,0x0096,0x0093,0x0091,
- 0x008E,0x008C,0x0089,0x0086,0x0084,0x0081,0x007E,0x007B, 0x0079,0x0076,0x0073,0x0070,0x006D,0x006B,0x0068,0x0065,
- 0x0062,0x005F,0x005C,0x0059,0x0056,0x0053,0x0050,0x004D, 0x004A,0x0047,0x0044,0x0041,0x003E,0x003B,0x0038,0x0035,
- 0x0032,0x002F,0x002C,0x0029,0x0026,0x0022,0x001F,0x001C, 0x0019,0x0016,0x0013,0x0010,0x000D,0x0009,0x0006,0x0003,
-
- 0x0000,0xFFFD,0xFFFA,0xFFF7,0xFFF3,0xFFF0,0xFFED,0xFFEA, 0xFFE7,0xFFE4,0xFFE1,0xFFDE,0xFFDA,0xFFD7,0xFFD4,0xFFD1,
- 0xFFCE,0xFFCB,0xFFC8,0xFFC5,0xFFC2,0xFFBF,0xFFBC,0xFFB9, 0xFFB6,0xFFB3,0xFFB0,0xFFAD,0xFFAA,0xFFA7,0xFFA4,0xFFA1,
- 0xFF9E,0xFF9B,0xFF98,0xFF95,0xFF93,0xFF90,0xFF8D,0xFF8A, 0xFF87,0xFF85,0xFF82,0xFF7F,0xFF7C,0xFF7A,0xFF77,0xFF74,
- 0xFF72,0xFF6F,0xFF6D,0xFF6A,0xFF68,0xFF65,0xFF63,0xFF60, 0xFF5E,0xFF5B,0xFF59,0xFF56,0xFF54,0xFF52,0xFF4F,0xFF4D,
-
- 0xFF4B,0xFF49,0xFF47,0xFF44,0xFF42,0xFF40,0xFF3E,0xFF3C, 0xFF3A,0xFF38,0xFF36,0xFF34,0xFF32,0xFF31,0xFF2F,0xFF2D,
- 0xFF2B,0xFF29,0xFF28,0xFF26,0xFF24,0xFF23,0xFF21,0xFF20, 0xFF1E,0xFF1D,0xFF1B,0xFF1A,0xFF19,0xFF17,0xFF16,0xFF15,
- 0xFF13,0xFF12,0xFF11,0xFF10,0xFF0F,0xFF0E,0xFF0D,0xFF0C, 0xFF0B,0xFF0A,0xFF09,0xFF08,0xFF08,0xFF07,0xFF06,0xFF06,
- 0xFF05,0xFF04,0xFF04,0xFF03,0xFF03,0xFF02,0xFF02,0xFF02, 0xFF01,0xFF01,0xFF01,0xFF00,0xFF00,0xFF00,0xFF00,0xFF00,
-
- 0xFF00,0xFF00,0xFF00,0xFF00,0xFF00,0xFF00,0xFF01,0xFF01, 0xFF01,0xFF02,0xFF02,0xFF02,0xFF03,0xFF03,0xFF04,0xFF04,
- 0xFF05,0xFF06,0xFF06,0xFF07,0xFF08,0xFF08,0xFF09,0xFF0A, 0xFF0B,0xFF0C,0xFF0D,0xFF0E,0xFF0F,0xFF10,0xFF11,0xFF12,
- 0xFF13,0xFF15,0xFF16,0xFF17,0xFF19,0xFF1A,0xFF1B,0xFF1D, 0xFF1E,0xFF20,0xFF21,0xFF23,0xFF24,0xFF26,0xFF28,0xFF29,
- 0xFF2B,0xFF2D,0xFF2F,0xFF31,0xFF32,0xFF34,0xFF36,0xFF38, 0xFF3A,0xFF3C,0xFF3E,0xFF40,0xFF42,0xFF44,0xFF47,0xFF49,
-
- 0xFF4B,0xFF4D,0xFF4F,0xFF52,0xFF54,0xFF56,0xFF59,0xFF5B, 0xFF5E,0xFF60,0xFF63,0xFF65,0xFF68,0xFF6A,0xFF6D,0xFF6F,
- 0xFF72,0xFF74,0xFF77,0xFF7A,0xFF7C,0xFF7F,0xFF82,0xFF85, 0xFF87,0xFF8A,0xFF8D,0xFF90,0xFF93,0xFF95,0xFF98,0xFF9B,
- 0xFF9E,0xFFA1,0xFFA4,0xFFA7,0xFFAA,0xFFAD,0xFFB0,0xFFB3, 0xFFB6,0xFFB9,0xFFBC,0xFFBF,0xFFC2,0xFFC5,0xFFC8,0xFFCB,
- 0xFFCE,0xFFD1,0xFFD4,0xFFD7,0xFFDA,0xFFDE,0xFFE1,0xFFE4, 0xFFE7,0xFFEA,0xFFED,0xFFF0,0xFFF3,0xFFF7,0xFFFA,0xFFFD};
-
-
-static u16 PA_AdjustAngle(u16 angle, s16 anglerot, s32 startx, s32 starty, s32 targetx, s32 targety) {
-u64 distances[3];
-
- startx = startx << 8; // Fixed point...
- starty = starty << 8; // Fixed point...
- targetx = targetx << 8; // Fixed point...
- targety = targety << 8; // Fixed point...
-
- u16 tempangle = (angle - anglerot) & 511;
-
-
- // Calcul des distances en fonction des angles
- distances[0] = PA_Distance(startx + PA_Cos(tempangle), starty - PA_Sin(tempangle), targetx, targety);
- tempangle += anglerot;
- tempangle &= 511;
- distances[1] = PA_Distance(startx + PA_Cos(tempangle), starty - PA_Sin(tempangle), targetx, targety);
- tempangle += anglerot;
- tempangle &= 511;
- distances[2] = PA_Distance(startx + PA_Cos(tempangle), starty - PA_Sin(tempangle), targetx, targety);
-
-
-
- // On regarde si l'angle est optimal. Si ce n'est pas le cas,
- // on fait tourner toujours dans le meme sens...
- if (distances[0] < distances[1]) angle -= anglerot;
- else if (distances[2] < distances[1]) angle += anglerot;
-
- return (angle&511);
-}
-
-static inline u16 PA_GetAngle(s32 startx, s32 starty, s32 targetx, s32 targety) {
-u16 angle = 0;
-u16 anglerot = 180;
-
-
-while(anglerot > 5) {
- angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety);
- anglerot = (anglerot - ((3 * anglerot) >> 3)); // On diminue petit à petit la rotation...
-}
-
-// Ajustement encore plus précis...
-anglerot = 4;
-angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety);
-anglerot = 2;
-angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety);
-anglerot = 1;
-angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety);
-
-return angle;
-}
-
-
-#endif /* RECO_H */
diff --git a/c/src/lib/libbsp/arm/nds/touchscreen/touchscreen.c b/c/src/lib/libbsp/arm/nds/touchscreen/touchscreen.c
deleted file mode 100644
index 868fccb9af..0000000000
--- a/c/src/lib/libbsp/arm/nds/touchscreen/touchscreen.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * RTEMS for Nintendo DS touchscreen driver.
- *
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-
-#include <bsp.h>
-#include <rtems/irq.h>
-#include <rtems/libio.h>
-#include <nds.h>
-
-#include <rtems/mw_uid.h>
-#include "touchscreen.h"
-
-/*
- * from parser.c
- */
-
-void register_mou_msg_queue (char *q_name);
-void unregister_mou_msg_queue (void);
-void touchscreen_sethand (int);
-
-/*
- * touchscreen device driver initialize entry point.
- */
-
-rtems_device_driver
-touchscreen_initialize (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_status_code status;
-
- printk ("[+] touchscreen started\n");
-
- touchscreen_sethand (1);
-
- /* register the device */
- status = rtems_io_register_name ("/dev/mouse", major, 0);
- if (status != RTEMS_SUCCESSFUL) {
- printk ("[!] error registering touchscreen\n");
- rtems_fatal_error_occurred (status);
- }
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * touchscreen device driver open operation.
- */
-
-rtems_device_driver
-touchscreen_open (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * touchscreen device driver close operation.
- */
-
-rtems_device_driver
-touchscreen_close (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * touchscreen device driver read operation.
- */
-
-rtems_device_driver
-touchscreen_read (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) arg;
- rw_args->bytes_moved = 0;
-
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * touchscreen device driver write operation.
- */
-
-rtems_device_driver
-touchscreen_write (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) arg;
- rw_args->bytes_moved = 0;
-
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * ioctl entry point.
- */
-
-rtems_device_driver
-touchscreen_control (rtems_device_major_number major,
- rtems_device_minor_number minor, void *arg)
-{
- rtems_libio_ioctl_args_t *args = arg;
-
- switch (args->command) {
- case MW_UID_REGISTER_DEVICE:
- register_mou_msg_queue (args->buffer);
- break;
- case MW_UID_UNREGISTER_DEVICE:
- unregister_mou_msg_queue ();
- break;
- case MW_UID_SET_LEFTHANDED:
- touchscreen_sethand (0);
- break;
- case MW_UID_SET_RIGHTHANDED:
- touchscreen_sethand (1);
- break;
- }
- args->ioctl_return = 0;
-
- return RTEMS_SUCCESSFUL;
-}
diff --git a/c/src/lib/libbsp/arm/nds/touchscreen/touchscreen.h b/c/src/lib/libbsp/arm/nds/touchscreen/touchscreen.h
deleted file mode 100644
index d9a854c270..0000000000
--- a/c/src/lib/libbsp/arm/nds/touchscreen/touchscreen.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#ifndef _TOUCHSCREEN_H_
-#define _TOUCHSCREEN_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- /*
- * ioctl for lefthanded/righthanded mode.
- */
-
-#define MW_UID_SET_RIGHTHANDED 0x4108
-#define MW_UID_SET_LEFTHANDED 0x4109
-
- /*
- * touchscreen prototype entry points
- */
-
- rtems_device_driver touchscreen_initialize (rtems_device_major_number,
- rtems_device_minor_number,
- void *);
-
- rtems_device_driver touchscreen_open (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver touchscreen_control (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver touchscreen_close (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver touchscreen_read (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver touchscreen_write (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
- rtems_device_driver touchscreen_control (rtems_device_major_number,
- rtems_device_minor_number, void *);
-
-#define TOUCHSCREEN_DRIVER_TABLE_ENTRY \
- { touchscreen_initialize, touchscreen_open, touchscreen_close, \
- touchscreen_read, touchscreen_write, touchscreen_control }
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/wifi/compat.c b/c/src/lib/libbsp/arm/nds/wifi/compat.c
deleted file mode 100644
index 0509a1169e..0000000000
--- a/c/src/lib/libbsp/arm/nds/wifi/compat.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * RTEMS for Nintendo DS sgIP compatibility glue.
- *
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <rtems.h>
-#include <stdlib.h>
-
-#include <sys/mbuf.h>
-#undef malloc
-#undef free
-
-#include "compat.h"
-
-unsigned long sgIP_timems = 0;
-static sgIP_Hub_HWInterface hw;
-
-/*
- * Dswifi stub functions
- */
-
-void *
-sgIP_malloc (int size)
-{
- return malloc (size);
-}
-
-void
-sgIP_free (void *ptr)
-{
- free (ptr);
-}
-
-/*
- * called by dswifi on initialization
- */
-
-void
-sgIP_Init (void)
-{
-}
-
-/*
- * network layer stack timer called periodically
- */
-
-void
-sgIP_Timer (int num_ms)
-{
- sgIP_timems += num_ms;
-}
-
-/*
- * add a new hardware interface
- * should be called once
- */
-
-sgIP_Hub_HWInterface *
-sgIP_Hub_AddHardwareInterface (int (*TransmitFunction)
- (sgIP_Hub_HWInterface *, sgIP_memblock *),
- int (*InterfaceInit) (sgIP_Hub_HWInterface *))
-{
- hw.TransmitFunction = TransmitFunction;
- if (InterfaceInit)
- InterfaceInit (&hw);
-
- return &hw;
-}
-
-/*
- * callback on packet reception
- * translate memblock to mbuf
- */
-
-extern void wifi_signal (struct mbuf *);
-int
-sgIP_Hub_ReceiveHardwarePacket (sgIP_Hub_HWInterface * hw,
- sgIP_memblock * packet)
-{
- struct mbuf *m;
- unsigned char *p;
-
- /* reserve the mbuf */
- MGETHDR (m, M_WAIT, MT_DATA);
- MCLGET (m, M_WAIT);
-
- /* copy data to mbuf */
- p = mtod (m, unsigned char *);
- m->m_len = m->m_pkthdr.len = packet->thislength;
- memcpy (p, packet->datastart, packet->thislength);
-
- /* free the memblock */
- sgIP_memblock_free (packet);
-
- /* signal packet arrival to the driver */
- wifi_signal (m);
-
- return 0;
-}
-
-/*
- * function for sending a packet (translates mbuf to memblock)
- */
-
-void
-compat_wifi_output (struct mbuf *m)
-{
- sgIP_memblock *packet;
- size_t size = 0;
- struct mbuf *l;
-
- /* compute total size of the packet */
- for (l = m; l != NULL; l = l->m_next)
- size += l->m_len;
-
- /* allocate memblock */
- packet = sgIP_memblock_allocHW (14, size - 14);
-
- /* copy data from mbuf to memblock */
- m_copydata (m, 0, size, packet->datastart);
-
- /* call TransmitFunction */
- hw.TransmitFunction (&hw, packet);
-
- /* free mbuf */
- m_freem (m);
-}
-
-/*
- * allocate a memblock
- */
-
-sgIP_memblock *
-sgIP_memblock_allocHW (int headersize, int packetsize)
-{
- sgIP_memblock *mb;
- mb =
- (sgIP_memblock *) sgIP_malloc (SGIP_MEMBLOCK_HEADERSIZE +
- SGIP_MAXHWHEADER + packetsize);
- if (!mb)
- return 0;
- mb->totallength = headersize + packetsize;
- mb->thislength = mb->totallength;
- mb->datastart = mb->reserved + SGIP_MAXHWHEADER - headersize;
- mb->next = 0;
- return mb;
-}
-
-/*
- * release a memblock
- */
-
-void
-sgIP_memblock_free (sgIP_memblock * mb)
-{
- sgIP_memblock *f;
- return;
- SGIP_INTR_PROTECT ();
- while (mb) {
- mb->totallength = 0;
- mb->thislength = 0;
- f = mb;
- mb = mb->next;
-
- sgIP_free (f);
- }
-
- SGIP_INTR_UNPROTECT ();
-}
-
-/*
- * start DHCP discovery
- */
-
-void
-sgIP_DHCP_Start (sgIP_Hub_HWInterface * interface, int getDNS)
-{
-}
-
-/*
- * get DHCP state
- */
-
-int
-sgIP_DHCP_Update (void)
-{
- return SGIP_DHCP_STATUS_SUCCESS;
-}
-
-/* ----------------- not my problem things ---------------- */
-
-/* flush ARP table */
-void
-sgIP_ARP_FlushInterface (sgIP_Hub_HWInterface * hw)
-{
-}
-
-/* send a ARP new IP notification */
-int
-sgIP_ARP_SendGratARP (sgIP_Hub_HWInterface * hw)
-{
- return 0;
-}
-
-/* ----------------- unused things ------------------------ */
-
-sgIP_DNS_Record *
-sgIP_DNS_GetUnusedRecord (void)
-{
- static sgIP_DNS_Record rec;
-
- return &rec; /* we must return a valid record even if not used */
-}
diff --git a/c/src/lib/libbsp/arm/nds/wifi/compat.h b/c/src/lib/libbsp/arm/nds/wifi/compat.h
deleted file mode 100644
index 5dd7137ee5..0000000000
--- a/c/src/lib/libbsp/arm/nds/wifi/compat.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * RTEMS for Nintendo DS sgIP compatibility header.
- *
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#ifndef COMPAT_H_
-#define COMPAT_H_
-
-#include <rtems.h>
-
-/* --------------- unused things --------------------- */
-
-#define SGIP_DNS_FLAG_ACTIVE 1
-#define SGIP_DNS_FLAG_RESOLVED 2
-#define SGIP_DNS_FLAG_BUSY 4
-#define SGIP_DNS_MAXRECORDADDRS 4
-#define SGIP_DNS_MAXALIASES 4
-
-typedef struct SGIP_DNS_RECORD
-{
- char name[256];
- char aliases[SGIP_DNS_MAXALIASES][256];
- unsigned char addrdata[SGIP_DNS_MAXRECORDADDRS * 4];
- short addrlen;
- short addrclass;
- int numaddr, numalias;
- int TTL;
- int flags;
-} sgIP_DNS_Record;
-
-
-/* -------------------------- */
-
-#define SGIP_DEBUG_MESSAGE(param)
-#define SGIP_DEBUG_ERROR(param)
-
-
-
-#define SGIP_MAXHWADDRLEN 8
-#define SGIP_MEMBLOCK_DATASIZE 1600
-
-
-
-#define SGIP_MAXHWHEADER 16
-
-
-#define SGIP_MEMBLOCK_HEADERSIZE 16
-#define SGIP_MEMBLOCK_INTERNALSIZE (SGIP_MEMBLOCK_DATASIZE-16)
-#define SGIP_MEMBLOCK_FIRSTINTERNALSIZE (SGIP_MEMBLOCK_DATASIZE-16-SGIP_MAXHWHEADER)
-#define SGIP_INTR_PROTECT()
-#define SGIP_INTR_REPROTECT()
-#define SGIP_INTR_UNPROTECT()
-#define SGIP_WAITEVENT();
-
-typedef struct SGIP_MEMBLOCK
-{
- int totallength;
- int thislength;
- struct SGIP_MEMBLOCK *next;
- char *datastart;
- char reserved[SGIP_MEMBLOCK_DATASIZE - 16]; // assume the other 4 values are 16 bytes total in length.
-} sgIP_memblock;
-
-typedef struct SGIP_HUB_HWINTERFACE
-{
- unsigned short flags;
- unsigned short hwaddrlen;
- int MTU;
- int (*TransmitFunction) (struct SGIP_HUB_HWINTERFACE *, sgIP_memblock *);
- void *userdata;
- unsigned long ipaddr, gateway, snmask, dns[3];
- unsigned char hwaddr[SGIP_MAXHWADDRLEN];
-} sgIP_Hub_HWInterface;
-
-enum SGIP_DHCP_STATUS
-{
- SGIP_DHCP_STATUS_IDLE,
- SGIP_DHCP_STATUS_WORKING,
- SGIP_DHCP_STATUS_FAILED,
- SGIP_DHCP_STATUS_SUCCESS
-};
-
-extern sgIP_Hub_HWInterface *wifi_hw;
-
-
-/* prototypes */
-
-sgIP_DNS_Record *sgIP_DNS_GetUnusedRecord (void);
-void sgIP_DHCP_Start (sgIP_Hub_HWInterface * interface, int getDNS);
-int sgIP_DHCP_Update (void);
-int sgIP_ARP_SendGratARP (sgIP_Hub_HWInterface * hw);
-void sgIP_Init (void);
-void sgIP_Timer (int num_ms);
-sgIP_Hub_HWInterface
- *sgIP_Hub_AddHardwareInterface (int (*TransmitFunction)
- (sgIP_Hub_HWInterface *, sgIP_memblock *),
- int (*InterfaceInit) (sgIP_Hub_HWInterface
- *));
-
-int sgIP_Hub_ReceiveHardwarePacket (sgIP_Hub_HWInterface * hw,
- sgIP_memblock * packet);
-sgIP_memblock *sgIP_memblock_allocHW (int headersize, int packetsize);
-void sgIP_memblock_free (sgIP_memblock * mb);
-void sgIP_ARP_FlushInterface (sgIP_Hub_HWInterface * hw);
-
-extern unsigned long sgIP_timems;
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/wifi/wifi.c b/c/src/lib/libbsp/arm/nds/wifi/wifi.c
deleted file mode 100644
index 791c1a9cf8..0000000000
--- a/c/src/lib/libbsp/arm/nds/wifi/wifi.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * RTEMS for Nintendo DS WiFi driver.
- *
- * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
- * Benjamin Ratier <agho.pwn@gmail.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- *
- * http://www.rtems.org/license/LICENSE
- */
-
-#include <bsp.h>
-
-#include <stdio.h>
-#include <assert.h>
-#include <errno.h>
-
-#include <rtems/error.h>
-#include <rtems/rtems_bsdnet.h>
-
-#include <sys/param.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <rtems/irq.h>
-
-#include <nds.h>
-#include <dswifi9.h>
-
-/*
- * RTEMS event number used by reception task to receive packet
- */
-
-#define RECEIVE_EVENT RTEMS_EVENT_1
-
-/*
- * RTEMS event number used to start the transmit daemon
- */
-
-#define TRANSMIT_EVENT RTEMS_EVENT_2
-
-/*
- * from compat.c
- */
-
-void compat_wifi_output (struct mbuf *m);
-
-/*
- * wifi driver structure
- */
-
-static struct
-{
- /* The bsdnet information structure */
- struct arpcom arpcom;
-
- /* indicate if the hwaddr is already set */
- uint8_t is_hwaddr_set;
-
- /* the thread ID of the transmit task */
- rtems_id tx_id;
- /* the thread ID of the receive task */
- rtems_id rx_id;
-
- /* reception queue (filled in compat.c:ReceiveHardwarePacket) */
- struct ifqueue recvq;
-} softc;
-
-static void
-print_byte (unsigned char b)
-{
- printk ("%x%x", b >> 4, b & 0x0f);
-}
-
-/*
- * wifi timer function, must be called every 50 ms
- */
-
-static void
-Timer_50ms (void)
-{
- Wifi_Timer (50);
-}
-
-/*
- * notification function to send fifo message to arm7
- */
-
-static void
-arm9_synctoarm7 (void)
-{
- /* send fifo message */
- REG_IPC_FIFO_TX = 0x87654321;
-}
-
-/*
- * interrupt handler to receive fifo messages from arm7
- */
-
-static void
-arm9_fifo (void)
-{
- u32 value = REG_IPC_FIFO_RX;
-
- /* check incoming fifo messages */
- if (value == 0x87654321)
- Wifi_Sync ();
-}
-
-/*
- * signal an icoming packet
- */
-
-void
-wifi_signal (struct mbuf *m)
-{
- rtems_interrupt_level level;
-
- /* enqueue the incoming packet */
- rtems_interrupt_disable (level);
- IF_ENQUEUE (&softc.recvq, m);
- rtems_interrupt_enable (level);
-
- /* signal the rx daemon */
- rtems_bsdnet_event_send (softc.rx_id, RECEIVE_EVENT);
-}
-
-
-/*
- * packet reception daemon
- */
-
-static void
-wifi_rxd (void *arg)
-{
- rtems_interrupt_level level;
- struct ifnet *ifp = &softc.arpcom.ac_if;
-
- while (1) {
- rtems_event_set events;
-
- rtems_bsdnet_event_receive (RECEIVE_EVENT,
- RTEMS_WAIT | RTEMS_EVENT_ANY,
- RTEMS_NO_TIMEOUT, &events);
-
- while (1) {
- struct ether_header *eh;
- struct mbuf *m;
-
- rtems_interrupt_disable (level);
- if (softc.recvq.ifq_head == NULL) {
- rtems_interrupt_enable (level);
- break;
- }
-
- /* get next packet */
- IF_DEQUEUE (&softc.recvq, m);
- rtems_interrupt_enable (level);
- if (m == NULL) {
- panic ("wifi_rxd");
- }
-
- m->m_pkthdr.rcvif = ifp;
-
- /* extract ethernet header */
- eh = mtod (m, struct ether_header *);
- m->m_data += sizeof (struct ether_header);
- m->m_len = m->m_pkthdr.len = m->m_len - sizeof (struct ether_header);
-
- /* push the packet into the stack */
- ether_input (ifp, eh, m);
- }
- }
-}
-
-/*
- * packet sending daemon
- */
-
-static void
-wifi_txd (void *arg)
-{
- rtems_interrupt_level level;
- struct ifnet *ifp = &softc.arpcom.ac_if;
-
- while (1) {
- rtems_event_set events;
-
- rtems_bsdnet_event_receive (TRANSMIT_EVENT,
- RTEMS_WAIT | RTEMS_EVENT_ANY,
- RTEMS_NO_TIMEOUT, &events);
- while (1) {
- struct mbuf *m;
-
- rtems_interrupt_disable (level);
- if (ifp->if_snd.ifq_head == NULL) {
- ifp->if_flags &= ~IFF_OACTIVE;
- rtems_interrupt_enable (level);
- break;
- }
-
- /* grab next packet */
- IF_DEQUEUE (&ifp->if_snd, m);
- rtems_interrupt_enable (level);
-
- if (m == NULL) {
- panic ("wifi_txd");
- }
-
- /* call compatibility glue to dswifi */
- compat_wifi_output (m);
- }
- }
-}
-
-/*
- * wifi device initialization procedure
- */
-
-static void
-wifi_init (void *arg)
-{
- struct ifnet *ifp = &softc.arpcom.ac_if;
- int i;
-
- /* create the receive & send daemons */
- if (softc.tx_id == 0) {
- Wifi_AutoConnect ();
-
- while (1) {
- i = Wifi_AssocStatus ();
- if (i == ASSOCSTATUS_ASSOCIATED) {
- printk ("Connected successfully!\n");
- break;
- }
- if (i == ASSOCSTATUS_CANNOTCONNECT) {
- printk ("Could not connect!\n");
- break;
- }
- }
-
- printk ("Starting daemon\n");
- softc.tx_id = rtems_bsdnet_newproc ("SCtx", 4096, wifi_txd, &softc);
- softc.rx_id = rtems_bsdnet_newproc ("SCrx", 4096, wifi_rxd, &softc);
- }
-
- ifp->if_flags |= IFF_RUNNING;
-}
-
-/*
- * wifi deactivation method.
- */
-
-static void
-wifi_shutdown (void *arg)
-{
- /* XXX */
-}
-
-/*
- * ioctl hook function.
- */
-
-static int
-wifi_ioctl (struct ifnet *ifp, ioctl_command_t command, caddr_t data)
-{
- void *sc = ifp->if_softc;
-
- switch (command) {
- case SIOCGIFADDR:
- case SIOCSIFADDR:
- return ether_ioctl (ifp, command, data);
-
- case SIOCSIFFLAGS:
- switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) {
- case IFF_RUNNING:
- wifi_shutdown (sc);
- break;
- case IFF_UP:
- wifi_init (sc);
- break;
- case IFF_UP | IFF_RUNNING:
- wifi_shutdown (sc);
- wifi_init (sc);
- break;
- default:
- break;
- }
- return 0;
-
- default:
- return EINVAL;
- }
-}
-
-/*
- * function for sending a packet
- */
-
-static void
-wifi_start (struct ifnet *ifp)
-{
- /* wake up the send daemon */
- ifp->if_flags |= IFF_OACTIVE;
- rtems_bsdnet_event_send (softc.tx_id, TRANSMIT_EVENT);
-}
-
-/*
- * RTEMS device attach method for wiwi driver
- */
-
-int
-rtems_wifi_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
-{
- struct ifnet *ifp = &softc.arpcom.ac_if;
-
- printk ("wifi attach...\n");
-
- /* initialize ifnet structure */
- memset (&softc, 0, sizeof (softc));
- ifp->if_softc = &softc;
- ifp->if_unit = 0;
- ifp->if_name = "dswifi";
- ifp->if_mtu = ETHERMTU;
- ifp->if_init = wifi_init;
- ifp->if_ioctl = wifi_ioctl;
- ifp->if_watchdog = NULL;
- ifp->if_start = wifi_start;
- ifp->if_output = ether_output;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
- if (ifp->if_snd.ifq_maxlen == 0) {
- ifp->if_snd.ifq_maxlen = ifqmaxlen;
- }
-
- if (config->mtu != 0) {
- ifp->if_mtu = config->mtu;
- }
-
- if (config->hardware_address != NULL) {
- softc.is_hwaddr_set = 1;
- memcpy (softc.arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN);
- } else {
- softc.is_hwaddr_set = 0;
- }
-
- u32 Wifi_pass;
- int i;
-
- /* wifi hardware initialization took from dswifi example code */
-
- /* send fifo message to initialize the arm7 wifi */
- REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
-
- Wifi_pass =
- Wifi_Init (WIFIINIT_OPTION_USELED | WIFIINIT_OPTION_USECUSTOMALLOC);
- REG_IPC_FIFO_TX = 0x12345678;
- REG_IPC_FIFO_TX = Wifi_pass;
-
- /* setup fifo IRQ */
- irqSet (IRQ_FIFO_NOT_EMPTY, arm9_fifo);
- irqEnable (IRQ_FIFO_NOT_EMPTY);
-
- /* enable FIFO IRQ */
- REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ;
-
- /* tell wifi lib to use our handler to notify arm7 */
- Wifi_SetSyncHandler (arm9_synctoarm7);
-
- /* set timer3 */
- TIMER3_DATA = -6553; // 6553.1 * 256 cycles = ~50ms;
- TIMER3_CR = 0x00C2; // enable, irq, 1/256 clock
-
- /* setup timer IRQ */
- irqSet (IRQ_TIMER3, Timer_50ms);
- irqEnable (IRQ_TIMER3);
-
- while (Wifi_CheckInit () == 0) {
- /* wait for arm7 to be initted successfully */
- while (REG_VCOUNT > 192);
- while (REG_VCOUNT < 192);
- }
-
- /* wifi init complete - wifi lib can now be used! */
-
- printk ("ok.\n");
-
- /* retrieve MAC address if unspecified by the user */
- if (!softc.is_hwaddr_set) {
- Wifi_GetData (WIFIGETDATA_MACADDRESS, ETHER_ADDR_LEN,
- softc.arpcom.ac_enaddr);
- }
-
- print_byte (softc.arpcom.ac_enaddr[0]);
- for (i = 1; i < ETHER_ADDR_LEN; i++) {
- printk (":");
- print_byte (softc.arpcom.ac_enaddr[i]);
- }
- printk ("\n");
-
- /* attach the interface */
- if_attach (ifp);
- ether_ifattach (ifp);
-
- printk ("network device '%s' initialized\n", config->name);
-
- return 0;
-}