From da848576312800dc229624e928d132d0702c1854 Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Tue, 28 Dec 2004 22:16:07 +0000 Subject: prepared to mount multiple partitions into one logical file system (most useful for Ondio, internal memory + external MMC) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5514 a1c6a512-1295-4272-9138-f99709370657 --- apps/main.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'apps/main.c') diff --git a/apps/main.c b/apps/main.c index ac84027362..572e0a3114 100644 --- a/apps/main.c +++ b/apps/main.c @@ -101,6 +101,9 @@ int main(void) #ifdef CONFIG_TUNER #include "radio.h" #endif +#ifdef HAVE_MMC +#include "ata_mmc.h" +#endif /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ @@ -236,7 +239,8 @@ void init(void) usb_start_monitoring(); - pinfo = disk_init(); + /* FixMe: the same kind of mounting happens in usb.c, share the code. */ + pinfo = disk_init(IF_MV(0)); if (!pinfo) { lcd_clear_display(); @@ -252,14 +256,15 @@ void init(void) system_reboot(); } + fat_init(); for ( i=0; i<4; i++ ) { - if (!fat_mount(pinfo[i].start)) - break; + if (!fat_mount(IF_MV2(0,) IF_MV2(0,) pinfo[i].start)) + break; /* only one partition gets mounted as of now */ } if ( i==4 ) { DEBUGF("No partition found, trying to mount sector 0.\n"); - rc = fat_mount(0); + rc = fat_mount(IF_MV2(0,) IF_MV2(0,) 0); if(rc) { lcd_clear_display(); lcd_puts(0,0,"No FAT32"); @@ -272,7 +277,26 @@ void init(void) /* The USB thread will panic if the drive still can't be mounted */ } } - +#ifdef HAVE_MULTIVOLUME + /* mount partition on the optional volume */ +#ifdef HAVE_MMC + if (mmc_detect()) /* for Ondio, only if card detected */ +#endif + { + pinfo = disk_init(1); + if (pinfo) + { + for ( i=0; i<4; i++ ) { + if (!fat_mount(1, 1, pinfo[i].start)) + break; /* only one partition gets mounted as of now */ + } + + if ( i==4 ) { + rc = fat_mount(1, 1, 0); + } + } + } +#endif /* #ifdef HAVE_MULTIVOLUME */ settings_calc_config_sector(); settings_load(SETTINGS_ALL); settings_apply(); -- cgit v1.2.3