summaryrefslogtreecommitdiff
path: root/firmware/drivers/fat.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2010-04-03 22:02:09 +0000
committerFrank Gevaerts <frank@gevaerts.be>2010-04-03 22:02:09 +0000
commit376d8d577fe94a8dc8742deff5a7524aa1595e1c (patch)
tree4d76e5232d8b513a40f11588d0f6899d47336b49 /firmware/drivers/fat.c
parentba7501513a87433043a217a813c9147d004314a5 (diff)
downloadrockbox-376d8d577fe94a8dc8742deff5a7524aa1595e1c.tar.gz
rockbox-376d8d577fe94a8dc8742deff5a7524aa1595e1c.zip
Add IO priority handling. Currently all IO has equal priority, except the dircache scanning thread which is lower. This fixes the slow boot problem for me, with the added benefit that actual audio playback also starts faster.
Lots of the changes are due to changing storage_(read|write)sectors() from macros to wrapper functions. This means that they have to be called with IF_MD2(drive,) again. Flyspray: FS#11167 Author: Frank Gevaerts git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25459 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r--firmware/drivers/fat.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index ff2bebce92..f93b32f832 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -311,7 +311,7 @@ int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector)
311#endif 311#endif
312 312
313 /* Read the sector */ 313 /* Read the sector */
314 rc = storage_read_sectors(drive, startsector,1,buf); 314 rc = storage_read_sectors(IF_MD2(drive,) startsector,1,buf);
315 if(rc) 315 if(rc)
316 { 316 {
317 DEBUGF( "fat_mount() - Couldn't read BPB (error code %d)\n", rc); 317 DEBUGF( "fat_mount() - Couldn't read BPB (error code %d)\n", rc);
@@ -433,7 +433,7 @@ int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector)
433#endif /* #ifdef HAVE_FAT16SUPPORT */ 433#endif /* #ifdef HAVE_FAT16SUPPORT */
434 { 434 {
435 /* Read the fsinfo sector */ 435 /* Read the fsinfo sector */
436 rc = storage_read_sectors(drive, 436 rc = storage_read_sectors(IF_MD2(drive,)
437 startsector + fat_bpb->bpb_fsinfo, 1, buf); 437 startsector + fat_bpb->bpb_fsinfo, 1, buf);
438 if (rc < 0) 438 if (rc < 0)
439 { 439 {
@@ -618,7 +618,7 @@ static void flush_fat_sector(struct fat_cache_entry *fce,
618#endif 618#endif
619 619
620 /* Write to the first FAT */ 620 /* Write to the first FAT */
621 rc = storage_write_sectors(fce->fat_vol->drive, 621 rc = storage_write_sectors(IF_MD2(fce->fat_vol->drive,)
622 secnum, 1, 622 secnum, 1,
623 sectorbuf); 623 sectorbuf);
624 if(rc < 0) 624 if(rc < 0)
@@ -639,7 +639,7 @@ static void flush_fat_sector(struct fat_cache_entry *fce,
639#else 639#else
640 secnum += fat_bpbs[0].fatsize; 640 secnum += fat_bpbs[0].fatsize;
641#endif 641#endif
642 rc = storage_write_sectors(fce->fat_vol->drive, 642 rc = storage_write_sectors(IF_MD2(fce->fat_vol->drive,)
643 secnum, 1, sectorbuf); 643 secnum, 1, sectorbuf);
644 if(rc < 0) 644 if(rc < 0)
645 { 645 {
@@ -685,7 +685,7 @@ static void *cache_fat_sector(IF_MV2(struct bpb* fat_bpb,)
685 /* Load the sector if it is not cached */ 685 /* Load the sector if it is not cached */
686 if(!fce->inuse) 686 if(!fce->inuse)
687 { 687 {
688 rc = storage_read_sectors(fat_bpb->drive, 688 rc = storage_read_sectors(IF_MD2(fat_bpb->drive,)
689 secnum + fat_bpb->startsector,1, 689 secnum + fat_bpb->startsector,1,
690 sectorbuf); 690 sectorbuf);
691 if(rc < 0) 691 if(rc < 0)
@@ -944,7 +944,7 @@ static int update_fsinfo(IF_MV_NONVOID(struct bpb* fat_bpb))
944#endif /* #ifdef HAVE_FAT16SUPPORT */ 944#endif /* #ifdef HAVE_FAT16SUPPORT */
945 945
946 /* update fsinfo */ 946 /* update fsinfo */
947 rc = storage_read_sectors(fat_bpb->drive, 947 rc = storage_read_sectors(IF_MD2(fat_bpb->drive,)
948 fat_bpb->startsector + fat_bpb->bpb_fsinfo, 1,fsinfo); 948 fat_bpb->startsector + fat_bpb->bpb_fsinfo, 1,fsinfo);
949 if (rc < 0) 949 if (rc < 0)
950 { 950 {
@@ -957,7 +957,7 @@ static int update_fsinfo(IF_MV_NONVOID(struct bpb* fat_bpb))
957 intptr = (long*)&(fsinfo[FSINFO_NEXTFREE]); 957 intptr = (long*)&(fsinfo[FSINFO_NEXTFREE]);
958 *intptr = htole32(fat_bpb->fsinfo.nextfree); 958 *intptr = htole32(fat_bpb->fsinfo.nextfree);
959 959
960 rc = storage_write_sectors(fat_bpb->drive, 960 rc = storage_write_sectors(IF_MD2(fat_bpb->drive,)
961 fat_bpb->startsector + fat_bpb->bpb_fsinfo,1,fsinfo); 961 fat_bpb->startsector + fat_bpb->bpb_fsinfo,1,fsinfo);
962 if (rc < 0) 962 if (rc < 0)
963 { 963 {
@@ -2110,11 +2110,11 @@ static int transfer(IF_MV2(struct bpb* fat_bpb,)
2110 if (start + count > fat_bpb->totalsectors) 2110 if (start + count > fat_bpb->totalsectors)
2111 panicf("Write %ld after data\n", 2111 panicf("Write %ld after data\n",
2112 start + count - fat_bpb->totalsectors); 2112 start + count - fat_bpb->totalsectors);
2113 rc = storage_write_sectors(fat_bpb->drive, 2113 rc = storage_write_sectors(IF_MD2(fat_bpb->drive,)
2114 start + fat_bpb->startsector, count, buf); 2114 start + fat_bpb->startsector, count, buf);
2115 } 2115 }
2116 else 2116 else
2117 rc = storage_read_sectors(fat_bpb->drive, 2117 rc = storage_read_sectors(IF_MD2(fat_bpb->drive,)
2118 start + fat_bpb->startsector, count, buf); 2118 start + fat_bpb->startsector, count, buf);
2119 if (rc < 0) { 2119 if (rc < 0) {
2120 DEBUGF( "transfer() - Couldn't %s sector %lx" 2120 DEBUGF( "transfer() - Couldn't %s sector %lx"