Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r4fb1e15d35f6b968bab5620909c30baec98bfd4e -rf7c714a1a09b10d85a8b013712532d37b4d7b97a --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 4fb1e15d35f6b968bab5620909c30baec98bfd4e) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision f7c714a1a09b10d85a8b013712532d37b4d7b97a) @@ -18,28 +18,19 @@ #include "reg_crc.h" // Used to hold reset reason code at startup before bits get cleared #include "reg_system.h" // Used to access exception status registers for reset reason code at startup -//#include "Accel.h" //#include "ConcentratePumps.h" //#include "ConductivitySensors.h" -//#include "CPLD.h" -//#include "DrainPump.h" -//#include "Fans.h" -//#include "FlowSensors.h" -#include "FPGA.h" +#include "FpgaDD.h" //#include "Integrity.h" -//#include "LoadCell.h" +#include "Messaging.h" #include "ModeInitPOST.h" //#include "NVDataMgmt.h" #include "OperationModes.h" //#include "Pressures.h" -//#include "Reservoirs.h" -//#include "RTC.h" #include "SafetyShutdown.h" -#include "Messaging.h" #include "TaskGeneral.h" //#include "TemperatureSensors.h" //#include "Thermistors.h" -//#include "UVReactors.h" #include "WatchdogMgmt.h" /** @@ -68,10 +59,9 @@ /*********************************************************************//** * @brief * The initInitAndPOSTMode function initializes the Initialization and POST - * mode module. + * mode unit. * @details \b Inputs: none - * @details \b Outputs: postState, postCompleted, tempPOSTPassed, - * startPOSTDelayCounter + * @details \b Outputs: unit variables are initialized. * @return none *************************************************************************/ void initInitAndPOSTMode( void ) @@ -94,13 +84,9 @@ U32 transitionToInitAndPOSTMode( void ) { initInitAndPOSTMode(); -// setCPLDCleanLEDColor( CPLD_CLEAN_LED_OFF ); // setCurrentSubState( NO_SUB_STATE ); -// resetRTCPOSTState(); // resetNVDataMgmtPOSTState(); -// resetAccelPOSTState(); // resetPressuresPOSTState(); -// resetUVReactorsPOSTState(); // resetWatchdogPOSTState(); // resetSafetyShutdownPOSTState(); @@ -114,6 +100,9 @@ * @details \b Inputs: postState * @details \b Outputs: Initialization and POST mode state machine executed * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when any of the post step fails. + * @Warning All the actuators and sensors must execute their POST after NVDataMgmt + * NVDataMgmt must load all the calibration data into RAM so the actuators + * can query their corresponding calibration values successfully * @return current state. *************************************************************************/ U32 execInitAndPOSTMode( void ) @@ -125,9 +114,6 @@ { case DD_POST_STATE_START: postState = handlePOSTStateStart(); -#ifdef BOARD_WITH_NO_HARDWARE - postState = DD_POST_STATE_RTC; -#endif break; case DD_POST_STATE_FW_COMPATIBILITY: @@ -145,11 +131,6 @@ postState = handlePOSTStatus( testStatus ); break; - case DD_POST_STATE_RTC: - //testStatus = execRTCSelfTest(); - postState = handlePOSTStatus( testStatus ); - break; - case DD_POST_STATE_NVDATAMGMT: //testStatus = execNVDataMgmtSelfTest(); postState = handlePOSTStatus( testStatus ); @@ -159,40 +140,15 @@ // NVDataMgmt must load all the calibration data into RAM so the actuators // can query their corresponding calibration values successfully case DD_POST_STATE_TEMPERATURE_SENSORS: -#ifndef BOARD_WITH_NO_HARDWARE //testStatus = execTemperatureSensorsSelfTest(); postState = handlePOSTStatus( testStatus ); -#else - postState = DD_POST_STATE_COMPLETED; -#endif break; - case DD_POST_STATE_ACCELEROMETER: -#ifndef _RELEASE_ - //if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ACCELS ) != SW_CONFIG_ENABLE_VALUE ) -#endif - { - //testStatus = execAccelTest(); - } -#ifndef _RELEASE_ -// else -// { -// testStatus = SELF_TEST_STATUS_PASSED; -// } -#endif - postState = handlePOSTStatus( testStatus ); - break; - case DD_POST_STATE_PRESSURES: //testStatus = execPressureSelfTest(); postState = handlePOSTStatus( testStatus ); break; - case DD_POST_STATE_DRAIN_PUMP: - //testStatus = execDrainPumpSelfTest(); - postState = handlePOSTStatus( testStatus ); - break; - case DD_POST_STATE_CONCENTRATE_PUMPS: //testStatus = execConcenratePumpsSelfTest(); postState = handlePOSTStatus( testStatus ); @@ -203,55 +159,19 @@ postState = handlePOSTStatus( testStatus ); break; - case DD_POST_STATE_RESERVOIRS: - //testStatus = execReservoirsSelfTest(); - postState = handlePOSTStatus( testStatus ); - break; - - case DD_POST_STATE_UV_REACTORS: -#ifndef _RELEASE_ - //if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UV_REACTORS ) != SW_CONFIG_ENABLE_VALUE ) -#endif - { - //testStatus = execUVReactorsSelfTest(); - } -#ifndef _RELEASE_ -// else -// { -// testStatus = SELF_TEST_STATUS_PASSED; -// } -#endif - postState = handlePOSTStatus( testStatus ); - break; - case DD_POST_STATE_THERMISTORS: //testStatus = execThermistorsSelfTest(); postState = handlePOSTStatus( testStatus ); break; - case DD_POST_STATE_FANS: - //testStatus = execFansSelfTest(); - postState = handlePOSTStatus( testStatus ); - break; - - case DD_POST_STATE_FLOW_SENSORS: - //testStatus = execFlowSensorsSelfTest(); - postState = handlePOSTStatus( testStatus ); - break; - case DD_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 DD_POST_STATE_SAFETY_SHUTDOWN: //testStatus = execSafetyShutdownTest(); - postState = handlePOSTStatus( testStatus ); - break; - - // Should be last POST (and last POST test must be a test that completes in a single call) - case DD_POST_STATE_LOAD_CELL: - //testStatus = execLoadCellsSelfTest(); handlePOSTStatus( testStatus ); // Ignoring return value because last test if ( TRUE == tempPOSTPassed ) @@ -278,7 +198,7 @@ break; case DD_POST_STATE_FAILED: - // Should not get here - any failed post test should have already triggered a fault and taken us to fault m + // Should not get here - any failed post test should have already triggered a fault and taken us to fault mode default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_MODE_INIT_POST_INVALID_POST_STATE, postState ) postState = DD_POST_STATE_FAILED; @@ -294,7 +214,7 @@ * and completed. If true, call the isPOSTPassed() to see final result (pass/fail). * @details \b Inputs: postCompleted * @details \b Outputs: none - * @return true if all HD POST tests have completed, false if not + * @return true if all DD POST tests have completed, false if not *************************************************************************/ BOOL isPOSTCompleted( void ) { @@ -303,11 +223,11 @@ /*********************************************************************//** * @brief - * The isPOSTPassed function determines whether all HD POST have passed. + * The isPOSTPassed function determines whether all DD POST have passed. * Call this function after POST is complete (call isPOSTCompleted function). * @details \b Inputs: postPassed * @details \b Outputs: none - * @return true if all HD POST tests have passed, false if not + * @return true if all DD POST tests have passed, false if not *************************************************************************/ BOOL isPOSTPassed( void ) { @@ -330,7 +250,7 @@ { BOOL passed = ( SELF_TEST_STATUS_PASSED == testStatus ? TRUE : FALSE ); - // Broadcast passed POST result + // Broadcast POST result //sendPOSTTestResult( (DD_POST_STATE_T)((int)postState), passed ); // Move on to next POST test result = (DD_POST_STATE_T)((int)postState + 1); @@ -348,6 +268,8 @@ * The handlePOSTStateStart function handles the POST start state. * @details \b Inputs: startPOSTDelayCounter, systemREG1 * @details \b Outputs: startPOSTDelayCounter, systemREG1 + * @details \b Message \b Sent: DD_EVENT_STARTUP with system register details and + * DD_EVENT_OP_MODE_CHANGE listing previous to new mode change details. * @return next POST state *************************************************************************/ static DD_POST_STATE_T handlePOSTStateStart( void )