SGDK
A free and open development kit for the Sega Mega Drive
Loading...
Searching...
No Matches
fat16.h
Go to the documentation of this file.
1
9
10#ifndef _FAT16_H
11#define _FAT16_H
12
13
14#if (MODULE_FAT16 != 0)
15
16#define FAT16_DIR_SIZE 32
17#define FAT16_TYPE_FILE 0x20
18#define FAT16_TYPE_DIR 0x10
19
20
21typedef struct {
22 u8 pointer[3]; //0
23 u8 oem_name[8]; //3
24 u16 byte_per_sector; //11
25 u8 sector_per_cluster; //13
26 u16 reserved_sectors; //14
27 u8 fat_copys; //16
28 u16 root_size; //17
29 u16 small_partition_sectros; //19
30 u8 drive_type; //21
31 u16 sectors_per_fat; //22
32 u16 sectors_per_track; //24
33 u16 heads; //26
34 u32 first_reserved_sectors; //28
35 u32 total_partition_sectors; //32
36 u16 drive_number; //36
37 u8 extendet_boot_signature; //38
38 u32 serial_number; //39
39 u8 drive_name[11]; //43
40 u8 fat_name[8]; //54
41} Fat16PBR;
42
43
44typedef struct {
45 u8 name[14];
46 u8 long_name[38];
47 u8 flags;
48 u16 entry;
49 u32 size;
50 u32 rec_addr;
51} Fat16Record;
52
53typedef struct {
54 Fat16Record records[FAT16_DIR_SIZE];
55 u16 entry;
56 volatile u16 size;
57} Fat16Dir;
58
59typedef struct {
60 Fat16Record *record;
61 u8 sectror_buff[512];
62 u16 cluster;
63 u32 pos;
64 u32 addr_buff;
65 u8 sector;
66} Fat16File;
67
68
69extern Fat16PBR fat16_pbr;
70
71
72u8 fat16Init();
73u8 fat16OpenDir(u16 entry, Fat16Dir *dir);
74u8 fat16OpenFile(Fat16Record *rec, Fat16File *file);
75u8 fat16ReadNextSector(Fat16File *file);
76u8 fat16WriteNextSector(Fat16File *file);
77u8 fat16DeleteRecord(Fat16Record *rec);
78u8 fat16CreateRecord(Fat16Record *rec, Fat16Dir *dir);
79u8 fat16SkipSectors(Fat16File *file, u16 num);
80
81#endif /* MODULE_FAT16 */
82
83
84#endif /* _FAT16_H */
unsigned long u32
Definition types.h:105
unsigned short u16
Definition types.h:100
unsigned char u8
Definition types.h:95