diff options
| author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-12-28 22:16:07 +0000 |
|---|---|---|
| committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-12-28 22:16:07 +0000 |
| commit | da848576312800dc229624e928d132d0702c1854 (patch) | |
| tree | 38cd01b8a9c1069a1de734e0f7eb478436715573 /apps | |
| parent | ae45d970d874217b779071b414dcd5edbf5647da (diff) | |
| download | rockbox-da848576312800dc229624e928d132d0702c1854.zip rockbox-da848576312800dc229624e928d132d0702c1854.tar.gz rockbox-da848576312800dc229624e928d132d0702c1854.tar.bz2 rockbox-da848576312800dc229624e928d132d0702c1854.tar.xz | |
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
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/main.c | 34 | ||||
| -rw-r--r-- | apps/main_menu.c | 2 | ||||
| -rw-r--r-- | apps/settings.c | 5 | ||||
| -rw-r--r-- | apps/tree.c | 7 | ||||
| -rw-r--r-- | apps/tree.h | 2 |
5 files changed, 40 insertions, 10 deletions
diff --git a/apps/main.c b/apps/main.c index ac84027..572e0a3 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(); diff --git a/apps/main_menu.c b/apps/main_menu.c index 1c27f75..68e2a03 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c @@ -146,7 +146,7 @@ bool show_info(void) int state = 1; unsigned int size, free; - fat_size( &size, &free ); + fat_size( IF_MV2(0,) &size, &free ); size /= 1024; free /= 1024; diff --git a/apps/settings.c b/apps/settings.c index ff9c57d..d4945d4 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -513,8 +513,7 @@ static int load_config_buffer(int which) if (which & SETTINGS_HD) { if (config_sector != 0) { - ata_read_sectors( config_sector, 1, config_block); - + ata_read_sectors(IF_MV2(0,) config_sector, 1, config_block); /* calculate the checksum, check it and the header */ chksum = calculate_config_checksum(config_block); @@ -623,7 +622,7 @@ void settings_calc_config_sector(void) int i, partition_start; int sector = 0; - if (fat_startsector() != 0) /* There is a partition table */ + if (fat_startsector(IF_MV(0)) != 0) /* There is a partition table */ { sector = 61; for (i = 0; i < 4; i++) diff --git a/apps/tree.c b/apps/tree.c index 87a0392..71af90f 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -302,6 +302,13 @@ static int compare(const void* p1, const void* p2) if (e1->attr & ATTR_DIRECTORY && e2->attr & ATTR_DIRECTORY) { /* two directories */ criteria = global_settings.sort_dir; + if (e1->attr & ATTR_VOLUME || e2->attr & ATTR_VOLUME) + { /* a volume identifier is involved */ + if (e1->attr & ATTR_VOLUME && e2->attr & ATTR_VOLUME) + criteria = 0; /* two volumes: sort alphabetically */ + else /* only one is a volume: volume first */ + return (e2->attr & ATTR_VOLUME) - (e1->attr & ATTR_VOLUME); + } } else if (!(e1->attr & ATTR_DIRECTORY) && !(e2->attr & ATTR_DIRECTORY)) { /* two files */ diff --git a/apps/tree.h b/apps/tree.h index c2606e1..f22163a 100644 --- a/apps/tree.h +++ b/apps/tree.h @@ -108,7 +108,7 @@ struct filetype { }; -/* using attribute bits not used by FAT (FAT uses lower 6) */ +/* using attribute bits not used by FAT (FAT uses lower 7) */ #define TREE_ATTR_THUMBNAIL 0x0080 /* corresponding .talk file exists */ |