diff options
Diffstat (limited to 'firmware/common')
-rw-r--r-- | firmware/common/disk.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/firmware/common/disk.c b/firmware/common/disk.c index 3c1f01cc61..a9fd346728 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c | |||
@@ -61,9 +61,18 @@ static int vol_drive[NUM_VOLUMES]; /* mounted to which drive (-1 if none) */ | |||
61 | static struct mutex disk_mutex; | 61 | static struct mutex disk_mutex; |
62 | 62 | ||
63 | #ifdef MAX_LOG_SECTOR_SIZE | 63 | #ifdef MAX_LOG_SECTOR_SIZE |
64 | int disk_sector_multiplier = 1; | 64 | static int disk_sector_multiplier[NUM_DRIVES] = {1}; |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | int disk_get_sector_multiplier(IF_MD_NONVOID(int drive)) | ||
68 | { | ||
69 | #ifdef HAVE_MULTIDRIVE | ||
70 | return disk_sector_multiplier[drive]; | ||
71 | #else | ||
72 | return disk_sector_multiplier[0]; | ||
73 | #endif | ||
74 | } | ||
75 | |||
67 | struct partinfo* disk_init(IF_MD_NONVOID(int drive)) | 76 | struct partinfo* disk_init(IF_MD_NONVOID(int drive)) |
68 | { | 77 | { |
69 | int i; | 78 | int i; |
@@ -174,6 +183,7 @@ int disk_mount(int drive) | |||
174 | 183 | ||
175 | volume = get_free_volume(); | 184 | volume = get_free_volume(); |
176 | pinfo = disk_init(IF_MD(drive)); | 185 | pinfo = disk_init(IF_MD(drive)); |
186 | disk_sector_multiplier[drive] = 1; | ||
177 | 187 | ||
178 | if (pinfo == NULL) | 188 | if (pinfo == NULL) |
179 | { | 189 | { |
@@ -206,7 +216,7 @@ int disk_mount(int drive) | |||
206 | vol_drive[volume] = drive; /* remember the drive for this volume */ | 216 | vol_drive[volume] = drive; /* remember the drive for this volume */ |
207 | volume = get_free_volume(); /* prepare next entry */ | 217 | volume = get_free_volume(); /* prepare next entry */ |
208 | if (drive == 0) | 218 | if (drive == 0) |
209 | disk_sector_multiplier = j; | 219 | disk_sector_multiplier[drive] = j; |
210 | break; | 220 | break; |
211 | } | 221 | } |
212 | } | 222 | } |
@@ -226,7 +236,7 @@ int disk_mount(int drive) | |||
226 | if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) 0)) | 236 | if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) 0)) |
227 | { | 237 | { |
228 | #ifdef MAX_LOG_SECTOR_SIZE | 238 | #ifdef MAX_LOG_SECTOR_SIZE |
229 | disk_sector_multiplier = fat_get_bytes_per_sector(IF_MV(volume))/SECTOR_SIZE; | 239 | disk_sector_multiplier[drive] = fat_get_bytes_per_sector(IF_MV(volume))/SECTOR_SIZE; |
230 | #endif | 240 | #endif |
231 | mounted = 1; | 241 | mounted = 1; |
232 | vol_drive[volume] = drive; /* remember the drive for this volume */ | 242 | vol_drive[volume] = drive; /* remember the drive for this volume */ |