mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-02 22:51:14 +00:00

Makes the entirety of the wl API runnable on host. Flash emulator is separated into spi_flash component directory to be reused by other storage components.
86 lines
4.6 KiB
C
86 lines
4.6 KiB
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "esp_err.h"
|
|
#include "esp_spi_flash.h"
|
|
|
|
/**
|
|
* @brief Partition type
|
|
* @note Keep this enum in sync with PartitionDefinition class gen_esp32part.py
|
|
*/
|
|
typedef enum {
|
|
ESP_PARTITION_TYPE_APP = 0x00, //!< Application partition type
|
|
ESP_PARTITION_TYPE_DATA = 0x01, //!< Data partition type
|
|
} esp_partition_type_t;
|
|
|
|
/**
|
|
* @brief Partition subtype
|
|
* @note Keep this enum in sync with PartitionDefinition class gen_esp32part.py
|
|
*/
|
|
typedef enum {
|
|
ESP_PARTITION_SUBTYPE_APP_FACTORY = 0x00, //!< Factory application partition
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_MIN = 0x10, //!< Base for OTA partition subtypes
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_0 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 0, //!< OTA partition 0
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_1 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 1, //!< OTA partition 1
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_2 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 2, //!< OTA partition 2
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_3 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 3, //!< OTA partition 3
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_4 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 4, //!< OTA partition 4
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_5 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 5, //!< OTA partition 5
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_6 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 6, //!< OTA partition 6
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_7 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 7, //!< OTA partition 7
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_8 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 8, //!< OTA partition 8
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_9 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 9, //!< OTA partition 9
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_10 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 10,//!< OTA partition 10
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_11 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 11,//!< OTA partition 11
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_12 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 12,//!< OTA partition 12
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_13 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 13,//!< OTA partition 13
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_14 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 14,//!< OTA partition 14
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_15 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 15,//!< OTA partition 15
|
|
ESP_PARTITION_SUBTYPE_APP_OTA_MAX = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 16,//!< Max subtype of OTA partition
|
|
ESP_PARTITION_SUBTYPE_APP_TEST = 0x20, //!< Test application partition
|
|
|
|
ESP_PARTITION_SUBTYPE_DATA_OTA = 0x00, //!< OTA selection partition
|
|
ESP_PARTITION_SUBTYPE_DATA_PHY = 0x01, //!< PHY init data partition
|
|
ESP_PARTITION_SUBTYPE_DATA_NVS = 0x02, //!< NVS partition
|
|
ESP_PARTITION_SUBTYPE_DATA_COREDUMP = 0x03, //!< COREDUMP partition
|
|
|
|
ESP_PARTITION_SUBTYPE_DATA_ESPHTTPD = 0x80, //!< ESPHTTPD partition
|
|
ESP_PARTITION_SUBTYPE_DATA_FAT = 0x81, //!< FAT partition
|
|
ESP_PARTITION_SUBTYPE_DATA_SPIFFS = 0x82, //!< SPIFFS partition
|
|
|
|
ESP_PARTITION_SUBTYPE_ANY = 0xff, //!< Used to search for partitions with any subtype
|
|
} esp_partition_subtype_t;
|
|
|
|
/**
|
|
* @brief partition information structure
|
|
*
|
|
* This is not the format in flash, that format is esp_partition_info_t.
|
|
*
|
|
* However, this is the format used by this API.
|
|
*/
|
|
typedef struct {
|
|
esp_partition_type_t type; /*!< partition type (app/data) */
|
|
esp_partition_subtype_t subtype; /*!< partition subtype */
|
|
uint32_t address; /*!< starting address of the partition in flash */
|
|
uint32_t size; /*!< size of the partition, in bytes */
|
|
char label[17]; /*!< partition label, zero-terminated ASCII string */
|
|
bool encrypted; /*!< flag is set to true if partition is encrypted */
|
|
|
|
int handle; /*!< simulator handle */
|
|
} esp_partition_t;
|
|
|
|
esp_err_t esp_partition_write(const esp_partition_t* partition,
|
|
size_t dst_offset, const void* src, size_t size);
|
|
|
|
esp_err_t esp_partition_erase_range(const esp_partition_t* partition,
|
|
uint32_t start_addr, uint32_t size);
|
|
|
|
esp_err_t esp_partition_read(const esp_partition_t* partition,
|
|
size_t src_offset, void* dst, size_t size);
|
|
|
|
esp_partition_t esp_partition_create(uint32_t size, uint32_t start);
|
|
|
|
void esp_partition_delete(esp_partition_t partition);
|
|
|