Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -rf0c52f6adff7b61132953890a74f1c462b31eedf -r7334590e610cd1543e128ad2dbc0de17e824b619 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision f0c52f6adff7b61132953890a74f1c462b31eedf) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 7334590e610cd1543e128ad2dbc0de17e824b619) @@ -23,12 +23,13 @@ #include "CPLD.h" #include "DialInFlow.h" #include "FPGA.h" -#include "OperationModes.h" -#include "RTC.h" -#include "WatchdogMgmt.h" #include "ModeInitPOST.h" #include "NVDataMgmt.h" +#include "OperationModes.h" +#include "RTC.h" +#include "SystemCommMessages.h" #include "Valves.h" +#include "WatchdogMgmt.h" /** * @addtogroup HDInitAndPOSTMode @@ -39,11 +40,14 @@ // ********** private data ********** -static HD_POST_STATE_T postState = POST_STATE_START; ///< Current state of initialize and POST mode. -static BOOL postCompleted = FALSE; ///< Flag indicates whether POST is completed. -static BOOL postPassed = FALSE; ///< Flag indicates all POST tests passed. -static BOOL tempPOSTPassed = TRUE; ///< Flag indicates all POST tests have passed so far. +static HD_POST_STATE_T postState; ///< Current state of initialize and POST mode. +static BOOL postCompleted; ///< Flag indicates whether POST is completed. +static BOOL postPassed; ///< Flag indicates all POST tests passed. +static BOOL tempPOSTPassed; ///< Flag indicates all POST tests have passed so far. +static BOOL uiPOSTPassed; ///< Final result for UI POST tests (TRUE = passed, FALSE = failed). +static BOOL dgPOSTPassed; ///< Final result for DG POST tests (TRUE = passed, FALSE = failed). + // ********** private function prototypes ********** static HD_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus ); @@ -62,6 +66,8 @@ postCompleted = FALSE; postPassed = FALSE; tempPOSTPassed = TRUE; + uiPOSTPassed = FALSE; + dgPOSTPassed = FALSE; } /*********************************************************************//** @@ -187,19 +193,23 @@ } break; + // TODO - add POST test requiring all DG and UI POST tests to pass + case POST_STATE_COMPLETED: // Set overall HD POST status to "passed" postPassed = TRUE; // Set overall HD POST completed status to TRUE postCompleted = TRUE; - // TODO - send POST status on CAN + // Broadcast final POST passed + sendPOSTFinalResult( TRUE ); // Go to standby mode requestNewOperationMode( MODE_STAN ); break; case POST_STATE_FAILED: // Should not get here - any failed post test should have already triggered a fault and taken us to fault mode default: + sendPOSTFinalResult( FALSE ); SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_MODE_INIT_POST_INVALID_POST_STATE, postState ) break; } @@ -218,11 +228,39 @@ *************************************************************************/ void signalAlarmActionToInitAndPOSTMode( ALARM_ACTION_T action ) { + // TODO - anything required here? +} +/*********************************************************************//** + * @brief + * The signalUIPOSTFinalResult function records the final POST result for + * the UI. + * @details Inputs: none + * @details Outputs: uiPOSTPassed + * @param passed TRUE if UI POST tests all passed, FALSE if any UI POST test failed + * @return none + *************************************************************************/ +void signalUIPOSTFinalResult( BOOL passed ) +{ + uiPOSTPassed = passed; } /*********************************************************************//** * @brief + * The signalDGPOSTFinalResult function records the final POST result for + * the DG. + * @details Inputs: none + * @details Outputs: dgPOSTPassed + * @param passed TRUE if DG POST tests all passed, FALSE if any DG POST test failed + * @return none + *************************************************************************/ +void signalDGPOSTFinalResult( BOOL passed ) +{ + dgPOSTPassed = passed; +} + +/*********************************************************************//** + * @brief * The isPOSTCompleted function determines whether all HD POST have * been run and completed. If true, call the isPOSTPassed() to see final * result (pass/fail). @@ -263,12 +301,18 @@ if ( testStatus == SELF_TEST_STATUS_PASSED ) { - result = (HD_POST_STATE_T)((int)postState + 1); // Move on to next POST test + // Broadcast passed POST result + sendPOSTTestResult( (HD_POST_STATE_T)((int)postState), TRUE ); + // Move on to next POST test + result = (HD_POST_STATE_T)((int)postState + 1); } else if ( testStatus == SELF_TEST_STATUS_FAILED ) { // At least one POST has failed tempPOSTPassed = FALSE; + // Broadcast failed POST results + sendPOSTTestResult( (HD_POST_STATE_T)((int)postState), FALSE ); + sendPOSTFinalResult( FALSE ); // Test that failed should have triggered a fault which will request fault mode, so should POST state machine should never see FAILED state and will fault if it does result = POST_STATE_FAILED; }