Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r395522dffef1348e176564925656012f529c1910 -r5a29e093e8a11f971c312cab5f6e7fedae2953db --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 395522dffef1348e176564925656012f529c1910) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 5a29e093e8a11f971c312cab5f6e7fedae2953db) @@ -23,6 +23,7 @@ //#include "Buttons.h" #include "Compatible.h" #include "CpldInterface.h" +#include "Ejector.h" //#include "Fans.h" #include "FpgaTD.h" //#include "Integrity.h" @@ -53,6 +54,9 @@ /// Maximum wait time for UI to send its final POST result. #define POST_UI_MAX_WAIT_TIME ( 2 * MS_PER_SECOND / TASK_GENERAL_INTERVAL ) +/// Ejector homing post test time interval (ms/task time) +#define EJECTOR_HOME_POST_TIMEOUT ( 10 * MS_PER_SECOND / TASK_GENERAL_INTERVAL ) + // ********** private data ********** static TD_POST_STATE_T postState; ///< Current state of initialize and POST mode. @@ -66,6 +70,7 @@ static BOOL dgPOSTResultReceived; ///< Have we received a final POST result from the DG? static U32 waitForUIPostTimerCtr; ///< Timer counter to limit wait for UI final POST result. static U32 postCompleteDelayTimerCtr; ///< Timer counter for 2 second delay after POST completes and before transitioning to Standbymode. +static U32 ejectorHomePostTimerCounter; ///< TImer counter for ejector homing POST test. static UI_VERSIONS_T uiVersion = { 0, 0, 0, 0, 0 }; ///< Version and compatibility information reported by UI. static DD_VERSIONS_T dgVersion = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ///< Version and compatibility information reported by DG. @@ -79,6 +84,7 @@ static TD_POST_STATE_T handlePOSTStateStart( void ); static SELF_TEST_STATUS_T execFWCompatibilityTest( void ); static SELF_TEST_STATUS_T execUITest( void ); +static SELF_TEST_STATUS_T execEjectorHomingTest( void ); /*********************************************************************//** * @brief @@ -89,17 +95,18 @@ *************************************************************************/ void initInitAndPOSTMode( void ) { - postState = POST_STATE_START; - postCompleted = FALSE; - postPassed = FALSE; - tempPOSTPassed = TRUE; - uiPOSTPassed = FALSE; - dgPOSTPassed = FALSE; - uiPOSTResultReceived = FALSE; - dgPOSTResultReceived = FALSE; - waitForUIPostTimerCtr = 0; - postCompleteDelayTimerCtr = 0; - startPOSTDelayCounter = 0; + postState = POST_STATE_START; + postCompleted = FALSE; + postPassed = FALSE; + tempPOSTPassed = TRUE; + uiPOSTPassed = FALSE; + dgPOSTPassed = FALSE; + uiPOSTResultReceived = FALSE; + dgPOSTResultReceived = FALSE; + waitForUIPostTimerCtr = 0; + postCompleteDelayTimerCtr = 0; + startPOSTDelayCounter = 0; + ejectorHomePostTimerCounter = 0; } /*********************************************************************//** @@ -250,6 +257,10 @@ postState = handlePOSTStatus( testStatus ); break; + case POST_STATE_EJECTOR_HOMING: + testStatus = execEjectorHomingTest(); + postState = handlePOSTStatus( testStatus ); + break; // Should be last POST (and last POST test must be a test that completes in a single call) case POST_STATE_FPGA: // testStatus = execFPGATest(); @@ -564,4 +575,34 @@ return result; } +/*********************************************************************//** + * @brief + * The execEjectorHomingTest function executes the ejector homing POST test. + * Commands the ejector to home on first call. + * @details \b Inputs: ejectorHomePostTimerCounter + * @details \b Outputs: ejectorHomePostTimerCounter + * @return in progress, passed, or failed + *************************************************************************/ +static SELF_TEST_STATUS_T execEjectorHomingTest( void ) +{ + SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; + + if ( 0U == ejectorHomePostTimerCounter ) + { + homeEjector(); + } + + if ( ++ejectorHomePostTimerCounter >= EJECTOR_HOME_POST_TIMEOUT ) + { + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TD_EJECTOR_POST_TEST_FAILED, (U32)getEjectorState() ); + result = SELF_TEST_STATUS_FAILED; + } + else if ( EJECTOR_STATE_RETRACTED == getEjectorState() ) + { + result = SELF_TEST_STATUS_PASSED; + } + + return result; +} + /**@}*/