Index: firmware/App/Services/WatchdogMgmt.c =================================================================== diff -u -r44c977966ab7cfecbfbf5110e6abe4ec45ebab62 -r22f1a58ac8e419353ec004b04e7c765c1d59df2b --- firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 44c977966ab7cfecbfbf5110e6abe4ec45ebab62) +++ firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 22f1a58ac8e419353ec004b04e7c765c1d59df2b) @@ -7,8 +7,8 @@ * * @file WatchdogMgmt.c * -* @author (last) Sean Nash -* @date (last) 19-Aug-2020 +* @author (last) Quang Nguyen +* @date (last) 14-Sep-2020 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -34,11 +34,11 @@ /// List of watchdog states. typedef enum Button_Self_Test_States { - WATCHDOG_SELF_TEST_STATE_START = 0, ///< Watchdog self test state start - WATCHDOG_SELF_TEST_STATE_IN_PROGRESS, ///< watchdog self test state in progress - WATCHDOG_SELF_TEST_STATE_RECOVER, ///< Watchdog self test state recover - WATCHDOG_SELF_TEST_STATE_COMPLETE, ///< Watchdog self test state complete - NUM_OF_WATCHDOG_SELF_TEST_STATES ///< Number of watchdog self test states + WATCHDOG_SELF_TEST_STATE_START = 0, ///< Watchdog self-test state start + WATCHDOG_SELF_TEST_STATE_IN_PROGRESS, ///< watchdog self-test state in progress + WATCHDOG_SELF_TEST_STATE_RECOVER, ///< Watchdog self-test state recover + WATCHDOG_SELF_TEST_STATE_COMPLETE, ///< Watchdog self-test state complete + NUM_OF_WATCHDOG_SELF_TEST_STATES ///< Number of watchdog self-test states } WATCHDOG_SELF_TEST_STATE_T; // ********** private data ********** @@ -47,10 +47,10 @@ static OVERRIDE_U32_T watchdogTaskCheckedIn[ NUM_OF_TASKS ]; ///< Array of flags indicating whether individual tasks have checked in with watchdog manager. -static WATCHDOG_SELF_TEST_STATE_T watchdogSelfTestState; ///< Watchdog self test current state. -static SELF_TEST_STATUS_T watchdogSelfTestStatus; ///< Watchdog self test status. -static U32 watchdogSelfTestTimerCount = 0; ///< Watchdog self test timer count. - +static WATCHDOG_SELF_TEST_STATE_T watchdogSelfTestState; ///< Watchdog self-test current state. +static SELF_TEST_STATUS_T watchdogSelfTestStatus; ///< Watchdog self-test status. +static U32 watchdogSelfTestTimerCount = 0; ///< Watchdog self-test timer count. + // ********** private function prototypes ********** static void resetWDTaskCheckIns( void ); @@ -61,9 +61,8 @@ /*********************************************************************//** * @brief * The initWatchdogMgmt function initializes the WatchdogMgmt module. - * @details - * Inputs : none - * Outputs : WatchdogMgmt module initialized. + * @details Inputs: none + * @details Outputs: WatchdogMgmt module initialized. * @return none *************************************************************************/ void initWatchdogMgmt( void ) @@ -87,9 +86,8 @@ /*********************************************************************//** * @brief * The execWatchdogMgmt function executes the watchdog management service. - * @details - * Inputs : watchdogTaskCheckedIn[] - * Outputs : Pets watchdog when all tasks checked in + * @details Inputs: watchdogTaskCheckedIn[] + * @details Outputs: Pets watchdog when all tasks checked in * @return none *************************************************************************/ void execWatchdogMgmt( void ) @@ -104,13 +102,13 @@ // if all monitored tasks checked in, pet watchdog and clear the slate if ( ( TRUE == allTasksCheckedIn ) && ( didTimeout( lastWatchdogPetTime, MIN_WATCHDOG_PET_INTERVAL_MS ) ) ) - { - petWatchdog(); + { + petWatchdog(); resetWDTaskCheckIns(); } // check to see if watchdog has expired - if ( getCPLDWatchdogExpired() == PIN_SIGNAL_HIGH ) + if ( PIN_SIGNAL_LOW == getCPLDWatchdogExpired() ) { // ignore expired watchdog until after watchdog POST if ( WATCHDOG_SELF_TEST_STATE_COMPLETE == watchdogSelfTestState ) @@ -126,9 +124,8 @@ * @brief * The checkInWithWatchdogMgmt function checks a given task in with the * watchdog management service. - * @details - * Inputs : none - * Outputs : task is checked in with the watchdog management + * @details Inputs: none + * @details Outputs: task is checked in with the watchdog management * @param task the task that is checking in with the watchdog management * @return none *************************************************************************/ @@ -144,9 +141,8 @@ * @brief * The execWatchdogTest function executes the watchdog test. This function * should be called periodically until a pass or fail result is returned. - * @details - * Inputs : watchdogSelfTestState - * Outputs : Executed watchdog self test + * @details Inputs: watchdogSelfTestState + * @details Outputs: Executed watchdog self-test * @return in progress, passed, or failed *************************************************************************/ SELF_TEST_STATUS_T execWatchdogTest( void ) @@ -165,13 +161,13 @@ { // waiting here for w.d. test period to prevent this task from checking in - watchdog should expire } - if ( getCPLDWatchdogExpired() == PIN_SIGNAL_HIGH ) + if ( PIN_SIGNAL_LOW == getCPLDWatchdogExpired() ) { watchdogSelfTestStatus = SELF_TEST_STATUS_PASSED; } else { - activateAlarmNoData( ALARM_ID_WATCHDOG_POST_TEST_FAILED ); + activateAlarmNoData( ALARM_ID_DG_WATCHDOG_POST_TEST_FAILED ); watchdogSelfTestStatus = SELF_TEST_STATUS_FAILED; } watchdogSelfTestTimerCount = getMSTimerCount(); @@ -187,7 +183,7 @@ break; case WATCHDOG_SELF_TEST_STATE_COMPLETE: - // if we get called in this state, assume we're doing self test again + // if we get called in this state, assume we're doing self-test again watchdogSelfTestStatus = SELF_TEST_STATUS_IN_PROGRESS; watchdogSelfTestState = WATCHDOG_SELF_TEST_STATE_START; break; @@ -204,9 +200,8 @@ /*********************************************************************//** * @brief * The resetWDTaskCheckIns function resets the task check-ins with the watchdog. - * @details - * Inputs : none - * Outputs : watchdogTaskCheckedIn[] array reset to all false. + * @details Inputs: none + * @details Outputs: watchdogTaskCheckedIn[] array reset to all false. * @return none *************************************************************************/ static void resetWDTaskCheckIns( void ) @@ -224,9 +219,8 @@ * @brief * The haveAllTasksCheckedIn function determines whether all tasks have * checked in with watchdog mgmt. - * @details - * Inputs : watchdogTaskCheckedIn[] - * Outputs : none + * @details Inputs: watchdogTaskCheckedIn[] + * @details Outputs: none * @return TRUE if all tasks have checked in since last watchdog pet, FALSE if not. *************************************************************************/ static BOOL haveAllTasksCheckedIn( void ) @@ -250,9 +244,8 @@ /*********************************************************************//** * @brief * The hasTaskGeneralCheckedIn function gets the check-in state of a given task. - * @details - * Inputs : watchdogTaskCheckedIn[] - * Outputs : none + * @details Inputs: watchdogTaskCheckedIn[] + * @details Outputs: none * @param task ID of task to check * @return TRUE if given task has checked in, FALSE if not *************************************************************************/ @@ -273,7 +266,7 @@ } else { - activateAlarmNoData( ALARM_ID_DG_SOFTWARE_FAULT ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_TASK, task ); } return result; @@ -282,9 +275,8 @@ /*********************************************************************//** * @brief * The petWatchdog function pets the watchdog by pulsing the CPLD WD pet signal. - * @details - * Inputs : none - * Outputs : CPLD WD pet signal is pulsed + * @details Inputs: none + * @details Outputs: CPLD WD pet signal is pulsed * @return none *************************************************************************/ static void petWatchdog( void ) @@ -306,9 +298,8 @@ * @brief * The testSetWatchdogTaskCheckInOverride function overrides the state of the * task check-in with the watchdog management with a given check-in state. - * @details - * Inputs : none - * Outputs : watchdogTaskCheckedIn[] + * @details Inputs: none + * @details Outputs: watchdogTaskCheckedIn[] * @param task ID of task to override check-in state for * @param value override state for the given task ID * @return TRUE if override successful, FALSE if not @@ -334,9 +325,8 @@ * @brief * The testResetWatchdogTaskCheckInOverride function resets the override of the * state of the check-in with the watchdog management. - * @details - * Inputs : none - * Outputs : watchdogTaskCheckedIn[] + * @details Inputs: none + * @details Outputs: watchdogTaskCheckedIn[] * @param task ID of task to override check-in state for * @return TRUE if override reset successful, FALSE if not *************************************************************************/