xmega_reset_cause.h
Go to the documentation of this file.00001
00038 #ifndef XMEGA_DRIVERS_CPU_RESET_CAUSE_H
00039 #define XMEGA_DRIVERS_CPU_RESET_CAUSE_H
00040
00041 #include "compiler.h"
00042 #include "ccp.h"
00043
00055 typedef uint8_t reset_cause_t;
00056
00058
00059
00060 #define CHIP_RESET_CAUSE_EXTRST RST_EXTRF_bm
00061
00062 #define CHIP_RESET_CAUSE_BOD_IO RST_BORF_bm
00063
00064 #define CHIP_RESET_CAUSE_BOD_CPU RST_BORF_bm
00065
00066 #define CHIP_RESET_CAUSE_OCD RST_PDIRF_bm
00067
00068 #define CHIP_RESET_CAUSE_POR RST_PORF_bm
00069
00070 #define CHIP_RESET_CAUSE_SOFT RST_SRF_bm
00071
00072 #define CHIP_RESET_CAUSE_SPIKE RST_SDRF_bm
00073
00074 #define CHIP_RESET_CAUSE_WDT RST_WDRF_bm
00075
00076
00077 static inline reset_cause_t reset_cause_get_causes(void)
00078 {
00079 return (reset_cause_t)RST.STATUS;
00080 }
00081
00082 static inline void reset_cause_clear_causes(reset_cause_t causes)
00083 {
00084 RST.STATUS &= ~(causes);
00085 }
00086
00087 static inline void reset_do_soft_reset(void)
00088 {
00089 ccp_write_io((void *)&RST.CTRL, RST_SWRST_bm);
00090
00091 while (1) {
00092
00093 }
00094 }
00095
00097
00098 #endif