1 /*
2  * SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: GPL-2.0-or-later
5  */
6 
7 /* Flasher command handlers, called from stub_flasher.c
8 
9    Commands related to writing flash are in stub_write_flash_xxx.
10 */
11 #pragma once
12 #include "stub_flasher.h"
13 #include "rom_functions.h"
14 #include <stdbool.h>
15 
16 int handle_flash_erase(uint32_t addr, uint32_t len);
17 
18 void handle_flash_read(uint32_t addr, uint32_t len, uint32_t block_size, uint32_t max_in_flight);
19 
20 int handle_flash_get_md5sum(uint32_t addr, uint32_t len);
21 
22 int handle_flash_read_chip_id();
23 
24 esp_command_error handle_spi_set_params(uint32_t *args, int *status);
25 
26 esp_command_error handle_spi_attach(uint32_t hspi_config_arg);
27 
28 esp_command_error handle_mem_begin(uint32_t size, uint32_t offset);
29 
30 esp_command_error handle_mem_data(void *data, uint32_t length);
31 
32 esp_command_error handle_mem_finish(void);
33 
34 typedef struct {
35     uint32_t addr;
36     uint32_t value;
37     uint32_t mask;
38     uint32_t delay_us;
39 } write_reg_args_t;
40 
41 esp_command_error handle_write_reg(const write_reg_args_t *cmd_buf, uint32_t num_commands);
42 
43 /* Get security info command only on ESP32S2 and later */
44 #if ESP32S2_OR_LATER
45 esp_command_error handle_get_security_info(void);
46 #endif // ESP32S2_OR_LATER
47