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_FLASH_H 20 #define BOOT_FLASH_H 21 22 #include <stdbool.h> 23 #include <stdint.h> 24 25 typedef uint32_t (*flash_init_func)(void); 26 typedef uint32_t (*flash_read_func)(uint32_t flash_addr, uint32_t flash_read_size, uint8_t *p_flash_read_data); 27 typedef uint32_t (*flash_write_func)(uint32_t flash_addr, uint32_t flash_write_size, 28 const uint8_t *p_flash_write_data, bool do_erase); 29 typedef uint32_t (*flash_erase_func)(uint32_t flash_addr, uint32_t flash_erase_size); 30 typedef void (*flash_deinit_func)(void); 31 32 typedef struct { 33 flash_init_func init; 34 flash_read_func read; 35 flash_write_func write; 36 flash_erase_func erase; 37 flash_deinit_func deinit; 38 } flash_cmd_func; 39 40 flash_cmd_func *boot_get_flash_funcs(void); 41 uint32_t boot_regist_flash_cmd(const flash_cmd_func *funcs); 42 43 #endif