@@ -32,6 +32,8 @@ extern "C" {
32
32
33
33
#define SPI_READ_BUF_MAX 64
34
34
35
+ #define SPI_FLASH_CACHE2PHYS_FAIL UINT32_MAX /*<! Result from spi_flash_cache2phys() if flash cache address is invalid */
36
+
35
37
#ifdef CONFIG_ENABLE_FLASH_MMAP
36
38
/**
37
39
* @brief Enumeration which specifies memory space requested in an mmap call
@@ -149,6 +151,50 @@ void spi_flash_munmap(spi_flash_mmap_handle_t handle);
149
151
150
152
#endif /* CONFIG_ENABLE_FLASH_MMAP */
151
153
154
+ /**
155
+ * @brief Given a memory address where flash is mapped, return the corresponding physical flash offset.
156
+ *
157
+ * Cache address does not have have been assigned via spi_flash_mmap(), any address in memory mapped flash space can be looked up.
158
+ *
159
+ * @param cached Pointer to flashed cached memory.
160
+ *
161
+ * @return
162
+ * - SPI_FLASH_CACHE2PHYS_FAIL If cache address is outside flash cache region, or the address is not mapped.
163
+ * - Otherwise, returns physical offset in flash
164
+ */
165
+ uintptr_t spi_flash_cache2phys (const void * cached );
166
+
167
+ #ifdef CONFIG_ESP8266_OTA_FROM_OLD
168
+
169
+ /**
170
+ * @brief Check if current firmware updates from V2 firmware and its location is at "APP2", if so, then V3 bootloader
171
+ * will copy patition table from "APP2" location to "APP1" location of V2 partition map.
172
+ *
173
+ * @return 0 if success or others if failed
174
+ */
175
+ int esp_patition_table_init_location (void );
176
+
177
+ /**
178
+ * @brief Check if current firmware updates from V2 firmware and its location is at "APP2", if so, then V3 bootloader
179
+ * will copy firmware from "APP2" location to "APP1" location.
180
+ *
181
+ * @note All data which is copied is "ota0" application and all data whose location is before "ota0".
182
+ *
183
+ * @return 0 if success or others if failed
184
+ */
185
+ int esp_patition_table_init_data (void * partition_info );
186
+ #endif
187
+
188
+ #ifdef CONFIG_ESP8266_BOOT_COPY_APP
189
+ /**
190
+ * @brief Check if current application which is to run is at "ota1" location, if so, bootloader will copy it to "ota0" location,
191
+ * and clear OTA data partition.
192
+ *
193
+ * @return 0 if success or others if failed
194
+ */
195
+ int esp_patition_copy_ota1_to_ota0 (const void * partition_info );
196
+ #endif
197
+
152
198
#ifdef __cplusplus
153
199
}
154
200
#endif
0 commit comments