1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-19 22:18:13 +00:00

boardloader: partial fix for powering off sd

This commit is contained in:
mcudev 2018-07-14 22:36:23 -04:00 committed by Pavol Rusnak
parent 7bf30ccb37
commit 0fbf2261cc

View File

@ -115,7 +115,7 @@ secbool sdcard_power_on(void) {
HAL_Delay(50); HAL_Delay(50);
if (sectrue != sdcard_is_present()) { if (sectrue != sdcard_is_present()) {
return secfalse; goto error;
} }
if (sd_handle.Instance) { if (sd_handle.Instance) {
return sectrue; return sectrue;
@ -147,17 +147,15 @@ secbool sdcard_power_on(void) {
return sectrue; return sectrue;
error: error:
sd_handle.Instance = NULL; sdcard_power_off();
return secfalse; return secfalse;
} }
void sdcard_power_off(void) { void sdcard_power_off(void) {
if (NULL == sd_handle.Instance) { if (sd_handle.Instance != NULL) {
return;
}
HAL_SD_DeInit(&sd_handle); HAL_SD_DeInit(&sd_handle);
sd_handle.Instance = NULL; sd_handle.Instance = NULL;
}
// turn off SD card circuitry // turn off SD card circuitry
HAL_Delay(50); HAL_Delay(50);
sdcard_default_pin_state(); sdcard_default_pin_state();