mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 11:21:23 +00:00
fatfs: Add raw emuMMC support for USER partition
This commit is contained in:
parent
f3f1d4d4f0
commit
e5689cfe57
4 changed files with 26 additions and 4 deletions
|
@ -27,7 +27,8 @@ typedef enum {
|
||||||
DRIVE_SD = 0,
|
DRIVE_SD = 0,
|
||||||
DRIVE_RAM = 1,
|
DRIVE_RAM = 1,
|
||||||
DRIVE_EMMC = 2,
|
DRIVE_EMMC = 2,
|
||||||
DRIVE_BIS = 3
|
DRIVE_BIS = 3,
|
||||||
|
DRIVE_EMU = 4
|
||||||
} DDRIVE;
|
} DDRIVE;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
static u32 sd_rsvd_sectors = 0;
|
static u32 sd_rsvd_sectors = 0;
|
||||||
static u32 ramdisk_sectors = 0;
|
static u32 ramdisk_sectors = 0;
|
||||||
|
static u32 emummc_sectors = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Get Drive Status */
|
/* Get Drive Status */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
@ -57,7 +59,8 @@ DRESULT disk_read (
|
||||||
case DRIVE_EMMC:
|
case DRIVE_EMMC:
|
||||||
return sdmmc_storage_read(&emmc_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
|
return sdmmc_storage_read(&emmc_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
|
||||||
case DRIVE_BIS:
|
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;
|
return RES_ERROR;
|
||||||
|
@ -82,6 +85,8 @@ DRESULT disk_write (
|
||||||
case DRIVE_EMMC:
|
case DRIVE_EMMC:
|
||||||
case DRIVE_BIS:
|
case DRIVE_BIS:
|
||||||
return RES_WRPRT;
|
return RES_WRPRT;
|
||||||
|
case DRIVE_EMU:
|
||||||
|
return nx_emmc_bis_write(sector, count, (void *)buff) ? RES_OK : RES_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
|
@ -122,6 +127,18 @@ DRESULT disk_ioctl (
|
||||||
break;
|
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;
|
return RES_OK;
|
||||||
}
|
}
|
||||||
|
@ -144,6 +161,9 @@ DRESULT disk_set_info (
|
||||||
case DRIVE_RAM:
|
case DRIVE_RAM:
|
||||||
ramdisk_sectors = *buf;
|
ramdisk_sectors = *buf;
|
||||||
break;
|
break;
|
||||||
|
case DRIVE_EMU:
|
||||||
|
emummc_sectors = *buf;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,13 +179,13 @@
|
||||||
/ Drive/Volume Configurations
|
/ Drive/Volume Configurations
|
||||||
/---------------------------------------------------------------------------*/
|
/---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define FF_VOLUMES 4
|
#define FF_VOLUMES 5
|
||||||
/* Number of volumes (logical drives) to be used. (1-10) */
|
/* Number of volumes (logical drives) to be used. (1-10) */
|
||||||
|
|
||||||
|
|
||||||
#define FF_STR_VOLUME_ID 1
|
#define FF_STR_VOLUME_ID 1
|
||||||
// Order is important. Any change to order, must also be reflected to diskio drive enum.
|
// Order is important. Any change to order, must also be reflected to diskio drive enum.
|
||||||
#define FF_VOLUME_STRS "sd","ram","emmc","bis"
|
#define FF_VOLUME_STRS "sd","ram","emmc","bis","emu"
|
||||||
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
|
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
|
||||||
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
|
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
|
||||||
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
|
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
|
||||||
|
|
|
@ -224,6 +224,7 @@ typedef struct _nx_emmc_cal0_t
|
||||||
} __attribute__((packed)) nx_emmc_cal0_t;
|
} __attribute__((packed)) nx_emmc_cal0_t;
|
||||||
|
|
||||||
int nx_emmc_bis_read(u32 sector, u32 count, void *buff);
|
int nx_emmc_bis_read(u32 sector, u32 count, void *buff);
|
||||||
|
int nx_emmc_bis_write(u32 sector, u32 count, void *buff);
|
||||||
void nx_emmc_bis_init(emmc_part_t *part, bool enable_cache, u32 emummc_offset);
|
void nx_emmc_bis_init(emmc_part_t *part, bool enable_cache, u32 emummc_offset);
|
||||||
void nx_emmc_bis_end();
|
void nx_emmc_bis_end();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue