Author Topic: FAT module from Jan Axelson's book "usb mass storage" FAT16 --> FAT32  (Read 21430 times)

ehenkes

  • Member
  • ***
  • Posts: 5
Jan Axelson's "usb mass storage" is a great book helping me in completing my hobby OS! I love it. However, I have to transfer the FAT16 modules to FAT16 and FAT32 because most sticks today are formatted with FAT32, if you buy them, and FAT16 ends with 2 GB.

Is there a link to this code adapted to FAT32? I am fighting with the Cache_File_Entry(...), fileFind(...). and fillFileObject(...).

FAT32 uses the root dir like a file (with a cluster chain in the FAT). 

Any help would be highly appreciated.

« Last Edit: June 01, 2010, 01:26:12 pm by ehenkes »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
The code examples in USB Mass Storage are from Microchip's USB Framework. Microchip's current code supports FAT16 and FAT32 and thus may be helpful to you:

Microchip Applications Library

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en547784

Jan

ehenkes

  • Member
  • ***
  • Posts: 5
Thank you very much for this download link. A lot of interesting material included.  :)
File/Directory/FAT source code: FSIO.h/FSIO.c at ...\Microchip Solutions\Microchip\MDD File System\...

I would like to propose to explain in the book the difference between FAT16 and FAT32 root directory. At a FAT32 volume this entity is handled like a normal file in the data area with its own FAT cluster chain starting at first cluster that is typically cluster number 2. ;)
« Last Edit: June 01, 2010, 06:24:28 pm by ehenkes »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
That's a good point. Thanks for the suggestion.

Jan

ehenkes

  • Member
  • ***
  • Posts: 5
Microchip's USB Framework code is very helpful to get an overview, but the the code style is not homogeneous enough (e.g. return values, no C99 style, lot of unnecessary temporary variables). It also works for FAT12 usb msd. You can produce such by copying Floppy images to the stick with dd.