summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CVSROOT/checkoutlist14
-rw-r--r--CVSROOT/commitinfo15
-rw-r--r--CVSROOT/config14
-rw-r--r--CVSROOT/cvswrappers23
-rw-r--r--CVSROOT/editinfo21
-rw-r--r--CVSROOT/loginfo35
-rw-r--r--CVSROOT/modules31
-rw-r--r--CVSROOT/notify12
-rw-r--r--CVSROOT/rcsinfo13
-rwxr-xr-xCVSROOT/syncmail217
-rw-r--r--CVSROOT/taginfo20
-rw-r--r--CVSROOT/verifymsg21
-rw-r--r--apps/codecs/libmusepack/config.h105
-rw-r--r--apps/credits.c131
-rw-r--r--apps/credits.h28
-rw-r--r--apps/credits.pl (renamed from flash/uart_boot/Makefile)16
-rw-r--r--apps/plugins/a52towav.c208
-rw-r--r--apps/plugins/codecmpa.c404
-rw-r--r--apps/plugins/codecvorbis.c161
-rw-r--r--apps/plugins/flac2wav.c237
-rw-r--r--apps/plugins/lib/codeclib.c37
-rw-r--r--apps/plugins/lib/codeclib.h46
-rw-r--r--apps/plugins/lib/gray_black_display.c44
-rw-r--r--apps/plugins/lib/gray_blockfuncs.c262
-rw-r--r--apps/plugins/lib/gray_clear_display.c44
-rw-r--r--apps/plugins/lib/gray_deferred_update.c50
-rw-r--r--apps/plugins/lib/gray_drawbitmap.c116
-rw-r--r--apps/plugins/lib/gray_drawgraymap.c275
-rw-r--r--apps/plugins/lib/gray_drawline.c119
-rw-r--r--apps/plugins/lib/gray_drawpixel.c55
-rw-r--r--apps/plugins/lib/gray_drawrect.c62
-rw-r--r--apps/plugins/lib/gray_fillrect.c92
-rw-r--r--apps/plugins/lib/gray_getstringsize.c64
-rw-r--r--apps/plugins/lib/gray_horline.c65
-rw-r--r--apps/plugins/lib/gray_pixelfuncs.c245
-rw-r--r--apps/plugins/lib/gray_position_display.c57
-rw-r--r--apps/plugins/lib/gray_putsxy.c67
-rw-r--r--apps/plugins/lib/gray_screendump.c141
-rw-r--r--apps/plugins/lib/gray_scroll_down.c134
-rw-r--r--apps/plugins/lib/gray_scroll_down8.c69
-rw-r--r--apps/plugins/lib/gray_scroll_left.c100
-rw-r--r--apps/plugins/lib/gray_scroll_right.c100
-rw-r--r--apps/plugins/lib/gray_scroll_up.c135
-rw-r--r--apps/plugins/lib/gray_scroll_up8.c69
-rw-r--r--apps/plugins/lib/gray_set_background.c48
-rw-r--r--apps/plugins/lib/gray_set_drawinfo.c49
-rw-r--r--apps/plugins/lib/gray_set_drawmode.c52
-rw-r--r--apps/plugins/lib/gray_set_foreground.c48
-rw-r--r--apps/plugins/lib/gray_setfont.c47
-rw-r--r--apps/plugins/lib/gray_verline.c88
-rw-r--r--apps/plugins/lib/xxx2wav.c259
-rw-r--r--apps/plugins/lib/xxx2wav.h67
-rw-r--r--apps/plugins/mpa2wav.c269
-rw-r--r--apps/plugins/mpc2wav.c208
-rw-r--r--apps/plugins/rockboy/cpu.h59
-rw-r--r--apps/plugins/rockboy/lcd.h78
-rw-r--r--apps/plugins/rockboy/rtc.h25
-rw-r--r--apps/plugins/vorbis2wav.c180
-rw-r--r--apps/plugins/wv2wav.c217
-rw-r--r--bootloader/FILES4
-rw-r--r--bootloader/Makefile85
-rw-r--r--bootloader/SOURCES1
-rw-r--r--bootloader/main.c365
-rw-r--r--firmware/drivers/i2c-h100.c166
-rw-r--r--firmware/export/i2c-h100.h64
-rw-r--r--firmware/fonts/clR6x8.bdf2895
-rw-r--r--firmware/win32.mak83
-rw-r--r--flash/FILES19
-rw-r--r--flash/README7
-rw-r--r--flash/bootbox/FILES4
-rw-r--r--flash/bootbox/Makefile87
-rw-r--r--flash/bootbox/SOURCES1
-rw-r--r--flash/bootbox/main.c259
-rw-r--r--flash/bootloader/Makefile78
-rw-r--r--flash/bootloader/README4
-rw-r--r--flash/bootloader/bootloader.c516
-rw-r--r--flash/bootloader/bootloader.h125
-rw-r--r--flash/bootloader/bootloader.lds34
-rw-r--r--flash/bootloader/no_rom.lds62
-rw-r--r--flash/extract/README5
-rw-r--r--flash/extract/extract.c145
-rw-r--r--flash/extract/extract.dsp100
-rw-r--r--flash/make_firmware/README14
-rw-r--r--flash/make_firmware/make_firmware.c357
-rw-r--r--flash/make_firmware/make_firmware.dsp96
-rw-r--r--flash/minimon/Makefile53
-rw-r--r--flash/minimon/README6
-rw-r--r--flash/minimon/minimon.c156
-rw-r--r--flash/minimon/minimon.h24
-rw-r--r--flash/minimon/minimon.lds60
-rw-r--r--flash/uart_boot/README8
-rw-r--r--flash/uart_boot/client.c737
-rw-r--r--flash/uart_boot/client.h22
-rw-r--r--flash/uart_boot/flash.c78
-rw-r--r--flash/uart_boot/flash.h10
-rw-r--r--flash/uart_boot/minimon.h24
-rw-r--r--flash/uart_boot/scalar_types.h45
-rw-r--r--flash/uart_boot/uart.h57
-rw-r--r--flash/uart_boot/uart_boot.c370
-rw-r--r--flash/uart_boot/uart_boot.dsp130
-rw-r--r--flash/uart_boot/uart_win.c139
-rw-r--r--gdb/FILES3
-rw-r--r--gdb/Makefile43
-rw-r--r--gdb/README95
-rw-r--r--gdb/linker.cfg28
-rw-r--r--gdb/sh-stub.c1616
-rw-r--r--gdb/start.s41
-rw-r--r--songdbj/AlbumEntry.java76
-rw-r--r--songdbj/ArtistEntry.java56
-rw-r--r--songdbj/Entry.java14
-rw-r--r--songdbj/FileEntry.java155
-rw-r--r--songdbj/MpegInfo.java367
-rw-r--r--songdbj/OggVorbisInfo.java311
-rw-r--r--songdbj/RundbEntry.java28
-rw-r--r--songdbj/RuntimeDatabase.java81
-rw-r--r--songdbj/SongDB.java74
-rw-r--r--songdbj/SongEntry.java167
-rw-r--r--songdbj/TagDatabase.java377
-rw-r--r--songdbj/TagInfo.java112
-rwxr-xr-xsongdbj/build.sh2
-rw-r--r--songdbj/classes/META-INF/MANIFEST.MF4
-rw-r--r--songdbj/classes/META-INF/services/javax.sound.sampled.spi.AudioFileReader4
-rw-r--r--songdbj/classes/META-INF/services/javax.sound.sampled.spi.FormatConversionProvider3
-rw-r--r--songdbj/com/jcraft/jogg/Buffer.java541
-rw-r--r--songdbj/com/jcraft/jogg/Packet.java82
-rw-r--r--songdbj/com/jcraft/jogg/Page.java973
-rw-r--r--songdbj/com/jcraft/jogg/StreamState.java657
-rw-r--r--songdbj/com/jcraft/jogg/SyncState.java275
-rw-r--r--songdbj/com/jcraft/jorbis/AllocChain.java31
-rw-r--r--songdbj/com/jcraft/jorbis/Block.java188
-rw-r--r--songdbj/com/jcraft/jorbis/ChainingExample.java61
-rw-r--r--songdbj/com/jcraft/jorbis/CodeBook.java742
-rw-r--r--songdbj/com/jcraft/jorbis/Comment.java252
-rw-r--r--songdbj/com/jcraft/jorbis/DecodeExample.java316
-rw-r--r--songdbj/com/jcraft/jorbis/Drft.java1317
-rw-r--r--songdbj/com/jcraft/jorbis/DspState.java459
-rw-r--r--songdbj/com/jcraft/jorbis/EncodeAuxNearestMatch.java36
-rw-r--r--songdbj/com/jcraft/jorbis/EncodeAuxThreshMatch.java33
-rw-r--r--songdbj/com/jcraft/jorbis/Floor0.java352
-rw-r--r--songdbj/com/jcraft/jorbis/Floor1.java653
-rw-r--r--songdbj/com/jcraft/jorbis/FuncFloor.java45
-rw-r--r--songdbj/com/jcraft/jorbis/FuncMapping.java40
-rw-r--r--songdbj/com/jcraft/jorbis/FuncResidue.java43
-rw-r--r--songdbj/com/jcraft/jorbis/FuncTime.java40
-rw-r--r--songdbj/com/jcraft/jorbis/Info.java516
-rw-r--r--songdbj/com/jcraft/jorbis/InfoMode.java33
-rw-r--r--songdbj/com/jcraft/jorbis/JOrbisException.java35
-rw-r--r--songdbj/com/jcraft/jorbis/Lookup.java154
-rw-r--r--songdbj/com/jcraft/jorbis/Lpc.java254
-rw-r--r--songdbj/com/jcraft/jorbis/Lsp.java111
-rw-r--r--songdbj/com/jcraft/jorbis/Mapping0.java566
-rw-r--r--songdbj/com/jcraft/jorbis/Mdct.java249
-rw-r--r--songdbj/com/jcraft/jorbis/PsyInfo.java72
-rw-r--r--songdbj/com/jcraft/jorbis/PsyLook.java187
-rw-r--r--songdbj/com/jcraft/jorbis/Residue0.java454
-rw-r--r--songdbj/com/jcraft/jorbis/Residue1.java51
-rw-r--r--songdbj/com/jcraft/jorbis/Residue2.java44
-rw-r--r--songdbj/com/jcraft/jorbis/StaticCodeBook.java588
-rw-r--r--songdbj/com/jcraft/jorbis/Time0.java38
-rw-r--r--songdbj/com/jcraft/jorbis/VorbisFile.java1361
-rw-r--r--songdbj/com/jcraft/jorbis/VorbisFile.java.new1240
-rw-r--r--songdbj/de/jarnbjo/ogg/BasicStream.java121
-rw-r--r--songdbj/de/jarnbjo/ogg/CachedUrlStream.java252
-rw-r--r--songdbj/de/jarnbjo/ogg/EndOfOggStreamException.java45
-rw-r--r--songdbj/de/jarnbjo/ogg/FileStream.java154
-rw-r--r--songdbj/de/jarnbjo/ogg/LogicalOggStream.java151
-rw-r--r--songdbj/de/jarnbjo/ogg/LogicalOggStreamImpl.java213
-rw-r--r--songdbj/de/jarnbjo/ogg/OggFormatException.java50
-rw-r--r--songdbj/de/jarnbjo/ogg/OggPage.java431
-rw-r--r--songdbj/de/jarnbjo/ogg/OnDemandUrlStream.java127
-rw-r--r--songdbj/de/jarnbjo/ogg/PhysicalOggStream.java124
-rw-r--r--songdbj/de/jarnbjo/ogg/UncachedUrlStream.java207
-rw-r--r--songdbj/de/jarnbjo/util/audio/FadeableAudioInputStream.java62
-rw-r--r--songdbj/de/jarnbjo/util/io/BitInputStream.java185
-rw-r--r--songdbj/de/jarnbjo/util/io/ByteArrayBitInputStream.java352
-rw-r--r--songdbj/de/jarnbjo/util/io/HuffmanNode.java144
-rw-r--r--songdbj/de/jarnbjo/vorbis/AudioPacket.java328
-rw-r--r--songdbj/de/jarnbjo/vorbis/CodeBook.java275
-rw-r--r--songdbj/de/jarnbjo/vorbis/CommentHeader.java244
-rw-r--r--songdbj/de/jarnbjo/vorbis/Floor.java124
-rw-r--r--songdbj/de/jarnbjo/vorbis/Floor0.java74
-rw-r--r--songdbj/de/jarnbjo/vorbis/Floor1.java324
-rw-r--r--songdbj/de/jarnbjo/vorbis/IdentificationHeader.java120
-rw-r--r--songdbj/de/jarnbjo/vorbis/Mapping.java59
-rw-r--r--songdbj/de/jarnbjo/vorbis/Mapping0.java146
-rw-r--r--songdbj/de/jarnbjo/vorbis/MdctFloat.java321
-rw-r--r--songdbj/de/jarnbjo/vorbis/Mode.java75
-rw-r--r--songdbj/de/jarnbjo/vorbis/Residue.java260
-rw-r--r--songdbj/de/jarnbjo/vorbis/Residue0.java53
-rw-r--r--songdbj/de/jarnbjo/vorbis/Residue1.java55
-rw-r--r--songdbj/de/jarnbjo/vorbis/Residue2.java123
-rw-r--r--songdbj/de/jarnbjo/vorbis/SetupHeader.java131
-rw-r--r--songdbj/de/jarnbjo/vorbis/Util.java127
-rw-r--r--songdbj/de/jarnbjo/vorbis/VorbisAudioFileReader.java217
-rw-r--r--songdbj/de/jarnbjo/vorbis/VorbisFormatException.java51
-rw-r--r--songdbj/de/jarnbjo/vorbis/VorbisStream.java247
-rw-r--r--songdbj/entagged/audioformats/AudioFile.java186
-rw-r--r--songdbj/entagged/audioformats/EncodingInfo.java116
-rw-r--r--songdbj/entagged/audioformats/Tag.java116
-rw-r--r--songdbj/entagged/audioformats/asf/AsfFileReader.java112
-rw-r--r--songdbj/entagged/audioformats/asf/data/AsfHeader.java279
-rw-r--r--songdbj/entagged/audioformats/asf/data/AudioStreamChunk.java292
-rw-r--r--songdbj/entagged/audioformats/asf/data/Chunk.java135
-rw-r--r--songdbj/entagged/audioformats/asf/data/ContentDescription.java251
-rw-r--r--songdbj/entagged/audioformats/asf/data/ContentDescriptor.java517
-rw-r--r--songdbj/entagged/audioformats/asf/data/EncodingChunk.java95
-rw-r--r--songdbj/entagged/audioformats/asf/data/ExtendedContentDescription.java299
-rw-r--r--songdbj/entagged/audioformats/asf/data/FileHeader.java235
-rw-r--r--songdbj/entagged/audioformats/asf/data/GUID.java329
-rw-r--r--songdbj/entagged/audioformats/asf/data/StreamChunk.java173
-rw-r--r--songdbj/entagged/audioformats/asf/data/VideoStreamChunk.java98
-rw-r--r--songdbj/entagged/audioformats/asf/data/wrapper/ContentDescriptorTagField.java130
-rw-r--r--songdbj/entagged/audioformats/asf/io/AsfHeaderReader.java178
-rw-r--r--songdbj/entagged/audioformats/asf/io/ChunkHeaderReader.java57
-rw-r--r--songdbj/entagged/audioformats/asf/io/ContentDescriptionReader.java175
-rw-r--r--songdbj/entagged/audioformats/asf/io/EncodingChunkReader.java118
-rw-r--r--songdbj/entagged/audioformats/asf/io/ExtContentDescReader.java182
-rw-r--r--songdbj/entagged/audioformats/asf/io/FileHeaderReader.java116
-rw-r--r--songdbj/entagged/audioformats/asf/io/StreamChunkReader.java187
-rw-r--r--songdbj/entagged/audioformats/asf/util/ChunkPositionComparator.java52
-rw-r--r--songdbj/entagged/audioformats/asf/util/TagConverter.java234
-rw-r--r--songdbj/entagged/audioformats/asf/util/Utils.java306
-rw-r--r--songdbj/entagged/audioformats/exceptions/CannotReadException.java33
-rw-r--r--songdbj/entagged/audioformats/exceptions/CannotWriteException.java33
-rw-r--r--songdbj/entagged/audioformats/generic/AbstractTag.java308
-rw-r--r--songdbj/entagged/audioformats/generic/AbstractTagCreator.java66
-rw-r--r--songdbj/entagged/audioformats/generic/AudioFileReader.java126
-rw-r--r--songdbj/entagged/audioformats/generic/GenericTag.java133
-rw-r--r--songdbj/entagged/audioformats/generic/OldTag.java382
-rw-r--r--songdbj/entagged/audioformats/generic/TagField.java43
-rw-r--r--songdbj/entagged/audioformats/generic/TagTextField.java33
-rw-r--r--songdbj/entagged/audioformats/generic/Utils.java95
-rw-r--r--songdbj/javazoom/jl/converter/Converter.java411
-rw-r--r--songdbj/javazoom/jl/converter/RiffFile.java495
-rw-r--r--songdbj/javazoom/jl/converter/WaveFile.java522
-rw-r--r--songdbj/javazoom/jl/converter/WaveFileObuffer.java141
-rw-r--r--songdbj/javazoom/jl/converter/jlc.java216
-rw-r--r--songdbj/javazoom/jl/decoder/BitReserve.java223
-rw-r--r--songdbj/javazoom/jl/decoder/Bitstream.java655
-rw-r--r--songdbj/javazoom/jl/decoder/BitstreamErrors.java72
-rw-r--r--songdbj/javazoom/jl/decoder/BitstreamException.java71
-rw-r--r--songdbj/javazoom/jl/decoder/Control.java57
-rw-r--r--songdbj/javazoom/jl/decoder/Crc16.java70
-rw-r--r--songdbj/javazoom/jl/decoder/Decoder.java357
-rw-r--r--songdbj/javazoom/jl/decoder/DecoderErrors.java38
-rw-r--r--songdbj/javazoom/jl/decoder/DecoderException.java61
-rw-r--r--songdbj/javazoom/jl/decoder/Equalizer.java227
-rw-r--r--songdbj/javazoom/jl/decoder/FrameDecoder.java38
-rw-r--r--songdbj/javazoom/jl/decoder/Header.java762
-rw-r--r--songdbj/javazoom/jl/decoder/InputStreamSource.java80
-rw-r--r--songdbj/javazoom/jl/decoder/JavaLayerError.java31
-rw-r--r--songdbj/javazoom/jl/decoder/JavaLayerErrors.java40
-rw-r--r--songdbj/javazoom/jl/decoder/JavaLayerException.java80
-rw-r--r--songdbj/javazoom/jl/decoder/JavaLayerHook.java36
-rw-r--r--songdbj/javazoom/jl/decoder/JavaLayerUtils.java207
-rw-r--r--songdbj/javazoom/jl/decoder/LayerIDecoder.java444
-rw-r--r--songdbj/javazoom/jl/decoder/LayerIIDecoder.java1064
-rw-r--r--songdbj/javazoom/jl/decoder/LayerIIIDecoder.java2439
-rw-r--r--songdbj/javazoom/jl/decoder/Manager.java46
-rw-r--r--songdbj/javazoom/jl/decoder/Obuffer.java88
-rw-r--r--songdbj/javazoom/jl/decoder/OutputChannels.java143
-rw-r--r--songdbj/javazoom/jl/decoder/SampleBuffer.java132
-rw-r--r--songdbj/javazoom/jl/decoder/Source.java49
-rw-r--r--songdbj/javazoom/jl/decoder/SynthesisFilter.java1817
-rw-r--r--songdbj/javazoom/jl/decoder/au2lin.serbin539 -> 0 bytes
-rw-r--r--songdbj/javazoom/jl/decoder/huffcodetab.java600
-rw-r--r--songdbj/javazoom/jl/decoder/l3reorder.serbin13925 -> 0 bytes
-rw-r--r--songdbj/javazoom/jl/decoder/lin2au.serbin16411 -> 0 bytes
-rw-r--r--songdbj/javazoom/jl/decoder/readme.txt15
-rw-r--r--songdbj/javazoom/jl/decoder/sfd.serbin2075 -> 0 bytes
-rw-r--r--songdbj/javazoom/jl/player/AudioDevice.java103
-rw-r--r--songdbj/javazoom/jl/player/AudioDeviceBase.java177
-rw-r--r--songdbj/javazoom/jl/player/AudioDeviceFactory.java87
-rw-r--r--songdbj/javazoom/jl/player/FactoryRegistry.java129
-rw-r--r--songdbj/javazoom/jl/player/JavaSoundAudioDevice.java215
-rw-r--r--songdbj/javazoom/jl/player/JavaSoundAudioDeviceFactory.java85
-rw-r--r--songdbj/javazoom/jl/player/NullAudioDevice.java37
-rw-r--r--songdbj/javazoom/jl/player/Player.java251
-rw-r--r--songdbj/javazoom/jl/player/PlayerApplet.java246
-rw-r--r--songdbj/javazoom/jl/player/advanced/AdvancedPlayer.java242
-rw-r--r--songdbj/javazoom/jl/player/advanced/PlaybackEvent.java51
-rw-r--r--songdbj/javazoom/jl/player/advanced/PlaybackListener.java30
-rw-r--r--songdbj/javazoom/jl/player/advanced/jlap.java116
-rw-r--r--songdbj/javazoom/jl/player/jlp.java176
-rw-r--r--songdbj/javazoom/spi/PropertiesContainer.java31
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/convert/DecodedMpegAudioInputStream.java334
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/convert/MpegFormatConversionProvider.java120
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/IcyListener.java131
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/MpegAudioFileFormat.java103
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/MpegAudioFileReader.java772
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/MpegAudioFormat.java67
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/MpegEncoding.java47
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/MpegFileFormatType.java40
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/tag/IcyInputStream.java412
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/tag/IcyTag.java42
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/tag/MP3MetadataParser.java50
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/tag/MP3Tag.java52
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/tag/MP3TagParseSupport.java62
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/tag/StringableTag.java36
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/tag/TagParseEvent.java44
-rw-r--r--songdbj/javazoom/spi/mpeg/sampled/file/tag/TagParseListener.java37
-rw-r--r--songdbj/javazoom/spi/vorbis/sampled/convert/DecodedVorbisAudioInputStream.java519
-rw-r--r--songdbj/javazoom/spi/vorbis/sampled/convert/VorbisFormatConversionProvider.java244
-rw-r--r--songdbj/javazoom/spi/vorbis/sampled/file/VorbisAudioFileFormat.java85
-rw-r--r--songdbj/javazoom/spi/vorbis/sampled/file/VorbisAudioFileReader.java502
-rw-r--r--songdbj/javazoom/spi/vorbis/sampled/file/VorbisAudioFormat.java66
-rw-r--r--songdbj/javazoom/spi/vorbis/sampled/file/VorbisEncoding.java41
-rw-r--r--songdbj/javazoom/spi/vorbis/sampled/file/VorbisFileFormatType.java41
-rw-r--r--songdbj/net/shredzone/ifish/ltr/FormatDecodeException.java66
-rw-r--r--songdbj/net/shredzone/ifish/ltr/LTR.java251
-rw-r--r--songdbj/net/shredzone/ifish/ltr/LTRmp3.java165
-rw-r--r--songdbj/net/shredzone/ifish/ltr/OggFastFileStream.java249
-rw-r--r--songdbj/net/shredzone/ifish/ltr/TagAsf.java170
-rw-r--r--songdbj/net/shredzone/ifish/ltr/TagMp3v1.java184
-rw-r--r--songdbj/net/shredzone/ifish/ltr/TagMp3v2.java441
-rw-r--r--songdbj/net/shredzone/ifish/ltr/TagMp3v200.java373
-rw-r--r--songdbj/net/shredzone/ifish/ltr/TagOggVorbis.java207
-rw-r--r--songdbj/org/tritonus/file/AiffAudioFileReader.java244
-rw-r--r--songdbj/org/tritonus/file/AiffAudioFileWriter.java104
-rw-r--r--songdbj/org/tritonus/file/AiffAudioOutputStream.java205
-rw-r--r--songdbj/org/tritonus/file/AiffTool.java82
-rw-r--r--songdbj/org/tritonus/file/AuAudioFileReader.java185
-rw-r--r--songdbj/org/tritonus/file/AuAudioFileWriter.java104
-rw-r--r--songdbj/org/tritonus/file/AuAudioOutputStream.java121
-rw-r--r--songdbj/org/tritonus/file/AuTool.java95
-rw-r--r--songdbj/org/tritonus/file/WaveAudioFileReader.java300
-rw-r--r--songdbj/org/tritonus/file/WaveAudioFileWriter.java103
-rw-r--r--songdbj/org/tritonus/file/WaveAudioOutputStream.java201
-rw-r--r--songdbj/org/tritonus/file/WaveTool.java115
-rw-r--r--songdbj/org/tritonus/file/gsm/GSMAudioFileReader.java142
-rw-r--r--songdbj/org/tritonus/file/gsm/GSMAudioFileWriter.java77
-rw-r--r--songdbj/org/tritonus/file/gsm/package.html10
-rw-r--r--songdbj/org/tritonus/file/jorbis/JorbisAudioFileReader.java231
-rw-r--r--songdbj/org/tritonus/file/jorbis/package.html10
-rw-r--r--songdbj/org/tritonus/file/mpeg/MpegAudioFileWriter.java75
-rw-r--r--songdbj/org/tritonus/file/mpeg/package.html10
-rw-r--r--songdbj/org/tritonus/file/package.html10
-rw-r--r--songdbj/org/tritonus/file/pvorbis/VorbisAudioFileReader.java302
-rw-r--r--songdbj/org/tritonus/file/pvorbis/VorbisAudioFileWriter.java75
-rw-r--r--songdbj/org/tritonus/file/pvorbis/package.html12
-rw-r--r--songdbj/org/tritonus/file/vorbis/VorbisAudioFileReader.java302
-rw-r--r--songdbj/org/tritonus/file/vorbis/VorbisAudioFileWriter.java75
-rw-r--r--songdbj/org/tritonus/file/vorbis/package.html12
-rw-r--r--songdbj/org/tritonus/lowlevel/ogg/Buffer.java173
-rw-r--r--songdbj/org/tritonus/lowlevel/ogg/Ogg.java104
-rw-r--r--songdbj/org/tritonus/lowlevel/ogg/Packet.java113
-rw-r--r--songdbj/org/tritonus/lowlevel/ogg/Page.java131
-rw-r--r--songdbj/org/tritonus/lowlevel/ogg/StreamState.java143
-rw-r--r--songdbj/org/tritonus/lowlevel/ogg/SyncState.java127
-rw-r--r--songdbj/org/tritonus/lowlevel/ogg/package.html12
-rw-r--r--songdbj/org/tritonus/lowlevel/pogg/Buffer.java284
-rw-r--r--songdbj/org/tritonus/lowlevel/pogg/Ogg.java104
-rw-r--r--songdbj/org/tritonus/lowlevel/pogg/Packet.java133
-rw-r--r--songdbj/org/tritonus/lowlevel/pogg/Page.java298
-rw-r--r--songdbj/org/tritonus/lowlevel/pogg/StreamState.java703
-rw-r--r--songdbj/org/tritonus/lowlevel/pogg/SyncState.java339
-rw-r--r--songdbj/org/tritonus/lowlevel/pogg/package.html12
-rw-r--r--songdbj/org/tritonus/share/ArraySet.java87
-rw-r--r--songdbj/org/tritonus/share/GlobalInfo.java60
-rw-r--r--songdbj/org/tritonus/share/StringHashedSet.java112
-rw-r--r--songdbj/org/tritonus/share/TCircularBuffer.java268
-rw-r--r--songdbj/org/tritonus/share/TDebug.java192
-rw-r--r--songdbj/org/tritonus/share/TNotifier.java140
-rw-r--r--songdbj/org/tritonus/share/TSettings.java75
-rw-r--r--songdbj/org/tritonus/share/package.html10
-rw-r--r--songdbj/org/tritonus/share/sampled/AudioFileTypes.java155
-rw-r--r--songdbj/org/tritonus/share/sampled/AudioFormatSet.java155
-rw-r--r--songdbj/org/tritonus/share/sampled/AudioFormats.java131
-rw-r--r--songdbj/org/tritonus/share/sampled/AudioSystemShadow.java115
-rw-r--r--songdbj/org/tritonus/share/sampled/AudioUtils.java181
-rw-r--r--songdbj/org/tritonus/share/sampled/Encodings.java183
-rw-r--r--songdbj/org/tritonus/share/sampled/FloatSampleBuffer.java734
-rw-r--r--songdbj/org/tritonus/share/sampled/FloatSampleTools.java696
-rw-r--r--songdbj/org/tritonus/share/sampled/TAudioFormat.java110
-rw-r--r--songdbj/org/tritonus/share/sampled/TConversionTool.java1224
-rw-r--r--songdbj/org/tritonus/share/sampled/TVolumeUtils.java55
-rw-r--r--songdbj/org/tritonus/share/sampled/convert/TAsynchronousFilteredAudioInputStream.java256
-rw-r--r--songdbj/org/tritonus/share/sampled/convert/TAudioInputStream.java120
-rw-r--r--songdbj/org/tritonus/share/sampled/convert/TEncodingFormatConversionProvider.java129
-rw-r--r--songdbj/org/tritonus/share/sampled/convert/TFormatConversionProvider.java170
-rw-r--r--songdbj/org/tritonus/share/sampled/convert/TMatrixFormatConversionProvider.java182
-rw-r--r--songdbj/org/tritonus/share/sampled/convert/TSimpleFormatConversionProvider.java367
-rw-r--r--songdbj/org/tritonus/share/sampled/convert/TSynchronousFilteredAudioInputStream.java271
-rw-r--r--songdbj/org/tritonus/share/sampled/convert/package.html17
-rw-r--r--songdbj/org/tritonus/share/sampled/file/AudioOutputStream.java113
-rw-r--r--songdbj/org/tritonus/share/sampled/file/HeaderlessAudioOutputStream.java58
-rw-r--r--songdbj/org/tritonus/share/sampled/file/TAudioFileFormat.java113
-rw-r--r--songdbj/org/tritonus/share/sampled/file/TAudioFileReader.java510
-rw-r--r--songdbj/org/tritonus/share/sampled/file/TAudioFileWriter.java484
-rw-r--r--songdbj/org/tritonus/share/sampled/file/TAudioOutputStream.java197
-rw-r--r--songdbj/org/tritonus/share/sampled/file/TDataOutputStream.java79
-rw-r--r--songdbj/org/tritonus/share/sampled/file/THeaderlessAudioFileWriter.java84
-rw-r--r--songdbj/org/tritonus/share/sampled/file/TNonSeekableDataOutputStream.java109
-rw-r--r--songdbj/org/tritonus/share/sampled/file/TSeekableDataOutputStream.java86
-rw-r--r--songdbj/org/tritonus/share/sampled/file/package.html18
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TBaseDataLine.java107
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TBooleanControl.java128
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TClip.java340
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TCompoundControl.java90
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TCompoundControlType.java55
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TControlController.java98
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TControllable.java62
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TDataLine.java304
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TEnumControl.java92
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TFloatControl.java134
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TLine.java362
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TMixer.java506
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TMixerInfo.java56
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TMixerProvider.java240
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TPort.java77
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TSoftClip.java318
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/package.html14
-rw-r--r--songdbj/org/tritonus/share/sampled/package.html10
-rw-r--r--tools/fwpatcher/checksums.h6
-rw-r--r--uisimulator/win32/UI-v2.bmpbin0 -> 236864 bytes
-rw-r--r--uisimulator/win32/mpeg-win32.c (renamed from gdb/setjmp.S)50
-rw-r--r--www/Makefile47
-rw-r--r--www/activity.t42
-rw-r--r--www/bugs.t30
-rw-r--r--www/codes_new.pngbin2300 -> 0 bytes
-rw-r--r--www/codes_old.pngbin2460 -> 0 bytes
-rw-r--r--www/codes_rec.pngbin5221 -> 0 bytes
-rw-r--r--www/cross-gcc.t105
-rw-r--r--www/cvs.t132
-rw-r--r--www/daily.t50
-rwxr-xr-xwww/dailymod.pl63
-rwxr-xr-xwww/dailysrc.pl27
-rw-r--r--www/devcon/IMG_4083.JPGbin739023 -> 0 bytes
-rw-r--r--www/devcon/IMG_4084.JPGbin744194 -> 0 bytes
-rw-r--r--www/devcon/IMG_4085.JPGbin807416 -> 0 bytes
-rw-r--r--www/devcon/IMG_4086.JPGbin626454 -> 0 bytes
-rw-r--r--www/devcon/IMG_4087.JPGbin904011 -> 0 bytes
-rw-r--r--www/devcon/IMG_4088.JPGbin1012372 -> 0 bytes
-rw-r--r--www/devcon/IMG_4089.JPGbin1006566 -> 0 bytes
-rw-r--r--www/devcon/Makefile9
-rw-r--r--www/devcon/bildtext.txt5
-rw-r--r--www/devcon/img4083.jpgbin67794 -> 0 bytes
-rw-r--r--www/devcon/img4083t.jpgbin12444 -> 0 bytes
-rw-r--r--www/devcon/img4084.jpgbin80091 -> 0 bytes
-rw-r--r--www/devcon/img4084t.jpgbin16550 -> 0 bytes
-rw-r--r--www/devcon/img4085.jpgbin90051 -> 0 bytes
-rw-r--r--www/devcon/img4085t.jpgbin10035 -> 0 bytes
-rw-r--r--www/devcon/img4086.jpgbin56036 -> 0 bytes
-rw-r--r--www/devcon/img4086t.jpgbin12220 -> 0 bytes
-rw-r--r--www/devcon/img4087.jpgbin79846 -> 0 bytes
-rw-r--r--www/devcon/img4087t.jpgbin8665 -> 0 bytes
-rw-r--r--www/devcon/img4088.jpgbin112641 -> 0 bytes
-rw-r--r--www/devcon/img4088t.jpgbin11368 -> 0 bytes
-rw-r--r--www/devcon/img4089.jpgbin101347 -> 0 bytes
-rw-r--r--www/devcon/img4089t.jpgbin18188 -> 0 bytes
-rw-r--r--www/devcon/index.t132
-rw-r--r--www/digest/Makefile31
-rw-r--r--www/digest/digest.t4
-rw-r--r--www/digest/digestfoot.t8
-rw-r--r--www/digest/digesthead.t45
-rw-r--r--www/digest/index.t31
-rw-r--r--www/digest/log.t1103
-rw-r--r--www/digest/mail.t3
-rwxr-xr-xwww/digest/mailify.pl130
-rw-r--r--www/digest/news.t11
-rwxr-xr-xwww/digest/rssify.pl32
-rw-r--r--www/digest/valid-rss.pngbin1523 -> 0 bytes
-rw-r--r--www/docs/Help-JBR.txt81
-rw-r--r--www/docs/Help-Stu.txt62
-rw-r--r--www/docs/Makefile83
-rw-r--r--www/docs/battery-faq.t6
-rw-r--r--www/docs/contributing.t8
-rw-r--r--www/docs/credits.t11
-rw-r--r--www/docs/custom_wps_format.t8
-rw-r--r--www/docs/cygwin_sdk.t66
-rw-r--r--www/docs/datasheets.t51
-rw-r--r--www/docs/devicechart.t368
-rw-r--r--www/docs/faq.t6
-rw-r--r--www/docs/features.t349
-rw-r--r--www/docs/firsttime.t67
-rw-r--r--www/docs/flash.t418
-rw-r--r--www/docs/flash/rockbox-flash.jpgbin16430 -> 0 bytes
-rw-r--r--www/docs/flash/rockbox_flash_boot.avibin1591964 -> 0 bytes
-rw-r--r--www/docs/fmrecorder.jpgbin13254 -> 0 bytes
-rw-r--r--www/docs/fmrecorder_t.jpgbin1602 -> 0 bytes
-rw-r--r--www/docs/how_to_compile.t8
-rw-r--r--www/docs/index.t123
-rw-r--r--www/docs/lcd_new.gifbin43437 -> 0 bytes
-rw-r--r--www/docs/lcd_new_hw.gifbin41878 -> 0 bytes
-rw-r--r--www/docs/lcd_new_subst.gifbin43437 -> 0 bytes
-rw-r--r--www/docs/lcd_old.gifbin43437 -> 0 bytes
-rw-r--r--www/docs/lcd_old_hw.gifbin41878 -> 0 bytes
-rw-r--r--www/docs/lcd_old_subst.gifbin43437 -> 0 bytes
-rw-r--r--www/docs/license.t8
-rw-r--r--www/docs/mpeghdr.t761
-rw-r--r--www/docs/newplayer.jpgbin13526 -> 0 bytes
-rw-r--r--www/docs/newplayer_t.jpgbin1539 -> 0 bytes
-rw-r--r--www/docs/nodo.t6
-rw-r--r--www/docs/oldplayer.jpgbin12856 -> 0 bytes
-rw-r--r--www/docs/oldplayer_t.jpgbin1537 -> 0 bytes
-rw-r--r--www/docs/ondiofm.jpgbin10190 -> 0 bytes
-rw-r--r--www/docs/ondiofm_t.jpgbin1463 -> 0 bytes
-rwxr-xr-xwww/docs/ondiosp.jpgbin11085 -> 0 bytes
-rwxr-xr-xwww/docs/ondiosp_t.jpgbin1450 -> 0 bytes
-rw-r--r--www/docs/patch.t99
-rwxr-xr-xwww/docs/ports.t230
-rw-r--r--www/docs/recorder.jpgbin13911 -> 0 bytes
-rw-r--r--www/docs/recorder_t.jpgbin1556 -> 0 bytes
-rw-r--r--www/docs/repairbattery.t53
-rw-r--r--www/docs/repairlcd.t125
-rw-r--r--www/docs/rocklatin.t95
-rw-r--r--www/docs/rvf.t117
-rw-r--r--www/docs/solderjoints.jpgbin59916 -> 0 bytes
-rw-r--r--www/docs/solderjoints2.jpgbin81739 -> 0 bytes
-rw-r--r--www/docs/solderjoints2_t.jpgbin9141 -> 0 bytes
-rw-r--r--www/docs/solderjoints_t.jpgbin13878 -> 0 bytes
-rw-r--r--www/docs/tools.t407
-rw-r--r--www/download/Makefile9
-rw-r--r--www/download/index.t85
-rw-r--r--www/download/old.t15
-rw-r--r--www/example/Makefile40
-rw-r--r--www/example/README7
-rw-r--r--www/example/app.lds23
-rw-r--r--www/example/main.c102
-rw-r--r--www/example/start.s23
-rwxr-xr-xwww/faq2html.pl101
-rw-r--r--www/foot.t5
-rw-r--r--www/getbugs.pl18
-rw-r--r--www/head.t78
-rw-r--r--www/history.t211
-rwxr-xr-xwww/index.cgi41
-rw-r--r--www/indexbot.t1
-rw-r--r--www/indextop.t2
-rw-r--r--www/internals/6k_back.jpgbin264430 -> 0 bytes
-rw-r--r--www/internals/6k_back_t.jpgbin6081 -> 0 bytes
-rw-r--r--www/internals/6k_cpu.jpgbin366857 -> 0 bytes
-rw-r--r--www/internals/6k_cpu_t.jpgbin7715 -> 0 bytes
-rw-r--r--www/internals/6k_top.jpgbin226454 -> 0 bytes
-rw-r--r--www/internals/6k_top_t.jpgbin5668 -> 0 bytes
-rw-r--r--www/internals/Makefile9
-rw-r--r--www/internals/archos1.jpgbin44602 -> 0 bytes
-rw-r--r--www/internals/archos1t.jpgbin1761 -> 0 bytes
-rw-r--r--www/internals/archos2.jpgbin54035 -> 0 bytes
-rw-r--r--www/internals/archos2t.jpgbin1962 -> 0 bytes
-rw-r--r--www/internals/archos3.jpgbin55151 -> 0 bytes
-rw-r--r--www/internals/archos3t.jpgbin2017 -> 0 bytes
-rw-r--r--www/internals/archos4.jpgbin43599 -> 0 bytes
-rw-r--r--www/internals/archos4t.jpgbin1680 -> 0 bytes
-rw-r--r--www/internals/archos_b1.jpgbin1643 -> 0 bytes
-rw-r--r--www/internals/archos_b2.jpgbin1547 -> 0 bytes
-rw-r--r--www/internals/archos_bottom.jpgbin146414 -> 0 bytes
-rw-r--r--www/internals/archos_bottom2.jpgbin216721 -> 0 bytes
-rw-r--r--www/internals/archos_t1.jpgbin1703 -> 0 bytes
-rw-r--r--www/internals/archos_top.jpgbin205131 -> 0 bytes
-rw-r--r--www/internals/bjorn.t49
-rwxr-xr-xwww/internals/fmrec_bottom_hires.jpgbin1078009 -> 0 bytes
-rwxr-xr-xwww/internals/fmrec_bottom_thumb.jpgbin12449 -> 0 bytes
-rwxr-xr-xwww/internals/fmrec_top_hires.jpgbin295375 -> 0 bytes
-rwxr-xr-xwww/internals/fmrec_top_thumb.jpgbin11418 -> 0 bytes
-rw-r--r--www/internals/fmrecorder.t12
-rw-r--r--www/internals/index.t44
-rw-r--r--www/internals/lcd.jpgbin11210 -> 0 bytes
-rw-r--r--www/internals/micromusic_archos_jb20rec.jpgbin56870 -> 0 bytes
-rw-r--r--www/internals/rec_front.jpgbin35983 -> 0 bytes
-rw-r--r--www/internals/rec_front_t.jpgbin4865 -> 0 bytes
-rw-r--r--www/internals/rec_iface_bottom.jpgbin392501 -> 0 bytes
-rw-r--r--www/internals/rec_iface_bottom_t.jpgbin7453 -> 0 bytes
-rw-r--r--www/internals/rec_iface_top.jpgbin385065 -> 0 bytes
-rw-r--r--www/internals/rec_iface_top_t.jpgbin6288 -> 0 bytes
-rw-r--r--www/internals/rec_main_bottom.jpgbin444606 -> 0 bytes
-rw-r--r--www/internals/rec_main_bottom_t.jpgbin6410 -> 0 bytes
-rw-r--r--www/internals/rec_main_top.jpgbin524496 -> 0 bytes
-rw-r--r--www/internals/rec_main_top_t.jpgbin5996 -> 0 bytes
-rw-r--r--www/internals/rec_rear_bottom.jpgbin58534 -> 0 bytes
-rw-r--r--www/internals/rec_rear_bottom_t.jpgbin11412 -> 0 bytes
-rw-r--r--www/internals/rec_rear_top.jpgbin48707 -> 0 bytes
-rw-r--r--www/internals/rec_rear_top_t.jpgbin10284 -> 0 bytes
-rw-r--r--www/internals/recorder.t31
-rw-r--r--www/internals/remote.jpgbin41940 -> 0 bytes
-rw-r--r--www/internals/remote.t13
-rw-r--r--www/internals/remote_back.jpgbin74513 -> 0 bytes
-rw-r--r--www/internals/remote_back_t.jpgbin13575 -> 0 bytes
-rw-r--r--www/internals/remote_front.jpgbin155282 -> 0 bytes
-rw-r--r--www/internals/remote_front_t.jpgbin14147 -> 0 bytes
-rw-r--r--www/internals/remote_t.jpgbin10690 -> 0 bytes
-rw-r--r--www/internals/small-micromusic_archos_jb20rec.jpgbin8434 -> 0 bytes
-rw-r--r--www/internals/tjerk.t17
-rw-r--r--www/irc/Makefile14
-rw-r--r--www/irc/index.t25
-rwxr-xr-xwww/irc/irclogs.pl51
-rw-r--r--www/irc/nicks.txt28
-rw-r--r--www/lock.t65
-rw-r--r--www/mailbot.t1
-rw-r--r--www/mailtop.t2
-rw-r--r--www/main.t37
-rw-r--r--www/manual/Makefile9
-rw-r--r--www/manual/dir.t98
-rw-r--r--www/manual/general.t87
-rw-r--r--www/manual/index.t46
-rw-r--r--www/manual/manual.t2
-rw-r--r--www/manual/menu-buttons.t8
-rw-r--r--www/manual/menu.t26
-rw-r--r--www/manual/play-boot.pngbin182 -> 0 bytes
-rw-r--r--www/manual/play-keyboard-Naentered.pngbin4408 -> 0 bytes
-rw-r--r--www/manual/play-keyboard-Nselected.pngbin4348 -> 0 bytes
-rw-r--r--www/manual/play-keyboard-accept.pngbin4293 -> 0 bytes
-rw-r--r--www/manual/play-keyboard-initial.pngbin4379 -> 0 bytes
-rw-r--r--www/manual/play-keyboard.t94
-rw-r--r--www/manual/rec-boot.pngbin519 -> 0 bytes
-rw-r--r--www/manual/rec-dir.pngbin595 -> 0 bytes
-rw-r--r--www/manual/rec-folder.pngbin232 -> 0 bytes
-rw-r--r--www/manual/rec-generalsettings.pngbin1095 -> 0 bytes
-rw-r--r--www/manual/rec-logo.pngbin1146 -> 0 bytes
-rw-r--r--www/manual/rec-m3u.pngbin218 -> 0 bytes
-rw-r--r--www/manual/rec-menu.pngbin477 -> 0 bytes
-rw-r--r--www/manual/rec-mp3.pngbin219 -> 0 bytes
-rw-r--r--www/manual/rec-soundsettings.pngbin582 -> 0 bytes
-rw-r--r--www/manual/rec-volume.pngbin495 -> 0 bytes
-rw-r--r--www/manual/rec-wps.pngbin620 -> 0 bytes
-rw-r--r--www/manual/settings-buttons.t7
-rw-r--r--www/manual/sound.t41
-rw-r--r--www/manual/textreader.t29
-rw-r--r--www/manual/wormlet.t259
-rw-r--r--www/manual/wps.t78
-rw-r--r--www/mods/Makefile9
-rw-r--r--www/mods/a1.jpgbin21532 -> 0 bytes
-rw-r--r--www/mods/a2.jpgbin20480 -> 0 bytes
-rw-r--r--www/mods/a3.jpgbin29395 -> 0 bytes
-rw-r--r--www/mods/a4.jpgbin23848 -> 0 bytes
-rw-r--r--www/mods/a5.jpgbin22546 -> 0 bytes
-rw-r--r--www/mods/a6.jpgbin25673 -> 0 bytes
-rw-r--r--www/mods/a7.jpgbin25447 -> 0 bytes
-rw-r--r--www/mods/a7b.jpgbin173573 -> 0 bytes
-rw-r--r--www/mods/a8.jpgbin26878 -> 0 bytes
-rw-r--r--www/mods/a8b.jpgbin130002 -> 0 bytes
-rw-r--r--www/mods/b1.jpgbin14800 -> 0 bytes
-rw-r--r--www/mods/b10.jpgbin21364 -> 0 bytes
-rw-r--r--www/mods/b11.jpgbin20680 -> 0 bytes
-rw-r--r--www/mods/b2.jpgbin23452 -> 0 bytes
-rw-r--r--www/mods/b3.jpgbin15993 -> 0 bytes
-rw-r--r--www/mods/b4.jpgbin21351 -> 0 bytes
-rw-r--r--www/mods/b5.jpgbin16909 -> 0 bytes
-rw-r--r--www/mods/b6.jpgbin20017 -> 0 bytes
-rw-r--r--www/mods/b7.jpgbin14938 -> 0 bytes
-rw-r--r--www/mods/b8.jpgbin15200 -> 0 bytes
-rw-r--r--www/mods/b9.jpgbin22040 -> 0 bytes
-rw-r--r--www/mods/d1.jpgbin26254 -> 0 bytes
-rw-r--r--www/mods/disassemble.t31
-rw-r--r--www/mods/disassemble2.t40
-rw-r--r--www/mods/esd.jpgbin2869 -> 0 bytes
-rw-r--r--www/mods/harddisk.t8
-rw-r--r--www/mods/index.t37
-rw-r--r--www/mods/reassemble.t10
-rw-r--r--www/mods/rs232.t69
-rw-r--r--www/mods/rs232_board_bottom.pdfbin12291 -> 0 bytes
-rw-r--r--www/mods/rs232_board_bottom.pngbin3519 -> 0 bytes
-rw-r--r--www/mods/rs232_board_place.pdfbin31732 -> 0 bytes
-rw-r--r--www/mods/rs232_board_place.pngbin17233 -> 0 bytes
-rw-r--r--www/mods/rs232_board_top.pdfbin25325 -> 0 bytes
-rw-r--r--www/mods/rs232_board_top.pngbin5273 -> 0 bytes
-rw-r--r--www/mods/rs232_eagle.zipbin53332 -> 0 bytes
-rw-r--r--www/mods/rs232_schematic.pdfbin39865 -> 0 bytes
-rw-r--r--www/mods/rs232_schematic.pngbin18553 -> 0 bytes
-rw-r--r--www/mods/rs232_schematic_big.pngbin33249 -> 0 bytes
-rw-r--r--www/mods/serialport.t22
-rw-r--r--www/mods/toast.jpgbin17800 -> 0 bytes
-rw-r--r--www/notes.t424
-rw-r--r--www/patches.t11
-rw-r--r--www/requests.t18
-rw-r--r--www/rockbox100.pngbin4908 -> 0 bytes
-rw-r--r--www/rockbox400.pngbin12261 -> 0 bytes
-rw-r--r--www/schematics/6k_schematic.pdfbin42784 -> 0 bytes
-rw-r--r--www/schematics/Makefile9
-rw-r--r--www/schematics/PCB_composite_print.pdfbin45180 -> 0 bytes
-rw-r--r--www/schematics/PCB_final_print.pdfbin48622 -> 0 bytes
-rw-r--r--www/schematics/index.t13
-rw-r--r--www/schematics/rec_interface.pdfbin30626 -> 0 bytes
-rw-r--r--www/schematics/rec_main.pdfbin91899 -> 0 bytes
-rw-r--r--www/schematics/remoclone_schem.pdfbin9712 -> 0 bytes
-rw-r--r--www/screenshots.t24
-rw-r--r--www/screenshots/Makefile9
-rw-r--r--www/screenshots/boot.pngbin1502 -> 0 bytes
-rw-r--r--www/screenshots/bounce.pngbin1242 -> 0 bytes
-rw-r--r--www/screenshots/bounce2.pngbin1222 -> 0 bytes
-rw-r--r--www/screenshots/cube.pngbin944 -> 0 bytes
-rw-r--r--www/screenshots/dirbrowser.pngbin1463 -> 0 bytes
-rw-r--r--www/screenshots/dirbrowser2.pngbin1333 -> 0 bytes
-rw-r--r--www/screenshots/index.t48
-rw-r--r--www/screenshots/mainmenu-se.pngbin1461 -> 0 bytes
-rw-r--r--www/screenshots/mainmenu.pngbin1579 -> 0 bytes
-rw-r--r--www/screenshots/resume-se.pngbin1008 -> 0 bytes
-rw-r--r--www/screenshots/resume.pngbin940 -> 0 bytes
-rw-r--r--www/screenshots/snow.pngbin978 -> 0 bytes
-rw-r--r--www/screenshots/sokoban.pngbin1112 -> 0 bytes
-rw-r--r--www/screenshots/tetris.pngbin861 -> 0 bytes
-rw-r--r--www/screenshots/version.pngbin1690 -> 0 bytes
-rw-r--r--www/screenshots/version2.pngbin1472 -> 0 bytes
-rw-r--r--www/screenshots/wormlet.pngbin1398 -> 0 bytes
-rw-r--r--www/screenshots/wps.pngbin1555 -> 0 bytes
-rw-r--r--www/sh-win/LCDv2Win.zipbin64119 -> 0 bytes
-rw-r--r--www/sh-win/Makefile9
-rw-r--r--www/sh-win/empty.zipbin62684 -> 0 bytes
-rw-r--r--www/sh-win/enviro.jpgbin37913 -> 0 bytes
-rw-r--r--www/sh-win/enviro2.jpgbin36174 -> 0 bytes
-rw-r--r--www/sh-win/enviro3.jpgbin10242 -> 0 bytes
-rw-r--r--www/sh-win/index.t78
-rw-r--r--www/status.t17
-rw-r--r--www/style.css163
-rw-r--r--www/tools.t66
-rw-r--r--www/tshirt-contest/Makefile10
-rw-r--r--www/tshirt-contest/designs.t503
-rw-r--r--www/tshirt-contest/index.t22
-rw-r--r--www/tshirt-contest/vote.t9
-rw-r--r--www/tshirt-contest/winner/Makefile9
-rw-r--r--www/tshirt-contest/winner/index.t32
-rw-r--r--www/tshirt-contest/winner/rockbox400.pngbin12261 -> 0 bytes
-rw-r--r--www/tshirt-contest/winner/shirt-back.pngbin47711 -> 0 bytes
-rw-r--r--www/tshirt-contest/winner/tiny-back.pngbin39101 -> 0 bytes
-rw-r--r--www/tshirt-contest/winner/tiny-front.pngbin14484 -> 0 bytes
-rw-r--r--www/tshirt-contest/winner/votes33
-rwxr-xr-xwww/txt2html.pl28
-rw-r--r--www/usb-howto.t93
717 files changed, 8649 insertions, 79734 deletions
diff --git a/CVSROOT/checkoutlist b/CVSROOT/checkoutlist
deleted file mode 100644
index 4c45a691d0..0000000000
--- a/CVSROOT/checkoutlist
+++ /dev/null
@@ -1,14 +0,0 @@
-# The "checkoutlist" file is used to support additional version controlled
-# administrative files in $CVSROOT/CVSROOT, such as template files.
-#
-# The first entry on a line is a filename which will be checked out from
-# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
-# The remainder of the line is an error message to use if the file cannot
-# be checked out.
-#
-# File format:
-#
-# [<whitespace>]<filename><whitespace><error message><end-of-line>
-#
-# comment lines begin with '#'
-syncmail
diff --git a/CVSROOT/commitinfo b/CVSROOT/commitinfo
deleted file mode 100644
index b19e7b7a63..0000000000
--- a/CVSROOT/commitinfo
+++ /dev/null
@@ -1,15 +0,0 @@
-# The "commitinfo" file is used to control pre-commit checks.
-# The filter on the right is invoked with the repository and a list
-# of files to check. A non-zero exit of the filter program will
-# cause the commit to be aborted.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being committed to, relative
-# to the $CVSROOT. For the first match that is found, then the remainder
-# of the line is the name of the filter to run.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/config b/CVSROOT/config
deleted file mode 100644
index a1f3a82709..0000000000
--- a/CVSROOT/config
+++ /dev/null
@@ -1,14 +0,0 @@
-# Set this to "no" if pserver shouldn't check system users/passwords
-#SystemAuth=no
-
-# Set `PreservePermissions' to `yes' to save file status information
-# in the repository.
-#PreservePermissions=no
-
-# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
-# level of the new working directory when using the `cvs checkout'
-# command.
-#TopLevelAdmin=no
-
-# use new info format
-UseNewInfoFmtStrings=yes
diff --git a/CVSROOT/cvswrappers b/CVSROOT/cvswrappers
deleted file mode 100644
index 0accaf1b15..0000000000
--- a/CVSROOT/cvswrappers
+++ /dev/null
@@ -1,23 +0,0 @@
-# This file affects handling of files based on their names.
-#
-# The -t/-f options allow one to treat directories of files
-# as a single file, or to transform a file in other ways on
-# its way in and out of CVS.
-#
-# The -m option specifies whether CVS attempts to merge files.
-#
-# The -k option specifies keyword expansion (e.g. -kb for binary).
-#
-# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
-#
-# wildcard [option value][option value]...
-#
-# where option is one of
-# -f from cvs filter value: path to filter
-# -t to cvs filter value: path to filter
-# -m update methodology value: MERGE or COPY
-# -k expansion mode value: b, o, kkv, &c
-#
-# and value is a single-quote delimited value.
-# For example:
-#*.gif -k 'b'
diff --git a/CVSROOT/editinfo b/CVSROOT/editinfo
deleted file mode 100644
index d78886c152..0000000000
--- a/CVSROOT/editinfo
+++ /dev/null
@@ -1,21 +0,0 @@
-# The "editinfo" file is used to allow verification of logging
-# information. It works best when a template (as specified in the
-# rcsinfo file) is provided for the logging procedure. Given a
-# template with locations for, a bug-id number, a list of people who
-# reviewed the code before it can be checked in, and an external
-# process to catalog the differences that were code reviewed, the
-# following test can be applied to the code:
-#
-# Making sure that the entered bug-id number is correct.
-# Validating that the code that was reviewed is indeed the code being
-# checked in (using the bug-id number or a seperate review
-# number to identify this particular code set.).
-#
-# If any of the above test failed, then the commit would be aborted.
-#
-# Actions such as mailing a copy of the report to each reviewer are
-# better handled by an entry in the loginfo file.
-#
-# One thing that should be noted is the the ALL keyword is not
-# supported. There can be only one entry that matches a given
-# repository.
diff --git a/CVSROOT/loginfo b/CVSROOT/loginfo
deleted file mode 100644
index 934f570ec0..0000000000
--- a/CVSROOT/loginfo
+++ /dev/null
@@ -1,35 +0,0 @@
-# The "loginfo" file controls where "cvs commit" log information
-# is sent. The first entry on a line is a regular expression which must match
-# the directory that the change is being made to, relative to the
-# $CVSROOT. If a match is found, then the remainder of the line is a filter
-# program that should expect log information on its standard input.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name ALL appears as a regular expression it is always used
-# in addition to the first matching regex or DEFAULT.
-#
-# You may specify a format string as part of the
-# filter. The string is composed of a `%' followed
-# by a single format character, or followed by a set of format
-# characters surrounded by `{' and `}' as separators. The format
-# characters are:
-#
-# s = file name
-# V = old version number (pre-checkin)
-# v = new version number (post-checkin)
-#
-# For example:
-#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
-# or
-#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
-CVSROOT /usr/bin/syncmail -C4 -u %1{sVv} bjorn@haxx.se
-^apps /usr/bin/syncmail -C4 -u -S "$USER: " %1{sVv} rockbox-cvs@cool.haxx.se
-^flash /usr/bin/syncmail -C4 -u -S "$USER: " %1{sVv} rockbox-cvs@cool.haxx.se
-^firmware /usr/bin/syncmail -C4 -u -S "$USER: " %1{sVv} rockbox-cvs@cool.haxx.se
-^docs /usr/bin/syncmail -C4 -u -S "$USER: " %1{sVv} rockbox-cvs@cool.haxx.se
-^uisimulator /usr/bin/syncmail -C4 -u -S "$USER: " %1{sVv} rockbox-cvs@cool.haxx.se
-^tools /usr/bin/syncmail -C4 -u -S "$USER: " %1{sVv} rockbox-cvs@cool.haxx.se
-^gdb /usr/bin/syncmail -C4 -u -S "$USER: " %1{sVv} rockbox-cvs@cool.haxx.se
-^bootloader /usr/bin/syncmail -C4 -u -S "$USER: " %1{sVv} rockbox-cvs@cool.haxx.se
diff --git a/CVSROOT/modules b/CVSROOT/modules
deleted file mode 100644
index df07ee7178..0000000000
--- a/CVSROOT/modules
+++ /dev/null
@@ -1,31 +0,0 @@
-# Three different line formats are valid:
-# key -a aliases...
-# key [options] directory
-# key [options] directory files...
-#
-# Where "options" are composed of:
-# -i prog Run "prog" on "cvs commit" from top-level of module.
-# -o prog Run "prog" on "cvs checkout" of module.
-# -e prog Run "prog" on "cvs export" of module.
-# -t prog Run "prog" on "cvs rtag" of module.
-# -u prog Run "prog" on "cvs update" of module.
-# -d dir Place module in directory "dir" instead of module name.
-# -l Top-level directory only -- do not recurse.
-#
-# NOTE: If you change any of the "Run" options above, you'll have to
-# release and re-checkout any working directories of these modules.
-#
-# And "directory" is a path to a directory relative to $CVSROOT.
-#
-# The "-a" option specifies an alias. An alias is interpreted as if
-# everything on the right of the "-a" had been typed on the command line.
-#
-# You can encode a module within a module by using the special '&'
-# character to interpose another module into the current module. This
-# can be useful for creating a module that consists of many directories
-# spread out over the entire source repository.
-
-rockbox &apps &firmware &docs &tools &fonts
-rockbox-devel &apps &flash &firmware &fonts &bootloader &docs &tools &uisimulator &gdb
-rockbox-all &apps &flash &firmware &fonts &bootloader &docs &tools &uisimulator &gdb &www
-website &www &docs
diff --git a/CVSROOT/notify b/CVSROOT/notify
deleted file mode 100644
index 34f0bc2888..0000000000
--- a/CVSROOT/notify
+++ /dev/null
@@ -1,12 +0,0 @@
-# The "notify" file controls where notifications from watches set by
-# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
-# a regular expression which is tested against the directory that the
-# change is being made to, relative to the $CVSROOT. If it matches,
-# then the remainder of the line is a filter program that should contain
-# one occurrence of %s for the user to notify, and information on its
-# standard input.
-#
-# "ALL" or "DEFAULT" can be used in place of the regular expression.
-#
-# For example:
-#ALL mail %s -s "CVS notification"
diff --git a/CVSROOT/rcsinfo b/CVSROOT/rcsinfo
deleted file mode 100644
index 49e59f4d0d..0000000000
--- a/CVSROOT/rcsinfo
+++ /dev/null
@@ -1,13 +0,0 @@
-# The "rcsinfo" file is used to control templates with which the editor
-# is invoked on commit and import.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being made to, relative to the
-# $CVSROOT. For the first match that is found, then the remainder of the
-# line is the name of the file that contains the template.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/syncmail b/CVSROOT/syncmail
deleted file mode 100755
index fa24a8052a..0000000000
--- a/CVSROOT/syncmail
+++ /dev/null
@@ -1,217 +0,0 @@
-#! /usr/bin/python
-# -*- Python -*-
-
-"""Complicated notification for CVS checkins.
-
-This script is used to provide email notifications of changes to the CVS
-repository. These email changes will include context diffs of the changes.
-Really big diffs will be trimmed.
-
-This script is run from a CVS loginfo file (see $CVSROOT/CVSROOT/loginfo). To
-set this up, create a loginfo entry that looks something like this:
-
- mymodule /path/to/this/script %%s some-email-addr@your.domain
-
-In this example, whenever a checkin that matches `mymodule' is made, this
-script is invoked, which will generate the diff containing email, and send it
-to some-email-addr@your.domain.
-
- Note: This module used to also do repository synchronizations via
- rsync-over-ssh, but since the repository has been moved to SourceForge,
- this is no longer necessary. The syncing functionality has been ripped
- out in the 3.0, which simplifies it considerably. Access the 2.x versions
- to refer to this functionality. Because of this, the script is misnamed.
-
-It no longer makes sense to run this script from the command line. Doing so
-will only print out this usage information.
-
-Usage:
-
- %(PROGRAM)s [options] <%%S> email-addr [email-addr ...]
-
-Where options is:
-
- --cvsroot=<path>
-Use <path> as the environment variable CVSROOT. Otherwise this
- variable must exist in the environment.
-
- --help
- -h
- Print this text.
-
- --context=#
- -C #
- Include # lines of context around lines that differ (default: 2).
-
- -c
- Produce a context diff (default).
-
- -u
- Produce a unified diff (smaller, but harder to read).
-
- -U user
- Mark diff as made by user.
-
- <%%S>
-CVS %%s loginfo expansion. When invoked by CVS, this will be a single
- string containing the directory the checkin is being made in, relative
- to $CVSROOT, followed by the list of files that are changing. If the
- %%s in the loginfo file is %%{sVv}, context diffs for each of the
- modified files are included in any email messages that are generated.
-
- email-addrs
- At least one email address.
-
-"""
-
-import os
-import sys
-import string
-import time
-import getopt
-
-# Notification command
-MAILCMD = '/bin/mail -s "%(username)s: %(SUBJECT)s" %(PEOPLE)s 2>&1 > /dev/null'
-
-# Diff trimming stuff
-DIFF_HEAD_LINES = 20
-DIFF_TAIL_LINES = 20
-DIFF_TRUNCATE_IF_LARGER = 1000
-
-PROGRAM = sys.argv[0]
-
-
-
-def usage(code, msg=''):
- print __doc__ % globals()
- if msg:
- print msg
- sys.exit(code)
-
-
-
-def calculate_diff(filespec, contextlines):
- try:
- file, oldrev, newrev = string.split(filespec, ',')
- except ValueError:
- # No diff to report
- return '***** Bogus filespec: %s' % filespec
- if oldrev == 'NONE':
- try:
- if os.path.exists(file):
- fp = open(file)
- else:
- update_cmd = 'cvs -fn update -r %s -p %s' % (newrev, file)
- fp = os.popen(update_cmd)
- lines = fp.readlines()
- fp.close()
- lines.insert(0, '--- NEW FILE: %s ---\n' % file)
- except IOError, e:
- lines = ['***** Error reading new file: ',
- str(e), '\n***** file: ', file, ' cwd: ', os.getcwd()]
- elif newrev == 'NONE':
- lines = ['--- %s DELETED ---\n' % file]
- else:
- # This /has/ to happen in the background, otherwise we'll run into CVS
- # lock contention. What a crock.
- if contextlines > 0:
- difftype = "-C " + str(contextlines)
- else:
- difftype = "-uN"
- diffcmd = '/usr/bin/cvs -f diff -kk %s -b -r %s -r %s %s' % (
- difftype, oldrev, newrev, file)
- fp = os.popen(diffcmd)
- lines = fp.readlines()
- sts = fp.close()
- # ignore the error code, it always seems to be 1 :(
-## if sts:
-## return 'Error code %d occurred during diff\n' % (sts >> 8)
- if len(lines) > DIFF_TRUNCATE_IF_LARGER:
- removedlines = len(lines) - DIFF_HEAD_LINES - DIFF_TAIL_LINES
- del lines[DIFF_HEAD_LINES:-DIFF_TAIL_LINES]
- lines.insert(DIFF_HEAD_LINES,
- '[...%d lines suppressed...]\n' % removedlines)
- return string.join(lines, '')
-
-
-
-def blast_mail(mailcmd, filestodiff, contextlines):
- # cannot wait for child process or that will cause parent to retain cvs
- # lock for too long. Urg!
- if not os.fork():
- # in the child
- # give up the lock you cvs thang!
- time.sleep(2)
- fp = os.popen(mailcmd, 'w')
- fp.write(sys.stdin.read())
- fp.write('\n')
- # append the diffs if available
- for file in filestodiff:
- fp.write(calculate_diff(file, contextlines))
- fp.write('\n')
- fp.close()
- # doesn't matter what code we return, it isn't waited on
- os._exit(0)
-
-
-
-# scan args for options
-def main():
- contextlines = 2
- try:
- opts, args = getopt.getopt(sys.argv[1:], 'hC:cuU:',
- ['context=', 'cvsroot=', 'help'])
- except getopt.error, msg:
- usage(1, msg)
-
- username = 'unknown'
-
- # parse the options
- for opt, arg in opts:
- if opt in ('-h', '--help'):
- usage(0)
- elif opt == '--cvsroot':
- os.environ['CVSROOT'] = arg
- elif opt in ('-C', '--context'):
- contextlines = int(arg)
- elif opt == '-c':
- if contextlines <= 0:
- contextlines = 2
- elif opt == '-u':
- contextlines = 0
- elif opt == '-U':
- username = arg
-
- # What follows is the specification containing the files that were
- # modified. The argument actually must be split, with the first component
- # containing the directory the checkin is being made in, relative to
- # $CVSROOT, followed by the list of files that are changing.
- if not args:
- usage(1, 'No CVS module specified')
- SUBJECT = args[0]
- specs = string.split(args[0])
- del args[0]
-
- # The remaining args should be the email addresses
- if not args:
- usage(1, 'No recipients specified')
-
- # Now do the mail command
- PEOPLE = string.join(args)
- mailcmd = MAILCMD % vars()
-
- print 'Mailing %s...' % PEOPLE
- if specs == ['-', 'Imported', 'sources']:
- return
- if specs[-3:] == ['-', 'New', 'directory']:
- del specs[-3:]
- print 'Generating notification message...'
- blast_mail(mailcmd, specs[1:], contextlines)
- print 'Generating notification message... done.'
-
-
-
-if __name__ == '__main__':
- main()
- sys.exit(0)
-
diff --git a/CVSROOT/taginfo b/CVSROOT/taginfo
deleted file mode 100644
index 274a46dd5b..0000000000
--- a/CVSROOT/taginfo
+++ /dev/null
@@ -1,20 +0,0 @@
-# The "taginfo" file is used to control pre-tag checks.
-# The filter on the right is invoked with the following arguments:
-#
-# $1 -- tagname
-# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
-# $3 -- repository
-# $4-> file revision [file revision ...]
-#
-# A non-zero exit of the filter program will cause the tag to be aborted.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being committed to, relative
-# to the $CVSROOT. For the first match that is found, then the remainder
-# of the line is the name of the filter to run.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/verifymsg b/CVSROOT/verifymsg
deleted file mode 100644
index 86f747ce22..0000000000
--- a/CVSROOT/verifymsg
+++ /dev/null
@@ -1,21 +0,0 @@
-# The "verifymsg" file is used to allow verification of logging
-# information. It works best when a template (as specified in the
-# rcsinfo file) is provided for the logging procedure. Given a
-# template with locations for, a bug-id number, a list of people who
-# reviewed the code before it can be checked in, and an external
-# process to catalog the differences that were code reviewed, the
-# following test can be applied to the code:
-#
-# Making sure that the entered bug-id number is correct.
-# Validating that the code that was reviewed is indeed the code being
-# checked in (using the bug-id number or a seperate review
-# number to identify this particular code set.).
-#
-# If any of the above test failed, then the commit would be aborted.
-#
-# Actions such as mailing a copy of the report to each reviewer are
-# better handled by an entry in the loginfo file.
-#
-# One thing that should be noted is the the ALL keyword is not
-# supported. There can be only one entry that matches a given
-# repository.
diff --git a/apps/codecs/libmusepack/config.h b/apps/codecs/libmusepack/config.h
new file mode 100644
index 0000000000..8d764c4031
--- /dev/null
+++ b/apps/codecs/libmusepack/config.h
@@ -0,0 +1,105 @@
+/* include/config.h. Generated by configure. */
+/* include/config.h.in. Generated from configure.in by autoheader. */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if the system has the type `ptrdiff_t'. */
+#define HAVE_PTRDIFF_T 1
+
+/* Define to 1 if you have the `sqrt' function. */
+/* #undef HAVE_SQRT */
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if the system has the type `_Bool'. */
+#define HAVE__BOOL 1
+
+/* Name of package */
+#define PACKAGE "libmusepack"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* The size of a `long long', as computed by sizeof. */
+#define SIZEOF_LONG_LONG 8
+
+/* The size of a `short', as computed by sizeof. */
+#define SIZEOF_SHORT 2
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.1"
+
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `long' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/apps/credits.c b/apps/credits.c
new file mode 100644
index 0000000000..72a33cf3c5
--- /dev/null
+++ b/apps/credits.c
@@ -0,0 +1,131 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 by Robert Hak <rhak at ramapo.edu>
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "credits.h"
+#include "lcd.h"
+#include "font.h"
+#include "kernel.h"
+#include "button.h"
+#include "sprintf.h"
+#include "string.h"
+
+const char* const credits[] = {
+#include "credits.raw" /* generated list of names from docs/CREDITS */
+};
+
+#ifdef HAVE_LCD_CHARCELLS
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+void roll_credits(void)
+{
+ int numnames = sizeof(credits)/sizeof(char*);
+ int curr_name = 0;
+ int curr_len = strlen(credits[0]);
+ int curr_index = 0;
+ int curr_line = 0;
+ int name, len, new_len, line, x;
+
+ while (1)
+ {
+ lcd_clear_display();
+
+ name = curr_name;
+ x = -curr_index;
+ len = curr_len;
+ line = curr_line;
+
+ while (x < 11)
+ {
+ int x2;
+
+ if (x < 0)
+ lcd_puts(0, line, credits[name] - x);
+ else
+ lcd_puts(x, line, credits[name]);
+
+ if (++name >= numnames)
+ break;
+ line ^= 1;
+
+ x2 = x + len/2;
+ if ((unsigned)x2 < 11)
+ lcd_putc(x2, line, '*');
+
+ new_len = strlen(credits[name]);
+ x += MAX(len/2 + 2, len - new_len/2 + 1);
+ len = new_len;
+ }
+ /* abort on keypress */
+ if (button_get_w_tmo(HZ/8) & BUTTON_REL)
+ return;
+
+ if (++curr_index >= curr_len)
+ {
+ if (++curr_name >= numnames)
+ break;
+ new_len = strlen(credits[curr_name]);
+ curr_index -= MAX(curr_len/2 + 2, curr_len - new_len/2 + 1);
+ curr_len = new_len;
+ curr_line ^= 1;
+ }
+ }
+}
+#else
+
+void roll_credits(void)
+{
+ int i;
+ int line = 0;
+ int numnames = sizeof(credits)/sizeof(char*);
+ char buffer[40];
+
+ int y=LCD_HEIGHT;
+
+ int height;
+ int width;
+
+ lcd_setfont(FONT_UI);
+
+ lcd_getstringsize("A", &width, &height);
+
+ while(1) {
+ lcd_clear_display();
+ for ( i=0; i <= (LCD_HEIGHT-y)/height; i++ )
+ lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"");
+ snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ",
+ line+1, numnames);
+ lcd_clearrect(0, 0, LCD_WIDTH, height);
+ lcd_putsxy(0, 0, buffer);
+ lcd_update();
+
+ if (button_get_w_tmo(HZ/20) & BUTTON_REL)
+ return;
+
+ y--;
+
+ if(y<0) {
+ line++;
+ if(line >= numnames)
+ break;
+ y+=height;
+ }
+
+ }
+ return;
+}
+#endif
diff --git a/apps/credits.h b/apps/credits.h
new file mode 100644
index 0000000000..dd4b459326
--- /dev/null
+++ b/apps/credits.h
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 by Robert Hak <rhak at ramapo.edu>
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef __ROCKBOX_CREDITS_H__
+#define __ROCKBOX_CREDITS_H__
+
+/* Show who worked on the project */
+void roll_credits(void);
+
+#endif
+
+
diff --git a/flash/uart_boot/Makefile b/apps/credits.pl
index 04db068c07..942a96b99f 100644
--- a/flash/uart_boot/Makefile
+++ b/apps/credits.pl
@@ -6,14 +6,8 @@
# \/ \/ \/ \/ \/
# $Id$
#
-# This Makefile currently works for cygwin only!
-
-
-CFLAGS := -O -W -Wall -mno-cygwin
-
-uart_boot: uart_boot.c client.c flash.c uart_win.c
- $(CC) $(CFLAGS) $+ -o $@
-
-clean:
- -rm -f uart_boot.exe
-
+while (<STDIN>) {
+ if(($_ =~ /^([A-Z]+[\S ]+)/) && ($_ !~ /^People/)) {
+ print "\"$1\",\n";
+ }
+}
diff --git a/apps/plugins/a52towav.c b/apps/plugins/a52towav.c
new file mode 100644
index 0000000000..32353d823f
--- /dev/null
+++ b/apps/plugins/a52towav.c
@@ -0,0 +1,208 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 Dave Chapman
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "plugin.h"
+
+#if (CONFIG_HWCODEC == MASNONE)
+/* software codec platforms */
+
+#include <inttypes.h> /* Needed by a52.h */
+
+#include <codecs/liba52/config-a52.h>
+#include <codecs/liba52/a52.h>
+
+#include "lib/xxx2wav.h" /* Helper functions common to test decoders */
+
+static struct plugin_api* rb;
+
+#ifdef WORDS_BIGENDIAN
+#define LE_S16(x) ( (uint16_t) ( ((uint16_t)(x) >> 8) | ((uint16_t)(x) << 8) ) )
+#else
+#define LE_S16(x) (x)
+#endif
+
+
+static float gain = 1;
+static a52_state_t * state;
+
+static inline int16_t convert (int32_t i)
+{
+ i >>= 15;
+ return (i > 32767) ? 32767 : ((i < -32768) ? -32768 : i);
+}
+
+void ao_play(file_info_struct* file_info,sample_t* samples,int flags) {
+ int i;
+ static int16_t int16_samples[256*2];
+
+ flags &= A52_CHANNEL_MASK | A52_LFE;
+
+ if (flags==A52_STEREO) {
+ for (i = 0; i < 256; i++) {
+ int16_samples[2*i] = LE_S16(convert (samples[i]));
+ int16_samples[2*i+1] = LE_S16(convert (samples[i+256]));
+ }
+ } else {
+ DEBUGF("ERROR: unsupported format: %d\n",flags);
+ }
+
+ /* FIX: Buffer the disk write to write larger amounts at one */
+ i=rb->write(file_info->outfile,int16_samples,256*2*2);
+}
+
+
+void a52_decode_data (file_info_struct* file_info, uint8_t * start, uint8_t * end)
+{
+ static uint8_t buf[3840];
+ static uint8_t * bufptr = buf;
+ static uint8_t * bufpos = buf + 7;
+
+ /*
+ * sample_rate and flags are static because this routine could
+ * exit between the a52_syncinfo() and the ao_setup(), and we want
+ * to have the same values when we get back !
+ */
+
+ static int sample_rate;
+ static int flags;
+ int bit_rate;
+ int len;
+
+ while (1) {
+ len = end - start;
+ if (!len)
+ break;
+ if (len > bufpos - bufptr)
+ len = bufpos - bufptr;
+ memcpy (bufptr, start, len);
+ bufptr += len;
+ start += len;
+ if (bufptr == bufpos) {
+ if (bufpos == buf + 7) {
+ int length;
+
+ length = a52_syncinfo (buf, &flags, &sample_rate, &bit_rate);
+ if (!length) {
+ DEBUGF("skip\n");
+ for (bufptr = buf; bufptr < buf + 6; bufptr++)
+ bufptr[0] = bufptr[1];
+ continue;
+ }
+ bufpos = buf + length;
+ } else {
+ // The following two defaults are taken from audio_out_oss.c:
+ level_t level;
+ sample_t bias;
+ int i;
+
+ /* This is the configuration for the downmixing: */
+ flags=A52_STEREO|A52_ADJUST_LEVEL|A52_LFE;
+ level=(1 << 26);
+ bias=0;
+
+ level = (level_t) (level * gain);
+
+ if (a52_frame (state, buf, &flags, &level, bias))
+ goto error;
+ file_info->frames_decoded++;
+
+ /* We assume this never changes */
+ file_info->samplerate=sample_rate;
+
+ // An A52 frame consists of 6 blocks of 256 samples
+ // So we decode and output them one block at a time
+ for (i = 0; i < 6; i++) {
+ if (a52_block (state)) {
+ goto error;
+ }
+ ao_play (file_info, a52_samples (state),flags);
+ file_info->current_sample+=256;
+ }
+ bufptr = buf;
+ bufpos = buf + 7;
+ continue;
+ error:
+ DEBUGF("error\n");
+ bufptr = buf;
+ bufpos = buf + 7;
+ }
+ }
+ }
+}
+
+
+#define BUFFER_SIZE 4096
+
+/* this is the plugin entry point */
+enum plugin_status plugin_start(struct plugin_api* api, void* file)
+{
+ file_info_struct file_info;
+
+ /* Generic plugin initialisation */
+
+ TEST_PLUGIN_API(api);
+ rb = api;
+
+
+ /* This function sets up the buffers and reads the file into RAM */
+
+ if (local_init(file,"/ac3test.wav",&file_info,api)) {
+ return PLUGIN_ERROR;
+ }
+
+ /* Intialise the A52 decoder and check for success */
+ state = a52_init (0); // Parameter is "accel"
+
+ if (state == NULL) {
+ rb->splash(HZ*2, true, "a52_init failed");
+ return PLUGIN_ERROR;
+ }
+
+ /* The main decoding loop */
+
+ file_info.start_tick=*(rb->current_tick);
+ rb->button_clear_queue();
+
+ while (file_info.curpos < file_info.filesize) {
+
+ if ((file_info.curpos+BUFFER_SIZE) < file_info.filesize) {
+ a52_decode_data(&file_info,&filebuf[file_info.curpos],&filebuf[file_info.curpos+BUFFER_SIZE]);
+ file_info.curpos+=BUFFER_SIZE;
+ } else {
+ a52_decode_data(&file_info,&filebuf[file_info.curpos],&filebuf[file_info.filesize-1]);
+ file_info.curpos=file_info.filesize;
+ }
+
+ display_status(&file_info);
+
+ if (rb->button_get(false)!=BUTTON_NONE) {
+ close_wav(&file_info);
+ return PLUGIN_OK;
+ }
+ }
+ close_wav(&file_info);
+
+ /* Cleanly close and exit */
+
+//NOT NEEDED: a52_free (state);
+
+ rb->splash(HZ*2, true, "FINISHED!");
+ return PLUGIN_OK;
+}
+#endif /* CONFIG_HWCODEC == MASNONE */
diff --git a/apps/plugins/codecmpa.c b/apps/plugins/codecmpa.c
new file mode 100644
index 0000000000..1125b4bf18
--- /dev/null
+++ b/apps/plugins/codecmpa.c
@@ -0,0 +1,404 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 Dave Chapman
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "plugin.h"
+
+#include <codecs/libmad/mad.h>
+
+#include "playback.h"
+#include "mp3data.h"
+#include "lib/codeclib.h"
+
+static struct plugin_api* rb;
+
+struct mad_stream Stream IDATA_ATTR;
+struct mad_frame Frame IDATA_ATTR;
+struct mad_synth Synth IDATA_ATTR;
+mad_timer_t Timer;
+struct dither d0, d1;
+
+/* The following function is used inside libmad - let's hope it's never
+ called.
+*/
+
+void abort(void) {
+}
+
+/* The "dither" code to convert the 24-bit samples produced by libmad was
+ taken from the coolplayer project - coolplayer.sourceforge.net */
+
+struct dither {
+ mad_fixed_t error[3];
+ mad_fixed_t random;
+};
+
+# define SAMPLE_DEPTH 16
+# define scale(x, y) dither((x), (y))
+
+/*
+ * NAME: prng()
+ * DESCRIPTION: 32-bit pseudo-random number generator
+ */
+static __inline
+unsigned long prng(unsigned long state)
+{
+ return (state * 0x0019660dL + 0x3c6ef35fL) & 0xffffffffL;
+}
+
+/*
+ * NAME: dither()
+ * DESCRIPTION: dither and scale sample
+ */
+static __inline
+signed int dither(mad_fixed_t sample, struct dither *dither)
+{
+ unsigned int scalebits;
+ mad_fixed_t output, mask, random;
+
+ enum {
+ MIN = -MAD_F_ONE,
+ MAX = MAD_F_ONE - 1
+ };
+
+ /* noise shape */
+ sample += dither->error[0] - dither->error[1] + dither->error[2];
+
+ dither->error[2] = dither->error[1];
+ dither->error[1] = dither->error[0] / 2;
+
+ /* bias */
+ output = sample + (1L << (MAD_F_FRACBITS + 1 - SAMPLE_DEPTH - 1));
+
+ scalebits = MAD_F_FRACBITS + 1 - SAMPLE_DEPTH;
+ mask = (1L << scalebits) - 1;
+
+ /* dither */
+ random = prng(dither->random);
+ output += (random & mask) - (dither->random & mask);
+
+ //dither->random = random;
+
+ /* clip */
+ if (output > MAX) {
+ output = MAX;
+
+ if (sample > MAX)
+ sample = MAX;
+ }
+ else if (output < MIN) {
+ output = MIN;
+
+ if (sample < MIN)
+ sample = MIN;
+ }
+
+ /* quantize */
+ output &= ~mask;
+
+ /* error feedback */
+ dither->error[0] = sample - output;
+
+ /* scale */
+ return output >> scalebits;
+}
+
+static __inline
+signed int detect_silence(mad_fixed_t sample)
+{
+ unsigned int scalebits;
+ mad_fixed_t output, mask;
+
+ enum {
+ MIN = -MAD_F_ONE,
+ MAX = MAD_F_ONE - 1
+ };
+
+ /* bias */
+ output = sample + (1L << (MAD_F_FRACBITS + 1 - SAMPLE_DEPTH - 1));
+
+ scalebits = MAD_F_FRACBITS + 1 - SAMPLE_DEPTH;
+ mask = (1L << scalebits) - 1;
+
+ /* clip */
+ if (output > MAX) {
+ output = MAX;
+
+ if (sample > MAX)
+ sample = MAX;
+ }
+ else if (output < MIN) {
+ output = MIN;
+
+ if (sample < MIN)
+ sample = MIN;
+ }
+
+ /* quantize */
+ output &= ~mask;
+
+ /* scale */
+ output >>= scalebits + 4;
+
+ if (output == 0x00 || output == 0xff)
+ return 1;
+
+ return 0;
+}
+#define SHRT_MAX 32767
+
+#define INPUT_CHUNK_SIZE 8192
+#define OUTPUT_BUFFER_SIZE 65536 /* Must be an integer multiple of 4. */
+
+unsigned char OutputBuffer[OUTPUT_BUFFER_SIZE];
+unsigned char *OutputPtr;
+unsigned char *GuardPtr=NULL;
+const unsigned char *OutputBufferEnd=OutputBuffer+OUTPUT_BUFFER_SIZE;
+
+mad_fixed_t mad_frame_overlap[2][32][18] IDATA_ATTR;
+unsigned char mad_main_data[MAD_BUFFER_MDLEN] IDATA_ATTR;
+
+#ifdef USE_IRAM
+extern char iramcopy[];
+extern char iramstart[];
+extern char iramend[];
+#endif
+
+#undef DEBUG_GAPLESS
+
+/* this is the plugin entry point */
+enum plugin_status plugin_start(struct plugin_api* api, void* parm)
+{
+ struct codec_api *ci = (struct codec_api *)parm;
+ int Status=0;
+ size_t size;
+ int file_end;
+ unsigned short Sample;
+ char *InputBuffer;
+ unsigned int samplecount;
+ unsigned int samplesdone;
+ bool first_frame;
+#ifdef DEBUG_GAPLESS
+ bool first = true;
+ int fd;
+#endif
+ int i;
+
+ /* Generic plugin inititialisation */
+
+ TEST_PLUGIN_API(api);
+ rb = api;
+
+#ifdef USE_IRAM
+ rb->memcpy(iramstart, iramcopy, iramend-iramstart);
+#endif
+
+ /* This function sets up the buffers and reads the file into RAM */
+
+ if (codec_init(api, ci)) {
+ return PLUGIN_ERROR;
+ }
+
+ /* Create a decoder instance */
+
+ next_track:
+
+ memset(&Stream, 0, sizeof(struct mad_stream));
+ memset(&Frame, 0, sizeof(struct mad_frame));
+ memset(&Synth, 0, sizeof(struct mad_synth));
+ memset(&Timer, 0, sizeof(mad_timer_t));
+
+ mad_stream_init(&Stream);
+ mad_frame_init(&Frame);
+ mad_synth_init(&Synth);
+ mad_timer_reset(&Timer);
+
+ /* We do this so libmad doesn't try to call codec_calloc() */
+ memset(mad_frame_overlap, 0, sizeof(mad_frame_overlap));
+ Frame.overlap = &mad_frame_overlap;
+ Stream.main_data = &mad_main_data;
+
+#ifdef DEBUG_GAPLESS
+ if (first)
+ fd = rb->open("/first.pcm", O_WRONLY | O_CREAT);
+ else
+ fd = rb->open("/second.pcm", O_WRONLY | O_CREAT);
+ first = false;
+#endif
+
+ samplesdone = 0;
+ first_frame = false;
+ file_end = 0;
+ OutputPtr = OutputBuffer;
+
+ while (!*ci->taginfo_ready)
+ rb->yield();
+
+
+ ci->request_buffer(&size, ci->id3->first_frame_offset);
+ ci->advance_buffer(size);
+
+ samplecount = ci->id3->length * (ci->id3->frequency / 100) / 10;
+ /* rb->snprintf(buf2, sizeof(buf2), "sc: %d", samplecount);
+ rb->splash(0, true, buf2);
+ rb->snprintf(buf2, sizeof(buf2), "length: %d", ci->id3->length);
+ rb->splash(HZ*5, true, buf2);
+ rb->snprintf(buf2, sizeof(buf2), "frequency: %d", ci->id3->frequency);
+ rb->splash(HZ*5, true, buf2); */
+
+ /* This is the decoding loop. */
+ while (1) {
+ rb->yield();
+ if (ci->stop_codec || ci->reload_codec) {
+ break ;
+ }
+
+ if (ci->seek_time) {
+ unsigned int sample_loc;
+ int newpos;
+
+ sample_loc = ci->seek_time/1000 * ci->id3->frequency;
+ newpos = ci->mp3_get_filepos(ci->seek_time-1);
+ if (ci->seek_buffer(newpos)) {
+ ci->seek_time = 0;
+ if (sample_loc >= samplecount + samplesdone)
+ break ;
+ samplecount += samplesdone - sample_loc;
+ samplesdone = sample_loc;
+ }
+ }
+
+ /* Lock buffers */
+ if (Stream.error == 0) {
+ InputBuffer = ci->request_buffer(&size, INPUT_CHUNK_SIZE);
+ if (size == 0 || InputBuffer == NULL)
+ break ;
+ mad_stream_buffer(&Stream, InputBuffer, size);
+ }
+
+ //if ((int)ci->curpos >= ci->id3->first_frame_offset)
+ //first_frame = true;
+
+ if(mad_frame_decode(&Frame,&Stream))
+ {
+ if (Stream.error == MAD_FLAG_INCOMPLETE || Stream.error == MAD_ERROR_BUFLEN) {
+ // rb->splash(HZ*1, true, "Incomplete");
+ /* This makes the codec to support partially corrupted files too. */
+ if (file_end == 30)
+ break ;
+
+ /* Fill the buffer */
+ Stream.error = 0;
+ file_end++;
+ continue ;
+ }
+ else if(MAD_RECOVERABLE(Stream.error))
+ {
+ if(Stream.error!=MAD_ERROR_LOSTSYNC || Stream.this_frame!=GuardPtr)
+ {
+ // rb->splash(HZ*1, true, "Recoverable...!");
+ }
+ continue;
+ }
+ else if(Stream.error==MAD_ERROR_BUFLEN) {
+ //rb->splash(HZ*1, true, "Buflen error");
+ break ;
+ } else {
+ //rb->splash(HZ*1, true, "Unrecoverable error");
+ Status=1;
+ break;
+ }
+ }
+ if (Stream.next_frame)
+ ci->advance_buffer_loc((void *)Stream.next_frame);
+ file_end = false;
+ /* ?? Do we need the timer module? */
+ // mad_timer_add(&Timer,Frame.header.duration);
+
+/* DAVE: This can be used to attenuate the audio */
+// if(DoFilter)
+// ApplyFilter(&Frame);
+
+ mad_synth_frame(&Synth,&Frame);
+
+ //if (!first_frame) {
+ //samplecount -= Synth.pcm.length;
+ //continue ;
+ //}
+
+ /* Convert MAD's numbers to an array of 16-bit LE signed integers */
+ for(i=0;i<Synth.pcm.length;i++)
+ {
+ samplesdone++;
+ //if (ci->mp3data->padding > 0) {
+ // ci->mp3data->padding--;
+ // continue ;
+ //}
+ if (!first_frame) {
+ if (detect_silence(Synth.pcm.samples[0][i]))
+ continue ;
+ first_frame = true;
+ }
+
+ /* Left channel */
+ Sample=scale(Synth.pcm.samples[0][i],&d0);
+ *(OutputPtr++)=Sample>>8;
+ *(OutputPtr++)=Sample&0xff;
+
+ /* Right channel. If the decoded stream is monophonic then
+ * the right output channel is the same as the left one.
+ */
+ if(MAD_NCHANNELS(&Frame.header)==2)
+ Sample=scale(Synth.pcm.samples[1][i],&d1);
+ *(OutputPtr++)=Sample>>8;
+ *(OutputPtr++)=Sample&0xff;
+
+ samplecount--;
+ if (samplecount == 0) {
+#ifdef DEBUG_GAPLESS
+ rb->write(fd, OutputBuffer, (int)OutputPtr-(int)OutputBuffer);
+#endif
+ while (!ci->audiobuffer_insert(OutputBuffer, (int)OutputPtr-(int)OutputBuffer))
+ rb->yield();
+ goto song_end;
+ }
+
+ /* Flush the buffer if it is full. */
+ if(OutputPtr==OutputBufferEnd)
+ {
+#ifdef DEBUG_GAPLESS
+ rb->write(fd, OutputBuffer, OUTPUT_BUFFER_SIZE);
+#endif
+ while (!ci->audiobuffer_insert(OutputBuffer, OUTPUT_BUFFER_SIZE))
+ rb->yield();
+ OutputPtr=OutputBuffer;
+ }
+ }
+ ci->set_elapsed(samplesdone / (ci->id3->frequency/1000));
+ }
+
+ song_end:
+#ifdef DEBUG_GAPLESS
+ rb->close(fd);
+#endif
+ Stream.error = 0;
+
+ if (ci->request_next_track())
+ goto next_track;
+ return PLUGIN_OK;
+}
diff --git a/apps/plugins/codecvorbis.c b/apps/plugins/codecvorbis.c
new file mode 100644
index 0000000000..2fcc031ce5
--- /dev/null
+++ b/apps/plugins/codecvorbis.c
@@ -0,0 +1,161 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 Björn Stenberg
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "kernel.h"
+#include "plugin.h"
+
+#include <codecs/Tremor/ivorbisfile.h>
+
+#include "playback.h"
+#include "lib/codeclib.h"
+
+static struct plugin_api* rb;
+
+/* Some standard functions and variables needed by Tremor */
+
+
+int errno;
+
+size_t strlen(const char *s) {
+ return(rb->strlen(s));
+}
+
+char *strcpy(char *dest, const char *src) {
+ return(rb->strcpy(dest,src));
+}
+
+char *strcat(char *dest, const char *src) {
+ return(rb->strcat(dest,src));
+}
+
+size_t read_handler(void *ptr, size_t size, size_t nmemb, void *datasource) {
+ struct codec_api *p = (struct codec_api *) datasource;
+
+ return p->read_filebuf(ptr, nmemb*size);
+}
+
+int seek_handler(void *datasource, ogg_int64_t offset, int whence) {
+ /* We are not seekable at the moment */
+ (void)datasource;
+ (void)offset;
+ (void)whence;
+ return -1;
+}
+
+int close_handler(void *datasource) {
+ (void)datasource;
+ return 0;
+}
+
+long tell_handler(void *datasource) {
+ struct codec_api *p = (struct codec_api *) datasource;
+ return p->curpos;
+}
+
+#ifdef USE_IRAM
+extern char iramcopy[];
+extern char iramstart[];
+extern char iramend[];
+#endif
+
+
+/* reserve the PCM buffer in the IRAM area */
+static char pcmbuf[4096] IDATA_ATTR;
+
+/* this is the plugin entry point */
+enum plugin_status plugin_start(struct plugin_api* api, void* parm)
+{
+ struct codec_api *ci = (struct codec_api *)parm;
+ ov_callbacks callbacks;
+ OggVorbis_File vf;
+ vorbis_info* vi;
+
+ int error;
+ long n;
+ int current_section;
+ int eof;
+#if BYTE_ORDER == BIG_ENDIAN
+ int i;
+ char x;
+#endif
+
+ TEST_PLUGIN_API(api);
+
+ /* if you are using a global api pointer, don't forget to copy it!
+ otherwise you will get lovely "I04: IllInstr" errors... :-) */
+ rb = api;
+
+ #ifdef USE_IRAM
+ rb->memcpy(iramstart, iramcopy, iramend-iramstart);
+ #endif
+
+ /* This function sets up the buffers and reads the file into RAM */
+
+ /* We need to flush reserver memory every track load. */
+ next_track:
+ if (codec_init(api, ci)) {
+ return PLUGIN_ERROR;
+ }
+
+
+ /* Create a decoder instance */
+
+ callbacks.read_func=read_handler;
+ callbacks.seek_func=seek_handler;
+ callbacks.tell_func=tell_handler;
+ callbacks.close_func=close_handler;
+
+ error=ov_open_callbacks(ci,&vf,NULL,0,callbacks);
+
+ vi=ov_info(&vf,-1);
+
+ if (vi==NULL) {
+ // rb->splash(HZ*2, true, "Vorbis Error");
+ return PLUGIN_ERROR;
+ }
+
+ eof=0;
+ while (!eof) {
+ /* Read host-endian signed 16 bit PCM samples */
+ n=ov_read(&vf,pcmbuf,sizeof(pcmbuf),&current_section);
+
+ if (n==0) {
+ eof=1;
+ } else if (n < 0) {
+ DEBUGF("Error decoding frame\n");
+ } else {
+ rb->yield();
+ if (ci->stop_codec || ci->reload_codec)
+ break ;
+ while (!ci->audiobuffer_insert(pcmbuf, n))
+ rb->yield();
+
+#if BYTE_ORDER == BIG_ENDIAN
+ for (i=0;i<n;i+=2) {
+ x=pcmbuf[i]; pcmbuf[i]=pcmbuf[i+1]; pcmbuf[i+1]=x;
+ }
+#endif
+ }
+ }
+
+ if (ci->request_next_track())
+ goto next_track;
+
+ return PLUGIN_OK;
+}
+
diff --git a/apps/plugins/flac2wav.c b/apps/plugins/flac2wav.c
new file mode 100644
index 0000000000..84b5ed15b2
--- /dev/null
+++ b/apps/plugins/flac2wav.c
@@ -0,0 +1,237 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 Björn Stenberg
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "plugin.h"
+
+#if (CONFIG_HWCODEC == MASNONE)
+/* software codec platforms */
+
+#include <codecs/libFLAC/include/FLAC/seekable_stream_decoder.h>
+
+#include "lib/xxx2wav.h" /* Helper functions common to test decoders */
+
+#define FLAC_MAX_SUPPORTED_BLOCKSIZE 4608
+#define FLAC_MAX_SUPPORTED_CHANNELS 2
+
+static struct plugin_api* rb;
+
+/* Called when the FLAC decoder needs some FLAC data to decode */
+FLAC__SeekableStreamDecoderReadStatus flac_read_handler(const FLAC__SeekableStreamDecoder *dec,
+ FLAC__byte buffer[], unsigned *bytes, void *data)
+{ (void)dec;
+
+ file_info_struct *p = (file_info_struct *) data;
+
+ if (p->curpos >= p->filesize) {
+ return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+ }
+
+ rb->memcpy(buffer,&filebuf[p->curpos],*bytes);
+ p->curpos+=*bytes;
+
+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+}
+
+/* Called when the FLAC decoder has some decoded PCM data to write */
+FLAC__StreamDecoderWriteStatus flac_write_handler(const FLAC__SeekableStreamDecoder *dec,
+ const FLAC__Frame *frame,
+ const FLAC__int32 * const buf[],
+ void *data)
+{
+ unsigned int c_samp, c_chan, d_samp;
+ file_info_struct *p = (file_info_struct *) data;
+ uint32_t data_size = frame->header.blocksize * frame->header.channels * (p->bitspersample / 8);
+ uint32_t samples = frame->header.blocksize;
+
+ // FIXME: This should not be on the stack!
+ static unsigned char ldb[FLAC_MAX_SUPPORTED_BLOCKSIZE*FLAC_MAX_SUPPORTED_CHANNELS*2];
+
+ if (samples*frame->header.channels > (FLAC_MAX_SUPPORTED_BLOCKSIZE*FLAC_MAX_SUPPORTED_CHANNELS)) {
+ // ERROR!!!
+ DEBUGF("ERROR: samples*frame->header.channels=%d\n",samples*frame->header.channels);
+ return(FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE);
+ }
+
+ (void)dec;
+ (void)data_size;
+ for(c_samp = d_samp = 0; c_samp < samples; c_samp++) {
+ for(c_chan = 0; c_chan < frame->header.channels; c_chan++, d_samp++) {
+ ldb[d_samp*2] = buf[c_chan][c_samp]&0xff;
+ ldb[(d_samp*2)+1] = (buf[c_chan][c_samp]&0xff00)>>8;
+ }
+ }
+
+ rb->write(p->outfile,ldb,data_size);
+
+ p->current_sample += samples;
+
+ return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+}
+
+void flac_metadata_handler(const FLAC__SeekableStreamDecoder *dec,
+ const FLAC__StreamMetadata *meta, void *data)
+{
+ file_info_struct *p = (file_info_struct *) data;
+ (void)dec;
+
+ if(meta->type == FLAC__METADATA_TYPE_STREAMINFO) {
+ p->bitspersample = meta->data.stream_info.bits_per_sample;
+ p->samplerate = meta->data.stream_info.sample_rate;
+ p->channels = meta->data.stream_info.channels;
+// FLAC__ASSERT(meta->data.stream_info.total_samples < 0x100000000); /* we can handle < 4 gigasamples */
+ p->total_samples = (unsigned)
+ (meta->data.stream_info.total_samples & 0xffffffff);
+ p->current_sample = 0;
+ }
+}
+
+
+void flac_error_handler(const FLAC__SeekableStreamDecoder *dec,
+ FLAC__StreamDecoderErrorStatus status, void *data)
+{
+ (void)dec;
+ (void)status;
+ (void)data;
+}
+
+FLAC__SeekableStreamDecoderSeekStatus flac_seek_handler (const FLAC__SeekableStreamDecoder *decoder,
+ FLAC__uint64 absolute_byte_offset,
+ void *client_data)
+{
+ (void)decoder;
+ file_info_struct *p = (file_info_struct *) client_data;
+ rb->lseek(p->infile,SEEK_SET,absolute_byte_offset);
+ return(FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK);
+}
+
+FLAC__SeekableStreamDecoderTellStatus flac_tell_handler (const FLAC__SeekableStreamDecoder *decoder,
+ FLAC__uint64 *absolute_byte_offset, void *client_data)
+{
+ file_info_struct *p = (file_info_struct *) client_data;
+
+ (void)decoder;
+ *absolute_byte_offset=rb->lseek(p->infile,SEEK_CUR,0);
+ return(FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK);
+}
+
+FLAC__SeekableStreamDecoderLengthStatus flac_length_handler (const FLAC__SeekableStreamDecoder *decoder,
+ FLAC__uint64 *stream_length, void *client_data)
+{
+ file_info_struct *p = (file_info_struct *) client_data;
+
+ (void)decoder;
+ *stream_length=p->filesize;
+ return(FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK);
+}
+
+FLAC__bool flac_eof_handler (const FLAC__SeekableStreamDecoder *decoder,
+ void *client_data)
+{
+ file_info_struct *p = (file_info_struct *) client_data;
+
+ (void)decoder;
+ if (p->curpos >= p->filesize) {
+ return(true);
+ } else {
+ return(false);
+ }
+}
+
+#ifndef SIMULATOR
+extern char iramcopy[];
+extern char iramstart[];
+extern char iramend[];
+#endif
+
+/* this is the plugin entry point */
+enum plugin_status plugin_start(struct plugin_api* api, void* file)
+{
+ FLAC__SeekableStreamDecoder* flacDecoder;
+ file_info_struct file_info;
+
+ TEST_PLUGIN_API(api);
+
+ /* if you are using a global api pointer, don't forget to copy it!
+ otherwise you will get lovely "I04: IllInstr" errors... :-) */
+ rb = api;
+
+#ifndef SIMULATOR
+ rb->memcpy(iramstart, iramcopy, iramend-iramstart);
+#endif
+
+ /* This function sets up the buffers and reads the file into RAM */
+
+ if (local_init(file,"/flactest.wav",&file_info,api)) {
+ return PLUGIN_ERROR;
+ }
+
+ /* Create a decoder instance */
+
+ flacDecoder=FLAC__seekable_stream_decoder_new();
+
+ /* Set up the decoder and the callback functions - this must be done before init */
+
+ /* The following are required for stream_decoder and higher */
+ FLAC__seekable_stream_decoder_set_client_data(flacDecoder,&file_info);
+ FLAC__seekable_stream_decoder_set_write_callback(flacDecoder, flac_write_handler);
+ FLAC__seekable_stream_decoder_set_read_callback(flacDecoder, flac_read_handler);
+ FLAC__seekable_stream_decoder_set_metadata_callback(flacDecoder, flac_metadata_handler);
+ FLAC__seekable_stream_decoder_set_error_callback(flacDecoder, flac_error_handler);
+ FLAC__seekable_stream_decoder_set_metadata_respond(flacDecoder, FLAC__METADATA_TYPE_STREAMINFO);
+
+ /* The following are only for the seekable_stream_decoder */
+ FLAC__seekable_stream_decoder_set_seek_callback(flacDecoder, flac_seek_handler);
+ FLAC__seekable_stream_decoder_set_tell_callback(flacDecoder, flac_tell_handler);
+ FLAC__seekable_stream_decoder_set_length_callback(flacDecoder, flac_length_handler);
+ FLAC__seekable_stream_decoder_set_eof_callback(flacDecoder, flac_eof_handler);
+
+ if (FLAC__seekable_stream_decoder_init(flacDecoder)) {
+ return PLUGIN_ERROR;
+ }
+
+ /* The first thing to do is to parse the metadata */
+ FLAC__seekable_stream_decoder_process_until_end_of_metadata(flacDecoder);
+
+ file_info.frames_decoded=0;
+ file_info.start_tick=*(rb->current_tick);
+ rb->button_clear_queue();
+
+ while (FLAC__seekable_stream_decoder_get_state(flacDecoder)!=2) {
+ FLAC__seekable_stream_decoder_process_single(flacDecoder);
+ file_info.frames_decoded++;
+
+ display_status(&file_info);
+
+ if (rb->button_get(false)!=BUTTON_NONE) {
+ close_wav(&file_info);
+ return PLUGIN_OK;
+ }
+ }
+
+ close_wav(&file_info);
+ rb->splash(HZ*2, true, "FINISHED!");
+
+ /* Flush internal buffers etc */
+//No need for this. flacResult=FLAC__seekable_stream_decoder_reset(flacDecoder);
+
+ // audio_close();
+
+ return PLUGIN_OK;
+}
+#endif /* CONFIG_HWCODEC == MASNONE */
diff --git a/apps/plugins/lib/codeclib.c b/apps/plugins/lib/codeclib.c
new file mode 100644
index 0000000000..9d9cc0b91b
--- /dev/null
+++ b/apps/plugins/lib/codeclib.c
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 Dave Chapman
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* Various "helper functions" common to all the xxx2wav decoder plugins */
+
+#include "plugin.h"
+#include "playback.h"
+#include "codeclib.h"
+#include "xxx2wav.h"
+
+struct plugin_api* local_rb;
+
+int codec_init(struct plugin_api* rb, struct codec_api* ci) {
+ local_rb = rb;
+
+ xxx2wav_set_api(rb);
+ mem_ptr = 0;
+ mallocbuf = (unsigned char *)ci->get_codec_memory((size_t *)&bufsize);
+
+ return 0;
+}
diff --git a/apps/plugins/lib/codeclib.h b/apps/plugins/lib/codeclib.h
new file mode 100644
index 0000000000..876e69b57e
--- /dev/null
+++ b/apps/plugins/lib/codeclib.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 Dave Chapman
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* Various "helper functions" common to all the xxx2wav decoder plugins */
+
+#if CONFIG_CPU == MCF5249 && !defined(SIMULATOR)
+#define ICODE_ATTR __attribute__ ((section(".icode")))
+#define IDATA_ATTR __attribute__ ((section(".idata")))
+#define USE_IRAM 1
+#else
+#define ICODE_ATTR
+#define IDATA_ATTR
+#endif
+
+extern int mem_ptr;
+extern int bufsize;
+extern unsigned char* mallocbuf; // 512K from the start of MP3 buffer
+
+void* codec_malloc(size_t size);
+void* codec_calloc(size_t nmemb, size_t size);
+void* codec_alloca(size_t size);
+void* codec_realloc(void* ptr, size_t size);
+void codec_free(void* ptr);
+void *memcpy(void *dest, const void *src, size_t n);
+void *memset(void *s, int c, size_t n);
+int memcmp(const void *s1, const void *s2, size_t n);
+void* memmove(const void *s1, const void *s2, size_t n);
+
+int codec_init(struct plugin_api* rb, struct codec_api* ci);
+
diff --git a/apps/plugins/lib/gray_black_display.c b/apps/plugins/lib/gray_black_display.c
new file mode 100644
index 0000000000..573060eb62
--- /dev/null
+++ b/apps/plugins/lib/gray_black_display.c
@@ -0,0 +1,44 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_black_display() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Set the grayscale display to all black
+ ----------------------------------------------------------------------------
+ */
+void gray_black_display(void)
+{
+ _gray_rb->memset(_graybuf->data, 0xFF, MULU16(_graybuf->depth,
+ _graybuf->plane_size));
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_blockfuncs.c b/apps/plugins/lib/gray_blockfuncs.c
new file mode 100644
index 0000000000..85af0014e1
--- /dev/null
+++ b/apps/plugins/lib/gray_blockfuncs.c
@@ -0,0 +1,262 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* Low level block drawing functions
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#if CONFIG_LCD == LCD_SSD1815 /* only for Recorder/Ondio */
+#include "gray.h"
+
+/* Prototypes */
+static void _writeblock(unsigned char *address, unsigned mask, unsigned bits);
+static void _invertblock(unsigned char *address, unsigned mask, unsigned bits);
+static void _writeblockfg(unsigned char *address, unsigned mask, unsigned bits);
+static void _writeblockbg(unsigned char *address, unsigned mask, unsigned bits);
+
+/* Block function pointer array */
+void (* const _gray_blockfuncs[4])(unsigned char *address, unsigned mask,
+ unsigned bits) = {
+ _invertblock, _writeblockfg, _writeblockbg, _writeblock
+};
+
+/* Write an 8-pixel block, defined by foreground and background pattern.
+ * Address is the byte in the first bitplane, mask determines which pixels to
+ * set, and bits determines if the pixel is foreground or background */
+static void _writeblock(unsigned char *address, unsigned mask, unsigned bits)
+{
+ unsigned long pat_stack[8];
+ register unsigned char *end_addr;
+ register unsigned long *pat_ptr = &pat_stack[8];
+
+ /* precalculate the bit patterns with random shifts (same RNG as _writepixel,
+ * see there for an explanation) for all 8 pixels and put them on an
+ * extra stack */
+ asm (
+ "mov #8,r3 \n" /* loop count in r3: 8 pixels */
+ "mov %6,r2 \n" /* copy mask */
+
+ ".wb_loop: \n" /** load pattern for pixel **/
+ "shlr r2 \n" /* shift out lsb of mask */
+ "bf .wb_skip \n" /* skip this pixel */
+
+ "mov %2,r4 \n" /* load foreground pattern */
+ "shlr %7 \n" /* shift out lsb of bits */
+ "bt .wb_fg \n" /* foreground? -> skip next insn */
+ "mov %3,r4 \n" /* load background pattern */
+ ".wb_fg: \n"
+
+ "mov #75,r0 \n"
+ "mulu r0,%0 \n" /* multiply by 75 */
+ "sts macl,%0 \n"
+ "add #74,%0 \n" /* add another 74 */
+ /* Since the lower bits are not very random: */
+ "swap.b %0,r1 \n" /* get bits 8..15 (need max. 5) */
+ "and %5,r1 \n" /* mask out unneeded bits */
+
+ "cmp/hs %4,r1 \n" /* random >= depth ? */
+ "bf .wb_ntrim \n"
+ "sub %4,r1 \n" /* yes: random -= depth; */
+ ".wb_ntrim: \n"
+
+ "mov.l .ashlsi3,r0 \n" /** rotate pattern **/
+ "jsr @r0 \n" /* r4 -> r0, shift left by r5 */
+ "mov r1,r5 \n"
+
+ "mov %4,r5 \n"
+ "sub r1,r5 \n" /* r5 = depth - r1 */
+ "mov.l .lshrsi3,r1 \n"
+ "jsr @r1 \n" /* r4 -> r0, shift right by r5 */
+ "mov r0,r1 \n" /* store previous result in r1 */
+
+ "bra .wb_store \n"
+ "or r1,r0 \n" /* rotated_pattern = r0 | r1 */
+
+ ".wb_skip: \n"
+ "shlr %7 \n" /* shift out lsb of bits to keep in sync */
+ "mov #0,r0 \n" /* pattern for skipped pixel must be 0 */
+
+ ".wb_store: \n"
+ "mov.l r0,@-%1 \n" /* push on pattern stack */
+
+ "add #-1,r3 \n" /* decrease loop count */
+ "cmp/pl r3 \n" /* loop count > 0? */
+ "bt .wb_loop \n" /* yes: loop */
+ : /* outputs */
+ /* %0, in & out */ "+r"(_gray_random_buffer),
+ /* %1, in & out */ "+r"(pat_ptr)
+ : /* inputs */
+ /* %2 */ "r"(_graybuf->fg_pattern),
+ /* %3 */ "r"(_graybuf->bg_pattern),
+ /* %4 */ "r"(_graybuf->depth),
+ /* %5 */ "r"(_graybuf->randmask),
+ /* %6 */ "r"(mask),
+ /* %7 */ "r"(bits)
+ : /* clobbers */
+ "r0", "r1", "r2", "r3", "r4", "r5", "macl", "pr"
+ );
+
+ end_addr = address + MULU16(_graybuf->depth, _graybuf->plane_size);
+
+ /* set the bits for all 8 pixels in all bytes according to the
+ * precalculated patterns on the pattern stack */
+ asm volatile (
+ "mov.l @%3+,r1 \n" /* pop all 8 patterns */
+ "mov.l @%3+,r2 \n"
+ "mov.l @%3+,r3 \n"
+ "mov.l @%3+,r8 \n"
+ "mov.l @%3+,r9 \n"
+ "mov.l @%3+,r10 \n"
+ "mov.l @%3+,r11 \n"
+ "mov.l @%3+,r12 \n"
+
+ "not %4,%4 \n" /* "set" mask -> "keep" mask */
+ "extu.b %4,%4 \n" /* mask out high bits */
+ "tst %4,%4 \n" /* nothing to keep? */
+ "bt .wb_sloop \n" /* yes: jump to short loop */
+
+ ".wb_floop: \n" /** full loop (there are bits to keep)**/
+ "shlr r1 \n" /* rotate lsb of pattern 1 to t bit */
+ "rotcl r0 \n" /* rotate t bit into r0 */
+ "shlr r2 \n"
+ "rotcl r0 \n"
+ "shlr r3 \n"
+ "rotcl r0 \n"
+ "shlr r8 \n"
+ "rotcl r0 \n"
+ "shlr r9 \n"
+ "rotcl r0 \n"
+ "shlr r10 \n"
+ "rotcl r0 \n"
+ "shlr r11 \n"
+ "rotcl r0 \n"
+ "shlr r12 \n"
+ "mov.b @%0,%3 \n" /* read old value */
+ "rotcl r0 \n"
+ "and %4,%3 \n" /* mask out unneeded bits */
+ "or r0,%3 \n" /* set new bits */
+ "mov.b %3,@%0 \n" /* store value to bitplane */
+ "add %2,%0 \n" /* advance to next bitplane */
+ "cmp/hi %0,%1 \n" /* last bitplane done? */
+ "bt .wb_floop \n" /* no: loop */
+
+ "bra .wb_end \n"
+ "nop \n"
+
+ ".wb_sloop: \n" /** short loop (nothing to keep) **/
+ "shlr r1 \n" /* rotate lsb of pattern 1 to t bit */
+ "rotcl r0 \n" /* rotate t bit into r0 */
+ "shlr r2 \n"
+ "rotcl r0 \n"
+ "shlr r3 \n"
+ "rotcl r0 \n"
+ "shlr r8 \n"
+ "rotcl r0 \n"
+ "shlr r9 \n"
+ "rotcl r0 \n"
+ "shlr r10 \n"
+ "rotcl r0 \n"
+ "shlr r11 \n"
+ "rotcl r0 \n"
+ "shlr r12 \n"
+ "rotcl r0 \n"
+ "mov.b r0,@%0 \n" /* store byte to bitplane */
+ "add %2,%0 \n" /* advance to next bitplane */
+ "cmp/hi %0,%1 \n" /* last bitplane done? */
+ "bt .wb_sloop \n" /* no: loop */
+
+ ".wb_end: \n"
+ : /* outputs */
+ : /* inputs */
+ /* %0 */ "r"(address),
+ /* %1 */ "r"(end_addr),
+ /* %2 */ "r"(_graybuf->plane_size),
+ /* %3 */ "r"(pat_ptr),
+ /* %4 */ "r"(mask)
+ : /* clobbers */
+ "r0", "r1", "r2", "r3", "r8", "r9", "r10", "r11", "r12"
+ );
+}
+
+/* References to C library routines used in _writeblock */
+asm (
+ ".align 2 \n"
+".ashlsi3: \n" /* C library routine: */
+ ".long ___ashlsi3 \n" /* shift r4 left by r5, return in r0 */
+".lshrsi3: \n" /* C library routine: */
+ ".long ___lshrsi3 \n" /* shift r4 right by r5, return in r0 */
+ /* both routines preserve r4, destroy r5 and take ~16 cycles */
+);
+
+/* Invert pixels within an 8-pixel block.
+ * Address is the byte in the first bitplane, mask and bits determine which
+ * pixels to invert ('And'ed together, for matching the parameters with
+ * _writeblock) */
+static void _invertblock(unsigned char *address, unsigned mask, unsigned bits)
+{
+ bits &= mask;
+ if (!bits)
+ return;
+
+ asm volatile (
+ "mov #0,r1 \n" /* current_plane = 0 */
+
+ ".im_loop: \n"
+ "mov.b @%1,r2 \n" /* get data byte */
+ "add #1,r1 \n" /* current_plane++; */
+ "xor %2,r2 \n" /* invert bits */
+ "mov.b r2,@%1 \n" /* store data byte */
+ "add %3,%1 \n" /* advance address to next bitplane */
+ "cmp/hi r1,%0 \n" /* current_plane < depth ? */
+ "bt .im_loop \n"
+ : /* outputs */
+ : /* inputs */
+ /* %0 */ "r"(_graybuf->depth),
+ /* %1 */ "r"(address),
+ /* %2 */ "r"(bits),
+ /* %3 */ "r"(_graybuf->plane_size)
+ : /* clobbers */
+ "r1", "r2", "macl"
+ );
+}
+
+/* Call _writeblock with the mask modified to draw foreground pixels only */
+static void _writeblockfg(unsigned char *address, unsigned mask, unsigned bits)
+{
+ mask &= bits;
+ if (mask)
+ _writeblock(address, mask, bits);
+}
+
+/* Call _writeblock with the mask modified to draw background pixels only */
+static void _writeblockbg(unsigned char *address, unsigned mask, unsigned bits)
+{
+ mask &= ~bits;
+ if (mask)
+ _writeblock(address, mask, bits);
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_clear_display.c b/apps/plugins/lib/gray_clear_display.c
new file mode 100644
index 0000000000..835107a7fe
--- /dev/null
+++ b/apps/plugins/lib/gray_clear_display.c
@@ -0,0 +1,44 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_clear_display() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Clear the grayscale display (sets all pixels to white)
+ ----------------------------------------------------------------------------
+ */
+void gray_clear_display(void)
+{
+ _gray_rb->memset(_graybuf->data, 0, MULU16(_graybuf->depth,
+ _graybuf->plane_size));
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_deferred_update.c b/apps/plugins/lib/gray_deferred_update.c
new file mode 100644
index 0000000000..3b6edd869e
--- /dev/null
+++ b/apps/plugins/lib/gray_deferred_update.c
@@ -0,0 +1,50 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_deferred_update() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Do an lcd_update() to show changes done by rb->lcd_xxx() functions (in areas
+ of the screen not covered by the grayscale overlay).
+ ----------------------------------------------------------------------------
+ If the grayscale overlay is running, the update will be done in the next
+ call of the interrupt routine, otherwise it will be performed right away.
+ See also comment for the gray_show_display() function.
+ */
+void gray_deferred_update(void)
+{
+ if (_graybuf->flags & _GRAY_RUNNING)
+ _graybuf->flags |= _GRAY_DEFERRED_UPDATE;
+ else
+ _gray_rb->lcd_update();
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_drawbitmap.c b/apps/plugins/lib/gray_drawbitmap.c
new file mode 100644
index 0000000000..376f76d45e
--- /dev/null
+++ b/apps/plugins/lib/gray_drawbitmap.c
@@ -0,0 +1,116 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_drawbitmap() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Display a bitmap with the current drawinfo
+ ----------------------------------------------------------------------------
+ The drawmode is used as described for gray_set_drawmode()
+
+ This (now) uses the same bitmap format as the core b&w graphics routines,
+ so you can use bmp2rb to generate bitmaps for use with this function as
+ well.
+
+ A bitmap contains one bit for every pixel that defines if that pixel is
+ foreground (1) or background (0). Bits within a byte are arranged
+ vertically, LSB at top.
+ The bytes are stored in row-major order, with byte 0 being top left,
+ byte 1 2nd from left etc. The first row of bytes defines pixel rows
+ 0..7, the second row defines pixel row 8..15 etc.
+
+ The <stride> parameter is useful if you want to show only a part of a
+ bitmap. It should always be set to the "row length" of the bitmap.
+ */
+void gray_drawbitmap(const unsigned char *src, int x, int y, int nx, int ny,
+ int stride)
+{
+ int shift;
+ unsigned bits, mask_top, mask_bottom;
+ const unsigned char *src_col;
+ unsigned char *dst, *dst_col;
+ void (*blockfunc)(unsigned char *address, unsigned mask, unsigned bits);
+
+ if ((unsigned) x >= (unsigned) _graybuf->width
+ || (unsigned) y >= (unsigned) _graybuf->height)
+ return;
+
+ if ((unsigned) (y + ny) >= (unsigned) _graybuf->height) /* clip bottom */
+ ny = _graybuf->height - y;
+
+ if ((unsigned) (x + nx) >= (unsigned) _graybuf->width) /* clip right */
+ nx = _graybuf->width - x;
+
+ dst = _graybuf->data + x + MULU16(_graybuf->width, y >> 3);
+ shift = y & 7;
+ ny += shift;
+
+ mask_top = 0xFFu << (y & 7);
+ mask_bottom = ~(0xFEu << ((ny - 1) & 7));
+ if (ny <= 8)
+ mask_bottom &= mask_top;
+
+ blockfunc = _gray_blockfuncs[_graybuf->drawmode];
+
+ for(x = 0; x < nx; x++)
+ {
+ src_col = src++;
+ dst_col = dst++;
+ bits = 0;
+ y = 0;
+
+ if (ny > 8)
+ {
+ bits = *src_col << shift;
+ src_col += stride;
+
+ blockfunc(dst_col, mask_top, bits);
+ dst_col += _graybuf->width;
+ bits >>= 8;
+
+ for (y = 8; y < ny - 8; y += 8)
+ {
+ bits |= *src_col << shift;
+ src_col += stride;
+
+ blockfunc(dst_col, 0xFFu, bits);
+ dst_col += _graybuf->width;
+ bits >>= 8;
+ }
+ }
+ if (y + shift < ny)
+ bits |= *src_col << shift;
+
+ blockfunc(dst_col, mask_bottom, bits);
+ }
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_drawgraymap.c b/apps/plugins/lib/gray_drawgraymap.c
new file mode 100644
index 0000000000..2760d5a96c
--- /dev/null
+++ b/apps/plugins/lib/gray_drawgraymap.c
@@ -0,0 +1,275 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_drawgraymap() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#if CONFIG_LCD == LCD_SSD1815 /* only for Recorder/Ondio */
+#include "gray.h"
+
+/* Prototypes */
+static void _writearray(unsigned char *address, const unsigned char *src,
+ int stride, unsigned mask);
+
+/* Write an 8-pixel block, defined by their brightnesses in a graymap.
+ * Address is the byte in the first bitplane, src is the graymap start address,
+ * stride is the increment for the graymap to get to the next pixel, mask
+ * determines which pixels of the destination block are changed. For "0" bits,
+ * the src address is not incremented! */
+static void _writearray(unsigned char *address, const unsigned char *src,
+ int stride, unsigned mask)
+{
+ unsigned long pat_stack[8];
+ register unsigned char *end_addr;
+ register unsigned long *pat_ptr = &pat_stack[8];
+
+ /* precalculate the bit patterns with random shifts (same RNG as
+ * _writepixel, see there for an explanation) for all 8 pixels and put them
+ * on an extra "stack" */
+ asm (
+ "mov #8,r3 \n" /* loop count in r3: 8 pixels */
+ "mov %7,r2 \n" /* copy mask */
+
+ ".wa_loop: \n" /** load pattern for pixel **/
+ "mov #0,r0 \n" /* pattern for skipped pixel must be 0 */
+ "shlr r2 \n" /* shift out lsb of mask */
+ "bf .wa_skip \n" /* skip this pixel */
+
+ "mov.b @%2,r0 \n" /* load src byte */
+ "extu.b r0,r0 \n" /* extend unsigned */
+ "mulu %4,r0 \n" /* macl = byte * depth; */
+ "add %3,%2 \n" /* src += stride; */
+ "sts macl,r4 \n" /* r4 = macl; */
+ "add r4,r0 \n" /* byte += r4; */
+ "shlr8 r0 \n" /* byte >>= 8; */
+ "shll2 r0 \n"
+ "mov.l @(r0,%5),r4 \n" /* r4 = bitpattern[byte]; */
+
+ "mov #75,r0 \n"
+ "mulu r0,%0 \n" /* multiply by 75 */
+ "sts macl,%0 \n"
+ "add #74,%0 \n" /* add another 74 */
+ /* Since the lower bits are not very random: */
+ "swap.b %0,r1 \n" /* get bits 8..15 (need max. 5) */
+ "and %6,r1 \n" /* mask out unneeded bits */
+
+ "cmp/hs %4,r1 \n" /* random >= depth ? */
+ "bf .wa_ntrim \n"
+ "sub %4,r1 \n" /* yes: random -= depth; */
+ ".wa_ntrim: \n"
+
+ "mov.l .ashlsi3,r0 \n" /** rotate pattern **/
+ "jsr @r0 \n" /* r4 -> r0, shift left by r5 */
+ "mov r1,r5 \n"
+
+ "mov %4,r5 \n"
+ "sub r1,r5 \n" /* r5 = depth - r1 */
+ "mov.l .lshrsi3,r1 \n"
+ "jsr @r1 \n" /* r4 -> r0, shift right by r5 */
+ "mov r0,r1 \n" /* store previous result in r1 */
+
+ "or r1,r0 \n" /* rotated_pattern = r0 | r1 */
+
+ ".wa_skip: \n"
+ "mov.l r0,@-%1 \n" /* push on pattern stack */
+
+ "add #-1,r3 \n" /* decrease loop count */
+ "cmp/pl r3 \n" /* loop count > 0? */
+ "bt .wa_loop \n" /* yes: loop */
+ : /* outputs */
+ /* %0, in & out */ "+r"(_gray_random_buffer),
+ /* %1, in & out */ "+r"(pat_ptr)
+ : /* inputs */
+ /* %2 */ "r"(src),
+ /* %3 */ "r"(stride),
+ /* %4 */ "r"(_graybuf->depth),
+ /* %5 */ "r"(_graybuf->bitpattern),
+ /* %6 */ "r"(_graybuf->randmask),
+ /* %7 */ "r"(mask)
+ : /* clobbers */
+ "r0", "r1", "r2", "r3", "r4", "r5", "macl", "pr"
+ );
+
+ end_addr = address + MULU16(_graybuf->depth, _graybuf->plane_size);
+
+ /* set the bits for all 8 pixels in all bytes according to the
+ * precalculated patterns on the pattern stack */
+ asm volatile (
+ "mov.l @%3+,r1 \n" /* pop all 8 patterns */
+ "mov.l @%3+,r2 \n"
+ "mov.l @%3+,r3 \n"
+ "mov.l @%3+,r8 \n"
+ "mov.l @%3+,r9 \n"
+ "mov.l @%3+,r10 \n"
+ "mov.l @%3+,r11 \n"
+ "mov.l @%3+,r12 \n"
+
+ "not %4,%4 \n" /* "set" mask -> "keep" mask */
+ "extu.b %4,%4 \n" /* mask out high bits */
+ "tst %4,%4 \n" /* nothing to keep? */
+ "bt .wa_sloop \n" /* yes: jump to short loop */
+
+ ".wa_floop: \n" /** full loop (there are bits to keep)**/
+ "shlr r1 \n" /* rotate lsb of pattern 1 to t bit */
+ "rotcl r0 \n" /* rotate t bit into r0 */
+ "shlr r2 \n"
+ "rotcl r0 \n"
+ "shlr r3 \n"
+ "rotcl r0 \n"
+ "shlr r8 \n"
+ "rotcl r0 \n"
+ "shlr r9 \n"
+ "rotcl r0 \n"
+ "shlr r10 \n"
+ "rotcl r0 \n"
+ "shlr r11 \n"
+ "rotcl r0 \n"
+ "shlr r12 \n"
+ "mov.b @%0,%3 \n" /* read old value */
+ "rotcl r0 \n"
+ "and %4,%3 \n" /* mask out unneeded bits */
+ "or r0,%3 \n" /* set new bits */
+ "mov.b %3,@%0 \n" /* store value to bitplane */
+ "add %2,%0 \n" /* advance to next bitplane */
+ "cmp/hi %0,%1 \n" /* last bitplane done? */
+ "bt .wa_floop \n" /* no: loop */
+
+ "bra .wa_end \n"
+ "nop \n"
+
+ ".wa_sloop: \n" /** short loop (nothing to keep) **/
+ "shlr r1 \n" /* rotate lsb of pattern 1 to t bit */
+ "rotcl r0 \n" /* rotate t bit into r0 */
+ "shlr r2 \n"
+ "rotcl r0 \n"
+ "shlr r3 \n"
+ "rotcl r0 \n"
+ "shlr r8 \n"
+ "rotcl r0 \n"
+ "shlr r9 \n"
+ "rotcl r0 \n"
+ "shlr r10 \n"
+ "rotcl r0 \n"
+ "shlr r11 \n"
+ "rotcl r0 \n"
+ "shlr r12 \n"
+ "rotcl r0 \n"
+ "mov.b r0,@%0 \n" /* store byte to bitplane */
+ "add %2,%0 \n" /* advance to next bitplane */
+ "cmp/hi %0,%1 \n" /* last bitplane done? */
+ "bt .wa_sloop \n" /* no: loop */
+
+ ".wa_end: \n"
+ : /* outputs */
+ : /* inputs */
+ /* %0 */ "r"(address),
+ /* %1 */ "r"(end_addr),
+ /* %2 */ "r"(_graybuf->plane_size),
+ /* %3 */ "r"(pat_ptr),
+ /* %4 */ "r"(mask)
+ : /* clobbers */
+ "r0", "r1", "r2", "r3", "r8", "r9", "r10", "r11", "r12"
+ );
+}
+
+/* References to C library routines used in _writearray */
+asm (
+ ".align 2 \n"
+".ashlsi3: \n" /* C library routine: */
+ ".long ___ashlsi3 \n" /* shift r4 left by r5, return in r0 */
+".lshrsi3: \n" /* C library routine: */
+ ".long ___lshrsi3 \n" /* shift r4 right by r5, return in r0 */
+ /* both routines preserve r4, destroy r5 and take ~16 cycles */
+);
+
+/*---------------------------------------------------------------------------
+ Copy a grayscale bitmap into the display
+ ----------------------------------------------------------------------------
+ A grayscale bitmap contains one byte for every pixel that defines the
+ brightness of the pixel (0..255). Bytes are read in row-major order.
+ The <stride> parameter is useful if you want to show only a part of a
+ bitmap. It should always be set to the "row length" of the bitmap, so
+ for displaying the whole bitmap, nx == stride.
+
+ This is the only drawing function NOT using the drawinfo.
+ */
+void gray_drawgraymap(const unsigned char *src, int x, int y, int nx, int ny,
+ int stride)
+{
+ int shift;
+ unsigned mask_top, mask_bottom;
+ const unsigned char *src_row;
+ unsigned char *dst, *dst_row;
+
+ if ((unsigned) x >= (unsigned) _graybuf->width
+ || (unsigned) y >= (unsigned) _graybuf->height)
+ return;
+
+ if ((unsigned) (y + ny) >= (unsigned) _graybuf->height) /* clip bottom */
+ ny = _graybuf->height - y;
+
+ if ((unsigned) (x + nx) >= (unsigned) _graybuf->width) /* clip right */
+ nx = _graybuf->width - x;
+
+ dst = _graybuf->data + x + MULU16(_graybuf->width, y >> 3);
+ shift = y & 7;
+ ny += shift;
+
+ mask_top = 0xFFu << (y & 7);
+ mask_bottom = ~(0xFEu << ((ny - 1) & 7));
+ if (ny <= 8)
+ mask_bottom &= mask_top;
+
+ if (ny > 8)
+ {
+ src_row = src;
+ dst_row = dst;
+
+ for (x = 0; x < nx; x++)
+ _writearray(dst_row++, src_row++, stride, mask_top);
+
+ src += MULU16(stride, 8 - shift);
+ dst += _graybuf->width;
+
+ for (y = 8; y < ny - 8; y += 8)
+ {
+ src_row = src;
+ dst_row = dst;
+
+ for (x = 0; x < nx; x++)
+ _writearray(dst_row++, src_row++, stride, 0xFFu);
+
+ src += stride << 3;
+ dst += _graybuf->width;
+ }
+ }
+
+ for (x = 0; x < nx; x++)
+ _writearray(dst++, src++, stride, mask_bottom);
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_drawline.c b/apps/plugins/lib/gray_drawline.c
new file mode 100644
index 0000000000..5ec4967c14
--- /dev/null
+++ b/apps/plugins/lib/gray_drawline.c
@@ -0,0 +1,119 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_drawline() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Draw a line from (x1, y1) to (x2, y2) with the current drawinfo
+ ----------------------------------------------------------------------------
+ See gray_drawpixel() for details
+ */
+void gray_drawline(int x1, int y1, int x2, int y2)
+{
+ int numpixels;
+ int i;
+ int deltax, deltay;
+ int d, dinc1, dinc2;
+ int x, xinc1, xinc2;
+ int y, yinc1, yinc2;
+ unsigned long pattern;
+ void (*pixelfunc)(int x, int y, unsigned long pattern);
+
+ if ((unsigned) x1 >= (unsigned) _graybuf->width
+ || (unsigned) y1 >= (unsigned) _graybuf->height
+ || (unsigned) x2 >= (unsigned) _graybuf->width
+ || (unsigned) y2 >= (unsigned) _graybuf->height)
+ return;
+
+ deltax = abs(x2 - x1);
+ deltay = abs(y2 - y1);
+ xinc2 = 1;
+ yinc2 = 1;
+
+ if (deltax >= deltay)
+ {
+ numpixels = deltax;
+ d = 2 * deltay - deltax;
+ dinc1 = deltay * 2;
+ dinc2 = (deltay - deltax) * 2;
+ xinc1 = 1;
+ yinc1 = 0;
+ }
+ else
+ {
+ numpixels = deltay;
+ d = 2 * deltax - deltay;
+ dinc1 = deltax * 2;
+ dinc2 = (deltax - deltay) * 2;
+ xinc1 = 0;
+ yinc1 = 1;
+ }
+ numpixels++; /* include endpoints */
+
+ if (x1 > x2)
+ {
+ xinc1 = -xinc1;
+ xinc2 = -xinc2;
+ }
+
+ if (y1 > y2)
+ {
+ yinc1 = -yinc1;
+ yinc2 = -yinc2;
+ }
+
+ x = x1;
+ y = y1;
+
+ pixelfunc = _gray_pixelfuncs[_graybuf->drawmode];
+ pattern = (_graybuf->drawmode == GRAY_DRAW_BG) ?
+ _graybuf->bg_pattern : _graybuf->fg_pattern;
+
+ for (i = 0; i < numpixels; i++)
+ {
+ pixelfunc(x, y, pattern);
+
+ if (d < 0)
+ {
+ d += dinc1;
+ x += xinc1;
+ y += yinc1;
+ }
+ else
+ {
+ d += dinc2;
+ x += xinc2;
+ y += yinc2;
+ }
+ }
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_drawpixel.c b/apps/plugins/lib/gray_drawpixel.c
new file mode 100644
index 0000000000..f7601f4360
--- /dev/null
+++ b/apps/plugins/lib/gray_drawpixel.c
@@ -0,0 +1,55 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_drawpixel() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Set a pixel with the current drawinfo
+ ----------------------------------------------------------------------------
+ If the drawmode is GRAY_DRAW_INVERSE, the pixel is inverted
+ GRAY_DRAW_FG and GRAY_DRAW_SOLID draw the pixel in the foreground shade
+ GRAY_DRAW_BG draws the pixel in the background shade
+ */
+void gray_drawpixel(int x, int y)
+{
+ unsigned long pattern;
+
+ if ((unsigned) x >= (unsigned) _graybuf->width
+ || (unsigned) y >= (unsigned) _graybuf->height)
+ return;
+
+ pattern = (_graybuf->drawmode == GRAY_DRAW_BG) ?
+ _graybuf->bg_pattern : _graybuf->fg_pattern;
+
+ _gray_pixelfuncs[_graybuf->drawmode](x, y, pattern);
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_drawrect.c b/apps/plugins/lib/gray_drawrect.c
new file mode 100644
index 0000000000..bd0bb71852
--- /dev/null
+++ b/apps/plugins/lib/gray_drawrect.c
@@ -0,0 +1,62 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_drawrect() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Draw a (hollow) rectangle with the current drawinfo
+ ----------------------------------------------------------------------------
+ See gray_drawpixel() for details
+ */
+void gray_drawrect(int x, int y, int nx, int ny)
+{
+ int x2, y2;
+
+ if ((unsigned) x >= (unsigned) _graybuf->width
+ || (unsigned) y >= (unsigned) _graybuf->height)
+ return;
+
+ if ((unsigned) (y + ny) >= (unsigned) _graybuf->height) /* clip bottom */
+ ny = _graybuf->height - y;
+
+ if ((unsigned) (x + nx) >= (unsigned) _graybuf->width) /* clip right */
+ nx = _graybuf->width - x;
+
+ x2 = x + nx - 1;
+ y2 = y + ny - 1;
+
+ gray_horline(x, x2, y);
+ gray_horline(x, x2, y2);
+ gray_verline(x, y, y2);
+ gray_verline(x2, y, y2);
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_fillrect.c b/apps/plugins/lib/gray_fillrect.c
new file mode 100644
index 0000000000..ac6d4818b9
--- /dev/null
+++ b/apps/plugins/lib/gray_fillrect.c
@@ -0,0 +1,92 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_fillrect() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Draw a filled rectangle with the current drawinfo
+ ----------------------------------------------------------------------------
+ See gray_drawpixel() for details
+
+ This one uses the block drawing optimization, so it is rather fast.
+ */
+void gray_fillrect(int x, int y, int nx, int ny)
+{
+ int shift;
+ unsigned bits, mask_top, mask_bottom;
+ unsigned char *dst, *dst_row;
+ void (*blockfunc)(unsigned char *address, unsigned mask, unsigned bits);
+
+ if ((unsigned) x >= (unsigned) _graybuf->width
+ || (unsigned) y >= (unsigned) _graybuf->height)
+ return;
+
+ if ((unsigned) (y + ny) >= (unsigned) _graybuf->height) /* clip bottom */
+ ny = _graybuf->height - y;
+
+ if ((unsigned) (x + nx) >= (unsigned) _graybuf->width) /* clip right */
+ nx = _graybuf->width - x;
+
+ dst = _graybuf->data + x + MULU16(_graybuf->width, y >> 3);
+ shift = y & 7;
+ ny += shift;
+
+ mask_top = 0xFFu << (y & 7);
+ mask_bottom = ~(0xFEu << ((ny - 1) & 7));
+ if (ny <= 8)
+ mask_bottom &= mask_top;
+
+ blockfunc = _gray_blockfuncs[_graybuf->drawmode];
+ bits = (_graybuf->drawmode == GRAY_DRAW_BG) ? 0u : 0xFFu;
+
+ if (ny > 8)
+ {
+ dst_row = dst;
+ for (x = 0; x < nx; x++)
+ blockfunc(dst_row++, mask_top, bits);
+
+ dst += _graybuf->width;
+
+ for (y = 8; y < ny - 8; y += 8)
+ {
+ dst_row = dst;
+ for (x = 0; x < nx; x++)
+ blockfunc(dst_row++, 0xFFu, bits);
+
+ dst += _graybuf->width;
+ }
+ }
+
+ for (x = 0; x < nx; x++)
+ blockfunc(dst++, mask_bottom, bits);
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_getstringsize.c b/apps/plugins/lib/gray_getstringsize.c
new file mode 100644
index 0000000000..5b6d3e7c49
--- /dev/null
+++ b/apps/plugins/lib/gray_getstringsize.c
@@ -0,0 +1,64 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_getstringsize() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Calculate width and height of the given text in pixels when rendered with
+ the currently selected font.
+ ----------------------------------------------------------------------------
+ This works exactly the same way as the core lcd_getstringsize(), only that
+ it uses the selected font for grayscale.
+ */
+int gray_getstringsize(const unsigned char *str, int *w, int *h)
+{
+ int ch;
+ int width = 0;
+ struct font *pf = _graybuf->curfont;
+
+ while ((ch = *str++))
+ {
+ /* check input range */
+ if (ch < pf->firstchar || ch >= pf->firstchar + pf->size)
+ ch = pf->defaultchar;
+ ch -= pf->firstchar;
+
+ /* get proportional width */
+ width += pf->width ? pf->width[ch] : pf->maxwidth;
+ }
+ if (w)
+ *w = width;
+ if (h)
+ *h = pf->height;
+ return width;
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_horline.c b/apps/plugins/lib/gray_horline.c
new file mode 100644
index 0000000000..c5ad0046de
--- /dev/null
+++ b/apps/plugins/lib/gray_horline.c
@@ -0,0 +1,65 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_horline() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Draw a horizontal line from (x1, y) to (x2, y) with the current drawinfo
+ ----------------------------------------------------------------------------
+ See gray_drawpixel() for details
+ */
+void gray_horline(int x1, int x2, int y)
+{
+ int x;
+ unsigned long pattern;
+ void (*pixelfunc)(int x, int y, unsigned long pattern);
+
+ if ((unsigned) x1 >= (unsigned) _graybuf->width
+ || (unsigned) x2 >= (unsigned) _graybuf->width
+ || (unsigned) y >= (unsigned) _graybuf->height)
+ return;
+
+ if (x1 > x2)
+ {
+ x = x1;
+ x1 = x2;
+ x2 = x;
+ }
+ pixelfunc = _gray_pixelfuncs[_graybuf->drawmode];
+ pattern = (_graybuf->drawmode == GRAY_DRAW_BG) ?
+ _graybuf->bg_pattern : _graybuf->fg_pattern;
+
+ for (x = x1; x <= x2; x++)
+ pixelfunc(x, y, pattern);
+
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_pixelfuncs.c b/apps/plugins/lib/gray_pixelfuncs.c
new file mode 100644
index 0000000000..31ce8deb3c
--- /dev/null
+++ b/apps/plugins/lib/gray_pixelfuncs.c
@@ -0,0 +1,245 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* Low level pixel drawing functions
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#if CONFIG_LCD == LCD_SSD1815 /* only for Recorder/Ondio */
+#include "gray.h"
+
+/* Prototypes */
+static void _writepixel(int x, int y, unsigned long pattern);
+static void _invertpixel(int x, int y, unsigned long pattern);
+
+/* function pointer array */
+void (* const _gray_pixelfuncs[4])(int x, int y, unsigned long pattern) = {
+ _invertpixel, _writepixel, _writepixel, _writepixel
+};
+
+/* Set a pixel to a specific bit pattern (low level routine) */
+static void _writepixel(int x, int y, unsigned long pattern)
+{
+ register unsigned mask, random;
+ register unsigned char *address;
+
+ /* Some (pseudo-)random function must be used here to shift the bit
+ * pattern randomly, otherwise you would get flicker and/or moire.
+ * Since rand() is relatively slow, I've implemented a simple, but very
+ * fast pseudo-random generator based on linear congruency in assembler.
+ * It delivers max. 16 pseudo-random bits in each iteration. */
+
+ /* simple but fast pseudo-random generator */
+ asm (
+ "mov #75,r1 \n"
+ "mulu %1,r1 \n" /* multiply by 75 */
+ "sts macl,%1 \n" /* get result */
+ "add #74,%1 \n" /* add another 74 */
+ /* Since the lower bits are not very random: */
+ "swap.b %1,%0 \n" /* get bits 8..15 (need max. 5) */
+ "and %2,%0 \n" /* mask out unneeded bits */
+ : /* outputs */
+ /* %0 */ "=&r"(random),
+ /* %1, in & out */ "+r"(_gray_random_buffer)
+ : /* inputs */
+ /* %2 */ "r"(_graybuf->randmask)
+ : /* clobbers */
+ "r1", "macl"
+ );
+
+ /* precalculate mask and byte address in first bitplane */
+ asm (
+ "mov %3,%0 \n" /* take y as base for address offset */
+ "shlr2 %0 \n" /* shift right by 3 (= divide by 8) */
+ "shlr %0 \n"
+ "mulu %0,%2 \n" /* multiply with width */
+ "and #7,%3 \n" /* get lower 3 bits of y */
+ "sts macl,%0 \n" /* get mulu result */
+ "add %4,%0 \n" /* add base + x to get final address */
+
+ "mov %3,%1 \n" /* move lower 3 bits of y out of r0 */
+ "mova .wp_masktable,%3\n" /* get address of mask table in r0 */
+ "bra .wp_predone \n" /* skip the table */
+ "mov.b @(%3,%1),%1 \n" /* get entry from mask table */
+
+ ".align 2 \n"
+ ".wp_masktable: \n" /* mask table */
+ ".byte 0x01 \n"
+ ".byte 0x02 \n"
+ ".byte 0x04 \n"
+ ".byte 0x08 \n"
+ ".byte 0x10 \n"
+ ".byte 0x20 \n"
+ ".byte 0x40 \n"
+ ".byte 0x80 \n"
+
+ ".wp_predone: \n"
+ : /* outputs */
+ /* %0 */ "=&r"(address),
+ /* %1 */ "=&r"(mask)
+ : /* inputs */
+ /* %2 */ "r"(_graybuf->width),
+ /* %3 = r0 */ "z"(y),
+ /* %4 */ "r"(_graybuf->data + x)
+ : /* clobbers */
+ "macl"
+ );
+
+ /* the hard part: set bits in all bitplanes according to pattern */
+ asm volatile (
+ "cmp/hs %1,%5 \n" /* random >= depth ? */
+ "bf .wp_ntrim \n"
+ "sub %1,%5 \n" /* yes: random -= depth */
+ /* it's sufficient to do this once, since the mask guarantees
+ * random < 2 * depth */
+ ".wp_ntrim: \n"
+
+ /* calculate some addresses */
+ "mulu %4,%1 \n" /* end address offset */
+ "not %3,r1 \n" /* get inverse mask (for "and") */
+ "sts macl,%1 \n" /* result of mulu */
+ "mulu %4,%5 \n" /* address offset of <random>'th plane */
+ "add %2,%1 \n" /* end offset -> end address */
+ "sts macl,%5 \n" /* result of mulu */
+ "add %2,%5 \n" /* address of <random>'th plane */
+ "bra .wp_start1 \n"
+ "mov %5,r2 \n" /* copy address */
+
+ /* first loop: set bits from <random>'th bitplane to last */
+ ".wp_loop1: \n"
+ "mov.b @r2,r3 \n" /* get data byte */
+ "shlr %0 \n" /* shift bit mask, sets t bit */
+ "and r1,r3 \n" /* reset bit (-> "white") */
+ "bf .wp_white1 \n" /* t=0? -> "white" bit */
+ "or %3,r3 \n" /* set bit ("black" bit) */
+ ".wp_white1: \n"
+ "mov.b r3,@r2 \n" /* store data byte */
+ "add %4,r2 \n" /* advance address to next bitplane */
+ ".wp_start1: \n"
+ "cmp/hi r2,%1 \n" /* address < end address ? */
+ "bt .wp_loop1 \n"
+
+ "bra .wp_start2 \n"
+ "nop \n"
+
+ /* second loop: set bits from first to <random-1>'th bitplane
+ * Bit setting works the other way round here to equalize average
+ * execution times for bright and dark pixels */
+ ".wp_loop2: \n"
+ "mov.b @%2,r3 \n" /* get data byte */
+ "shlr %0 \n" /* shift bit mask, sets t bit */
+ "or %3,r3 \n" /* set bit (-> "black") */
+ "bt .wp_black2 \n" /* t=1? -> "black" bit */
+ "and r1,r3 \n" /* reset bit ("white" bit) */
+ ".wp_black2: \n"
+ "mov.b r3,@%2 \n" /* store data byte */
+ "add %4,%2 \n" /* advance address to next bitplane */
+ ".wp_start2: \n"
+ "cmp/hi %2,%5 \n" /* address < <random>'th address ? */
+ "bt .wp_loop2 \n"
+ : /* outputs */
+ : /* inputs */
+ /* %0 */ "r"(pattern),
+ /* %1 */ "r"(_graybuf->depth),
+ /* %2 */ "r"(address),
+ /* %3 */ "r"(mask),
+ /* %4 */ "r"(_graybuf->plane_size),
+ /* %5 */ "r"(random)
+ : /* clobbers */
+ "r1", "r2", "r3", "macl"
+ );
+}
+
+/* invert all bits for one pixel (low level routine) */
+static void _invertpixel(int x, int y, unsigned long pattern)
+{
+ register unsigned mask;
+ register unsigned char *address;
+
+ (void) pattern; /* not used for invert */
+
+ /* precalculate mask and byte address in first bitplane */
+ asm (
+ "mov %3,%0 \n" /* take y as base for address offset */
+ "shlr2 %0 \n" /* shift right by 3 (= divide by 8) */
+ "shlr %0 \n"
+ "mulu %0,%2 \n" /* multiply with width */
+ "and #7,%3 \n" /* get lower 3 bits of y */
+ "sts macl,%0 \n" /* get mulu result */
+ "add %4,%0 \n" /* add base + x to get final address */
+
+ "mov %3,%1 \n" /* move lower 3 bits of y out of r0 */
+ "mova .ip_masktable,%3\n" /* get address of mask table in r0 */
+ "bra .ip_predone \n" /* skip the table */
+ "mov.b @(%3,%1),%1 \n" /* get entry from mask table */
+
+ ".align 2 \n"
+ ".ip_masktable: \n" /* mask table */
+ ".byte 0x01 \n"
+ ".byte 0x02 \n"
+ ".byte 0x04 \n"
+ ".byte 0x08 \n"
+ ".byte 0x10 \n"
+ ".byte 0x20 \n"
+ ".byte 0x40 \n"
+ ".byte 0x80 \n"
+
+ ".ip_predone: \n"
+ : /* outputs */
+ /* %0 */ "=&r"(address),
+ /* %1 */ "=&r"(mask)
+ : /* inputs */
+ /* %2 */ "r"(_graybuf->width),
+ /* %3 = r0 */ "z"(y),
+ /* %4 */ "r"(_graybuf->data + x)
+ : /* clobbers */
+ "macl"
+ );
+
+ /* invert bits in all bitplanes */
+ asm volatile (
+ "mov #0,r1 \n" /* current_plane = 0 */
+
+ ".ip_loop: \n"
+ "mov.b @%1,r2 \n" /* get data byte */
+ "add #1,r1 \n" /* current_plane++; */
+ "xor %2,r2 \n" /* invert bits */
+ "mov.b r2,@%1 \n" /* store data byte */
+ "add %3,%1 \n" /* advance address to next bitplane */
+ "cmp/hi r1,%0 \n" /* current_plane < depth ? */
+ "bt .ip_loop \n"
+ : /* outputs */
+ : /* inputs */
+ /* %0 */ "r"(_graybuf->depth),
+ /* %1 */ "r"(address),
+ /* %2 */ "r"(mask),
+ /* %3 */ "r"(_graybuf->plane_size)
+ : /* clobbers */
+ "r1", "r2"
+ );
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_position_display.c b/apps/plugins/lib/gray_position_display.c
new file mode 100644
index 0000000000..4ec13ee730
--- /dev/null
+++ b/apps/plugins/lib/gray_position_display.c
@@ -0,0 +1,57 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_position_display() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Set position of the top left corner of the grayscale overlay
+ ----------------------------------------------------------------------------
+ x = left margin in pixels
+ by = top margin in 8-pixel units
+
+ You may set this in a way that the overlay spills across the right or
+ bottom display border. In this case it will simply be clipped by the
+ LCD controller. You can even set negative values, this will clip at the
+ left or top border. I did not test it, but the limits may be +127 / -128
+
+ If you use this while the grayscale overlay is running, the now-freed area
+ will be restored.
+ */
+void gray_position_display(int x, int by)
+{
+ _graybuf->x = x;
+ _graybuf->by = by;
+
+ if (_graybuf->flags & _GRAY_RUNNING)
+ _graybuf->flags |= _GRAY_DEFERRED_UPDATE;
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_putsxy.c b/apps/plugins/lib/gray_putsxy.c
new file mode 100644
index 0000000000..9b34ad7a65
--- /dev/null
+++ b/apps/plugins/lib/gray_putsxy.c
@@ -0,0 +1,67 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_putsxy() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Display text starting at (x, y) with the current font and drawinfo
+ ----------------------------------------------------------------------------
+ The drawmode is used as described for gray_set_drawmode()
+ */
+void gray_putsxy(int x, int y, const unsigned char *str)
+{
+ int ch, width;
+ const unsigned char *bits;
+ struct font *pf = _graybuf->curfont;
+
+ if ((unsigned) x >= (unsigned) _graybuf->width
+ || (unsigned) y >= (unsigned) _graybuf->height)
+ return;
+
+ while ((ch = *str++) != '\0' && x < _graybuf->width)
+ {
+ /* check input range */
+ if (ch < pf->firstchar || ch >= pf->firstchar + pf->size)
+ ch = pf->defaultchar;
+ ch -= pf->firstchar;
+
+ /* get proportional width and glyph bits */
+ width = pf->width ? pf->width[ch] : pf->maxwidth;
+ bits = pf->bits + (pf->offset ? pf->offset[ch] :
+ MULU16((pf->height + 7) / 8, MULU16(pf->maxwidth, ch)));
+
+ gray_drawbitmap((const unsigned char*) bits, x, y, width, pf->height,
+ width);
+ x += width;
+ }
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_screendump.c b/apps/plugins/lib/gray_screendump.c
new file mode 100644
index 0000000000..fdc88b8547
--- /dev/null
+++ b/apps/plugins/lib/gray_screendump.c
@@ -0,0 +1,141 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_screendump() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+static const unsigned char bmpheader[] =
+{
+ 0x42, 0x4d, 0xba, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, 0x00,
+ 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x40, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c,
+ 0x00, 0x00, 0xc4, 0x0e, 0x00, 0x00, 0xc4, 0x0e, 0x00, 0x00, 0x21, 0x00,
+ 0x00, 0x00, 0x21, 0x00, 0x00, 0x00
+};
+
+static unsigned char linebuf[LCD_WIDTH];
+
+/*---------------------------------------------------------------------------
+ Save the current display content (b&w and grayscale overlay) to an 8-bit
+ BMP file in the root directory
+ ----------------------------------------------------------------------------
+ *
+ * This one is rather slow if used with larger bit depths, but it's intended
+ * primary use is for documenting the grayscale plugins. A much faster version
+ * would be possible, but would take more than twice the RAM
+ */
+void gray_screendump(void)
+{
+ int fh, i, bright;
+ int x, y, by, mask;
+ int gx, gby;
+
+ char filename[MAX_PATH];
+ struct tm *tm = _gray_rb->get_time();
+
+ unsigned char *lcdptr, *grayptr, *grayptr2;
+
+ _gray_rb->snprintf(filename, MAX_PATH,
+ "/graydump %04d-%02d-%02d %02d-%02d-%02d.bmp",
+ tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
+ fh = _gray_rb->creat(filename, O_WRONLY);
+
+ if (fh < 0)
+ return;
+
+ _gray_rb->write(fh, bmpheader, sizeof(bmpheader)); /* write header */
+
+ /* build clut, always 33 entries */
+
+ linebuf[3] = 0;
+
+ for (i = 0; i < 33; i++)
+ {
+ bright = MIN(i, _graybuf->depth);
+ linebuf[0] = linebuf[2] = MULU16(0x90, bright) / _graybuf->depth;
+ linebuf[1] = MULU16(0xee, bright) / _graybuf->depth;
+ _gray_rb->write(fh, linebuf, 4);
+ }
+
+ /* 8-bit BMP image goes bottom -> top */
+
+ for (y = LCD_HEIGHT - 1; y >= 0; y--)
+ {
+ _gray_rb->memset(linebuf, 32, sizeof(linebuf)); /* max. brightness */
+
+ mask = 1 << (y & 7);
+ by = y / 8;
+ lcdptr = _gray_rb->lcd_framebuffer + MULU16(LCD_WIDTH, by);
+ gby = by - _graybuf->by;
+
+ if ((_graybuf->flags & _GRAY_RUNNING)
+ && (unsigned) gby < (unsigned) _graybuf->bheight)
+ {
+ /* line contains grayscale (and maybe b&w) graphics */
+ grayptr = _graybuf->data + MULU16(_graybuf->width, gby);
+
+ for (x = 0; x < LCD_WIDTH; x++)
+ {
+ if (*lcdptr++ & mask)
+ linebuf[x] = 0;
+
+ gx = x - _graybuf->x;
+
+ if ((unsigned) gx < (unsigned) _graybuf->width)
+ {
+ bright = 0;
+ grayptr2 = grayptr + gx;
+
+ for (i = 0; i < _graybuf->depth; i++)
+ {
+ if (!(*grayptr2 & mask))
+ bright++;
+ grayptr2 += _graybuf->plane_size;
+ }
+ linebuf[x] = bright;
+ }
+ }
+ }
+ else
+ {
+ /* line contains only b&w graphics */
+ for (x = 0; x < LCD_WIDTH; x++)
+ if (*lcdptr++ & mask)
+ linebuf[x] = 0;
+ }
+
+ _gray_rb->write(fh, linebuf, sizeof(linebuf));
+ }
+
+ _gray_rb->close(fh);
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_scroll_down.c b/apps/plugins/lib/gray_scroll_down.c
new file mode 100644
index 0000000000..1fb1de8335
--- /dev/null
+++ b/apps/plugins/lib/gray_scroll_down.c
@@ -0,0 +1,134 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_scroll_down() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#if CONFIG_LCD == LCD_SSD1815 /* only for Recorder/Ondio */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Scroll the whole grayscale buffer down by <count> pixels (<= 7)
+ ----------------------------------------------------------------------------
+ black_border determines if the pixels scrolled in at the top are black
+ or white
+
+ Scrolling up/down pixel-wise is significantly slower than scrolling
+ left/right or scrolling up/down byte-wise because it involves bit
+ shifting. That's why it is asm optimized.
+ */
+void gray_scroll_down(int count, bool black_border)
+{
+ unsigned filler;
+
+ if ((unsigned) count > 7)
+ return;
+
+ filler = black_border ? (0xFFu << count) : 0;
+
+ /* scroll column by column to minimize flicker */
+ asm volatile (
+ "mov #0,r6 \n" /* x = 0 */
+ "mova .sd_shifttbl,r0 \n" /* calculate jump destination for */
+ "mov.b @(r0,%6),%6 \n" /* shift amount from table */
+ "bra .sd_cloop \n" /* skip table */
+ "add r0,%6 \n"
+
+ ".align 2 \n"
+ ".sd_shifttbl: \n" /* shift jump offset table */
+ ".byte .sd_shift0 - .sd_shifttbl \n"
+ ".byte .sd_shift1 - .sd_shifttbl \n"
+ ".byte .sd_shift2 - .sd_shifttbl \n"
+ ".byte .sd_shift3 - .sd_shifttbl \n"
+ ".byte .sd_shift4 - .sd_shifttbl \n"
+ ".byte .sd_shift5 - .sd_shifttbl \n"
+ ".byte .sd_shift6 - .sd_shifttbl \n"
+ ".byte .sd_shift7 - .sd_shifttbl \n"
+
+ ".sd_cloop: \n" /* repeat for every column */
+ "mov %1,r2 \n" /* get start address */
+ "mov #0,r3 \n" /* current_plane = 0 */
+
+ ".sd_oloop: \n" /* repeat for every bitplane */
+ "mov r2,r4 \n" /* get start address */
+ "mov #0,r5 \n" /* current_row = 0 */
+ "mov %5,r1 \n" /* get filler bits */
+
+ ".sd_iloop: \n" /* repeat for all rows */
+ "shlr8 r1 \n" /* shift right to get residue */
+ "mov.b @r4,r0 \n" /* get data byte */
+ "jmp @%6 \n" /* jump into shift "path" */
+ "extu.b r0,r0 \n" /* extend unsigned */
+
+ ".sd_shift6: \n" /* shift left by 0..7 bits */
+ "shll2 r0 \n"
+ ".sd_shift4: \n"
+ "shll2 r0 \n"
+ ".sd_shift2: \n"
+ "bra .sd_shift0 \n"
+ "shll2 r0 \n"
+ ".sd_shift7: \n"
+ "shll2 r0 \n"
+ ".sd_shift5: \n"
+ "shll2 r0 \n"
+ ".sd_shift3: \n"
+ "shll2 r0 \n"
+ ".sd_shift1: \n"
+ "shll r0 \n"
+ ".sd_shift0: \n"
+
+ "or r0,r1 \n" /* combine with last residue */
+ "mov.b r1,@r4 \n" /* store data */
+ "add %2,r4 \n" /* address += width */
+ "add #1,r5 \n" /* current_row++ */
+ "cmp/hi r5,%3 \n" /* current_row < bheight ? */
+ "bt .sd_iloop \n"
+
+ "add %4,r2 \n" /* start_address += plane_size */
+ "add #1,r3 \n" /* current_plane++ */
+ "cmp/hi r3,%0 \n" /* current_plane < depth ? */
+ "bt .sd_oloop \n"
+
+ "add #1,%1 \n" /* start_address++ */
+ "add #1,r6 \n" /* x++ */
+ "cmp/hi r6,%2 \n" /* x < width ? */
+ "bt .sd_cloop \n"
+ : /* outputs */
+ : /* inputs */
+ /* %0 */ "r"(_graybuf->depth),
+ /* %1 */ "r"(_graybuf->data),
+ /* %2 */ "r"(_graybuf->width),
+ /* %3 */ "r"(_graybuf->bheight),
+ /* %4 */ "r"(_graybuf->plane_size),
+ /* %5 */ "r"(filler),
+ /* %6 */ "r"(count)
+ : /* clobbers */
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6"
+ );
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_scroll_down8.c b/apps/plugins/lib/gray_scroll_down8.c
new file mode 100644
index 0000000000..db716baee7
--- /dev/null
+++ b/apps/plugins/lib/gray_scroll_down8.c
@@ -0,0 +1,69 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_scroll_down8() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Scroll the whole grayscale buffer down by 8 pixels
+ ----------------------------------------------------------------------------
+ black_border determines if the pixels scrolled in at the top are black
+ or white
+
+ Scrolling up/down by 8 pixels is very fast.
+ */
+void gray_scroll_down8(bool black_border)
+{
+ int by, d;
+ unsigned filler;
+ unsigned char *ptr;
+
+ filler = black_border ? 0xFF : 0;
+
+ /* Scroll row by row to minimize flicker (byte rows = 8 pixels each) */
+ for (by = _graybuf->bheight - 1; by > 0; by--)
+ {
+ ptr = _graybuf->data + MULU16(_graybuf->width, by);
+ for (d = 0; d < _graybuf->depth; d++)
+ {
+ _gray_rb->memcpy(ptr, ptr - _graybuf->width, _graybuf->width);
+ ptr += _graybuf->plane_size;
+ }
+ }
+ /* fill first row */
+ ptr = _graybuf->data;
+ for (d = 0; d < _graybuf->depth; d++)
+ {
+ _gray_rb->memset(ptr, filler, _graybuf->width);
+ ptr += _graybuf->plane_size;
+ }
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_scroll_left.c b/apps/plugins/lib/gray_scroll_left.c
new file mode 100644
index 0000000000..5fb9a441c1
--- /dev/null
+++ b/apps/plugins/lib/gray_scroll_left.c
@@ -0,0 +1,100 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_scroll_left() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#if CONFIG_LCD == LCD_SSD1815 /* only for Recorder/Ondio */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Scroll the whole grayscale buffer left by <count> pixels
+ ----------------------------------------------------------------------------
+ black_border determines if the pixels scrolled in at the right are black
+ or white
+
+ Scrolling left/right by an even pixel count is almost twice as fast as
+ scrolling by an odd pixel count.
+ */
+void gray_scroll_left(int count, bool black_border)
+{
+ int by, d;
+ unsigned filler;
+ unsigned char *ptr;
+
+ if ((unsigned) count >= (unsigned) _graybuf->width)
+ return;
+
+ filler = black_border ? 0xFF : 0;
+
+ /* Scroll row by row to minimize flicker (byte rows = 8 pixels each) */
+ for (by = 0; by < _graybuf->bheight; by++)
+ {
+ ptr = _graybuf->data + MULU16(_graybuf->width, by);
+ for (d = 0; d < _graybuf->depth; d++)
+ {
+ asm volatile (
+ "mov %0,r1 \n" /* check if both source... */
+ "or %2,r1 \n" /* ...and offset are even */
+ "shlr r1 \n" /* -> lsb = 0 */
+ "bf .sl_start2 \n" /* -> copy word-wise */
+
+ "add #-1,%2 \n" /* copy byte-wise */
+ ".sl_loop1: \n"
+ "mov.b @%0+,r1 \n"
+ "mov.b r1,@(%2,%0) \n"
+ "cmp/hi %0,%1 \n"
+ "bt .sl_loop1 \n"
+
+ "bra .sl_end \n"
+ "nop \n"
+
+ ".sl_start2: \n" /* copy word-wise */
+ "add #-2,%2 \n"
+ ".sl_loop2: \n"
+ "mov.w @%0+,r1 \n"
+ "mov.w r1,@(%2,%0) \n"
+ "cmp/hi %0,%1 \n"
+ "bt .sl_loop2 \n"
+
+ ".sl_end: \n"
+ : /* outputs */
+ : /* inputs */
+ /* %0 */ "r"(ptr + count),
+ /* %1 */ "r"(ptr + _graybuf->width),
+ /* %2 */ "z"(-count)
+ : /* clobbers */
+ "r1"
+ );
+
+ _gray_rb->memset(ptr + _graybuf->width - count, filler, count);
+ ptr += _graybuf->plane_size;
+ }
+ }
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_scroll_right.c b/apps/plugins/lib/gray_scroll_right.c
new file mode 100644
index 0000000000..f944319d91
--- /dev/null
+++ b/apps/plugins/lib/gray_scroll_right.c
@@ -0,0 +1,100 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_scroll_right() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#if CONFIG_LCD == LCD_SSD1815 /* only for Recorder/Ondio */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Scroll the whole grayscale buffer right by <count> pixels
+ ----------------------------------------------------------------------------
+ black_border determines if the pixels scrolled in at the left are black
+ or white
+
+ Scrolling left/right by an even pixel count is almost twice as fast as
+ scrolling by an odd pixel count.
+ */
+void gray_scroll_right(int count, bool black_border)
+{
+ int by, d;
+ unsigned filler;
+ unsigned char *ptr;
+
+ if ((unsigned) count >= (unsigned) _graybuf->width)
+ return;
+
+ filler = black_border ? 0xFF : 0;
+
+ /* Scroll row by row to minimize flicker (byte rows = 8 pixels each) */
+ for (by = 0; by < _graybuf->bheight; by++)
+ {
+ ptr = _graybuf->data + MULU16(_graybuf->width, by);
+ for (d = 0; d < _graybuf->depth; d++)
+ {
+ asm volatile (
+ "mov %0,r1 \n" /* check if both source... */
+ "or %2,r1 \n" /* ...and offset are even */
+ "shlr r1 \n" /* -> lsb = 0 */
+ "bf .sr_start2 \n" /* -> copy word-wise */
+
+ "add #-1,%2 \n" /* copy byte-wise */
+ ".sr_loop1: \n"
+ "mov.b @(%2,%0),r1 \n"
+ "mov.b r1,@-%0 \n"
+ "cmp/hi %1,%0 \n"
+ "bt .sr_loop1 \n"
+
+ "bra .sr_end \n"
+ "nop \n"
+
+ ".sr_start2: \n" /* copy word-wise */
+ "add #-2,%2 \n"
+ ".sr_loop2: \n"
+ "mov.w @(%2,%0),r1 \n"
+ "mov.w r1,@-%0 \n"
+ "cmp/hi %1,%0 \n"
+ "bt .sr_loop2 \n"
+
+ ".sr_end: \n"
+ : /* outputs */
+ : /* inputs */
+ /* %0 */ "r"(ptr + _graybuf->width),
+ /* %1 */ "r"(ptr + count),
+ /* %2 */ "z"(-count)
+ : /* clobbers */
+ "r1"
+ );
+
+ _gray_rb->memset(ptr, filler, count);
+ ptr += _graybuf->plane_size;
+ }
+ }
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_scroll_up.c b/apps/plugins/lib/gray_scroll_up.c
new file mode 100644
index 0000000000..4c493071af
--- /dev/null
+++ b/apps/plugins/lib/gray_scroll_up.c
@@ -0,0 +1,135 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_scroll_up() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#if CONFIG_LCD == LCD_SSD1815 /* only for Recorder/Ondio */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Scroll the whole grayscale buffer up by <count> pixels (<= 7)
+ ----------------------------------------------------------------------------
+ black_border determines if the pixels scrolled in at the bottom are black
+ or white
+
+ Scrolling up/down pixel-wise is significantly slower than scrolling
+ left/right or scrolling up/down byte-wise because it involves bit
+ shifting. That's why it is asm optimized.
+ */
+void gray_scroll_up(int count, bool black_border)
+{
+ unsigned filler;
+
+ if ((unsigned) count > 7)
+ return;
+
+ filler = black_border ? 0xFFu : 0;
+
+ /* scroll column by column to minimize flicker */
+ asm volatile (
+ "mov #0,r6 \n" /* x = 0 */
+ "mova .su_shifttbl,r0 \n" /* calculate jump destination for */
+ "mov.b @(r0,%6),%6 \n" /* shift amount from table */
+ "bra .su_cloop \n" /* skip table */
+ "add r0,%6 \n"
+
+ ".align 2 \n"
+ ".su_shifttbl: \n" /* shift jump offset table */
+ ".byte .su_shift0 - .su_shifttbl \n"
+ ".byte .su_shift1 - .su_shifttbl \n"
+ ".byte .su_shift2 - .su_shifttbl \n"
+ ".byte .su_shift3 - .su_shifttbl \n"
+ ".byte .su_shift4 - .su_shifttbl \n"
+ ".byte .su_shift5 - .su_shifttbl \n"
+ ".byte .su_shift6 - .su_shifttbl \n"
+ ".byte .su_shift7 - .su_shifttbl \n"
+
+ ".su_cloop: \n" /* repeat for every column */
+ "mov %1,r2 \n" /* get start address */
+ "mov #0,r3 \n" /* current_plane = 0 */
+
+ ".su_oloop: \n" /* repeat for every bitplane */
+ "mov r2,r4 \n" /* get start address */
+ "mov #0,r5 \n" /* current_row = 0 */
+ "mov %5,r1 \n" /* get filler bits */
+
+ ".su_iloop: \n" /* repeat for all rows */
+ "sub %2,r4 \n" /* address -= width */
+ "mov.b @r4,r0 \n" /* get data byte */
+ "shll8 r1 \n" /* old data to 2nd byte */
+ "extu.b r0,r0 \n" /* extend unsigned */
+ "or r1,r0 \n" /* combine old data */
+ "jmp @%6 \n" /* jump into shift "path" */
+ "extu.b r0,r1 \n" /* store data for next round */
+
+ ".su_shift6: \n" /* shift right by 0..7 bits */
+ "shlr2 r0 \n"
+ ".su_shift4: \n"
+ "shlr2 r0 \n"
+ ".su_shift2: \n"
+ "bra .su_shift0 \n"
+ "shlr2 r0 \n"
+ ".su_shift7: \n"
+ "shlr2 r0 \n"
+ ".su_shift5: \n"
+ "shlr2 r0 \n"
+ ".su_shift3: \n"
+ "shlr2 r0 \n"
+ ".su_shift1: \n"
+ "shlr r0 \n"
+ ".su_shift0: \n"
+
+ "mov.b r0,@r4 \n" /* store data */
+ "add #1,r5 \n" /* current_row++ */
+ "cmp/hi r5,%3 \n" /* current_row < bheight ? */
+ "bt .su_iloop \n"
+
+ "add %4,r2 \n" /* start_address += plane_size */
+ "add #1,r3 \n" /* current_plane++ */
+ "cmp/hi r3,%0 \n" /* current_plane < depth ? */
+ "bt .su_oloop \n"
+
+ "add #1,%1 \n" /* start_address++ */
+ "add #1,r6 \n" /* x++ */
+ "cmp/hi r6,%2 \n" /* x < width ? */
+ "bt .su_cloop \n"
+ : /* outputs */
+ : /* inputs */
+ /* %0 */ "r"(_graybuf->depth),
+ /* %1 */ "r"(_graybuf->data + _graybuf->plane_size),
+ /* %2 */ "r"(_graybuf->width),
+ /* %3 */ "r"(_graybuf->bheight),
+ /* %4 */ "r"(_graybuf->plane_size),
+ /* %5 */ "r"(filler),
+ /* %6 */ "r"(count)
+ : /* clobbers */
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6"
+ );
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_scroll_up8.c b/apps/plugins/lib/gray_scroll_up8.c
new file mode 100644
index 0000000000..b181673f22
--- /dev/null
+++ b/apps/plugins/lib/gray_scroll_up8.c
@@ -0,0 +1,69 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_scroll_up8() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Scroll the whole grayscale buffer up by 8 pixels
+ ----------------------------------------------------------------------------
+ black_border determines if the pixels scrolled in at the bottom are black
+ or white
+
+ Scrolling up/down by 8 pixels is very fast.
+ */
+void gray_scroll_up8(bool black_border)
+{
+ int by, d;
+ unsigned filler;
+ unsigned char *ptr;
+
+ filler = black_border ? 0xFF : 0;
+
+ /* Scroll row by row to minimize flicker (byte rows = 8 pixels each) */
+ for (by = 1; by < _graybuf->bheight; by++)
+ {
+ ptr = _graybuf->data + MULU16(_graybuf->width, by);
+ for (d = 0; d < _graybuf->depth; d++)
+ {
+ _gray_rb->memcpy(ptr - _graybuf->width, ptr, _graybuf->width);
+ ptr += _graybuf->plane_size;
+ }
+ }
+ /* fill last row */
+ ptr = _graybuf->data + _graybuf->plane_size - _graybuf->width;
+ for (d = 0; d < _graybuf->depth; d++)
+ {
+ _gray_rb->memset(ptr, filler, _graybuf->width);
+ ptr += _graybuf->plane_size;
+ }
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_set_background.c b/apps/plugins/lib/gray_set_background.c
new file mode 100644
index 0000000000..c78e9ff112
--- /dev/null
+++ b/apps/plugins/lib/gray_set_background.c
@@ -0,0 +1,48 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_set_background() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Set the background shade for subsequent drawing operations
+ ----------------------------------------------------------------------------
+ brightness = 0 (black) .. 255 (white)
+
+ Default after initialization: 255
+ */
+void gray_set_background(int brightness)
+{
+ if ((unsigned) brightness <= 255)
+ _graybuf->bg_pattern = _graybuf->bitpattern[MULU16(brightness,
+ _graybuf->depth + 1) >> 8];
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_set_drawinfo.c b/apps/plugins/lib/gray_set_drawinfo.c
new file mode 100644
index 0000000000..59928882d7
--- /dev/null
+++ b/apps/plugins/lib/gray_set_drawinfo.c
@@ -0,0 +1,49 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_set_drawinfo() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Set draw mode, foreground and background shades at once
+ ----------------------------------------------------------------------------
+ If you hand it -1 (or in fact any other out-of-bounds value) for a
+ parameter, that particular setting won't be changed
+
+ Default after initialization: GRAY_DRAW_SOLID, 0, 255
+ */
+void gray_set_drawinfo(int drawmode, int fg_brightness, int bg_brightness)
+{
+ gray_set_drawmode(drawmode);
+ gray_set_foreground(fg_brightness);
+ gray_set_background(bg_brightness);
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_set_drawmode.c b/apps/plugins/lib/gray_set_drawmode.c
new file mode 100644
index 0000000000..969b99894f
--- /dev/null
+++ b/apps/plugins/lib/gray_set_drawmode.c
@@ -0,0 +1,52 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_set_drawmode() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Set the draw mode for subsequent drawing operations
+ ----------------------------------------------------------------------------
+ drawmode =
+ GRAY_DRAW_INVERSE: Foreground pixels are inverted, background pixels are
+ left untouched
+ GRAY_DRAW_FG: Only foreground pixels are drawn
+ GRAY_DRAW_BG: Only background pixels are drawn
+ GRAY_DRAW_SOLID: Foreground and background pixels are drawn
+
+ Default after initialization: GRAY_DRAW_SOLID
+ */
+void gray_set_drawmode(int drawmode)
+{
+ if ((unsigned) drawmode <= GRAY_DRAW_SOLID)
+ _graybuf->drawmode = drawmode;
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_set_foreground.c b/apps/plugins/lib/gray_set_foreground.c
new file mode 100644
index 0000000000..afde64f645
--- /dev/null
+++ b/apps/plugins/lib/gray_set_foreground.c
@@ -0,0 +1,48 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_set_foreground() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Set the foreground shade for subsequent drawing operations
+ ----------------------------------------------------------------------------
+ brightness = 0 (black) .. 255 (white)
+
+ Default after initialization: 0
+ */
+void gray_set_foreground(int brightness)
+{
+ if ((unsigned) brightness <= 255)
+ _graybuf->fg_pattern = _graybuf->bitpattern[MULU16(brightness,
+ _graybuf->depth + 1) >> 8];
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_setfont.c b/apps/plugins/lib/gray_setfont.c
new file mode 100644
index 0000000000..714a1f5b17
--- /dev/null
+++ b/apps/plugins/lib/gray_setfont.c
@@ -0,0 +1,47 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+* gray_setfont() function
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Set font for the font routines
+ ----------------------------------------------------------------------------
+ newfont can be FONT_SYSFIXED or FONT_UI the same way as with the Rockbox
+ core routines
+
+ Default after initialization: FONT_SYSFIXED
+ */
+void gray_setfont(int newfont)
+{
+ _graybuf->curfont = _gray_rb->font_get(newfont);
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/gray_verline.c b/apps/plugins/lib/gray_verline.c
new file mode 100644
index 0000000000..15910b41cf
--- /dev/null
+++ b/apps/plugins/lib/gray_verline.c
@@ -0,0 +1,88 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Grayscale framework
+* gray_verline() function
+*
+* This is a generic framework to use grayscale display within Rockbox
+* plugins. It obviously does not work for the player.
+*
+* Copyright (C) 2004 Jens Arnold
+*
+* All files in this archive are subject to the GNU General Public License.
+* See the file COPYING in the source tree root for full license agreement.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef SIMULATOR /* not for simulator by now */
+#include "plugin.h"
+
+#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
+#include "gray.h"
+
+/*---------------------------------------------------------------------------
+ Draw a vertical line from (x, y1) to (x, y2) with the current drawinfo
+ ----------------------------------------------------------------------------
+ See gray_drawpixel() for details
+ This one uses the block drawing optimization, so it is rather fast.
+ */
+void gray_verline(int x, int y1, int y2)
+{
+ int shift, y, ny;
+ unsigned bits, mask_top, mask_bottom;
+ unsigned char *dst;
+ void (*blockfunc)(unsigned char *address, unsigned mask, unsigned bits);
+
+ if ((unsigned) x >= (unsigned) _graybuf->width
+ || (unsigned) y1 >= (unsigned) _graybuf->height
+ || (unsigned) y2 >= (unsigned) _graybuf->height)
+ return;
+
+ if (y1 > y2)
+ {
+ y = y1;
+ y1 = y2;
+ y2 = y;
+ }
+ y = y1;
+ ny = y2 - y1 + 1;
+
+ dst = _graybuf->data + x + MULU16(_graybuf->width, y >> 3);
+ shift = y & 7;
+ ny += shift;
+
+ mask_top = 0xFFu << (y & 7);
+ mask_bottom = ~(0xFEu << ((ny - 1) & 7));
+ if (ny <= 8)
+ mask_bottom &= mask_top;
+
+ blockfunc = _gray_blockfuncs[_graybuf->drawmode];
+ bits = (_graybuf->drawmode == GRAY_DRAW_BG) ? 0u : 0xFFu;
+
+ if (ny > 8)
+ {
+ blockfunc(dst, mask_top, bits);
+ dst += _graybuf->width;
+
+ for (y = 8; y < ny - 8; y += 8)
+ {
+ blockfunc(dst, 0xFFu, bits);
+ dst += _graybuf->width;
+ }
+ }
+
+ blockfunc(dst, mask_bottom, bits);
+}
+
+#endif // #ifdef HAVE_LCD_BITMAP
+#endif // #ifndef SIMULATOR
+
diff --git a/apps/plugins/lib/xxx2wav.c b/apps/plugins/lib/xxx2wav.c
new file mode 100644
index 0000000000..8eadfb815e
--- /dev/null
+++ b/apps/plugins/lib/xxx2wav.c
@@ -0,0 +1,259 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 Dave Chapman
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* Various "helper functions" common to all the xxx2wav decoder plugins */
+
+#if (CONFIG_HWCODEC == MASNONE)
+/* software codec platforms, not for simulator */
+
+#include "plugin.h"
+#include "xxx2wav.h"
+
+static struct plugin_api* local_rb;
+
+int mem_ptr;
+int bufsize;
+unsigned char* audiobuf; // The actual audio buffer from Rockbox
+unsigned char* mallocbuf; // 512K from the start of audio buffer
+unsigned char* filebuf; // The rest of the audio buffer
+
+void* codec_malloc(size_t size) {
+ void* x;
+
+ x=&mallocbuf[mem_ptr];
+ mem_ptr+=(size+3)&~3; // Keep memory 32-bit aligned (if it was already?)
+/*
+ if(TIME_AFTER(*(local_rb->current_tick), last_tick + HZ)) {
+ char s[32];
+ static long last_tick = 0;
+ local_rb->snprintf(s,30,"Memory used: %d",mem_ptr);
+ local_rb->lcd_putsxy(0,80,s);
+
+ last_tick = *(local_rb->current_tick);
+ local_rb->lcd_update();
+ }*/
+ return(x);
+}
+
+void* codec_calloc(size_t nmemb, size_t size) {
+ void* x;
+ x = codec_malloc(nmemb*size);
+ local_rb->memset(x,0,nmemb*size);
+ return(x);
+}
+
+void* codec_alloca(size_t size) {
+ void* x;
+ x = codec_malloc(size);
+ return(x);
+}
+
+void codec_free(void* ptr) {
+ (void)ptr;
+}
+
+void* codec_realloc(void* ptr, size_t size) {
+ void* x;
+ (void)ptr;
+ x = codec_malloc(size);
+ return(x);
+}
+
+void *memcpy(void *dest, const void *src, size_t n) {
+ return(local_rb->memcpy(dest,src,n));
+}
+
+void *memset(void *s, int c, size_t n) {
+ return(local_rb->memset(s,c,n));
+}
+
+int memcmp(const void *s1, const void *s2, size_t n) {
+ return(local_rb->memcmp(s1,s2,n));
+}
+
+void* memchr(const void *s, int c, size_t n) {
+ /* TO DO: Implement for Tremor */
+ (void)s;
+ (void)c;
+ (void)n;
+ return(NULL);
+}
+
+void* memmove(const void *s1, const void *s2, size_t n) {
+ char* dest=(char*)s1;
+ char* src=(char*)s2;
+ size_t i;
+
+ for (i=0;i<n;i++) { dest[i]=src[i]; }
+ // while(n>0) { *(dest++)=*(src++); n--; }
+ return(dest);
+}
+
+void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) {
+ local_rb->qsort(base,nmemb,size,compar);
+}
+
+void display_status(file_info_struct* file_info) {
+ char s[32];
+ unsigned long ticks_taken;
+ unsigned long long speed;
+ unsigned long xspeed;
+ static long last_tick = 0;
+
+ if(TIME_AFTER(*(local_rb->current_tick), last_tick + HZ)) {
+ local_rb->snprintf(s,32,"Bytes read: %d",file_info->curpos);
+ local_rb->lcd_putsxy(0,0,s);
+ local_rb->snprintf(s,32,"Samples Decoded: %d",file_info->current_sample);
+ local_rb->lcd_putsxy(0,20,s);
+ local_rb->snprintf(s,32,"Frames Decoded: %d",file_info->frames_decoded);
+ local_rb->lcd_putsxy(0,40,s);
+
+ ticks_taken=*(local_rb->current_tick)-file_info->start_tick;
+
+ /* e.g.:
+ ticks_taken=500
+ sam_fmt.rate=44,100
+ samples_decoded=172,400
+ (samples_decoded/sam_fmt.rate)*100=400 (time it should have taken)
+ % Speed=(400/500)*100=80%
+ */
+
+ if (ticks_taken==0) { ticks_taken=1; } // Avoid fp exception.
+
+ speed=(100*file_info->current_sample)/file_info->samplerate;
+ xspeed=(speed*10000)/ticks_taken;
+ local_rb->snprintf(s,32,"Speed %ld.%02ld %% Secs: %d",(xspeed/100),(xspeed%100),ticks_taken/100);
+ local_rb->lcd_putsxy(0,60,s);
+
+ last_tick = *(local_rb->current_tick);
+ local_rb->lcd_update();
+ }
+}
+
+static unsigned char wav_header[44]={'R','I','F','F', // 0 - ChunkID
+ 0,0,0,0, // 4 - ChunkSize (filesize-8)
+ 'W','A','V','E', // 8 - Format
+ 'f','m','t',' ', // 12 - SubChunkID
+ 16,0,0,0, // 16 - SubChunk1ID // 16 for PCM
+ 1,0, // 20 - AudioFormat (1=16-bit)
+ 2,0, // 22 - NumChannels
+ 0,0,0,0, // 24 - SampleRate in Hz
+ 0,0,0,0, // 28 - Byte Rate (SampleRate*NumChannels*(BitsPerSample/8)
+ 4,0, // 32 - BlockAlign (== NumChannels * BitsPerSample/8)
+ 16,0, // 34 - BitsPerSample
+ 'd','a','t','a', // 36 - Subchunk2ID
+ 0,0,0,0 // 40 - Subchunk2Size
+ };
+
+
+void xxx2wav_set_api(struct plugin_api* rb)
+{
+ local_rb = rb;
+}
+
+int local_init(char* infilename, char* outfilename, file_info_struct* file_info, struct plugin_api* rb) {
+ char s[32];
+ int i,n,bytesleft;
+
+ local_rb=rb;
+
+ mem_ptr=0;
+ audiobuf=local_rb->plugin_get_audio_buffer(&bufsize);
+ mallocbuf=audiobuf;
+ filebuf=&audiobuf[MALLOC_BUFSIZE];
+
+ local_rb->snprintf(s,32,"audio bufsize: %d",bufsize);
+ local_rb->lcd_putsxy(0,100,s);
+ local_rb->lcd_update();
+
+ file_info->infile=local_rb->open(infilename,O_RDONLY);
+ file_info->outfile=local_rb->creat(outfilename,O_WRONLY);
+ local_rb->write(file_info->outfile,wav_header,sizeof(wav_header));
+ file_info->curpos=0;
+ file_info->current_sample=0;
+ file_info->frames_decoded=0;
+ file_info->filesize=local_rb->filesize(file_info->infile);
+
+ local_rb->splash(HZ, true, "in: %d, size: %d", file_info->infile, file_info->filesize);
+
+ if (file_info->filesize > (bufsize-MALLOC_BUFSIZE)) {
+ local_rb->close(file_info->infile);
+ local_rb->splash(HZ*2, true, "File too large");
+ return(1);
+ }
+
+ local_rb->snprintf(s,32,"Loading file...");
+ local_rb->lcd_putsxy(0,0,s);
+ local_rb->lcd_update();
+
+ bytesleft=file_info->filesize;
+ i=0;
+ while (bytesleft > 0) {
+ n=local_rb->read(file_info->infile,&filebuf[i],bytesleft);
+ if (n < 0) {
+ local_rb->close(file_info->infile);
+ local_rb->splash(HZ*2, true, "ERROR READING FILE");
+ return(1);
+ }
+ i+=n; bytesleft-=n;
+ }
+ local_rb->close(file_info->infile);
+ local_rb->lcd_clear_display();
+ return(0);
+}
+
+void close_wav(file_info_struct* file_info) {
+ int x;
+ int filesize=local_rb->filesize(file_info->outfile);
+
+ /* We assume 16-bit, Stereo */
+
+ local_rb->lseek(file_info->outfile,0,SEEK_SET);
+
+ // ChunkSize
+ x=filesize-8;
+ wav_header[4]=(x&0xff);
+ wav_header[5]=(x&0xff00)>>8;
+ wav_header[6]=(x&0xff0000)>>16;
+ wav_header[7]=(x&0xff000000)>>24;
+
+ // Samplerate
+ wav_header[24]=file_info->samplerate&0xff;
+ wav_header[25]=(file_info->samplerate&0xff00)>>8;
+ wav_header[26]=(file_info->samplerate&0xff0000)>>16;
+ wav_header[27]=(file_info->samplerate&0xff000000)>>24;
+
+ // ByteRate
+ x=file_info->samplerate*4;
+ wav_header[28]=(x&0xff);
+ wav_header[29]=(x&0xff00)>>8;
+ wav_header[30]=(x&0xff0000)>>16;
+ wav_header[31]=(x&0xff000000)>>24;
+
+ // Subchunk2Size
+ x=filesize-44;
+ wav_header[40]=(x&0xff);
+ wav_header[41]=(x&0xff00)>>8;
+ wav_header[42]=(x&0xff0000)>>16;
+ wav_header[43]=(x&0xff000000)>>24;
+
+ local_rb->write(file_info->outfile,wav_header,sizeof(wav_header));
+ local_rb->close(file_info->outfile);
+}
+#endif /* CONFIG_HWCODEC == MASNONE */
diff --git a/apps/plugins/lib/xxx2wav.h b/apps/plugins/lib/xxx2wav.h
new file mode 100644
index 0000000000..7e1b942820
--- /dev/null
+++ b/apps/plugins/lib/xxx2wav.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 Dave Chapman
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* Various "helper functions" common to all the xxx2wav decoder plugins */
+
+#if CONFIG_CPU == MCF5249 && !defined(SIMULATOR)
+#define ICODE_ATTR __attribute__ ((section(".icode")))
+#define IDATA_ATTR __attribute__ ((section(".idata")))
+#define USE_IRAM 1
+#else
+#define ICODE_ATTR
+#define IDATA_ATTR
+#endif
+
+/* the main data structure of the program */
+typedef struct {
+ int infile;
+ int outfile;
+ off_t curpos;
+ off_t filesize;
+ int samplerate;
+ int bitspersample;
+ int channels;
+ int frames_decoded;
+ unsigned long total_samples;
+ unsigned long current_sample;
+ unsigned long start_tick;
+} file_info_struct;
+
+#define MALLOC_BUFSIZE (512*1024)
+
+extern int mem_ptr;
+extern int bufsize;
+extern unsigned char* mp3buf; // The actual MP3 buffer from Rockbox
+extern unsigned char* mallocbuf; // 512K from the start of MP3 buffer
+extern unsigned char* filebuf; // The rest of the MP3 buffer
+
+void* codec_malloc(size_t size);
+void* codec_calloc(size_t nmemb, size_t size);
+void* codec_alloca(size_t size);
+void* codec_realloc(void* ptr, size_t size);
+void codec_free(void* ptr);
+void *memcpy(void *dest, const void *src, size_t n);
+void *memset(void *s, int c, size_t n);
+int memcmp(const void *s1, const void *s2, size_t n);
+void* memmove(const void *s1, const void *s2, size_t n);
+
+void display_status(file_info_struct* file_info);
+int local_init(char* infilename, char* outfilename, file_info_struct* file_info, struct plugin_api* rb);
+void close_wav(file_info_struct* file_info);
+void xxx2wav_set_api(struct plugin_api* rb);
diff --git a/apps/plugins/mpa2wav.c b/apps/plugins/mpa2wav.c
new file mode 100644
index 0000000000..bf40fa3b81
--- /dev/null
+++ b/apps/plugins/mpa2wav.c
@@ -0,0 +1,269 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 Dave Chapman
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "plugin.h"
+
+#if (CONFIG_HWCODEC == MASNONE)
+/* software codec platforms */
+
+#include <codecs/libmad/mad.h>
+
+#include "lib/xxx2wav.h" /* Helper functions common to test decoders */
+
+static struct plugin_api* rb;
+
+struct mad_stream Stream IDATA_ATTR;
+struct mad_frame Frame IDATA_ATTR;
+struct mad_synth Synth IDATA_ATTR;
+mad_timer_t Timer;
+struct dither d0, d1;
+
+/* The following function is used inside libmad - let's hope it's never
+ called.
+*/
+
+void abort(void) {
+}
+
+/* The "dither" code to convert the 24-bit samples produced by libmad was
+ taken from the coolplayer project - coolplayer.sourceforge.net */
+
+struct dither {
+ mad_fixed_t error[3];
+ mad_fixed_t random;
+};
+
+# define SAMPLE_DEPTH 16
+# define scale(x, y) dither((x), (y))
+
+/*
+ * NAME: prng()
+ * DESCRIPTION: 32-bit pseudo-random number generator
+ */
+static __inline
+unsigned long prng(unsigned long state)
+{
+ return (state * 0x0019660dL + 0x3c6ef35fL) & 0xffffffffL;
+}
+
+/*
+ * NAME: dither()
+ * DESCRIPTION: dither and scale sample
+ */
+static __inline
+signed int dither(mad_fixed_t sample, struct dither *dither)
+{
+ unsigned int scalebits;
+ mad_fixed_t output, mask, random;
+
+ enum {
+ MIN = -MAD_F_ONE,
+ MAX = MAD_F_ONE - 1
+ };
+
+ /* noise shape */
+ sample += dither->error[0] - dither->error[1] + dither->error[2];
+
+ dither->error[2] = dither->error[1];
+ dither->error[1] = dither->error[0] / 2;
+
+ /* bias */
+ output = sample + (1L << (MAD_F_FRACBITS + 1 - SAMPLE_DEPTH - 1));
+
+ scalebits = MAD_F_FRACBITS + 1 - SAMPLE_DEPTH;
+ mask = (1L << scalebits) - 1;
+
+ /* dither */
+ random = prng(dither->random);
+ output += (random & mask) - (dither->random & mask);
+
+ dither->random = random;
+
+ /* clip */
+ if (output > MAX) {
+ output = MAX;
+
+ if (sample > MAX)
+ sample = MAX;
+ }
+ else if (output < MIN) {
+ output = MIN;
+
+ if (sample < MIN)
+ sample = MIN;
+ }
+
+ /* quantize */
+ output &= ~mask;
+
+ /* error feedback */
+ dither->error[0] = sample - output;
+
+ /* scale */
+ return output >> scalebits;
+}
+
+#define SHRT_MAX 32767
+
+#define INPUT_BUFFER_SIZE (10*8192)
+#define OUTPUT_BUFFER_SIZE 65536 /* Must be an integer multiple of 4. */
+
+unsigned char InputBuffer[INPUT_BUFFER_SIZE+MAD_BUFFER_GUARD];
+unsigned char OutputBuffer[OUTPUT_BUFFER_SIZE];
+unsigned char *OutputPtr=OutputBuffer;
+unsigned char *GuardPtr=NULL;
+const unsigned char *OutputBufferEnd=OutputBuffer+OUTPUT_BUFFER_SIZE;
+
+mad_fixed_t mad_frame_overlap[2][32][18] IDATA_ATTR;
+unsigned char mad_main_data[MAD_BUFFER_MDLEN] IDATA_ATTR;
+
+#ifdef USE_IRAM
+extern char iramcopy[];
+extern char iramstart[];
+extern char iramend[];
+#endif
+
+/* this is the plugin entry point */
+enum plugin_status plugin_start(struct plugin_api* api, void* file)
+{
+ file_info_struct file_info;
+ int Status=0;
+ unsigned short Sample;
+ int i;
+
+ /* Generic plugin inititialisation */
+
+ TEST_PLUGIN_API(api);
+ rb = api;
+
+#ifdef USE_IRAM
+ rb->memcpy(iramstart, iramcopy, iramend-iramstart);
+#endif
+
+ /* This function sets up the buffers and reads the file into RAM */
+
+ if (local_init(file,"/libmadtest.wav",&file_info,api)) {
+ return PLUGIN_ERROR;
+ }
+
+ /* Create a decoder instance */
+
+ mad_stream_init(&Stream);
+ mad_frame_init(&Frame);
+ mad_synth_init(&Synth);
+ mad_timer_reset(&Timer);
+
+ /* We do this so libmad doesn't try to call codec_calloc() */
+ memset(mad_frame_overlap, 0, sizeof(mad_frame_overlap));
+ Frame.overlap = &mad_frame_overlap;
+ Stream.main_data = &mad_main_data;
+
+ GuardPtr = &filebuf[file_info.filesize];
+ memset(GuardPtr,0,MAD_BUFFER_GUARD);
+ mad_stream_buffer(&Stream, filebuf,file_info.filesize);
+
+ file_info.curpos=0;
+ file_info.start_tick=*(rb->current_tick);
+
+ rb->button_clear_queue();
+
+ /* This is the decoding loop. */
+ while (file_info.curpos < file_info.filesize &&
+ Stream.this_frame != GuardPtr &&
+ Stream.error != MAD_ERROR_BUFLEN) {
+ file_info.curpos += (int)Stream.next_frame - (int)Stream.this_frame;
+
+ if(mad_frame_decode(&Frame,&Stream))
+ {
+ if(MAD_RECOVERABLE(Stream.error))
+ {
+ if(Stream.error!=MAD_ERROR_LOSTSYNC || Stream.this_frame!=GuardPtr)
+ {
+ rb->splash(HZ*1, true, "Recoverable...!");
+ }
+ continue;
+ }
+ else
+ if(Stream.error==MAD_ERROR_BUFLEN)
+ continue;
+ else
+ {
+ rb->splash(HZ*1, true, "Recoverable...!");
+ //fprintf(stderr,"%s: unrecoverable frame level error.\n",ProgName);
+ Status=1;
+ break;
+ }
+ }
+
+ /* We assume all frames have same samplerate as the first */
+ if(file_info.frames_decoded==0) {
+ file_info.samplerate=Frame.header.samplerate;
+ }
+
+ file_info.frames_decoded++;
+
+ /* ?? Do we need the timer module? */
+ mad_timer_add(&Timer,Frame.header.duration);
+
+/* DAVE: This can be used to attenuate the audio */
+// if(DoFilter)
+// ApplyFilter(&Frame);
+
+ mad_synth_frame(&Synth,&Frame);
+
+ /* Convert MAD's numbers to an array of 16-bit LE signed integers */
+ for(i=0;i<Synth.pcm.length;i++)
+ {
+ /* Left channel */
+ Sample=scale(Synth.pcm.samples[0][i],&d0);
+ *(OutputPtr++)=Sample&0xff;
+ *(OutputPtr++)=Sample>>8;
+
+ /* Right channel. If the decoded stream is monophonic then
+ * the right output channel is the same as the left one.
+ */
+ if(MAD_NCHANNELS(&Frame.header)==2)
+ Sample=scale(Synth.pcm.samples[1][i],&d1);
+ *(OutputPtr++)=Sample&0xff;
+ *(OutputPtr++)=Sample>>8;
+
+ /* Flush the buffer if it is full. */
+ if(OutputPtr==OutputBufferEnd)
+ {
+ rb->write(file_info.outfile,OutputBuffer,OUTPUT_BUFFER_SIZE);
+ OutputPtr=OutputBuffer;
+ }
+ }
+
+ file_info.current_sample+=Synth.pcm.length;
+
+ display_status(&file_info);
+
+ if (rb->button_get(false)!=BUTTON_NONE) {
+ close_wav(&file_info);
+ return PLUGIN_OK;
+ }
+ }
+
+ close_wav(&file_info);
+ rb->splash(HZ*2, true, "FINISHED!");
+
+ return PLUGIN_OK;
+}
+#endif /* CONFIG_HWCODEC == MASNONE */
diff --git a/apps/plugins/mpc2wav.c b/apps/plugins/mpc2wav.c
new file mode 100644
index 0000000000..b1478bac31
--- /dev/null
+++ b/apps/plugins/mpc2wav.c
@@ -0,0 +1,208 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 Thom Johansen
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* This is a lovely mishmash of sample.c from libmusepack and mpa2wav.c,
+ * but happens to work, so no whining!
+ */
+
+#include "plugin.h"
+
+#if (CONFIG_HWCODEC == MASNONE)
+/* software codec platforms */
+
+#include <codecs/libmusepack/musepack.h>
+
+#include "lib/xxx2wav.h" /* Helper functions common to test decoders */
+
+static struct plugin_api* rb;
+mpc_decoder decoder;
+
+/*
+ Our implementations of the mpc_reader callback functions.
+*/
+mpc_int32_t
+read_impl(void *data, void *ptr, mpc_int32_t size)
+{
+ file_info_struct *f = (file_info_struct *)data;
+ mpc_int32_t num = f->filesize - f->curpos;
+ if (num > size)
+ num = size;
+ rb->memcpy(ptr, filebuf + f->curpos, num);
+ f->curpos += num;
+ return num;
+}
+
+bool
+seek_impl(void *data, mpc_int32_t offset)
+{
+ file_info_struct *f = (file_info_struct *)data;
+ if (offset > f->filesize) {
+ return 0;
+ } else {
+ f->curpos = offset;
+ return 1;
+ }
+}
+
+mpc_int32_t
+tell_impl(void *data)
+{
+ file_info_struct *f = (file_info_struct *)data;
+ return f->curpos;
+}
+
+mpc_int32_t
+get_size_impl(void *data)
+{
+ file_info_struct *f = (file_info_struct *)data;
+ return f->filesize;
+}
+
+bool
+canseek_impl(void *data)
+{
+ (void)data;
+ return true;
+}
+
+static int
+shift_signed(MPC_SAMPLE_FORMAT val, int shift)
+{
+ if (shift > 0)
+ val <<= shift;
+ else if (shift < 0)
+ val >>= -shift;
+ return (int)val;
+}
+
+#define OUTPUT_BUFFER_SIZE 65536 /* Must be an integer multiple of 4. */
+
+unsigned char OutputBuffer[OUTPUT_BUFFER_SIZE];
+MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH];
+unsigned char *OutputPtr=OutputBuffer;
+const unsigned char *OutputBufferEnd=OutputBuffer+OUTPUT_BUFFER_SIZE;
+
+#ifdef USE_IRAM
+extern char iramcopy[];
+extern char iramstart[];
+extern char iramend[];
+#endif
+
+/* this is the plugin entry point */
+enum plugin_status plugin_start(struct plugin_api* api, void* file)
+{
+ file_info_struct file_info;
+ unsigned short Sample;
+ unsigned status = 1;
+ unsigned int i;
+ mpc_reader reader;
+
+ /* Generic plugin inititialisation */
+
+ TEST_PLUGIN_API(api);
+ rb = api;
+
+#ifdef USE_IRAM
+ rb->memcpy(iramstart, iramcopy, iramend-iramstart);
+#endif
+
+ reader.read = read_impl;
+ reader.seek = seek_impl;
+ reader.tell = tell_impl;
+ reader.get_size = get_size_impl;
+ reader.canseek = canseek_impl;
+ reader.data = &file_info;
+
+ /* This function sets up the buffers and reads the file into RAM */
+
+ if (local_init(file, "/libmusepacktest.wav", &file_info, api)) {
+ return PLUGIN_ERROR;
+ }
+
+ /* read file's streaminfo data */
+ mpc_streaminfo info;
+ mpc_streaminfo_init(&info);
+ if (mpc_streaminfo_read(&info, &reader) != ERROR_CODE_OK) {
+ rb->splash(HZ, true, "Not an MPC file.");
+ return PLUGIN_ERROR;
+ }
+ file_info.samplerate=info.sample_freq;
+ /* instantiate a decoder with our file reader */
+ mpc_decoder_setup(&decoder, &reader);
+ if (!mpc_decoder_initialize(&decoder, &info)) {
+ rb->splash(HZ, true, "Error in init.");
+ return PLUGIN_ERROR;
+ }
+ file_info.frames_decoded = 0;
+ file_info.start_tick = *(rb->current_tick);
+
+ rb->button_clear_queue();
+
+ /* This is the decoding loop. */
+ while (status != 0) {
+ status = mpc_decoder_decode(&decoder, sample_buffer, 0, 0);
+ if (status == (unsigned)(-1)) {
+ //decode error
+ rb->splash(HZ, true, "Error decoding file.");
+ break;
+ }
+ else //status>0
+ {
+ file_info.current_sample += status;
+ file_info.frames_decoded++;
+ /* Convert musepack's numbers to an array of 16-bit LE signed integers */
+#if 1 /* uncomment to time without byte swapping and disk writing */
+ for(i = 0; i < status*info.channels; i += info.channels)
+ {
+ /* Left channel */
+ Sample=shift_signed(sample_buffer[i], 16 - MPC_FIXED_POINT_SCALE_SHIFT);
+ *(OutputPtr++)=Sample&0xff;
+ *(OutputPtr++)=Sample>>8;
+
+ /* Right channel. If the decoded stream is monophonic then
+ * the right output channel is the same as the left one.
+ */
+ if(info.channels==2)
+ Sample=shift_signed(sample_buffer[i + 1], 16 - MPC_FIXED_POINT_SCALE_SHIFT);
+ *(OutputPtr++)=Sample&0xff;
+ *(OutputPtr++)=Sample>>8;
+
+ /* Flush the buffer if it is full. */
+ if(OutputPtr==OutputBufferEnd)
+ {
+ rb->write(file_info.outfile,OutputBuffer,OUTPUT_BUFFER_SIZE);
+ OutputPtr=OutputBuffer;
+ }
+ }
+#endif
+
+ }
+ display_status(&file_info);
+
+ if (rb->button_get(false)!=BUTTON_NONE) {
+ close_wav(&file_info);
+ return PLUGIN_OK;
+ }
+ }
+ close_wav(&file_info);
+ rb->splash(HZ*2, true, "FINISHED!");
+
+ return PLUGIN_OK;
+}
+#endif /* CONFIG_HWCODEC == MASNONE */
diff --git a/apps/plugins/rockboy/cpu.h b/apps/plugins/rockboy/cpu.h
new file mode 100644
index 0000000000..c7ec36ccf8
--- /dev/null
+++ b/apps/plugins/rockboy/cpu.h
@@ -0,0 +1,59 @@
+
+
+#ifndef __CPU_H__
+#define __CPU_H__
+
+
+
+#include "defs.h"
+
+
+union reg
+{
+ byte b[2][2];
+ word w[2];
+ un32 d; /* padding for alignment, carry */
+};
+
+struct cpu
+{
+#ifdef DYNAREC
+ union reg a,b,c,d,e,hl,f,sp,pc;
+#else
+ union reg pc, sp, bc, de, hl, af;
+#endif
+ int ime, ima;
+ int speed;
+ int halt;
+ int div, tim;
+ int lcdc;
+ int snd;
+};
+
+extern struct cpu cpu;
+
+#ifdef DYNAREC
+struct dynarec_block {
+ union reg address;
+ void *block;
+ int length;
+ struct dynarec_block *next;
+};
+
+#define HASH_SIGNIFICANT_LOWER_BITS 8
+#define HASH_BITMASK ((1<<HASH_SIGNIFICANT_LOWER_BITS)-1)
+
+extern struct dynarec_block *address_map[1<<HASH_SIGNIFICANT_LOWER_BITS];
+extern int blockclen;
+#endif
+
+void cpu_reset(void);
+void div_advance(int cnt);
+void timer_advance(int cnt);
+void lcdc_advance(int cnt);
+void sound_advance(int cnt);
+void cpu_timers(int cnt);
+int cpu_emulate(int cycles) ICODE_ATTR;
+int cpu_step(int max) ICODE_ATTR;
+
+#endif
diff --git a/apps/plugins/rockboy/lcd.h b/apps/plugins/rockboy/lcd.h
new file mode 100644
index 0000000000..776c8592f4
--- /dev/null
+++ b/apps/plugins/rockboy/lcd.h
@@ -0,0 +1,78 @@
+
+
+#ifndef __LCD_H__
+#define __LCD_H__
+
+#include "defs.h"
+
+struct vissprite
+{
+ byte *buf;
+ int x;
+ byte pal, pri, pad[6];
+};
+
+struct scan
+{
+ int bg[64];
+ int wnd[64];
+#ifdef GRAYSCALE
+ byte buf[4][256];
+#else
+ byte buf[8][256];
+#endif
+ byte pal1[128];
+ un16 pal2[64];
+ un32 pal4[64];
+ byte pri[256];
+ struct vissprite vs[16];
+ int ns, l, x, y, s, t, u, v, wx, wy, wt, wv;
+};
+
+struct obj
+{
+ byte y;
+ byte x;
+ byte pat;
+ byte flags;
+};
+
+struct lcd
+{
+ byte vbank[2][8192];
+ union
+ {
+ byte mem[256];
+ struct obj obj[40];
+ } oam;
+ byte pal[128];
+};
+
+extern struct lcd lcd;
+extern struct scan scan;
+
+
+
+
+
+#endif
+
+
+
+void updatepatpix(void) ICODE_ATTR;
+void tilebuf(void);
+void bg_scan(void);
+void wnd_scan(void);
+void bg_scan_pri(void);
+void wnd_scan_pri(void);
+void spr_count(void);
+void spr_enum(void);
+void spr_scan(void);
+void lcd_begin(void);
+void lcd_refreshline(void);
+void pal_write(int i, byte b);
+void pal_write_dmg(int i, int mapnum, byte d);
+void vram_write(int a, byte b);
+void vram_dirty(void);
+void pal_dirty(void);
+void lcd_reset(void);
diff --git a/apps/plugins/rockboy/rtc.h b/apps/plugins/rockboy/rtc.h
new file mode 100644
index 0000000000..2665cd81c3
--- /dev/null
+++ b/apps/plugins/rockboy/rtc.h
@@ -0,0 +1,25 @@
+
+
+#ifndef __RTC_H__
+#define __RTC_H__
+
+
+struct rtc
+{
+ int batt;
+ int sel;
+ int latch;
+ int d, h, m, s, t;
+ int stop, carry;
+ byte regs[8];
+};
+
+extern struct rtc rtc;
+
+void rtc_latch(byte b);
+void rtc_write(byte b);
+void rtc_tick(void);
+void rtc_save_internal(int fd);
+void rtc_load_internal(int fd);
+
+#endif
diff --git a/apps/plugins/vorbis2wav.c b/apps/plugins/vorbis2wav.c
new file mode 100644
index 0000000000..01815ab1ca
--- /dev/null
+++ b/apps/plugins/vorbis2wav.c
@@ -0,0 +1,180 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 Björn Stenberg
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "kernel.h"
+#include "plugin.h"
+
+#if (CONFIG_HWCODEC == MASNONE)
+/* software codec platforms */
+
+#include <codecs/Tremor/ivorbisfile.h>
+
+#include "lib/xxx2wav.h" /* Helper functions common to test decoders */
+
+static struct plugin_api* rb;
+
+/* Some standard functions and variables needed by Tremor */
+
+
+int errno;
+
+size_t strlen(const char *s) {
+ return(rb->strlen(s));
+}
+
+char *strcpy(char *dest, const char *src) {
+ return(rb->strcpy(dest,src));
+}
+
+char *strcat(char *dest, const char *src) {
+ return(rb->strcat(dest,src));
+}
+
+size_t read_handler(void *ptr, size_t size, size_t nmemb, void *datasource) {
+ size_t len;
+ file_info_struct *p = (file_info_struct *) datasource;
+
+ if (p->curpos >= p->filesize) {
+ return 0; /* EOF */
+ }
+
+ len=nmemb*size;
+ if ((long)(p->curpos+len) > (long)p->filesize) { len=p->filesize-p->curpos; }
+
+ rb->memcpy(ptr,&filebuf[p->curpos],len);
+ p->curpos+=len;
+
+ return(len);
+}
+
+int seek_handler(void *datasource, ogg_int64_t offset, int whence) {
+ /* We are not seekable at the moment */
+ (void)datasource;
+ (void)offset;
+ (void)whence;
+ return -1;
+}
+
+int close_handler(void *datasource) {
+ (void)datasource;
+ return 0;
+}
+
+long tell_handler(void *datasource) {
+ file_info_struct *p = (file_info_struct *) datasource;
+ return p->curpos;
+}
+
+#ifdef USE_IRAM
+extern char iramcopy[];
+extern char iramstart[];
+extern char iramend[];
+#endif
+
+
+/* reserve the PCM buffer in the IRAM area */
+static char pcmbuf[4096] IDATA_ATTR;
+
+/* this is the plugin entry point */
+enum plugin_status plugin_start(struct plugin_api* api, void* file)
+{
+ ov_callbacks callbacks;
+ OggVorbis_File vf;
+ vorbis_info* vi;
+
+ int error;
+ long n;
+ int current_section;
+ int eof;
+#if BYTE_ORDER == BIG_ENDIAN
+ int i;
+ char x;
+#endif
+
+ file_info_struct file_info;
+
+ TEST_PLUGIN_API(api);
+
+ /* if you are using a global api pointer, don't forget to copy it!
+ otherwise you will get lovely "I04: IllInstr" errors... :-) */
+ rb = api;
+
+ #ifdef USE_IRAM
+ rb->memcpy(iramstart, iramcopy, iramend-iramstart);
+ #endif
+
+ /* This function sets up the buffers and reads the file into RAM */
+
+ if (local_init(file,"/vorbistest.wav",&file_info,api)) {
+ return PLUGIN_ERROR;
+ }
+
+
+ /* Create a decoder instance */
+
+ callbacks.read_func=read_handler;
+ callbacks.seek_func=seek_handler;
+ callbacks.tell_func=tell_handler;
+ callbacks.close_func=close_handler;
+
+ file_info.frames_decoded=0;
+ file_info.start_tick=*(rb->current_tick);
+ rb->button_clear_queue();
+
+ error=ov_open_callbacks(&file_info,&vf,NULL,0,callbacks);
+
+ vi=ov_info(&vf,-1);
+
+ if (vi==NULL) {
+ rb->splash(HZ*2, true, "Error");
+ }
+ file_info.samplerate=vi->rate;
+
+ eof=0;
+ while (!eof) {
+ /* Read host-endian signed 16 bit PCM samples */
+ n=ov_read(&vf,pcmbuf,sizeof(pcmbuf),&current_section);
+
+ if (n==0) {
+ eof=1;
+ } else if (n < 0) {
+ DEBUGF("Error decoding frame\n");
+ } else {
+ file_info.frames_decoded++;
+#if BYTE_ORDER == BIG_ENDIAN
+ for (i=0;i<n;i+=2) {
+ x=pcmbuf[i]; pcmbuf[i]=pcmbuf[i+1]; pcmbuf[i+1]=x;
+ }
+#endif
+ rb->write(file_info.outfile,pcmbuf,n);
+ file_info.current_sample+=(n/4);
+ }
+
+ display_status(&file_info);
+
+ if (rb->button_get(false)!=BUTTON_NONE) {
+ close_wav(&file_info);
+ return PLUGIN_OK;
+ }
+ }
+
+ close_wav(&file_info);
+ rb->splash(HZ*2, true, "FINISHED!");
+ return PLUGIN_OK;
+}
+#endif /* CONFIG_HWCODEC == MASNONE */
diff --git a/apps/plugins/wv2wav.c b/apps/plugins/wv2wav.c
new file mode 100644
index 0000000000..909a0c3c63
--- /dev/null
+++ b/apps/plugins/wv2wav.c
@@ -0,0 +1,217 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 Christian Gmeiner
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "plugin.h"
+
+#if (CONFIG_HWCODEC == MASNONE)
+/* software codec platforms */
+
+#include "lib/xxx2wav.h" /* Helper functions common to test decoders */
+#include <codecs/libwavpack/wavpack.h>
+
+#define BUFFER_SIZE 4096
+
+static struct plugin_api* rb;
+static file_info_struct file_info;
+static long temp_buffer [BUFFER_SIZE] IDATA_ATTR;
+
+/* Reformat samples from longs in processor's native endian mode to
+ little-endian data with 2 bytes / sample. */
+uchar* format_samples (int bps, uchar *dst, long *src, ulong samcnt)
+{
+ long temp;
+
+ switch (bps)
+ {
+ case 1:
+ while (samcnt--)
+ {
+ *dst++ = (uchar)(temp = (*src++ << 8));
+ *dst++ = (uchar)(temp >> 8);
+ }
+
+ break;
+
+ case 2:
+ while (samcnt--)
+ {
+ *dst++ = (uchar)(temp = *src++);
+ *dst++ = (uchar)(temp >> 8);
+ }
+
+ break;
+
+ case 3:
+ while (samcnt--)
+ {
+ *dst++ = (uchar)(temp = (*src++ >> 8));
+ *dst++ = (uchar)(temp >> 8);
+ }
+
+ break;
+
+ case 4:
+ while (samcnt--)
+ {
+ *dst++ = (uchar)(temp = (*src++ >> 16));
+ *dst++ = (uchar)(temp >> 8);
+ }
+
+ break;
+ }
+
+ return dst;
+}
+
+/* this is our function to decode a memory block from a file */
+void wvpack_decode_data(file_info_struct* file_info, int samples_to_decode, WavpackContext **wpc)
+{
+ int bps = WavpackGetBytesPerSample(*wpc);
+ /* nothing to decode */
+ if (!samples_to_decode)
+ {
+ return;
+ }
+
+ /* decode now */
+ ulong samples_unpacked = WavpackUnpackSamples(*wpc, temp_buffer, samples_to_decode);
+
+ if (samples_unpacked)
+ {
+ /* update some infos */
+ file_info->current_sample += samples_unpacked;
+
+ /* for now, convert mono to stereo here, in place */
+ if (WavpackGetReducedChannels (*wpc) == 1) {
+ long *dst = temp_buffer + (samples_unpacked * 2);
+ long *src = temp_buffer + samples_unpacked;
+ long count = samples_unpacked;
+
+ while (count--) {
+ *--dst = *--src;
+ *--dst = *src;
+ }
+ }
+
+ format_samples (bps, (uchar *) temp_buffer, temp_buffer, samples_unpacked * file_info->channels);
+ rb->write(file_info->outfile, temp_buffer, samples_unpacked * 4);
+ }
+}
+
+/* callback function for wavpack
+Maybe we do this at a lower level, but the
+first thing is to get all working */
+long Read(void* buffer, long size)
+{
+ long oldpos = file_info.curpos;
+
+ if ((file_info.curpos + size) < file_info.filesize)
+ {
+ memcpy(buffer, &filebuf[file_info.curpos], size);
+ file_info.curpos += size;
+ }
+ else
+ {
+ memcpy(buffer, &filebuf[file_info.curpos], file_info.filesize-file_info.curpos);
+ file_info.curpos = file_info.filesize;
+ }
+
+ return (file_info.curpos - oldpos);
+}
+
+#ifdef USE_IRAM
+extern char iramcopy[];
+extern char iramstart[];
+extern char iramend[];
+#endif
+
+/* this is the plugin entry point */
+enum plugin_status plugin_start(struct plugin_api* api, void* file)
+{
+ WavpackContext *wpc;
+ char error[80];
+
+ /* generic plugin initialisation */
+ TEST_PLUGIN_API(api);
+ rb = api;
+
+ #ifdef USE_IRAM
+ rb->memcpy(iramstart, iramcopy, iramend-iramstart);
+ #endif
+
+ /* this function sets up the buffers and reads the file into RAM */
+ if (local_init(file,"/wvtest.wav",&file_info,api))
+ {
+ return PLUGIN_ERROR;
+ }
+
+ /* setup wavpack */
+ wpc = WavpackOpenFileInput(Read, error);
+
+ /* was there an error? */
+ if (!wpc)
+ {
+ rb->splash(HZ*2, true, error);
+ return PLUGIN_ERROR;
+ }
+
+ /* grap/set some infos (forcing some to temp values) */
+ file_info.channels = 2;
+ file_info.total_samples = WavpackGetNumSamples(wpc);
+ file_info.bitspersample = 16;
+ file_info.samplerate = WavpackGetSampleRate(wpc);
+ file_info.current_sample = 0;
+
+ /* deciding loop */
+ file_info.start_tick=*(rb->current_tick);
+ rb->button_clear_queue();
+
+ while (file_info.current_sample < file_info.total_samples)
+ {
+ wvpack_decode_data(&file_info, BUFFER_SIZE / file_info.channels, &wpc);
+
+ display_status(&file_info);
+
+ if (rb->button_get(false)!=BUTTON_NONE)
+ {
+ close_wav(&file_info);
+ return PLUGIN_OK;
+ }
+ }
+
+ close_wav(&file_info);
+
+ /* do some last checks */
+ if ((WavpackGetNumSamples (wpc) != (ulong) -1) && (file_info.current_sample != WavpackGetNumSamples (wpc)))
+ {
+ rb->splash(HZ*2, true, "incorrect number of samples!");
+ return PLUGIN_ERROR;
+ }
+
+ if (WavpackGetNumErrors (wpc)) {
+ rb->splash(HZ*2, true, "crc errors detected!");
+ return PLUGIN_ERROR;
+ }
+
+ rb->splash(HZ*2, true, "FINISHED!");
+
+ return PLUGIN_OK;
+}
+
+#endif /* CONFIG_HWCODEC == MASNONE */
diff --git a/bootloader/FILES b/bootloader/FILES
deleted file mode 100644
index 22e7774f20..0000000000
--- a/bootloader/FILES
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-SOURCES
-FILES
-*.c
diff --git a/bootloader/Makefile b/bootloader/Makefile
deleted file mode 100644
index c2bc54a6da..0000000000
--- a/bootloader/Makefile
+++ /dev/null
@@ -1,85 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR) \
- -I$(BUILDDIR)
-
-DEPFILE = $(OBJDIR)/dep-bootloader
-LDS := $(FIRMDIR)/boot.lds
-
-ifdef DEBUG
- DEFINES := -DDEBUG
- CFLAGS += -g
-endif
-
-SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P -include "config.h" - )
-DIRS = .
-
-ifdef APPEXTRA
- DIRS += $(APPEXTRA)
- INCLUDES += -I$(APPEXTRA)
-endif
-
-ifndef VERSION
-VERSION=$(shell date +%y%m%d-%H%M)
-endif
-
-CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) \
- -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
-
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-SOURCES = $(SRC)
-LINKFILE = $(OBJDIR)/linkage.lds
-MAXINFILE = $(OBJDIR)/romstart.temp
-MAXOUTFILE = $(OBJDIR)/romstart
-
-LIBROCKBOX = $(BUILDDIR)/librockbox.a
-
-ifdef DEBUG
-all: $(OBJDIR)/bootloader.elf
-else
-all: $(BUILDDIR)/$(BINARY) $(FLASHFILE)
-endif
-
-dep: $(DEPFILE)
-
-$(LINKFILE): $(LDS)
- @echo "Build LDS file"
- @cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
-
-$(MAXOUTFILE):
- @echo '#include "config.h"' > $(MAXINFILE)
- @echo "ROM_START" >> $(MAXINFILE)
- @cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE)
- @rm $(MAXINFILE)
-
-$(OBJDIR)/bootloader.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX)
- @echo "LD bootloader.elf"
- $(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -L$(BUILDDIR)/firmware -lrockbox -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/bootloader.map
-
-$(OBJDIR)/bootloader.bin : $(OBJDIR)/bootloader.elf
- @echo "OBJCOPY $<"
- @$(OC) -O binary $< $@
-
-$(OBJDIR)/bootloader.asm: $(OBJDIR)/bootloader.bin
- $(TOOLSDIR)/sh2d -sh1 $< > $@
-
-$(BUILDDIR)/$(BINARY) : $(OBJDIR)/bootloader.bin
- @echo "Build bootloader file"
- @$(MKFIRMWARE) $< $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- @echo "cleaning bootloader"
- @-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) $(OBJDIR)/bootloader.asm \
- $(OBJDIR)/bootloader.bin $(OBJDIR)/bootloader.elf $(OBJDIR)/*.map \
- $(LINKFILE) $(MAXOUTFILE) $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
deleted file mode 100644
index e241137f99..0000000000
--- a/bootloader/SOURCES
+++ /dev/null
@@ -1 +0,0 @@
-main.c
diff --git a/bootloader/main.c b/bootloader/main.c
deleted file mode 100644
index 5e981aa7fa..0000000000
--- a/bootloader/main.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2005 by Linus Nielsen Feltzing
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "cpu.h"
-#include "system.h"
-#include "lcd.h"
-#include "kernel.h"
-#include "thread.h"
-#include "ata.h"
-#include "disk.h"
-#include "font.h"
-#include "adc.h"
-#include "backlight.h"
-#include "button.h"
-#include "panic.h"
-#include "power.h"
-#include "file.h"
-#include "uda1380.h"
-
-#define DRAM_START 0x31000000
-
-int line = 0;
-
-int usb_screen(void)
-{
- return 0;
-}
-
-char version[] = APPSVERSION;
-
-static void usb_enable(bool on)
-{
- and_l(~0x01000000, &GPIO_OUT); /* GPIO24 is the Cypress chip power */
- or_l(0x01000000, &GPIO_ENABLE);
- or_l(0x01000000, &GPIO_FUNCTION);
-
- or_l(0x00000080, &GPIO1_FUNCTION); /* GPIO39 is the USB detect input */
-
- if(on)
- {
- /* Power on the Cypress chip */
- or_l(0x01000000, &GPIO_OUT);
- sleep(2);
- }
- else
- {
- /* Power off the Cypress chip */
- and_l(~0x01000000, &GPIO_OUT);
- }
-}
-
-bool usb_detect(void)
-{
- return (GPIO1_READ & 0x80)?true:false;
-}
-
-void start_iriver_fw(void)
-{
- asm(" move.w #0x2700,%sr");
- /* Reset the cookie for the crt0 crash check */
- asm(" move.l #0,%d0");
- asm(" move.l %d0,0x10017ffc");
- asm(" movec.l %d0,%vbr");
- asm(" move.l 0,%sp");
- asm(" lea.l 8,%a0");
- asm(" jmp (%a0)");
-}
-
-int load_firmware(void)
-{
- int fd;
- int rc;
- int len;
- unsigned long chksum;
- char model[5];
- unsigned long sum;
- int i;
- unsigned char *buf = (unsigned char *)DRAM_START;
- char str[80];
-
- fd = open("/rockbox.iriver", O_RDONLY);
- if(fd < 0)
- return -1;
-
- len = filesize(fd) - 8;
-
- snprintf(str, 80, "Length: %x", len);
- lcd_puts(0, line++, str);
- lcd_update();
-
- lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET);
-
- rc = read(fd, &chksum, 4);
- if(rc < 4)
- return -2;
-
- snprintf(str, 80, "Checksum: %x", chksum);
- lcd_puts(0, line++, str);
- lcd_update();
-
- rc = read(fd, model, 4);
- if(rc < 4)
- return -3;
-
- model[4] = 0;
-
- snprintf(str, 80, "Model name: %s", model);
- lcd_puts(0, line++, str);
- lcd_update();
-
- lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET);
-
- rc = read(fd, buf, len);
- if(rc < len)
- return -4;
-
- close(fd);
-
- sum = MODEL_NUMBER;
-
- for(i = 0;i < len;i++) {
- sum += buf[i];
- }
-
- snprintf(str, 80, "Sum: %x", sum);
- lcd_puts(0, line++, str);
- lcd_update();
-
- if(sum != chksum)
- return -5;
-
- return 0;
-}
-
-
-void start_firmware(void)
-{
- asm(" move.w #0x2700,%sr");
- /* Reset the cookie for the crt0 crash check */
- asm(" move.l #0,%d0");
- asm(" move.l %d0,0x10017ffc");
- asm(" move.l %0,%%d0" :: "i"(DRAM_START));
- asm(" movec.l %d0,%vbr");
- asm(" move.l %0,%%sp" :: "m"(*(int *)DRAM_START));
- asm(" move.l %0,%%a0" :: "m"(*(int *)(DRAM_START+4)));
- asm(" jmp (%a0)");
-}
-
-void main(void)
-{
- int i;
- int rc;
- char buf[256];
- bool rc_on_button = false;
- bool on_button = false;
- int data;
- int adc_battery, battery_voltage, batt_int, batt_frac;
-
- /* We want to read the buttons as early as possible, before the user
- releases the ON button */
-
- /* Set GPIO33, GPIO37, GPIO38 and GPIO52 as general purpose inputs
- (The ON and Hold buttons on the main unit and the remote) */
- or_l(0x00100062, &GPIO1_FUNCTION);
- and_l(~0x00100062, &GPIO1_ENABLE);
-
- data = GPIO1_READ;
- if ((data & 0x20) == 0)
- on_button = true;
-
- if ((data & 0x40) == 0)
- rc_on_button = true;
-
- /* Backlight ON */
- or_l(0x00020000, &GPIO1_ENABLE);
- or_l(0x00020000, &GPIO1_FUNCTION);
-
- /* Set the default state of the hard drive power to OFF */
- ide_power_enable(false);
-
- power_init();
-
- /* Power on the hard drive early, to speed up the loading */
- if(!((on_button && button_hold()) ||
- (rc_on_button && remote_button_hold()))) {
- ide_power_enable(true);
- }
-
- system_init();
- kernel_init();
-
-#ifdef HAVE_ADJUSTABLE_CPU_FREQ
- /* Set up waitstates for the peripherals */
- set_cpu_frequency(0); /* PLL off */
-#endif
-
- uda1380_reset();
-
- backlight_init();
- set_irq_level(0);
- lcd_init();
- font_init();
- adc_init();
- button_init();
-
- lcd_setfont(FONT_SYSFIXED);
-
- lcd_puts(0, line++, "Rockbox boot loader");
- snprintf(buf, sizeof(buf), "Version %s", version);
- lcd_puts(0, line++, buf);
- lcd_update();
-
- sleep(HZ/50); /* Allow the button driver to check the buttons */
-
- /* Holding REC while starting runs the original firmware */
- if(((button_status() & BUTTON_REC) == BUTTON_REC) ||
- ((button_status() & BUTTON_RC_REC) == BUTTON_RC_REC)) {
- lcd_puts(0, 8, "Starting original firmware...");
- lcd_update();
- start_iriver_fw();
- }
-
- /* Don't start if the Hold button is active on the device you
- are starting with */
- if((on_button && button_hold()) ||
- (rc_on_button && remote_button_hold())) {
- lcd_puts(0, 8, "HOLD switch on, power off...");
- lcd_update();
- sleep(HZ*2);
- /* Reset the cookie for the crt0 crash check */
- asm(" move.l #0,%d0");
- asm(" move.l %d0,0x10017ffc");
- power_off();
- }
-
- adc_battery = adc_read(ADC_BATTERY);
-
- battery_voltage = (adc_battery * BATTERY_SCALE_FACTOR) / 10000;
- batt_int = battery_voltage / 100;
- batt_frac = battery_voltage % 100;
-
- snprintf(buf, 32, "Batt: %d.%02dV", batt_int, batt_frac);
- lcd_puts(0, line++, buf);
- lcd_update();
-
- if(battery_voltage <= 300) {
- line++;
- lcd_puts(0, line++, "WARNING! BATTERY LOW!!");
- lcd_update();
- sleep(HZ*2);
- }
-
- rc = ata_init();
- if(rc)
- {
- char str[32];
- lcd_clear_display();
- snprintf(str, 31, "ATA error: %d", rc);
- lcd_puts(0, line++, str);
- lcd_puts(0, line++, "Insert USB cable and press");
- lcd_puts(0, line++, "a button");
- lcd_update();
- while(!(button_get(true) & BUTTON_REL));
- }
-
- /* A hack to enter USB mode without using the USB thread */
- if(usb_detect())
- {
- lcd_clear_display();
- lcd_puts(0, 7, " Bootloader USB mode");
- lcd_update();
-
- ata_spin();
- ata_enable(false);
- usb_enable(true);
- while(usb_detect())
- {
- ata_spin(); /* Prevent the drive from spinning down */
- sleep(HZ);
-
- /* Backlight OFF */
- or_l(0x00020000, &GPIO1_OUT);
- }
-
- usb_enable(false);
- ata_init(); /* Reinitialize ATA and continue booting */
-
- lcd_clear_display();
- line = 0;
- lcd_update();
- }
-
- disk_init();
-
- rc = disk_mount_all();
- if (rc<=0)
- {
- lcd_clear_display();
- lcd_puts(0, 0, "No partition found");
- while(button_get(true) != SYS_USB_CONNECTED) {};
- }
-
- lcd_puts(0, line++, "Loading firmware");
- lcd_update();
- i = load_firmware();
- snprintf(buf, 256, "Result: %d", i);
- lcd_puts(0, line++, buf);
- lcd_update();
-
- if(i == 0)
- start_firmware();
-
- start_iriver_fw();
-}
-
-/* These functions are present in the firmware library, but we reimplement
- them here because the originals do a lot more than we want */
-
-void reset_poweroff_timer(void)
-{
-}
-
-void screen_dump(void)
-{
-}
-
-int dbg_ports(void)
-{
- return 0;
-}
-
-void mpeg_stop(void)
-{
-}
-
-void usb_acknowledge(void)
-{
-}
-
-void usb_wait_for_disconnect(void)
-{
-}
-
-void sys_poweroff(void)
-{
-}
diff --git a/firmware/drivers/i2c-h100.c b/firmware/drivers/i2c-h100.c
new file mode 100644
index 0000000000..e2fbea2573
--- /dev/null
+++ b/firmware/drivers/i2c-h100.c
@@ -0,0 +1,166 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 by Andy Young
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "cpu.h"
+#include "kernel.h"
+#include "debug.h"
+#include "system.h"
+#include "i2c-h100.h"
+
+#define I2C_DEVICE_1 ((volatile unsigned char *)&MADR)
+#define I2C_DEVICE_2 ((volatile unsigned char *)&MADR2)
+
+/* Local functions definitions */
+
+static int i2c_write_byte(int device, unsigned char data);
+static int i2c_gen_start(int device);
+static void i2c_gen_stop(int device);
+static volatile unsigned char *i2c_get_addr(int device);
+
+/* Public functions */
+
+void i2c_init(void)
+{
+ /* Audio Codec */
+ MADR = 0x6c; /* iRiver firmware uses this addr */
+ MBDR = 0; /* iRiver firmware does this */
+ MBCR = IEN; /* Enable interface */
+
+#if 0
+ /* FM Tuner */
+ MADR2 = 0x6c;
+ MBDR2 = 0;
+ MBCR2 = IEN;
+#endif
+}
+
+void i2c_close(void)
+{
+ MBCR = 0;
+
+#if 0
+ MBCR2 = 0;
+#endif
+}
+
+/**
+ * Writes bytes to the selected device.
+ *
+ * Use device=1 for bus 1 at 0x40000280 (Audio Codec)
+ * Use device=2 for bus 2 at 0x80000440 (Tuner ?)
+ *
+ * Returns number of bytes successfully send or -1 if START failed
+ */
+int i2c_write(int device, unsigned char *buf, int count)
+{
+ int i;
+
+ if (i2c_gen_start(device) == -1)
+ {
+ DEBUGF("i2c: gen_start failed (d=%d)", device);
+ return -1;
+ }
+
+ for (i=0; i<count; i++)
+ {
+ if (i2c_write_byte(device, buf[i]) == -1)
+ {
+ DEBUGF("i2c: write failed at (d=%d,i=%d)", device, i);
+ return i-1;
+ }
+ }
+
+ i2c_gen_stop(device);
+
+ return count;
+}
+
+/* Write a byte to the interface, returns 0 on success, -1 otherwise. */
+int i2c_write_byte(int device, unsigned char data)
+{
+ volatile unsigned char *regs = i2c_get_addr(device);
+
+ long count = 0;
+
+ regs[O_MBDR] = data; /* Write data byte */
+
+ /* Wait for bus busy */
+ while (!(regs[O_MBSR] & IBB) && count < MAX_LOOP)
+ {
+ yield();
+ count++;
+ }
+
+ if (count >= MAX_LOOP)
+ return -1;
+
+ /* Wait for interrupt flag */
+ while (!(regs[O_MBSR] & IFF) && count < MAX_LOOP)
+ {
+ yield();
+ count++;
+ }
+
+ if (count >= MAX_LOOP)
+ return -1;
+
+ regs[O_MBSR] &= ~IFF; /* Clear interrupt flag */
+
+ if (!(regs[O_MBSR] & ICF)) /* Check that transfer is complete */
+ return -1;
+
+ if (regs[O_MBSR] & RXAK) /* Check that the byte has been ACKed */
+ return -1;
+
+ return 0;
+}
+
+
+/* Returns 0 on success, -1 on failure */
+int i2c_gen_start(int device)
+{
+ volatile unsigned char *regs = i2c_get_addr(device);
+ long count = 0;
+
+ /* Wait for bus to become free */
+ while ((regs[O_MBSR] & IBB) && (count < MAX_LOOP))
+ count++;
+
+ if (count >= MAX_LOOP)
+ return -1;
+
+ regs[O_MBCR] |= MSTA | MTX; /* Generate START */
+
+ return 0;
+}
+
+void i2c_gen_stop(int device)
+{
+ volatile unsigned char *regs = i2c_get_addr(device);
+ regs[O_MBCR] &= ~MSTA; /* Clear MSTA to generate STOP */
+}
+
+
+volatile unsigned char *i2c_get_addr(int device)
+{
+ if (device == 1)
+ return I2C_DEVICE_1;
+
+ return I2C_DEVICE_2;
+}
diff --git a/firmware/export/i2c-h100.h b/firmware/export/i2c-h100.h
new file mode 100644
index 0000000000..f8fd423b7e
--- /dev/null
+++ b/firmware/export/i2c-h100.h
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 by Linus Nielsen Feltzing
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/*
+ * Driver for MCF5249's I2C interface
+ * 2005-02-17 hubble@mochine.com
+ *
+ */
+
+#ifndef _I2C_H100_H
+#define _I2C_H100_H
+
+void i2c_init(void);
+int i2c_write(int device, unsigned char *buf, int count);
+void i2c_close(void);
+
+
+#define MAX_LOOP 0x10000 /* TODO: select a better value */
+
+/* PLLCR control */
+#define QSPISEL (1 << 11) /* Selects QSPI or I2C interface */
+
+/* Offsets to I2C registers from base address */
+#define O_MADR 0x00 /* Slave Address */
+#define O_MFDR 0x04 /* Frequency divider */
+#define O_MBCR 0x08 /* Control register */
+#define O_MBSR 0x0c /* Status register */
+#define O_MBDR 0x10 /* Data register */
+
+/* MBSR - Status register */
+#define ICF (1 << 7) /* Transfer Complete */
+#define IAAS (1 << 6) /* Addressed As Alave */
+#define IBB (1 << 5) /* Bus Busy */
+#define IAL (1 << 4) /* Arbitration Lost */
+#define SRW (1 << 2) /* Slave R/W */
+#define IFF (1 << 1) /* I2C Interrupt */
+#define RXAK (1 << 0) /* No Ack bit */
+
+/* MBCR - Control register */
+#define IEN (1 << 7) /* I2C Enable */
+#define IIEN (1 << 6) /* Interrupt Enable */
+#define MSTA (1 << 5) /* Master/Slave select */
+#define MTX (1 << 4) /* Transmit/Receive */
+#define TXAK (1 << 3) /* Transfer ACK */
+#define RSTA (1 << 2) /* Restart.. */
+
+
+#endif
diff --git a/firmware/fonts/clR6x8.bdf b/firmware/fonts/clR6x8.bdf
new file mode 100644
index 0000000000..b4552e982a
--- /dev/null
+++ b/firmware/fonts/clR6x8.bdf
@@ -0,0 +1,2895 @@
+STARTFONT 2.1
+COMMENT $XConsortium: clR6x8.bdf,v 1.2 94/04/11 12:08:36 gildea Exp $
+COMMENT
+COMMENT Copyright 1989 Dale Schumacher, dal@syntel.mn.org
+COMMENT 399 Beacon Ave.
+COMMENT St. Paul, MN 55104-3527
+COMMENT
+COMMENT Permission to use, copy, modify, and distribute this software and
+COMMENT its documentation for any purpose and without fee is hereby
+COMMENT granted, provided that the above copyright notice appear in all
+COMMENT copies and that both that copyright notice and this permission
+COMMENT notice appear in supporting documentation, and that the name of
+COMMENT Dale Schumacher not be used in advertising or publicity pertaining to
+COMMENT distribution of the software without specific, written prior
+COMMENT permission. Dale Schumacher makes no representations about the
+COMMENT suitability of this software for any purpose. It is provided "as
+COMMENT is" without express or implied warranty.
+COMMENT
+FONT -Schumacher-Clean-Medium-R-Normal--8-80-75-75-C-60-ISO646.1991-IRV
+SIZE 8 75 75
+FONTBOUNDINGBOX 6 8 0 -1
+STARTPROPERTIES 20
+FONTNAME_REGISTRY ""
+FOUNDRY "Schumacher"
+FAMILY_NAME "Clean"
+WEIGHT_NAME "Medium"
+SLANT "R"
+SETWIDTH_NAME "Normal"
+ADD_STYLE_NAME ""
+PIXEL_SIZE 8
+POINT_SIZE 80
+RESOLUTION_X 75
+RESOLUTION_Y 75
+SPACING "C"
+AVERAGE_WIDTH 60
+CHARSET_REGISTRY "ISO646.1991"
+CHARSET_ENCODING "IRV"
+FONT_ASCENT 7
+FONT_DESCENT 1
+DEFAULT_CHAR 0
+COPYRIGHT "Copyright 1989 Dale Schumacher."
+_XMBDFED_INFO "Edited with xmbdfed 4.5."
+ENDPROPERTIES
+CHARS 190
+STARTCHAR space
+ENCODING 32
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR exclamation mark
+ENCODING 33
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+10
+10
+10
+10
+00
+10
+00
+ENDCHAR
+STARTCHAR double quote
+ENCODING 34
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+28
+28
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR hash
+ENCODING 35
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+28
+7C
+28
+7C
+28
+00
+00
+ENDCHAR
+STARTCHAR dollar sign
+ENCODING 36
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+3C
+50
+38
+14
+78
+10
+00
+ENDCHAR
+STARTCHAR percent sign
+ENCODING 37
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+60
+64
+08
+10
+20
+4C
+0C
+00
+ENDCHAR
+STARTCHAR ampersand
+ENCODING 38
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+30
+48
+48
+30
+54
+48
+34
+00
+ENDCHAR
+STARTCHAR apostrophe
+ENCODING 39
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+20
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR open bracket
+ENCODING 40
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+04
+08
+10
+10
+10
+08
+04
+00
+ENDCHAR
+STARTCHAR close bracket
+ENCODING 41
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+40
+20
+10
+10
+10
+20
+40
+00
+ENDCHAR
+STARTCHAR asterisk
+ENCODING 42
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+10
+54
+38
+54
+10
+00
+00
+ENDCHAR
+STARTCHAR plus sign
+ENCODING 43
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+10
+10
+7C
+10
+10
+00
+00
+ENDCHAR
+STARTCHAR comma
+ENCODING 44
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+00
+00
+10
+10
+20
+ENDCHAR
+STARTCHAR minus sign
+ENCODING 45
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+7C
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR full stop
+ENCODING 46
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+00
+00
+10
+10
+00
+ENDCHAR
+STARTCHAR slash
+ENCODING 47
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+04
+04
+08
+08
+10
+10
+20
+20
+ENDCHAR
+STARTCHAR digit zero
+ENCODING 48
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+4C
+54
+64
+44
+38
+00
+ENDCHAR
+STARTCHAR digit one
+ENCODING 49
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+30
+10
+10
+10
+10
+10
+00
+ENDCHAR
+STARTCHAR digit two
+ENCODING 50
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+04
+08
+10
+20
+7C
+00
+ENDCHAR
+STARTCHAR digit three
+ENCODING 51
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+04
+18
+04
+44
+38
+00
+ENDCHAR
+STARTCHAR digit four
+ENCODING 52
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+18
+28
+48
+7C
+08
+08
+00
+ENDCHAR
+STARTCHAR digit five
+ENCODING 53
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+7C
+40
+78
+04
+04
+44
+38
+00
+ENDCHAR
+STARTCHAR digit six
+ENCODING 54
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+18
+20
+40
+78
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR digit seven
+ENCODING 55
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+7C
+44
+04
+08
+08
+10
+10
+00
+ENDCHAR
+STARTCHAR digit eight
+ENCODING 56
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+44
+38
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR digit nine
+ENCODING 57
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+44
+3C
+04
+08
+30
+00
+ENDCHAR
+STARTCHAR colon
+ENCODING 58
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+10
+10
+00
+00
+10
+10
+00
+ENDCHAR
+STARTCHAR semicolon
+ENCODING 59
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+10
+10
+00
+00
+10
+10
+20
+ENDCHAR
+STARTCHAR less-than sign
+ENCODING 60
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+0C
+30
+C0
+30
+0C
+00
+00
+ENDCHAR
+STARTCHAR equal sign
+ENCODING 61
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+7C
+00
+7C
+00
+00
+00
+ENDCHAR
+STARTCHAR greater-than sign
+ENCODING 62
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+C0
+30
+0C
+30
+C0
+00
+00
+ENDCHAR
+STARTCHAR question mark
+ENCODING 63
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+04
+08
+10
+00
+10
+00
+ENDCHAR
+STARTCHAR commercial at
+ENCODING 64
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+5C
+5C
+58
+40
+38
+00
+ENDCHAR
+STARTCHAR A
+ENCODING 65
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+44
+44
+7C
+44
+44
+00
+ENDCHAR
+STARTCHAR B
+ENCODING 66
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+78
+44
+44
+78
+44
+44
+78
+00
+ENDCHAR
+STARTCHAR C
+ENCODING 67
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+40
+40
+40
+44
+38
+00
+ENDCHAR
+STARTCHAR D
+ENCODING 68
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+70
+48
+44
+44
+44
+48
+70
+00
+ENDCHAR
+STARTCHAR E
+ENCODING 69
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+7C
+40
+40
+78
+40
+40
+7C
+00
+ENDCHAR
+STARTCHAR F
+ENCODING 70
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+7C
+40
+40
+78
+40
+40
+40
+00
+ENDCHAR
+STARTCHAR G
+ENCODING 71
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+40
+4C
+44
+44
+3C
+00
+ENDCHAR
+STARTCHAR H
+ENCODING 72
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+44
+44
+7C
+44
+44
+44
+00
+ENDCHAR
+STARTCHAR I
+ENCODING 73
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+7C
+10
+10
+10
+10
+10
+7C
+00
+ENDCHAR
+STARTCHAR J
+ENCODING 74
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+1C
+04
+04
+04
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR K
+ENCODING 75
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+48
+50
+60
+50
+48
+44
+00
+ENDCHAR
+STARTCHAR L
+ENCODING 76
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+40
+40
+40
+40
+40
+40
+7C
+00
+ENDCHAR
+STARTCHAR M
+ENCODING 77
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+6C
+54
+54
+44
+44
+44
+00
+ENDCHAR
+STARTCHAR N
+ENCODING 78
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+64
+64
+54
+4C
+4C
+44
+00
+ENDCHAR
+STARTCHAR O
+ENCODING 79
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+44
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR P
+ENCODING 80
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+78
+44
+44
+78
+40
+40
+40
+00
+ENDCHAR
+STARTCHAR Q
+ENCODING 81
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+44
+44
+44
+44
+38
+0C
+ENDCHAR
+STARTCHAR R
+ENCODING 82
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+78
+44
+44
+78
+50
+48
+44
+00
+ENDCHAR
+STARTCHAR S
+ENCODING 83
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+40
+38
+04
+44
+38
+00
+ENDCHAR
+STARTCHAR T
+ENCODING 84
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+7C
+10
+10
+10
+10
+10
+10
+00
+ENDCHAR
+STARTCHAR U
+ENCODING 85
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+44
+44
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR V
+ENCODING 86
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+44
+44
+28
+28
+10
+10
+00
+ENDCHAR
+STARTCHAR W
+ENCODING 87
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+44
+44
+54
+54
+6C
+44
+00
+ENDCHAR
+STARTCHAR X
+ENCODING 88
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+44
+28
+10
+28
+44
+44
+00
+ENDCHAR
+STARTCHAR Y
+ENCODING 89
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+44
+28
+10
+10
+10
+10
+00
+ENDCHAR
+STARTCHAR Z
+ENCODING 90
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+7C
+04
+08
+10
+20
+40
+7C
+00
+ENDCHAR
+STARTCHAR left square bracket
+ENCODING 91
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+1C
+10
+10
+10
+10
+10
+1C
+00
+ENDCHAR
+STARTCHAR backslash
+ENCODING 92
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+20
+10
+10
+08
+08
+04
+04
+ENDCHAR
+STARTCHAR right square bracket
+ENCODING 93
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+70
+10
+10
+10
+10
+10
+70
+00
+ENDCHAR
+STARTCHAR circumflex accent
+ENCODING 94
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+44
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR underscore
+ENCODING 95
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+00
+00
+00
+FC
+00
+ENDCHAR
+STARTCHAR grave accent
+ENCODING 96
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+08
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR a
+ENCODING 97
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+3C
+44
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR b
+ENCODING 98
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+40
+40
+78
+44
+44
+44
+78
+00
+ENDCHAR
+STARTCHAR c
+ENCODING 99
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+3C
+40
+40
+40
+3C
+00
+ENDCHAR
+STARTCHAR d
+ENCODING 100
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+04
+04
+3C
+44
+44
+44
+3C
+00
+ENDCHAR
+STARTCHAR e
+ENCODING 101
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+38
+44
+7C
+40
+38
+00
+ENDCHAR
+STARTCHAR f
+ENCODING 102
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+1C
+20
+78
+20
+20
+20
+20
+00
+ENDCHAR
+STARTCHAR g
+ENCODING 103
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+3C
+44
+44
+3C
+04
+38
+ENDCHAR
+STARTCHAR h
+ENCODING 104
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+40
+40
+78
+44
+44
+44
+44
+00
+ENDCHAR
+STARTCHAR i
+ENCODING 105
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+00
+30
+10
+10
+10
+38
+00
+ENDCHAR
+STARTCHAR j
+ENCODING 106
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+00
+38
+08
+08
+08
+08
+70
+ENDCHAR
+STARTCHAR k
+ENCODING 107
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+40
+40
+48
+50
+60
+50
+48
+00
+ENDCHAR
+STARTCHAR l
+ENCODING 108
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+30
+10
+10
+10
+10
+10
+38
+00
+ENDCHAR
+STARTCHAR m
+ENCODING 109
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+68
+54
+54
+54
+44
+00
+ENDCHAR
+STARTCHAR n
+ENCODING 110
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+58
+64
+44
+44
+44
+00
+ENDCHAR
+STARTCHAR o
+ENCODING 111
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+38
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR p
+ENCODING 112
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+78
+44
+44
+44
+78
+40
+ENDCHAR
+STARTCHAR q
+ENCODING 113
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+3C
+44
+44
+44
+3C
+04
+ENDCHAR
+STARTCHAR r
+ENCODING 114
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+58
+64
+40
+40
+40
+00
+ENDCHAR
+STARTCHAR s
+ENCODING 115
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+3C
+40
+38
+04
+78
+00
+ENDCHAR
+STARTCHAR t
+ENCODING 116
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+10
+7C
+10
+10
+10
+0C
+00
+ENDCHAR
+STARTCHAR u
+ENCODING 117
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+44
+44
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR v
+ENCODING 118
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+44
+44
+28
+28
+10
+00
+ENDCHAR
+STARTCHAR w
+ENCODING 119
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+44
+54
+54
+54
+28
+00
+ENDCHAR
+STARTCHAR x
+ENCODING 120
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+44
+28
+10
+28
+44
+00
+ENDCHAR
+STARTCHAR y
+ENCODING 121
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+44
+44
+44
+3C
+04
+38
+ENDCHAR
+STARTCHAR z
+ENCODING 122
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+7C
+08
+10
+20
+7C
+00
+ENDCHAR
+STARTCHAR left curly bracket
+ENCODING 123
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+04
+08
+08
+10
+08
+08
+04
+00
+ENDCHAR
+STARTCHAR pipe symbol
+ENCODING 124
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+10
+10
+10
+10
+10
+10
+00
+ENDCHAR
+STARTCHAR right curly bracket
+ENCODING 125
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+40
+20
+20
+10
+20
+20
+40
+00
+ENDCHAR
+STARTCHAR tilde
+ENCODING 126
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+54
+08
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR inverted exclamation
+ENCODING 161
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+00
+10
+10
+10
+10
+10
+00
+ENDCHAR
+STARTCHAR cent sign
+ENCODING 162
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+10
+3C
+50
+50
+3C
+10
+00
+ENDCHAR
+STARTCHAR pound sign
+ENCODING 163
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+18
+24
+20
+78
+20
+20
+7C
+00
+ENDCHAR
+STARTCHAR euro sign
+ENCODING 164
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+1C
+20
+78
+20
+78
+20
+1C
+00
+ENDCHAR
+STARTCHAR yen sign
+ENCODING 165
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+44
+28
+7C
+10
+7C
+10
+00
+ENDCHAR
+STARTCHAR broken bar
+ENCODING 166
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+10
+10
+00
+10
+10
+10
+00
+ENDCHAR
+STARTCHAR section sign
+ENCODING 167
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+18
+24
+30
+48
+30
+90
+60
+00
+ENDCHAR
+STARTCHAR dieresis
+ENCODING 168
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+00
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR copyright sign
+ENCODING 169
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+30
+48
+B4
+A4
+B4
+48
+30
+00
+ENDCHAR
+STARTCHAR feminine ordinal
+ENCODING 170
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+3C
+44
+44
+4C
+34
+00
+7C
+00
+ENDCHAR
+STARTCHAR guillemot left
+ENCODING 171
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+24
+48
+24
+00
+00
+00
+ENDCHAR
+STARTCHAR not sign
+ENCODING 172
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+78
+08
+00
+00
+00
+ENDCHAR
+STARTCHAR soft hyphen
+ENCODING 173
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR registered trademark
+ENCODING 174
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+30
+48
+B4
+B4
+AC
+48
+30
+00
+ENDCHAR
+STARTCHAR macron
+ENCODING 175
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+7C
+00
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR degree sign
+ENCODING 176
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+28
+38
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR plus or minus
+ENCODING 177
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+10
+7C
+10
+10
+00
+7C
+00
+ENDCHAR
+STARTCHAR superscript 2
+ENCODING 178
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+08
+10
+38
+00
+00
+00
+ENDCHAR
+STARTCHAR superscript 3
+ENCODING 179
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+30
+08
+30
+08
+30
+00
+00
+00
+ENDCHAR
+STARTCHAR spacing acute
+ENCODING 180
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+20
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR micro sign
+ENCODING 181
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+48
+48
+48
+48
+74
+40
+ENDCHAR
+STARTCHAR paragraph sign
+ENCODING 182
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+3C
+54
+54
+54
+34
+14
+14
+00
+ENDCHAR
+STARTCHAR middle dot
+ENCODING 183
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+10
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR cedilla
+ENCODING 184
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+00
+00
+00
+10
+30
+ENDCHAR
+STARTCHAR suprtscript 1
+ENCODING 185
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+30
+10
+10
+10
+00
+00
+00
+ENDCHAR
+STARTCHAR masculine ordinal
+ENCODING 186
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+44
+44
+38
+00
+7C
+00
+ENDCHAR
+STARTCHAR guillemot right
+ENCODING 187
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+48
+24
+48
+00
+00
+00
+ENDCHAR
+STARTCHAR one quarter
+ENCODING 188
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR one half
+ENCODING 189
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR three quarters
+ENCODING 190
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR inverted question
+ENCODING 191
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+00
+10
+08
+04
+44
+38
+00
+ENDCHAR
+STARTCHAR large A, grave accent
+ENCODING 192
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+10
+10
+28
+44
+7C
+44
+00
+ENDCHAR
+STARTCHAR large A, acute accent
+ENCODING 193
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+20
+10
+28
+44
+7C
+44
+00
+ENDCHAR
+STARTCHAR large A, circumflex accent
+ENCODING 194
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+10
+28
+44
+7C
+44
+00
+ENDCHAR
+STARTCHAR large A, tilde
+ENCODING 195
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+24
+58
+10
+28
+44
+7C
+44
+00
+ENDCHAR
+STARTCHAR large A, dieresis
+ENCODING 196
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+10
+28
+44
+7C
+44
+44
+00
+ENDCHAR
+STARTCHAR large A, circle
+ENCODING 197
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+10
+28
+44
+7C
+44
+00
+ENDCHAR
+STARTCHAR large AE, diphtong
+ENCODING 198
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+0C
+18
+28
+4C
+78
+48
+4C
+00
+ENDCHAR
+STARTCHAR large C, cedilla
+ENCODING 199
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+40
+40
+44
+38
+10
+30
+ENDCHAR
+STARTCHAR large E, grave accent
+ENCODING 200
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+10
+7C
+40
+70
+40
+7C
+00
+ENDCHAR
+STARTCHAR large E, acute accent
+ENCODING 201
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+7C
+40
+70
+40
+7C
+00
+ENDCHAR
+STARTCHAR large E, circumflex accent
+ENCODING 202
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+7C
+40
+70
+40
+7C
+00
+ENDCHAR
+STARTCHAR large E, dieresis
+ENCODING 203
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+28
+00
+7C
+40
+70
+40
+7C
+00
+ENDCHAR
+STARTCHAR capital I, grave accent
+ENCODING 204
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+10
+7C
+10
+10
+10
+7C
+00
+ENDCHAR
+STARTCHAR capital I, acute accent
+ENCODING 205
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+7C
+10
+10
+10
+7C
+00
+ENDCHAR
+STARTCHAR capital I, circumflex accent
+ENCODING 206
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+7C
+10
+10
+10
+7C
+00
+ENDCHAR
+STARTCHAR capital I, dieresis
+ENCODING 207
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+28
+00
+7C
+10
+10
+10
+7C
+00
+ENDCHAR
+STARTCHAR capital Eth, Icelandic
+ENCODING 208
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+70
+48
+44
+E4
+44
+48
+70
+00
+ENDCHAR
+STARTCHAR capital N, tilde
+ENCODING 209
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+24
+58
+44
+64
+54
+4C
+44
+00
+ENDCHAR
+STARTCHAR capital O, grave accent
+ENCODING 210
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+10
+38
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR capital O, acute accent
+ENCODING 211
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+38
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR capital O, circumflex accent
+ENCODING 212
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+38
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR capital O, tilde
+ENCODING 213
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+24
+58
+38
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR capital O, dieresis
+ENCODING 214
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+38
+44
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR multiply sign
+ENCODING 215
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+44
+28
+10
+28
+44
+00
+00
+ENDCHAR
+STARTCHAR capital O, slash
+ENCODING 216
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+4C
+54
+64
+44
+38
+00
+ENDCHAR
+STARTCHAR capital U, grave accent
+ENCODING 217
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+10
+44
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR capital U, acute accent
+ENCODING 218
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+44
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR capital U, circumflex accent
+ENCODING 219
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+00
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR capital U, dieresis
+ENCODING 220
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+44
+00
+44
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR capital Y, acute accent
+ENCODING 221
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+44
+28
+10
+10
+10
+00
+ENDCHAR
+STARTCHAR capital Thorn, Icelandic
+ENCODING 222
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+40
+78
+44
+44
+44
+78
+40
+00
+ENDCHAR
+STARTCHAR sharp s, German
+ENCODING 223
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+44
+44
+48
+44
+44
+58
+00
+ENDCHAR
+STARTCHAR small a, grave accent
+ENCODING 224
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+10
+3C
+44
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR small a, acute accent
+ENCODING 225
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+3C
+44
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR small a, circumflex accent
+ENCODING 226
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+00
+3C
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR small a, tilde
+ENCODING 227
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+24
+58
+00
+3C
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR small a, dieresis
+ENCODING 228
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+28
+00
+3C
+44
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR small a, circle
+ENCODING 229
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+10
+3C
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR small ae, diphtong
+ENCODING 230
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+38
+54
+5C
+50
+3C
+00
+ENDCHAR
+STARTCHAR small c, cedilla
+ENCODING 231
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+3C
+40
+40
+3C
+10
+30
+ENDCHAR
+STARTCHAR small e, grave accent
+ENCODING 232
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+10
+38
+44
+7C
+40
+38
+00
+ENDCHAR
+STARTCHAR small e, acute accent
+ENCODING 233
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+38
+44
+7C
+40
+38
+00
+ENDCHAR
+STARTCHAR small e, circumflex accent
+ENCODING 234
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+38
+44
+7C
+40
+38
+00
+ENDCHAR
+STARTCHAR small e, dieresis
+ENCODING 235
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+28
+00
+38
+44
+7C
+40
+38
+00
+ENDCHAR
+STARTCHAR small i, grave accent
+ENCODING 236
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+10
+00
+30
+10
+10
+38
+00
+ENDCHAR
+STARTCHAR small i, acute accent
+ENCODING 237
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+00
+30
+10
+10
+38
+00
+ENDCHAR
+STARTCHAR small i, circumflex accent
+ENCODING 238
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+00
+30
+10
+10
+38
+00
+ENDCHAR
+STARTCHAR small i, dieresis
+ENCODING 239
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+28
+00
+30
+10
+10
+10
+38
+00
+ENDCHAR
+STARTCHAR small eth, Icelandic
+ENCODING 240
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+38
+14
+04
+1C
+24
+24
+18
+00
+ENDCHAR
+STARTCHAR small n, tilde
+ENCODING 241
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+24
+58
+00
+58
+64
+44
+44
+00
+ENDCHAR
+STARTCHAR small o, grave accent
+ENCODING 242
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+10
+38
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR small o, acute accent
+ENCODING 243
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+38
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR small o, circumflex accent
+ENCODING 244
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+38
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR small o, tilde
+ENCODING 245
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+24
+58
+38
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR small o, dieresis
+ENCODING 246
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+28
+00
+38
+44
+44
+44
+38
+00
+ENDCHAR
+STARTCHAR division sign
+ENCODING 247
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+10
+00
+7C
+00
+10
+00
+00
+ENDCHAR
+STARTCHAR small o, slash
+ENCODING 248
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+00
+00
+3C
+4C
+54
+64
+78
+00
+ENDCHAR
+STARTCHAR small u, grave accent
+ENCODING 249
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+20
+10
+44
+44
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR small u, acute accent
+ENCODING 250
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+44
+44
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR small u, circumflex accent
+ENCODING 251
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+10
+28
+00
+44
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR small u, dieresis
+ENCODING 252
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+28
+00
+44
+44
+44
+4C
+34
+00
+ENDCHAR
+STARTCHAR small y, acute accent
+ENCODING 253
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+08
+10
+44
+44
+44
+3C
+04
+38
+ENDCHAR
+STARTCHAR small thorn, Icelandic
+ENCODING 254
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+40
+70
+48
+48
+48
+70
+40
+00
+ENDCHAR
+STARTCHAR small y, dieresis
+ENCODING 255
+SWIDTH 720 0
+DWIDTH 6 0
+BBX 6 8 0 -1
+BITMAP
+28
+00
+44
+44
+44
+3C
+04
+38
+ENDCHAR
+ENDFONT
diff --git a/firmware/win32.mak b/firmware/win32.mak
new file mode 100644
index 0000000000..80165c2c81
--- /dev/null
+++ b/firmware/win32.mak
@@ -0,0 +1,83 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id$
+#
+
+CC = sh-elf-gcc
+LD = sh-elf-ld
+AR = sh-elf-ar
+AS = sh-elf-as
+OC = sh-elf-objcopy
+TOOLSDIR = ../tools
+
+INCLUDES=-Iinclude -I. -Icommon -Idrivers -Iexport
+
+# Pick a target to build for
+TARGET=-DARCHOS_RECORDER=1
+ifdef RECORDER
+ TARGET=-DARCHOS_RECORDER=1
+else
+ ifdef PLAYER
+ TARGET=-DARCHOS_PLAYER=1
+ else
+ ifdef PLAYER_OLD
+ TARGET=-DARCHOS_PLAYER_OLD=1
+ endif
+ endif
+endif
+
+# store output files in this directory:
+OBJDIR = .
+
+# use propfonts?
+ifdef PROPFONTS
+ CFLAGS = -W -Wall -O -m1 -nostdlib -Wstrict-prototypes $(INCLUDES) $(TARGET) -DLCD_PROPFONTS
+else
+ CFLAGS = -W -Wall -O -m1 -nostdlib -Wstrict-prototypes $(INCLUDES) $(TARGET)
+endif
+
+ifdef DEBUG
+CFLAGS += -g -DDEBUG
+else
+CFLAGS += -fomit-frame-pointer -fschedule-insns
+endif
+
+SRC := $(wildcard drivers/*.c common/*.c malloc/*.c *.c)
+
+OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(OBJDIR)/crt0.o $(OBJDIR)/bitswap.o
+DEPS:=.deps
+DEPDIRS:=$(DEPS) $(DEPS)/drivers $(DEPS)/common $(DEPS)/malloc
+
+ifndef PLAYER
+ifndef PLAYER_OLD
+ OBJS += $(OBJDIR)/sysfont.o
+endif
+endif
+
+OUTPUT = $(OBJDIR)/librockbox.a
+
+$(OUTPUT): $(OBJS)
+ $(AR) ruv $@ $+
+
+$(OBJDIR)/%.o: %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(OBJDIR)/%.o: %.S
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(OBJDIR)/sysfont.o: fonts/clR6x8.bdf
+ $(TOOLSDIR)/convbdf -c -o $(OBJDIR)/sysfont.c $<
+ $(CC) $(CFLAGS) -c $(OBJDIR)/sysfont.c -o $@
+
+clean:
+ -rm -f $(OBJS) $(OUTPUT) sysfont.c
+
+# Special targets
+$(OBJDIR)/thread.o: thread.c export/thread.h
+ $(CC) -c -O -fomit-frame-pointer $(CFLAGS) $< -o $@
+
+-include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)
diff --git a/flash/FILES b/flash/FILES
deleted file mode 100644
index 2eaed530c8..0000000000
--- a/flash/FILES
+++ /dev/null
@@ -1,19 +0,0 @@
-FILES
-README
-bootloader/*.[ch]
-bootloader/*.lds
-bootloader/Makefile
-bootloader/README
-extract/*.[ch]
-extract/extract.dsp
-extract/README
-make_firmware/*.[ch]
-make_firmware/make_firmware.dsp
-make_firmware/README
-minimon/*.[ch]
-minimon/minimon.lds
-minimon/Makefile
-minimon/README
-uart_boot/*.[ch]
-uart_boot/uart_boot.dsp
-uart_boot/README
diff --git a/flash/README b/flash/README
deleted file mode 100644
index 9f77dd502f..0000000000
--- a/flash/README
+++ /dev/null
@@ -1,7 +0,0 @@
-(c) 2003 by Jörg Hohensohn
-
-Sourcecode for the flash "infrastructure"
-Please bear in mind that these are powerful tools, don't fool with them!
-
-For most up-to-date info about flashing see:
-http://rockbox.haxx.se/docs/flash.html
diff --git a/flash/bootbox/FILES b/flash/bootbox/FILES
deleted file mode 100644
index 22e7774f20..0000000000
--- a/flash/bootbox/FILES
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-SOURCES
-FILES
-*.c
diff --git a/flash/bootbox/Makefile b/flash/bootbox/Makefile
deleted file mode 100644
index e08c26f53e..0000000000
--- a/flash/bootbox/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR) \
- -I$(BUILDDIR)
-
-DEPFILE = $(OBJDIR)/dep-bootbox
-LDS := $(FIRMDIR)/app.lds
-
-ifdef DEBUG
- DEFINES := -DDEBUG
- CFLAGS += -g
-endif
-
-SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P -include "config.h" - )
-DIRS = .
-
-ifdef APPEXTRA
- DIRS += $(APPEXTRA)
- INCLUDES += -I$(APPEXTRA)
-endif
-
-CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) \
- -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
-
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-SOURCES = $(SRC)
-LINKFILE = $(OBJDIR)/linkage.lds
-MAXINFILE = $(OBJDIR)/romstart.temp
-MAXOUTFILE = $(OBJDIR)/romstart
-
-LIBROCKBOX = $(BUILDDIR)/librockbox.a
-
-all: $(BUILDDIR)/$(BINARY) $(FLASHFILE)
-
-dep: $(DEPFILE)
-
-$(LINKFILE): $(LDS)
- @echo "Build LDS file"
- @cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
-
-$(MAXOUTFILE):
- @echo '#include "config.h"' > $(MAXINFILE)
- @echo "ROM_START" >> $(MAXINFILE)
- @cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE)
- @rm $(MAXINFILE)
-
-$(OBJDIR)/bootbox.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX)
- @echo "LD bootbox.elf"
- $(CC) $(GCCOPTS) -Wl,--gc-sections -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -L$(BUILDDIR)/firmware -lrockbox -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/bootbox.map
-
-$(OBJDIR)/bootbox.bin : $(OBJDIR)/bootbox.elf
- @echo "OBJCOPY $<"
- @$(OC) -O binary $< $@
-
-$(OBJDIR)/bootbox.asm: $(OBJDIR)/bootbox.bin
- $(TOOLSDIR)/sh2d -sh1 $< > $@
-
-$(BUILDDIR)/$(BINARY) : $(OBJDIR)/bootbox.bin
- @echo "Build bootbox file"
- @$(MKFIRMWARE) $< $@
-
-$(FLASHFILE): $(OBJDIR)/bootbox.bin
- @a=`uclpack -h 2>/dev/null`; \
- if test -n "$$a"; then \
- echo "UCLPACK bootbox" ; \
- uclpack --best --2e $< $@ >/dev/null 2>&1; \
- else \
- echo "no uclpack command found, makes a fake bootbox.ucl"; \
- echo "fake" > $@; \
- fi
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- @echo "cleaning bootbox"
- @-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) $(OBJDIR)/bootbox.asm $(OBJDIR)/rockbox.ucl \
- $(OBJDIR)/bootbox.bin $(OBJDIR)/bootbox.elf $(OBJDIR)/*.map \
- $(LINKFILE) $(MAXOUTFILE) $(DEPFILE) $(FLASHFILE)
-
--include $(DEPFILE)
diff --git a/flash/bootbox/SOURCES b/flash/bootbox/SOURCES
deleted file mode 100644
index e241137f99..0000000000
--- a/flash/bootbox/SOURCES
+++ /dev/null
@@ -1 +0,0 @@
-main.c
diff --git a/flash/bootbox/main.c b/flash/bootbox/main.c
deleted file mode 100644
index ef215c092b..0000000000
--- a/flash/bootbox/main.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2005 by Jörg Hohensohn aka [IDC]Dragon
- *
- * This is "Bootbox", a minimalistic loader, rescue firmware for just
- * booting into a full features one. Aside from that it does charging
- * and USB mode, to enable copying the desired firmware.
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "cpu.h"
-#include "system.h"
-#include "lcd.h"
-#include "kernel.h"
-#include "thread.h"
-#include "ata.h"
-#include "disk.h"
-#include "font.h"
-#include "adc.h"
-#include "button.h"
-#include "panic.h"
-#include "power.h"
-#include "file.h"
-#include "buffer.h"
-#include "rolo.h"
-#include "usb.h"
-#include "powermgmt.h"
-
-void usb_screen(void)
-{
- lcd_clear_display();
- lcd_puts(0, 0, "USB mode");
-#ifdef HAVE_LCD_BITMAP
- lcd_update();
-#endif
- usb_acknowledge(SYS_USB_CONNECTED_ACK);
- while(usb_wait_for_disconnect_w_tmo(&button_queue, HZ)) {
- }
-}
-
-int show_logo(void)
-{
- lcd_clear_display();
- lcd_puts(0, 0, "Rockbox");
- lcd_puts(0, 1, "Rescue boot");
-#ifdef HAVE_LCD_BITMAP
- lcd_update();
-#endif
- return 0;
-}
-
-#ifdef HAVE_CHARGING
-/*
-bool backlight_get_on_when_charging(void)
-{
- return false;
-}
-*/
-void charging_screen(void)
-{
- unsigned int button;
- const char* msg;
-
- ide_power_enable(false); /* power down the disk, else would be spinning */
-
- lcd_clear_display();
-
- do
- {
-#ifdef HAVE_CHARGE_CTRL
- if (charge_state == 1)
- msg = "charging";
- else if (charge_state == 2)
- msg = "topoff charge";
- else if (charge_state == 3)
- msg = "trickle charge";
- else
- msg = "not charging";
-
-#else
- msg = "charging";
-#endif
- lcd_puts(0, 0, msg);
- {
- char buf[32];
- int battery_voltage;
- int batt_int, batt_frac;
- battery_voltage = (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) / 10000;
- batt_int = battery_voltage / 100;
- batt_frac = battery_voltage % 100;
-
- snprintf(buf, sizeof(buf), "%d.%02dV %d%%",
- batt_int, batt_frac, battery_level());
- lcd_puts(0, 1, buf);
- }
-
-#ifdef HAVE_LCD_BITMAP
- lcd_update();
-#endif
-
- button = button_get_w_tmo(HZ/2);
-#ifdef BUTTON_ON
- if (button == (BUTTON_ON | BUTTON_REL))
-#else
- if (button == (BUTTON_RIGHT | BUTTON_REL))
-#endif
- break; /* start */
- else
- {
- if (usb_detect())
- break;
- else if (!charger_inserted())
- power_off(); /* charger removed: power down */
- }
- } while (1);
-}
-#endif /* HAVE_CHARGING */
-
-/* prompt user to plug USB and fix a problem */
-void prompt_usb(const char* msg1, const char* msg2)
-{
- int button;
- lcd_clear_display();
- lcd_puts(0, 0, msg1);
- lcd_puts(0, 1, msg2);
-#ifdef HAVE_LCD_BITMAP
- lcd_puts(0, 2, "Insert USB cable");
- lcd_puts(0, 3, "and fix it.");
- lcd_update();
-#endif
- do
- {
- button = button_get(true);
- if (button == SYS_POWEROFF)
- {
- power_off();
- }
- } while (button != SYS_USB_CONNECTED);
- usb_screen();
- system_reboot();
-}
-
-void main(void)
-{
- int rc;
-
- power_init();
- system_init();
- kernel_init();
- buffer_init();
- lcd_init();
- show_logo();
- set_irq_level(0);
- adc_init();
- usb_init();
- button_init();
- powermgmt_init();
-
-#if defined(HAVE_CHARGING) && (CONFIG_CPU == SH7034)
- if (charger_inserted()
-#ifdef ATA_POWER_PLAYERSTYLE
- && !ide_powered() /* relies on probing result from bootloader */
-#endif
- )
- {
- charging_screen(); /* display a "charging" screen */
- show_logo(); /* again, to provide better visual feedback */
- }
-#endif
-
- rc = ata_init();
- if(rc)
- {
-#ifdef HAVE_LCD_BITMAP
- char str[32];
- lcd_clear_display();
- snprintf(str, 31, "ATA error: %d", rc);
- lcd_puts(0, 1, str);
- lcd_update();
- while(!(button_get(true) & BUTTON_REL));
-#endif
- panicf("ata: %d", rc);
- }
-
- //disk_init();
- usb_start_monitoring();
- while (usb_detect())
- { /* enter USB mode early, before trying to mount */
- if (button_get_w_tmo(HZ/10) == SYS_USB_CONNECTED)
- {
- usb_screen();
- }
- }
-
- rc = disk_mount_all();
- if (rc<=0)
- {
- prompt_usb("No partition", "found.");
- }
-
- { // rolo the firmware
- static const char filename[] = "/" BOOTFILE;
- rolo_load((char*)filename); /* won't return if started */
-
- prompt_usb("No firmware", filename);
- }
-
-
-}
-
-/* These functions are present in the firmware library, but we reimplement
- them here because the originals do a lot more than we want */
-
-void screen_dump(void)
-{
-}
-
-int dbg_ports(void)
-{
- return 0;
-}
-
-void audio_stop(void)
-{
-}
-
-int audio_status(void)
-{
- return 0;
-}
-
-void mp3_shutdown(void)
-{
-}
-/*
-void i2c_init(void)
-{
-}
-
-void backlight_on(void)
-{
-}
-*/
diff --git a/flash/bootloader/Makefile b/flash/bootloader/Makefile
deleted file mode 100644
index 6872fcbc99..0000000000
--- a/flash/bootloader/Makefile
+++ /dev/null
@@ -1,78 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-CC = sh-elf-gcc
-LD = sh-elf-ld
-AR = sh-elf-ar
-AS = sh-elf-as
-OC = sh-elf-objcopy
-
-FIRMWARE := ../../firmware
-TOOLSDIR=../../tools
-
-TARGET = bootloader
-LDS := $(TARGET).lds
-
-
-ifndef PLATFORM
-not_configured:
- @echo "No platform given."
- @echo "Use make PLATFORM=PLAYER|RECORDER|FM|ONDIO {NO_ROM=1}"
-##else
-##configured:
-## @echo "Building bootloader for platform "$(PLATFORM)
-endif
-
-
-INCLUDES= -I$(FIRMWARE)/export -I. -I$(OBJDIR)
-DEFINES= -DPLATFORM_$(PLATFORM)
-
-OBJDIR := .
-
-CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(DEFINES)
-AFLAGS += -small -relax
-
-
-ifdef DEBUG
- DEFINES := -DDEBUG
- CFLAGS += -g
-endif
-
-SRC := $(wildcard *.c)
-
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-
-ifdef NO_ROM
-LINKFILE = $(OBJDIR)/no_rom.lds
-ORIGIN = 0
-DEFINES += -DNO_ROM
-else
-LINKFILE = $(OBJDIR)/$(TARGET).lds
-ORIGIN = FFFF500
-endif
-
-$(OBJDIR)/$(TARGET).bin : $(OBJDIR)/$(TARGET).elf
- $(OC) -O binary $(OBJDIR)/$(TARGET).elf $(OBJDIR)/$(TARGET).bin
- $(TOOLSDIR)/sh2d $(OBJDIR)/$(TARGET).bin -o $(ORIGIN) > $(OBJDIR)/$(TARGET).asm
-ifndef NO_ROM
- $(TOOLSDIR)/scramble $(OBJDIR)/$(TARGET).bin $(OBJDIR)/$(TARGET).ajz
-endif
-
-$(OBJDIR)/$(TARGET).elf : $(OBJS)
- $(CC) -Os -nostdlib -o $(OBJDIR)/$(TARGET).elf -L$(OBJDIR) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$(TARGET).map
-
-
-clean:
- -rm -f \
- $(OBJS) \
- $(OBJDIR)/$(TARGET).asm \
- $(OBJDIR)/$(TARGET).bin \
- $(OBJDIR)/$(TARGET).ajz \
- $(OBJDIR)/$(TARGET).elf \
- $(OBJDIR)/$(TARGET).map
diff --git a/flash/bootloader/README b/flash/bootloader/README
deleted file mode 100644
index 16c27d9876..0000000000
--- a/flash/bootloader/README
+++ /dev/null
@@ -1,4 +0,0 @@
-(c) 2003 by Jörg Hohensohn
-
-This is the source code for the flash bootloader.
-It give the dual boot feature, decompresses one of two software images.
diff --git a/flash/bootloader/bootloader.c b/flash/bootloader/bootloader.c
deleted file mode 100644
index d5ce509cce..0000000000
--- a/flash/bootloader/bootloader.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2003 by Jörg Hohensohn
- *
- * Second-level bootloader, with dual-boot feature by holding F1/Menu
- * This is the image being descrambled and executed by the boot ROM.
- * It's task is to copy Rockbox from Flash to DRAM.
- * The image(s) in flash may optionally be compressed with UCL 2e
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-#include "sh7034.h"
-#include "bootloader.h"
-
-
-#ifdef NO_ROM
-/* start with the vector table */
-UINT32 vectors[] __attribute__ ((section (".vectors"))) =
-{
- (UINT32)_main, /* entry point, the copy routine */
- (UINT32)(end_stack - 1), /* initial stack pointer */
- FLASH_BASE + 0x200, /* source of image in flash */
- (UINT32)total_size, /* size of image */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x03020080 /* mask and version (just as a suggestion) */
-};
-#else
-/* our binary has to start with a vector to the entry point */
-tpMain start_vector[] __attribute__ ((section (".startvector"))) = {main};
-#endif
-
-#ifdef NO_ROM /* some code which is only needed for the romless variant */
-void _main(void)
-{
- UINT32* pSrc;
- UINT32* pDest;
- UINT32* pEnd;
-/*
- asm volatile ("ldc %0,sr" : : "r"(0xF0)); // disable interrupts
- asm volatile ("mov.l @%0,r15" : : "r"(4)); // load stack
- asm volatile ("ldc %0,vbr" : : "r"(0)); // load vector base
-*/
- /* copy everything to IRAM and continue there */
- pSrc = begin_iramcopy;
- pDest = begin_text;
- pEnd = pDest + (begin_stack - begin_text);
-
- do
- {
- *pDest++ = *pSrc++;
- }
- while (pDest < pEnd);
-
- main(); /* jump to the real main() */
-}
-
-
-void BootInit(void)
-{
- /* inits from the boot ROM, whether they make sense or not */
- PBDR &= 0xFFBF; /* LED off (0x131E) */
- PBCR2 = 0; /* all GPIO */
- PBIOR |= 0x0040; /* LED output */
- PBIOR &= 0xFFF1; /* LCD lines input */
-
- /* init DRAM like the boot ROM does */
- PACR2 &= 0xFFFB;
- PACR2 |= 0x0008;
- CASCR = 0xAF;
- BCR |= 0x8000;
- WCR1 &= 0xFDFD;
- DCR = 0x0E00;
- RCR = 0x5AB0;
- RTCOR = 0x9605;
- RTCSR = 0xA518;
-}
-#endif /* #ifdef NO_ROM */
-
-
-int main(void)
-{
- int nButton;
-
- PlatformInit(); /* model-specific inits */
-
- nButton = ButtonPressed();
-
- if (nButton == 3)
- { /* F3 means start monitor */
- MiniMon();
- }
- else
- {
- tImage* pImage;
- pImage = GetStartImage(nButton); /* which image */
- DecompressStart(pImage); /* move into place and start it */
- }
-
- return 0; /* I guess we won't return ;-) */
-}
-
-
-/* init code that is specific to certain platform */
-void PlatformInit(void)
-{
-#ifdef NO_ROM
- BootInit(); /* if not started by boot ROM, we need to init what it did */
-#endif
-
-#if defined PLATFORM_PLAYER
- BRR1 = 0x19; /* 14400 Baud for monitor */
- PBDRL |= 0x10; /* set PB4 to 1 to power the hd early (and prepare for
- * probing in case the charger is connected) */
- PBIORL |= 0x10; /* make PB4 an output */
- PACR2 &= 0xFFFC; /* GPIO for PA0 (charger detection, input by default) */
- if (!(PADRL & 0x01)) /* charger plugged? */
- { /* we need to probe whether the box is able to control hd power */
- int i;
-
- PBIORL &= ~0x10; /* set PB4 to input */
- /* wait whether it goes low, max. ~1 ms */
- for (i = 0; (PBDRL & 0x10) && i < 1000; i++);
-
- if (~(PBDRL & 0x10)) /* pulled low -> power controllable */
- PBDRL &= 0x10; /* set PB4 low */
- else /* still floating high -> not controllable */
- PBDRL |= 0x10; /* set PB4 high */
- PBIORL |= 0x10; /* ..and output again */
- }
-#elif defined PLATFORM_RECORDER
- BRR1 = 0x02; /* 115200 Baud for monitor */
- if (ReadADC(7) > 0x100) /* charger plugged? */
- { /* switch off the HD, else a flat battery may not start */
- PACR2 &= 0xFBFF; /* GPIO for PA5 */
- PAIOR |= 0x0020; /* make PA5 an output (low by default) */
- }
-#elif defined PLATFORM_FM
- BRR1 = 0x02; /* 115200 Baud for monitor */
- PBDR |= 0x0020; /* set PB5 to keep power (fixes the ON-holding problem) */
- PBIOR |= 0x0020; /* make PB5 an output */
- if (ReadADC(0) < 0x1FF) /* charger plugged? */
- { /* switch off the HD, else a flat battery may not start */
- PACR2 &= 0xFBFF; /* GPIO for PA5 */
- PAIOR |= 0x0020; /* make PA5 an output (low by default) */
- }
-#elif defined PLATFORM_ONDIO
- BRR1 = 0x19; /* 14400 Baud for monitor */
- PBDR |= 0x0020; /* set PB5 to keep power (fixes the ON-holding problem) */
- PBIOR |= 0x0020; /* make PB5 an output */
-#endif
-
- /* platform-independent inits */
- DCR |= 0x1000; /* enable burst mode on DRAM */
- BCR |= 0x2000; /* activate Warp mode (simultaneous internal and external
- * mem access) */
-}
-
-
-/* Thinned out version of the UCL 2e decompression sourcecode
- * Original (C) Markus F.X.J Oberhumer under GNU GPL license */
-#define GETBIT(bb, src, ilen) \
- (((bb = bb & 0x7f ? bb*2 : ((unsigned)src[ilen++]*2+1)) >> 8) & 1)
-
-int ucl_nrv2e_decompress_8(
- const UINT8 *src, UINT8 *dst, UINT32* dst_len)
-{
- UINT32 bb = 0;
- unsigned ilen = 0, olen = 0, last_m_off = 1;
-
- for (;;)
- {
- unsigned m_off, m_len;
-
- while (GETBIT(bb,src,ilen))
- {
- dst[olen++] = src[ilen++];
- }
- m_off = 1;
- for (;;)
- {
- m_off = m_off*2 + GETBIT(bb,src,ilen);
- if (GETBIT(bb,src,ilen)) break;
- m_off = (m_off-1)*2 + GETBIT(bb,src,ilen);
- }
- if (m_off == 2)
- {
- m_off = last_m_off;
- m_len = GETBIT(bb,src,ilen);
- }
- else
- {
- m_off = (m_off-3)*256 + src[ilen++];
- if (m_off == 0xffffffff)
- break;
- m_len = (m_off ^ 0xffffffff) & 1;
- m_off >>= 1;
- last_m_off = ++m_off;
- }
- if (m_len)
- m_len = 1 + GETBIT(bb,src,ilen);
- else if (GETBIT(bb,src,ilen))
- m_len = 3 + GETBIT(bb,src,ilen);
- else
- {
- m_len++;
- do {
- m_len = m_len*2 + GETBIT(bb,src,ilen);
- } while (!GETBIT(bb,src,ilen));
- m_len += 3;
- }
- m_len += (m_off > 0x500);
- {
- const UINT8 *m_pos;
- m_pos = dst + olen - m_off;
- dst[olen++] = *m_pos++;
- do dst[olen++] = *m_pos++; while (--m_len > 0);
- }
- }
- *dst_len = olen;
-
- return ilen;
-}
-
-
-/* move the image into place and start it */
-void DecompressStart(tImage* pImage)
-{
- UINT32* pSrc;
- UINT32* pDest;
-
- pSrc = pImage->image;
- pDest = pImage->pDestination;
-
- if (pSrc != pDest) /* if not linked to that flash address */
- {
- if (pImage->flags & IF_UCL_2E)
- { /* UCL compressed, algorithm 2e */
- UINT32 dst_len; /* dummy */
- ucl_nrv2e_decompress_8((UINT8*)pSrc, (UINT8*)pDest, &dst_len);
- }
- else
- { /* uncompressed, copy it */
- UINT32 size = pImage->size;
- UINT32* pEnd;
- size = (size + 3) / 4; /* round up to 32bit-words */
- pEnd = pDest + size;
-
- do
- {
- *pDest++ = *pSrc++;
- }
- while (pDest < pEnd);
- }
- }
-
- pImage->pExecute();
-}
-
-#ifdef USE_ADC
-int ReadADC(int channel)
-{
- /* after channel 3, the ports wrap and get re-used */
- volatile UINT16* pResult = (UINT16*)(ADDRAH_ADDR + 2 * (channel & 0x03));
- int timeout = 266; /* conversion takes 266 clock cycles */
-
- ADCSR = 0x20 | channel; /* start single conversion */
- while (((ADCSR & 0x80) == 0) && (--timeout)); /* 6 instructions per round*/
-
- return (timeout == 0) ? -1 : *pResult>>6;
-}
-#endif
-
-
-/* This function is platform-dependent,
- * until I figure out how to distinguish at runtime. */
-int ButtonPressed(void) /* return 1,2,3 for F1,F2,F3, 0 if none pressed */
-{
-#ifdef USE_ADC
- int value = ReadADC(CHANNEL);
-
- if (value >= F1_LOWER && value <= F1_UPPER) /* in range */
- return 1;
- else if (value >= F2_LOWER && value <= F2_UPPER) /* in range */
- return 2;
- else if (value >= F3_LOWER && value <= F3_UPPER) /* in range */
- return 3;
-#else
- int value = PCDR;
-
- if (!(value & F1_MASK))
- return 1;
- else if (!(value & F2_MASK))
- return 2;
- else if (!(value & F3_MASK))
- return 3;
-#endif
-
- return 0;
-}
-
-
-/* Determine the image to be started */
-tImage* GetStartImage(int nPreferred)
-{
- tImage* pImage1;
- tImage* pImage2 = NULL; /* default to not present */
- UINT32 pos;
- UINT32* pFlash = (UINT32*)FLASH_BASE;
-
- /* determine the first image position */
- pos = pFlash[2] + pFlash[3]; /* position + size of the bootloader
- * = after it */
- pos = (pos + 3) & ~3; /* be sure it's 32 bit aligned */
-
- pImage1 = (tImage*)pos;
-
- if (pImage1->size != 0)
- { /* check for second image */
- pos = (UINT32)(&pImage1->image) + pImage1->size;
- pImage2 = (tImage*)pos;
-
- /* does it make sense? (not in FF or 00 erazed space) */
- if (pImage2->pDestination == (void*)0xFFFFFFFF
- || pImage2->size == 0xFFFFFFFF
- || pImage2->pExecute == (void*)0xFFFFFFFF
- || pImage2->flags == 0xFFFFFFFF
- || pImage2->pDestination == NULL)
- /* size, execute and flags can legally be 0 */
- {
- pImage2 = NULL; /* invalidate */
- }
- }
-
- if (pImage2 == NULL || nPreferred == 1)
- { /* no second image or overridden: return the first */
- return pImage1;
- }
-
- return pImage2; /* return second image */
-}
-
-/* diagnostic functions */
-
-void SetLed(BOOL bOn)
-{
- if (bOn)
- PBDR |= 0x0040;
- else
- PBDR &= ~0x0040;
-}
-
-
-void UartInit(void)
-{
- PBIOR &= 0xFBFF; /* input: RXD1 remote pin */
- PBCR1 |= 0x00A0; /* set PB11+PB10 to UART */
- PBCR1 &= 0xFFAF; /* clear bits 6, 4 -> UART */
- SMR1 = 0x00; /* async format 8N1, baud generator input is CPU clock */
- SCR1 = 0x30; /* transmit+receive enable */
- PBCR1 &= 0x00FF; /* set bit 12...15 as GPIO */
- SSR1 &= 0xBF; /* clear bit 6 (RDRF, receive data register full) */
-}
-
-
-UINT8 UartRead(void)
-{
- UINT8 byte;
- while (!(SSR1 & SCI_RDRF)); /* wait for char to be available */
- byte = RDR1;
- SSR1 &= ~SCI_RDRF;
- return byte;
-}
-
-
-void UartWrite(UINT8 byte)
-{
- while (!(SSR1 & SCI_TDRE)); /* wait for transmit buffer empty */
- TDR1 = byte;
- SSR1 &= ~SCI_TDRE;
-}
-
-
-/* include the mini monitor as a rescue feature, started with F3 */
-void MiniMon(void)
-{
- UINT8 cmd;
- UINT32 addr;
- UINT32 size;
- UINT32 content;
- volatile UINT8* paddr = NULL;
- volatile UINT8* pflash = NULL; /* flash base address */
-
- UartInit();
-
- while (1)
- {
- cmd = UartRead();
- switch (cmd)
- {
- case BAUDRATE:
- content = UartRead();
- UartWrite(cmd); /* acknowledge by returning the command value */
- while (!(SSR1 & SCI_TEND)); /* wait for empty shift register,
- * before changing baudrate */
- BRR1 = content;
- break;
-
- case ADDRESS:
- addr = (UartRead() << 24) | (UartRead() << 16)
- | (UartRead() << 8) | UartRead();
- paddr = (UINT8*)addr;
- pflash = (UINT8*)(addr & 0xFFF80000); /* round down to 512k align*/
- UartWrite(cmd); /* acknowledge by returning the command value */
- break;
-
- case BYTE_READ:
- content = *paddr++;
- UartWrite(content); /* the content is the ack */
- break;
-
- case BYTE_WRITE:
- content = UartRead();
- *paddr++ = content;
- UartWrite(cmd); /* acknowledge by returning the command value */
- break;
-
- case BYTE_READ16:
- size = 16;
- while (size--)
- {
- content = *paddr++;
- UartWrite(content); /* the content is the ack */
- }
- break;
-
- case BYTE_WRITE16:
- size = 16;
- while (size--)
- {
- content = UartRead();
- *paddr++ = content;
- }
- UartWrite(cmd); /* acknowledge by returning the command value */
- break;
-
- case BYTE_FLASH:
- content = UartRead();
- pflash[0x5555] = 0xAA; /* set flash to command mode */
- pflash[0x2AAA] = 0x55;
- pflash[0x5555] = 0xA0; /* byte program command */
- *paddr++ = content;
- UartWrite(cmd); /* acknowledge by returning the command value */
- break;
-
- case BYTE_FLASH16:
- size = 16;
- while (size--)
- {
- content = UartRead();
- pflash[0x5555] = 0xAA; /* set flash to command mode */
- pflash[0x2AAA] = 0x55;
- pflash[0x5555] = 0xA0; /* byte program command */
- *paddr++ = content;
- }
- UartWrite(cmd); /* acknowledge by returning the command value */
- break;
-
- case HALFWORD_READ:
- content = *(UINT16*)paddr;
- paddr += 2;
- UartWrite(content >> 8); /* highbyte */
- UartWrite(content & 0xFF); /* lowbyte */
- break;
-
- case HALFWORD_WRITE:
- content = UartRead() << 8 | UartRead();
- *(UINT16*)paddr = content;
- paddr += 2;
- UartWrite(cmd); /* acknowledge by returning the command value */
- break;
-
- case EXECUTE:
- {
- tpFunc pFunc = (tpFunc)paddr;
- pFunc();
- UartWrite(cmd); /* acknowledge by returning the command value*/
- }
- break;
-
- case VERSION:
- UartWrite(1); /* return our version number */
- break;
-
- default:
- {
- SetLed(TRUE);
- UartWrite(~cmd); /* error acknowledge */
- }
-
- } /* case */
- } /* while (1) */
-}
diff --git a/flash/bootloader/bootloader.h b/flash/bootloader/bootloader.h
deleted file mode 100644
index fc6bcb1eed..0000000000
--- a/flash/bootloader/bootloader.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-#define TRUE 1
-#define FALSE 0
-
-// scalar types
-typedef unsigned char UINT8;
-typedef unsigned short UINT16;
-typedef unsigned long UINT32;
-typedef int BOOL;
-
-typedef void(*tpFunc)(void); // type for execute
-typedef int(*tpMain)(void); // type for start vector to main()
-
-
-// structure of an image in the flash
-typedef struct
-{
- UINT32* pDestination; // address to copy it to
- UINT32 size; // how many bytes of payload (to the next header)
- tpFunc pExecute; // entry point
- UINT32 flags; // uncompressed or compressed
- // end of header, now comes the payload
- UINT32 image[]; // the binary image starts here
- // after the payload, the next header may follow, all 0xFF if none
-} tImage;
-
-// flags valid for image header
-#define IF_NONE 0x00000000
-#define IF_UCL_2E 0x00000001 // image is compressed with UCL, algorithm 2e
-
-
-// resolve platform dependency of F1 button check
-#if defined PLATFORM_PLAYER
-#define F1_MASK 0x0001 // Player has no F1 button, so we use "-"
-#define F2_MASK 0x0008 // Player has no F2 button, so we use "Play"
-#define F3_MASK 0x0004 // Player has no F3 button, so we use "+"
-
-#elif defined PLATFORM_RECORDER
-#define USE_ADC
-#define CHANNEL 4
-#define F1_LOWER 250
-#define F1_UPPER 499
-#define F2_LOWER 500
-#define F2_UPPER 699
-#define F3_LOWER 900
-#define F3_UPPER 1023
-
-#elif defined PLATFORM_FM
-#define USE_ADC
-#define CHANNEL 4
-#define F1_LOWER 150
-#define F1_UPPER 384
-#define F2_LOWER 385
-#define F2_UPPER 544
-#define F3_LOWER 700
-#define F3_UPPER 1023
-
-#elif defined PLATFORM_ONDIO
-#define USE_ADC
-#define CHANNEL 4
-#define F1_LOWER 0x2EF // Ondio has no F1 button,
-#define F1_UPPER 0x3FF // so we use "Left".
-#define F2_LOWER 0x19D // Ondio has no F2 button,
-#define F2_UPPER 0x245 // so we use "Up".
-#define F3_LOWER 0x246 // Ondio has no F3 button,
-#define F3_UPPER 0x2EE // so we use "Right".
-
-#else
-#error ("No platform given!")
-#endif
-
-
-#define FLASH_BASE 0x02000000 // start of the flash memory
-#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
-
-
-// prototypes
-void _main(void) __attribute__ ((section (".startup")));
-int main(void);
-void PlatformInit(void);
-void DramInit(void);
-int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
-void DecompressStart(tImage* pImage);
-#ifdef USE_ADC
-int ReadADC(int channel);
-#endif
-int ButtonPressed(void);
-tImage* GetStartImage(int nPreferred);
-// test functions
-void SetLed(BOOL bOn);
-void UartInit(void);
-UINT8 UartRead(void);
-void UartWrite(UINT8 byte);
-void MiniMon(void);
-
-
-// minimon commands
-#define BAUDRATE 0x00 // followed by BRR value; response: command byte
-#define ADDRESS 0x01 // followed by 4 bytes address; response: command byte
-#define BYTE_READ 0x02 // response: 1 byte content
-#define BYTE_WRITE 0x03 // followed by 1 byte content; response: command byte
-#define BYTE_READ16 0x04 // response: 16 bytes content
-#define BYTE_WRITE16 0x05 // followed by 16 bytes; response: command byte
-#define BYTE_FLASH 0x06 // followed by 1 byte content; response: command byte
-#define BYTE_FLASH16 0x07 // followed by 16 bytes; response: command byte
-#define HALFWORD_READ 0x08 // response: 2 byte content
-#define HALFWORD_WRITE 0x09 // followed by 2 byte content; response: command byte
-#define EXECUTE 0x0A // response: command byte if call returns
-#define VERSION 0x0B // response: version
-
-
-// linker symbols
-extern UINT32 begin_text[];
-extern UINT32 end_text[];
-extern UINT32 begin_data[];
-extern UINT32 end_data[];
-extern UINT32 begin_bss[];
-extern UINT32 end_bss[];
-extern UINT32 begin_stack[];
-extern UINT32 end_stack[];
-extern UINT32 begin_iramcopy[];
-extern UINT32 total_size[];
diff --git a/flash/bootloader/bootloader.lds b/flash/bootloader/bootloader.lds
deleted file mode 100644
index 143d83bdc7..0000000000
--- a/flash/bootloader/bootloader.lds
+++ /dev/null
@@ -1,34 +0,0 @@
-OUTPUT_FORMAT(elf32-sh)
-INPUT(bootloader.o)
-
-MEMORY
-{
- /* the boot ROM uses IRAM at 400-430, stay away and start at 500 */
- IRAM : ORIGIN = 0x0FFFF500, LENGTH = 0xA00
- /* and leave some room for stack at the end */
-}
-
-SECTIONS
-{
- .startvector :
- {
- *(.startvector)
- . = ALIGN(0x4);
- } > IRAM
-
- .text :
- {
- *(.text)
- . = ALIGN(0x4);
- } > IRAM
-
- .data :
- {
- *(.data)
- } > IRAM
-
- .bss :
- {
- *(.bss)
- } > IRAM
-}
diff --git a/flash/bootloader/no_rom.lds b/flash/bootloader/no_rom.lds
deleted file mode 100644
index e65e7fdd3c..0000000000
--- a/flash/bootloader/no_rom.lds
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This is for the variant without boot ROM,
- where the flash ROM is mirrored to address zero */
-
-OUTPUT_FORMAT(elf32-sh)
-INPUT(bootloader.o)
-
-MEMORY
-{
- IRAM : ORIGIN = 0x0FFFF000, LENGTH = 0x1000
- FLASH : ORIGIN = 0x00000000, LENGTH = 0x40000
-}
-
-SECTIONS
-{
- .vectors :
- {
- *(.vectors)
- . = ALIGN(0x200);
- } > FLASH
-
- .startup :
- {
- *(.startup)
- . = ALIGN(0x4);
- _begin_iramcopy = .;
- } > FLASH
-
- .text : AT ( _begin_iramcopy )
- {
- _begin_text = .;
- *(.text)
- . = ALIGN(0x4);
- _end_text = .;
- } > IRAM
-
- .data : AT ( _end_text )
- {
- _begin_data = .;
- *(.data)
- . = ALIGN(0x4);
- _end_data = .;
- } > IRAM
-
- .bss : AT ( _end_data )
- {
- _begin_bss = .;
- *(.bss)
- . = ALIGN(0x4);
- _end_bss = .;
- } > IRAM
-
- .stack :
- {
- _begin_stack = .;
- *(.stack)
- . = ALIGN(0x1000);
- _end_stack = .;
- } > IRAM
-
- /* size of the program (without vectors) */
- _total_size = SIZEOF(.startup) + SIZEOF(.text) + SIZEOF(.data);
-}
diff --git a/flash/extract/README b/flash/extract/README
deleted file mode 100644
index b66443aa34..0000000000
--- a/flash/extract/README
+++ /dev/null
@@ -1,5 +0,0 @@
-(c) 2003 by Jörg Hohensohn
-
-This tool extracts the firmware image out of an original Archos ROM dump,
-like created with the Rockbox debug->dump feature.
-The extracted image can then be used to compose a dual-boot firmware.
diff --git a/flash/extract/extract.c b/flash/extract/extract.c
deleted file mode 100644
index 2a8a7b3ec7..0000000000
--- a/flash/extract/extract.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2003 by Jörg Hohensohn
- *
- * Tool to extract the scrambled image out of an Archos flash ROM dump
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-
-#define UINT8 unsigned char
-#define UINT16 unsigned short
-#define UINT32 unsigned long
-
-#define IMAGE_HEADER 0x6000 // a 32 byte header in front of the software image
-#define IMAGE_START 0x6020 // software image position in Flash
-
-
-// place a 32 bit value into memory, big endian
-void Write32(UINT8* pByte, UINT32 value)
-{
- pByte[0] = (UINT8)(value >> 24);
- pByte[1] = (UINT8)(value >> 16);
- pByte[2] = (UINT8)(value >> 8);
- pByte[3] = (UINT8)(value);
-}
-
-
-// read a 32 bit value from memory, big endian
-UINT32 Read32(UINT8* pByte)
-{
- UINT32 value = 0;
-
- value |= (UINT32)pByte[0] << 24;
- value |= (UINT32)pByte[1] << 16;
- value |= (UINT32)pByte[2] << 8;
- value |= (UINT32)pByte[3];
-
- return value;
-}
-
-
-// entry point
-int main(int argc, char* argv[])
-{
- FILE* pInFile;
- FILE* pOutFile;
- UINT8 aHeader[6];
- UINT8 aImage[256*1024];
- UINT32 i;
- UINT32 uiSize, uiStart;
- UINT16 usChecksum = 0;
-
- if (argc < 2)
- {
- printf("Extract the software image out of an original Archos Flash ROM dump.\n");
- printf("Result is a scrambled file, use the descramble tool to get the binary,\n");
- printf(" always without the -fm option, even if processing an FM software.\n\n");
- printf("Usage: extract <flash dump file> <output file>\n");
- printf("Example: extract internal_rom_2000000-203FFFF.bin archos.ajz\n");
- exit(0);
- }
-
- pInFile = fopen(argv[1], "rb");
- if (pInFile == NULL)
- {
- printf("Error opening input file %s\n", argv[1]);
- exit(1);
- }
-
- if (fread(aImage, 1, sizeof(aImage), pInFile) != sizeof(aImage))
- {
- printf("Error reading input file %s, must be 256kB in size.\n", argv[1]);
- fclose(pInFile);
- exit(2);
- }
- fclose(pInFile);
-
- // find out about the type
- uiStart = Read32(aImage + 8);
- uiSize = Read32(aImage + 12); // booted ROM image
- if (uiStart == 0x02000100 && uiSize > 20000)
- { // Player has no loader, starts directly with the image
- uiStart = 0x0100;
- }
- else
- { // Recorder / FM / V2 Recorder
- uiStart = IMAGE_START;
- uiSize = Read32(aImage + IMAGE_HEADER + 4); // size record of header
- }
-
- // sanity check
- if (uiSize > sizeof(aImage) - uiStart || uiSize < 40000)
- {
- printf("Error: Impossible image size &d bytes.\n", uiSize);
- exit(3);
- }
-
- // generate checksum
- for (i=0; i<uiSize; i++)
- {
- UINT8 byte;
- byte = aImage[uiStart + i];
- byte = ~((byte >> 1) | ((byte << 7) & 0x80)); /* poor man's ROR */
- usChecksum += byte;
- }
-
- // make header
- Write32(aHeader + 2, usChecksum); // checksum in 5th and 6th byte
- Write32(aHeader, uiSize); // size in first 4 bytes
-
- pOutFile = fopen(argv[2], "wb");
- if (pOutFile == NULL)
- {
- printf("Error opening output file %s\n", argv[2]);
- exit(4);
- }
-
- if (fwrite(aHeader, 1, sizeof(aHeader), pOutFile) != sizeof(aHeader)
- || fwrite(aImage + uiStart, 1, uiSize, pOutFile) != uiSize)
- {
- printf("Write error\n");
- fclose(pOutFile);
- exit(5);
- }
-
- fclose(pOutFile);
-
- return 0;
-} \ No newline at end of file
diff --git a/flash/extract/extract.dsp b/flash/extract/extract.dsp
deleted file mode 100644
index e10281a829..0000000000
--- a/flash/extract/extract.dsp
+++ /dev/null
@@ -1,100 +0,0 @@
-# Microsoft Developer Studio Project File - Name="extract" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=extract - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "extract.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "extract.mak" CFG="extract - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "extract - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "extract - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "extract - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "extract - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "extract - Win32 Release"
-# Name "extract - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\extract.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/flash/make_firmware/README b/flash/make_firmware/README
deleted file mode 100644
index 7110610284..0000000000
--- a/flash/make_firmware/README
+++ /dev/null
@@ -1,14 +0,0 @@
-(c) 2003 by Jörg Hohensohn
-
-This tool composes a firmware file, out of:
-1. Template for the first Flash page
-2. Bootloader
-3. Archos image
-4. Rockbox image
-
-Use with extreme caution, the components have to match!
-The aspects are:
-- Model (Player, Recorder, FM, V2)
-- boot type (standard boot ROM or ROMless)
-
-Such a firmware file can then be programmed with "firmware_flash.rock".
diff --git a/flash/make_firmware/make_firmware.c b/flash/make_firmware/make_firmware.c
deleted file mode 100644
index 05cb3322ea..0000000000
--- a/flash/make_firmware/make_firmware.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2003 by Jörg Hohensohn
- *
- * Autoring tool for the firmware image to be programmed into Flash ROM
- * It composes the flash content with header, bootloader and image(s)
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-#include <string.h>
-
-#define UINT8 unsigned char
-#define UINT16 unsigned short
-#define UINT32 unsigned long
-#define BOOL int
-#define TRUE 1
-#define FALSE 0
-
-// size of one flash sector, the granularity with which it can be erased
-#define SECTORSIZE 4096
-
-#define BOOTLOAD_DEST 0x0FFFF500 // for the "normal" one
-#define FLASH_START 0x02000000
-#define BOOTLOAD_SCR 0x02000100
-#define ROCKBOX_DEST 0x09000000
-#define ROCKBOX_EXEC 0x09000200
-
-
-// place a 32 bit value into memory, big endian
-void Write32(UINT8* pByte, UINT32 value)
-{
- pByte[0] = (UINT8)(value >> 24);
- pByte[1] = (UINT8)(value >> 16);
- pByte[2] = (UINT8)(value >> 8);
- pByte[3] = (UINT8)(value);
-}
-
-
-// read a 32 bit value from memory, big endian
-UINT32 Read32(UINT8* pByte)
-{
- UINT32 value = 0;
-
- value |= (UINT32)pByte[0] << 24;
- value |= (UINT32)pByte[1] << 16;
- value |= (UINT32)pByte[2] << 8;
- value |= (UINT32)pByte[3];
-
- return value;
-}
-
-
-UINT32 CalcCRC32 (const UINT8* buf, UINT32 len)
-{
- static const UINT32 crc_table[256] =
- { // CRC32 lookup table for polynomial 0x04C11DB7
- 0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B,
- 0x1A864DB2, 0x1E475005, 0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, 0x2B4BCB61,
- 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD, 0x4C11DB70, 0x48D0C6C7,
- 0x4593E01E, 0x4152FDA9, 0x5F15ADAC, 0x5BD4B01B, 0x569796C2, 0x52568B75,
- 0x6A1936C8, 0x6ED82B7F, 0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3,
- 0x709F7B7A, 0x745E66CD, 0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039,
- 0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5, 0xBE2B5B58, 0xBAEA46EF,
- 0xB7A96036, 0xB3687D81, 0xAD2F2D84, 0xA9EE3033, 0xA4AD16EA, 0xA06C0B5D,
- 0xD4326D90, 0xD0F37027, 0xDDB056FE, 0xD9714B49, 0xC7361B4C, 0xC3F706FB,
- 0xCEB42022, 0xCA753D95, 0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1,
- 0xE13EF6F4, 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D, 0x34867077, 0x30476DC0,
- 0x3D044B19, 0x39C556AE, 0x278206AB, 0x23431B1C, 0x2E003DC5, 0x2AC12072,
- 0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16, 0x018AEB13, 0x054BF6A4,
- 0x0808D07D, 0x0CC9CDCA, 0x7897AB07, 0x7C56B6B0, 0x71159069, 0x75D48DDE,
- 0x6B93DDDB, 0x6F52C06C, 0x6211E6B5, 0x66D0FB02, 0x5E9F46BF, 0x5A5E5B08,
- 0x571D7DD1, 0x53DC6066, 0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA,
- 0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E, 0xBFA1B04B, 0xBB60ADFC,
- 0xB6238B25, 0xB2E29692, 0x8AAD2B2F, 0x8E6C3698, 0x832F1041, 0x87EE0DF6,
- 0x99A95DF3, 0x9D684044, 0x902B669D, 0x94EA7B2A, 0xE0B41DE7, 0xE4750050,
- 0xE9362689, 0xEDF73B3E, 0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2,
- 0xC6BCF05F, 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686, 0xD5B88683, 0xD1799B34,
- 0xDC3ABDED, 0xD8FBA05A, 0x690CE0EE, 0x6DCDFD59, 0x608EDB80, 0x644FC637,
- 0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB, 0x4F040D56, 0x4BC510E1,
- 0x46863638, 0x42472B8F, 0x5C007B8A, 0x58C1663D, 0x558240E4, 0x51435D53,
- 0x251D3B9E, 0x21DC2629, 0x2C9F00F0, 0x285E1D47, 0x36194D42, 0x32D850F5,
- 0x3F9B762C, 0x3B5A6B9B, 0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF,
- 0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623, 0xF12F560E, 0xF5EE4BB9,
- 0xF8AD6D60, 0xFC6C70D7, 0xE22B20D2, 0xE6EA3D65, 0xEBA91BBC, 0xEF68060B,
- 0xD727BBB6, 0xD3E6A601, 0xDEA580D8, 0xDA649D6F, 0xC423CD6A, 0xC0E2D0DD,
- 0xCDA1F604, 0xC960EBB3, 0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7,
- 0xAE3AFBA2, 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B, 0x9B3660C6, 0x9FF77D71,
- 0x92B45BA8, 0x9675461F, 0x8832161A, 0x8CF30BAD, 0x81B02D74, 0x857130C3,
- 0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640, 0x4E8EE645, 0x4A4FFBF2,
- 0x470CDD2B, 0x43CDC09C, 0x7B827D21, 0x7F436096, 0x7200464F, 0x76C15BF8,
- 0x68860BFD, 0x6C47164A, 0x61043093, 0x65C52D24, 0x119B4BE9, 0x155A565E,
- 0x18197087, 0x1CD86D30, 0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC,
- 0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088, 0x2497D08D, 0x2056CD3A,
- 0x2D15EBE3, 0x29D4F654, 0xC5A92679, 0xC1683BCE, 0xCC2B1D17, 0xC8EA00A0,
- 0xD6AD50A5, 0xD26C4D12, 0xDF2F6BCB, 0xDBEE767C, 0xE3A1CBC1, 0xE760D676,
- 0xEA23F0AF, 0xEEE2ED18, 0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4,
- 0x89B8FD09, 0x8D79E0BE, 0x803AC667, 0x84FBDBD0, 0x9ABC8BD5, 0x9E7D9662,
- 0x933EB0BB, 0x97FFAD0C, 0xAFB010B1, 0xAB710D06, 0xA6322BDF, 0xA2F33668,
- 0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4
- };
- UINT32 i;
- UINT32 crc = 0xffffffff;
-
- for (i = 0; i < len; i++)
- crc = (crc << 8) ^ crc_table[((crc >> 24) ^ *buf++) & 0xFF];
-
- return crc;
-}
-
-
-UINT32 PlaceImage(char* filename, UINT32 pos, UINT8* pFirmware, UINT32 limit)
-{
- UINT32 size, read;
- FILE* pFile;
- UINT32 align;
- UINT32 flags;
- UINT32 load_addr = ROCKBOX_DEST, exec_addr = ROCKBOX_EXEC; // defaults
-
- // magic file header for compressed files
- static const UINT8 magic[8] = { 0x00,0xe9,0x55,0x43,0x4c,0xff,0x01,0x1a };
- UINT8 ucl_header[26];
-
- pFile = fopen(filename, "rb"); // open the current image
- if (pFile == NULL)
- {
- printf("Image file %s not found!\n", filename);
- exit(5);
- }
-
- fseek(pFile, 0, SEEK_END);
- size = ftell(pFile);
- fseek(pFile, 0, SEEK_SET);
-
- // determine if compressed
- flags = 0x00000000; // default: flags for uncompressed
- fread(ucl_header, 1, sizeof(ucl_header), pFile);
- if (memcmp(magic, ucl_header, sizeof(magic)) == 0)
- {
- if (ucl_header[12] != 0x2E // check algorithm
- && ucl_header[12] != 0x2B) // or uncompressed
- {
- printf("UCL compressed files must use algorithm 2e, not %d\n", ucl_header[12]);
- printf("Generate with: uclpack --best --2e rockbox.bin %s\n", filename);
- exit(6);
- }
-
- size = Read32(ucl_header + 22); // compressed size
- if (Read32(ucl_header + 18) > size) // compare with uncompressed size
- { // normal case
- flags = 0x00000001; // flags for UCL compressed
- }
-
- if (ucl_header[12] == 0x2B) // uncompressed means "ROMbox", for direct flash execution
- {
- UINT8 start_addr[4];
- UINT8 reset_vec[4];
- fread(start_addr, 1, sizeof(start_addr), pFile); // read the link address from image
- fread(reset_vec, 1, sizeof(reset_vec), pFile); // read the reset vector from image
- fseek(pFile, 0-sizeof(start_addr)-sizeof(reset_vec), SEEK_CUR); // wind back
- load_addr = Read32(start_addr);
- if (load_addr != FLASH_START + pos + 16) // behind 16 byte header
- {
- printf("Error: Rombox .ucl file is linked to 0x%08X instead of 0x%08X\n", load_addr, FLASH_START + pos + 16);
- exit(11);
- }
- exec_addr = Read32(reset_vec);
- }
- }
- else
- {
- fseek(pFile, 0, SEEK_SET); // go back
- }
-
- if (pos + 16 + size > limit) // enough space for all that?
- {
- printf("Exceeding maximum image size %d\n", limit);
- exit(7);
- }
-
- // write header
- align = (pos + 16 + size + SECTORSIZE-1) & ~(SECTORSIZE-1); // round up to next flash sector
- Write32(pFirmware + pos, load_addr); // load address
- Write32(pFirmware + pos + 4, align - (pos + 16)); // image size
- Write32(pFirmware + pos + 8, exec_addr); // execution address
- Write32(pFirmware + pos + 12, flags); // compressed or not
- pos += 16;
-
- // load image
- read = fread(pFirmware + pos, 1, size, pFile);
- if (read != size)
- {
- printf("Read error, expecting %d bytes, got only %d\n", size, read);
- exit(8);
- }
- fclose (pFile);
-
- pos += size;
-
- return pos;
-}
-
-
-int main(int argc, char* argv[])
-{
- static UINT8 aFirmware[512*1024]; // maximum with exchanged chip
- FILE* pFile;
- UINT32 size; // size of loaded item
- UINT32 pos; // current position in firmware
- UINT32 crc32; // checksum of "payload"
- BOOL hasBootRom; // flag if regular boot ROM or directly starts from flash
- UINT32 template_F8, template_FC; // my platform ID, mask and version
-
- int i;
-
- if (argc <= 4)
- {
- printf("Usage:\n");
- printf("make_firmware <output> <template.bin> <bootloader.ajz> <image1.ucl> {image2.ucl}\n");
- printf("<template.bin> is the original firmware from your box\n");
- printf("<bootloader.ajz> is the scrambled bootloader\n");
- printf("<image1.ucl> is the first image, compressed (recommended) or uncompressed\n");
- printf("<image1.ucl> is the second image, compressed (recommended) or uncompressed\n");
- printf("More images may follow, but keep the flash size in mind!\n");
- printf("Compression must be UCL, algorithm 2e.\n");
- printf("Generated with: uclpack --best --2e rockbox.bin imageN.ucl\n");
- exit(0);
- }
-
- memset(aFirmware, 0xFF, sizeof(aFirmware));
-
- /******* process template *******/
-
- pFile = fopen(argv[2], "rb"); // open the template
- if (pFile == NULL)
- {
- printf("Template file %s not found!\n", argv[2]);
- exit(1);
- }
- size = fread(aFirmware, 1, 256, pFile); // need only the header
- fclose(pFile);
- if (size < 256) // need at least the firmware header
- {
- printf("Template file %s too small, need at least the header!\n", argv[2]);
- exit(2);
- }
-
- if (strncmp(aFirmware, "ARCH", 4) == 0)
- {
- hasBootRom = TRUE;
- pos = 256; // place bootloader after this "boot block"
- }
- else if (Read32(aFirmware) == 0x0200)
- {
- hasBootRom = FALSE;
- pos = 0; // directly start with the bootloader
- template_F8 = Read32(aFirmware + 0xF8); // my platform ID and future info
- template_FC = Read32(aFirmware + 0xFC); // use mask+version from template
- }
- else
- {
- printf("Template file %s invalid!\n", argv[2]);
- exit(3);
- }
-
- /******* process bootloader *******/
-
- pFile = fopen(argv[3], "rb"); // open the bootloader
- if (pFile == NULL)
- {
- printf("Bootloader file %s not found!\n", argv[3]);
- exit(4);
- }
- if (hasBootRom && fseek(pFile, 6, SEEK_SET)) // skip the ajz header
- {
- printf("Bootloader file %s too short!\n", argv[3]);
- exit(5);
- }
-
- // place bootloader after header
- size = fread(aFirmware + pos, 1, sizeof(aFirmware) - pos, pFile);
- fclose(pFile);
-
- if (hasBootRom)
- {
- Write32(aFirmware + 4, BOOTLOAD_DEST); // boot code destination address
-
- for (i=0x08; i<=0x28; i+=8)
- {
- Write32(aFirmware + i, BOOTLOAD_SCR); // boot code source address
- Write32(aFirmware + i + 4, size); // boot code size
- }
- }
- else
- {
- Write32(aFirmware + 0xF8, template_F8); // values from template
- Write32(aFirmware + 0xFC, template_FC); // mask and version
- }
-
- size = (size + 3) & ~3; // make shure it's 32 bit aligned
- pos += size; // prepare position for first image
-
- /******* process images *******/
- for (i = 4; i < argc; i++)
- {
- pos = PlaceImage(argv[i], pos, aFirmware, sizeof(aFirmware));
-
- if (i < argc-1)
- { // not the last: round up to next flash sector
- pos = (pos + SECTORSIZE-1) & ~(SECTORSIZE-1);
- }
- }
-
-
- /******* append CRC32 checksum *******/
- crc32 = CalcCRC32(aFirmware, pos);
- Write32(aFirmware + pos, crc32);
- pos += sizeof(crc32); // 4 bytes
-
-
- /******* save result to output file *******/
-
- pFile = fopen(argv[1], "wb"); // open the output file
- if (pFile == NULL)
- {
- printf("Output file %s cannot be created!\n", argv[1]);
- exit(9);
- }
- size = fwrite(aFirmware, 1, pos, pFile);
- fclose(pFile);
-
- if (size != pos)
- {
- printf("Error writing %d bytes to output file %s!\n", pos, argv[1]);
- exit(10);
- }
-
- printf("Firmware file generated with %d bytes.\n", pos);
-
- return 0;
-}
diff --git a/flash/make_firmware/make_firmware.dsp b/flash/make_firmware/make_firmware.dsp
deleted file mode 100644
index 54a6f53671..0000000000
--- a/flash/make_firmware/make_firmware.dsp
+++ /dev/null
@@ -1,96 +0,0 @@
-# Microsoft Developer Studio Project File - Name="make_firmware" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=make_firmware - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "make_firmware.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "make_firmware.mak" CFG="make_firmware - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "make_firmware - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "make_firmware - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "make_firmware - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX"stdafx.h" /FD /c
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "make_firmware - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX"stdafx.h" /FD /GZ /c
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "make_firmware - Win32 Release"
-# Name "make_firmware - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\make_firmware.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# End Target
-# End Project
diff --git a/flash/minimon/Makefile b/flash/minimon/Makefile
deleted file mode 100644
index 57ae13e940..0000000000
--- a/flash/minimon/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-CC = sh-elf-gcc
-LD = sh-elf-ld
-AR = sh-elf-ar
-AS = sh-elf-as
-OC = sh-elf-objcopy
-
-FIRMWARE := ../../firmware
-TOOLSDIR=../../tools
-
-TARGET = minimon
-LDS := $(TARGET).lds
-
-INCLUDES= -I$(FIRMWARE)/export -I. -I$(OBJDIR)
-OBJDIR := .
-
-CFLAGS = -fpic -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(DEFINES)
-AFLAGS += -small -relax
-
-
-ifdef DEBUG
- DEFINES := -DDEBUG
- CFLAGS += -g
-endif
-
-SRC := $(wildcard *.c)
-
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-
-LINKFILE = $(OBJDIR)/$(TARGET).lds
-
-
-$(OBJDIR)/$(TARGET).bin : $(OBJDIR)/$(TARGET).elf
- $(OC) -O binary $(OBJDIR)/$(TARGET).elf $(OBJDIR)/$(TARGET).bin
- $(TOOLSDIR)/sh2d $(OBJDIR)/$(TARGET).bin -o 0900000 > $(OBJDIR)/$(TARGET).asm
-
-$(OBJDIR)/$(TARGET).elf : $(OBJS)
- $(CC) -Os -nostdlib -o $(OBJDIR)/$(TARGET).elf -L$(OBJDIR) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$(TARGET).map
-
-
-clean:
- -rm -f $(OBJS) $(OBJDIR)/$(TARGET).asm \
- $(OBJDIR)/$(TARGET).bin \
- $(OBJDIR)/$(TARGET).elf \
- $(OBJDIR)/$(TARGET).map
diff --git a/flash/minimon/README b/flash/minimon/README
deleted file mode 100644
index b80edd9689..0000000000
--- a/flash/minimon/README
+++ /dev/null
@@ -1,6 +0,0 @@
-(c) 2003 by Jörg Hohensohn
-
-MiniMon is the tiny but powerful-enough piece of code that can be loaded
-with the UART boot mod.
-It allows to read and write memory, flash program, execute code.
-This is suitable to reflash the box, load Rockbox or the gdb stub, etc.
diff --git a/flash/minimon/minimon.c b/flash/minimon/minimon.c
deleted file mode 100644
index e7981f2d09..0000000000
--- a/flash/minimon/minimon.c
+++ /dev/null
@@ -1,156 +0,0 @@
-// minimalistic monitor
-// to be loaded with the UART boot feature
-// capable of reading and writing bytes, commanded by UART
-
-#include "sh7034.h"
-#include "minimon.h"
-
-// scalar types
-typedef unsigned char UINT8;
-typedef unsigned short UINT16;
-typedef unsigned long UINT32;
-
-typedef void(*tpFunc)(void); // type for exec
-typedef int(*tpMain)(void); // type for start vector to main()
-
-
-// prototypes
-int main(void);
-
-// our binary has to start with a vector to the entry point
-tpMain start_vector[] __attribute__ ((section (".startvector"))) = {main};
-
-
-UINT8 uart_read(void)
-{
- UINT8 byte;
- while (!(SSR1 & SCI_RDRF)); // wait for char to be available
- byte = RDR1;
- SSR1 &= ~SCI_RDRF;
- return byte;
-}
-
-
-void uart_write(UINT8 byte)
-{
- while (!(SSR1 & SCI_TDRE)); // wait for transmit buffer empty
- TDR1 = byte;
- SSR1 &= ~SCI_TDRE;
-}
-
-
-int main(void)
-{
- UINT8 cmd;
- UINT32 addr;
- UINT32 size;
- UINT32 content;
- volatile UINT8* paddr = 0;
- volatile UINT8* pflash; // flash base address
-
- while (1)
- {
- cmd = uart_read();
- switch (cmd)
- {
- case BAUDRATE:
- content = uart_read();
- uart_write(cmd); // acknowledge by returning the command value
- while (!(SSR1 & SCI_TEND)); // wait for empty shift register, before changing baudrate
- BRR1 = content;
- break;
-
- case ADDRESS:
- addr = (uart_read() << 24) | (uart_read() << 16) | (uart_read() << 8) | uart_read();
- paddr = (UINT8*)addr;
- pflash = (UINT8*)(addr & 0xFFF80000); // round down to 512k align
- uart_write(cmd); // acknowledge by returning the command value
- break;
-
- case BYTE_READ:
- content = *paddr++;
- uart_write(content); // the content is the ack
- break;
-
- case BYTE_WRITE:
- content = uart_read();
- *paddr++ = content;
- uart_write(cmd); // acknowledge by returning the command value
- break;
-
- case BYTE_READ16:
- size = 16;
- while (size--)
- {
- content = *paddr++;
- uart_write(content); // the content is the ack
- }
- break;
-
- case BYTE_WRITE16:
- size = 16;
- while (size--)
- {
- content = uart_read();
- *paddr++ = content;
- }
- uart_write(cmd); // acknowledge by returning the command value
- break;
-
- case BYTE_FLASH:
- content = uart_read();
- pflash[0x5555] = 0xAA; // set flash to command mode
- pflash[0x2AAA] = 0x55;
- pflash[0x5555] = 0xA0; // byte program command
- *paddr++ = content;
- uart_write(cmd); // acknowledge by returning the command value
- break;
-
- case BYTE_FLASH16:
- size = 16;
- while (size--)
- {
- content = uart_read();
- pflash[0x5555] = 0xAA; // set flash to command mode
- pflash[0x2AAA] = 0x55;
- pflash[0x5555] = 0xA0; // byte program command
- *paddr++ = content;
- }
- uart_write(cmd); // acknowledge by returning the command value
- break;
-
- case HALFWORD_READ:
- content = *(UINT16*)paddr;
- paddr += 2;
- uart_write(content >> 8); // highbyte
- uart_write(content & 0xFF); // lowbyte
- break;
-
- case HALFWORD_WRITE:
- content = uart_read() << 8 | uart_read();
- *(UINT16*)paddr = content;
- paddr += 2;
- uart_write(cmd); // acknowledge by returning the command value
- break;
-
- case EXECUTE:
- {
- tpFunc pFunc = (tpFunc)paddr;
- pFunc();
- uart_write(cmd); // acknowledge by returning the command value
- }
- break;
-
-
- default:
- {
- volatile UINT16* pPortB = (UINT16*)0x05FFFFC2;
- *pPortB |= 1 << 6; // bit 6 is red LED on
- uart_write(~cmd); // error acknowledge
- }
-
- } // case
- }
-
- return 0;
-}
diff --git a/flash/minimon/minimon.h b/flash/minimon/minimon.h
deleted file mode 100644
index b6e9805ecf..0000000000
--- a/flash/minimon/minimon.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _MINIMON_H
-#define _MINIMON_H
-
-
-// Commands
-// all multibyte values (address, halfwords) are passed as big endian
-// (most significant of the bytes first)
-
-// set the address (all read/write commands will auto-increment it)
-#define BAUDRATE 0x00 // followed by BRR value; response: command byte
-#define ADDRESS 0x01 // followed by 4 bytes address; response: command byte
-#define BYTE_READ 0x02 // response: 1 byte content
-#define BYTE_WRITE 0x03 // followed by 1 byte content; response: command byte
-#define BYTE_READ16 0x04 // response: 16 bytes content
-#define BYTE_WRITE16 0x05 // followed by 16 bytes; response: command byte
-#define BYTE_FLASH 0x06 // followed by 1 byte content; response: command byte
-#define BYTE_FLASH16 0x07 // followed by 16 bytes; response: command byte
-#define HALFWORD_READ 0x08 // response: 2 byte content
-#define HALFWORD_WRITE 0x09 // followed by 2 byte content; response: command byte
-#define EXECUTE 0x0A // response: command byte if call returns
-#define VERSION 0x0B // response: version
-
-
-#endif // _MINIMON_H
diff --git a/flash/minimon/minimon.lds b/flash/minimon/minimon.lds
deleted file mode 100644
index dbdbdc3faa..0000000000
--- a/flash/minimon/minimon.lds
+++ /dev/null
@@ -1,60 +0,0 @@
-OUTPUT_FORMAT(elf32-sh)
-INPUT(minimon.o)
-
-MEMORY
-{
- DRAM : ORIGIN = 0x09000000, LENGTH = 0x200000
-}
-
-SECTIONS
-{
- .startvector :
- {
- *(.startvector)
- . = ALIGN(0x4);
- } > DRAM
-
- .got :
- {
- *(.got)
- } > DRAM
-
- .got.plt :
- {
- *(.got.plt)
- } > DRAM
-
- .rela.got :
- {
- *(.rela.got)
- } > DRAM
-
- .text :
- {
- . = ALIGN(0x200);
- *(.entry)
- *(.text)
- . = ALIGN(0x4);
- } > DRAM
-
- .data :
- {
- *(.data)
- } > DRAM
-
- .rodata :
- {
- *(.rodata)
- . = ALIGN(0x4);
- } > DRAM
-
- .bss :
- {
- *(.bss)
- } > DRAM
-
- .stack :
- {
- *(.stack)
- } > DRAM
-}
diff --git a/flash/uart_boot/README b/flash/uart_boot/README
deleted file mode 100644
index edfa20c121..0000000000
--- a/flash/uart_boot/README
+++ /dev/null
@@ -1,8 +0,0 @@
-(c) 2003 by Jörg Hohensohn
-
-This is the client side for MiniMon, a command line program that communicates with it.
-It can be used to reflash a box from ground up, load a program like gdb stub or Rockbox,
-and other diagnostics.
-
-Current implementation is for Windows, but with a different UART implementation
-it should work for other platforms (Linux) as well.
diff --git a/flash/uart_boot/client.c b/flash/uart_boot/client.c
deleted file mode 100644
index 71749a2c55..0000000000
--- a/flash/uart_boot/client.c
+++ /dev/null
@@ -1,737 +0,0 @@
-// client.cpp : functions for monitor download and communication.
-//
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "scalar_types.h" // (U)INT8/16/32
-#include "Uart.h" // platform abstraction for UART
-#include "minimon.h" // protocol of my little monitor
-
-// do the baudrate configuration for the Player
-int ConfigFirstlevelPlayer (tUartHandle serial_handle)
-{
- UINT32 result_nbr;
-
- if(!UartConfig(serial_handle, 4800, eMARKPARITY, eTWOSTOPBITS, 8))
- {
- UINT32 dwErr = GET_LAST_ERR();
- printf("Error %lu setting up COM params for baudrate byte\n", dwErr);
- exit(1);
- }
-
- // this will read as 0x19 when viewed with 2300 baud like the player does
- result_nbr = UartWrite(serial_handle, (UINT8*)"\x86\xC0", 2);
- if (result_nbr != 2)
- {
- UINT32 dwErr = GET_LAST_ERR();
- printf("Error %lu setting up COM params for baudrate byte\n", dwErr);
- }
-
- SLEEP(100); // wait for the chars to be sent, is there a better way?
-
- // the read 0x19 means 14423 baud with 12 MHz
- if(!UartConfig(serial_handle, 14400, eNOPARITY, eONESTOPBIT, 8))
- {
- printf("Error setting up COM params for 1st level loader\n");
- exit(1);
- }
-
- return 0;
-}
-
-
-// do the baudrate configuration for the Recoder/FM
-int ConfigFirstlevelRecorder (tUartHandle serial_handle)
-{
- UINT32 result_nbr;
-
- if(!UartConfig(serial_handle, 4800, eNOPARITY, eTWOSTOPBITS, 8))
- {
- UINT32 dwErr = GET_LAST_ERR();
- printf("Error %lu setting up COM params for baudrate byte\n", dwErr);
- exit(1);
- }
-
- // this will read as 0x08 when viewed with 2120 baud like the recorder does
- result_nbr = UartWrite(serial_handle, (UINT8*)"\x00\x00", 2);
- if(result_nbr != 2)
- {
- printf("Error transmitting baudrate byte\n");
- exit(1);
- }
-
- SLEEP(100); // wait for the chars to be sent, is there a better way?
-
- // the read 0x08 means 38400 baud with 11.0592 MHz
- if(!UartConfig(serial_handle, 38400, eNOPARITY, eONESTOPBIT, 8))
- {
- UINT32 dwErr = GET_LAST_ERR();
- printf("Error %lu setting up COM params for 1st level loader\n", dwErr);
- exit(1);
- }
-
- return 0;
-}
-
-
-// transfer a byte for the monitor download, with or without acknowledge
-int DownloadByte(tUartHandle serial_handle, unsigned char byte, bool bAck)
-{
- unsigned char received;
-
- while (1)
- {
- UartWrite(serial_handle, &byte, 1);
- if (bAck)
- {
- UartRead(serial_handle, &received, 1);
- if (received == byte)
- {
- UartWrite(serial_handle, (UINT8*)"\x01", 1); // ack success
- break; // exit the loop
- }
- else
- {
- printf("Error transmitting monitor byte 0x%02X, got 0x%0X\n", byte, received);
- UartWrite(serial_handle, (UINT8*)"\x00", 1); // ack fail, try again
- }
- }
- else
- break; // no loop
- }
- return 1;
-}
-
-
-// download our little monitor, the box must have been just freshly switched on for this to work
-int DownloadMonitor(tUartHandle serial_handle, bool bRecorder, char* szFilename)
-{
- FILE* pFile;
- size_t filesize;
- UINT8 byte;
- unsigned i;
-
- // hard-coded parameters
- bool bAck = true; // configure if acknowledged download (without useful for remote pin boot)
- UINT32 TargetLoad = 0x0FFFF000; // target load address
-
- pFile = fopen(szFilename, "rb");
- if (pFile == NULL)
- {
- printf("\nMonitor file %s not found, exiting\n", szFilename);
- exit(1);
- }
-
- // determine file size
- fseek(pFile, 0, SEEK_END);
- filesize = ftell(pFile);
- fseek(pFile, 0, SEEK_SET);
-
- // This is _really_ tricky! The box expects a BRR value in a nonstandard baudrate,
- // which a PC can't generate. I'm using a higher one with some wild settings
- // to generate a pulse series that:
- // 1) looks like a stable byte when sampled with the nonstandard baudrate
- // 2) gives a BRR value to the box which results in a baudrate the PC can also use
- if (bRecorder)
- {
- ConfigFirstlevelRecorder(serial_handle);
- }
- else
- {
- ConfigFirstlevelPlayer(serial_handle);
- }
-
- UartWrite(serial_handle, bAck ? (UINT8*)"\x01" : (UINT8*)"\x00", 1); // ACK mode
-
- // transmit the size, little endian
- DownloadByte(serial_handle, (UINT8)( filesize & 0xFF), bAck);
- DownloadByte(serial_handle, (UINT8)((filesize>>8) & 0xFF), bAck);
- DownloadByte(serial_handle, (UINT8)((filesize>>16) & 0xFF), bAck);
- DownloadByte(serial_handle, (UINT8)((filesize>>24) & 0xFF), bAck);
-
- // transmit the load address, little endian
- DownloadByte(serial_handle, (UINT8)( TargetLoad & 0xFF), bAck);
- DownloadByte(serial_handle, (UINT8)((TargetLoad>>8) & 0xFF), bAck);
- DownloadByte(serial_handle, (UINT8)((TargetLoad>>16) & 0xFF), bAck);
- DownloadByte(serial_handle, (UINT8)((TargetLoad>>24) & 0xFF), bAck);
-
- // transmit the command byte
- DownloadByte(serial_handle, 0xFF, bAck); // 0xFF means execute the transferred image
-
- // transmit the image
- for (i=0; i<filesize; i++)
- {
- fread(&byte, 1, 1, pFile);
- DownloadByte(serial_handle, byte, bAck);
- }
-
- fclose (pFile);
-
- // now the image should have been started, red LED off
-
- return 0;
-}
-
-
-// wait for a fixed string to be received (no foolproof algorithm,
-// may overlook if the searched string contains repeatitions)
-int WaitForString(tUartHandle serial_handle, char* pszWait)
-{
- int i = 0;
- unsigned char received;
-
- while(pszWait[i] != '\0')
- {
- UartRead(serial_handle, &received, 1);
-
- printf("%c", received); // debug
-
- if (received == pszWait[i])
- i++; // continue
- else
- i=0; // mismatch, start over
- }
- return 0;
-}
-
-
-// send a sting and check the echo
-int SendWithEcho(tUartHandle serial_handle, char* pszSend)
-{
- int i = 0;
- unsigned char received;
-
- while(pszSend[i] != '\0')
- {
- UartWrite(serial_handle, (unsigned char*)(pszSend + i), 1); // send char
- do
- {
- UartRead(serial_handle, &received, 1); // receive echo
- printf("%c", received); // debug
- }
- while (received != pszSend[i]); // should normally be equal
- i++; // next char
- }
- return 0;
-}
-
-
-// rarely used variant: download our monitor using the built-in Archos monitor
-int DownloadArchosMonitor(tUartHandle serial_handle, char* szFilename)
-{
- FILE* pFile;
- size_t filesize;
- UINT8 byte;
- UINT16 checksum = 0;
- unsigned i;
-
- // the onboard monitor uses 115200 baud
- if(!UartConfig(serial_handle, 115200, eNOPARITY, eONESTOPBIT, 8))
- {
- UINT32 dwErr = GET_LAST_ERR();
- printf("Error %lu setting up COM params for baudrate %d\n", dwErr, 115200);
- exit(1);
- }
-
- // wait for receiving "#SERIAL#"
- WaitForString(serial_handle, "#SERIAL#");
-
- // send magic "SRL" command to get interactive mode
- SendWithEcho(serial_handle, "SRL\r");
-
- // wait for menu completion: "ROOT>" at the end
- WaitForString(serial_handle, "ROOT>");
-
- // send upload command "UP"
- SendWithEcho(serial_handle, "UP\r");
-
- pFile = fopen(szFilename, "rb");
- if (pFile == NULL)
- {
- printf("\nMonitor file %s not found, exiting\n", szFilename);
- exit(1);
- }
-
- // determine file size
- fseek(pFile, 0, SEEK_END);
- filesize = ftell(pFile);
- fseek(pFile, 0, SEEK_SET);
-
- // calculate checksum
- for (i=0; i<filesize; i++)
- {
- fread(&byte, 1, 1, pFile);
- checksum += byte;
- }
- fseek(pFile, 0, SEEK_SET);
-
- // send header
-
- // size as 32 bit little endian
- byte = (UINT8)( filesize & 0xFF);
- UartWrite(serial_handle, &byte, 1);
- byte = (UINT8)((filesize>>8) & 0xFF);
- UartWrite(serial_handle, &byte, 1);
- byte = (UINT8)((filesize>>16) & 0xFF);
- UartWrite(serial_handle, &byte, 1);
- byte = (UINT8)((filesize>>24) & 0xFF);
- UartWrite(serial_handle, &byte, 1);
-
- // checksum as 16 bit little endian
- byte = (UINT8)( checksum & 0xFF);
- UartWrite(serial_handle, &byte, 1);
- byte = (UINT8)((checksum>>8) & 0xFF);
- UartWrite(serial_handle, &byte, 1);
-
- UartWrite(serial_handle, (unsigned char*)"\x00", 1); // kind (3 means flash)
- UartWrite(serial_handle, (unsigned char*)"\x00", 1); // ignored byte
-
- // wait for monitor to accept data
- WaitForString(serial_handle, "#OKCTRL#");
-
- // transmit the image
- for (i=0; i<filesize; i++)
- {
- fread(&byte, 1, 1, pFile);
- UartWrite(serial_handle, &byte, 1); // payload
- }
- fclose (pFile);
-
- UartWrite(serial_handle, (unsigned char*)"\x00", 1); // ignored byte
-
- // wait for menu completion: "ROOT>" at the end
- WaitForString(serial_handle, "ROOT>");
-
- // send start program command "SPRO"
- SendWithEcho(serial_handle, "SPRO\r");
-
- SLEEP(100); // wait a little while for startup
-
- return 0;
-}
-
-
-/********** Target functions using the Monitor Protocol **********/
-
-// read a byte using the target monitor
-UINT8 ReadByte(tUartHandle serial_handle, UINT32 addr)
-{
- UINT8 send;
- UINT8 received;
-
- // send the address command
- send = ADDRESS;
- UartWrite(serial_handle, &send, 1);
-
- // transmit the address, big endian
- send = (UINT8)((addr>>24) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>16) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>8) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)(addr & 0xFF);
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
- if (received != ADDRESS)
- {
- printf("Protocol error!\n");
- return 1;
- }
-
- // send the read command
- send = BYTE_READ;
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
-
- return received;
-}
-
-
-// write a byte using the target monitor
-int WriteByte(tUartHandle serial_handle, UINT32 addr, UINT8 byte)
-{
- UINT8 send;
- UINT8 received;
-
- // send the address command
- send = ADDRESS;
- UartWrite(serial_handle, &send, 1);
-
- // transmit the address, big endian
- send = (UINT8)((addr>>24) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>16) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>8) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)(addr & 0xFF);
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
- if (received != ADDRESS)
- {
- printf("Protocol error, receiced 0x%02X!\n", received);
- return 1;
- }
-
- // send the write command
- send = BYTE_WRITE;
- UartWrite(serial_handle, &send, 1);
-
- // transmit the data
- UartWrite(serial_handle, &byte, 1);
-
- UartRead(serial_handle, &received, 1); // response
-
- if (received != BYTE_WRITE)
- {
- printf("Protocol error!\n");
- return 1;
- }
-
- return 0;
-}
-
-
-// read many bytes using the target monitor
-int ReadByteMultiple(tUartHandle serial_handle, UINT32 addr, UINT32 size, UINT8* pBuffer)
-{
- UINT8 send, received;
-
- // send the address command
- send = ADDRESS;
- UartWrite(serial_handle, &send, 1);
-
- // transmit the address, big endian
- send = (UINT8)((addr>>24) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>16) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>8) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)(addr & 0xFF);
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
- if (received != ADDRESS)
- {
- printf("Protocol error!\n");
- return 1;
- }
-
- while (size)
- {
- if (size >= 16)
- { // we can use a "burst" command
- send = BYTE_READ16;
- UartWrite(serial_handle, &send, 1); // send the read command
- UartRead(serial_handle, pBuffer, 16); // data response
- pBuffer += 16;
- size -= 16;
- }
- else
- { // use single byte command
- send = BYTE_READ;
- UartWrite(serial_handle, &send, 1); // send the read command
- UartRead(serial_handle, pBuffer++, 1); // data response
- size--;
- }
- }
-
- return 0;
-}
-
-
-// write many bytes using the target monitor
-int WriteByteMultiple(tUartHandle serial_handle, UINT32 addr, UINT32 size, UINT8* pBuffer)
-{
- UINT8 send, received;
-
- // send the address command
- send = ADDRESS;
- UartWrite(serial_handle, &send, 1);
-
- // transmit the address, big endian
- send = (UINT8)((addr>>24) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>16) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>8) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)(addr & 0xFF);
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
- if (received != ADDRESS)
- {
- printf("Protocol error!\n");
- return 1;
- }
-
- while (size)
- {
- if (size >= 16)
- { // we can use a "burst" command
- send = BYTE_WRITE16;
- UartWrite(serial_handle, &send, 1); // send the write command
- UartWrite(serial_handle, pBuffer, 16); // transmit the data
- UartRead(serial_handle, &received, 1); // response
- if (received != BYTE_WRITE16)
- {
- printf("Protocol error!\n");
- return 1;
- }
- pBuffer += 16;
- size -= 16;
- }
- else
- { // use single byte command
- send = BYTE_WRITE;
- UartWrite(serial_handle, &send, 1); // send the write command
- UartWrite(serial_handle, pBuffer++, 1); // transmit the data
- UartRead(serial_handle, &received, 1); // response
- if (received != BYTE_WRITE)
- {
- printf("Protocol error!\n");
- return 1;
- }
- size--;
- }
- }
-
- return 0;
-}
-
-
-// write many bytes using the target monitor
-int FlashByteMultiple(tUartHandle serial_handle, UINT32 addr, UINT32 size, UINT8* pBuffer)
-{
- UINT8 send, received;
-
- // send the address command
- send = ADDRESS;
- UartWrite(serial_handle, &send, 1);
-
- // transmit the address, big endian
- send = (UINT8)((addr>>24) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>16) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>8) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)(addr & 0xFF);
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
- if (received != ADDRESS)
- {
- printf("Protocol error!\n");
- return 1;
- }
-
- while (size)
- {
- if (size >= 16)
- { // we can use a "burst" command
- send = BYTE_FLASH16;
- UartWrite(serial_handle, &send, 1); // send the write command
- UartWrite(serial_handle, pBuffer, 16); // transmit the data
- UartRead(serial_handle, &received, 1); // response
- if (received != BYTE_FLASH16)
- {
- printf("Protocol error!\n");
- return 1;
- }
- pBuffer += 16;
- size -= 16;
- }
- else
- { // use single byte command
- send = BYTE_FLASH;
- UartWrite(serial_handle, &send, 1); // send the write command
- UartWrite(serial_handle, pBuffer++, 1); // transmit the data
- UartRead(serial_handle, &received, 1); // response
- if (received != BYTE_FLASH)
- {
- printf("Protocol error!\n");
- return 1;
- }
- size--;
- }
- }
-
- return 0;
-}
-
-
-// read a 16bit halfword using the target monitor
-UINT16 ReadHalfword(tUartHandle serial_handle, UINT32 addr)
-{
- UINT8 send;
- UINT8 received;
- UINT16 halfword;
-
- // send the address command
- send = ADDRESS;
- UartWrite(serial_handle, &send, 1);
-
- // transmit the address, big endian
- send = (UINT8)((addr>>24) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>16) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>8) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)(addr & 0xFF);
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
- if (received != ADDRESS)
- {
- printf("Protocol error!\n");
- return 1;
- }
-
- // send the read command
- send = HALFWORD_READ;
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
- halfword = received << 8; // highbyte
- UartRead(serial_handle, &received, 1);
- halfword |= received; // lowbyte
-
- return halfword;
-}
-
-
-// write a 16bit halfword using the target monitor
-int WriteHalfword(tUartHandle serial_handle, UINT32 addr, UINT16 halfword)
-{
- UINT8 send;
- UINT8 received;
-
- // send the address command
- send = ADDRESS;
- UartWrite(serial_handle, &send, 1);
-
- // transmit the address, big endian
- send = (UINT8)((addr>>24) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>16) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>8) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)(addr & 0xFF);
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
- if (received != ADDRESS)
- {
- printf("Protocol error!\n");
- return 1;
- }
-
- // send the write command
- send = HALFWORD_WRITE;
- UartWrite(serial_handle, &send, 1);
-
- // transmit the data
- send = halfword >> 8; // highbyte
- UartWrite(serial_handle, &send, 1);
- send = halfword & 0xFF; // lowbyte
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
-
- if (received != HALFWORD_WRITE)
- {
- printf("Protocol error!\n");
- return 1;
- }
-
- return 0;
-}
-
-
-// change baudrate using target monitor
-int SetTargetBaudrate(tUartHandle serial_handle, long lClock, long lBaudrate)
-{
- UINT8 send;
- UINT8 received;
- UINT8 brr;
- long lBRR;
-
- lBRR = lClock / lBaudrate;
- lBRR = ((lBRR + 16) / 32) - 1; // with rounding
- brr = (UINT8)lBRR;
-
- // send the command
- send = BAUDRATE;
- UartWrite(serial_handle, &send, 1);
- UartWrite(serial_handle, &brr, 1); // send the BRR value
- UartRead(serial_handle, &received, 1); // response ack
-
- if (received != BAUDRATE)
- { // bad situation, now we're unclear about the baudrate of the target
- printf("Protocol error!\n");
- return 1;
- }
-
- SLEEP(100); // give it some time to settle
-
- // change our baudrate, too
- UartConfig(serial_handle, lBaudrate, eNOPARITY, eONESTOPBIT, 8);
-
- return 0;
-}
-
-
-// call a subroutine using the target monitor
-int Execute(tUartHandle serial_handle, UINT32 addr, bool bReturns)
-{
- UINT8 send;
- UINT8 received;
-
- // send the address command
- send = ADDRESS;
- UartWrite(serial_handle, &send, 1);
-
- // transmit the address, big endian
- send = (UINT8)((addr>>24) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>16) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)((addr>>8) & 0xFF);
- UartWrite(serial_handle, &send, 1);
- send = (UINT8)(addr & 0xFF);
- UartWrite(serial_handle, &send, 1);
-
- UartRead(serial_handle, &received, 1); // response
- if (received != ADDRESS)
- {
- printf("Protocol error!\n");
- return 1;
- }
-
- // send the execute command
- send = EXECUTE;
- UartWrite(serial_handle, &send, 1);
- if (bReturns)
- { // we expect the call to return control to minimon
- UartRead(serial_handle, &received, 1); // response
-
- if (received != EXECUTE)
- {
- printf("Protocol error!\n");
- return 1;
- }
- }
-
- return 0;
-}
-
-
diff --git a/flash/uart_boot/client.h b/flash/uart_boot/client.h
deleted file mode 100644
index a5df8c35d6..0000000000
--- a/flash/uart_boot/client.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _CLIENT_H
-#define _CLIENT_H
-
-
-// setup function for monitor download
-int DownloadMonitor(tUartHandle serial_handle, bool bRecorder, char* szFilename);
-int DownloadArchosMonitor(tUartHandle serial_handle, char* szFilename);
-
-// target functions using the Monitor Protocol
-UINT8 ReadByte(tUartHandle serial_handle, UINT32 addr);
-int WriteByte(tUartHandle serial_handle, UINT32 addr, UINT8 byte);
-int ReadByteMultiple(tUartHandle serial_handle, UINT32 addr, UINT32 size, UINT8* pBuffer);
-int WriteByteMultiple(tUartHandle serial_handle, UINT32 addr, UINT32 size, UINT8* pBuffer);
-int FlashByteMultiple(tUartHandle serial_handle, UINT32 addr, UINT32 size, UINT8* pBuffer);
-UINT16 ReadHalfword(tUartHandle serial_handle, UINT32 addr);
-int WriteHalfword(tUartHandle serial_handle, UINT32 addr, UINT16 halfword);
-int SetTargetBaudrate(tUartHandle serial_handle, long lClock, long lBaudrate);
-int Execute(tUartHandle serial_handle, UINT32 addr, bool bReturns);
-
-
-#endif
-
diff --git a/flash/uart_boot/flash.c b/flash/uart_boot/flash.c
deleted file mode 100644
index 854de20454..0000000000
--- a/flash/uart_boot/flash.c
+++ /dev/null
@@ -1,78 +0,0 @@
-// flash.cpp : higher-level functions for flashing the chip
-//
-
-#include "scalar_types.h" // (U)INT8/16/32
-#include "Uart.h" // platform abstraction for UART
-#include "client.h" // client functions
-
-
-// read the manufacturer and device ID
-int ReadID(tUartHandle serial_handle, UINT32 base, UINT8* pManufacturerID, UINT8* pDeviceID)
-{
- base &= 0xFFF80000; // round down to 512k align, to make shure
-
- WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode
- WriteByte(serial_handle, base + 0x2AAA, 0x55);
- WriteByte(serial_handle, base + 0x5555, 0x90); // ID command
- SLEEP(20); // Atmel wants 20ms pause here
-
- *pManufacturerID = ReadByte(serial_handle, base + 0);
- *pDeviceID = ReadByte(serial_handle, base + 1);
-
- WriteByte(serial_handle, base + 0, 0xF0); // reset flash (back to normal read mode)
- SLEEP(20); // Atmel wants 20ms pause here
-
- return 0;
-}
-
-
-// erase the sector which contains the given address
-int EraseSector(tUartHandle serial_handle, UINT32 address)
-{
- UINT32 base = address & 0xFFF80000; // round down to 512k align
-
- WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode
- WriteByte(serial_handle, base + 0x2AAA, 0x55);
- WriteByte(serial_handle, base + 0x5555, 0x80); // eraze command
- WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode
- WriteByte(serial_handle, base + 0x2AAA, 0x55);
- WriteByte(serial_handle, address, 0x30); // eraze the sector
- SLEEP(25); // sector eraze time: 25ms
-
- return 0;
-}
-
-
-// erase the whole flash
-int EraseChip(tUartHandle serial_handle, UINT32 base)
-{
- base &= 0xFFF80000; // round down to 512k align, to make shure
-
- WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode
- WriteByte(serial_handle, base + 0x2AAA, 0x55);
- WriteByte(serial_handle, base + 0x5555, 0x80); // eraze command
- WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode
- WriteByte(serial_handle, base + 0x2AAA, 0x55);
- WriteByte(serial_handle, base + 0x5555, 0x10); // chip eraze command
- SLEEP(100); // chip eraze time: 100ms
-
- return 0;
-}
-
-
-// program a bunch of bytes "by hand"
-int ProgramBytes(tUartHandle serial_handle, UINT32 address, UINT8* pData, UINT32 size)
-{
- UINT32 base = address & 0xFFF80000; // round down to 512k align
-
- while (size--)
- {
- WriteByte(serial_handle, base + 0x5555, 0xAA); // enter command mode
- WriteByte(serial_handle, base + 0x2AAA, 0x55);
- WriteByte(serial_handle, base + 0x5555, 0xA0); // byte program command
- WriteByte(serial_handle, address++, *pData++);
- // UART protocol is slow enough such that I don't have to wait 20us here
- }
- return 0;
-}
-
diff --git a/flash/uart_boot/flash.h b/flash/uart_boot/flash.h
deleted file mode 100644
index 9c69ad46a5..0000000000
--- a/flash/uart_boot/flash.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _FLASH_H
-#define _FLASH_H
-
-int ReadID(tUartHandle serial_handle, UINT32 base, UINT8* pManufacturerID, UINT8* pDeviceID);
-int EraseSector(tUartHandle serial_handle, UINT32 address);
-int EraseChip(tUartHandle serial_handle, UINT32 base);
-int ProgramBytes(tUartHandle serial_handle, UINT32 address, UINT8* pData, UINT32 size);
-
-#endif
-
diff --git a/flash/uart_boot/minimon.h b/flash/uart_boot/minimon.h
deleted file mode 100644
index 69a03b1f4d..0000000000
--- a/flash/uart_boot/minimon.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _MINIMON_H
-#define _MINIMON_H
-
-
-// Commands
-// all multibyte values (address, halfwords) are passed as big endian
-// (most significant of the bytes first)
-
-// set the address (all read/write commands will auto-increment it)
-#define BAUDRATE 0x00 // followed by BRR value; response: command byte
-#define ADDRESS 0x01 // followed by 4 bytes address; response: command byte
-#define BYTE_READ 0x02 // response: 1 byte content
-#define BYTE_WRITE 0x03 // followed by 1 byte content; response: command byte
-#define BYTE_READ16 0x04 // response: 16 bytes content
-#define BYTE_WRITE16 0x05 // followed by 16 bytes; response: command byte
-#define BYTE_FLASH 0x06 // followed by 1 byte content; response: command byte
-#define BYTE_FLASH16 0x07 // followed by 16 bytes; response: command byte
-#define HALFWORD_READ 0x08 // response: 2 byte content
-#define HALFWORD_WRITE 0x09 // followed by 2 byte content; response: command byte
-#define EXECUTE 0x0A // response: command byte if call returns
-
-
-#endif // _MINIMON_H
-
diff --git a/flash/uart_boot/scalar_types.h b/flash/uart_boot/scalar_types.h
deleted file mode 100644
index f3ac1d86eb..0000000000
--- a/flash/uart_boot/scalar_types.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// this is meant to resolve platform dependency
-
-#ifndef _SCALAR_TYPES_H
-#define _SCALAR_TYPES_H
-
-
-#ifdef WIN32
-#include <windows.h>
-#define SLEEP Sleep
-#define GET_LAST_ERR GetLastError
-#endif
-// ToDo: add stuff for Linux
-
-
-
-#ifndef UINT8
-#define UINT8 unsigned char
-#endif
-
-#ifndef UINT16
-#define UINT16 unsigned short
-#endif
-
-#ifndef UINT32
-#define UINT32 unsigned long
-#endif
-
-#ifndef bool
-#define bool int
-#endif
-
-#ifndef true
-#define true 1
-#endif
-
-#ifndef false
-#define false 0
-#endif
-
-
-
-
-
-#endif
-
diff --git a/flash/uart_boot/uart.h b/flash/uart_boot/uart.h
deleted file mode 100644
index a0c10d1a0f..0000000000
--- a/flash/uart_boot/uart.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// A general definition for the required UART functionality.
-// This will be used to gain platform abstraction.
-
-#ifndef _UART_H
-#define _UART_H
-
-// data types
-
-typedef void* tUartHandle;
-#define INVALID_UART_HANDLE (tUartHandle)-1
-
-typedef enum
-{
- eNOPARITY,
- eODDPARITY,
- eEVENPARITY,
- eMARKPARITY,
- eSPACEPARITY,
-} tParity;
-
-typedef enum
-{
- eONESTOPBIT,
- eONE5STOPBITS,
- eTWOSTOPBITS,
-} tStopBits;
-
-
-// prototypes
-
-tUartHandle UartOpen( // returns NULL on error
- char* szPortName); // COMx for windows
-
-bool UartConfig( // returns true on success, false on error
- tUartHandle handle, // the handle returned from UartOpen()
- long lBaudRate, // must be one of the "standard" baudrates
- tParity nParity, // what kind of parity
- tStopBits nStopBits, // how many stop bits
- int nByteSize); // size of the "payload", can be 5 to 8
-
-long UartWrite( // returns how much data was actually transmitted
- tUartHandle handle, // the handle returned from UartOpen()
- unsigned char* pData, // pointer to the data to be transmitted
- long lSize); // how many bytes
-
-long UartRead( // returns how much data was actually received
- tUartHandle handle, // the handle returned from UartOpen()
- unsigned char* pBuffer, // pointer to the destination
- long lSize); // how many bytes to read (pBuffer must have enough room)
-
-
-void UartClose(tUartHandle handle);
-
-
-
-#endif // _UART_H
-
diff --git a/flash/uart_boot/uart_boot.c b/flash/uart_boot/uart_boot.c
deleted file mode 100644
index 40c3682091..0000000000
--- a/flash/uart_boot/uart_boot.c
+++ /dev/null
@@ -1,370 +0,0 @@
-// uart_boot.cpp : Defines the entry point for the console application.
-//
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "scalar_types.h" // (U)INT8/16/32
-#include "Uart.h" // platform abstraction for UART
-#include "client.h" // client functions
-#include "flash.h" // flash high level functions
-
-// command line configuration: what shall we do?
-struct
-{
- char* szPort; // COM port to use
- bool bRecorder; // it's a recorder
- bool bArchos; // use the Archos monitor to load, instead of UART boot
- bool bSpindown; // spindown the harddisk
- bool bReadID; // read manufacturer+device ID
- char* szFlashfile; // file to be programmed
- char* szDumpfile; // file to dump into
- char* szExecfile; // file with the executable
- bool bTest; // debug action
- bool bHold; // hold power (for FMs & V2s)
- bool bBlink; // blink red LED
- bool bNoDownload;
-} gCmd;
-
-
-
-int ProcessCmdLine(int argc, char* argv[])
-{
- argc--; // exclude our name
- argv++;
-
- memset(&gCmd, 0, sizeof(gCmd));
-
- if (argc == 0)
- {
- printf("Usage: uart_boot [-option {filename}]\n");
- printf(" uses activated UART boot mod, box has to be fresh started\n");
- printf("The order of the options does not matter, one letter is sufficient.\n");
- printf("Possible options are (in the order of later processing):\n");
- printf("-port <name of COM port to use>\n");
- printf("-recorder (this is a recorder/FM, default is player if not specified)\n");
- printf("-archos (use Archos bootloader, this one needs powerup while program waits)\n");
- printf("-nodownload (no MiniMon download, it's already active)\n");
- printf("-hold (hold the power, useful for FMs and V2s, so you can release ON)\n");
- printf("-spindown (spindown the harddisk, else it stays on by default)\n");
- printf("-id (read manufacturer and device ID of flash, no checks)\n");
- printf("-flash <filename of binary to program into flash>\n");
- printf("-dump <filename to write flash content to>\n");
- printf("-exec <filename of executable for 0x09000000:0x09000200>\n");
- printf("-test (some test action currently under development, don't use!)\n");
- printf("-blink (blink red LED forever, meant as diagnostics)\n");
- printf("\n");
- printf("Examples:\n");
- printf("uart_boot -r -p COM1 -s -f flashfile.bin -d dumpfile.bin\n");
- printf(" recorder on COM1, spindown HD, program and dump (for e.g. offline verify)\n");
- printf("uart_boot -r -p COM2 -e rockbox.bin\n");
- printf(" recorder on COM2, load Rockbox from file and start it\n");
- exit (0);
- }
-
-
- while (argc)
- {
- if (!strncmp("-port", *argv, 2))
- {
- gCmd.szPort = *++argv;
- if (--argc <= 0 || **argv == '-')
- {
- printf("No argument given for option %s, aborting.\n", argv[-1]);
- exit (-2);
- }
- }
- else if (!strncmp("-recorder", *argv, 2))
- {
- gCmd.bRecorder = true;
- }
- else if (!strncmp("-archos", *argv, 2))
- {
- gCmd.bArchos = true;
- }
- else if (!strncmp("-nodownload", *argv, 2))
- {
- gCmd.bNoDownload = true;
- }
- else if (!strncmp("-spindown", *argv, 2))
- {
- gCmd.bSpindown = true;
- }
- else if (!strncmp("-id", *argv, 2))
- {
- gCmd.bReadID = true;
- }
- else if (!strncmp("-flash", *argv, 2))
- {
- gCmd.szFlashfile = *++argv;
- if (--argc <= 0 || **argv == '-')
- {
- printf("No argument given for option %s, aborting.\n", argv[-1]);
- exit (-2);
- }
- }
- else if (!strncmp("-dump", *argv, 2))
- {
- gCmd.szDumpfile = *++argv;
- if (--argc <= 0 || **argv == '-')
- {
- printf("No argument given for option %s, aborting.\n", argv[-1]);
- exit (-3);
- }
- }
- else if (!strncmp("-exec", *argv, 2))
- {
- gCmd.szExecfile = *++argv;
- if (--argc <= 0 || **argv == '-')
- {
- printf("No argument given for option %s, aborting.\n", argv[-1]);
- exit (-4);
- }
- }
- else if (!strncmp("-test", *argv, 2))
- {
- gCmd.bTest = true;
- }
- else if (!strncmp("-hold", *argv, 2))
- {
- gCmd.bHold = true;
- }
- else if (!strncmp("-blink", *argv, 2))
- {
- gCmd.bBlink = true;
- }
- else
- {
- printf("Unknown option %s, aborting. Use 'uart_boot' without options for help.\n", *argv);
- exit(-1);
- }
-
- argv++;
- argc--;
- }
-
- return 0;
-}
-
-
-int main(int argc, char* argv[])
-{
- tUartHandle serial_handle;
- UINT16 reg;
- FILE* pFile;
- size_t size;
- static UINT8 abFirmware[256*1024]; // blocksize
- memset(abFirmware, 0xFF, sizeof(abFirmware));
-
- ProcessCmdLine(argc, argv); // what to do
-
- if (!gCmd.szPort)
- {
- printf("No serial port given, use 'uart_boot' without parameters for options.\n");
- exit(-1);
- }
-
- serial_handle = UartOpen(gCmd.szPort); // opening serial port
- if (serial_handle == NULL)
- {
- printf("Cannot open port %s\n", gCmd.szPort);
- return -1;
- }
-
- if (gCmd.bNoDownload)
- { // just set our speed
- int baudrate = gCmd.bRecorder ? 115200 : 14400;
- if (!gCmd.bRecorder && gCmd.bTest)
- { // experimental Player speedup to 38400 baud
- baudrate = 38400;
- }
-
- if (!UartConfig(serial_handle, baudrate, eNOPARITY, eONESTOPBIT, 8))
- {
- printf("Error setting up COM params\n");
- exit(1);
- }
- }
- else
- { // download the monitor program
- if (gCmd.bArchos)
- {
- printf("Waiting for box startup to download monitor...");
- DownloadArchosMonitor(serial_handle, "minimon_archos.bin"); // load the monitor image
- printf("\b\b\b done.\n");
- }
- else
- {
- printf("Downloading monitor...");
- DownloadMonitor(serial_handle, gCmd.bRecorder, "minimon.bin"); // load the monitor image
- // From now on, we can talk to the box.
- printf("\b\b\b done.\n");
-
- if (gCmd.bRecorder)
- { // we can be faster
- SetTargetBaudrate(serial_handle, 11059200, 115200); // set to 115200
- }
- else if (gCmd.bTest) // experimental Player speedup to 38400 baud
- {
- SetTargetBaudrate(serial_handle, 12000000, 38400); // set to 38400
- }
- }
- }
-
-
- // do the action
- if (gCmd.bHold)
- {
- // hold power for FM
- reg = ReadHalfword(serial_handle, 0x05FFFFC2); // PBDR
- reg |= 0x0020; // set PB5 to keep power
- WriteHalfword(serial_handle, 0x05FFFFC2, reg);
-
- reg = ReadHalfword(serial_handle, 0x05FFFFC6); // PBIOR
- reg |= 0x0020; // make PB5 an output
- WriteHalfword(serial_handle, 0x05FFFFC6, reg);
- printf("Power hold, you can release ON button now.\n");
- }
-
-
- if (gCmd.bSpindown)
- {
- // power down the disk
- if (gCmd.bRecorder)
- { // Recorder (V1+V2) and FM have disk power control on PA5
- reg = ReadHalfword(serial_handle, 0x05FFFFCA); // PACR2
- reg &= ~0x0400; // clear bit 10: GPIO
- WriteHalfword(serial_handle, 0x05FFFFCA, reg);
-
- reg = ReadHalfword(serial_handle, 0x05FFFFC4); // PAIOR
- reg |= 0x0020; // set bit 5: output
- WriteHalfword(serial_handle, 0x05FFFFC4, reg);
-
- reg = ReadHalfword(serial_handle, 0x05FFFFC0); // PADR
- reg &= ~0x0020; // clear PA5 to power down
- WriteHalfword(serial_handle, 0x05FFFFC0, reg);
- }
- else
- { // new Players have disk power control on PB4
- reg = ReadHalfword(serial_handle, 0x05FFFFC6); // PBIOR
- reg |= 0x0010; // set bit 4: output
- WriteHalfword(serial_handle, 0x05FFFFC6, reg);
-
- reg = ReadHalfword(serial_handle, 0x05FFFFC2); // PBDR
- reg &= ~0x0010; // clear PB4 to power down
- WriteHalfword(serial_handle, 0x05FFFFC2, reg);
- }
- printf("Harddisk powered down.\n");
- }
-
-
- if (gCmd.bReadID)
- {
- UINT8 bMan, bID;
- ReadID(serial_handle, 0x02000000, &bMan, &bID);
- printf("Manufacturer ID = 0x%02X, Device ID = 0x%02X\n", bMan, bID);
- }
-
-
- if (gCmd.szFlashfile)
- {
- // flash a firmware file
- printf("Flashing file %s...", gCmd.szFlashfile);
- pFile = fopen(gCmd.szFlashfile, "rb");
- if (pFile == NULL)
- {
- printf("\nFlash file %s not found, exiting.\n", gCmd.szFlashfile);
- return -2;
- }
- size = fread(abFirmware, 1, sizeof(abFirmware), pFile);
- fclose (pFile);
-
- EraseChip(serial_handle, 0x02000000);
- FlashByteMultiple(serial_handle, 0x02000000, size, abFirmware);
- printf("\b\b\b done.\n");
- }
-
-
- if (gCmd.szDumpfile)
- {
- // dump the flash content
- printf("Writing flash dump into file %s...", gCmd.szDumpfile);
- ReadByteMultiple(serial_handle, 0x02000000, sizeof(abFirmware), abFirmware);
- pFile = fopen(gCmd.szDumpfile, "wb");
- if (pFile == NULL)
- {
- printf("\nDump file %s cannot be opened, exiting.\n", gCmd.szDumpfile);
- return -3;
- }
- fwrite(abFirmware, 1, sizeof(abFirmware), pFile);
- fclose (pFile);
- printf("\b\b\b done.\n");
- }
-
-
- if (gCmd.szExecfile)
- {
- UINT32 size;
-
- printf("Downloading program...");
-
- // init the DRAM controller like the flash boot does
- reg = ReadHalfword(serial_handle, 0x05FFFFCA); // PACR2
- reg &= 0xFFFB; // PA1 config: /RAS
- reg |= 0x0008;
- WriteHalfword(serial_handle, 0x05FFFFCA, reg); // PACR2
- reg = 0xAFFF; // CS1, CS3 config: /CASH. /CASL
- WriteHalfword(serial_handle, 0x05FFFFEE, reg); // CASCR
- reg = ReadHalfword(serial_handle, 0x05FFFFA0); // BCR
- reg |= 0x8000; // DRAM enable, default bus
- WriteHalfword(serial_handle, 0x05FFFFA0, reg); // BCR
- reg = ReadHalfword(serial_handle, 0x05FFFFA2); // WCR1
- reg &= 0xFDFD; // 1-cycle CAS
- WriteHalfword(serial_handle, 0x05FFFFA2, reg); // WCR1
- reg = 0x0E00; // CAS 35%, multiplexed, 10 bit row addr.
- WriteHalfword(serial_handle, 0x05FFFFA8, reg); // DCR
- reg = 0x5AB0; // refresh, 4 cycle waitstate
- WriteHalfword(serial_handle, 0x05FFFFAC, reg); // RCR
- reg = 0x9605; // refresh constant
- WriteHalfword(serial_handle, 0x05FFFFB2, reg); // RTCOR
- reg = 0xA518; // phi/32
- WriteHalfword(serial_handle, 0x05FFFFAE, reg); // RTCSR
-
-
- // download Rockbox/gdb
- pFile = fopen(gCmd.szExecfile, "rb");
- if (pFile == NULL)
- {
- printf("\nExecutable file %s cannot be opened, exiting.\n", gCmd.szExecfile);
- return -3;
- }
-
- size = fread(abFirmware, 1, sizeof(abFirmware), pFile);
- WriteByteMultiple(serial_handle, 0x09000000, size, abFirmware);
- fclose (pFile);
- printf("\b\b\b done.\n");
-
- // start rockbox/gdb
- printf("Starting program...");
- Execute(serial_handle, 0x09000200, false);
- printf("\b\b\b done.\n");
- }
-
-
- if (gCmd.bBlink)
- {
- // blinking LED
- UINT8 byte;
- printf("Flashing red LED forever... (stop with Ctrl-C)\n");
- byte = ReadByte(serial_handle, 0x05FFFFC3);
- while (1)
- {
- byte ^= 0x40;
- WriteByte(serial_handle, 0x05FFFFC3, byte);
- Sleep(200);
- }
- }
-
- return 0;
-}
-
diff --git a/flash/uart_boot/uart_boot.dsp b/flash/uart_boot/uart_boot.dsp
deleted file mode 100644
index 4d94c72530..0000000000
--- a/flash/uart_boot/uart_boot.dsp
+++ /dev/null
@@ -1,130 +0,0 @@
-# Microsoft Developer Studio Project File - Name="uart_boot" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=uart_boot - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "uart_boot.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "uart_boot.mak" CFG="uart_boot - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "uart_boot - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "uart_boot - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "uart_boot - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "uart_boot - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "uart_boot - Win32 Release"
-# Name "uart_boot - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\client.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\flash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\uart_boot.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\uart_win.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\client.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\flash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\minimon.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\scalar_types.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\uart.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/flash/uart_boot/uart_win.c b/flash/uart_boot/uart_win.c
deleted file mode 100644
index 6e82e9580c..0000000000
--- a/flash/uart_boot/uart_win.c
+++ /dev/null
@@ -1,139 +0,0 @@
-// UART wrapper implementation for the Win32 platform
-// make a new version of this file for different systems, e.g. Linux
-
-#include <windows.h>
-#include "scalar_types.h" // (U)INT8/16/32
-#include "Uart.h"
-
-// COMx for windows, returns NULL on error
-tUartHandle UartOpen(char* szPortName)
-{
- HANDLE serial_handle;
- DCB dcb;
- COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 };
-
- memset(&dcb,0,sizeof(dcb));
-
- /* -------------------------------------------------------------------- */
- // set DCB to configure the serial port
- dcb.DCBlength = sizeof(dcb);
-
- dcb.fOutxCtsFlow = 0;
- dcb.fOutxDsrFlow = 0;
- dcb.fDtrControl = DTR_CONTROL_ENABLE; // enable for power
- dcb.fDsrSensitivity = 0;
- dcb.fRtsControl = RTS_CONTROL_ENABLE; // enable for power
- dcb.fOutX = 0;
- dcb.fInX = 0;
-
- /* ----------------- misc parameters ----- */
- dcb.fErrorChar = 0;
- dcb.fBinary = 1;
- dcb.fNull = 0;
- dcb.fAbortOnError = 0;
- dcb.wReserved = 0;
- dcb.XonLim = 2;
- dcb.XoffLim = 4;
- dcb.XonChar = 0x13;
- dcb.XoffChar = 0x19;
- dcb.EvtChar = 0;
-
- /* ----------------- defaults ----- */
- dcb.BaudRate = 4800;
- dcb.Parity = NOPARITY;
- dcb.fParity = 0;
- dcb.StopBits = ONESTOPBIT;
- dcb.ByteSize = 8;
-
-
- /* -------------------------------------------------------------------- */
- // opening serial port
- serial_handle = CreateFile(szPortName, GENERIC_READ | GENERIC_WRITE,
- 0, NULL, OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, NULL);
-
- if (serial_handle == INVALID_HANDLE_VALUE)
- {
- //printf("Cannot open port \n");
- return NULL;
- }
-
- SetCommMask(serial_handle, 0);
- SetCommTimeouts(serial_handle, &cto);
-
- if(!SetCommState(serial_handle, &dcb))
- {
- //printf("Error setting up COM params\n");
- CloseHandle(serial_handle);
- return NULL;
- }
-
- return serial_handle;
-}
-
-// returns true on success, false on error
-bool UartConfig(tUartHandle handle, long lBaudRate, tParity nParity, tStopBits nStopBits, int nByteSize)
-{
- DCB dcb;
-
- if (!GetCommState (handle, &dcb))
- {
- return false;
- }
-
- dcb.BaudRate = lBaudRate;
- dcb.Parity = nParity;
- dcb.StopBits = nStopBits;
- dcb.ByteSize = nByteSize;
-
- if(!SetCommState(handle, &dcb))
- {
- //DWORD dwErr = GetLastError();
- //printf("Error %d setting up COM params for baudrate byte\n", dwErr);
- return false;
- }
-
- return true;
-}
-
-// returns how much data was actually transmitted
-long UartWrite(tUartHandle handle, unsigned char* pData, long lSize)
-{
- BOOL success;
- DWORD result_nbr;
-
- success = WriteFile(handle, pData, lSize, &result_nbr, NULL);
-
- if(!success)
- {
- return 0;
- }
-
- return result_nbr;
-}
-
-// returns how much data was actually received
-long UartRead(tUartHandle handle, unsigned char* pBuffer, long lSize)
-{
- BOOL success;
- DWORD read_nbr;
-
- success = ReadFile(handle, pBuffer, lSize, &read_nbr, NULL);
- if(!success)
- {
- return 0;
- }
-
- return read_nbr;
-}
-
-
-void UartClose(tUartHandle handle)
-{
- if (handle != NULL)
- {
- CloseHandle(handle);
- }
-
- return;
-}
-
diff --git a/gdb/FILES b/gdb/FILES
deleted file mode 100644
index ef5633cbd6..0000000000
--- a/gdb/FILES
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-linker.cfg
-*.[chs]
diff --git a/gdb/Makefile b/gdb/Makefile
deleted file mode 100644
index 61f4cb838d..0000000000
--- a/gdb/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-ifdef RECORDER
-EXTRA = -DRECORDER
-EXT = ajz
-else
-EXT = mod
-endif
-
-TARGET = stub
-OBJS = start.o sh-stub.o setjmp.o
-LIBS = -lgcc
-
-.s.o:
- sh-elf-as -o $@ $<
-
-.c.o:
- sh-elf-gcc -O $(EXTRA) -I../firmware/export -I../firmware/include -m1 -Wall -Wstrict-prototypes -c -o $@ $<
-
-.S.o:
- sh-elf-gcc -O -I../firmware/export -I../firmware/include -m1 -Wall -Wstrict-prototypes -c -o $@ $<
-
-$(TARGET).$(EXT): $(TARGET).elf
- sh-elf-objcopy -O binary $(TARGET).elf $(TARGET).out
- ../tools/scramble $(TARGET).out $(TARGET).$(EXT)
- ../tools/sh2d $(TARGET).out -o 09000000 > $(TARGET).asm
-
-$(TARGET).elf: $(OBJS)
- sh-elf-gcc -nostartfiles $(OBJS) -nostdlib -Wl,-Map,$(TARGET).map -o $(TARGET).elf -Tlinker.cfg
-
-clean:
- rm $(OBJS) $(TARGET).map $(TARGET).elf $(TARGET).out $(TARGET).mod $(TARGET).ajz
-
-start.o: start.S
-sh-stub.o: sh-stub.c
-setjmp.o: setjmp.S
diff --git a/gdb/README b/gdb/README
deleted file mode 100644
index e61c930ea8..0000000000
--- a/gdb/README
+++ /dev/null
@@ -1,95 +0,0 @@
---------------------------------------------------------------------
- __________ __ ___.
- Open \______ \ ____ ____ | | _\_ |__ _______ ___
- Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- \/ \/ \/ \/ \/
- $Id$
-
- Copyright (C) 2002 by Linus Nielsen Feltzing
-
---------------------------------------------------------------------
-
-Debugging the Archos Jukebox
-----------------------------
-
-To debug using the serial port on the Jukebox, you need to do the following:
-
-1) Connect the serial port to the PC. This is best done with the "serial
- port mod" described on the home page, along with a serial port converter
- for the 3V signals from the Jukebox.
-
-2) Build or download a GDB SH1 cross debugger
-
-3) Compile the GDB stub from the CVS "gdb" archive
- For Player models, just type:
- # make
-
- For Recorder, type
- #make RECORDER=1
-
-4) Copy the newly built ARCHOS.MOD to the Jukebox.
-
-5) Start the Jukebox and fire up the GDB with the elf file you want to debug
- as an argument along with the baud rate:
-
- For Player:
- # sh-elf-gdb -b 38400 test.elf
-
- For Recorder:
- # sh-elf-gdb -b 115200 test.elf
-
-6) In GDB, type:
-
- (gdb) target remote /dev/ttyS0
-
- /dev/ttyS0 is the serial port you want to use. I guess Windows users
- would type COM1 or something like that.
-
- GDB should answer with a message like:
-
- Remote debugging using /dev/ttyS0
- 0x090014b6 in ?? ()
- (gdb)
-
-7) Load the code from the elf file you specified on the command line:
-
- (gdb) load
-
- GDB should answer like this:
-
- Loading section .text, size 0x6b00 lma 0x9018000
- Loading section .data, size 0x738 lma 0x901eb00
- Start address 0x9018290, load size 29240
- Transfer rate: 11696 bits/sec, 102 bytes/write.
- (gdb)
-
-8) You're set. Now try to set a breakpoint and run:
-
- (gdb) b main
- Breakpoint 1 at 0x9011b2a: file main.c, line 192.
- (gdb) c
- Continuing.
-
- Breakpoint 1, main () at main.c:192
- 192 app_main();
- (gdb)
-
- Good luck!
-
-
-Technical details:
-
- As for now, the GDB stub occupies the memory from 0x900000 up to
- 0x9018000.
-
- Compile and link your test program at 0x9018000 and up, and it will work.
-
- The baud rate is 38400 for Player, 115200 for Recorder, and the settings
- are 8N1.
-
- Note that you may have to change the ATA I/O address in the ATA_CONTROL
- macro in sh-stub.c. go to Menu->Debug (keep out)->View HW info to find out.
-
- Linus Nielsen Feltzing
diff --git a/gdb/linker.cfg b/gdb/linker.cfg
deleted file mode 100644
index 5d5334b92f..0000000000
--- a/gdb/linker.cfg
+++ /dev/null
@@ -1,28 +0,0 @@
-ENTRY(_start)
-OUTPUT_FORMAT(elf32-sh)
-SECTIONS
-{
- .vectors 0x09000000 :
- {
- *(.vectors);
- . = ALIGN(0x200);
- start.o(.text)
- *(.rodata)
- }
-
- .text :
- {
- *(.text)
- }
-
- .bss :
- {
- _stack = . + 0x1000;
- _stub_stack = _stack + 0x1000;
- }
-
- .pad 0x0900C800 :
- {
- LONG(0);
- }
- }
diff --git a/gdb/sh-stub.c b/gdb/sh-stub.c
deleted file mode 100644
index 9a68d2fd53..0000000000
--- a/gdb/sh-stub.c
+++ /dev/null
@@ -1,1616 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2002 by Linus Nielsen Feltzing
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-/* sh-stub.c -- debugging stub for the Hitachi-SH.
-
- NOTE!! This code has to be compiled with optimization, otherwise the
- function inlining which generates the exception handlers won't work.
-
-*/
-
-/* This is originally based on an m68k software stub written by Glenn
- Engel at HP, but has changed quite a bit.
-
- Modifications for the SH by Ben Lee and Steve Chamberlain
-
- Even more modifications for GCC 3.0 and The Rockbox by Linus
- Nielsen Feltzing
-*/
-
-/****************************************************************************
-
- THIS SOFTWARE IS NOT COPYRIGHTED
-
- HP offers the following for use in the public domain. HP makes no
- warranty with regard to the software or it's performance and the
- user accepts the software "AS IS" with all faults.
-
- HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
- TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-****************************************************************************/
-
-
-/* Remote communication protocol.
-
- A debug packet whose contents are <data>
- is encapsulated for transmission in the form:
-
- $ <data> # CSUM1 CSUM2
-
- <data> must be ASCII alphanumeric and cannot include characters
- '$' or '#'. If <data> starts with two characters followed by
- ':', then the existing stubs interpret this as a sequence number.
-
- CSUM1 and CSUM2 are ascii hex representation of an 8-bit
- checksum of <data>, the most significant nibble is sent first.
- the hex digits 0-9,a-f are used.
-
- Receiver responds with:
-
- + - if CSUM is correct and ready for next packet
- - - if CSUM is incorrect
-
- <data> is as follows:
- All values are encoded in ascii hex digits.
-
- Request Packet
-
- read registers g
- reply XX....X Each byte of register data
- is described by two hex digits.
- Registers are in the internal order
- for GDB, and the bytes in a register
- are in the same order the machine uses.
- or ENN for an error.
-
- write regs GXX..XX Each byte of register data
- is described by two hex digits.
- reply OK for success
- ENN for an error
-
- write reg Pn...=r... Write register n... with value r...,
- which contains two hex digits for each
- byte in the register (target byte
- order).
- reply OK for success
- ENN for an error
- (not supported by all stubs).
-
- read mem mAA..AA,LLLL AA..AA is address, LLLL is length.
- reply XX..XX XX..XX is mem contents
- Can be fewer bytes than requested
- if able to read only part of the data.
- or ENN NN is errno
-
- write mem MAA..AA,LLLL:XX..XX
- AA..AA is address,
- LLLL is number of bytes,
- XX..XX is data
- reply OK for success
- ENN for an error (this includes the case
- where only part of the data was
- written).
-
- cont cAA..AA AA..AA is address to resume
- If AA..AA is omitted,
- resume at same address.
-
- step sAA..AA AA..AA is address to resume
- If AA..AA is omitted,
- resume at same address.
-
- last signal ? Reply the current reason for stopping.
- This is the same reply as is generated
- for step or cont : SAA where AA is the
- signal number.
-
- There is no immediate reply to step or cont.
- The reply comes when the machine stops.
- It is SAA AA is the "signal number"
-
- or... TAAn...:r...;n:r...;n...:r...;
- AA = signal number
- n... = register number
- r... = register contents
- or... WAA The process exited, and AA is
- the exit status. This is only
- applicable for certains sorts of
- targets.
- kill request k
-
- toggle debug d toggle debug flag (see 386 & 68k stubs)
- reset r reset -- see sparc stub.
- reserved <other> On other requests, the stub should
- ignore the request and send an empty
- response ($#<checksum>). This way
- we can extend the protocol and GDB
- can tell whether the stub it is
- talking to uses the old or the new.
- search tAA:PP,MM Search backwards starting at address
- AA for a match with pattern PP and
- mask MM. PP and MM are 4 bytes.
- Not supported by all stubs.
-
- general query qXXXX Request info about XXXX.
- general set QXXXX=yyyy Set value of XXXX to yyyy.
- query sect offs qOffsets Get section offsets. Reply is
- Text=xxx;Data=yyy;Bss=zzz
- console output Otext Send text to stdout. Only comes from
- remote target.
-
- Responses can be run-length encoded to save space. A '*' means that
- the next character is an ASCII encoding giving a repeat count which
- stands for that many repititions of the character preceding the '*'.
- The encoding is n+29, yielding a printable character where n >=3
- (which is where rle starts to win). Don't use an n > 126.
-
- So
- "0* " means the same as "0000". */
-
-#include "sh7034.h"
-#include <string.h>
-
-typedef int jmp_buf[20];
-
-void longjmp(jmp_buf __jmpb, int __retval);
-int setjmp(jmp_buf __jmpb);
-
-/* We need to undefine this from the sh7034.h file */
-#undef GBR
-
-/* Hitachi SH architecture instruction encoding masks */
-
-#define COND_BR_MASK 0xff00
-#define UCOND_DBR_MASK 0xe000
-#define UCOND_RBR_MASK 0xf0df
-#define TRAPA_MASK 0xff00
-
-#define COND_DISP 0x00ff
-#define UCOND_DISP 0x0fff
-#define UCOND_REG 0x0f00
-
-/* Hitachi SH instruction opcodes */
-
-#define BF_INSTR 0x8b00
-#define BT_INSTR 0x8900
-#define BRA_INSTR 0xa000
-#define BSR_INSTR 0xb000
-#define JMP_INSTR 0x402b
-#define JSR_INSTR 0x400b
-#define RTS_INSTR 0x000b
-#define RTE_INSTR 0x002b
-#define TRAPA_INSTR 0xc300
-#define SSTEP_INSTR 0xc37f
-
-/* Hitachi SH processor register masks */
-
-#define T_BIT_MASK 0x0001
-
-/*
- * BUFMAX defines the maximum number of characters in inbound/outbound
- * buffers. At least NUMREGBYTES*2 are needed for register packets.
- */
-#define BUFMAX 1024
-
-/*
- * Number of bytes for registers
- */
-#define NUMREGBYTES 112 /* 92 */
-
-/*
- * Forward declarations
- */
-
-static int hex (char);
-static char *mem2hex (char *mem, char *buf, int count);
-static char *hex2mem (char *buf, char *mem, int count);
-static int hex2int (char **ptr, int *intValue);
-static unsigned char *getpacket (void);
-static void putpacket (register char *buffer);
-static int computeSignal (int exceptionVector);
-void handle_buserror (void);
-void handle_exception (int exceptionVector);
-void init_serial(void);
-
-void serial_putc (char ch);
-char serial_getc (void);
-
-/* These are in the file but in asm statements so the compiler can't see them */
-void catch_exception_4 (void);
-void catch_exception_5 (void);
-void catch_exception_6 (void);
-void catch_exception_7 (void);
-void catch_exception_8 (void);
-void catch_exception_9 (void);
-void catch_exception_10 (void);
-void catch_exception_11 (void);
-void catch_exception_12 (void);
-void catch_exception_13 (void);
-void catch_exception_14 (void);
-void catch_exception_15 (void);
-void catch_exception_16 (void);
-void catch_exception_17 (void);
-void catch_exception_18 (void);
-void catch_exception_19 (void);
-void catch_exception_20 (void);
-void catch_exception_21 (void);
-void catch_exception_22 (void);
-void catch_exception_23 (void);
-void catch_exception_24 (void);
-void catch_exception_25 (void);
-void catch_exception_26 (void);
-void catch_exception_27 (void);
-void catch_exception_28 (void);
-void catch_exception_29 (void);
-void catch_exception_30 (void);
-void catch_exception_31 (void);
-void catch_exception_32 (void);
-void catch_exception_33 (void);
-void catch_exception_34 (void);
-void catch_exception_35 (void);
-void catch_exception_36 (void);
-void catch_exception_37 (void);
-void catch_exception_38 (void);
-void catch_exception_39 (void);
-void catch_exception_40 (void);
-void catch_exception_41 (void);
-void catch_exception_42 (void);
-void catch_exception_43 (void);
-void catch_exception_44 (void);
-void catch_exception_45 (void);
-void catch_exception_46 (void);
-void catch_exception_47 (void);
-void catch_exception_48 (void);
-void catch_exception_49 (void);
-void catch_exception_50 (void);
-void catch_exception_51 (void);
-void catch_exception_52 (void);
-void catch_exception_53 (void);
-void catch_exception_54 (void);
-void catch_exception_55 (void);
-void catch_exception_56 (void);
-void catch_exception_57 (void);
-void catch_exception_58 (void);
-void catch_exception_59 (void);
-void catch_exception_60 (void);
-void catch_exception_61 (void);
-void catch_exception_62 (void);
-void catch_exception_63 (void);
-void catch_exception_64 (void);
-void catch_exception_65 (void);
-void catch_exception_66 (void);
-void catch_exception_67 (void);
-void catch_exception_68 (void);
-void catch_exception_69 (void);
-void catch_exception_70 (void);
-void catch_exception_71 (void);
-void catch_exception_72 (void);
-void catch_exception_73 (void);
-void catch_exception_74 (void);
-void catch_exception_75 (void);
-void catch_exception_76 (void);
-void catch_exception_77 (void);
-void catch_exception_78 (void);
-void catch_exception_79 (void);
-void catch_exception_80 (void);
-void catch_exception_81 (void);
-void catch_exception_82 (void);
-void catch_exception_83 (void);
-void catch_exception_84 (void);
-void catch_exception_85 (void);
-void catch_exception_86 (void);
-void catch_exception_87 (void);
-void catch_exception_88 (void);
-void catch_exception_89 (void);
-void catch_exception_90 (void);
-void catch_exception_91 (void);
-void catch_exception_92 (void);
-void catch_exception_93 (void);
-void catch_exception_94 (void);
-void catch_exception_95 (void);
-void catch_exception_96 (void);
-void catch_exception_97 (void);
-void catch_exception_98 (void);
-void catch_exception_99 (void);
-void catch_exception_100 (void);
-void catch_exception_101 (void);
-void catch_exception_102 (void);
-void catch_exception_103 (void);
-void catch_exception_104 (void);
-void catch_exception_105 (void);
-void catch_exception_106 (void);
-void catch_exception_107 (void);
-void catch_exception_108 (void);
-void catch_exception_109 (void);
-void catch_exception_110 (void);
-void catch_exception_111 (void);
-void catch_exception_112 (void);
-void catch_exception_113 (void);
-void catch_exception_114 (void);
-void catch_exception_115 (void);
-void catch_exception_116 (void);
-void catch_exception_117 (void);
-void catch_exception_118 (void);
-void catch_exception_119 (void);
-void catch_exception_120 (void);
-void catch_exception_121 (void);
-void catch_exception_122 (void);
-void catch_exception_123 (void);
-void catch_exception_124 (void);
-void catch_exception_125 (void);
-void catch_exception_126 (void);
-void catch_exception_127 (void);
-
-void breakpoint (void);
-
-
-//#define stub_stack_size 2*1024
-
-//int stub_stack[stub_stack_size] __attribute__ ((section (".stack"))) = {0};
-
-extern int stub_stack[];
-
-void INIT (void);
-void start (void);
-
-#define CPU_BUS_ERROR_VEC 9
-#define DMA_BUS_ERROR_VEC 10
-#define NMI_VEC 11
-#define INVALID_INSN_VEC 4
-#define INVALID_SLOT_VEC 6
-#define TRAP_VEC 32
-#define IO_VEC 33
-#define USER_VEC 127
-
-char in_nmi; /* Set when handling an NMI, so we don't reenter */
-int dofault; /* Non zero, bus errors will raise exception */
-
-int *stub_sp;
-
-/* debug > 0 prints ill-formed commands in valid packets & checksum errors */
-int remote_debug;
-
-/* jump buffer used for setjmp/longjmp */
-jmp_buf remcomEnv;
-
-enum regnames
-{
- R0, R1, R2, R3, R4, R5, R6, R7,
- R8, R9, R10, R11, R12, R13, R14,
- R15, PC, PR, GBR, VBR, MACH, MACL, SR,
- TICKS, STALLS, CYCLES, INSTS, PLR
-};
-
-typedef struct
-{
- short *memAddr;
- short oldInstr;
-}
-stepData;
-
-int registers[NUMREGBYTES / 4];
-stepData instrBuffer;
-char stepped;
-static const char hexchars[] = "0123456789abcdef";
-static char remcomInBuffer[BUFMAX];
-static char remcomOutBuffer[BUFMAX];
-
-#define ATA_NSECTOR (*((volatile unsigned char*)0x06100102))
-#define ATA_COMMAND (*((volatile unsigned char*)0x06100107))
-
-/* You may need to change this depending on your ATA I/O address
-** 0x200 - 0x06200206
-** 0x300 - 0x06200306
-*/
-#define ATA_CONTROL (*((volatile unsigned char*)0x06200206))
-#define ATA_ALT_STATUS ATA_CONTROL
-
-#define STATUS_BSY 0x80
-#define STATUS_RDY 0x40
-
-#define CMD_STANDBY_IMMEDIATE 0xE0
-#define CMD_STANDBY 0xE2
-
-void ata_wait_for_bsy(void)
-{
- while (ATA_ALT_STATUS & STATUS_BSY);
-}
-
-int ata_wait_for_rdy(void)
-{
- ata_wait_for_bsy();
- return ATA_ALT_STATUS & STATUS_RDY;
-}
-
-int ata_spindown(int time)
-{
- /* Port A setup */
- PAIOR |= 0x0280; /* output for ATA reset, IDE enable */
- PADR |= 0x0200; /* release ATA reset */
- PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */
-
- /* activate ATA */
- PADR &= ~0x80;
-
- if(!ata_wait_for_rdy())
- return -1;
-
- if ( time == -1 ) {
- ATA_COMMAND = CMD_STANDBY_IMMEDIATE;
- }
- else {
- if (time > 255)
- return -1;
- ATA_NSECTOR = time & 0xff;
- ATA_COMMAND = CMD_STANDBY;
- }
-
- if (!ata_wait_for_rdy())
- return -1;
-
- return 0;
-}
-
-void blink(void)
-{
- while(1)
- {
- int i;
- PBDR ^= 0x40; /* toggle PB6 */
- for(i = 0;i < 500000;i++)
- {
- }
- }
-}
-
-char highhex(int x)
-{
- return hexchars[(x >> 4) & 0xf];
-}
-
-char lowhex(int x)
-{
- return hexchars[x & 0xf];
-}
-
-/*
- * Assembly macros
- */
-
-#define BREAKPOINT() asm("trapa #0x20"::);
-
-
-/*
- * Routines to handle hex data
- */
-
-static int hex (char ch)
-{
- if ((ch >= 'a') && (ch <= 'f'))
- return (ch - 'a' + 10);
- if ((ch >= '0') && (ch <= '9'))
- return (ch - '0');
- if ((ch >= 'A') && (ch <= 'F'))
- return (ch - 'A' + 10);
- return (-1);
-}
-
-/* convert the memory, pointed to by mem into hex, placing result in buf */
-/* return a pointer to the last char put in buf (null) */
-static char *mem2hex (char *mem, char *buf, int count)
-{
- int i;
- int ch;
- for (i = 0; i < count; i++)
- {
- ch = *mem++;
- *buf++ = highhex (ch);
- *buf++ = lowhex (ch);
- }
- *buf = 0;
- return (buf);
-}
-
-/* convert the hex array pointed to by buf into binary, to be placed in mem */
-/* return a pointer to the character after the last byte written */
-static char *hex2mem (char *buf, char *mem, int count)
-{
- int i;
- unsigned char ch;
- for (i = 0; i < count; i++)
- {
- ch = hex (*buf++) << 4;
- ch = ch + hex (*buf++);
- *mem++ = ch;
- }
- return (mem);
-}
-
-/**********************************************/
-/* WHILE WE FIND NICE HEX CHARS, BUILD AN INT */
-/* RETURN NUMBER OF CHARS PROCESSED */
-/**********************************************/
-static int hex2int (char **ptr, int *intValue)
-{
- int numChars = 0;
- int hexValue;
-
- *intValue = 0;
-
- while (**ptr)
- {
- hexValue = hex (**ptr);
- if (hexValue >= 0)
- {
- *intValue = (*intValue << 4) | hexValue;
- numChars++;
- }
- else
- break;
-
- (*ptr)++;
- }
-
- return (numChars);
-}
-
-/*
- * Routines to get and put packets
- */
-
-/* scan for the sequence $<data>#<checksum> */
-
-unsigned char *getpacket (void)
-{
- unsigned char *buffer = &remcomInBuffer[0];
- unsigned char checksum;
- unsigned char xmitcsum;
- int count;
- char ch;
-
- while (1)
- {
- /* wait around for the start character, ignore all other characters */
- while ((ch = serial_getc ()) != '$')
- ;
-
- retry:
- checksum = 0;
- xmitcsum = -1;
- count = 0;
-
- /* now, read until a # or end of buffer is found */
- while (count < BUFMAX)
- {
- ch = serial_getc ();
- if (ch == '$')
- goto retry;
- if (ch == '#')
- break;
- checksum = checksum + ch;
- buffer[count] = ch;
- count = count + 1;
- }
- buffer[count] = 0;
-
- if (ch == '#')
- {
- ch = serial_getc ();
- xmitcsum = hex (ch) << 4;
- ch = serial_getc ();
- xmitcsum += hex (ch);
-
- if (checksum != xmitcsum)
- {
- serial_putc ('-'); /* failed checksum */
- }
- else
- {
- serial_putc ('+'); /* successful transfer */
-
- /* if a sequence char is present, reply the sequence ID */
- if (buffer[2] == ':')
- {
- serial_putc (buffer[0]);
- serial_putc (buffer[1]);
-
- return &buffer[3];
- }
-
- return &buffer[0];
- }
- }
- }
-}
-
-
-/* send the packet in buffer. */
-
-static void putpacket (register char *buffer)
-{
- register int checksum;
-
- /* $<packet info>#<checksum>. */
- do
- {
- char *src = buffer;
- serial_putc ('$');
- checksum = 0;
-
- while (*src)
- {
- int runlen;
-
- /* Do run length encoding */
- for (runlen = 0; runlen < 100; runlen ++)
- {
- if (src[0] != src[runlen] || runlen == 99)
- {
- if (runlen > 3)
- {
- int encode;
- /* Got a useful amount */
- serial_putc (*src);
- checksum += *src;
- serial_putc ('*');
- checksum += '*';
- checksum += (encode = runlen + ' ' - 4);
- serial_putc (encode);
- src += runlen;
- }
- else
- {
- serial_putc (*src);
- checksum += *src;
- src++;
- }
- break;
- }
- }
- }
-
-
- serial_putc ('#');
- serial_putc (highhex(checksum));
- serial_putc (lowhex(checksum));
- }
- while (serial_getc() != '+');
-}
-
-
-/* a bus error has occurred, perform a longjmp
- to return execution and allow handling of the error */
-
-void handle_buserror (void)
-{
- longjmp (remcomEnv, 1);
-}
-
-#define SIGINT 2 /* interrupt */
-#define SIGILL 4 /* illegal instruction (not reset when caught) */
-#define SIGTRAP 5 /* trace trap (not reset when caught) */
-#define SIGEMT 7 /* EMT instruction */
-#define SIGBUS 10 /* bus error */
-
-/*
- * this function takes the SH-1 exception number and attempts to
- * translate this number into a unix compatible signal value
- */
-static int computeSignal (int exceptionVector)
-{
- int sigval;
- switch (exceptionVector)
- {
- case INVALID_INSN_VEC:
- sigval = SIGILL;
- break;
- case INVALID_SLOT_VEC:
- sigval = SIGILL;
- break;
- case CPU_BUS_ERROR_VEC:
- sigval = SIGBUS;
- break;
- case DMA_BUS_ERROR_VEC:
- sigval = SIGBUS;
- break;
- case NMI_VEC:
- sigval = SIGINT;
- break;
-
- case TRAP_VEC:
- case USER_VEC:
- sigval = SIGTRAP;
- break;
-
- default:
- sigval = SIGEMT; /* "software generated"*/
- break;
- }
- return (sigval);
-}
-
-void doSStep (void)
-{
- short *instrMem;
- int displacement;
- int reg;
- unsigned short opcode;
-
- instrMem = (short *) registers[PC];
-
- opcode = *instrMem;
- stepped = 1;
-
- if ((opcode & COND_BR_MASK) == BT_INSTR)
- {
- if (registers[SR] & T_BIT_MASK)
- {
- displacement = (opcode & COND_DISP) << 1;
- if (displacement & 0x80)
- displacement |= 0xffffff00;
- /*
- * Remember PC points to second instr.
- * after PC of branch ... so add 4
- */
- instrMem = (short *) (registers[PC] + displacement + 4);
- }
- else
- instrMem += 1;
- }
- else if ((opcode & COND_BR_MASK) == BF_INSTR)
- {
- if (registers[SR] & T_BIT_MASK)
- instrMem += 1;
- else
- {
- displacement = (opcode & COND_DISP) << 1;
- if (displacement & 0x80)
- displacement |= 0xffffff00;
- /*
- * Remember PC points to second instr.
- * after PC of branch ... so add 4
- */
- instrMem = (short *) (registers[PC] + displacement + 4);
- }
- }
- else if ((opcode & UCOND_DBR_MASK) == BRA_INSTR)
- {
- displacement = (opcode & UCOND_DISP) << 1;
- if (displacement & 0x0800)
- displacement |= 0xfffff000;
-
- /*
- * Remember PC points to second instr.
- * after PC of branch ... so add 4
- */
- instrMem = (short *) (registers[PC] + displacement + 4);
- }
- else if ((opcode & UCOND_RBR_MASK) == JSR_INSTR)
- {
- reg = (char) ((opcode & UCOND_REG) >> 8);
-
- instrMem = (short *) registers[reg];
- }
- else if (opcode == RTS_INSTR)
- instrMem = (short *) registers[PR];
- else if (opcode == RTE_INSTR)
- instrMem = (short *) registers[15];
- else if ((opcode & TRAPA_MASK) == TRAPA_INSTR)
- instrMem = (short *) ((opcode & ~TRAPA_MASK) << 2);
- else
- instrMem += 1;
-
- instrBuffer.memAddr = instrMem;
- instrBuffer.oldInstr = *instrMem;
- *instrMem = SSTEP_INSTR;
-}
-
-
-/* Undo the effect of a previous doSStep. If we single stepped,
- restore the old instruction. */
-void undoSStep (void)
-{
- if (stepped)
- {
- short *instrMem;
- instrMem = instrBuffer.memAddr;
- *instrMem = instrBuffer.oldInstr;
- }
- stepped = 0;
-}
-
-/*
- * This function does all exception handling. It only does two things -
- * it figures out why it was called and tells gdb, and then it reacts
- * to gdb's requests.
- *
-*/
-void gdb_handle_exception (int exceptionVector)
-{
- int sigval, stepping;
- int addr, length;
- char *ptr;
-
- /* reply to host that an exception has occurred */
- sigval = computeSignal (exceptionVector);
- remcomOutBuffer[0] = 'S';
- remcomOutBuffer[1] = highhex(sigval);
- remcomOutBuffer[2] = lowhex (sigval);
- remcomOutBuffer[3] = 0;
-
- putpacket (remcomOutBuffer);
-
- /*
- * exception 127 indicates a software trap
- * inserted in place of code ... so back up
- * PC by one instruction, since this instruction
- * will later be replaced by its original one!
- */
- if (exceptionVector == USER_VEC
- || exceptionVector == TRAP_VEC)
- registers[PC] -= 2;
-
- /*
- * Do the things needed to undo
- * any stepping we may have done!
- */
- undoSStep ();
-
- stepping = 0;
-
- while (1)
- {
- remcomOutBuffer[0] = 0;
- ptr = getpacket ();
-
- switch (*ptr++)
- {
- case '?':
- remcomOutBuffer[0] = 'S';
- remcomOutBuffer[1] = highhex (sigval);
- remcomOutBuffer[2] = lowhex (sigval);
- remcomOutBuffer[3] = 0;
- break;
- case 'd':
- remote_debug = !(remote_debug); /* toggle debug flag */
- break;
- case 'g': /* return the value of the CPU registers */
- mem2hex ((char *) registers, remcomOutBuffer, NUMREGBYTES);
- break;
- case 'G': /* set the value of the CPU registers - return OK */
- hex2mem (ptr, (char *) registers, NUMREGBYTES);
- strcpy (remcomOutBuffer, "OK");
- break;
-
- /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
- case 'm':
- if (setjmp (remcomEnv) == 0)
- {
- dofault = 0;
- /* TRY, TO READ %x,%x. IF SUCCEED, SET PTR = 0 */
- if (hex2int (&ptr, &addr))
- if (*(ptr++) == ',')
- if (hex2int (&ptr, &length))
- {
- ptr = 0;
- mem2hex ((char *) addr, remcomOutBuffer, length);
- }
- if (ptr)
- strcpy (remcomOutBuffer, "E01");
- }
- else
- strcpy (remcomOutBuffer, "E03");
-
- /* restore handler for bus error */
- dofault = 1;
- break;
-
- /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
- case 'M':
- if (setjmp (remcomEnv) == 0)
- {
- dofault = 0;
-
- /* TRY, TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */
- if (hex2int (&ptr, &addr))
- if (*(ptr++) == ',')
- if (hex2int (&ptr, &length))
- if (*(ptr++) == ':')
- {
- hex2mem (ptr, (char *) addr, length);
- ptr = 0;
- strcpy (remcomOutBuffer, "OK");
- }
- if (ptr)
- strcpy (remcomOutBuffer, "E02");
- }
- else
- strcpy (remcomOutBuffer, "E03");
-
- /* restore handler for bus error */
- dofault = 1;
- break;
-
- /* cAA..AA Continue at address AA..AA(optional) */
- /* sAA..AA Step one instruction from AA..AA(optional) */
- case 's':
- stepping = 1;
- case 'c':
- {
- /* tRY, to read optional parameter, pc unchanged if no parm */
- if (hex2int (&ptr, &addr))
- registers[PC] = addr;
-
- if (stepping)
- doSStep ();
- }
-
- return;
- break;
-
- /* kill the program */
- case 'k': /* do nothing */
- break;
-
- default:
- break;
- } /* switch */
-
- /* reply to the request */
- putpacket (remcomOutBuffer);
- }
-}
-
-
-/* We've had an exception - go into the gdb stub */
-void handle_exception(int exceptionVector)
-{
- gdb_handle_exception (exceptionVector);
-}
-
-/* This function will generate a breakpoint exception. It is used at the
- beginning of a program to sync up with a debugger and can be used
- otherwise as a quick means to stop program execution and "break" into
- the debugger. */
-void breakpoint (void)
-{
- BREAKPOINT ();
-}
-
-/**** Processor-specific routines start here ****/
-/**** Processor-specific routines start here ****/
-/**** Processor-specific routines start here ****/
-
-extern int stack[];
-
-/* SH1/SH2 exception vector table format */
-typedef struct
-{
- void (*func_cold) (void);
- int *stack_cold;
- void (*func_warm) (void);
- int *stack_warm;
- void (*(handler[128 - 4])) (void);
-} vec_type;
-
-/* vectable is the SH1/SH2 vector table. It must be at address 0
-** or wherever your vbr points.
-** Note that we only define the first 128 vectors, since the Jukebox
-** firmware has its entry point at 0x200
-*/
-const vec_type vectable __attribute__ ((section (".vectors"))) =
-{
- &start, /* 0: Power-on reset PC */
- stack, /* 1: Power-on reset SP */
- &start, /* 2: Manual reset PC */
- stack, /* 3: Manual reset SP */
- {
- &catch_exception_4, /* 4: General invalid instruction */
- &catch_exception_5, /* 5: Reserved for system */
- &catch_exception_6, /* 6: Invalid slot instruction */
- &catch_exception_7, /* 7: Reserved for system */
- &catch_exception_8, /* 8: Reserved for system */
- &catch_exception_9, /* 9: CPU bus error */
- &catch_exception_10, /* 10: DMA bus error */
- &catch_exception_11, /* 11: NMI */
- &catch_exception_12, /* 12: User break */
- &catch_exception_13, /* 13: Reserved for system */
- &catch_exception_14, /* 14: Reserved for system */
- &catch_exception_15, /* 15: Reserved for system */
- &catch_exception_16, /* 16: Reserved for system */
- &catch_exception_17, /* 17: Reserved for system */
- &catch_exception_18, /* 18: Reserved for system */
- &catch_exception_19, /* 19: Reserved for system */
- &catch_exception_20, /* 20: Reserved for system */
- &catch_exception_21, /* 21: Reserved for system */
- &catch_exception_22, /* 22: Reserved for system */
- &catch_exception_23, /* 23: Reserved for system */
- &catch_exception_24, /* 24: Reserved for system */
- &catch_exception_25, /* 25: Reserved for system */
- &catch_exception_26, /* 26: Reserved for system */
- &catch_exception_27, /* 27: Reserved for system */
- &catch_exception_28, /* 28: Reserved for system */
- &catch_exception_29, /* 29: Reserved for system */
- &catch_exception_30, /* 30: Reserved for system */
- &catch_exception_31, /* 31: Reserved for system */
- &catch_exception_32, /* 32: Trap instr (user vectors) */
- &catch_exception_33, /* 33: Trap instr (user vectors) */
- &catch_exception_34, /* 34: Trap instr (user vectors) */
- &catch_exception_35, /* 35: Trap instr (user vectors) */
- &catch_exception_36, /* 36: Trap instr (user vectors) */
- &catch_exception_37, /* 37: Trap instr (user vectors) */
- &catch_exception_38, /* 38: Trap instr (user vectors) */
- &catch_exception_39, /* 39: Trap instr (user vectors) */
- &catch_exception_40, /* 40: Trap instr (user vectors) */
- &catch_exception_41, /* 41: Trap instr (user vectors) */
- &catch_exception_42, /* 42: Trap instr (user vectors) */
- &catch_exception_43, /* 43: Trap instr (user vectors) */
- &catch_exception_44, /* 44: Trap instr (user vectors) */
- &catch_exception_45, /* 45: Trap instr (user vectors) */
- &catch_exception_46, /* 46: Trap instr (user vectors) */
- &catch_exception_47, /* 47: Trap instr (user vectors) */
- &catch_exception_48, /* 48: Trap instr (user vectors) */
- &catch_exception_49, /* 49: Trap instr (user vectors) */
- &catch_exception_50, /* 50: Trap instr (user vectors) */
- &catch_exception_51, /* 51: Trap instr (user vectors) */
- &catch_exception_52, /* 52: Trap instr (user vectors) */
- &catch_exception_53, /* 53: Trap instr (user vectors) */
- &catch_exception_54, /* 54: Trap instr (user vectors) */
- &catch_exception_55, /* 55: Trap instr (user vectors) */
- &catch_exception_56, /* 56: Trap instr (user vectors) */
- &catch_exception_57, /* 57: Trap instr (user vectors) */
- &catch_exception_58, /* 58: Trap instr (user vectors) */
- &catch_exception_59, /* 59: Trap instr (user vectors) */
- &catch_exception_60, /* 60: Trap instr (user vectors) */
- &catch_exception_61, /* 61: Trap instr (user vectors) */
- &catch_exception_62, /* 62: Trap instr (user vectors) */
- &catch_exception_63, /* 63: Trap instr (user vectors) */
- &catch_exception_64, /* 64: IRQ0 */
- &catch_exception_65, /* 65: IRQ1 */
- &catch_exception_66, /* 66: IRQ2 */
- &catch_exception_67, /* 67: IRQ3 */
- &catch_exception_68, /* 68: IRQ4 */
- &catch_exception_69, /* 69: IRQ5 */
- &catch_exception_70, /* 70: IRQ6 */
- &catch_exception_71, /* 71: IRQ7 */
- &catch_exception_72,
- &catch_exception_73,
- &catch_exception_74,
- &catch_exception_75,
- &catch_exception_76,
- &catch_exception_77,
- &catch_exception_78,
- &catch_exception_79,
- &catch_exception_80,
- &catch_exception_81,
- &catch_exception_82,
- &catch_exception_83,
- &catch_exception_84,
- &catch_exception_85,
- &catch_exception_86,
- &catch_exception_87,
- &catch_exception_88,
- &catch_exception_89,
- &catch_exception_90,
- &catch_exception_91,
- &catch_exception_92,
- &catch_exception_93,
- &catch_exception_94,
- &catch_exception_95,
- &catch_exception_96,
- &catch_exception_97,
- &catch_exception_98,
- &catch_exception_99,
- &catch_exception_100,
- &catch_exception_101,
- &catch_exception_102,
- &catch_exception_103,
- &catch_exception_104,
- &catch_exception_105,
- &catch_exception_106,
- &catch_exception_107,
- &catch_exception_108,
- &catch_exception_109,
- &catch_exception_110,
- &catch_exception_111,
- &catch_exception_112,
- &catch_exception_113,
- &catch_exception_114,
- &catch_exception_115,
- &catch_exception_116,
- &catch_exception_117,
- &catch_exception_118,
- &catch_exception_119,
- &catch_exception_120,
- &catch_exception_121,
- &catch_exception_122,
- &catch_exception_123,
- &catch_exception_124,
- &catch_exception_125,
- &catch_exception_126,
- &catch_exception_127}};
-
-void INIT (void)
-{
- /* Disable all timer interrupts */
- TIER0 = 0;
- TIER1 = 0;
- TIER2 = 0;
- TIER3 = 0;
- TIER4 = 0;
-
- init_serial();
-
- in_nmi = 0;
- dofault = 1;
- stepped = 0;
-
- ata_spindown(-1);
-
- stub_sp = stub_stack;
- breakpoint ();
-
- /* We should never come here */
- blink();
-}
-
-void sr(void)
-{
- /* Calling Reset does the same as pressing the button */
- asm (".global _Reset\n"
- " .global _WarmReset\n"
- "_Reset:\n"
- "_WarmReset:\n"
- " mov.l L_sp,r15\n"
- " bra _INIT\n"
- " nop\n"
- " .align 2\n"
- "L_sp: .long _stack");
-
- asm("saveRegisters:\n");
- asm(" mov.l @(L_reg, pc), r0\n"
- " mov.l @r15+, r1 ! pop R0\n"
- " mov.l r2, @(0x08, r0) ! save R2\n"
- " mov.l r1, @r0 ! save R0\n"
- " mov.l @r15+, r1 ! pop R1\n"
- " mov.l r3, @(0x0c, r0) ! save R3\n"
- " mov.l r1, @(0x04, r0) ! save R1\n"
- " mov.l r4, @(0x10, r0) ! save R4\n"
- " mov.l r5, @(0x14, r0) ! save R5\n"
- " mov.l r6, @(0x18, r0) ! save R6\n"
- " mov.l r7, @(0x1c, r0) ! save R7\n"
- " mov.l r8, @(0x20, r0) ! save R8\n"
- " mov.l r9, @(0x24, r0) ! save R9\n"
- " mov.l r10, @(0x28, r0) ! save R10\n"
- " mov.l r11, @(0x2c, r0) ! save R11\n"
- " mov.l r12, @(0x30, r0) ! save R12\n"
- " mov.l r13, @(0x34, r0) ! save R13\n"
- " mov.l r14, @(0x38, r0) ! save R14\n"
- " mov.l @r15+, r4 ! save arg to handleException\n"
- " add #8, r15 ! hide PC/SR values on stack\n"
- " mov.l r15, @(0x3c, r0) ! save R15\n"
- " add #-8, r15 ! save still needs old SP value\n"
- " add #92, r0 ! readjust register pointer\n"
- " mov r15, r2\n"
- " add #4, r2\n"
- " mov.l @r2, r2 ! R2 has SR\n"
- " mov.l @r15, r1 ! R1 has PC\n"
- " mov.l r2, @-r0 ! save SR\n"
- " sts.l macl, @-r0 ! save MACL\n"
- " sts.l mach, @-r0 ! save MACH\n"
- " stc.l vbr, @-r0 ! save VBR\n"
- " stc.l gbr, @-r0 ! save GBR\n"
- " sts.l pr, @-r0 ! save PR\n"
- " mov.l @(L_stubstack, pc), r2\n"
- " mov.l @(L_hdl_except, pc), r3\n"
- " mov.l @r2, r15\n"
- " jsr @r3\n"
- " mov.l r1, @-r0 ! save PC\n"
- " mov.l @(L_stubstack, pc), r0\n"
- " mov.l @(L_reg, pc), r1\n"
- " bra restoreRegisters\n"
- " mov.l r15, @r0 ! save __stub_stack\n"
-
- " .align 2\n"
- "L_reg:\n"
- " .long _registers\n"
- "L_stubstack:\n"
- " .long _stub_sp\n"
- "L_hdl_except:\n"
- " .long _handle_exception");
-}
-
-void rr(void)
-{
- asm(" .align 2 \n"
- " .global _resume\n"
- "_resume:\n"
- " mov r4,r1\n"
- "restoreRegisters:\n"
- " add #8, r1 ! skip to R2\n"
- " mov.l @r1+, r2 ! restore R2\n"
- " mov.l @r1+, r3 ! restore R3\n"
- " mov.l @r1+, r4 ! restore R4\n"
- " mov.l @r1+, r5 ! restore R5\n"
- " mov.l @r1+, r6 ! restore R6\n"
- " mov.l @r1+, r7 ! restore R7\n"
- " mov.l @r1+, r8 ! restore R8\n"
- " mov.l @r1+, r9 ! restore R9\n"
- " mov.l @r1+, r10 ! restore R10\n"
- " mov.l @r1+, r11 ! restore R11\n"
- " mov.l @r1+, r12 ! restore R12\n"
- " mov.l @r1+, r13 ! restore R13\n"
- " mov.l @r1+, r14 ! restore R14\n"
- " mov.l @r1+, r15 ! restore programs stack\n"
- " mov.l @r1+, r0\n"
- " add #-8, r15 ! uncover PC/SR on stack \n"
- " mov.l r0, @r15 ! restore PC onto stack\n"
- " lds.l @r1+, pr ! restore PR\n"
- " ldc.l @r1+, gbr ! restore GBR\n"
- " ldc.l @r1+, vbr ! restore VBR\n"
- " lds.l @r1+, mach ! restore MACH\n"
- " lds.l @r1+, macl ! restore MACL\n"
- " mov.l @r1, r0 \n"
- " add #-88, r1 ! readjust reg pointer to R1\n"
- " mov.l r0, @(4, r15) ! restore SR onto stack+4\n"
- " mov.l r2, @-r15\n"
- " mov.l L_in_nmi, r0\n"
- " mov #0, r2\n"
- " mov.b r2, @r0\n"
- " mov.l @r15+, r2\n"
- " mov.l @r1+, r0 ! restore R0\n"
- " rte\n"
- " mov.l @r1, r1 ! restore R1");
-}
-
-static inline void code_for_catch_exception(unsigned int n)
-{
- asm(" .globl _catch_exception_%O0" : : "X" (n) );
- asm(" _catch_exception_%O0:" :: "X" (n) );
-
- asm(" add #-4, r15 ! reserve spot on stack ");
- asm(" mov.l r1, @-r15 ! push R1 ");
-
- if (n == NMI_VEC)
- {
- /* Special case for NMI - make sure that they don't nest */
- asm(" mov.l r0, @-r15 ! push R0");
- asm(" mov.l L_in_nmi, r0");
- asm(" tas.b @r0 ! Fend off against addtnl NMIs");
- asm(" bt noNMI");
- asm(" mov.l @r15+, r0");
- asm(" mov.l @r15+, r1");
- asm(" add #4, r15");
- asm(" rte");
- asm(" nop");
- asm(".align 2");
- asm("L_in_nmi: .long _in_nmi");
- asm("noNMI:");
- }
- else
- {
-
- if (n == CPU_BUS_ERROR_VEC)
- {
- /* Exception 9 (bus errors) are disasbleable - so that you
- can probe memory and get zero instead of a fault.
- Because the vector table may be in ROM we don't revector
- the interrupt like all the other stubs, we check in here
- */
- asm("mov.l L_dofault,r1");
- asm("mov.l @r1,r1");
- asm("tst r1,r1");
- asm("bf faultaway");
- asm("bsr _handle_buserror");
- asm(".align 2");
- asm("L_dofault: .long _dofault");
- asm("faultaway:");
- }
- asm(" mov #15<<4, r1 ");
- asm(" ldc r1, sr ! disable interrupts ");
- asm(" mov.l r0, @-r15 ! push R0 ");
- }
-
- /* Prepare for saving context, we've already pushed r0 and r1, stick
- exception number into the frame */
- asm(" mov r15, r0 ");
- asm(" add #8, r0 ");
- asm(" mov %0,r1" :: "X" (n));
- asm(" extu.b r1,r1 ");
- asm(" bra saveRegisters ! save register values ");
- asm(" mov.l r1, @r0 ! save exception # ");
-}
-
-/* Here we call all defined exceptions, so the inline assembler gets
- generated */
-void exceptions (void)
-{
- code_for_catch_exception (4);
- code_for_catch_exception (5);
- code_for_catch_exception (6);
- code_for_catch_exception (7);
- code_for_catch_exception (8);
- code_for_catch_exception (9);
- code_for_catch_exception (10);
- code_for_catch_exception (11);
- code_for_catch_exception (12);
- code_for_catch_exception (13);
- code_for_catch_exception (14);
- code_for_catch_exception (15);
- code_for_catch_exception (16);
- code_for_catch_exception (17);
- code_for_catch_exception (18);
- code_for_catch_exception (19);
- code_for_catch_exception (20);
- code_for_catch_exception (21);
- code_for_catch_exception (22);
- code_for_catch_exception (23);
- code_for_catch_exception (24);
- code_for_catch_exception (25);
- code_for_catch_exception (26);
- code_for_catch_exception (27);
- code_for_catch_exception (28);
- code_for_catch_exception (29);
- code_for_catch_exception (30);
- code_for_catch_exception (31);
- code_for_catch_exception (32);
- code_for_catch_exception (33);
- code_for_catch_exception (34);
- code_for_catch_exception (35);
- code_for_catch_exception (36);
- code_for_catch_exception (37);
- code_for_catch_exception (38);
- code_for_catch_exception (39);
- code_for_catch_exception (40);
- code_for_catch_exception (41);
- code_for_catch_exception (42);
- code_for_catch_exception (43);
- code_for_catch_exception (44);
- code_for_catch_exception (45);
- code_for_catch_exception (46);
- code_for_catch_exception (47);
- code_for_catch_exception (48);
- code_for_catch_exception (49);
- code_for_catch_exception (50);
- code_for_catch_exception (51);
- code_for_catch_exception (52);
- code_for_catch_exception (53);
- code_for_catch_exception (54);
- code_for_catch_exception (55);
- code_for_catch_exception (56);
- code_for_catch_exception (57);
- code_for_catch_exception (58);
- code_for_catch_exception (59);
- code_for_catch_exception (60);
- code_for_catch_exception (61);
- code_for_catch_exception (62);
- code_for_catch_exception (63);
- code_for_catch_exception (64);
- code_for_catch_exception (65);
- code_for_catch_exception (66);
- code_for_catch_exception (67);
- code_for_catch_exception (68);
- code_for_catch_exception (69);
- code_for_catch_exception (70);
- code_for_catch_exception (71);
- code_for_catch_exception (72);
- code_for_catch_exception (73);
- code_for_catch_exception (74);
- code_for_catch_exception (75);
- code_for_catch_exception (76);
- code_for_catch_exception (77);
- code_for_catch_exception (78);
- code_for_catch_exception (79);
- code_for_catch_exception (80);
- code_for_catch_exception (81);
- code_for_catch_exception (82);
- code_for_catch_exception (83);
- code_for_catch_exception (84);
- code_for_catch_exception (85);
- code_for_catch_exception (86);
- code_for_catch_exception (87);
- code_for_catch_exception (88);
- code_for_catch_exception (89);
- code_for_catch_exception (90);
- code_for_catch_exception (91);
- code_for_catch_exception (92);
- code_for_catch_exception (93);
- code_for_catch_exception (94);
- code_for_catch_exception (95);
- code_for_catch_exception (96);
- code_for_catch_exception (97);
- code_for_catch_exception (98);
- code_for_catch_exception (99);
- code_for_catch_exception (100);
- code_for_catch_exception (101);
- code_for_catch_exception (102);
- code_for_catch_exception (103);
- code_for_catch_exception (104);
- code_for_catch_exception (105);
- code_for_catch_exception (106);
- code_for_catch_exception (107);
- code_for_catch_exception (108);
- code_for_catch_exception (109);
- code_for_catch_exception (110);
- code_for_catch_exception (111);
- code_for_catch_exception (112);
- code_for_catch_exception (113);
- code_for_catch_exception (114);
- code_for_catch_exception (115);
- code_for_catch_exception (116);
- code_for_catch_exception (117);
- code_for_catch_exception (118);
- code_for_catch_exception (119);
- code_for_catch_exception (120);
- code_for_catch_exception (121);
- code_for_catch_exception (122);
- code_for_catch_exception (123);
- code_for_catch_exception (124);
- code_for_catch_exception (125);
- code_for_catch_exception (126);
- code_for_catch_exception (127);
-}
-
-/*
- * Port B Control Register (PBCR1)
- */
-#define PB15MD1 0x8000
-#define PB15MD0 0x4000
-#define PB14MD1 0x2000
-#define PB14MD0 0x1000
-#define PB13MD1 0x0800
-#define PB13MD0 0x0400
-#define PB12MD1 0x0200
-#define PB12MD0 0x0100
-#define PB11MD1 0x0080
-#define PB11MD0 0x0040
-#define PB10MD1 0x0020
-#define PB10MD0 0x0010
-#define PB9MD1 0x0008
-#define PB9MD0 0x0004
-#define PB8MD1 0x0002
-#define PB8MD0 0x0001
-
-#define PB15MD PB15MD1|PB14MD0
-#define PB14MD PB14MD1|PB14MD0
-#define PB13MD PB13MD1|PB13MD0
-#define PB12MD PB12MD1|PB12MD0
-#define PB11MD PB11MD1|PB11MD0
-#define PB10MD PB10MD1|PB10MD0
-#define PB9MD PB9MD1|PB9MD0
-#define PB8MD PB8MD1|PB8MD0
-
-#define PB_TXD1 PB11MD1
-#define PB_RXD1 PB10MD1
-#define PB_TXD0 PB9MD1
-#define PB_RXD0 PB8MD1
-
-#define PB7MD PB7MD1|PB7MD0
-#define PB6MD PB6MD1|PB6MD0
-#define PB5MD PB5MD1|PB5MD0
-#define PB4MD PB4MD1|PB4MD0
-#define PB3MD PB3MD1|PB3MD0
-#define PB2MD PB2MD1|PB2MD0
-#define PB1MD PB1MD1|PB1MD0
-#define PB0MD PB0MD1|PB0MD0
-
-
-void handleError (char theSSR);
-
-void nop (void)
-{
-}
-
-void init_serial (void)
-{
- int i;
-
- /* Clear Channel 1's SCR */
- SCR1 = 0;
-
- /* Set communication to be async, 8-bit data,
- no parity, 1 stop bit and use internal clock */
- SMR1 = 0;
-
-#ifdef RECORDER
- #warning 115200
- BRR1 = 2; /* 115200 */
-#else
- BRR1 = 9; /* 38400 */
-#endif
-
- SCR1 &= ~(SCI_CKE1 | SCI_CKE0);
-
- /* let the hardware settle */
- for (i = 0; i < 1000; i++)
- nop ();
-
- /* Turn on in and out */
- SCR1 |= SCI_RE | SCI_TE;
-
- /* Set the PFC to make RXD1 (pin PB8) an input pin
- and TXD1 (pin PB9) an output pin */
- PBCR1 &= ~(PB_TXD1 | PB_RXD1);
- PBCR1 |= PB_TXD1 | PB_RXD1;
-}
-
-
-int serial_waitc(void)
-{
- char mySSR;
- mySSR = SSR1 & ( SCI_PER | SCI_FER | SCI_ORER );
- if ( mySSR )
- handleError ( mySSR );
- return SSR1 & SCI_RDRF ;
-}
-
-char serial_getc (void)
-{
- char ch;
- char mySSR;
-
- while ( ! serial_waitc())
- ;
-
- ch = RDR1;
- SSR1 &= ~SCI_RDRF;
-
- mySSR = SSR1 & (SCI_PER | SCI_FER | SCI_ORER);
-
- if (mySSR)
- handleError (mySSR);
-
- return ch;
-}
-
-void serial_putc (char ch)
-{
- while (!(SSR1 & SCI_TDRE))
- {
- ;
- }
-
- /*
- * Write data into TDR and clear TDRE
- */
- TDR1 = ch;
- SSR1 &= ~SCI_TDRE;
-}
-
-void handleError (char theSSR)
-{
- /* Clear all error bits, otherwise the receiver will stop */
- SSR1 &= ~(SCI_ORER | SCI_PER | SCI_FER);
-}
-
-void *memcpy(void *dest, const void *src0, size_t n)
-{
- char *dst = (char *) dest;
- char *src = (char *) src0;
-
- void *save = dest;
-
- while(n--)
- {
- *dst++ = *src++;
- }
-
- return save;
-}
diff --git a/gdb/start.s b/gdb/start.s