sgdk
fat16.h
Go to the documentation of this file.
00001 
00010 #ifndef _FAT16_H
00011 #define _FAT16_H
00012 
00013 
00014 #if (MODULE_FAT16 != 0)
00015 
00016 #define FAT16_DIR_SIZE 32
00017 #define FAT16_TYPE_FILE  0x20
00018 #define FAT16_TYPE_DIR  0x10
00019 
00020 
00021 typedef struct {
00022     u8 pointer[3]; //0
00023     u8 oem_name[8]; //3
00024     u16 byte_per_sector; //11
00025     u8 sector_per_cluster; //13
00026     u16 reserved_sectors; //14
00027     u8 fat_copys; //16
00028     u16 root_size; //17
00029     u16 small_partition_sectros; //19
00030     u8 drive_type; //21
00031     u16 sectors_per_fat; //22
00032     u16 sectors_per_track; //24
00033     u16 heads; //26
00034     u32 first_reserved_sectors; //28
00035     u32 total_partition_sectors; //32
00036     u16 drive_number; //36
00037     u8 extendet_boot_signature; //38
00038     u32 serial_number; //39
00039     u8 drive_name[11]; //43
00040     u8 fat_name[8]; //54
00041 } Fat16PBR;
00042 
00043 
00044 typedef struct {
00045     u8 name[14];
00046     u8 long_name[38];
00047     u8 flags;
00048     u16 entry;
00049     u32 size;
00050     u32 rec_addr;
00051 } Fat16Record;
00052 
00053 typedef struct {
00054     Fat16Record records[FAT16_DIR_SIZE];
00055     u16 entry;
00056     volatile u16 size;
00057 } Fat16Dir;
00058 
00059 typedef struct {
00060     Fat16Record *record;
00061     u8 sectror_buff[512];
00062     u16 cluster;
00063     u32 pos;
00064     u32 addr_buff;
00065     u8 sector;
00066 } Fat16File;
00067 
00068 
00069 extern Fat16PBR fat16_pbr;
00070 
00071 
00072 u8 fat16Init();
00073 u8 fat16OpenDir(u16 entry, Fat16Dir *dir);
00074 u8 fat16OpenFile(Fat16Record *rec, Fat16File *file);
00075 u8 fat16ReadNextSector(Fat16File *file);
00076 u8 fat16WriteNextSector(Fat16File *file);
00077 u8 fat16DeleteRecord(Fat16Record *rec);
00078 u8 fat16CreateRecord(Fat16Record *rec, Fat16Dir *dir);
00079 u8 fat16SkipSectors(Fat16File *file, u16 num);
00080 
00081 #endif  /* MODULE_FAT16 */
00082 
00083 
00084 #endif  /* _FAT16_H */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines