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 106228c2ee - Show all commits

View File

@ -38,10 +38,11 @@ CoreController::CoreController(object_id_t objectId):
if(sdcMan == nullptr) { if(sdcMan == nullptr) {
sif::error << "CoreController::CoreController: SD card manager invalid!" << std::endl; sif::error << "CoreController::CoreController: SD card manager invalid!" << std::endl;
} }
if(not BLOCKING_SD_INIT) { if(not BLOCKING_SD_INIT) {
sdStateMachine();
sdcMan->setBlocking(false); sdcMan->setBlocking(false);
} }
sdStateMachine();
result = initBootCopy(); result = initBootCopy();
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
@ -59,7 +60,7 @@ ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
} }
void CoreController::performControlOperation() { void CoreController::performControlOperation() {
if(not BLOCKING_SD_INIT and not sdInfo.initFinished) { if(not BLOCKING_SD_INIT) {
sdStateMachine(); sdStateMachine();
} }
performWatchdogControlOperation(); performWatchdogControlOperation();
@ -83,9 +84,8 @@ ReturnValue_t CoreController::initialize() {
"count failed" << std::endl; "count failed" << std::endl;
} }
if(not BLOCKING_SD_INIT) {
sdStateMachine(); sdStateMachine();
}
return ExtendedControllerBase::initialize(); return ExtendedControllerBase::initialize();
} }
@ -146,9 +146,17 @@ ReturnValue_t CoreController::sdStateMachine() {
if(sdInfo.state == SdStates::START) { if(sdInfo.state == SdStates::START) {
#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE #if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE
sif::info << "No SD card initialization will be performed" << std::endl; sif::info << "No SD card initialization will be performed" << std::endl;
sdInfo.state == SdStates::IDLE; sdInfo.state = SdStates::IDLE;
sdInfo.initFinished = true; sdInfo.initFinished = true;
return result;
#else #else
// Init will be performed by separate function
if(not BLOCKING_SD_INIT) {
sdInfo.state = SdStates::IDLE;
sdInfo.initFinished = true;
return result;
}
#endif
sdInfo.cycleCount = 0; sdInfo.cycleCount = 0;
sdInfo.commandExecuted = false; sdInfo.commandExecuted = false;
sdInfo.state = SdStates::GET_INFO; sdInfo.state = SdStates::GET_INFO;