Error if emuNAND is booted while the SD card is write protected
This commit is contained in:
parent
33436ae2a6
commit
2a6a655804
@ -37,6 +37,7 @@
|
|||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
#include "fatfs/sdmmc/sdmmc.h"
|
||||||
|
|
||||||
extern CfgData configData;
|
extern CfgData configData;
|
||||||
extern ConfigurationStatus needConfig;
|
extern ConfigurationStatus needConfig;
|
||||||
@ -308,6 +309,12 @@ boot:
|
|||||||
if(nandType == FIRMWARE_SYSNAND) firmSource = FIRMWARE_SYSNAND;
|
if(nandType == FIRMWARE_SYSNAND) firmSource = FIRMWARE_SYSNAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//If we're using EmuNAND, make sure the SD card isn't write protected
|
||||||
|
if(nandType != FIRMWARE_SYSNAND && (*(vu16*)(SDMMC_BASE + REG_SDSTATUS0) & TMIO_STAT0_WRPROTECT) == 0)
|
||||||
|
{
|
||||||
|
error("The SD card is locked, EmuNAND can not be used.\n\nPlease turn the write protection switch off.");
|
||||||
|
}
|
||||||
|
|
||||||
//Same if we're using EmuNAND as the FIRM source
|
//Same if we're using EmuNAND as the FIRM source
|
||||||
else if(firmSource != FIRMWARE_SYSNAND)
|
else if(firmSource != FIRMWARE_SYSNAND)
|
||||||
locateEmuNand(&firmSource);
|
locateEmuNand(&firmSource);
|
||||||
|
@ -109,6 +109,9 @@ void mcuPowerOff(void)
|
|||||||
//Ensure that all memory transfers have completed and that the data cache has been flushed
|
//Ensure that all memory transfers have completed and that the data cache has been flushed
|
||||||
flushEntireDCache();
|
flushEntireDCache();
|
||||||
|
|
||||||
|
//Deinitialize the screens
|
||||||
|
deinitScreens();
|
||||||
|
|
||||||
i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 0);
|
i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 0);
|
||||||
while(true);
|
while(true);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user