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