summaryrefslogtreecommitdiff
path: root/firmware/export/fat.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/fat.h')
-rw-r--r--firmware/export/fat.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/firmware/export/fat.h b/firmware/export/fat.h
index 6f9c9c5d11..7150d2b09f 100644
--- a/firmware/export/fat.h
+++ b/firmware/export/fat.h
@@ -21,6 +21,7 @@
21#define FAT_H 21#define FAT_H
22 22
23#include <stdbool.h> 23#include <stdbool.h>
24#include "ata.h" /* for volume definitions */
24 25
25#define SECTOR_SIZE 512 26#define SECTOR_SIZE 512
26 27
@@ -45,6 +46,7 @@ struct fat_direntry
45#define FAT_ATTR_VOLUME_ID 0x08 46#define FAT_ATTR_VOLUME_ID 0x08
46#define FAT_ATTR_DIRECTORY 0x10 47#define FAT_ATTR_DIRECTORY 0x10
47#define FAT_ATTR_ARCHIVE 0x20 48#define FAT_ATTR_ARCHIVE 0x20
49#define FAT_ATTR_VOLUME 0x40 /* this is a volume, not a real directory */
48 50
49struct fat_file 51struct fat_file
50{ 52{
@@ -57,6 +59,9 @@ struct fat_file
57 unsigned int direntries; /* number of dir entries used by this file */ 59 unsigned int direntries; /* number of dir entries used by this file */
58 unsigned int dircluster; /* first cluster of dir */ 60 unsigned int dircluster; /* first cluster of dir */
59 bool eof; 61 bool eof;
62#ifdef HAVE_MULTIVOLUME
63 int volume; /* file resides on which volume */
64#endif
60}; 65};
61 66
62struct fat_dir 67struct fat_dir
@@ -69,14 +74,16 @@ struct fat_dir
69}; 74};
70 75
71 76
72extern int fat_mount(int startsector); 77extern void fat_init(void);
73extern void fat_size(unsigned int* size, unsigned int* free); 78extern int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) int startsector);
74extern void fat_recalc_free(void); 79extern void fat_size(IF_MV2(int volume,) unsigned int* size, unsigned int* free); // public for info
80extern void fat_recalc_free(IF_MV_NONVOID(int volume)); // public for debug info screen
75extern int fat_create_dir(const char* name, 81extern int fat_create_dir(const char* name,
76 struct fat_dir* newdir, 82 struct fat_dir* newdir,
77 struct fat_dir* dir); 83 struct fat_dir* dir);
78extern int fat_startsector(void); 84extern int fat_startsector(IF_MV_NONVOID(int volume)); // public for config sector
79extern int fat_open(unsigned int cluster, 85extern int fat_open(IF_MV2(int volume,)
86 unsigned int cluster,
80 struct fat_file* ent, 87 struct fat_file* ent,
81 const struct fat_dir* dir); 88 const struct fat_dir* dir);
82extern int fat_create_file(const char* name, 89extern int fat_create_file(const char* name,
@@ -93,9 +100,11 @@ extern int fat_rename(struct fat_file* file,
93 const unsigned char* newname, 100 const unsigned char* newname,
94 int size, int attr); 101 int size, int attr);
95 102
96extern int fat_opendir(struct fat_dir *ent, unsigned int currdir, 103extern int fat_opendir(IF_MV2(int volume,)
104 struct fat_dir *ent, unsigned int currdir,
97 const struct fat_dir *parent_dir); 105 const struct fat_dir *parent_dir);
98extern int fat_getnext(struct fat_dir *ent, struct fat_direntry *entry); 106extern int fat_getnext(struct fat_dir *ent, struct fat_direntry *entry);
99extern int fat_get_cluster_size(void); 107extern int fat_get_cluster_size(IF_MV_NONVOID(int volume));
108extern bool fat_ismounted(int volume);
100 109
101#endif 110#endif