1 /* 2 * SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #pragma once 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 #include "esp_system.h" 14 15 /** 16 * @brief Internal function to restart PRO and APP CPUs. 17 * 18 * @note This function should not be called from FreeRTOS applications. 19 * Use esp_restart instead. 20 * 21 * This is an internal function called by esp_restart. It is called directly 22 * by the panic handler and brownout detector interrupt. 23 */ 24 void esp_restart_noos(void) __attribute__ ((noreturn)); 25 26 /** 27 * @brief Similar to esp_restart_noos, but resets all the digital peripherals. 28 */ 29 void esp_restart_noos_dig(void) __attribute__ ((noreturn)); 30 31 /** 32 * @brief Internal function to set reset reason hint 33 * 34 * The hint is used do distinguish different reset reasons when software reset 35 * is performed. 36 * 37 * The hint is stored in RTC store register, RTC_RESET_CAUSE_REG. 38 * 39 * @param hint Desired esp_reset_reason_t value for the real reset reason 40 */ 41 void esp_reset_reason_set_hint(esp_reset_reason_t hint); 42 43 /** 44 * @brief Internal function to get the reset hint value 45 * @return - Reset hint value previously stored into RTC_RESET_CAUSE_REG using 46 * esp_reset_reason_set_hint function 47 * - ESP_RST_UNKNOWN if the value in RTC_RESET_CAUSE_REG is invalid 48 */ 49 esp_reset_reason_t esp_reset_reason_get_hint(void); 50 51 /** 52 * @brief Get the time in microseconds since startup 53 * 54 * @returns time since g_startup_time; definition should be fixed by system time provider 55 * no matter the underlying timer used. 56 */ 57 int64_t esp_system_get_time(void); 58 59 /** 60 * @brief Get the resolution of the time returned by `esp_system_get_time`. 61 * 62 * @returns the resolution in nanoseconds 63 */ 64 uint32_t esp_system_get_time_resolution(void); 65 66 /** 67 * @brief Before the system exit (e.g. panic, brownout, restart, etc.), this function is to be called to reset all necessary peripherals. 68 */ 69 void esp_system_reset_modules_on_exit(void); 70 71 #ifdef __cplusplus 72 } 73 #endif 74