Nut/OS  4.10.3
API Reference
reset.c
Go to the documentation of this file.
00001 
00045 #include <arch/avr32.h>
00046 #include <dev/reset.h>
00047 #include <dev/watchdog.h>
00048 
00049 #include <avr32/io.h>
00050 
00055 
00059 void Avr32Reset(void)
00060 {
00061     /* use the watchdog. */
00062     if (NutWatchDogStart(1, 0)) {
00063         for (;;);
00064     }
00065 }
00066 
00067 int Avr32ResetCause(void)
00068 {
00069     int rc = NUT_RSTTYP_UNKNOWN;
00070 
00071     switch (AVR32_PM.rcause) {
00072     case AVR32_PM_RCAUSE_POR:
00073         rc = NUT_RSTTYP_POWERUP;
00074         break;
00075     case AVR32_PM_RCAUSE_WDT:
00076         rc = NUT_RSTTYP_WATCHDOG;
00077         break;
00078     case AVR32_PM_RCAUSE_EXT:
00079         rc = NUT_RSTTYP_EXTERNAL;
00080         break;
00081     case AVR32_PM_RCAUSE_BOD:
00082         rc = NUT_RSTTYP_BROWNOUT;
00083         break;
00084     }
00085     return rc;
00086 }
00087