xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 1 | #ifndef _DOWNLOAD_H_ |
| 2 | #define _DOWNLOAD_H_ |
| 3 | |
| 4 | #include "define.h" |
| 5 | |
| 6 | // BI层最大支持线程数 |
| 7 | #define TSP_THREAD_NUM 64 |
| 8 | |
| 9 | // 下载文件类型 |
| 10 | #define FLASH (0x01) |
| 11 | #define EXTSRAM (0x02) |
| 12 | #define FPGA (0x03) |
| 13 | #define RAMIMAGE (0x04) |
| 14 | #define NVBACKUP (0x05) |
| 15 | #define ZPHY_ERFC_CA_NUMBER 2 |
| 16 | |
| 17 | // 串行口参数配置 |
| 18 | #define READ_INTERVAL_TIMEOUT (0) |
| 19 | #define READ_TOTAL_TIMEOUT_MULTIPLIER (0) |
| 20 | #define READ_TOTAL_TIMEOUT_CONSTANT (0) |
| 21 | #define WRITE_TOTAL_TIMEOUT_MULTIPLIER (0) |
| 22 | #define WRITE_TOTAL_TIMEOUT_CONSTANT (1000) |
| 23 | |
| 24 | // 收发数据包大小 |
| 25 | #define READ_QUEUE (4096) |
| 26 | #define WRITE_QUEUE (4096) |
| 27 | |
| 28 | // 波特率设置选项 |
| 29 | #define NO_OF_PARAMS (7) |
| 30 | #define COM_PORT (1) |
| 31 | #define BAUD_RATE (2) |
| 32 | #define PARITY (3) |
| 33 | #define STOP_BITS (4) |
| 34 | #define DATA_BITS (5) |
| 35 | #define READ_INTVL (6) |
| 36 | #define TOTAL_TIME (7) |
| 37 | |
| 38 | // |
| 39 | //#define BUFFERLEN 1100 |
| 40 | #define AT_CMD_TYPE_TEST 1000 |
| 41 | #define AT_CMD_TYPE_AT 1001 |
| 42 | #define INFO_PACKET_LEN 1024 |
| 43 | // 下载的配置文件选项 |
| 44 | #define VERSION_NUM 4 |
| 45 | |
| 46 | #define CONFIG_SECTION_CFG _T("Configuration") |
| 47 | #define CONFIG_SECTION_VERSION _T("Version") |
| 48 | #define CONFIG_SECTION_CHIPDETAILS _T("ChipDetails") |
| 49 | #define CONFIG_SECTION_ARM_BIN _T("ArmBin") |
| 50 | #define CONFIG_SECTION_ZSP_BIN _T("ZspBin") |
| 51 | #define CONFIG_SECTION_ZSPCC_BIN _T("ZspCCBin") |
| 52 | #define CONFIG_SECTION_ARM1_BIN _T("Arm1Bin") |
| 53 | #define CONFIG_SECTION_TDNV_BIN _T("TDNVBin") |
| 54 | #define CONFIG_SECTION_AP_BIN _T("APBin") |
| 55 | #define CONFIG_SECTION_RAMDISK_BIN _T("RAMDiskBin") |
| 56 | #define CONFIG_SECTION_PHY_FILES_INFO _T("AMT_PHY_FILES_INFO") |
| 57 | #define CONFIG_SECTION_DOWNLOAD_IMAGE _T("DownloadImage") |
| 58 | #define CONFIG_SECTION_NV_BACKUP _T("NVBackup") |
| 59 | #define CONFIG_SECTION_INDEX_LIST _T("IndexList") |
| 60 | #define CONFIG_SECTION_IN_SOFTVERSION _T("SoftVersionIn") |
| 61 | #define CONFIG_SECTION_OUT_SOFTVERSION _T("SoftVersionOut") |
| 62 | #define CONFIG_SECTION_SSID_FLAG _T("SSIDFlag") |
| 63 | #define CONFIG_SECTION_SSID _T("SSID") |
| 64 | |
| 65 | #define CONFIG_SECTION_BUILD_DATE _T("BuildDate") |
| 66 | #define CONFIG_SECTION_BUILD_TIME _T("BuildTime") |
| 67 | #define CONFIG_SECTION_RALETIVEPATHBOOT _T("RaletivePathBOOT") |
| 68 | #define CONFIG_SECTION_RALETIVEPATHAT _T("RaletivePathAT") |
| 69 | #define CONFIG_SECTION_RALETIVEPATHATLC _T("RaletivePathATLC") |
| 70 | #define CONFIG_SECTION_RALETIVEPATHLOG _T("RaletivePathLOG") |
| 71 | #define CONFIG_SECTION_RALETIVEPATHFT _T("RaletivePathFT") |
| 72 | #define CONFIG_KEY_VERSION _T("Version") |
| 73 | #define CONFIG_KEY_FILE _T("File") |
| 74 | #define CONFIG_KEY_STARTADDRESS _T("StartAddress") |
| 75 | #define CONFIG_KEY_ENDADDRESS _T("EndAddress") |
| 76 | #define CONFIG_KEY_TYPE _T("Type") |
| 77 | #define CONFIG_KEY_DEBUGINFO _T("DebugInfo") |
| 78 | #define CONFIG_KEY_OPENLOGPORT _T("IsOpenLogPort") |
| 79 | #define CONFIG_KEY_NVBACKUPCOUNT _T("NVItemCount") |
| 80 | #define CONFIG_KEY_TLFILE _T("TLFile") |
| 81 | #define CONFIG_KEY_TLSTARTADDRESS _T("TLStartAddress") |
| 82 | #define CONFIG_KEY_TDPSTARTADDRESS _T("TDPStartAddress") |
| 83 | #define CONFIG_KEY_FLASHSTARTADDRESS _T("FlashStartAddress") |
| 84 | #define CONFIG_KEY_COUNT _T("Count") |
| 85 | #define CONFIG_KEY_MANUID _T("ManuID") |
| 86 | #define CONFIG_KEY_DEVICEID _T("DeviceID") |
| 87 | #define CONFIG_KEY_TDPPATH _T("TDPPath") |
| 88 | #define CONFIG_KEY_RELATIVEPATH _T("UseRelativePath") |
| 89 | #define CONFIG_KEY_READFROMFILE _T("ReadFromFile") |
| 90 | #define CONFIG_KEY_FILESYSTEM _T("FileSystem") |
| 91 | #define CONFIG_KEY_LENGTH _T("Length") |
| 92 | #define CONFIG_KEY_BUILD_DATE _T("BuildDate") |
| 93 | #define CONFIG_KEY_BUILD_TIME _T("BuildTime") |
| 94 | #define CONFIG_KEY_SN_INDEX _T("SNIndex") |
| 95 | // ....by wong |
| 96 | #define CONFIG_KEY_HARDWARE_SN_INDEX _T("HARDWARE_SNIndex") |
| 97 | #define CONFIG_KEY_IMEI_INDEX _T("IMEIIndex") |
| 98 | #define CONFIG_KEY_WIFI_MAC_INDEX _T("WIFIIndex") |
| 99 | #define CONFIG_KEY_RJ45_MAC_INDEX _T("RJ45MACIndex") |
| 100 | #define CONFIG_KEY_TESTINFO_INDEX _T("TestInfoIndex") |
| 101 | #define CONFIG_KEY_SN_BACKUP_INDEX _T("SNBackupIndex") |
| 102 | #define CONFIG_KEY_IMEI_BACKUP_INDEX _T("IMEIBackupIndex") |
| 103 | #define CONFIG_KEY_TESTINFO_BACKUP_INDEX _T("TestInfoBackupIndex") |
| 104 | #define CONFIG_KEY_BBACKUPAREA _T("bBackupArea") |
| 105 | #define CONFIG_KEY_RALETIVEPATH _T("RaletivePath") |
| 106 | #define CONFIG_KEY_ATVERSION _T("AtVersion") |
| 107 | #define CONFIG_KEY_TESTINFODOWNLOAD _T("TestInfoDLPV") |
| 108 | |
| 109 | //#define CONFIG_KET_ISBOOTROM _T("IsBootRom") |
| 110 | #define CONFIG_KEY_USBORUARTPORT _T("USBORUARTPORT") |
| 111 | #define CONFIG_KEY_BOOTSTAGE1FILE _T("BootStage1File") //add zxw 20130422 for 296301 |
| 112 | #define CONFIG_KEY_BOOTSTAGE1STARTADDRESS _T("BootStage1StartAddress") |
| 113 | #define CONFIG_KEY_BOOTSTAGE2FILE _T("BootStage2File") //add zxw 20120422 for 296301 |
| 114 | #define CONFIG_KEY_BOOTSTAGE2STARTADDRESS _T("BootStage2StartAddress") |
| 115 | #define CONFIG_KEY_PARTITIONFILE _T("PartitionFile") //add zxw 20120422 for 296301 |
| 116 | #define CONFIG_KEY_PARTITIONSTARTADDRESS _T("PartitionStartAddress") |
| 117 | #define CONFIG_KEY_PARTITIONNAME _T("PartitionName") |
| 118 | #define CONFIG_KEY_PARTITIONTYPE _T("PartitionType") |
| 119 | #define CONFIG_KEY_STARTAMTCMD _T("StartAMTCMD") |
| 120 | #define CONFIG_KEY_ISDOWNLOAD_PV _T("ISDownLoadPV") |
| 121 | #define CONFIG_KEY_PHY_FILE_NUMS _T("FileNumber") |
| 122 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 123 | |
| 124 | |
| 125 | // For CDownload |
| 126 | #define BI_TSP_ERROR_BASE_CDownload (BI_TSP_ERROR_BASE_CTransmit + 10000) |
| 127 | |
| 128 | typedef enum |
| 129 | { |
| 130 | TYPE_BOOT, // 从TYPE_BOOT到TYPE_TEST_AUTO |
| 131 | TYPE_BOOT_AUTO, // 属于老版本设计的思路,其初衷 |
| 132 | TYPE_EVB_TEST, // 是按照EVB、FWP、DATACARD进行 |
| 133 | TYPE_EVB_LOG, // 分类,根据配置界面(校准的脚本) |
| 134 | TYPE_FWP_TEST, // 设置对应的值,达到找到对应端口 |
| 135 | TYPE_FWP_LOG, // 的目的。这种做法看似简单,但 |
| 136 | TYPE_DATACARD_TEST, // 带来了维护方面的困难,因此, |
| 137 | TYPE_DATACARD_LOG, // 将采用新的方法进行兼容性过度 |
| 138 | TYPE_TEST_AUTO, |
| 139 | TYPE_AT, // 过度的准则是:在配置文件中设置对应端口的匹配信息 |
| 140 | TYPE_LOG, // 所有项目通过这对统一的入口与端口对接 |
| 141 | TYPE_FT, // 打开FT的AT口 |
| 142 | TYPE_BOOT_P93B, // P93B的Boot口 |
| 143 | TYPE_AT_P93B, // P93B的AT口 |
| 144 | TYPE_AT_LC, |
| 145 | TYPE_INVALID = 99, |
| 146 | } enCOMTYPE; |
| 147 | |
| 148 | typedef enum |
| 149 | { |
| 150 | TYPE_GPIB = 0, |
| 151 | TYPE_LAN, |
| 152 | |
| 153 | } enTransferType; |
| 154 | |
| 155 | typedef enum |
| 156 | { |
| 157 | OFF_STATE =0, |
| 158 | ON_STATE, |
| 159 | ERR_STATE, |
| 160 | |
| 161 | } enBootFlag; |
| 162 | // BOOT口列表 |
| 163 | #define TYPE_BOOT_LIST TYPE_BOOT, TYPE_BOOT_P93B |
| 164 | // AT口列表 |
| 165 | #define TYPE_AT_LIST TYPE_EVB_TEST, TYPE_FWP_TEST, TYPE_DATACARD_TEST, TYPE_AT, TYPE_FT, TYPE_AT_P93B |
| 166 | // LOT口列表 |
| 167 | #define TYPE_LOG_LIST TYPE_EVB_LOG, TYPE_FWP_LOG, TYPE_DATACARD_LOG |
| 168 | |
| 169 | typedef struct _COMSTRUCT |
| 170 | { |
| 171 | #pragma pack(1) |
| 172 | BYTE byByteSize; |
| 173 | BYTE byParity; |
| 174 | BYTE byStopBits; |
| 175 | DWORD dwBaudRate; |
| 176 | DWORD dwReadInterval; |
| 177 | DWORD dwTotalTime; |
| 178 | #pragma pack() |
| 179 | } COMSTRUCT; |
| 180 | |
| 181 | typedef struct |
| 182 | { |
| 183 | int cmd; |
| 184 | unsigned char Msg[INFO_PACKET_LEN]; |
| 185 | }Msg_PACKET; |
| 186 | |
| 187 | // start ============================================================================================= |
| 188 | #define DLTYPE_CONTROL_BEGIN() \ |
| 189 | typedef enum{ \ |
| 190 | DLTYPE_OWNERSTATE_START = 0x00, \ |
| 191 | |
| 192 | #define DLTYPE_CONTROL_END() \ |
| 193 | DLTYPE_OWNERSTATE_END = 0X11, \ |
| 194 | }enDLTYPE_CONTROL; |
| 195 | // CDownload绑定状态位索引 |
| 196 | // 下载类型绑定状态位,enDownloadType高字合计2个字节空间,支持16个小bool位控制从BI传入BL |
| 197 | // 如: 免PV的标志位IsNoPVDownLoad变量传入 |
| 198 | // 若已经使用某一位,则不可再复用 |
| 199 | |
| 200 | #define STATEFLAG(x) (1<<x) |
| 201 | |
| 202 | DLTYPE_CONTROL_BEGIN() // start 在此内部添加[下载类型绑定状态位]传入BL |
| 203 | DLTYPE_OWNERSTATE_NONEPV = STATEFLAG(0), // 免PV控制开关 |
| 204 | DLTYPE_OWNERSTATE_NONEPV_ERASEAUTO = STATEFLAG(1), |
| 205 | DLTYPE_OWNERSTATE_NONEPV_ERASEALL = STATEFLAG(2), |
| 206 | // TODO |
| 207 | |
| 208 | DLTYPE_CONTROL_END() // end |
| 209 | // end ============================================================================================= |
| 210 | |
| 211 | |
| 212 | //CDownload |
| 213 | typedef enum |
| 214 | { |
| 215 | DOWNLOAD_TYPE_AMT, |
| 216 | DOWNLOAD_TYPE_AMT_MODEM, //modem 小系统 |
| 217 | DOWNLOAD_TYPE_AMT_AP, // AP小系统 |
| 218 | DOWNLOAD_TYPE_IMAGE, // 版本文件 |
| 219 | DOWNLOAD_TYPE_NV_IMAGE, // NV镜像文件 |
| 220 | DOWNLOAD_TYPE_NV, // NV 备份文件 |
| 221 | DOWNLOAD_TYPE_SN, // SN文件 |
| 222 | DOWNLOAD_TYPE_IMEI, // IMEI文件 |
| 223 | DOWNLOAD_TYPE_TESTINFO, // TESTINFO文件 |
| 224 | DOWNLOAD_TYPE_SN_BACKUP, // SN Backup文件 |
| 225 | DOWNLOAD_TYPE_IMEI_BACKUP, // IMEI Backup文件 |
| 226 | DOWNLOAD_TYPE_TESTINFO_BACKUP, // TESTINFO Backup文件 |
| 227 | DOWNLOAD_TYPE_IN_SOFTVERSION, // SoftVersion文件 |
| 228 | DOWNLOAD_TYPE_MAC_WIFI, |
| 229 | DOWNLOAD_TYPE_SSID_FLAG, |
| 230 | DOWNLOAD_TYPE_SSID, |
| 231 | DOWNLOAD_TYPE_FS_FLAG, |
| 232 | DOWNLOAD_TYPE_OUT_SOFTVERSION, // SoftVersion文件 |
| 233 | DOWNLOAD_TYPE_HARDWARE_SN, // HARDWARE_SN 下载硬件版本号 |
| 234 | DOWNLOAD_TYPE_TESTINFO_DL_PV, // 下载PV版本的生产测试标志位 |
| 235 | DOWNLOAD_TYPE_TESTINFO_DL_RELEASE, // 下载发货版本的生产测试标志位 |
| 236 | DOWNLOAD_TYPE_TESTINFO_DL_AMT, // 下载AMT版本的生产测试标志位 |
| 237 | DOWNLOAD_TYPE_MAC_RJ45, |
| 238 | } enDownloadType; |
| 239 | |
| 240 | typedef enum |
| 241 | { |
| 242 | METHOD_NORMAL, // 只备份工作区 |
| 243 | METHOD_WORK_BACKUP, // 根据标志位,备份工作区、备份区 |
| 244 | METHOD_WRITE_TO_FILE, // 备份时,若板号不为空,则将NV数据写入文件 |
| 245 | } enDownloadNVBackupMethod; |
| 246 | |
| 247 | // 待下载镜像文件信息 CDownload |
| 248 | typedef struct |
| 249 | { |
| 250 | BOOL bDownload; // 上/下载功能标志,TRUE = 下载;FALSE = 上载 |
| 251 | char * strFileName; // 文件路径 |
| 252 | BOOL bUseRelativePath; // 文件路径是否为相对路径;TRUE = 相对路径;FALSE = 绝对路径 |
| 253 | BOOL bReadFromFile; // 下载时,是否直接从文件读取;TRUE = 数据取自文件;FALSE = 数据取自内存 |
| 254 | // BOOL bFileSystem; // 镜像文件是否为文件系统;TRUE = 文件系统文件;FALSE = 非文件系统文件 |
| 255 | BOOL bAutoDeleteImageCache; // 是否自动回收镜像缓存 |
| 256 | BYTE *pImageCache; // 镜像缓存 |
| 257 | // DWORD dwStartAddress; // 下载/上载绝对起始地址 |
| 258 | |
| 259 | DWORD dwOffset; // 相对于文件/缓存的偏移 |
| 260 | DWORD dwLength; // 下载/上载数据长度 |
| 261 | int nType; // 下载类型 |
| 262 | char PartitionName[16]; //分区名 add zxw 20130422 |
| 263 | char FileName[16]; |
| 264 | char PartitionType[16] ; |
| 265 | DWORD nPartitionOffset; |
| 266 | //新增文件的CRC校验值 |
| 267 | ULONG ulCRCValue; |
| 268 | |
| 269 | } stFileItem; |
| 270 | |
| 271 | // NV备份信息 |
| 272 | typedef struct |
| 273 | { |
| 274 | enDownloadType nType; // NV备份的类型 |
| 275 | BYTE *pBuffer; // NV备份的缓存 |
| 276 | DWORD dwStartAddress;// NV备份的下载地址 |
| 277 | DWORD dwLength; // NV备份的长度 |
| 278 | } stNVItem; |
| 279 | |
| 280 | typedef struct |
| 281 | { |
| 282 | unsigned long dwResult; |
| 283 | } stResult; |
| 284 | |
| 285 | ////////////////////////////////////////////////////////////////////////// |
| 286 | typedef unsigned int UINT32; |
| 287 | typedef signed int SINT32; |
| 288 | typedef unsigned short UINT16; |
| 289 | typedef signed short SINT16; |
| 290 | |
| 291 | // 分区表相关的信息 |
| 292 | #define MAX_ENTRY 16 |
| 293 | |
| 294 | // add cxh 7510 下载分区文件类型 |
| 295 | #define nand (0x01) |
| 296 | #define fs (0x02) |
| 297 | //#define NV (0x03) |
| 298 | #define zftl (0x03) |
| 299 | #define ddr (0x04) |
| 300 | #define raw (0x05) |
| 301 | #define zloader (0x06) |
| 302 | |
| 303 | // 合并BIN文件中Masterhead结构 |
| 304 | typedef struct |
| 305 | { |
| 306 | BYTE FileId[16]; |
| 307 | BYTE chVersionIN[32]; |
| 308 | BYTE chVersionOUT[32]; |
| 309 | DWORD nTotalFileNum; |
| 310 | DWORD nFlashType; |
| 311 | DWORD nNVCoalition; |
| 312 | DWORD iFileSize; |
| 313 | DWORD iCkeckSum; |
| 314 | DWORD iImageStructOffset; |
| 315 | DWORD tloaderOffset; |
| 316 | DWORD tloaderLength; |
| 317 | DWORD tBootOffset; |
| 318 | DWORD tBootLength; |
| 319 | DWORD PartitionOffset; |
| 320 | DWORD PartitionLength; |
| 321 | BYTE UnUsed[80]; //预留区 |
| 322 | }stBinMasterInfo; |
| 323 | |
| 324 | |
| 325 | typedef struct |
| 326 | { |
| 327 | BYTE PartitionName[16]; |
| 328 | BYTE PartitionType[16]; |
| 329 | unsigned int PartitionSize; |
| 330 | unsigned int PartitionOffset; |
| 331 | }partition_entry; |
| 332 | |
| 333 | typedef struct |
| 334 | { |
| 335 | unsigned int iPartitionMagic; |
| 336 | BYTE PlatformName[16]; |
| 337 | unsigned int iPartitionVersion; /* 分区版本 */ |
| 338 | unsigned int iPartitionEntrys; /* 总的分区个数 */ |
| 339 | unsigned int iPartitionCrc; |
| 340 | partition_entry PartitionTable[MAX_ENTRY]; |
| 341 | }partition_table; |
| 342 | |
| 343 | |
| 344 | // 合并BIN文件的文件头部信息 CDownload |
| 345 | typedef struct |
| 346 | { |
| 347 | BYTE nTotalFileNum; // BIN文件中包含的子文件总数量 |
| 348 | BYTE UnUsed[15]; // 未使用 |
| 349 | } stBinInfo; |
| 350 | |
| 351 | // 合并BIN文件的每个文件信息 CDownload |
| 352 | typedef struct |
| 353 | { |
| 354 | DWORD dwOffset; // 子文件相对于BIN文件起始的偏移 |
| 355 | DWORD dwLength; // 子文件长度 |
| 356 | DWORD dwStartAddress; // 子文件待下载的绝对地址 |
| 357 | DWORD nType; // 子文件的类型 |
| 358 | BYTE bFileSystem; // 子文件的文件系统标志 |
| 359 | |
| 360 | } stBinFileHeader; |
| 361 | |
| 362 | typedef struct |
| 363 | { |
| 364 | BYTE FileName[64]; |
| 365 | BYTE PartitionName[16]; |
| 366 | BYTE PartitionType[16]; |
| 367 | unsigned int iFileLength; |
| 368 | unsigned int iPartitionOffset; |
| 369 | unsigned int iFileOffset; // 子文件相对于BIN文件起始的偏移 |
| 370 | //相对于分区起始地址的偏移 |
| 371 | BYTE UnUsed[20]; |
| 372 | }stBinImageHead; |
| 373 | |
| 374 | typedef enum |
| 375 | { |
| 376 | HDT_W_MAIN = 0, |
| 377 | HDT_W_ASSIST, |
| 378 | HDT_W_MAANDAS, |
| 379 | }E_HDT_WAGCTYPE; |
| 380 | |
| 381 | typedef struct |
| 382 | { |
| 383 | int iErrorCode; |
| 384 | char cBarcode[21]; |
| 385 | } stDLDBInfo; |
| 386 | |
| 387 | typedef enum |
| 388 | { |
| 389 | STAT_SYNC, // 0 |
| 390 | STAT_START_BYTE, // 1 |
| 391 | STAT_NO_MODIFY_REG, // 2 |
| 392 | STAT_ADDRESS, // 3 |
| 393 | STAT_DATA_LEN, // 4 |
| 394 | STAT_DATAPACKET, // 5 |
| 395 | STAT_LINK_EST, // 6 |
| 396 | STAT_DEVICEINFO, // 7 |
| 397 | STAT_CONFIGTDP, // 8 |
| 398 | STAT_PROG_DEV_ST_ADDR, // 9 |
| 399 | STAT_PROG_DEV_END_ADDR, // 10 |
| 400 | STAT_SET_PACKET_SIZE, // 11 |
| 401 | STAT_CHANGE_CONFIG, // 12 |
| 402 | STAT_ERASE_SEG_ST_ADDR, // 13 |
| 403 | STAT_ERASE_SEG_END_ADDR, // 14 |
| 404 | STAT_DEV_BASE_ADDR, // 15 |
| 405 | STAT_EXECUTE_CODE, // 16 |
| 406 | STAT_TERMINATE, // 17 |
| 407 | STAT_RVRS_DWNLD, // 18 |
| 408 | STAT_UPLD_DATA_SIZE, // 19 |
| 409 | STAT_SUCCESS, // 20 |
| 410 | STAT_CRC_ON, |
| 411 | STAT_CRC_OFF, |
| 412 | // New stat add code here |
| 413 | } enSTAT; |
| 414 | |
| 415 | |
| 416 | //Bootrom & TLoader公用下载协议 |
| 417 | #define CMD_SYNC_BYTE_BOOTROM 0x5A |
| 418 | #define CMD_SYNC_BYTE_ACK_BOOTROM 0xA5 |
| 419 | #define CMD_SEND_REG_CONFIG_BOOTROM 0x6A |
| 420 | #define CMD_SEND_DATA_BOOTROM 0x7A |
| 421 | #define CMD_STARTUP_BOOTROM 0x8A |
| 422 | |
| 423 | //7520V2 bootrom&TLoader新增回复命令 |
| 424 | #define CMD_SEND_ADDRESS_LEN_ACK_BOOTROM 0xA1 |
| 425 | #define CMD_SEND_DATA_ACK_BOOTROM 0xA7 |
| 426 | #define CMD_STARTUP_ACK_BOOTROM 0xA8 |
| 427 | |
| 428 | |
| 429 | //TBoot运行同步协议 |
| 430 | #define CMD_SYNC_TBOOT 0x5A |
| 431 | #define CMD_SYNC_ACK_TBOOT 0xA7 |
| 432 | |
| 433 | #define PACKET_SIZE_BOOT 131072 |
| 434 | //#define PACKET_SIZE_BOOT 131072 |
| 435 | |
| 436 | #define PACKET_SIZE_TL 1024 |
| 437 | #define PACKET_SIZE_TDP 4096 |
| 438 | |
| 439 | #define PACKET_SIZE_FLASH 4096 |
| 440 | |
| 441 | //#define PACKET_SIZE_FLASH 2097152 |
| 442 | #define PACKET_SIZE_IMAGE 131072 |
| 443 | #define PACKET_SIZE_FILESYSTEM 135168 |
| 444 | |
| 445 | //partiiton协议 |
| 446 | typedef enum |
| 447 | { // STAT_TBOOT_OK, |
| 448 | STAT_SYNC_PARTIITON, |
| 449 | STAT_SET_PARTITION_CMD, |
| 450 | STAT_SEND_PARTIITON, |
| 451 | STAT_EXIT, |
| 452 | |
| 453 | }enParpSTAT; |
| 454 | |
| 455 | typedef struct |
| 456 | { |
| 457 | enSTAT mNextTRUE; |
| 458 | enSTAT mNextFALSE; |
| 459 | } stSTAT; |
| 460 | |
| 461 | typedef struct DownloadConfig |
| 462 | { |
| 463 | enSTAT mStartState; |
| 464 | BOOL mbExecuteCode; //下载后,是否启动运行,暂时无用 zxw 20130422 |
| 465 | stFileItem mCurrentFile; |
| 466 | DWORD mPacketSize; //数据包大小,新方案由UE侧上传,暂无用处 zxw 20130422 //这个还是有用的,大小不超过2M就可以 |
| 467 | } stDownloadConfig; |
| 468 | |
| 469 | // 执行擦除NVRW |
| 470 | BOOL ExecuteEraseNVRW(const char *softwarepath); |
| 471 | // 下载boot和tloader |
| 472 | BOOL DoDownloadBootForDL(BOOL bCheckPartition, const char *softwarepath); |
| 473 | // 下载主流程 |
| 474 | int PrimaryDoDownload(const char *softwarepath); |
| 475 | |
| 476 | #endif |