system_internal.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright 2018 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "esp_system.h"
  19. #define MWDT0_TICK_PRESCALER 40000
  20. #define MWDT0_TICKS_PER_US 500
  21. #define MWDT1_TICK_PRESCALER 40000
  22. #define MWDT1_TICKS_PER_US 500
  23. /**
  24. * @brief Internal function to restart PRO and APP CPUs.
  25. *
  26. * @note This function should not be called from FreeRTOS applications.
  27. * Use esp_restart instead.
  28. *
  29. * This is an internal function called by esp_restart. It is called directly
  30. * by the panic handler and brownout detector interrupt.
  31. */
  32. void esp_restart_noos(void) __attribute__ ((noreturn));
  33. /**
  34. * @brief Similar to esp_restart_noos, but resets all the digital peripherals.
  35. */
  36. void esp_restart_noos_dig(void) __attribute__ ((noreturn));
  37. /**
  38. * @brief Internal function to set reset reason hint
  39. *
  40. * The hint is used do distinguish different reset reasons when software reset
  41. * is performed.
  42. *
  43. * The hint is stored in RTC store register, RTC_RESET_CAUSE_REG.
  44. *
  45. * @param hint Desired esp_reset_reason_t value for the real reset reason
  46. */
  47. void esp_reset_reason_set_hint(esp_reset_reason_t hint);
  48. /**
  49. * @brief Internal function to get the reset hint value
  50. * @return - Reset hint value previously stored into RTC_RESET_CAUSE_REG using
  51. * esp_reset_reason_set_hint function
  52. * - ESP_RST_UNKNOWN if the value in RTC_RESET_CAUSE_REG is invalid
  53. */
  54. esp_reset_reason_t esp_reset_reason_get_hint(void);
  55. /**
  56. * @brief Get the time in microseconds since startup
  57. *
  58. * @returns time since g_startup_time; definition should be fixed by system time provider
  59. * no matter the underlying timer used.
  60. */
  61. int64_t esp_system_get_time(void);
  62. /**
  63. * @brief Get the resolution of the time returned by `esp_system_get_time`.
  64. *
  65. * @returns the resolution in nanoseconds
  66. */
  67. uint32_t esp_system_get_time_resolution(void);
  68. #ifdef __cplusplus
  69. }
  70. #endif