1 /*
2  * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef __BOOT_CONFIG_H__
7 #define __BOOT_CONFIG_H__
8 
9 #include <stdint.h>
10 
11 #ifdef __cplusplus
12 extern "C"
13 {
14 #endif
15 
16 #include "esp_flash_partitions.h"
17 #include "soc/soc.h"
18 
19 #define SPI_SEC_SIZE 0x1000
20 
21 #define SPI_ERROR_LOG "spi flash error"
22 
23 #define MAX_OTA_SLOTS 16
24 
25 typedef struct {
26     esp_partition_pos_t ota_info;
27     esp_partition_pos_t factory;
28     esp_partition_pos_t test;
29     esp_partition_pos_t ota[MAX_OTA_SLOTS];
30     uint32_t app_count;
31     uint32_t selected_subtype;
32 } bootloader_state_t;
33 
34 bool flash_encrypt(bootloader_state_t *bs);
35 
36 /* Indices used by index_to_partition are the OTA index
37    number, or these special constants */
38 #define FACTORY_INDEX (-1)
39 #define TEST_APP_INDEX (-2)
40 #define INVALID_INDEX (-99)
41 
42 #ifdef __cplusplus
43 }
44 #endif
45 
46 #endif /* __BOOT_CONFIG_H__ */
47