diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-12-29 22:10:24 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-12-29 22:10:24 +0000 |
commit | 1a5962f2be995b669f2cc3a49be33b3ecd8dede0 (patch) | |
tree | dd9f407265826fa02ed08cc12f9fd54a093e4ad8 /firmware/usb.c | |
parent | 5c631a1222c81bb075ec241621aa3626bd44c31a (diff) | |
download | rockbox-1a5962f2be995b669f2cc3a49be33b3ecd8dede0.tar.gz rockbox-1a5962f2be995b669f2cc3a49be33b3ecd8dede0.zip |
Shared mounting code, also more general. It will mount multiple HD partitions, too, once HAVE_MULTIVOLUME is enabled.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5518 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usb.c')
-rw-r--r-- | firmware/usb.c | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/firmware/usb.c b/firmware/usb.c index ab8e080c45..7060ccfe23 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -122,7 +122,6 @@ static void usb_enable(bool on) | |||
122 | static void usb_slave_mode(bool on) | 122 | static void usb_slave_mode(bool on) |
123 | { | 123 | { |
124 | int rc; | 124 | int rc; |
125 | struct partinfo* pinfo; | ||
126 | 125 | ||
127 | if(on) | 126 | if(on) |
128 | { | 127 | { |
@@ -135,7 +134,6 @@ static void usb_slave_mode(bool on) | |||
135 | } | 134 | } |
136 | else | 135 | else |
137 | { | 136 | { |
138 | int i; | ||
139 | DEBUGF("Leaving USB slave mode\n"); | 137 | DEBUGF("Leaving USB slave mode\n"); |
140 | 138 | ||
141 | /* Let the ISDx00 settle */ | 139 | /* Let the ISDx00 settle */ |
@@ -146,6 +144,7 @@ static void usb_slave_mode(bool on) | |||
146 | rc = ata_init(); | 144 | rc = ata_init(); |
147 | if(rc) | 145 | if(rc) |
148 | { | 146 | { |
147 | /* fixme: can we remove this? (already such in main.c) */ | ||
149 | char str[32]; | 148 | char str[32]; |
150 | lcd_clear_display(); | 149 | lcd_clear_display(); |
151 | snprintf(str, 31, "ATA error: %d", rc); | 150 | snprintf(str, 31, "ATA error: %d", rc); |
@@ -157,38 +156,10 @@ static void usb_slave_mode(bool on) | |||
157 | panicf("ata: %d",rc); | 156 | panicf("ata: %d",rc); |
158 | } | 157 | } |
159 | 158 | ||
160 | pinfo = disk_init(IF_MV(0)); | 159 | rc = disk_mount_all(); |
161 | if (!pinfo) | 160 | if (rc <= 0) /* no partition */ |
162 | panicf("disk: NULL"); | ||
163 | |||
164 | fat_init(); | ||
165 | for ( i=0; i<4; i++ ) { | ||
166 | rc = fat_mount(IF_MV2(0,) IF_MV2(0,) pinfo[i].start); | ||
167 | if (!rc) | ||
168 | break; /* only one partition gets mounted as of now */ | ||
169 | } | ||
170 | if (i==4) | ||
171 | panicf("mount: %d",rc); | 161 | panicf("mount: %d",rc); |
172 | #ifdef HAVE_MULTIVOLUME | ||
173 | /* mount partition on the optional volume */ | ||
174 | #ifdef HAVE_MMC | ||
175 | if (mmc_detect()) /* for Ondio, only if card detected */ | ||
176 | #endif | ||
177 | { | ||
178 | pinfo = disk_init(1); | ||
179 | if (pinfo) | ||
180 | { | ||
181 | for ( i=0; i<4; i++ ) { | ||
182 | if (!fat_mount(1, 1, pinfo[i].start)) | ||
183 | break; /* only one partition gets mounted as of now */ | ||
184 | } | ||
185 | 162 | ||
186 | if ( i==4 ) { | ||
187 | rc = fat_mount(1, 1, 0); | ||
188 | } | ||
189 | } | ||
190 | } | ||
191 | #endif /* #ifdef HAVE_MULTIVOLUME */ | ||
192 | } | 163 | } |
193 | } | 164 | } |
194 | 165 | ||