From b535be7ab85ad6e6e1487e9b1636f1a2d6bb2722 Mon Sep 17 00:00:00 2001 From: Johny Mattsson Date: Tue, 27 Oct 2015 14:31:17 +1100 Subject: [PATCH] Fix WDT resets during file.format(). With the new SDK soft-wdt it is no longer sufficient to tickle the hardware watchdog, so all (found) instances have been changed to system_soft_wdt_feed(). --- app/modules/tmr.c | 6 +++--- app/platform/platform.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/modules/tmr.c b/app/modules/tmr.c index 8e9bc852..31d35d9e 100755 --- a/app/modules/tmr.c +++ b/app/modules/tmr.c @@ -121,11 +121,11 @@ static int tmr_delay( lua_State* L ){ while(us >= 1000000){ us -= 1000000; os_delay_us(1000000); - WRITE_PERI_REG(0x60000914, 0x73); + system_soft_wdt_feed (); } if(us>0){ os_delay_us(us); - WRITE_PERI_REG(0x60000914, 0x73); + system_soft_wdt_feed (); } return 0; } @@ -256,7 +256,7 @@ why they are here*/ // extern void update_key_led(); // Lua: tmr.wdclr() static int tmr_wdclr( lua_State* L ){ - WRITE_PERI_REG(0x60000914, 0x73); + system_soft_wdt_feed (); // update_key_led(); return 0; } diff --git a/app/platform/platform.c b/app/platform/platform.c index aa7fdc85..e712af8a 100644 --- a/app/platform/platform.c +++ b/app/platform/platform.c @@ -508,7 +508,7 @@ uint32_t platform_s_flash_write( const void *from, uint32_t toaddr, uint32_t siz return 0; c_memcpy(apbuf, from, size); } - WRITE_PERI_REG(0x60000914, 0x73); + system_soft_wdt_feed (); r = flash_write(toaddr, apbuf?(uint32 *)apbuf:(uint32 *)from, size); if(apbuf) c_free(apbuf); @@ -532,7 +532,7 @@ uint32_t platform_s_flash_read( void *to, uint32_t fromaddr, uint32_t size ) fromaddr -= INTERNAL_FLASH_START_ADDRESS; SpiFlashOpResult r; - WRITE_PERI_REG(0x60000914, 0x73); + system_soft_wdt_feed (); const uint32_t blkmask = (INTERNAL_FLASH_READ_UNIT_SIZE - 1); if( ((uint32_t)to) & blkmask ) @@ -561,6 +561,6 @@ uint32_t platform_s_flash_read( void *to, uint32_t fromaddr, uint32_t size ) int platform_flash_erase_sector( uint32_t sector_id ) { - WRITE_PERI_REG(0x60000914, 0x73); + system_soft_wdt_feed (); return flash_erase( sector_id ) == SPI_FLASH_RESULT_OK ? PLATFORM_OK : PLATFORM_ERR; }