Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -rde5a0d43bdef611d963d11855bc958a8d8899a09 -r5eda37efda2d771de4f5cfb509adf05621a290c3 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision de5a0d43bdef611d963d11855bc958a8d8899a09) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 5eda37efda2d771de4f5cfb509adf05621a290c3) @@ -15,9 +15,12 @@ * ***************************************************************************/ +#include "Accel.h" #include "AlarmLamp.h" +#include "BloodFlow.h" #include "Buttons.h" #include "CPLD.h" +#include "DialInFlow.h" #include "FPGA.h" #include "OperationModes.h" #include "RTC.h" @@ -34,22 +37,21 @@ // ********** private data ********** -static HD_POST_STATE_T postState = POST_STATE_START; -static BOOL postCompleted = FALSE; -static BOOL postPassed = FALSE; -static BOOL tempPOSTPassed = TRUE; +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. // ********** private function prototypes ********** static HD_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus ); -/************************************************************************* - * @brief initInitAndPOSTMode +/*********************************************************************//** + * @brief * The initInitAndPOSTMode function initializes the Initialize & POST Mode module. * @details * Inputs : none * Outputs : Initialize & POST Mode module initialized. - * @param none * @return none *************************************************************************/ void initInitAndPOSTMode( void ) @@ -60,27 +62,25 @@ tempPOSTPassed = TRUE; } -/************************************************************************* - * @brief transitionToInitAndPOSTMode - * The transitionToInitAndPOSTMode function prepares for transition to\n +/*********************************************************************//** + * @brief + * The transitionToInitAndPOSTMode function prepares for transition to * initialize & POST mode. * @details * Inputs : none - * Outputs : - * @param none + * Outputs : none * @return none *************************************************************************/ void transitionToInitAndPOSTMode( void ) { } -/************************************************************************* - * @brief execInitAndPOSTMode +/*********************************************************************//** + * @brief * The execInitAndPOSTMode function executes the Initialize & POST Mode state machine. * @details - * Inputs : none - * Outputs : - * @param none + * Inputs : postState + * Outputs : postState, postPassed, postCompleted * @return current state (sub-mode) *************************************************************************/ U32 execInitAndPOSTMode( void ) @@ -127,6 +127,25 @@ postState = handlePOSTStatus( testStatus ); break; + case POST_STATE_BLOOD_FLOW: + testStatus = execBloodFlowTest(); + postState = handlePOSTStatus( testStatus ); + break; + + case POST_STATE_DIALYSATE_FLOW: + testStatus = execDialInFlowTest(); + postState = handlePOSTStatus( testStatus ); + break; + + case POST_STATE_ACCELEROMETER: +#ifndef DISABLE_ACCELS + testStatus = execAccelTest(); +#else + testStatus = SELF_TEST_STATUS_PASSED; +#endif + postState = handlePOSTStatus( testStatus ); + break; + case POST_STATE_STUCK_BUTTON: testStatus = execStuckButtonTest(); handlePOSTStatus( testStatus ); @@ -154,53 +173,51 @@ 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: - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_SOFTWARE_FAULT, SW_FAULT_ID_MODE_INIT_POST_INVALID_POST_STATE, postState ) + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_MODE_INIT_POST_INVALID_POST_STATE, postState ) postState = POST_STATE_FAILED; break; } return postState; } -/************************************************************************* - * @brief isPOSTCompleted - * The isPOSTCompleted function determines whether all HD POST have \n - * been run and completed. If true, call the isPOSTPassed() to see final \n +/*********************************************************************//** + * @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). * @details * Inputs : postCompleted * Outputs : none - * @param none * @return true if all HD POST tests have completed, false if not *************************************************************************/ BOOL isPOSTCompleted( void ) { return postCompleted; } -/************************************************************************* - * @brief isPOSTPassed - * The isPOSTPassed function determines whether all HD POST have passed. \n +/*********************************************************************//** + * @brief + * The isPOSTPassed function determines whether all HD POST have passed. * Call this function after POST is complete (call isPOSTCompleted function). * @details * Inputs : postPassed * Outputs : none - * @param none * @return true if all HD POST tests have passed, false if not *************************************************************************/ BOOL isPOSTPassed( void ) { return postPassed; } -/************************************************************************* - * @brief handlePOSTStatus +/*********************************************************************//** + * @brief * The handlePOSTStatus function handles a status result returned by a * POST function. * @details * Inputs : postPassed * Outputs : none - * @param testStatus + * @param testStatus status reported by last test * @return recommended next POST state *************************************************************************/ static HD_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus )