1
0
Fork 0
forked from len0rd/rockbox

iPod Classic CE-ATA Support (Part 2 of 4: Remove on-stack sector buffers, and replace them with a single statically allocated sector buffer that's arbitrated amongst users)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29445 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sparmann 2011-02-27 22:44:54 +00:00
parent 751303c2ac
commit 1b5e31ed43
5 changed files with 141 additions and 28 deletions

View file

@ -67,7 +67,6 @@ int disk_sector_multiplier = 1;
struct partinfo* disk_init(IF_MD_NONVOID(int drive))
{
int i;
unsigned char sector[SECTOR_SIZE];
#ifdef HAVE_MULTIDRIVE
/* For each drive, start at a different position, in order not to destroy
the first entry of drive 0.
@ -81,10 +80,12 @@ struct partinfo* disk_init(IF_MD_NONVOID(int drive))
(void)drive;
#endif
unsigned char* sector = fat_get_sector_buffer();
storage_read_sectors(IF_MD2(drive,) 0,1, sector);
/* check that the boot sector is initialized */
if ( (sector[510] != 0x55) ||
(sector[511] != 0xaa)) {
fat_release_sector_buffer();
DEBUGF("Bad boot sector signature\n");
return NULL;
}
@ -104,6 +105,7 @@ struct partinfo* disk_init(IF_MD_NONVOID(int drive))
/* not handled yet */
}
}
fat_release_sector_buffer();
return pinfo;
}