Index: App/Services/WatchdogMgmt.c =================================================================== diff -u -r8ba82119080b77f804fa2b3edadd11422f57371b -rcda7aca3cdae3f3a2c2bcefc009f96a9bf6e4bdd --- App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 8ba82119080b77f804fa2b3edadd11422f57371b) +++ App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision cda7aca3cdae3f3a2c2bcefc009f96a9bf6e4bdd) @@ -16,6 +16,7 @@ #include "Common.h" #include "CPLD.h" +#include "SystemCommMessages.h" #include "Timers.h" #include "WatchdogMgmt.h" @@ -35,10 +36,10 @@ // ********** private data ********** -static BOOL watchdogExpired = FALSE; static U32 lastWatchdogPetTime = 0; -static BOOL watchdogTaskCheckedIn[NUM_OF_TASKS]; +DATA_ARRAY_DECL( BOOL, TaskCheckIns, NUM_OF_TASKS, watchdogTaskCheckedIn ); + static WATCHDOG_SELF_TEST_STATE_T watchdogSelfTestState = WATCHDOG_SELF_TEST_STATE_START; static U32 watchdogSelfTestTimerCount = 0; @@ -47,6 +48,7 @@ static void resetWDTaskCheckIns( void ); static BOOL haveAllTasksCheckedIn( void ); static void petWatchdog( void ); +static DATA_ARRAY_GET_PROTOTYPE( BOOL, hasTaskGeneralCheckedIn, task ); /************************************************************************* * @brief initWatchdogMgmt @@ -59,11 +61,19 @@ *************************************************************************/ void initWatchdogMgmt( void ) { - watchdogExpired = FALSE; + U32 i; + lastWatchdogPetTime = 0; watchdogSelfTestState = WATCHDOG_SELF_TEST_STATE_START; watchdogSelfTestTimerCount = 0; - resetWDTaskCheckIns(); + // initialize task check-ins to false + for ( i = 0; i < NUM_OF_TASKS; i++ ) + { + watchdogTaskCheckedIn[i].data = FALSE; + watchdogTaskCheckedIn[i].ovData = FALSE; + watchdogTaskCheckedIn[i].ovInitData = FALSE; + watchdogTaskCheckedIn[i].override = OVERRIDE_RESET; + } } /************************************************************************* @@ -95,7 +105,7 @@ // check to see if watchdog has expired if ( getCPLDWatchdogExpired() == PIN_SIGNAL_HIGH ) { - watchdogExpired = TRUE; + // TODO - watchdog expired fault } } @@ -113,26 +123,11 @@ { if ( task < NUM_OF_TASKS ) { - watchdogTaskCheckedIn[task] = TRUE; + watchdogTaskCheckedIn[task].data = TRUE; } } /************************************************************************* - * @brief hasWatchdogExpired - * The hasWatchdogExpired function determines whether the watchdog has /n - * expired. - * @details - * Inputs : watchdogExpired - * Outputs : none - * @param none - * @return TRUE if watchdog has expired, FALSE if not. - *************************************************************************/ -BOOL hasWatchdogExpired( void ) -{ - return watchdogExpired; -} - -/************************************************************************* * @brief execWatchdogTest * The execWatchdogTest function executes the watchdog test. \n * This function should be called periodically until a pass or fail \n @@ -201,7 +196,7 @@ // initialize task check-ins to false for ( i = 0; i < NUM_OF_TASKS; i++ ) { - watchdogTaskCheckedIn[i] = FALSE; + watchdogTaskCheckedIn[i].data = FALSE; } } @@ -223,7 +218,7 @@ // check that each task has checked in for ( i = 0; i < NUM_OF_TASKS; i++ ) { - if ( FALSE == watchdogTaskCheckedIn[i] ) + if ( FALSE == hasTaskGeneralCheckedIn( i ) ) { result = FALSE; break; @@ -234,6 +229,18 @@ } /************************************************************************* + * @brief hasTaskGeneralCheckedIn + * The hasTaskGeneralCheckedIn function gets the check-in state of a given /n + * task. + * @details + * Inputs : watchdogTaskCheckedIn[] + * Outputs : none + * @param task : ID of task to check + * @return TRUE if given task has checked in, FALSE if not + *************************************************************************/ +static DATA_ARRAY_GET( BOOL, hasTaskGeneralCheckedIn, task, NUM_OF_TASKS-1, watchdogTaskCheckedIn, FALSE ) + +/************************************************************************* * @brief petWatchdog * The petWatchdog function pets the watchdog by pulsing the CPLD WD pet /n * signal. @@ -253,3 +260,46 @@ // remember when we last pet the watchdog lastWatchdogPetTime = getMSTimerCount(); } + + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/************************************************************************* + * @brief testSetWatchdogTaskCheckInOverride and testResetWatchdogTaskCheckInOverride + * The testSetWatchdogTaskCheckInOverride function overrides the state of the \n + * task check-in with the watchdog management with a given check-in state. \n + * The testResetWatchdogTaskCheckInOverride function resets the override of the \n + * state of the check-in with the watchdog management. + * @details + * Inputs : none + * 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 + *************************************************************************/ +DATA_ARRAY_OVERRIDE_FUNC( BOOL, testSetWatchdogTaskCheckInOverride, testResetWatchdogTaskCheckInOverride, watchdogTaskCheckedIn, task, NUM_OF_TASKS-1 ) + + + + + + + + + + + + + + + + + + + + + +