bootloader_flash.h 1.2 KB

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