mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 11:21:23 +00:00
[Main] Unmount SD before reboot/power off
This commit is contained in:
parent
e06d833cf8
commit
645df34367
1 changed files with 13 additions and 0 deletions
13
ipl/main.c
13
ipl/main.c
|
@ -87,6 +87,16 @@ int sd_mount()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void sd_unmount()
|
||||
{
|
||||
if (sd_mounted)
|
||||
{
|
||||
gfx_puts(&gfx_con, "Unmounting SD card...\n");
|
||||
f_mount(NULL, "", 1);
|
||||
sdmmc_storage_end(&sd_storage);
|
||||
}
|
||||
}
|
||||
|
||||
void *sd_file_read(char *path)
|
||||
{
|
||||
FIL fp;
|
||||
|
@ -638,11 +648,13 @@ out:;
|
|||
|
||||
void reboot_normal()
|
||||
{
|
||||
sd_unmount();
|
||||
panic(0x21); //Bypass fuse programming in package1.
|
||||
}
|
||||
|
||||
void reboot_rcm()
|
||||
{
|
||||
sd_unmount();
|
||||
PMC(APBDEV_PMC_SCRATCH0) = 2; //Reboot into rcm.
|
||||
PMC(0) |= 0x10;
|
||||
while (1)
|
||||
|
@ -651,6 +663,7 @@ void reboot_rcm()
|
|||
|
||||
void power_off()
|
||||
{
|
||||
sd_unmount();
|
||||
//TODO: we should probably make sure all regulators are powered off properly.
|
||||
i2c_send_byte(I2C_5, 0x3C, MAX77620_REG_ONOFFCNFG1, MAX77620_ONOFFCNFG1_PWR_OFF);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue