system_internal.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. #include "esp_system.h"
  11. /**
  12. * @brief Internal function to restart PRO and APP CPUs.
  13. *
  14. * @note This function should not be called from FreeRTOS applications.
  15. * Use esp_restart instead.
  16. *
  17. * This function executes a CPU reset (see TRM).
  18. *
  19. * CPU resets do not reset digital peripherals, but this function will
  20. * manually reset a subset of digital peripherals (depending on target) before
  21. * carrying out the CPU reset.
  22. *
  23. * Memory protection is also cleared by a CPU reset.
  24. *
  25. * This is an internal function called by esp_restart. It is called directly
  26. * by the panic handler and brownout detector interrupt.
  27. */
  28. void esp_restart_noos(void) __attribute__ ((noreturn));
  29. /**
  30. * @brief Similar to esp_restart_noos, but resets all the digital peripherals.
  31. */
  32. void esp_restart_noos_dig(void) __attribute__ ((noreturn));
  33. /**
  34. * @brief Internal function to set reset reason hint
  35. *
  36. * The hint is used do distinguish different reset reasons when software reset
  37. * is performed.
  38. *
  39. * The hint is stored in RTC store register, RTC_RESET_CAUSE_REG.
  40. *
  41. * @param hint Desired esp_reset_reason_t value for the real reset reason
  42. */
  43. void esp_reset_reason_set_hint(esp_reset_reason_t hint);
  44. /**
  45. * @brief Internal function to get the reset hint value
  46. * @return - Reset hint value previously stored into RTC_RESET_CAUSE_REG using
  47. * esp_reset_reason_set_hint function
  48. * - ESP_RST_UNKNOWN if the value in RTC_RESET_CAUSE_REG is invalid
  49. */
  50. esp_reset_reason_t esp_reset_reason_get_hint(void);
  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. * @brief Get the resolution of the time returned by `esp_system_get_time`.
  60. *
  61. * @returns the resolution in nanoseconds
  62. */
  63. uint32_t esp_system_get_time_resolution(void);
  64. /**
  65. * @brief Before the system exit (e.g. panic, brownout, restart, etc.), this function is to be called to reset all necessary peripherals.
  66. */
  67. void esp_system_reset_modules_on_exit(void);
  68. #ifdef __cplusplus
  69. }
  70. #endif