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 */ 15 16 #ifndef __UPG_CHECK_FILE_H__ 17 #define __UPG_CHECK_FILE_H__ 18 19 #include <upg_common.h> 20 21 #define PRODUCT_UPG_FILE_IMAGE_ID 0x3C78961E 22 #define KERELN_VER_MAX 48 23 #define KERNEL_VER_LEN 6 24 #define BOOT_VER_MAX 16 25 #define BOOT_VER_LEN 2 26 27 #define HI_UPG_FILE_ATTR_UNENCRYPT 0x1 /* kernel or flashboot attributes */ 28 #define HI_UPG_FILE_ATTR_ENCRYPT 0x2 /* kernel or flashboot attributes */ 29 30 #define HI_UPG_FILE_ATTR_KERNELA 0x1 /* dual partition ota kernelA attributes */ 31 #define HI_UPG_FILE_ATTR_KERNELB 0x2 /* dual partition ota kernelB attributes */ 32 #define HI_UPG_FILE_ATTR_COMPRESSION 0x4 /* compression ota kernel or flashboot attributes */ 33 34 #define HI_UPG_OTA_SETTINGS_MASK 0x3F 35 36 hi_u32 upg_check_common_head(const hi_upg_common_head *head, hi_u32 head_size); 37 hi_u32 upg_get_common_head_from_flash(hi_u32 addr, hi_upg_common_head *head); 38 hi_u32 upg_get_section_head_from_flash(hi_u32 addr, hi_upg_section_head *section_head); 39 hi_u32 upg_verify_file(hi_u32 flash_addr); 40 #endif /* __UPG_CHECK_FILE_H__ */ 41 42