esp_flash.h 1.7 KB

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