diff options
Diffstat (limited to 'firmware/drivers/fat.h')
-rw-r--r-- | firmware/drivers/fat.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/firmware/drivers/fat.h b/firmware/drivers/fat.h index b60b3d4164..a7c73c53fe 100644 --- a/firmware/drivers/fat.h +++ b/firmware/drivers/fat.h | |||
@@ -20,7 +20,7 @@ | |||
20 | #ifndef FAT_H | 20 | #ifndef FAT_H |
21 | #define FAT_H | 21 | #define FAT_H |
22 | 22 | ||
23 | #define BLOCK_SIZE 512 | 23 | #define SECTOR_SIZE 512 |
24 | 24 | ||
25 | struct bpb | 25 | struct bpb |
26 | { | 26 | { |
@@ -71,12 +71,12 @@ struct fat_direntry | |||
71 | unsigned short crttime; /* Creation time */ | 71 | unsigned short crttime; /* Creation time */ |
72 | unsigned short crtdate; /* Creation date */ | 72 | unsigned short crtdate; /* Creation date */ |
73 | unsigned short lstaccdate; /* Last access date */ | 73 | unsigned short lstaccdate; /* Last access date */ |
74 | unsigned short fstclushi; /* High word of first cluster | ||
75 | (0 for FAT12/16) */ | ||
76 | unsigned short wrttime; /* Last write time */ | 74 | unsigned short wrttime; /* Last write time */ |
77 | unsigned short wrtdate; /* Last write date */ | 75 | unsigned short wrtdate; /* Last write date */ |
78 | unsigned short fstcluslo; /* Low word of first cluster */ | ||
79 | unsigned int filesize; /* File size in bytes */ | 76 | unsigned int filesize; /* File size in bytes */ |
77 | unsigned short fstclusterlo; | ||
78 | unsigned short fstclusterhi; | ||
79 | int firstcluster; /* fstclusterhi<<16 + fstcluslo */ | ||
80 | }; | 80 | }; |
81 | 81 | ||
82 | #define FAT_ATTR_READ_ONLY 0x01 | 82 | #define FAT_ATTR_READ_ONLY 0x01 |
@@ -91,7 +91,15 @@ struct fat_dirent | |||
91 | int entry; | 91 | int entry; |
92 | unsigned int cached_sec; | 92 | unsigned int cached_sec; |
93 | unsigned int num_sec; | 93 | unsigned int num_sec; |
94 | char cached_buf[BLOCK_SIZE]; | 94 | char cached_buf[SECTOR_SIZE]; |
95 | }; | ||
96 | |||
97 | struct fat_fileent | ||
98 | { | ||
99 | int firstcluster; /* first cluster in file */ | ||
100 | int nextcluster; /* cluster of last access */ | ||
101 | int nextsector; /* sector of last access */ | ||
102 | int sectornum; /* sector number in this cluster */ | ||
95 | }; | 103 | }; |
96 | 104 | ||
97 | extern int fat_create_file(struct bpb *bpb, | 105 | extern int fat_create_file(struct bpb *bpb, |
@@ -100,6 +108,14 @@ extern int fat_create_file(struct bpb *bpb, | |||
100 | extern int fat_create_dir(struct bpb *bpb, | 108 | extern int fat_create_dir(struct bpb *bpb, |
101 | unsigned int currdir, | 109 | unsigned int currdir, |
102 | char *name); | 110 | char *name); |
111 | extern int fat_open(struct bpb *bpb, | ||
112 | unsigned int cluster, | ||
113 | struct fat_fileent *ent); | ||
114 | extern int fat_read(struct bpb *bpb, | ||
115 | struct fat_fileent *ent, | ||
116 | int sectorcount, | ||
117 | void* buf ); | ||
118 | |||
103 | extern int fat_opendir(struct bpb *bpb, | 119 | extern int fat_opendir(struct bpb *bpb, |
104 | struct fat_dirent *ent, | 120 | struct fat_dirent *ent, |
105 | unsigned int currdir); | 121 | unsigned int currdir); |