1 /*
2  * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #include "esp_err.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /* Note: Most of esp_flash APIs in ROM are compatible with headers in ESP-IDF, this function
16    just adds ROM-specific parts
17 */
18 
19 struct spi_flash_chip_t;
20 typedef struct esp_flash_t esp_flash_t;
21 
22 /* Structure to wrap "global" data used by esp_flash in ROM */
23 typedef struct {
24     /* Default SPI flash chip, ie main chip attached to the MCU
25        This chip is used if the 'chip' argument passed to esp_flash_xxx API functions is ever NULL
26     */
27     esp_flash_t *default_chip;
28 
29     /* Global API OS notification start/end/chip_check functions
30 
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 
40 /** Access a pointer to the global data used by the ROM spi_flash driver
41  */
42 esp_flash_rom_global_data_t *esp_flash_get_rom_global_data(void);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47