Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r72dd42b6a116e62d1b3ad5d60088c29e067d10d4 -r2fff37fa585181917705645494549b5fd4a4d522 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 72dd42b6a116e62d1b3ad5d60088c29e067d10d4) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 2fff37fa585181917705645494549b5fd4a4d522) @@ -20,13 +20,14 @@ #include "DrainPump.h" #include "Fans.h" #include "FPGA.h" -#include "Heaters.h" +#include "Integrity.h" #include "LoadCell.h" #include "ModeInitPOST.h" #include "NVDataMgmt.h" #include "OperationModes.h" #include "Pressures.h" #include "RTC.h" +#include "SystemCommMessages.h" #include "TemperatureSensors.h" #include "Thermistors.h" #include "UVReactors.h" @@ -47,6 +48,7 @@ // ********** private function prototypes ********** static DG_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus ); +static SELF_TEST_STATUS_T execFWCompatibilityTest( void ); /*********************************************************************//** * @brief @@ -92,7 +94,7 @@ switch ( postState ) { case DG_POST_STATE_START: - postState = DG_POST_STATE_FPGA; + postState = DG_POST_STATE_FW_COMPATIBILITY; #ifdef SKIP_POST postState = DG_POST_STATE_COMPLETED; #endif @@ -102,6 +104,16 @@ #endif break; + case DG_POST_STATE_FW_COMPATIBILITY: + testStatus = execFWCompatibilityTest(); + postState = handlePOSTStatus( testStatus ); + break; + + case DG_POST_STATE_FW_INTEGRITY: + testStatus = execIntegrityTest(); + postState = handlePOSTStatus( testStatus ); + break; + case DG_POST_STATE_FPGA: testStatus = execFPGATest(); postState = handlePOSTStatus( testStatus ); @@ -117,11 +129,6 @@ postState = handlePOSTStatus( testStatus ); break; - case DG_POST_STATE_LOAD_CELL: - testStatus = execLoadCellsSelfTest(); - postState = handlePOSTStatus( testStatus ); - break; - case DG_POST_STATE_TEMPERATURE_SENSORS: #ifdef DONT_SKIP_NV_POST // Skip the rest of the POSTs @@ -132,11 +139,6 @@ #endif break; - case DG_POST_STATE_HEATERS: - testStatus = execHeatersSelfTest(); - postState = handlePOSTStatus( testStatus ); - break; - case DG_POST_STATE_ACCELEROMETER: #ifndef DISABLE_ACCELS testStatus = execAccelTest(); @@ -176,6 +178,12 @@ case DG_POST_STATE_WATCHDOG: testStatus = execWatchdogTest(); + postState = handlePOSTStatus( testStatus ); + break; + + // Should be last POST (and last POST test must be a test that completes in a single call) + case DG_POST_STATE_LOAD_CELL: + testStatus = execLoadCellsSelfTest(); handlePOSTStatus( testStatus ); // ignoring return value because last test if ( TRUE == tempPOSTPassed ) { @@ -188,23 +196,25 @@ break; case DG_POST_STATE_COMPLETED: - // set overall HD POST status to "passed" + // Set overall HD POST status to "passed" postPassed = TRUE; - // set overall HD POST completed status to TRUE + // Set overall HD POST completed status to TRUE postCompleted = TRUE; - // TODO - send POST status on CAN - // go to standby mode + // Broadcast final POST passed + sendPOSTFinalResult( TRUE ); + // Go to standby mode requestNewOperationMode( DG_MODE_STAN ); break; case DG_POST_STATE_FAILED: - // TODO - send POST status on CAN - // will want POST faults to wait for us to get here before sending us to fault mode + // Broadcast final POST failed + sendPOSTFinalResult( FALSE ); + // Will want POST faults to wait for us to get here before sending us to fault mode requestNewOperationMode( DG_MODE_FAUL ); break; default: - // TODO - s/w fault + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_MODE_INIT_POST_INVALID_POST_STATE, postState ) postState = DG_POST_STATE_FAILED; break; } @@ -252,7 +262,12 @@ if ( ( testStatus == SELF_TEST_STATUS_PASSED ) || ( testStatus == SELF_TEST_STATUS_FAILED ) ) { - result = (DG_POST_STATE_T)((int)postState + 1); // move on to next POST test + BOOL passed = ( testStatus == SELF_TEST_STATUS_PASSED ? TRUE : FALSE ); + + // Broadcast passed POST result + sendPOSTTestResult( (DG_POST_STATE_T)((int)postState), passed ); + // Move on to next POST test + result = (DG_POST_STATE_T)((int)postState + 1); if ( testStatus == SELF_TEST_STATUS_FAILED ) { tempPOSTPassed = FALSE; @@ -275,4 +290,20 @@ return postState; } +/*********************************************************************//** + * @brief + * The execFWCompatibilityTest function executes the firmware compatibility test. + * @details Inputs: none + * @details Outputs: none + * @return in progress, passed, or failed + *************************************************************************/ +static SELF_TEST_STATUS_T execFWCompatibilityTest( void ) +{ + SELF_TEST_STATUS_T result = SELF_TEST_STATUS_PASSED; + + // TODO - implement + + return result; +} + /**@}*/