summaryrefslogtreecommitdiff
path: root/firmware/drivers/fat.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/fat.h')
-rw-r--r--firmware/drivers/fat.h19
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
25struct fat_direntry 27struct 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
55struct fat_file 58struct 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
63extern int fat_mount(int startsector); 68extern int fat_mount(int startsector);
64 69
65#ifdef DISK_WRITE
66extern int fat_create_file(unsigned int currdir, char *name);
67extern int fat_create_dir(unsigned int currdir, char *name); 70extern int fat_create_dir(unsigned int currdir, char *name);
68#endif
69extern int fat_startsector(void); 71extern int fat_startsector(void);
70extern int fat_open(unsigned int cluster, struct fat_file *ent); 72extern int fat_open(unsigned int cluster,
71extern int fat_read(struct fat_file *ent, int sectorcount, void* buf ); 73 struct fat_file* ent,
74 struct fat_dir* dir);
75extern int fat_create_file(char* name,
76 struct fat_file* ent,
77 struct fat_dir* dir);
78extern int fat_readwrite(struct fat_file *ent, int sectorcount,
79 void* buf, bool write );
80extern int fat_closewrite(struct fat_file *ent, int size);
72extern int fat_seek(struct fat_file *ent, int sector ); 81extern int fat_seek(struct fat_file *ent, int sector );
73 82
74extern int fat_opendir(struct fat_dir *ent, unsigned int currdir); 83extern int fat_opendir(struct fat_dir *ent, unsigned int currdir);