From 06f043935c62b49bfe2f96c96d405d3f0f718221 Mon Sep 17 00:00:00 2001 From: maxxir Date: Mon, 18 Mar 2019 18:06:56 +0400 Subject: [PATCH] Added Prologue for fast WDT disable --- 02_m1284p_FATFS_Chang_tst/main.c | 2 +- 02_m1284p_FATFS_LFN_Chang_tst/main.c | 1 + 03_m1284p_WIZNET_loopback_FATFS_template/main.c | 2 +- 03_m1284p_WIZNET_loopback_STATIC_IP/main.c | 2 +- 04_m1284p_WIZNET_loopback_DHCP/main.c | 14 ++++++++++++++ 05_m1284p_WIZNET_DNS_client/main.c | 15 +++++++++++++++ 06_m1284p_WIZNET_DNS_SNTP_client/main.c | 15 +++++++++++++++ 07_m1284p_WIZNET_telnets_basic/main.c | 15 +++++++++++++++ 08_m1284p_WIZNET_ICMP_aka_ping/main.c | 15 +++++++++++++++ 09_m1284p_WIZNET_simple_webserver/main.c | 15 +++++++++++++++ 10_m1284p_WIZNET_HTTPServer_RAM_pages/main.c | 15 +++++++++++++++ 11_m1284p_WIZNET_HTTPServer_FLASH_pages/main.c | 15 +++++++++++++++ 11_m644p_WIZNET_HTTPServer_FLASH_pages/main.c | 15 +++++++++++++++ 12_m1284p_WIZNET_HTTPServer_SDCARD_pages/main.c | 2 +- 12_m644p_WIZNET_HTTPServer_SDCARD_pages/main.c | 2 +- 14_m1284p_WIZNET_FTPC_FATFS/main.c | 2 +- 15_m1284p_WIZNET_FTPD_FATFS/main.c | 2 +- 16_m1284p_WIZNET_HTTPD_FTPD_FATFS_SDCARD/main.c | 2 +- 17_m1284p_BTLD_WIZNET_HTTPD_FTPD_FATFS_SDCARD/main.c | 2 +- 18_m1284p_BTLD_WIZNET_LOOPBACK_FTPD_FATFS_SDCARD/main.c | 2 +- 18_m644p_BTLD_WIZNET_LOOPBACK_FTPD_FATFS_SDCARD/main.c | 2 +- 21 files changed, 146 insertions(+), 11 deletions(-) diff --git a/02_m1284p_FATFS_Chang_tst/main.c b/02_m1284p_FATFS_Chang_tst/main.c index 9c670bd..5054dc3 100644 --- a/02_m1284p_FATFS_Chang_tst/main.c +++ b/02_m1284p_FATFS_Chang_tst/main.c @@ -150,7 +150,7 @@ int xatoi ( /* 0:Failed, 1:Successful */ //************************* Fat FS declare related: END -//***********Prologue for fast WDT disable & and save reason of reset/power-up: END +//***********Prologue for fast WDT disable & and save reason of reset/power-up: BEGIN uint8_t mcucsr_mirror __attribute__ ((section (".noinit"))); // This is for fast WDT disable & and save reason of reset/power-up diff --git a/02_m1284p_FATFS_LFN_Chang_tst/main.c b/02_m1284p_FATFS_LFN_Chang_tst/main.c index 38dfcfe..96d7d0d 100644 --- a/02_m1284p_FATFS_LFN_Chang_tst/main.c +++ b/02_m1284p_FATFS_LFN_Chang_tst/main.c @@ -149,6 +149,7 @@ int xatoi ( /* 0:Failed, 1:Successful */ //************************* Fat FS declare related: END +//***********Prologue for fast WDT disable & and save reason of reset/power-up: BEGIN uint8_t mcucsr_mirror __attribute__ ((section (".noinit"))); // This is for fast WDT disable & and save reason of reset/power-up diff --git a/03_m1284p_WIZNET_loopback_FATFS_template/main.c b/03_m1284p_WIZNET_loopback_FATFS_template/main.c index 27e6564..f9a408f 100644 --- a/03_m1284p_WIZNET_loopback_FATFS_template/main.c +++ b/03_m1284p_WIZNET_loopback_FATFS_template/main.c @@ -57,7 +57,7 @@ wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac add * */ -//***********Prologue for fast WDT disable & and save reason of reset/power-up: END +//***********Prologue for fast WDT disable & and save reason of reset/power-up: BEGIN uint8_t mcucsr_mirror __attribute__ ((section (".noinit"))); // This is for fast WDT disable & and save reason of reset/power-up diff --git a/03_m1284p_WIZNET_loopback_STATIC_IP/main.c b/03_m1284p_WIZNET_loopback_STATIC_IP/main.c index b2bb728..690a7b0 100644 --- a/03_m1284p_WIZNET_loopback_STATIC_IP/main.c +++ b/03_m1284p_WIZNET_loopback_STATIC_IP/main.c @@ -35,7 +35,7 @@ * */ -//***********Prologue for fast WDT disable & and save reason of reset/power-up: END +//***********Prologue for fast WDT disable & and save reason of reset/power-up: BEGIN uint8_t mcucsr_mirror __attribute__ ((section (".noinit"))); // This is for fast WDT disable & and save reason of reset/power-up diff --git a/04_m1284p_WIZNET_loopback_DHCP/main.c b/04_m1284p_WIZNET_loopback_DHCP/main.c index 96da67f..ce322c8 100644 --- a/04_m1284p_WIZNET_loopback_DHCP/main.c +++ b/04_m1284p_WIZNET_loopback_DHCP/main.c @@ -19,6 +19,20 @@ #include "Internet/DHCP/dhcp.h" #include "Application/loopback/loopback.h" +//***********Prologue for fast WDT disable & and save reason of reset/power-up: BEGIN +uint8_t mcucsr_mirror __attribute__ ((section (".noinit"))); + +// This is for fast WDT disable & and save reason of reset/power-up +void get_mcusr(void) \ + __attribute__((naked)) \ + __attribute__((section(".init3"))); +void get_mcusr(void) +{ + mcucsr_mirror = MCUSR; + MCUSR = 0; + wdt_disable(); +} +//***********Prologue for fast WDT disable & and save reason of reset/power-up: END //#include // itoa etc.. /* diff --git a/05_m1284p_WIZNET_DNS_client/main.c b/05_m1284p_WIZNET_DNS_client/main.c index f779fa9..487b679 100644 --- a/05_m1284p_WIZNET_DNS_client/main.c +++ b/05_m1284p_WIZNET_DNS_client/main.c @@ -56,6 +56,21 @@ #define sw1_conf() {DDRC &= ~(1<