/************************************************************************** * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file TaskTimer.c * * @date 20-Sep-2019 * @author S. Nash * * @brief Timer task handler. * **************************************************************************/ #include #include "NVDataMgmt.h" #include "SafetyShutdown.h" #include "SystemComm.h" #include "Timers.h" #include "WatchdogMgmt.h" #include "TaskTimer.h" // ********** private definitions ********** #define MAX_TIME_FOR_UI_TO_COMMUNICATE_MS 30000 // 30 seconds // ********** private data ********** static U32 startUICommTimeout; static BOOL uiIsCommunicating = FALSE; /************************************************************************* * @brief taskBackground * The taskBackground function handles the idle Background Task loop. * Calls the Watchdog Mgmt. and NonVolatile Data services. * @details * Inputs : none * Outputs : Executive for watchdog mgmt. and non-volatile data services called. *************************************************************************/ void taskBackground( void ) { startUICommTimeout = getMSTimerCount(); #ifndef _VECTORCAST_ // can't have infinite loop in unit test tool while ( 1 ) #endif { // wait for UI to come up after power up if ( FALSE == uiIsCommunicating ) { if ( TRUE == uiCommunicated() ) { uiIsCommunicating = TRUE; } else { if ( TRUE == didTimeout( startUICommTimeout, MAX_TIME_FOR_UI_TO_COMMUNICATE_MS ) ) { activateAlarmNoData( ALARM_ID_UI_COMM_POST_FAILED ); } } } // manage the watchdog execWatchdogMgmt(); // Manage Non-volatile data manager execNVDataMgmt(); } }