diff options
author | Michael Sparmann <theseven@rockbox.org> | 2011-01-02 22:28:22 +0000 |
---|---|---|
committer | Michael Sparmann <theseven@rockbox.org> | 2011-01-02 22:28:22 +0000 |
commit | 7fea1369034f4c10b22365e34493d4151e793fac (patch) | |
tree | de734cc78103dea6c873113c166e8cddd59f36d9 /firmware | |
parent | 886e97221bc6105057116a6a7303b15710c9e06f (diff) |
Autodetect sector size on superfloppy volumes based on the FAT32 BPB (kudos to Frank Gevaerts)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28946 a1c6a512-1295-4272-9138-f99709370657
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 400d21f359..a23d51dbb8 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 a99341d58f..f055f4b170 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 5df5dc4b91..36beda711d 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 */ |