Fix previous commit, deinit screens on ARM9 exception, add check for write protect switch on writing operations

This commit is contained in:
Aurora Wright
2017-08-28 02:40:05 +02:00
parent 2a6a655804
commit 618ce671ac
8 changed files with 36 additions and 29 deletions

View File

@@ -76,7 +76,7 @@ DRESULT disk_write (
UINT count /* Number of sectors to write */
)
{
return ((pdrv == SDCARD && !sdmmc_sdcard_writesectors(sector, count, buff)) ||
return ((pdrv == SDCARD && (*(vu16 *)(SDMMC_BASE + REG_SDSTATUS0) & TMIO_STAT0_WRPROTECT) != 0 && !sdmmc_sdcard_writesectors(sector, count, buff)) ||
(pdrv == CTRNAND && !ctrNandWrite(sector, count, buff))) ? RES_OK : RES_PARERR;
}
#endif
@@ -91,12 +91,11 @@ DRESULT disk_write (
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;
return cmd == CTRL_SYNC ? RES_OK : RES_PARERR;
}
#endif