diff options
Diffstat (limited to 'firmware/drivers/fat.h')
-rw-r--r-- | firmware/drivers/fat.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/firmware/drivers/fat.h b/firmware/drivers/fat.h index 836d5c6866..3052488c5a 100644 --- a/firmware/drivers/fat.h +++ b/firmware/drivers/fat.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef FAT_H | 20 | #ifndef FAT_H |
21 | #define FAT_H | 21 | #define FAT_H |
22 | 22 | ||
23 | #include <stdbool.h> | ||
24 | |||
23 | #define SECTOR_SIZE 512 | 25 | #define SECTOR_SIZE 512 |
24 | 26 | ||
25 | struct fat_direntry | 27 | struct fat_direntry |
@@ -50,6 +52,7 @@ struct fat_dir | |||
50 | int cached_sec; | 52 | int cached_sec; |
51 | int num_sec; | 53 | int num_sec; |
52 | unsigned char cached_buf[SECTOR_SIZE]; | 54 | unsigned char cached_buf[SECTOR_SIZE]; |
55 | int startcluster; | ||
53 | }; | 56 | }; |
54 | 57 | ||
55 | struct fat_file | 58 | struct fat_file |
@@ -58,17 +61,23 @@ struct fat_file | |||
58 | int nextcluster; /* cluster of last access */ | 61 | int nextcluster; /* cluster of last access */ |
59 | int nextsector; /* sector of last access */ | 62 | int nextsector; /* sector of last access */ |
60 | int sectornum; /* sector number in this cluster */ | 63 | int sectornum; /* sector number in this cluster */ |
64 | int dirsector; /* sector where the dir entry is located */ | ||
65 | int direntry; /* dir entry index in sector */ | ||
61 | }; | 66 | }; |
62 | 67 | ||
63 | extern int fat_mount(int startsector); | 68 | extern int fat_mount(int startsector); |
64 | 69 | ||
65 | #ifdef DISK_WRITE | ||
66 | extern int fat_create_file(unsigned int currdir, char *name); | ||
67 | extern int fat_create_dir(unsigned int currdir, char *name); | 70 | extern int fat_create_dir(unsigned int currdir, char *name); |
68 | #endif | ||
69 | extern int fat_startsector(void); | 71 | extern int fat_startsector(void); |
70 | extern int fat_open(unsigned int cluster, struct fat_file *ent); | 72 | extern int fat_open(unsigned int cluster, |
71 | extern int fat_read(struct fat_file *ent, int sectorcount, void* buf ); | 73 | struct fat_file* ent, |
74 | struct fat_dir* dir); | ||
75 | extern int fat_create_file(char* name, | ||
76 | struct fat_file* ent, | ||
77 | struct fat_dir* dir); | ||
78 | extern int fat_readwrite(struct fat_file *ent, int sectorcount, | ||
79 | void* buf, bool write ); | ||
80 | extern int fat_closewrite(struct fat_file *ent, int size); | ||
72 | extern int fat_seek(struct fat_file *ent, int sector ); | 81 | extern int fat_seek(struct fat_file *ent, int sector ); |
73 | 82 | ||
74 | extern int fat_opendir(struct fat_dir *ent, unsigned int currdir); | 83 | extern int fat_opendir(struct fat_dir *ent, unsigned int currdir); |