esp32_spi_port.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Copyright 2020-2023 Espressif Systems (Shanghai) CO 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. #include "esp_loader_io.h"
  17. #include "driver/spi_master.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. typedef struct
  22. {
  23. spi_host_device_t spi_bus;
  24. uint32_t frequency;
  25. uint32_t spi_clk_pin;
  26. uint32_t spi_miso_pin;
  27. uint32_t spi_mosi_pin;
  28. uint32_t spi_cs_pin;
  29. uint32_t spi_quadwp_pin;
  30. uint32_t spi_quadhd_pin;
  31. uint32_t reset_trigger_pin;
  32. uint32_t strap_bit0_pin;
  33. uint32_t strap_bit1_pin;
  34. uint32_t strap_bit2_pin;
  35. uint32_t strap_bit3_pin;
  36. } loader_esp32_spi_config_t;
  37. /**
  38. * @brief Initializes the SPI interface.
  39. *
  40. * @param config[in] Configuration structure
  41. *
  42. * @return
  43. * - ESP_LOADER_SUCCESS Success
  44. * - ESP_LOADER_ERROR_FAIL Initialization failure
  45. */
  46. esp_loader_error_t loader_port_esp32_spi_init(const loader_esp32_spi_config_t *config);
  47. /**
  48. * @brief Deinitializes the SPI interface.
  49. */
  50. void loader_port_esp32_spi_deinit(void);
  51. #ifdef __cplusplus
  52. }
  53. #endif