Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
8d0a8a57
Commit
8d0a8a57
authored
Apr 04, 2018
by
devsaurus
Browse files
refactor task wdt handling to platform layer
parent
a63da92e
Changes
3
Hide whitespace changes
Inline
Side-by-side
components/platform/flash_api.c
View file @
8d0a8a57
...
@@ -9,9 +9,10 @@
...
@@ -9,9 +9,10 @@
#include <stdlib.h>
#include <stdlib.h>
#include "rom/spi_flash.h"
#include "rom/spi_flash.h"
#include "platform_wdt.h"
#include "esp_image_format.h"
#include "esp_image_format.h"
#include "esp_flash_data_types.h"
#include "esp_flash_data_types.h"
#include "esp_task_wdt.h"
#define FLASH_HDR_ADDR 0x1000
#define FLASH_HDR_ADDR 0x1000
...
@@ -175,14 +176,6 @@ uint32_t flash_rom_get_speed(void)
...
@@ -175,14 +176,6 @@ uint32_t flash_rom_get_speed(void)
esp_err_t
flash_erase
(
size_t
sector
)
esp_err_t
flash_erase
(
size_t
sector
)
{
{
#ifdef CONFIG_TASK_WDT
platform_wdt_feed
();
// re-init the task WDT, simulates feeding for the IDLE task
# ifdef CONFIG_TASK_WDT_PANIC
esp_task_wdt_init
(
CONFIG_TASK_WDT_TIMEOUT_S
,
true
);
# else
esp_task_wdt_init
(
CONFIG_TASK_WDT_TIMEOUT_S
,
false
);
# endif
#endif
return
spi_flash_erase_sector
(
sector
);
return
spi_flash_erase_sector
(
sector
);
}
}
components/platform/include/platform_wdt.h
0 → 100644
View file @
8d0a8a57
#ifndef __PLATFORM_WDT_H__
#define __PLATFORM_WDT_H__
int
platform_wdt_feed
(
void
);
#endif
components/platform/wdt.c
0 → 100644
View file @
8d0a8a57
/******************************************************************************
* WDT api for NodeMCU
* NodeMCU Team
* 2018-04-04
*******************************************************************************/
#include "platform.h"
#include "esp_task_wdt.h"
#ifdef CONFIG_TASK_WDT
static
uint32_t
task_wdt_timeout
=
CONFIG_TASK_WDT_TIMEOUT_S
;
static
bool
task_wdt_panic
=
#ifdef CONFIG_TASK_WDT_PANIC
true
;
#else
false
;
#endif
#endif
int
platform_wdt_feed
(
void
)
{
#ifdef CONFIG_TASK_WDT
return
esp_task_wdt_init
(
task_wdt_timeout
,
task_wdt_panic
)
==
ESP_OK
?
PLATFORM_OK
:
PLATFORM_ERR
;
#else
return
PLATFORM_OK
;
#endif
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment