2022-07-07 02:54:15 -04:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2018-07-29 05:57:59 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "esp_system.h"
|
2022-07-07 02:54:15 -04:00
|
|
|
|
2018-07-29 05:57:59 -04:00
|
|
|
/**
|
|
|
|
* @brief Internal function to restart PRO and APP CPUs.
|
|
|
|
*
|
|
|
|
* @note This function should not be called from FreeRTOS applications.
|
|
|
|
* Use esp_restart instead.
|
|
|
|
*
|
2023-04-25 04:28:10 -04:00
|
|
|
* This function executes a CPU reset (see TRM).
|
|
|
|
*
|
|
|
|
* CPU resets do not reset digital peripherals, but this function will
|
|
|
|
* manually reset a subset of digital peripherals (depending on target) before
|
|
|
|
* carrying out the CPU reset.
|
|
|
|
*
|
|
|
|
* Memory protection is also cleared by a CPU reset.
|
|
|
|
*
|
2018-07-29 05:57:59 -04:00
|
|
|
* This is an internal function called by esp_restart. It is called directly
|
|
|
|
* by the panic handler and brownout detector interrupt.
|
|
|
|
*/
|
2024-01-29 20:40:10 -05:00
|
|
|
void esp_restart_noos(void) __attribute__((noreturn));
|
2018-07-29 05:57:59 -04:00
|
|
|
|
2020-04-30 10:37:57 -04:00
|
|
|
/**
|
|
|
|
* @brief Similar to esp_restart_noos, but resets all the digital peripherals.
|
|
|
|
*/
|
2024-01-29 20:40:10 -05:00
|
|
|
void esp_restart_noos_dig(void) __attribute__((noreturn));
|
2020-04-30 10:37:57 -04:00
|
|
|
|
2018-07-29 05:57:59 -04:00
|
|
|
/**
|
|
|
|
* @brief Internal function to set reset reason hint
|
|
|
|
*
|
|
|
|
* The hint is used do distinguish different reset reasons when software reset
|
|
|
|
* is performed.
|
|
|
|
*
|
|
|
|
* The hint is stored in RTC store register, RTC_RESET_CAUSE_REG.
|
|
|
|
*
|
|
|
|
* @param hint Desired esp_reset_reason_t value for the real reset reason
|
|
|
|
*/
|
|
|
|
void esp_reset_reason_set_hint(esp_reset_reason_t hint);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Internal function to get the reset hint value
|
|
|
|
* @return - Reset hint value previously stored into RTC_RESET_CAUSE_REG using
|
|
|
|
* esp_reset_reason_set_hint function
|
|
|
|
* - ESP_RST_UNKNOWN if the value in RTC_RESET_CAUSE_REG is invalid
|
|
|
|
*/
|
|
|
|
esp_reset_reason_t esp_reset_reason_get_hint(void);
|
|
|
|
|
2020-11-10 02:40:01 -05:00
|
|
|
/**
|
2020-07-14 02:46:13 -04:00
|
|
|
* @brief Get the time in microseconds since startup
|
2020-11-10 02:40:01 -05:00
|
|
|
*
|
2021-03-08 20:12:24 -05:00
|
|
|
* @returns time since g_startup_time; definition should be fixed by system time provider
|
|
|
|
* no matter the underlying timer used.
|
2020-06-23 04:46:06 -04:00
|
|
|
*/
|
2020-08-11 05:49:48 -04:00
|
|
|
int64_t esp_system_get_time(void);
|
2020-06-23 04:46:06 -04:00
|
|
|
|
2020-11-10 02:40:01 -05:00
|
|
|
/**
|
2020-08-11 05:49:48 -04:00
|
|
|
* @brief Get the resolution of the time returned by `esp_system_get_time`.
|
2020-11-10 02:40:01 -05:00
|
|
|
*
|
2020-10-07 05:39:11 -04:00
|
|
|
* @returns the resolution in nanoseconds
|
2020-08-11 05:49:48 -04:00
|
|
|
*/
|
|
|
|
uint32_t esp_system_get_time_resolution(void);
|
2020-06-23 04:46:06 -04:00
|
|
|
|
2023-05-04 23:19:37 -04:00
|
|
|
/**
|
|
|
|
* @brief Before the system exit (e.g. panic, brownout, restart, etc.), this function is to be called to reset all necessary peripherals.
|
|
|
|
*/
|
|
|
|
void esp_system_reset_modules_on_exit(void);
|
|
|
|
|
2018-07-29 05:57:59 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|