fatfs: Add raw emuMMC support for USER partition

This commit is contained in:
CTCaer
2021-02-06 17:11:32 +02:00
parent f3f1d4d4f0
commit e5689cfe57
4 changed files with 26 additions and 4 deletions

View File

@@ -18,6 +18,8 @@
static u32 sd_rsvd_sectors = 0;
static u32 ramdisk_sectors = 0;
static u32 emummc_sectors = 0;
/*-----------------------------------------------------------------------*/
/* Get Drive Status */
/*-----------------------------------------------------------------------*/
@@ -57,7 +59,8 @@ DRESULT disk_read (
case DRIVE_EMMC:
return sdmmc_storage_read(&emmc_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
case DRIVE_BIS:
return nx_emmc_bis_read(sector, count, (void *)buff);
case DRIVE_EMU:
return nx_emmc_bis_read(sector, count, (void *)buff) ? RES_OK : RES_ERROR;
}
return RES_ERROR;
@@ -82,6 +85,8 @@ DRESULT disk_write (
case DRIVE_EMMC:
case DRIVE_BIS:
return RES_WRPRT;
case DRIVE_EMU:
return nx_emmc_bis_write(sector, count, (void *)buff) ? RES_OK : RES_ERROR;
}
return RES_ERROR;
@@ -122,6 +127,18 @@ DRESULT disk_ioctl (
break;
}
}
else if (pdrv == DRIVE_EMU)
{
switch (cmd)
{
case GET_SECTOR_COUNT:
*buf = emummc_sectors;
break;
case GET_BLOCK_SIZE:
*buf = 32768; // Align to 16MB.
break;
}
}
return RES_OK;
}
@@ -144,6 +161,9 @@ DRESULT disk_set_info (
case DRIVE_RAM:
ramdisk_sectors = *buf;
break;
case DRIVE_EMU:
emummc_sectors = *buf;
break;
}
}