![]() |
Energy Micro IEC60355 Library Example Project 1.0 (internal use only!) GCC-Version
Example project demonstrating POST and BIST library functions
|
POST test of WDOG unit and processing a reset
.
More...
|
Defines | |
| #define | SyncWDOGCTRL() (WDOG->SYNCBUSY & WDOG_SYNCBUSY_CTRL) |
| #define | SyncWDOGCMD() (WDOG->SYNCBUSY & WDOG_SYNCBUSY_CMD) |
Functions | |
| testResult_t | IEC60335_ClassB_initWDT (void) |
| This function initializes the IEC60335 Class B WDT test for POST usage the function will be called after reset and checks the reset conditions The function will enable the WDOG module if the last reset condition was POR or EXT. In this case the WDOG start counting and will cause a WDOG reset after a period of time. Residing in the POST function the routine now will check for WDOG reset and return a pass result. | |
| void | IEC60335_ClassB_Refresh_WDT (void) |
| This function represents the part of the IEC60335 Class B WDT test which has to be executed within a loop. It refreshes the WDT counter. | |
| testResult_t | IEC60335_ClassB_Force_WDT_Reset (void) |
| This function starts the Watchdog and waits for positive reset conditions. | |
POST test of WDOG unit and processing a reset
.
starting the WDOG will force a reset of the chip. a second entry to the functions will
be checked for a WDOG reset reason.
| #define SyncWDOGCMD | ( | ) | (WDOG->SYNCBUSY & WDOG_SYNCBUSY_CMD) |
Definition at line 45 of file iec60335_class_b_wdt_test.c.
Referenced by IEC60335_ClassB_Refresh_WDT().
| #define SyncWDOGCTRL | ( | ) | (WDOG->SYNCBUSY & WDOG_SYNCBUSY_CTRL) |
Definition at line 44 of file iec60335_class_b_wdt_test.c.
Referenced by IEC60335_ClassB_initWDT().
| testResult_t IEC60335_ClassB_Force_WDT_Reset | ( | void | ) |
This function starts the Watchdog and waits for positive reset conditions.
(DO_NOT_INCLUDE_WITH_DOXYGEN)
Definition at line 121 of file iec60335_class_b_wdt_test.c.
References IEC60335_ClassB_initWDT(), and IEC60335_testFailed.
Referenced by IEC60335_ClassB_POST().
{
testResult_t result = IEC60335_testFailed;
/* no debugger allowed here */
result = IEC60335_ClassB_initWDT();
return result;
}


| testResult_t IEC60335_ClassB_initWDT | ( | void | ) |
This function initializes the IEC60335 Class B WDT test for POST usage
the function will be called after reset and checks the reset conditions
The function will enable the WDOG module if the last reset condition was POR or EXT.
In this case the WDOG start counting and will cause a WDOG reset after a period of time.
Residing in the POST function the routine now will check for WDOG reset and return a pass result.
(DO_NOT_INCLUDE_WITH_DOXYGEN)
Definition at line 56 of file iec60335_class_b_wdt_test.c.
References IEC60335_testFailed, IEC60335_testInProgress, IEC60335_testPassed, and SyncWDOGCTRL.
Referenced by IEC60335_ClassB_Force_WDT_Reset().
{
testResult_t result = IEC60335_testFailed;
uint32_t resetcause;
/* check for core locked condition */
resetcause = RMU->RSTCAUSE;
if (!(RMU->CTRL & (1 << _RMU_CTRL_LOCKUPRDIS_SHIFT)))
{
/* check POR or Ext-reset reset as last reset event */
if ((resetcause == RMU_RSTCAUSE_PORST)
|| ((resetcause & RMU_RSTCAUSE_EXTRST) && ((~resetcause) & 0x3)))
{
/* enable LE clock */
CMU->HFCORECLKEN0 |= CMU_HFCORECLKEN0_LE;
/* clear flag */
RMU->CMD = RMU_CMD_RCCLR;
EMU->AUXCTRL = EMU_AUXCTRL_HRCCLR;
EMU->AUXCTRL = 0;
/* init WDOG and start */
while (SyncWDOGCTRL()) ;
WDOG->CTRL = 0x80D;
/* optional WDOG_CTRL_DEBUGRUN */
result = IEC60335_testInProgress;
}
/* WDOG reset detected (second entry) */
else if ((resetcause & RMU_RSTCAUSE_WDOGRST) && (~resetcause & 0x03))
{
/* test has been successful */
result = IEC60335_testPassed;
/* optional clear flag */
/* RMU->CMD = RMU_CMD_RCCLR; */
}
}
return result;
}

| void IEC60335_ClassB_Refresh_WDT | ( | void | ) |
This function represents the part of the IEC60335 Class B WDT test which has to be executed within a loop. It refreshes the WDT counter.
(DO_NOT_INCLUDE_WITH_DOXYGEN)
Definition at line 100 of file iec60335_class_b_wdt_test.c.
References SyncWDOGCMD.
{
/* If a previous clearing is being synchronized to LF domain, then there
* is no point in waiting for it to complete before clearing over again.
* This avoids stalling the core in the typical use case where some idle loop
* keeps clearing the watchdog. */
if (SyncWDOGCMD())
{
return;
}
WDOG->CMD = WDOG_CMD_CLEAR;
}