Non Blocking SD Card Initialization #75

Merged
meierj merged 25 commits from mueller/non-blocking-sd-card-init into develop 2021-08-09 14:18:49 +02:00
Showing only changes of commit e186bff4e4 - Show all commits

View File

@ -224,9 +224,11 @@ ReturnValue_t CoreController::sdInitStateMachine() {
// 2. Hot redundant case: Other SD card needs to be mounted and switched on
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
if(sdInfo.otherState == sd::SdState::ON) {
sif::debug << "Determine: Setting other state off" << std::endl;
sdInfo.state = SdStates::SET_STATE_OTHER;
}
else if(sdInfo.otherState == sd::SdState::MOUNTED) {
sif::debug << "Determine: Unmounting other" << std::endl;
sdInfo.state = SdStates::MOUNT_UNMOUNT_OTHER;
}
else {
@ -235,9 +237,11 @@ ReturnValue_t CoreController::sdInitStateMachine() {
}
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
if(sdInfo.otherState == sd::SdState::OFF) {
sif::debug << "Determine: Setting other state on" << std::endl;
sdInfo.state = SdStates::SET_STATE_OTHER;
}
else if(sdInfo.otherState == sd::SdState::ON) {
sif::debug << "Determine: Mounting other" << std::endl;
sdInfo.state = SdStates::MOUNT_UNMOUNT_OTHER;
}
else {
@ -252,19 +256,24 @@ ReturnValue_t CoreController::sdInitStateMachine() {
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
if(not sdInfo.commandExecuted) {
sif::debug << "Set state other off" << std::endl;
result = sdCardSetup(sdInfo.pref, sd::SdState::OFF, sdInfo.prefChar);
result = sdCardSetup(sdInfo.other, sd::SdState::OFF, sdInfo.otherChar);
sdInfo.commandExecuted = true;
}
else {
nonBlockingOpChecking(SdStates::UPDATE_INFO, 10, "Switching off other SD card");
}
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
if(not sdInfo.commandExecuted) {
sif::debug << "Set state other on" << std::endl;
result = sdCardSetup(sdInfo.pref, sd::SdState::ON, sdInfo.prefChar);
result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar);
sdInfo.commandExecuted = true;
}
#endif
else {
nonBlockingOpChecking(SdStates::MOUNT_UNMOUNT_OTHER, 10, "Switching off other SD card");
nonBlockingOpChecking(SdStates::SdStates::MOUNT_UNMOUNT_OTHER, 10,
"Switching on other SD card");
}
#endif
}
if(sdInfo.state == SdStates::MOUNT_UNMOUNT_OTHER) {
@ -272,23 +281,21 @@ ReturnValue_t CoreController::sdInitStateMachine() {
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
if(not sdInfo.commandExecuted) {
sif::debug << "Unmount other" << std::endl;
result = sdCardSetup(sdInfo.pref, sd::SdState::ON, sdInfo.prefChar);
result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar);
sdInfo.commandExecuted = true;
}
else {
nonBlockingOpChecking(SdStates::SET_STATE_OTHER, 10, "Unmounting other SD card");
}
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
if(not sdInfo.commandExecuted) {
result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
result = sdCardSetup(sdInfo.other, sd::SdState::MOUNTED, sdInfo.otherChar);
sdInfo.commandExecuted = true;
}
#endif
else {
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
std::string opPrint = "Switching off other SD card";
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
std::string opPrint = "Mounting other SD card";
#endif
nonBlockingOpChecking(SdStates::MOUNT_UNMOUNT_OTHER, 10, opPrint);
nonBlockingOpChecking(SdStates::UPDATE_INFO, 4, "Mounting other SD card");
}
#endif
}
if(sdInfo.state == SdStates::UPDATE_INFO) {