esp_rom_efuse.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Copyright 2010-2020 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 <stdint.h>
  19. #include <stdbool.h>
  20. #define ESP_ROM_EFUSE_FLASH_DEFAULT_SPI (0)
  21. #define ESP_ROM_EFUSE_FLASH_DEFAULT_HSPI (1)
  22. /**
  23. * @brief A CRC8 algorithm used for MAC addresses stored in eFuse
  24. *
  25. * @param data Pointer to the original data
  26. * @param len Data length in byte
  27. * @return uint8_t CRC value
  28. */
  29. uint8_t esp_rom_efuse_mac_address_crc8(const uint8_t *data, uint32_t len);
  30. /**
  31. * @brief Get SPI Flash GPIO pin configurations from eFuse
  32. *
  33. * @return uint32_t
  34. * - 0: default SPI pins (ESP_ROM_EFUSE_FLASH_DEFAULT_SPI)
  35. * - 1: default HSPI pins (ESP_ROM_EFUSE_FLASH_DEFAULT_HSPI)
  36. * - Others: Customized pin configuration mask. Pins are encoded as per the
  37. * EFUSE_SPICONFIG_RET_SPICLK, EFUSE_SPICONFIG_RET_SPIQ, EFUSE_SPICONFIG_RET_SPID,
  38. * EFUSE_SPICONFIG_RET_SPICS0, EFUSE_SPICONFIG_RET_SPIHD macros.
  39. *
  40. * @note WP pin (for quad I/O modes) is not saved in eFuse and not returned by this function.
  41. */
  42. uint32_t esp_rom_efuse_get_flash_gpio_info(void);
  43. /**
  44. * @brief Get SPI Flash WP pin information from eFuse
  45. *
  46. * @return uint32_t
  47. * - 0x3F: invalid GPIO number
  48. * - 0~46: valid GPIO number
  49. */
  50. uint32_t esp_rom_efuse_get_flash_wp_gpio(void);
  51. /**
  52. * @brief Read eFuse to check whether secure boot has been enabled or not
  53. *
  54. * @return true if secure boot is enabled, otherwise false
  55. */
  56. bool esp_rom_efuse_is_secure_boot_enabled(void);
  57. #ifdef __cplusplus
  58. }
  59. #endif