Example #1
0
/*FUNCTION****************************************************************
 *
 * Function Name : WDOG_DRV_Unlock
 * Description   : Unlock watchdog register written
 * This function is used to unlock the WDOG register written because WDOG register
 * will lock automatically after 256 bus clock. Written while the register is
 * locked has no affect.
 *
 *END*********************************************************************/
static void WDOG_DRV_Unlock(void)
{
    INT_SYS_DisableIRQGlobal();

    WDOG_HAL_Unlock(g_wdogBaseAddr[0]);

    INT_SYS_EnableIRQGlobal();
}
Example #2
0
/*FUNCTION**********************************************************************
 *
 * Function Name : WDOG_HAL_Init
 * Description   : Initialize WDOG peripheral to workable state.
 *
 *END**************************************************************************/
void WDOG_HAL_Init(WDOG_Type * base)
{
    wdog_work_mode_t initWorkmode;
#if FSL_FEATURE_WDOG_HAS_WAITEN
    initWorkmode.kWdogEnableInWaitMode  = true;
#endif
    initWorkmode.kWdogEnableInStopMode  = false;
    initWorkmode.kWdogEnableInDebugMode = false;
    wdog_config_t initConfig;
    initConfig.wdogEnable   = true;
    initConfig.clkSrc       = kWdogLpoClkSrc;
    initConfig.prescaler    = kWdogClkPrescalerDivide1;
    initConfig.workMode     = initWorkmode;
    initConfig.updateEnable = true;
    initConfig.intEnable    = false;
    initConfig.winEnable    = false;
    WDOG_HAL_Unlock(base);
    WDOG_HAL_SetTimeoutValue(base, 0x004C4B4C);
    WDOG_HAL_SetWindowValue(base, 0);
    WDOG_HAL_SetConfig(base, &initConfig);
}