esp_flash.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 "esp_err.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /* Note: Most of esp_flash APIs in ROM are compatible with headers in ESP-IDF, this function
  12. just adds ROM-specific parts
  13. */
  14. struct spi_flash_chip_t;
  15. typedef struct esp_flash_t esp_flash_t;
  16. /* Structure to wrap "global" data used by esp_flash in ROM */
  17. typedef struct {
  18. /* Default SPI flash chip, ie main chip attached to the MCU
  19. This chip is used if the 'chip' argument passed to esp_flash_xxx API functions is ever NULL
  20. */
  21. esp_flash_t *default_chip;
  22. /* Global API OS notification start/end/chip_check functions
  23. These are used by ROM if no other host functions are configured.
  24. */
  25. struct {
  26. esp_err_t (*start)(esp_flash_t *chip);
  27. esp_err_t (*end)(esp_flash_t *chip, esp_err_t err);
  28. esp_err_t (*chip_check)(esp_flash_t **inout_chip);
  29. } api_funcs;
  30. } esp_flash_rom_global_data_t;
  31. /** Access a pointer to the global data used by the ROM spi_flash driver
  32. */
  33. esp_flash_rom_global_data_t *esp_flash_get_rom_global_data(void);
  34. #ifdef __cplusplus
  35. }
  36. #endif