1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 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 * Description: Common Boot for Standard Application Core 15 * 16 * Create: 2023-01-09 17 */ 18 19 #ifndef BOOT_CMD_LOOP_H 20 #define BOOT_CMD_LOOP_H 21 22 #include "boot_uart_auth.h" 23 24 #define ACK_SUCCESS 0x5A 25 #define ACK_FAILURE 0xA5 26 27 enum { 28 CMD_ACK = 0xE1, 29 CMD_DL_IMAGE = 0xD2, 30 CMD_BURN_EFUSE = 0xC3, 31 CMD_UL_DATA = 0xB4, 32 CMD_READ_EFUSE = 0xA5, 33 CMD_FLASH_PROTECT = 0x96, 34 CMD_RESET = 0x87, 35 CMD_FACTORY_IMAGE = 0x78, 36 CMD_VERSION = 0x69, 37 CMD_SET_BUADRATE = 0x5A, 38 }; 39 40 #define LOADER_CMD_MAX 8 41 42 uint32_t loader_download_image(const uart_ctx *cmd_ctx); 43 uint32_t loader_upload_data(const uart_ctx *cmd_ctx); 44 uint32_t loader_reset(const uart_ctx *cmd_ctx); 45 uint32_t loader_read_ver(const uart_ctx *cmd_ctx); 46 uint32_t loader_set_baudrate(const uart_ctx *cmd_ctx); 47 void cmd_loop(uart_ctx *ctx); 48 void loader_ack(uint8_t err_code); 49 bool loader_download_is_flash_all_erased(void); 50 void loader_download_set_flash_all_erase(bool all_erased); 51 #endif