mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 07:04:32 +02:00
esp_system: remove duplicated esp_digital_reset function
esp_digital_reset was defined both in system_api.c and panic_handler.c
This commit is contained in:
@@ -36,6 +36,11 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
void esp_restart_noos(void) __attribute__ ((noreturn));
|
void esp_restart_noos(void) __attribute__ ((noreturn));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Similar to esp_restart_noos, but resets all the digital peripherals.
|
||||||
|
*/
|
||||||
|
void esp_restart_noos_dig(void) __attribute__ ((noreturn));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Internal function to set reset reason hint
|
* @brief Internal function to set reset reason hint
|
||||||
*
|
*
|
||||||
|
@@ -542,25 +542,6 @@ void xt_unhandled_exception(XtExcFrame *frame)
|
|||||||
panic_handler(frame, false);
|
panic_handler(frame, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __attribute__((noreturn)) void esp_digital_reset(void)
|
|
||||||
{
|
|
||||||
// make sure all the panic handler output is sent from UART FIFO
|
|
||||||
uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
|
|
||||||
// switch to XTAL (otherwise we will keep running from the PLL)
|
|
||||||
|
|
||||||
rtc_clk_cpu_freq_set_xtal();
|
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
|
||||||
esp_cpu_unstall(PRO_CPU_NUM);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// reset the digital part
|
|
||||||
SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_SW_SYS_RST);
|
|
||||||
while (true) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void __attribute__((noreturn)) panic_restart(void)
|
void __attribute__((noreturn)) panic_restart(void)
|
||||||
{
|
{
|
||||||
bool digital_reset_needed = false;
|
bool digital_reset_needed = false;
|
||||||
@@ -576,7 +557,7 @@ void __attribute__((noreturn)) panic_restart(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (digital_reset_needed) {
|
if (digital_reset_needed) {
|
||||||
esp_digital_reset();
|
esp_restart_noos_dig();
|
||||||
}
|
}
|
||||||
esp_restart_noos();
|
esp_restart_noos();
|
||||||
}
|
}
|
||||||
|
@@ -3,16 +3,16 @@
|
|||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32S2
|
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
#include "soc/rtc_cntl_reg.h"
|
#include "soc/rtc_cntl_reg.h"
|
||||||
|
#include "panic_internal.h"
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
|
#include "esp32/rom/uart.h"
|
||||||
|
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||||
#include "esp32s2/rom/uart.h"
|
#include "esp32s2/rom/uart.h"
|
||||||
#include "esp32s2/memprot.h"
|
#include "esp32s2/memprot.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "esp_system.h"
|
|
||||||
#include "panic_internal.h"
|
|
||||||
|
|
||||||
#define SHUTDOWN_HANDLERS_NO 2
|
#define SHUTDOWN_HANDLERS_NO 2
|
||||||
static shutdown_handler_t shutdown_handlers[SHUTDOWN_HANDLERS_NO];
|
static shutdown_handler_t shutdown_handlers[SHUTDOWN_HANDLERS_NO];
|
||||||
@@ -41,22 +41,25 @@ esp_err_t esp_unregister_shutdown_handler(shutdown_handler_t handler)
|
|||||||
return ESP_ERR_INVALID_STATE;
|
return ESP_ERR_INVALID_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32S2
|
void IRAM_ATTR esp_restart_noos_dig(void)
|
||||||
static __attribute__((noreturn)) void esp_digital_reset(void)
|
|
||||||
{
|
{
|
||||||
// make sure all the panic handler output is sent from UART FIFO
|
// make sure all the panic handler output is sent from UART FIFO
|
||||||
|
if (CONFIG_ESP_CONSOLE_UART_NUM >= 0) {
|
||||||
uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
|
uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||||
// switch to XTAL (otherwise we will keep running from the PLL)
|
}
|
||||||
|
|
||||||
|
// switch to XTAL (otherwise we will keep running from the PLL)
|
||||||
rtc_clk_cpu_freq_set_xtal();
|
rtc_clk_cpu_freq_set_xtal();
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
|
esp_cpu_unstall(PRO_CPU_NUM);
|
||||||
|
#endif
|
||||||
// reset the digital part
|
// reset the digital part
|
||||||
SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_SW_SYS_RST);
|
SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_SW_SYS_RST);
|
||||||
while (true) {
|
while (true) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void IRAM_ATTR esp_restart(void)
|
void IRAM_ATTR esp_restart(void)
|
||||||
{
|
{
|
||||||
@@ -71,7 +74,7 @@ void IRAM_ATTR esp_restart(void)
|
|||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32S2
|
#if CONFIG_IDF_TARGET_ESP32S2
|
||||||
if (esp_memprot_is_intr_ena_any() || esp_memprot_is_locked_any()) {
|
if (esp_memprot_is_intr_ena_any() || esp_memprot_is_locked_any()) {
|
||||||
esp_digital_reset();
|
esp_restart_noos_dig();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
esp_restart_noos();
|
esp_restart_noos();
|
||||||
|
Reference in New Issue
Block a user