1 /* 2 * Copyright (C) 2023 Rockchip Electronics Co., Ltd. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef _DEFINEHEADER_H 18 #define _DEFINEHEADER_H 19 20 #define DEFAULT_DOWNLOAD_PATH "/tmp/update.img" 21 #define BLOCK_WRITE_LEN (16 * 1024) 22 #define MTD_SIZE 2048 23 #define SECTOR_SIZE 512 24 25 #define BYTE2SECTOR(x) ((x>0)?((x-1)/SECTOR_SIZE + 1):(x)) 26 #define PAGEALIGN(x) ((x>0)?((x-1) / 4 + 1):(x)) 27 28 typedef unsigned char BYTE; 29 typedef BYTE *PBYTE; 30 typedef unsigned short USHORT; 31 typedef unsigned int UINT; 32 typedef unsigned int DWORD; 33 typedef unsigned char UCHAR; 34 typedef unsigned short WCHAR; 35 typedef signed char CHAR; 36 37 typedef enum { 38 RKNONE_DEVICE = 0, 39 RK27_DEVICE = 0x10, 40 RKCAYMAN_DEVICE, 41 RK28_DEVICE = 0x20, 42 RK281X_DEVICE, 43 RKPANDA_DEVICE, 44 RKNANO_DEVICE = 0x30, 45 RKSMART_DEVICE, 46 RKCROWN_DEVICE = 0x40, 47 RK29_DEVICE = 0x50, 48 RK292X_DEVICE, 49 RK30_DEVICE = 0x60, 50 RK30B_DEVICE, 51 RK31_DEVICE = 0x70, 52 RK32_DEVICE = 0x80 53 } ENUM_RKDEVICE_TYPE; 54 55 typedef enum { 56 ENTRY471 = 1, 57 ENTRY472 = 2, 58 ENTRYLOADER = 4 59 } ENUM_RKBOOTENTRY; 60 61 #define SHA_DIGEST_SIZE 20 62 #define PART_NAME 32 63 #define RELATIVE_PATH 64 64 #define MAX_PARTS 20 65 #define MAX_MACHINE_MODEL 64 66 #define MAX_MANUFACTURER 60 67 #define MAX_PACKAGE_FILES 32 68 #define RKIMAGE_TAG 0x46414B52 69 #define IMAGE_RESERVED_SIZE 61 70 #define BOOT_RESERVED_SIZE 57 71 #define IDB_BLOCKS 5 72 #define IDBLOCK_TOP 50 73 #define CHIPINFO_LEN 16 74 #define RKANDROID_SEC2_RESERVED_LEN 473 75 #define RKDEVICE_SN_LEN 30 76 #define RKANDROID_SEC3_RESERVED_LEN 419 77 #define RKDEVICE_IMEI_LEN 15 78 #define RKDEVICE_UID_LEN 30 79 #define RKDEVICE_BT_LEN 6 80 #define RKDEVICE_MAC_LEN 6 81 #define SPARE_SIZE 16 82 83 #define GPT_BACKUP_FILE_NAME "gpt_backup.img" 84 85 #endif 86