7dbded99a2
- Gotten rid of the patched FIRMs, AuReiNand now finds and loads all the FIRMs from CTRNAND by default. If you are booting an emuNAND, the FIRMs will be loaded from its CTRNAND. This also applies to AGB and TWL FIRM, and allows for a very fast boot with no firmware files on the SD card. - If for some reason (like using NTR) you do not want to use the CTRNAND FIRM, you can place a firmware.bin in the aurei folder and it will be loaded just for the default NAND. - The way AuReiNand works has changed. Now you can specify to autoboot SysNAND or not, and a NAND is no more tied to a FIRM (since 9.0 FIRM is autodetected). If you press nothing the default NAND is booted with its own FIRM, L boots the non-default NAND with its own FIRM, R boots EmuNAND with the SysNAND FIRM if you picked "Updated SysNAND", and vice-versa. - In order for AuReiNand to handle FIRM reboots, the .bin path needs to be hardcoded in the program. The default is /arm9loaderhax.bin (the AuReiNand.dat is also supported for 9.0 people). A PC tool was written to make changing the path easier. - Bug fixes and stuff I forgot. - Gelex is a saint.
132 lines
3.8 KiB
C
132 lines
3.8 KiB
C
/*-----------------------------------------------------------------------*/
|
|
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2014 */
|
|
/*-----------------------------------------------------------------------*/
|
|
/* If a working storage control module is available, it should be */
|
|
/* attached to the FatFs via a glue function rather than modifying it. */
|
|
/* This is an example of glue functions to attach various exsisting */
|
|
/* storage control modules to the FatFs module with a defined API. */
|
|
/*-----------------------------------------------------------------------*/
|
|
|
|
#include "diskio.h" /* FatFs lower layer API */
|
|
#include "sdmmc/sdmmc.h"
|
|
|
|
/* Definitions of physical drive number for each media */
|
|
#define SDCARD 0
|
|
#define CTRNAND 1
|
|
|
|
/*-----------------------------------------------------------------------*/
|
|
/* Get Drive Status */
|
|
/*-----------------------------------------------------------------------*/
|
|
|
|
DSTATUS disk_status (
|
|
__attribute__((unused))
|
|
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
|
)
|
|
{
|
|
return RES_OK;
|
|
}
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------*/
|
|
/* Inidialize a Drive */
|
|
/*-----------------------------------------------------------------------*/
|
|
|
|
DSTATUS disk_initialize (
|
|
__attribute__((unused))
|
|
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
|
)
|
|
{
|
|
switch(pdrv)
|
|
{
|
|
case SDCARD:
|
|
sdmmc_sdcard_init();
|
|
break;
|
|
case CTRNAND:
|
|
ctrNandInit();
|
|
break;
|
|
}
|
|
|
|
return RES_OK;
|
|
}
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------*/
|
|
/* Read Sector(s) */
|
|
/*-----------------------------------------------------------------------*/
|
|
|
|
DRESULT disk_read (
|
|
__attribute__((unused))
|
|
BYTE pdrv, /* Physical drive nmuber to identify the drive */
|
|
BYTE *buff, /* Data buffer to store read data */
|
|
DWORD sector, /* Sector address in LBA */
|
|
UINT count /* Number of sectors to read */
|
|
)
|
|
{
|
|
switch(pdrv)
|
|
{
|
|
case SDCARD:
|
|
if(sdmmc_sdcard_readsectors(sector, count, (BYTE *)buff))
|
|
return RES_PARERR;
|
|
break;
|
|
case CTRNAND:
|
|
if(ctrNandRead(sector, count, (BYTE *)buff))
|
|
return RES_PARERR;
|
|
break;
|
|
}
|
|
|
|
return RES_OK;
|
|
}
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------*/
|
|
/* Write Sector(s) */
|
|
/*-----------------------------------------------------------------------*/
|
|
|
|
#if _USE_WRITE
|
|
DRESULT disk_write (
|
|
__attribute__((unused))
|
|
BYTE pdrv, /* Physical drive nmuber to identify the drive */
|
|
const BYTE *buff, /* Data to be written */
|
|
DWORD sector, /* Sector address in LBA */
|
|
UINT count /* Number of sectors to write */
|
|
)
|
|
{
|
|
switch(pdrv)
|
|
{
|
|
case SDCARD:
|
|
if(sdmmc_sdcard_writesectors(sector, count, (BYTE *)buff))
|
|
return RES_PARERR;
|
|
break;
|
|
case CTRNAND:
|
|
if(ctrNandWrite(sector, count, (BYTE *)buff))
|
|
return RES_PARERR;
|
|
break;
|
|
}
|
|
|
|
return RES_OK;
|
|
}
|
|
#endif
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------*/
|
|
/* Miscellaneous Functions */
|
|
/*-----------------------------------------------------------------------*/
|
|
|
|
#if _USE_IOCTL
|
|
DRESULT disk_ioctl (
|
|
__attribute__((unused))
|
|
BYTE pdrv, /* Physical drive nmuber (0..) */
|
|
__attribute__((unused))
|
|
BYTE cmd, /* Control code */
|
|
__attribute__((unused))
|
|
void *buff /* Buffer to send/receive control data */
|
|
)
|
|
{
|
|
return RES_PARERR;
|
|
}
|
|
#endif
|