summaryrefslogtreecommitdiff
path: root/firmware/common/disk.c
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-12-15 17:07:19 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-12-15 17:07:19 +0000
commit3a6e3c254e5518c110ecaededebc26c5ae431552 (patch)
tree0557d685bd97778bf7d7cda0f9b307af1e20a900 /firmware/common/disk.c
parent39148be8ac62d5e2d43f207dcccf2426eaa97310 (diff)
downloadrockbox-3a6e3c254e5518c110ecaededebc26c5ae431552.tar.gz
rockbox-3a6e3c254e5518c110ecaededebc26c5ae431552.zip
Add support for for per-drive logical sector size. This allows targets to have a different logical sector size for the internal storage and the sd card, like on the fuze+ for example.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31270 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common/disk.c')
-rw-r--r--firmware/common/disk.c16
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) */
61static struct mutex disk_mutex; 61static struct mutex disk_mutex;
62 62
63#ifdef MAX_LOG_SECTOR_SIZE 63#ifdef MAX_LOG_SECTOR_SIZE
64int disk_sector_multiplier = 1; 64static int disk_sector_multiplier[NUM_DRIVES] = {1};
65#endif 65#endif
66 66
67int 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
67struct partinfo* disk_init(IF_MD_NONVOID(int drive)) 76struct 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 */