VLSI Solution Oy VLSI Solution Oy Evaluation MP3 Player Source Code Documentation

Main Page | Class List | File List | Class Members | File Members | Related Pages

VLSIModularPlayer Documentation

0.6BetaRelease44

This is a preliminary version of the new MP3 player evaluation kit source code. Some bugs still exist.

This is pure C code. No inline assembly. It compiles with SDCC 2.4.0. Upload with Atmel Flip. Connect a terminal with settings 115200bps,N81 to the serial port to see the console output.

The code is written for VLSI Evakit 1.5-1.6 that has VS1011/1002 and AT89C51RD2 microcontroller. Now also Evakit 2.0-2.5 with VS1011, VS1002 or VS1003 is supported. It should be easily portable for other microcontrollers.

All microcontroller/pcb -specific definitions should be in board.h and board.c but some board specific features may still lurk in the code elsewhere. Due to SDCC requirements, interrupts are defined in player.c (main file). They are of course board/cpu dependent.

Throughout the code, SDCC memory allocation pragmas "code" "data" and "xdata" are used, sorry. "Code" allocates from ROM, "data" allocates from fast RAM, "xdata" allocates from slow RAM. You may need to remove/adjust these to make code compatible with your compiler.

It is strongly suggested that you use the free SDCC 2.4.0 to compile the code. SDCC 2.5.0 fails to compile the code: Although it has advantages over v2.4, it tries to allocate more extra temporary memory than is available if you compile all the modules (incl. recording).

How to get started

The description of how the program works and the module structure will be written here soon. Please check http://www.vlsi.fi/ often to see if the final code is released. Email to mp3@vlsi.fi about bugs.

Changes in version 0.5:

Filesystem and Storage are affected. Code has been added to handle new MMC cards with manufacturer id 21 and possibly others that seem to (sometimes) require resetting CRC calculation before they agree to work. Storage.c is divided into submodules storage.c and mmc.c and a new file buffer.c is created to hold the global I/O buffer. This clarifies the code a lot. Lots of documentation is added to MMC and filing system functions, do yourself a favor and read it through.

In storage.c, mmc.c and filesys.c a "dummy" declarator Public is added in declarations for functions that are called from outside the module and thus form module interface. It has no code effect in C but is a reminder for the programmer that the functions need to be adjusted carefully.

Storage.c is now a "middle-level" disk handler that takes advantage of lower level functions in mmc.c. It handles decisions of when to seek based on testing whether the underlying storage module supports separate seeks before reads. A new function PrepareToReadDiskSector() is for telling the storage that it can do a seek now if the storage supports it.

Adding support for different storage media that MMC is easy: only mmc.c needs to be rewritten. Currently it only has 3 public functions: Init, Seek sector and Read sector. As the code uses ONLY the address granularity of 512 bytes, called a "disk sector", supporting hard disks etc should be very simple.

Support for compiling under Windows:

The code is natively developed under Linux and Makefile for GNU Make is included. Now also .bat files for compiling in Dos window under Win32 are included, plus a readme.txt file. Use them at your own risk :)

Changes in version 0.6

The major improvement is adding recording support. Recording for VS1003 is supported. See the Record() function documentation for instructions. The Record() function can only create a single file fragment. If a fragment boundary is reached, recording continues to a new file. Also there is an experimental function PlayAVI() in module aviplay.c that often succeeds in demuxing an avifile and sending just the audio stream for decoding.

Much of the FAT code is rewritten for speedups.

Todo:
VFAT long file names,
Remarks:
If you are usind SDCC 2.4.0 and you need just a little bit of more DSEG memory (now how on Earth that might happen...) you can hand-allocate global variables to unused addresses 0x08..0x1F, for instance: declaring
 data at 0x08 unsigned int myVariable;
 
would place myVariable in DSEG addresses 0x08..0x09.
Note for HyperTerminal users: Check the "Append Line Feeds" checkbox in terminal settings -> ascii setup.

Example output to console: When the code runs it prints out something like: (from a little older version)

 Board: Console is up.
 Init: Board; supports: AT89C51RD2, MMC, VS10xx, RS232

 VLSI Modular Player
 Starting up.

 Init: Filesystem; supports: MBR, FAT16, FAT32
 Trying to bring up storage...
 Init: Storage v2: supports: MMC,SD,miniSD in SPI mode
 Init: MMC
 Card found, starting... Ok.

 MMC Manufacturer#: 30 Product Name: MMC    Production date: 10 / 2004
 Media serial number: 00000468
 This MMC has no support for interrupted read. Using compatibility mode.
 Storage initialized in seek-and-read mode.
 Storage ok.
 Sector 0 read...ok.
 Sector signature...ok.
 Partition 1... at sector 00000020
 Formatter signature: j!BFIHC
 Bytes per sector:    512
 Bytes per sector:    512
 Reserved sectors:    1
 Number of FATs:      2
 Root entries:        512
 Total Sectors 16:    0
 Fat Size 16:         123
 Hidden Sectors:      32
 Total Sectors 32:    125408
 File system is FAT16
 File system signature is FAT16
 Volume Label is NO NAME
 Sectors per Cluster: 4
 FAT Start sector:    33
 Root start sector:   279
 Data start sector:   303

 Init: VS10XX
 Loading patch.

 Filesystem: Looking for file 1 ... found, FAT name is "UTOPIA~1MP3"
 File size: 1471792 bytes. Start cluster: 0003h, sector 315 decimal.
 Building file fragment table...
 Fragment Start: 315  Fragment End: 3190  Fragment length: 2876

 Fragments: 1
 Player: Playing from sector 315

 
...and so on.
All software copyright 2000-2004 VLSI Solution OY. Redistribution of these software modules are limited to promotional use only and only with the VS1011 / VS1002 / VS1003 MP3-Evakit evaluation boards. Free or commercial use of these software modules in MP3 players is ok if the product includes MP3 decoder chip(s) from VLSI. You can request the complete (compilable) package from mp3@vlsi.fi