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