www.pudn.com > FlashTool_src_v2.9.1006.zip > DOWNLOAD.H


/******************************************************************************* 
*  Copyright Statement: 
*  -------------------- 
*  This software is protected by Copyright and the information contained 
*  herein is confidential. The software may not be copied and the information 
*  contained herein may not be used or disclosed except with the written 
*  permission of MediaTek Inc. (C) 2001 
* 
*******************************************************************************/ 
 
/******************************************************************************* 
 * Filename: 
 * --------- 
 *	   download.h 
 * 
 * Project: 
 * -------- 
 *   MTK6208 DOWNLOAD AGENT 
 * 
 * Description: 
 * ------------ 
 *   This file is intends for download agent specific definition 
 * 
 * Author: 
 * ------- 
 *	Jensen Hu 
 * 
 *------------------------------------------------------------------------------ 
 * $Revision:   1.36  $  
 * $Modtime:   Jan 13 2006 20:33:06  $ 
 * $Log:   //mtkvs01/vmdata/flash_tool/archives/DA/INC/DOWNLOAD.H-arc  $ 
 * 
 * Nov 27 2006 mtk01413 
 * [STP100001233] FlashTool v2.9.1006 release 
 * New features: 
 *  1. [DA] Supports new NOR flash device. 
 * 		[SPANSION] S71WS128NB0BFWAN3 
 * 		[ST] M58PPR256J 
 * 		[ST] M58PPR512J 
 * 		[SST] SST32HF3241C 
 * 		[SPANSION] S71WS512PD0HF3HR 
 *  
 * 
 * Jun 12 2006 mtk01413 
 * [STP100000922] FlashTool v2.9.1001 release 
 * New features: 
 *  1. [FlashTool/BROM_DLL] Support Multi-Load Autodetection Download. 
 * 
 * May 24 2006 mtk01413 
 * [STP100000877] FlashTool v2.7.1018 release 
 *  1. [DA] Supports new NOR flash device. 
 * 	[SHARP] LRS18BK 
 * 	[INTEL] 28F3204C3TD70, [MemoCom] KS03204 
 *  2. [DA] Supports new NAND flash device. 
 * 	[TOSHIBA] TC58NWM9S3B  
 * 
 * Mar 18 2006 mtk01413 
 * [STP100000694] [DA] 1. Support SST driver. 2. Bug Fix: WriteCmd  3. Bug Fix: DetectExtRAM 
 * [SST]  SST34HF16x1 
 * [SST]  SST34HF32x4 
 * 
 * Mar 8 2006 mtk00539 
 * [STP100000625] FlashTool v2.7.1016 
 *  1. [DA] Supports new NOR flash device. 
 * 		[INTEL] PF48F50xxM0x1xx 
 * 		[INTEL] PF48F40xxM0x0xx 
 * 		[INTEL] PF48F40xxM0x1xx 
 *  2. [DA] Supports new NAND flash device. 
 * 		[MICRON] MT29F2G08AAC 
 * 		[MICRON] MT29F4G08BAB 
 * 		[RENESAS] superAND 512Mb/8bits 
 * 		[RENESAS] superAND 512Mb/16bits 
 * 		[Infineon] HYF33DS51280 
 * 		[Infineon] HYF33DS1G80 
 * 		[Infineon] HYF33DS1G16 
 *  
 * 
 * Mar 8 2006 mtk00539 
 * [STP100000669] [DA] Support RENESAS superAND flash read back and format operation. 
 *  
 * 
 * Feb 26 2006 mtk00539 
 * [STP100000633] [BROM_DLL] Using local DA_REPORT_T variable to avoid multithread unsafe problem. 
 *  
 * 
 * Feb 23 2006 mtk00539 
 * [STP100000625] FlashTool v2.7.1016 
 *  
 *  
 *    Rev 1.36   Jan 14 2006 00:09:52   mtk00539 
 * Bug fixes: 
 *  1. [DA] Workaround reading DSP version failure issue in some production lines, rollback to the old method for reading DSP version.  
 *  
 * New features: 
 *  1. [DA] Supports INTEL Sibley family flash. 
 *  2. [DA] Supports new NOR flash device. 
 * 		[INTEL] PF38F5050M0XXXX 
 * Resolution for 159: [FlashTool v2.7.1015] 
 *  
 *    Rev 1.35   Jan 04 2006 14:35:48   mtk00539 
 * Bug fixes: 
 *  1. [DA] Fix Spansion S71PLXXXN detection problem by reading CFI info. 
 *  
 * New features: 
 *  1. [DA] Supports Spansion MirrorBit Buffer-Program method. 
 *  2. [DA] Supports new NOR flash device. 
 * 		[SPANSION] S71PL129N 
 *  
 * Enhancements: 
 *  1. [DA] Halt program when external RAM is less than 128KB. 
 * Resolution for 158: [FlashTool v2.7.1014][New] Support Spansion MirrorBit Buffer-Program method. 
 *  
 *    Rev 1.34   Jan 02 2006 13:16:22   mtk00539 
 * Add new flash [SPANSION] S71PL256NC0HAW5B 
 * Resolution for 156: [FlashTool v2.7.1013][BUG FIX] Fix BootROM start command failure while manually selecting NMT6226 or MT6227 baseband chip. 
 *  
 *    Rev 1.33   Dec 29 2005 10:42:58   mtk00539 
 *  1. [DA] Supports new NOR flash device. 
 * 		[SPANSION] S71PL127N 
 * 		[SILICON7] SV6D2832UTA 
 * 		[SILICON7] SV6D2832UBA 
 * 		[SILICON7] SV6C2832UTA 
 * 		[SILICON7] SV6C2832UBA 
 * 		[SHARP] LH28F16 
 * 		[TOSHIBA] TV00578002DABD 
 * 		[TOSHIBA] TV00578003DABD 
 *  2. [DA] Supports new NAND flash device. 
 * 		[TOSHIBA] TH58NVG1S8BFT 
 * Resolution for 156: [FlashTool v2.7.1013][BUG FIX] Fix BootROM start command failure while manually selecting NMT6226 or MT6227 baseband chip. 
 *  
 *    Rev 1.32   Nov 27 2005 16:35:56   mtk00539 
 * 1. [DA][BUG FIX] Add NUTL_VERIFY_AFTER_PROGRAM flash to perform read back verification after program operation.  
 * Resolution for 151: [BROM_DLL v2.7.1012][BUG FIX] Cannot recognize 05B ROM_INFO header. 
 *  
 *    Rev 1.31   Nov 19 2005 00:40:30   mtk00539 
 *  1. [BROM_DLL&DA][New] Add UID Secure Booting feature. 
 *  2. [BROM_DLL&DA][BUG FIX] Fix RTC date-time value could not be initialized problem.  
 *  3. [DA][New] Supports new NOR flash device. 
 * 				[INTEL] 38F1010C0ZBL0 
 * 				[INTEL] 28F1602C3BD70 
 * 				[TOSHIBA] TY0068B012APGG 
 * 				[TOSHIBA] TY0068B013APGG 
 *  4. [DA][New] Supports new NAND flash device. 
 * 				[HYNIX] HY27XG082G2M 
 * Resolution for 149: [BROM_DLL v2.7.1011][New] Add UID Secure Booting feature and Bug Fix. 
 *  
 *    Rev 1.30   Oct 26 2005 09:43:42   mtk00539 
 *  1. [BROM_DLL][Enhance] Always fix BootROM start command read timeout to 20ms to bypass start command failure problem. 
 *  2. [DA][BUG FIX] Fix wrong start block address of 2nd binary for new NFB architecture. 
 * Resolution for 144: [BROM_DLL v2.7.1010][BUG FIX] Fix wrong start block address of 2nd binary for new NFB architecture. 
 *  
 *    Rev 1.29   Oct 19 2005 14:45:02   mtk00539 
 *  1. [BROM_DLL&DA][New] New H/W devices detection architecture including NOR, NAND, SRAM and DRAM detection.  
 *  2. [BROM_DLL&DA][New] DA partial download technic, that overcomes DA size exceeds MT6205B internal SRAM (32KB). 
 *  3. [BROM_DLL&DA][New] Format verification option, each byte should be 0xFF after erasure.  
 *  4. [BROM_DLL&DA][New] DA validation to ensure invalid binary could not be loaded. 
 *  5. [BROM_DLL&DA][New] Support NFB download.  
 *  6. [BROM_DLL&DA][New] Support NAND flash format with 3 method, NORMAL, FORCEDLY ERASE and MARK AS BAD BLOCK.  
 *  7. [BROM_DLL&DA][New] Support NAND flash read back with 4 methods, PAGE+ECC, PAGE ONLY, SPARE ONLY and PAGE+SPARE.  
 * Resolution for 140: [BROM_DLL v2.7.1008][New] Support NFB download and many new features. 
 *  
 *    Rev 1.28   Oct 18 2005 13:36:40   mtk00539 
 *  1. [DA][New] New NOR flash device support 
 * 		[SILICON7] S7_SV7E160XT, 
 * 		[SILICON7] S7_SV7E160XB, 
 * 		[SILICON7] S7_SV7E320XT, 
 * 		[SILICON7] S7_SV7E320XB, 
 * 		[SPANSION] S71GL032R3_T, 
 * 		[SPANSION] S71GL032R4_B, 
 * 		[SPANSION] S71GL032R1R2, 
 * 		[TOSHIBA] TV00569002BABD, 
 * 		[TOSHIBA] TV00569003BABD, 
 * 		[TOSHIBA] TV00569002AABD, 
 * 		[TOSHIBA] TV00569003AABD, 
 * Resolution for 137: [BROM_DLL v2.4.1017][New] Enable SID feature and add new flash device supoprt. 
 *  
 *    Rev 1.27   Sep 13 2005 13:23:52   mtk00539 
 *  1. [DA][New] New NOR flash device support [Winbond] W19B320ATB, W19B320ATT. 
 *  2. [DA][BUG FIX] Fix MT6229 read DSP version failure problem. 
 * Resolution for 130: [BROM_DLL v2.4.1016][Enhance] Workaround the 1st time power up failure issue when RTC is empty. 
 *  
 *    Rev 1.26   Jun 15 2005 12:21:42   mtk00539 
 *  1. [DA][New] Support new flash devices TV0057A002AABD and TV0057A002AABD. 
 *  2. [DA][New] Support RENESAS flash with F-WP#(LOW). 
 * Resolution for 118: [BROM_DLL v2.4.1013][New] Support RENESAS flash with F-WP#(LOW). 
 *  
 *    Rev 1.25   May 24 2005 19:54:22   mtk00539 
 *  1. [BROM_DLL][New] Add DA_cmd::CMD_EnableWatchDog() to enable watchdog after download process.  
 *  2. [BROM_DLL][New] Add DL_ResourceProjectIdComparisonSetting() API to enable/disable resource project id comparison.  
 *  3. [BROM_DLL][New] Add callback function in Boot_META() series API to do extra process after BootROM start command passed. 
 *  4. [BROM_DLL][BUG FIX] Fix com port error after using HyperTerminal. 
 *  5. [BROM_DLL][BUG FIX] Fix m_boot_timeout takes no effect in BRom_AutoBoot::BRom_StartCmd(). 
 *  6. [BROM_DLL][Change Behavior] Stop download process while CALLBACK_BEFORE_PROCESS return non-zero value.  
 *  7. [BROM_DLL][Change Behavior] Skip resource table size and content size checking for CustPack project. 
 * Resolution for 115: [BROM_DLL v2.4.1012][New] Support new flash devices and bug fix. 
 *  
 *    Rev 1.24   Mar 29 2005 11:14:38   mtk00539 
 *  1. [BROM_DLL][BUG FIX] ROM_ID_Class::LoadID() should dump only the last 256 bytes data.  
 *  2. [BROM_DLL][New] Add detail H/W error debug log.  
 *  3. [DA][Enhance] Enhance bus test in FlashTest_DA. 
 *  4. [DA][New] Add H/W error detail detection, thus we can distinguish INT_SRAM or EXT_SRAM error. 
 *  5. [DA][New] Add all INTEL W18/W30, L18/L30 non-SCSP flashes support.  
 * Resolution for 107: [BROM_DLL v2.4.1010][New] Enhance bus test in FlashTest_DA, new INTEL flash support and bug fix. 
 *  
 *    Rev 1.23   Feb 16 2005 17:23:56   mtk00539 
 *  1. [DA][BUG FIX] Fix INTEL W18/W30 series flash program fail. this series don't support Buffered-Program method, we can only use WORD program. 
 *  2. [DA][BUG FIX] Fix format %x bug in UART_Printf(). 
 *  3. [DA][BUG FIX] Fix small size EXT_SRAM detection error. Shrink the EXT_SRAM detection unit from 512KB to 128KB in Board_Schematic(). 
 *  4. [DA][New] Extend max sector region to 4 for SPANSION S71AL016D flash. 
 *  5. [DA][New] Add SPANSION S71AL016D T/B and SHARP LRS18C8A flash support.  
 * Resolution for 105: [BROM_DLL v2.4.1009][New] Fix INTEL W18/W30 series bug and add SPANSION S71AL016D and SHARP LRS18C8A flash support. 
 *  
 *    Rev 1.22   Nov 29 2004 15:49:36   mtk00539 
 * [DA][New] Support new flashes [SHARP]LRS18B0 and LRS1863. 
 * Resolution for 99: [BROM_DLL v2.4.1008][New] Support INTEL family flash Buffered-Program method. 
 *  
 *    Rev 1.21   Nov 22 2004 12:23:48   mtk00539 
 *  1. [DA][BUG FIX] Add data verification in status polling during erase or program operation. 
 *  2. [DA][BUG FIX] Fix two dies flash detection fail in INTEL_CheckDevID().  
 *  3. [DA][Change Behavior] When RX_BUFFER_FULL occurs, flush data queued in UART ring buffer til data is less than 512KB. 
 *  4. [DA][New] Support Buffered-Program method for INTEL family flashes. 
 *  5. [DA][New] Support new flashes [SHARP]LRS1828C and [RENESAS]M6MGB64BM34CDG. 
 * Resolution for 99: [BROM_DLL v2.4.1008][New] Support INTEL family flash Buffered-Program method. 
 *  
 *    Rev 1.20   Oct 29 2004 11:42:58   mtk00539 
 *  1. [BROM_DLL][New] Implement auto bbchip and ext_clock detection mechanism. 
 *  2. [BROM_DLL][New] Increase BootROM baudrate as twice times by setup UART_HIGHSPEED_RATE_STEP register. 
 *  3. [BROM_DLL][New] Add new bbchip MT6205_EN and MT6218B_GN. 
 *  4. [BROM_DLL][Enhance] Increase MT6217 and MT6219 EMI driving strength. 
 * Resolution for 92: [BROM_DLL v2.4.1006][BUG FIX] Fix AM49DL3208GT & S71PL032J download fail problem and some enhancement. 
 *  
 *    Rev 1.19   Sep 17 2004 17:01:22   mtk00539 
 * add error code to indicate Board_Schematic() error 
 * Resolution for 90: [BROM_DLL v2.4.1005][BUG FIX] Fix MT6217 download fail problem and some enhancement. 
 *  
 *    Rev 1.18   Sep 14 2004 20:47:38   mtk00539 
 * [SAMSUNG] KAD060300B 
 * Resolution for 90: [BROM_DLL v2.4.1005][BUG FIX] Fix MT6217 download fail problem and some enhancement. 
 *  
 *    Rev 1.17   Sep 14 2004 16:38:26   mtk00539 
 *  1. [BROM_DLL][BUG FIX] Change MT6217 EMI general control register to default value since it's different with MT6218B. 
 *  2. [BROM_DLL][Enhance] Modify serial port enumeration to support FTDI USB-Serial cable. 
 * Resolution for 90: [BROM_DLL v2.4.1005][BUG FIX] Fix MT6217 download fail problem and some enhancement. 
 *  
 *    Rev 1.16   Aug 03 2004 10:42:42   mtk00539 
 *  1. [DA][BUG FIX] Invoke Board_Schematic()(old name is HW_Init()) before FUTL_CheckDevice(). Because FUTL_CheckDevice() must know the absolute address for each bank. 
 *  2. [DA][New] Add 12 new flash devices support  
 * 				[SAMSUNG]K5A3280YT, 
 * 				[TOSHIBA]TH50VPF6782AASB, 
 * 				[TOSHIBA]TH50VPF6783AASB, 
 * 				[TOSHIBA]TV00578002AABD, 
 * 				[TOSHIBA]TV00578003AABD, 
 * 				[Fujitsu]MB84VP24581HK, 
 * 				[INTEL]INTEL_28F640W30_B, 
 * 				[SPANSION]AM49PDL127BH, 
 * 				[SPANSION]AM49PDL129BH, 
 * 				[RENESAS]M6MGD13BW66CDG, 
 * 				[Winbond]W19B322TM, 
 * 				[Winbond]W19B323TM, 
 *  3. [DA][New] Readback check after WORD program is done, so that DA won't have to keep the chksum. 
 *  4. [DA][New] Auto-detect baseband chip type. 
 *  5. [DA][New] Auto-detect external SRAM size. 
 *  6. [DA][New] Merge MT6205B, MT6218B and MT6219 to an all-in-one DA. 
 *  7. [DA][New] Merge flash stress test module. 
 *  8. [DA][New] Modify makefile to build ARM or THUMB code. 
 *  9. [DA][New] Construct a customization kit for customers to add new flash or SOC checking algorithm by themselves. 
 * 10. [DA][Enhance] Split out AM29PDL128G function to improve the performance of general AMD callback functions. 
 * 11. [DA][Enhance] Enhance RX_BUFF_FULL behavior to prevent always retry two times. 
 * Resolution for 83: [BROM_DLL v2.4.1002] Merge all the DAs into all-in-one DA and fix many bugs and enhancement. 
 *  
 *    Rev 1.15   Jul 19 2004 01:39:34   mtk00539 
 *  1. [DA][New] New flash table structure to support AMD and Intel family flash. 
 *  2. [DA][New] New flash ID detection method to tell from single stack flash and daul stack flash with the same id. 
 *  3. [DA][BUG FIX] Fix MB84VD23280FA id detection error. 
 *  4. [DA][BUG FIX] Fix baudrate 921600 download fail under 13MHz external clock, shift SAMPLE_POINT to 0x01 under 13MHz. 
 * Resolution for 81: [BROM_DLL v2.4.1001] Support Intel flash and fix many bugs. 
 *  
 *    Rev 1.14   Jun 16 2004 16:30:08   mtk00539 
 * 1. [DA][New] Replace two expired Toshiba flash with AMD AM29DL322GT and ST M29DW640D in flash device table. 
 * 2. [DA][Enhance] Check MEM_BLOCK range to prevent it exceeds that flash size. 
 * Resolution for 77: [BROM_DLL v2.3.1007][New] Support AMD AM29DL322GT and ST M29DW640D flash. 
 *  
 *    Rev 1.13   May 14 2004 16:59:22   mtk00539 
 * 1. [DA][New] add DA auto selection mechanism, append custom_name at the end of DA. 
 * 2. [DA][New] add FAT auto format mechanism, report flash manufacture id and device code to PC side. 
 * Resolution for 67: [BootRom v2.3.1001][New] add FAT auto format, DA auto selection mechanism and bug fix. 
 *  
 *    Rev 1.12   Mar 02 2004 00:14:42   mtk00539 
 * 1. [DA][Enhance] re-assign DA command id. 
 * 2. [DA][Enhance] add DSP firmware version command. 
 * 3. [DA][BUG FIX] fix unsigned var in while loop that causes infinite loop. 
 * Resolution for 53: [BootRom v2.2.1007][Enhance] resource layout error detection. 
 *  
 *    Rev 1.11   Feb 05 2004 14:13:52   mtk00539 
 * supposupport multiple concatanated bin files download. 
 * Resolution for 46: [BootRom v2.2.1001][New] support multiple concatanated bin files download. 
 *  
 *    Rev 1.10   Feb 04 2004 10:04:36   mtk00539 
 * support AMD AM50DL128CG flash 
 * Resolution for 45: [BootRom v2.1.1011][New] support AMD AM50DL128CG flash. 
 *  
 *    Rev 1.9   Jan 13 2004 10:14:54   mtk00539 
 * [DA][New] support Fujitsu MB84VP24491HK-70 flash. 
 * Resolution for 43: [BootRom v2.1.1010][New] support Fujitsu MB84VP24491HK-70 flash 
 *  
 *    Rev 1.8   Dec 12 2003 14:31:34   mtk00539 
 * support Fujitsu MB84VD22280FE flash by Chicago's request. 
 * Resolution for 40: [BootRom v2.1.1007][New] support Fujitsu MB84VD22280FE flash and etc. 
 *  
 *    Rev 1.7   Nov 12 2003 14:14:44   mtk00539 
 * Add SOC feature 
 * Resolution for 35: [BootRom v2.1.1005][New] Add SOC feature. 
 *  
 *    Rev 1.6   Oct 01 2003 23:34:06   mtk00539 
 * Add packet length in DA_WRITE_CMD and DA_READ_CMD. 
 * Resolution for 28: [BootRom v2.1.1001][New] See the reasons below. 
 *  
 *    Rev 1.5   Sep 25 2003 13:57:52   mtk00539 
 * brom.dll v2.1.1001, please see SCR(28) for more details. 
 * Resolution for 28: [BootRom v2.1.1001][New] See the reasons below. 
 *  
 *    Rev 1.4   Jun 30 2003 19:30:26   mtk00539 
 *  1. [brom.dll][BUG FIXED] Fix DA_MEM_CMD end_addr bug, FlashTool should use (begin_addr+length-1) as end_addr. 
 *  2. [brom.dll][Add Features] Split flashtool function into brom.dll 
 *  3. [brom.dll][Add Features] Add a fake MT6208 bootrom for FlashTool for Pluto version. 
 *  4. [DA][Add Features] Check format range. 
 *  5. [DA][Add Features] Report format percentage. 
 *  6. [DA][Add Features] Support 6208 EVB/CEVB for double flash devices access. 
 *  7. [DA][BUG FIXED] Fix DA pre-format sector bug, it shouldn't format beyond the max size of flash. 
 *  8. [DA][BUG FIXED] Fix DA FlashTool MEM_CMD end_addr bug, FlashTool should use (begin_addr+length-1) as end_addr. 
 *  9. [DA][BUG FIXED] Fix DA AM29DL640D, MB84VD23280FA and TC58FVB64 flash table error. 
 * Resolution for 12: [BootRom v2.2.1001][New Version] Split flashtool function into brom.dll 
 *  
 *    Rev 1.3   Jun 11 2003 21:32:46   mtk00539 
 * 1. Modify BootRom library to support MT6218 
 * 2. Modify DA to support AM29PDL128G flash 
 * Resolution for 9: [FlashTool v2.2.1005][Add Feature] Support MT6218 and new flash AM29PDL128G 
 *  
 *    Rev 1.2   Jun 09 2003 11:47:56   mtk00539 
 * Reason: 
 * 1. If we use DA_SET_REG_CMD to release power key, there is no chance to wait for ACK from DA, because target is shutdown already. 
 *  
 * Solution: 
 * 1. Add DA_FINISH_CMD back, DA will release power key after recieve DA_FINISH_CMD 
 *  
 * Resolution for 8: [FlashTool v2.2.1004][BUG FIX] Add DA_FINISH_CMD back 
 *  
 *    Rev 1.1   Jun 03 2003 22:32:02   mtk00539 
 * 1. extend timeout to 10 sec for large image download in boot_2.cpp 
 * 2. disable unnecesssary debug hot-key. 
 * 3. add shift+ctrl+A for Jensen's DA debug tool kit. 
 * 4. enable build number, and start from 1003. 
 * 5. save baseband chip type, mcu frequency and auto-memory wait state setup flag to ini file. 
 * 6. add DA_SET_REG_CMD command and remove FINISH_CMD, so that release power key could be issued from FlashTool, not hardcoded in DA. 
 * 7. add DA_MCU_FREQ_CMD command, so that we don't have to select different DA while switching frequency. 
 * 8. add new flash MB84VD23280FA-70 for Chicago project. 
 * 9. remove DEVICE_CMD, DA will check flash automatically and report the flash type to PC. 
 * 10. add DA_FORMAT_CMD command to support range format. 
 * 11. display flash type on FlashTool. 
 * 12. merge the DOWNLOAD.H header file, both FlashTool and DA will use the same header file. 
 * 13. modify SPEED_CMD handshake by adding a sync mechanism to detect whether if the speed change is done by both sides. 
 * Resolution for 7: [FlashTool v2.2.1003][AddFeature] Enhanced for KLM and Chicago project. 
 *  
 *    Rev 1.0   May 20 2003 16:38:38   admin 
 * Initial revision. 
 *  
 *    Rev 1.1   16 May 2002 09:18:16   mtk00361 
 * 0515 updated 
 *  
 *    Rev 1.0   Apr 03 2002 22:38:50   mtk00288 
 * Initial revision. 
 * 
 *******************************************************************************/ 
#ifndef _DOWNLOAD_H_ 
#define _DOWNLOAD_H_ 
 
/* DA Version */ 
#define DA_MAJOR_VER			0x02 
#define DA_MINOR_VER			0x09 
 
/* Max Number of Load Sections */ 
#define MAX_LOAD_SECTIONS		10 
 
// Max Die Number of MCP  
#define MAX_DIE_IN_MCP			2 
 
/* RETURN VALUE */ 
#define SOC_OK					0xC1 
#define SOC_FAIL				0xCF 
#define SYNC_CHAR				0xc0 
#define CONT_CHAR				0x69 
#define STOP_CHAR				0x96 
#define ACK						0x5a 
#define NACK					0xa5 
#define UNKNOWN_CMD				0xbb 
 
/* FLASH OPERATION STATUS */ 
typedef enum { 
	 S_DONE = 0 
	,S_PGM_FAILED 
	,S_ERASE_FAILED 
	,S_TIMEOUT 
	,S_IN_PROGRESS 
	,S_CMD_ERR 
	,S_BLOCK_LOCKED_ERR 
	,S_BLOCK_UNSTABLE 
	,S_VPP_RANGE_ERR 
	,S_INVALID_BEGIN_ADDR 
	,S_INVALID_RANGE 
	,S_PGM_AT_ODD_ADDR 
	,S_PGM_WITH_ODD_LENGTH 
	,S_BUFPGM_NO_SUPPORT 
	,S_UNKNOWN_ERR 
	,S_BAD_BLOCK 
	,S_ECC_1BIT_CORRECT 
	,S_ECC_2BITS_ERR 
	,S_SPARE_CHKSUM_ERR 
	,S_HW_COPYBACK_ERR 
	,S_INVALID_PAGE_INDEX 
	,S_NFI_NOT_SUPPORT 
	,S_NFI_CS1_NOT_SUPPORT 
	,S_NFI_16BITS_IO_NOT_SUPPORT 
	,S_NO_GOOD_BLOCK_FOUND 
	,S_SETUP_PLL_ERR 
	,S_MOBILE_RAM_NOT_SUPPORT 
	,S_RAM_FLOARTING 
	,S_RAM_UNACCESSABLE 
	,S_RAM_ERROR 
	,S_DEVICE_NOT_FOUND 
	,S_REACH_END_ADDR 
	,S_BLOADER_IS_TOO_LARGE 
	,S_SIBLEY_REWRITE_OBJ_MODE_REGION 
	,S_SIBLEY_WRITE_B_HALF_IN_CTRL_MODE_REGION 
	,S_SIBLEY_ILLEGAL_CMD 
	,S_SIBLEY_PGM_AT_THE_SAME_REGIONS 
	,STATUS_END 
} STATUS_E; 
 
/* COMMANDS */ 
#define DA_SPEED_CMD				0xD2 
#define DA_MEM_CMD					0xD3 
#define DA_FORMAT_CMD				0xD4 
#define DA_WRITE_CMD				0xD5 
#define DA_READ_CMD					0xD6 
#define DA_WRITE_REG16_CMD			0xD7 
#define DA_READ_REG16_CMD			0xD8 
#define DA_FINISH_CMD				0xD9 
#define DA_GET_DSP_VER_CMD			0xDA 
#define DA_ENABLE_WATCHDOG_CMD		0xDB 
#define DA_NFB_WRITE_BLOADER_CMD	0xDC 
#define DA_NAND_IMAGE_LIST_CMD		0xDD 
#define DA_NFB_WRITE_IMAGE_CMD		0xDE 
#define DA_NAND_READPAGE_CMD		0xDF 
 
/* SPEED_PARA */ 
typedef enum { 
	UART_BAUD_921600	= 0x01, 
	UART_BAUD_460800	= 0x02, 
	UART_BAUD_230400	= 0x03, 
	UART_BAUD_115200	= 0x04, 
	UART_BAUD_57600		= 0x05, 
	UART_BAUD_38400		= 0x06, 
	UART_BAUD_19200		= 0x07, 
	UART_BAUD_9600		= 0x08, 
	UART_BAUD_4800		= 0x09, 
	UART_BAUD_2400		= 0x0a, 
	UART_BAUD_1200		= 0x0b, 
	UART_BAUD_300		= 0x0c, 
	UART_BAUD_110		= 0x0d 
}UART_BAUDRATE; 
 
typedef enum 
{ 
	TIMEOUT_DATA = 0, 
	CKSUM_ERROR, 
	RX_BUFFER_FULL, 
	TIMEOUT_CKSUM_LSB, 
	TIMEOUT_CKSUM_MSB, 
	ERASE_TIMEOUT, 
	PROGRAM_TIMEOUT, 
	RECOVERY_BUFFER_FULL, 
	SB_AREA_ERROR, 
	UNKNOWN_ERROR 
}eRX_error; 
 
typedef enum { 
	 CS0 = 0 
	,CS1 
	,CS2 
	,CS3 
	,CS4 
	,CS5 
	,CS6 
	,CS7 
	,CS_WITH_DECODER 
	,MAX_CS = CS_WITH_DECODER 
	,HW_CHIP_SELECT_END 
} HW_ChipSelect_E; 
 
typedef enum { 
	 HW_STORAGE_NOR = 0 
	,HW_STORAGE_NAND 
	,HW_STORAGE_TYPE_END 
} HW_StorageType_E; 
 
typedef enum { 
	 HW_RAM_UNKNOWN = 0 
	,HW_RAM_SRAM 
	,HW_RAM_DRAM 
	,HW_RAM_TYPE_END 
} HW_RAMType_E; 
 
typedef enum { 
	 NUTL_READ_PAGE_SPARE = 0 
	,NUTL_READ_PAGE_ONLY 
	,NUTL_READ_SPARE_ONLY 
	,NUTL_READ_PAGE_WITH_ECC 
	,NUTL_VERIFY_AFTER_PROGRAM 
	,NUTL_READ_FLAG_END 
} NUTL_ReadFlag_E; 
 
typedef enum { 
	 NUTL_ERASE = 0 
	,NUTL_FORCE_ERASE 
	,NUTL_MARK_BAD_BLOCK 
	,NUTL_ERASE_FLAG_END 
} NUTL_EraseFlag_E; 
 
// NOR flash device id  
typedef enum { 
	 NOR_AM29DL323D = 0 
	,NOR_AM29DL640D 
	,NOR_ST_M29DW640D 
	,NOR_AM29DL322GT 
	,NOR_MB84VD23280FA 
	,NOR_AM29PDL128G 
	,NOR_MB84VD22280FE 
	,NOR_MB84VP24491HK 
	,NOR_AM50DL128CG 
	,NOR_AM49DL3208GB 
	,NOR_ST_M74DW66500B 
	,NOR_INTEL_28F128L30_B 
	,NOR_K5A3280YT 
	,NOR_TH50VPF6782AASB 
	,NOR_TH50VPF6783AASB 
	,NOR_TV00578002AABD 
	,NOR_TV00578003AABD 
	,NOR_MB84VP24581HK 
	,NOR_INTEL_28F640W30_B 
	,NOR_AM49PDL127BH 
	,NOR_AM49PDL129BH 
	,NOR_M6MGD13BW66CDG 
	,NOR_W19B322TM 
	,NOR_W19B323TM 
	,NOR_KAD060300B 
	,NOR_K5J6316CTM 
	,NOR_TH50VPF5682CDSB 
	,NOR_TH50VPF5683CDSB 
	,NOR_IS75V16F128GS32 
	,NOR_M6MGT64BM34CDG 
	,NOR_ST_M30L0T7000T0 
	,NOR_ST_M30L0T7000B0 
	,NOR_SHARP_LRS1862 
	,NOR_SHARP_LRS1806A 
	,NOR_AM49DL3208GT 
	,NOR_S29PL032J 
	,NOR_SHARP_LRS1828C 
	,NOR_M6MGB64BM34CDG 
	,NOR_SHARP_LRS18B0 
	,NOR_SHARP_LRS1863 
	,NOR_S71AL016D_T 
	,NOR_S71AL016D_B 
	,NOR_SHARP_LRS18C8A 
	,NOR_INTEL_28F640L18_T 
	,NOR_INTEL_28F128L18_T 
	,NOR_INTEL_28F256L18_T 
	,NOR_INTEL_28F640L18_B 
	,NOR_INTEL_28F128L18_B 
	,NOR_INTEL_28F256L18_B 
	,NOR_INTEL_28F640L30_T 
	,NOR_INTEL_28F128L30_T 
	,NOR_INTEL_28F256L30_T 
	,NOR_INTEL_28F640L30_B 
	,NOR_INTEL_28F256L30_B 
	,NOR_INTEL_28F320W30_T 
	,NOR_INTEL_28F320W30_B 
	,NOR_INTEL_28F640W30_T 
	,NOR_INTEL_28F128W30_T 
	,NOR_INTEL_28F128W30_B 
	,NOR_INTEL_28F320W18_T 
	,NOR_INTEL_28F320W18_B 
	,NOR_INTEL_28F640W18_T 
	,NOR_INTEL_28F640W18_B 
	,NOR_INTEL_28F128W18_T 
	,NOR_INTEL_28F128W18_B 
	,NOR_M6MGD15BM34CDG 
	,NOR_S71PL254J 
	,NOR_TV0057A002AABD 
	,NOR_TV0057A003AABD 
	,NOR_W19B320ATB 
	,NOR_W19B320ATT 
	,NOR_S7_SV7E160XT 
	,NOR_S7_SV7E160XB 
	,NOR_S7_SV7E320XT 
	,NOR_S7_SV7E320XB 
	,NOR_S71GL032R3_T 
	,NOR_S71GL032R4_B 
	,NOR_S71GL032R1R2 
	,NOR_TV00569002BABD 
	,NOR_TV00569003BABD 
	,NOR_TV00569002AABD 
	,NOR_TV00569003AABD 
	,NOR_INTEL_38F1010C0ZBL0 
	,NOR_INTEL_28F1602C3BD70 
	,NOR_TY0068B012APGG 
	,NOR_TY0068B013APGG 
	,NOR_S71PL127N 
	,NOR_S7_SV6D2832UTA 
	,NOR_S7_SV6D2832UBA 
	,NOR_S7_SV6C2832UTA 
	,NOR_S7_SV6C2832UBA 
	,NOR_SHARP_LH28F16 
	,NOR_TV00578002DABD 
	,NOR_TV00578003DABD 
	,NOR_S71PL256N 
	,NOR_S71PL129N 
	,NOR_INTEL_PF48F50xxM0x0xx 
	,NOR_INTEL_PF48F50xxM0x1xx 
	,NOR_INTEL_PF48F40xxM0x0xx 
	,NOR_INTEL_PF48F40xxM0x1xx 
	,NOR_SST34HF16x1    // 1=Bottom 
	,NOR_SST34HF32x4    // 4=Top 
	,NOR_SHARP_LRS18BK 
	,NOR_INTEL_28F3204C3TD70 
	,NOR_S71WS128NB0BFWAN3 
	,NOR_ST_M58PPR256J 
	,NOR_ST_M58PPR512J 
	,NOR_SST32HF3241C 
	,NOR_S71WS512PD0HF3HR 
	,NOR_S29NS064N 
	,NOR_S29NS128N 
	,NOR_S29NS256N 
	     
	,NOR_LAST 
	,NOR_UNKNOWN = 0xFFFF		// Unknown Device  
} NOR_DeviceID_E; 
 
// NAND flash device id  
typedef enum { 
	 NAND_K9F5608Q0C = 0 
	,NAND_K9F5608X0C 
	,NAND_K9F5616Q0C 
	,NAND_K9F5616X0C 
	,NAND_K9K1208X0C 
	,NAND_K9K1G08X0A 
	,NAND_K9F1G08Q0M 
	,NAND_K9F1G08X0M 
	,NAND_K9F1G16Q0M 
	,NAND_K9F1G16X0M 
	,NAND_K9F2G08X0M 
	,NAND_K9F2G16X0M 
	,NAND_K9K4G08Q0M 
	,NAND_K9K4G08U0M 
	,NAND_K9K4G16Q0M 
	,NAND_K9K4G16U0M 
	,NAND_TC58DVM82A1FT 
	,NAND_TC58DVM92A1FT 
	,NAND_TC58DVG02A1FT 
	,NAND_TC58NVG0S3AFT 
	,NAND_TH58NVG1S3AFT 
	,NAND_HY27XS08561M 
	,NAND_HY27XS08121M 
	,NAND_HY27XA081G1M 
	,NAND_HY27XA161G1M 
	,NAND_ST128W3A 
	,NAND_ST128W4A 
	,NAND_ST256W3A 
	,NAND_ST256W4A 
	,NAND_ST512W3A 
	,NAND_ST512W4A 
	,NAND_ST01GW3A 
	,NAND_ST01GW4A 
	,NAND_ST512R3B 
	,NAND_ST512W3B 
	,NAND_ST512R4B 
	,NAND_ST512W4B 
	,NAND_ST01GR3B 
	,NAND_ST01GW3B 
	,NAND_ST01GR4B 
	,NAND_ST01GW4B 
	,NAND_ST02GR3B 
	,NAND_ST02GW3B 
	,NAND_ST02GR4B 
	,NAND_ST02GW4B 
	,NAND_ST04GR3B 
	,NAND_ST04GW3B 
	,NAND_ST04GR4B 
	,NAND_ST04GW4B 
	,NAND_ST08GR3B 
	,NAND_ST08GW3B 
	,NAND_ST08GR4B 
	,NAND_ST08GW4B 
	,NAND_K9F2808U0C 
	,NAND_K9K8G08U0M 
	,NAND_TH58NVG2D4BFT 
	,NAND_HY27UF081G2M 
	,NAND_TH58NVG1S8BFT 
	,NAND_MT29F2G08AAC 
	,NAND_MT29F4G08BAB 
	,NAND_SUPERAND51208 
	,NAND_SUPERAND51216 
	,NAND_HYF33DS51280 
	,NAND_HYF33DS1G80 
	,NAND_HYF33DS1G16 
	,NAND_TC58NWM9S3B 
	,NAND_LAST 
	,NAND_UNKNOWN = 0xFFFF		// Unknown Device  
} NAND_DeviceID_E; 
 
#endif