diff options
Diffstat (limited to 'firmware')
| -rw-r--r-- | firmware/common/disk.c | 3 | ||||
| -rw-r--r-- | firmware/drivers/fat.c | 13 | ||||
| -rw-r--r-- | firmware/export/fat.h | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/firmware/common/disk.c b/firmware/common/disk.c index 400d21f..a23d51d 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c @@ -223,6 +223,9 @@ int disk_mount(int drive) DEBUGF("No partition found, trying to mount sector 0.\n"); if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) 0)) { +#ifdef MAX_LOG_SECTOR_SIZE + disk_sector_multiplier = fat_get_bytes_per_sector(IF_MV(volume))/SECTOR_SIZE; +#endif mounted = 1; vol_drive[volume] = drive; /* remember the drive for this volume */ } diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index a99341d..f055f4b 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c @@ -448,6 +448,19 @@ static int fat_mount_internal(IF_MV2(int volume,) IF_MD2(int drive,) long starts return 0; } +#ifdef MAX_LOG_SECTOR_SIZE +int fat_get_bytes_per_sector(IF_MV_NONVOID(int volume)) +{ +#ifdef HAVE_MULTIVOLUME + if(!fat_bpbs[volume].mounted) + return 0; + return fat_bpbs[volume].bpb_bytspersec; +#else + return fat_bpbs[0].bpb_bytspersec; +#endif +} +#endif + int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector) { #ifndef HAVE_MULTIVOLUME diff --git a/firmware/export/fat.h b/firmware/export/fat.h index 5df5dc4..36beda7 100644 --- a/firmware/export/fat.h +++ b/firmware/export/fat.h @@ -99,6 +99,7 @@ extern void fat_unlock(void); #endif extern void fat_init(void); +extern int fat_get_bytes_per_sector(IF_MV_NONVOID(int volume)); extern int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector); extern int fat_unmount(int volume, bool flush); extern void fat_size(IF_MV2(int volume,) /* public for info */ |