diff options
Diffstat (limited to 'firmware/drivers')
| -rw-r--r-- | firmware/drivers/fat.c | 8 | ||||
| -rw-r--r-- | firmware/drivers/fat.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index ad1a7a0..38223ed 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c @@ -223,6 +223,14 @@ int fat_startsector(void) return fat_bpb.startsector; } +void fat_size(unsigned int* size, unsigned int* free) +{ + if (size) + *size = fat_bpb.dataclusters * fat_bpb.bpb_secperclus / 2; + if (free) + *free = fat_bpb.fsinfo.freecount * fat_bpb.bpb_secperclus / 2; +} + int fat_mount(int startsector) { unsigned char buf[SECTOR_SIZE]; diff --git a/firmware/drivers/fat.h b/firmware/drivers/fat.h index b23d8df..8ef2982 100644 --- a/firmware/drivers/fat.h +++ b/firmware/drivers/fat.h @@ -67,6 +67,7 @@ struct fat_dir extern int fat_mount(int startsector); +extern void fat_size(unsigned int* size, unsigned int* free); extern int fat_create_dir(unsigned int currdir, char *name); extern int fat_startsector(void); |