bootloader_flash_config.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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(void);
  25. /**
  26. * @brief Set the flash CS setup and hold time.
  27. *
  28. * @note CS setup time is recomemded to be 1.5T, and CS hold time is recommended to be 2.5T.
  29. * cs_setup = 1, cs_setup_time = 0; cs_hold = 1, cs_hold_time = 1.
  30. *
  31. * @return None
  32. */
  33. void bootloader_flash_cs_timing_config(void);
  34. /**
  35. * @brief Configure SPI flash clock.
  36. *
  37. * @note This function only set clock frequency for SPI0.
  38. *
  39. * @param pfhdr Pointer to App image header, from where to fetch flash settings.
  40. *
  41. * @return None
  42. */
  43. void bootloader_flash_clock_config(const esp_image_header_t* pfhdr);
  44. /**
  45. * @brief Configure SPI flash gpio, include the IO matrix and drive strength configuration.
  46. *
  47. * @param pfhdr Pointer to App image header, from where to fetch flash settings.
  48. *
  49. * @return None
  50. */
  51. void bootloader_flash_gpio_config(const esp_image_header_t* pfhdr);
  52. /**
  53. * @brief Configure SPI flash read dummy based on different mode and frequency.
  54. *
  55. * @param pfhdr Pointer to App image header, from where to fetch flash settings.
  56. *
  57. * @return None
  58. */
  59. void bootloader_flash_dummy_config(const esp_image_header_t* pfhdr);
  60. #ifdef __cplusplus
  61. }
  62. #endif