bootloader_flash_config.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Copyright 2018 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. #include "esp_image_format.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /**
  20. * @brief Update the flash id in g_rom_flashchip(global esp_rom_spiflash_chip_t structure).
  21. *
  22. * @return None
  23. */
  24. void bootloader_flash_update_id();
  25. /**
  26. * @brief Update the flash size in g_rom_flashchip (global esp_rom_spiflash_chip_t structure).
  27. *
  28. * @param size The size to store, in bytes.
  29. * @return None
  30. */
  31. void bootloader_flash_update_size(uint32_t size);
  32. /**
  33. * @brief Set the flash CS setup and hold time.
  34. *
  35. * @note CS setup time is recomemded to be 1.5T, and CS hold time is recommended to be 2.5T.
  36. * cs_setup = 1, cs_setup_time = 0; cs_hold = 1, cs_hold_time = 1.
  37. *
  38. * @return None
  39. */
  40. void bootloader_flash_cs_timing_config();
  41. /**
  42. * @brief Configure SPI flash clock.
  43. *
  44. * @note This function only set clock frequency for SPI0.
  45. *
  46. * @param pfhdr Pointer to App image header, from where to fetch flash settings.
  47. *
  48. * @return None
  49. */
  50. void bootloader_flash_clock_config(const esp_image_header_t* pfhdr);
  51. /**
  52. * @brief Configure SPI flash gpio, include the IO matrix and drive strength configuration.
  53. *
  54. * @param pfhdr Pointer to App image header, from where to fetch flash settings.
  55. *
  56. * @return None
  57. */
  58. void bootloader_flash_gpio_config(const esp_image_header_t* pfhdr);
  59. /**
  60. * @brief Configure SPI flash read dummy based on different mode and frequency.
  61. *
  62. * @param pfhdr Pointer to App image header, from where to fetch flash settings.
  63. *
  64. * @return None
  65. */
  66. void bootloader_flash_dummy_config(const esp_image_header_t* pfhdr);
  67. #ifdef __cplusplus
  68. }
  69. #endif