esp_system.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // Copyright 2015-2016 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. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef __ESP_SYSTEM_H__
  14. #define __ESP_SYSTEM_H__
  15. #include <stdint.h>
  16. #include <stdbool.h>
  17. #include "esp_err.h"
  18. #include "esp_deepsleep.h"
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /**
  23. * @attention application don't need to call this function anymore. It do nothing and will
  24. * be removed in future version.
  25. */
  26. void system_init(void) __attribute__ ((deprecated));
  27. /**
  28. * @brief Reset to default settings.
  29. *
  30. * Function has been deprecated, please use esp_wifi_restore instead.
  31. * This name will be removed in a future release.
  32. */
  33. void system_restore(void) __attribute__ ((deprecated));
  34. /**
  35. * @brief Restart PRO and APP CPUs.
  36. *
  37. * This function can be called both from PRO and APP CPUs.
  38. * After successful restart, CPU reset reason will be SW_CPU_RESET.
  39. * Peripherals (except for WiFi, BT, UART0, SPI1, and legacy timers) are not reset.
  40. * This function does not return.
  41. */
  42. void esp_restart(void) __attribute__ ((noreturn));
  43. /**
  44. * @brief Restart system.
  45. *
  46. * Function has been renamed to esp_restart.
  47. * This name will be removed in a future release.
  48. */
  49. void system_restart(void) __attribute__ ((deprecated, noreturn));
  50. /**
  51. * @brief Get system time, unit: microsecond.
  52. *
  53. * This function is deprecated. Use 'gettimeofday' function for 64-bit precision.
  54. * This definition will be removed in a future release.
  55. */
  56. uint32_t system_get_time(void) __attribute__ ((deprecated));
  57. /**
  58. * @brief Get the size of available heap.
  59. *
  60. * Note that the returned value may be larger than the maximum contiguous block
  61. * which can be allocated.
  62. *
  63. * @return Available heap size, in bytes.
  64. */
  65. uint32_t esp_get_free_heap_size(void);
  66. /**
  67. * @brief Get the size of available heap.
  68. *
  69. * Function has been renamed to esp_get_free_heap_size.
  70. * This name will be removed in a future release.
  71. *
  72. * @return Available heap size, in bytes.
  73. */
  74. uint32_t system_get_free_heap_size(void) __attribute__ ((deprecated));
  75. /**
  76. * @brief Get one random 32-bit word from hardware RNG
  77. *
  78. * @return random value between 0 and UINT32_MAX
  79. */
  80. uint32_t esp_random(void);
  81. /**
  82. * @brief Read hardware MAC address.
  83. *
  84. * In WiFi MAC, only ESP32 station MAC is the hardware MAC, ESP32 softAP MAC is a software MAC
  85. * calculated from ESP32 station MAC.
  86. * So users need to call esp_wifi_get_macaddr to query the ESP32 softAP MAC if ESP32 station MAC changed.
  87. *
  88. * @param mac hardware MAC address, length: 6 bytes.
  89. *
  90. * @return ESP_OK on success
  91. */
  92. esp_err_t esp_efuse_read_mac(uint8_t* mac);
  93. /**
  94. * @brief Read hardware MAC address.
  95. *
  96. * Function has been renamed to esp_efuse_read_mac.
  97. * This name will be removed in a future release.
  98. *
  99. * @param mac hardware MAC address, length: 6 bytes.
  100. * @return ESP_OK on success
  101. */
  102. esp_err_t system_efuse_read_mac(uint8_t mac[6]) __attribute__ ((deprecated));
  103. /**
  104. * Get SDK version
  105. *
  106. * This function is deprecated and will be removed in a future release.
  107. *
  108. * @return constant string "master"
  109. */
  110. const char* system_get_sdk_version(void) __attribute__ ((deprecated));
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114. #endif /* __ESP_SYSTEM_H__ */