#include "Hal_Wdg.h" volatile uint8 notificationCount = 0; void WdgInit(void) { /* Initialize the Wdg driver */ Wdg_43_Instance0_Init(&Wdg_Config_0_VS_0); /* Set the Wdg Trigger Condition in order to periodically service the Wdg */ Wdg_43_Instance0_SetTriggerCondition(5000); /*Change the Wdg mode of operation */ Wdg_43_Instance0_SetMode(WDGIF_FAST_MODE); /* Set the Wdg Trigger Condition in order to periodically service the Wdg */ Wdg_43_Instance0_SetTriggerCondition(5000); } void WdgDeInit(void) { Wdg_43_Instance0_SetMode(WDGIF_OFF_MODE); } void Wdg_CallBackNotification1(void) { notificationCount = 1U; } static void HAL_1msPeriod(void) { uint16 cntTmp = 0u; /* Just for check time overflow or not? */ cntTmp = hal_1ms_TimerCounter + 1u; if (0u != cntTmp) { hal_1ms_TimerCounter++; } cntTmp = hal_100ms_TimerCounter + 1u; if (0u != cntTmp) { hal_100ms_TimerCounter++; } } void vTimer1msCallback(TimerHandle_t pxTimer) { uint32 ulTimerID; ulTimerID = (uint32)pvTimerGetTimerID(pxTimer); if(ulTimerID==0) { HAL_1msPeriod(); } } boolean HAL_Is1msTickTimeout(void) { boolean result = FALSE; if (hal_1ms_TimerCounter) { result = TRUE; hal_1ms_TimerCounter--; } return result; } boolean HAL_Is100msTickTimeout(void) { boolean result = FALSE; if (hal_100ms_TimerCounter >= 100u) { result = TRUE; hal_100ms_TimerCounter -= 100u; } return result; } /* Get timer tick cnt for random seed. */ uint32 HAL_GetTimerTickCnt(void) { /* This two variables not init before used, because it used for generate random */ uint32 hardwareTimerTickCnt; uint32 timerTickCnt; #if 0 /* For S32K1xx get timer counter(LPTIMER), get timer count will trigger the period incorrect. */ hardwareTimerTickCnt = LPTMR_DRV_GetCounterValueByCount(INST_LPTMR1); #endif #pragma GCC diagnostic ignored "-Wuninitialized" timerTickCnt = ((hardwareTimerTickCnt & 0xFFFFu)) | (timerTickCnt << 16u); return timerTickCnt; } void WATCHDOG_HAL_Feed(void) { Wdg_43_Instance0_SetTriggerCondition(500); } //typedef void (*AppAddr)(void); void DoResetECUWithWdg(void) { IsFeedWdg = FALSE; Wdg_43_Instance0_SetTriggerCondition(0); while(1) { // AppAddr resetHandle = (AppAddr)(0x00); // (resetHandle)(); ; } }