Remove hardcoded CTRNAND FAT offsets, calculate them from parsing NCSD + CTR MBR

This commit is contained in:
Aurora Wright
2017-05-26 03:07:39 +02:00
committed by TuxSH
parent 710d8cd15c
commit 28e5d8107f
8 changed files with 45 additions and 40 deletions

View File

@@ -37,23 +37,12 @@ DSTATUS disk_initialize (
BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
DSTATUS ret;
static u32 sdmmcInitResult = 4;
if(sdmmcInitResult == 4) sdmmcInitResult = sdmmc_sdcard_init();
if(pdrv == CTRNAND)
{
if(!(sdmmcInitResult & 1))
{
ctrNandInit();
ret = 0;
}
else ret = STA_NOINIT;
}
else ret = (!(sdmmcInitResult & 2)) ? 0 : STA_NOINIT;
return ret;
return ((pdrv == SDCARD && !(sdmmcInitResult & 2)) ||
(pdrv == CTRNAND && !(sdmmcInitResult & 1) && !ctrNandInit())) ? 0 : STA_NOINIT;
}