diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-01-08 15:12:21 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-01-08 15:12:21 +0100 |
commit | 114072c5873f58064f59613abeb2bf4d46312808 (patch) | |
tree | 8e2bb8800df8a304ce0d7ec0fbb572e3783fd93a /usb-dfu-experiment | |
parent | f2be0ee6d8ed310c100c22aed2e706bf59dd4495 (diff) |
read reset reason
Diffstat (limited to 'usb-dfu-experiment')
-rw-r--r-- | usb-dfu-experiment/main.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/usb-dfu-experiment/main.c b/usb-dfu-experiment/main.c index 81f7e89..31c2c4f 100644 --- a/usb-dfu-experiment/main.c +++ b/usb-dfu-experiment/main.c @@ -54,6 +54,8 @@ #include <memories/flash/flashd.h> +#include <peripherals/rstc/rstc.h> + #include <usb/device/core/USBD.h> #include <usb/device/core/USBDDriver.h> #include <usb/device/dfu/dfu.h> @@ -395,9 +397,14 @@ void dfu_drv_updstatus(void) extern void USBD_IrqHandler(void); +static const char *rst_type_strs[8] = { + "General", "Backup", "Watchdog", "Softare", "User", "5", "6", "7" +}; + int main(void) { volatile uint8_t usbConn = 0; + unsigned long rst_type; TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK); @@ -405,6 +412,9 @@ int main(void) printf("-- %s\n\r", BOARD_NAME); printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__); + rst_type = (RSTC_GetStatus() >> 8) & 0x7; + printf("-- Reset type: %s --\n\r", rst_type_strs[rst_type]); + chipid_to_usbserial(); /* If they are present, configure Vbus & Wake-up pins */ |