esp_rom_efuse.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * SPDX-FileCopyrightText: 2010-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 <stdint.h>
  11. #include <stdbool.h>
  12. #include "soc/soc_caps.h"
  13. #define ESP_ROM_EFUSE_FLASH_DEFAULT_SPI (0)
  14. #define ESP_ROM_EFUSE_FLASH_DEFAULT_HSPI (1)
  15. /**
  16. * @brief A CRC8 algorithm used for MAC addresses stored in eFuse
  17. *
  18. * @param data Pointer to the original data
  19. * @param len Data length in byte
  20. * @return uint8_t CRC value
  21. */
  22. uint8_t esp_rom_efuse_mac_address_crc8(const uint8_t *data, uint32_t len);
  23. /**
  24. * @brief Get SPI Flash GPIO pin configurations from eFuse
  25. *
  26. * @return uint32_t
  27. * - 0: default SPI pins (ESP_ROM_EFUSE_FLASH_DEFAULT_SPI)
  28. * - 1: default HSPI pins (ESP_ROM_EFUSE_FLASH_DEFAULT_HSPI)
  29. * - Others: Customized pin configuration mask. Pins are encoded as per the
  30. * EFUSE_SPICONFIG_RET_SPICLK, EFUSE_SPICONFIG_RET_SPIQ, EFUSE_SPICONFIG_RET_SPID,
  31. * EFUSE_SPICONFIG_RET_SPICS0, EFUSE_SPICONFIG_RET_SPIHD macros.
  32. *
  33. * @note WP pin (for quad I/O modes) is not saved in eFuse and not returned by this function.
  34. */
  35. uint32_t esp_rom_efuse_get_flash_gpio_info(void);
  36. /**
  37. * @brief Get SPI Flash WP pin information from eFuse
  38. *
  39. * @return uint32_t
  40. * - 0x3F: invalid GPIO number
  41. * - 0~46: valid GPIO number
  42. */
  43. uint32_t esp_rom_efuse_get_flash_wp_gpio(void);
  44. #if SOC_SPI_MEM_SUPPORT_OPI_MODE
  45. /**
  46. * @brief Read opi flash pads configuration from Efuse
  47. *
  48. * @return
  49. * - 0 for default SPI pins.
  50. * - Other values define a custom pin configuration mask. From the LSB, every 6 bits represent a GPIO number which stand for:
  51. * DQS, D4, D5, D6, D7 accordingly.
  52. */
  53. uint32_t esp_rom_efuse_get_opiconfig(void);
  54. #endif // SOC_SPI_MEM_SUPPORT_OPI_MODE
  55. /**
  56. * @brief Read eFuse to check whether secure boot has been enabled or not
  57. *
  58. * @return true if secure boot is enabled, otherwise false
  59. */
  60. bool esp_rom_efuse_is_secure_boot_enabled(void);
  61. #ifdef __cplusplus
  62. }
  63. #endif