bootloader_flash.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdint.h>
  8. #include <esp_err.h>
  9. #include <esp_spi_flash.h> /* including in bootloader for error values */
  10. #include "sdkconfig.h"
  11. #include "soc/soc_caps.h"
  12. #include "bootloader_flash_override.h"
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /**
  17. * @brief Read flash ID by sending RDID command (0x9F)
  18. * @return flash raw ID
  19. * mfg_id = (ID >> 16) & 0xFF;
  20. flash_id = ID & 0xffff;
  21. */
  22. uint32_t bootloader_read_flash_id(void);
  23. #if SOC_CACHE_SUPPORT_WRAP
  24. /**
  25. * @brief Set the burst mode setting command for specified wrap mode.
  26. *
  27. * @param mode The specified warp mode.
  28. * @return always ESP_OK
  29. */
  30. esp_err_t bootloader_flash_wrap_set(spi_flash_wrap_mode_t mode);
  31. #endif
  32. /**
  33. * @brief Startup flow recommended by XMC. Call at startup before any erase/write operation.
  34. *
  35. * @return ESP_OK When startup successfully, otherwise ESP_FAIL (indiciating you should reboot before erase/write).
  36. */
  37. esp_err_t bootloader_flash_xmc_startup(void);
  38. /**
  39. * @brief Unlock Flash write protect.
  40. * Please do not call this function in SDK.
  41. *
  42. * @note This can be overridden because it's attribute weak.
  43. */
  44. esp_err_t __attribute__((weak)) bootloader_flash_unlock(void);
  45. #ifdef __cplusplus
  46. }
  47. #endif