At 09:04 14-04-05 -0400, you wrote:
>I'm not sure what opportunity you have had in FAT16 implementing, but I
have seen a
>couple of implementations and none were less than about 30k ROM space not
to mention the
>RAM requirements.  While 30k is not that big, it's huge when you consider
the entire ROM

I suppose these implementations use some sort of a filesystem approach. You
don't really need that.

First you'll need to know the block size, position of the first FAT and
where the root directory is. These pointers can al be 16 bit. This may take
parsing the partition table.

If you want to read a file, search the directory entries for it. This will
give you a pointer to the first element in the FAT which automatically
translates into an address space in the CF. Since the FAT is a linked list,
you can search through it until the last block is found.
This routine won't take more than say 32 bytes + sector size of the CF as a
buffer (I think one can use the memory of the CF device as a buffer as well).

Writing is a bit more tricky because you'll need to update 2 FATs (one
would need to pointers into both FATs and update them one by one with a
read-modify-write).

Here is some more interesting information:
http://www.freescale.com/files/32bit/doc/app_note/AN2417.pdf

And here is someone who implemented reading FAT16 in a PIC:
http://www.compuphase.com/mp3player_en.htm

Nico Coesel


Reply via email to