📄 brom.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) 2003
*
******************************************************************************/
/*******************************************************************************
* Filename:
* ---------
* brom.h
*
* Project:
* --------
* BootRom Library
*
* Description:
* ------------
* Exported C interface APIs for BootRom library.
*
* Author:
* -------
* Amos Hsu (mtk00539)
*
*==============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* $Revision: 1.21 $
* $Modtime: Dec 06 2005 15:05:36 $
* $Log: //mtkvs01/vmdata/flash_tool/archives/BootRom/brom.h-arc $
*
* Jan 2 2007 mtk01413
* [STP100001195] FlashTool v3.1.02 release
* New features:
* 1. [BROM_DLL/DA] Support MT6223 download.
* 2. [BROM_DLL/DA] Support MT6268T download.
*
* Sep 27 2006 mtk00539
* [STP100001145] FlashTool v3.1.01 release
*
*
* Aug 16 2006 mtk00539
* [STP100001057] FlashTool v3.1.00 release
* Add GetBromDLLInfo().
*
* Aug 14 2006 mtk00539
* [STP100001057] FlashTool v3.1.00 release
*
*
* Jul 21 2006 mtk01413
* [STP100001021] FlashTool v2.9.1002 release
* 1. [BROM_DLL] Fix DA download error on MT6205/MT6205B.
*
* Rev 1.21 Dec 29 2005 10:42:02 mtk00539
* 1. [BROM_DLL] Support new baseband chip MT6226M.
* Resolution for 156: [FlashTool v2.7.1013][BUG FIX] Fix BootROM start command failure while manually selecting NMT6226 or MT6227 baseband chip.
*
* Rev 1.20 Sep 13 2005 13:21:58 mtk00539
* 1. [BROM_DLL][Enhance] Workaround the 1st time power up failure issue when RTC is empty.
* 2. [BROM_DLL][Enhance] Padding download bin file length to EVEN number.
* 3. [BROM_DLL][New] New baseband chip support, MT6226, MT6227(0x8A01), MT6228(0x8A01).
* Resolution for 130: [BROM_DLL v2.4.1016][Enhance] Workaround the 1st time power up failure issue when RTC is empty.
*
* Rev 1.19 Jul 24 2005 21:37:50 mtk00539
* 1. Support MT6228 NFB META mode.
* Resolution for 121: [BROM_DLL v2.4.1014][New] Support MT6227 and MT6228 NFB META mode.
*
* Rev 1.18 May 24 2005 19:54:20 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.17 Nov 22 2004 14:27:54 mtk00539
* 1. [BROM_DLL][BUG FIX] Add baudrate sync procedure for BootROM stage baudrate change for Prolific convertor.
* 2. [BROM_DLL][BUG FIX] Fix ReadData() delay time too long problem in DA_cmd::CMD_ChangeUartSpeed() while target is running at 13MHz.
* 3. [BROM_DLL][BUG FIX] DO NOT use while loop in reading BootROM ack in BRom_AutoBoot::BRom_StartCmd(), it will cause BootROM timeout.
* 4. [BROM_DLL][Enhance] Extend the read timeout waiting time in DA_cmd::CMD_WriteData, because SHARP flash program time is slow.
* 5. [BROM_DLL][Enhance] Add m_speedup_brom_baudrate flag to enable/disable speed-up baudrate in BootROM stage.
* Resolution for 99: [BROM_DLL v2.4.1008][New] Support INTEL family flash Buffered-Program method.
*
* Rev 1.16 Nov 05 2004 10:35:08 mtk00539
* 1. [BROM_DLL][New] Implement S/W compatible mechanism for MT6218B_FN and MT6218B_GN.
* 2. [BROM_DLL][Enhance] Read property to check if it was RS232 or Modem from COM1 to COM3.
* 3. [BROM_DLL][Change Behavior] Unknown bbchip won't allow to download once check ECO version flag is enabled.
* Resolution for 96: [BROM_DLL v2.4.1007][New] Implement S/W compatible mechanism for MT6218B_FN and MT6218B_GN.
*
* Rev 1.15 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.14 Jul 19 2004 01:56:36 mtk00539
* 1. [BROM_DLL][BUG FIX] When bbchip_type is inconsistent with rom bbchip info, do not use rom bbchip info to compare with target bbchip id.
* 2. [BROM_DLL][BUG FIX] Fix baudrate 921600 download fail under 13MHz external clock.
* 1. Add Sleep(0) to force context switch to flush UART TX data in BRom_Base::WriteData() and DA_cmd::WriteData().
* 2. After target side baudrate changed command was issued, add Sleep() to delay sending SYNC_CHAR.
* This will prevent the interference of target side UART state machine during target side baudrate changed.
* 3. Purge PC side and target side UART TX & RX FIFO after baudrate changed.
* 4. Use while(1) loop to avoid flash readback checksum timeout.
* 5. Add baudrate full char sync mechanism to test if baudrate is stable.
* 3. [BROM_DLL][CHANGE] Change GetJumpTableInfoFromBuf() to fit JumpTable definition changed in Maui.SW system.
* 4. [BROM_DLL][Enhance] Remove unnecessary functions MT6205_MEM_config and MT6205B_MEM_config.
* 5. [BROM_DLL][Enhance] Add MT6218B and MT6219 EMI general control register setting in BootROM stage.
* 6. [BROM_DLL][Enhance] Change EMI setting to 32 bits.
* Resolution for 81: [BROM_DLL v2.4.1001] Support Intel flash and fix many bugs.
*
* Rev 1.13 May 26 2004 21:23:58 mtk00539
* [New] Add callback function in BootROM stage. So that users could have chance to issue other BootROM command after start cmd is passed, or do whatever they want otherwise.
* Resolution for 73: [BROM_DLL v2.3.1005][New] Add callback function in BootROM stage.
*
* Rev 1.12 May 21 2004 15:44:38 mtk00539
* 1. [brom.dll][New] add J2ME_ROM resource for w04.21 load.
* 2. [brom.dll][New] add MT6217 BootROM.
* 3. [brom.dll][New] add Brom_DownloadData API.
* 4. [brom.dll][New] remove Brom_Verify relative APIs.
* 5. [brom.dll][Enhance] move region overlap checking from Rom_Load() to IsReady() for more convenience.
* Resolution for 70: [BROM_DLL v2.3.1003][New] add J2ME_ROM resource for w04.21 load.
*
* Rev 1.11 May 17 2004 12:55:20 mtk00539
* [New] keep old interfaces of Boot_META, Boot_FlashTool & Brom_Verify
* Resolution for 69: [BootRom v2.3.1002][BUG FIX] fix RB_HANDLE deadlock.
*
* Rev 1.10 May 14 2004 17:01:26 mtk00539
* 1. [brom.dll][BUG FIX] fix DA_cmd::CMD_WriteData() buffer overrun problem.
* 2. [brom.dll][BUG FIX] remove DA_HANDLE & DL_HANDLE rwlock_writer_sentry for multi-thread download.
* 3. [brom.dll][BUG FIX] fix download address remap problem for Multi-Bin download on MT6218B series projects.
* 4. [brom.dll][Enhance] for the unknown bbchip_name just bypass ECO checking, don't stop process.
* 5. [brom.dll][New] add FAT auto format mechanism, parse the embedded FAT range info from the end of the ROM file.
* 6. [brom.dll][New] add DA auto selection mechanism, parse the embedded custom_bane info from the end of the DA file.
* 7. [brom.dll][New] add _ByhCOM interface to let users to control com port handle.
* 8. [brom.dll][New] add BootROM start command retry mechanism to prevent cable TX/RX cross over.
* 9. [brom.dll][New] add MT6219_AV, MT6219_BV and MT6218B_FN support.
* 10. [DA][New] add DA auto selection mechanism, append custom_name at the end of DA.
* 11. [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.9 Mar 18 2004 23:06:40 mtk00539
* 1. [brom.dll][Enhance] only bbchip after MT6218B has to check firmware version.
* 2. [brom.dll][BUG FIX] change func() to func(void) to fix header file compatibility for LabView.
* 3. [brom.dll][BUG FIX] CompareTargetBBChipHWID() should return error and skip comparison when target doesn't respond.
* Resolution for 61: [BootRom v2.2.1012][BUG FIX] fix CompareTargetBBChipHWID() error.
*
* Rev 1.8 Mar 09 2004 21:00:50 mtk00539
* [Enhance] check BBChip H/W version in Boot_META and Boot_FlashTool.
* Resolution for 57: [BootRom v2.2.1010][Enhance] check BBChip H/W version in Boot_META and Boot_FlashTool.
*
* Rev 1.7 Mar 02 2004 00:19:04 mtk00539
* 1. [brom.dll][Enhance] add resource and jump table consistency detection.
* 2. [brom.dll][Enhance] read back target's jump table layout and compare before download.
* 3. [brom.dll][Enhance] automatically load all the resource files.
* 4. [brom.dll][Enhance] add target bbchip id detection.
* 5. [brom.dll][Enhance] add ini module.
* 6. [brom.dll][Enhance] add MT6219 support.
* Resolution for 53: [BootRom v2.2.1007][Enhance] resource layout error detection.
*
* Rev 1.6 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.5 Jul 25 2003 15:50:28 mtk00539
* Reason:
* 1. SA reports read(10sec)/write(3sec) timeouts are too long. Because DA_cmd::WriteData() and DA_cmd::ReadData() will re-try one time, so the actual timeouts are read(10x2sec)/write(3x2sec). So I decide to reduce timeouts to read(5sec)/write(1.5sec).
*
* 2. Add specific debug log at the end of FlashDownload(), FlashReadback() and FlashFormat(). In this way SA can query whether if the function successfully executed by this signature.
*
* 3. Export debug log clear function, let users clear debug log whenever they want.
* Resolution for 17: [BootRom v2.0.1006][Add Features] shorten read/write timeout and export debug log clear function.
*
* Rev 1.4 Jun 30 2003 19:24:50 mtk00539
* 1. [brom.dll][Add Features] Split flashtool function into brom.dll
* 2. [brom.dll][Add Features] Add a fake MT6208 bootrom for FlashTool for Pluto version.
* 3. [DA][Add Features] Check format range.
* 4. [DA][Add Features] Report format percentage.
* 5. [DA][Add Features] Support 6208 EVB/CEVB for double flash devices access.
* 6. [DA][BUG FIXED] Fix DA pre-format sector bug, it shouldn't format beyond the max size of flash.
* 7. [DA][BUG FIXED] Fix DA FlashTool MEM_CMD end_addr bug, FlashTool should use (begin_addr+length-1) as end_addr.
* 8. [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.2 May 22 2003 17:27:48 mtk00539
* add bootstop flag
* Resolution for 6: [FlashTool v2.2][AddFeature] Support 6205/6205B at 13MHz, 26MHz and 52MHz.
*
* Rev 1.1 May 20 2003 18:05:46 mtk00539
* add copyright
* Resolution for 6: [FlashTool v2.2][AddFeature] Support 6205/6205B at 13MHz, 26MHz and 52MHz.
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/
#ifndef _BROM_H_
#define _BROM_H_
#include <windows.h>
#include "flashtool_handle.h"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -