Beispiel #1
0
/*********************************************************************//**
 * @brief       Configure the WatchDog by initialization all the timing
 *              value for register (Warning value, Window value,...)
 *
 * @param       wdtCfg a the st_Wdt_Config type value
 *
 * @return      None
 **********************************************************************/
void WWDT_Configure(st_Wdt_Config wdtCfg)
{
    WWDT_SetTimeOut(wdtCfg.wdtTmrConst);

    if(wdtCfg.wdtEnable)
    {
        LPC_WDT->MOD |= WWDT_WDMOD_WDEN;
    }
    else
    {
        LPC_WDT->MOD &= ~WWDT_WDMOD_WDEN;
    }

    if(wdtCfg.wdtReset)
    {
        LPC_WDT->MOD |= WWDT_WDMOD_WDRESET;
    }
    else
    {
        LPC_WDT->MOD &= ~WWDT_WDMOD_WDRESET;
    }

    if(wdtCfg.wdtProtect)
    {
        LPC_WDT->MOD |= WWDT_WDMOD_WDPROTECT;
    }
    else
    {
        LPC_WDT->MOD &= ~WWDT_WDMOD_WDPROTECT;
    }

    WWDT_SetWarning(wdtCfg.wdtWarningVal);

    WWDT_SetWindow(wdtCfg.wdtWindowVal);
}
Beispiel #2
0
/*********************************************************************//**
 * @brief       Start WatchDog with specific Timeout
 *
 * @param       TimeOut specific Timeout for WatchDog event
 *
 * @return      WWDT_FUNC_OK if success
 **********************************************************************/
int8_t WWDT_Start(uint32_t TimeOut)
{
    int8_t retval = WWDT_FUNC_OK;

    retval = WWDT_SetTimeOut(TimeOut);

    WWDT_Cmd(ENABLE);

    return retval;
}
/********************************************************************//**
 * @brief 		Update WDT timeout value and feed
 * @param[in]	TimeOut	TimeOut value to be updated, should be in range:
 * 				2048 .. 134217728
 * @return		None
 *********************************************************************/
void WDT_UpdateTimeOut(uint32_t TimeOut)
{
	/* check WDPROTECT,
	 * if it is enable, wait until the counter is below the value of
	 * WDWARNINT and WDWINDOW
	 */
	if(LPC_WWDT->MOD & (1<<4))
	{
		while((LPC_WWDT->TV <(LPC_WWDT->WARNINT & WWDT_WDWARNINT_MASK))\
						&&(LPC_WWDT->TV <(LPC_WWDT->WINDOW & WWDT_WDTC_MASK)));
	}

	WWDT_SetTimeOut(TimeOut);
}
/*********************************************************************//**
* @brief 		Enable/Disable WWDT activity
* @param[in]	None
* @return 		None
 **********************************************************************/
void WWDT_Configure(st_Wdt_Config wdtCfg)
{
	WWDT_SetTimeOut(wdtCfg.wdtTmrConst);

	if(wdtCfg.wdtReset)
	{
		LPC_WWDT->MOD |= WWDT_WDMOD_WDRESET;
	}
	else
	{
		LPC_WWDT->MOD &= ~WWDT_WDMOD_WDRESET;
	}

	if(wdtCfg.wdtProtect)
	{
		LPC_WWDT->MOD |= WWDT_WDMOD_WDPROTECT;
	}
	else
	{
		LPC_WWDT->MOD &= ~WWDT_WDMOD_WDPROTECT;
	}
}
Beispiel #5
0
/*********************************************************************//**
* @brief        Initial for Watchdog function by setting timeout
*
* @param[in]    TimeOut time out value, should be in range:
*               2048 .. 134217728
*
* @return      WWDT_FUNC_OK if success
 **********************************************************************/
int8_t WWDT_Init(uint32_t TimeOut)
{
    return WWDT_SetTimeOut(TimeOut);
}