system_internal.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 is an internal function called by esp_restart. It is called directly
  18. * by the panic handler and brownout detector interrupt.
  19. */
  20. void esp_restart_noos(void) __attribute__ ((noreturn));
  21. /**
  22. * @brief Similar to esp_restart_noos, but resets all the digital peripherals.
  23. */
  24. void esp_restart_noos_dig(void) __attribute__ ((noreturn));
  25. /**
  26. * @brief Internal function to set reset reason hint
  27. *
  28. * The hint is used do distinguish different reset reasons when software reset
  29. * is performed.
  30. *
  31. * The hint is stored in RTC store register, RTC_RESET_CAUSE_REG.
  32. *
  33. * @param hint Desired esp_reset_reason_t value for the real reset reason
  34. */
  35. void esp_reset_reason_set_hint(esp_reset_reason_t hint);
  36. /**
  37. * @brief Internal function to get the reset hint value
  38. * @return - Reset hint value previously stored into RTC_RESET_CAUSE_REG using
  39. * esp_reset_reason_set_hint function
  40. * - ESP_RST_UNKNOWN if the value in RTC_RESET_CAUSE_REG is invalid
  41. */
  42. esp_reset_reason_t esp_reset_reason_get_hint(void);
  43. /**
  44. * @brief Get the time in microseconds since startup
  45. *
  46. * @returns time since g_startup_time; definition should be fixed by system time provider
  47. * no matter the underlying timer used.
  48. */
  49. int64_t esp_system_get_time(void);
  50. /**
  51. * @brief Get the resolution of the time returned by `esp_system_get_time`.
  52. *
  53. * @returns the resolution in nanoseconds
  54. */
  55. uint32_t esp_system_get_time_resolution(void);
  56. #ifdef __cplusplus
  57. }
  58. #endif