nyx: part mgr: add eMMC partition manager
The eMMC partition manager allows user the following: - Resize HOS USER partition - Add and flash Linux partitions - Add and flash Android partitions It is hidden and is accessible by holding the `Partition SD Card` button for 5 seconds.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Low level disk I/O module skeleton for FatFs */
|
||||
/* (C) ChaN, 2016 */
|
||||
/* (C) CTCaer, 2018-2020 */
|
||||
/* (C) CTCaer, 2018-2025 */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* If a working storage control module is available, it should be */
|
||||
/* attached to the FatFs via a glue function rather than modifying it. */
|
||||
@@ -17,7 +17,10 @@
|
||||
|
||||
static u32 sd_rsvd_sectors = 0;
|
||||
static u32 ramdisk_sectors = 0;
|
||||
static u32 emummc_sectors = 0;
|
||||
static u32 bis_sectors = 0;
|
||||
static u32 emummc_sectors = 0;
|
||||
|
||||
static bool bis_write_allowed = false;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Get Drive Status */
|
||||
@@ -82,9 +85,11 @@ DRESULT disk_write (
|
||||
case DRIVE_RAM:
|
||||
return ram_disk_write(sector, count, (void *)buff);
|
||||
case DRIVE_EMMC:
|
||||
case DRIVE_BIS:
|
||||
return RES_WRPRT;
|
||||
case DRIVE_BIS:
|
||||
case DRIVE_EMU:
|
||||
if (pdrv == DRIVE_BIS && !bis_write_allowed)
|
||||
return RES_WRPRT;
|
||||
return nx_emmc_bis_write(sector, count, (void *)buff) ? RES_OK : RES_ERROR;
|
||||
}
|
||||
|
||||
@@ -102,8 +107,9 @@ DRESULT disk_ioctl (
|
||||
{
|
||||
DWORD *buf = (DWORD *)buff;
|
||||
|
||||
if (pdrv == DRIVE_SD)
|
||||
switch (pdrv)
|
||||
{
|
||||
case DRIVE_SD:
|
||||
switch (cmd)
|
||||
{
|
||||
case GET_SECTOR_COUNT:
|
||||
@@ -113,9 +119,9 @@ DRESULT disk_ioctl (
|
||||
*buf = 32768; // Align to 16MB.
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (pdrv == DRIVE_RAM)
|
||||
{
|
||||
break;
|
||||
|
||||
case DRIVE_RAM:
|
||||
switch (cmd)
|
||||
{
|
||||
case GET_SECTOR_COUNT:
|
||||
@@ -125,21 +131,33 @@ DRESULT disk_ioctl (
|
||||
*buf = 2048; // Align to 1MB.
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (pdrv == DRIVE_EMU)
|
||||
{
|
||||
break;
|
||||
|
||||
case DRIVE_BIS:
|
||||
switch (cmd)
|
||||
{
|
||||
case GET_SECTOR_COUNT:
|
||||
*buf = bis_sectors;
|
||||
break;
|
||||
case GET_BLOCK_SIZE:
|
||||
*buf = 32768; // Align to 16MB.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DRIVE_EMU:
|
||||
switch (cmd)
|
||||
{
|
||||
case GET_SECTOR_COUNT:
|
||||
*buf = emummc_sectors;
|
||||
break;
|
||||
case GET_BLOCK_SIZE:
|
||||
*buf = 32768; // Align to 16MB.
|
||||
*buf = 16384; // Align to 8MB (With BOOT0/1 data will be at 16MB BU).
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // Catch all for unknown devices.
|
||||
{
|
||||
break;
|
||||
|
||||
default: // Catch all for unknown devices.
|
||||
switch (cmd)
|
||||
{
|
||||
case CTRL_SYNC:
|
||||
@@ -149,6 +167,7 @@ DRESULT disk_ioctl (
|
||||
*buf = 0; // Zero value to force default or abort.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return RES_OK;
|
||||
@@ -169,14 +188,22 @@ DRESULT disk_set_info (
|
||||
case DRIVE_SD:
|
||||
sd_rsvd_sectors = *buf;
|
||||
break;
|
||||
|
||||
case DRIVE_RAM:
|
||||
ramdisk_sectors = *buf;
|
||||
break;
|
||||
|
||||
case DRIVE_BIS:
|
||||
bis_sectors = *buf;
|
||||
break;
|
||||
|
||||
case DRIVE_EMU:
|
||||
emummc_sectors = *buf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (cmd == SET_WRITE_PROTECT && pdrv == DRIVE_BIS)
|
||||
bis_write_allowed = *(bool *)buff;
|
||||
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user