⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.h

📁 MTK 最新的flashtool工具的源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/*****************************************************************************
*  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) 2002
*
*****************************************************************************/

/*******************************************************************************
* Filename:
* ---------
*  main.h
*
* Project:
* --------
*  Flash tool set
*
* Description:
* ------------
*  main window header file 
*
* Author:
* -------
*  FZ Hsu (mtk00303)
*
*==============================================================================
*           HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* $Revision:   1.35  $
* $Modtime:   Dec 28 2005 22:13:02  $
* $Log:   //mtkvs01/vmdata/flash_tool/archives/main.h-arc  $
 *
 * May 18 2007 mtk01413
 * [STP100001402] FlashTool v3.1.05 release
 * 
 *
 * Mar 12 2007 mtk01413
 * [STP100001329] FlashTool v3.1.04 release
 * Enhancements:
 *  1. [FlashTool] Show Parameter List View automatically when loading secure-on MAUI
 *  2. [FlashTool] Move "Paremeter"/ "File Management"/ "ROM Writer" under "Window" menu item
 *  3. [FlashTool] Show DA version and Build Date in help dialog
 * 
 *
 * Sep 27 2006 mtk00539
 * [STP100001145] FlashTool v3.1.01 release
 * 
 *
 * Aug 13 2006 mtk01413
 * [STP100001057] FlashTool v3.1.00 release
 * 
 *
 * Jul 21 2006 mtk01413
 * [STP100001021] FlashTool v2.9.1002 release
 * 
 *
 * 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
 * [STP100000879] FlashTool v2.8.1001 release
 *  1. [FlashTool][NEW] Support 6229 Download, add m_emi_gen_c in DRAM setting
 *
 * Feb 23 2006 mtk00539
 * [STP100000625] FlashTool v2.7.1016
 * 
 * 
 *    Rev 1.35   Dec 29 2005 10:57:26   mtk00539
 *  1. [FlashTool] Add download history feature.
 * Resolution for 156: [FlashTool v2.7.1013][BUG FIX] Fix BootROM start command failure while manually selecting NMT6226 or MT6227 baseband chip.
 * 
 *    Rev 1.34   Nov 19 2005 00:58:06   mtk00539
 *  1. [FlashTool][New] Adapt new BROM_DLL&DA v2.7.1011. 
 * Resolution for 150: [FlashTool v2.7.1011][New] Add UID Secure Booting feature and Bug Fix.
 * 
 *    Rev 1.33   Oct 19 2005 14:47:26   mtk00539
 *  1. [FlashTool][New] Adapt new BROM_DLL&DA v2.7.1008. 
 * Resolution for 141: [FlashTool v2.7.1008][New] Support NFB download and many new features.
 * 
 *    Rev 1.32   Sep 13 2005 13:38:16   mtk00539
 *  1. [FlashTool][New] Adapt new BROM_DLL&DA v2.4.1016. 
 * Resolution for 131: [FlashTool v2.6.1016][Enhance] Workaround the 1st time power up failure issue when RTC is empty.
 * 
 *    Rev 1.31   Jul 25 2005 14:56:44   mtk00539
 *  1. [FlashTool][New] Support MT6229.
 * Resolution for 125: [FlashTool v2.6.1015][New] Support MT6229.
 * 
 *    Rev 1.30   Jul 22 2005 20:48:30   mtk00539
 *  1. [FlashTool][New] Support MT6227.
 * Resolution for 122: [FlashTool v2.6.1014][New] Support MT6227.
 * 
 *    Rev 1.29   May 24 2005 20:03:40   mtk00539
 *  1. [FlashTool][New] Reset FAT to factory default setting. 
 *  2. [FlashTool][New] Option to enable/disable resource project id comparison. 
 * Resolution for 116: [FlashTool v2.6.1012][New] Reset FAT to factory default setting.
 * 
 *    Rev 1.28   Apr 12 2005 22:14:00   mtk00539
 *  1. [FlashTool][New] Support MT6228 baseband chip.
 * Resolution for 110: [FlashTool v2.6.1011][New] Support MT6228 baseband chip.
 * 
 *    Rev 1.27   Feb 16 2005 17:27:44   mtk00539
 *  1. [FlashTool][New] Adapt new BROM_DLL&DA v2.4.1009 to support SPANSION S71AL016D and SHARP LRS18C8A flash. 
 *  2. [FlashTool][Enhance] Allow to setup EMI setting in TestMode.
 *  3. [FlashTool][Enhance] Keep TestMode unless you disable it. In order to allow users to do test continuously.
 *  4. [FlashTool][Enhance] Add CTRL+S hot-key to save TestMode log into file.
 * Resolution for 106: [FlashTool v2.6.1009][New] Adapt new BROM_DLL&DA v2.4.1009 to support SPANSION S71AL016D and SHARP LRS18C8A flash.
 * 
 *    Rev 1.26   Nov 22 2004 14:30:12   mtk00539
 *  1. [FlashTool][New] Adapt new BROM_DLL&DA v2.4.1008 to enable/disable speed-up baudrate in BootROM stage.
 * Resolution for 100: [FlashTool v2.6.1008][New] Adapt new BROM_DLL&DA v2.4.1008 to enable/disable speed-up baudrate in BootROM stage.
 * 
 *    Rev 1.25   Oct 29 2004 11:49:22   mtk00539
 *  1. [FlashTool][New] Adapt new BROM_DLL&DA v2.4.1006 to fix AM49DL3208GT & S71PL032J download fail problem and some enhancement.
 *  2. [FlashTool][New] Add auto-detect base band chip type flag.
 * Resolution for 1: META MAUI v1.0
 * 
 *    Rev 1.24   Sep 03 2004 19:54:48   mtk00539
 * [FlashTool][New] Adapt new BROM_DLL&DA v2.4.1004 for MT6217 support.
 * Resolution for 89: [FlashTool v2.6.1004][New] Adapt new BROM_DLL&DA v2.4.1004 for MT6217 support.
 * 
 *    Rev 1.23   Jul 19 2004 11:13:30   mtk00539
 * add baudrate full sync count option
 * Resolution for 82: [FlashTool v2.6.1001][New] Adapt with BROM_DLL v2.4.1001 and many enhancement.
 * 
 *    Rev 1.22   Jul 19 2004 02:10:56   mtk00539
 *  1. [FlashTool][New] Adapt new BROM_DLL v2.4.1001 for many features and bug fix.
 *  2. [FlashTool][Enhance] Export COM port read/write timeout setting.
 *  3. [FlashTool][Enhance] Change EMI setting to 32 bits.
 * Resolution for 82: [FlashTool v2.6.1001][New] Adapt with BROM_DLL v2.4.1001 and many enhancement.
 * 
 *    Rev 1.21   Jun 16 2004 16:38:34   mtk00539
 *  1. [FlashTool][Enhance] Re-org format option panel to prevent users confused.
 *  2. [FlashTool][Enhance] Do not close OK window when operation is done.
 * Resolution for 78: [FlashTool v2.5.1013][Enhance] Re-org format option panel to prevent users confused.
 * 
 *    Rev 1.20   Jun 03 2004 11:55:34   mtk00539
 * when users select new scatter file, set dialog initial dir to scatter file base dir.
 * Resolution for 76: [FlashTool v2.5.1012][BUG FIX] Fix bug in FAT range info import.
 * 
 *    Rev 1.19   May 26 2004 21:54:58   mtk00539
 * [FlashTool][New] Using BROM_DLL_v2.3.1005 new feature to add BootROM stage callback function to disable vibrator to avoid MT6218B series board layout issue.
 * Resolution for 74: [FlashTool v2.5.1011][New] Add new flag to pull down GPIO17.
 * 
 *    Rev 1.18   May 21 2004 15:54:54   mtk00539
 *  1. [FlashTool][BUF FIX] fix incorrect error message of resource detection.
 * Resolution for 71: [FlashTool v2.5.1010][BUF FIX] fix incorrect error message of resource detection.
 * 
 *    Rev 1.17   May 14 2004 17:04:22   mtk00539
 *  1. [FlashTool][New] add CTRL+ALT+O hot-key to toggle Advanced Option Mode.
 *  2. [FlashTool][New] add FAT auto format mechanism.
 *  3. [FlashTool][New] add DA auto selection mechanism.
 *  4. [FlashTool][New] add STOP button.
 *  5. [FlashTool][Enhance] start timer when BootROM start cmd pass.
 *  6. [FlashTool][New] display flash info in status bar hint.
 *  7. [FlashTool][New] display format range info in format progress bar hint.
 *  8. [FlashTool][New] record the DA, Scatter and DL path separately.
 * Resolution for 68: [FlashTool v2.5.1009][New] add FAT auto format, DA auto selection mechanism and lots of enhancements.
 * 
 *    Rev 1.16   Apr 20 2004 15:58:30   mtk00539
 * [Enhance] hide seldom used option, it an be turn on again by Advance Mode hot-key CTRL+ALT+O.
 * Resolution for 65: [FlashTool v2.5.1008][New] add baseband chip ECO revision checking flag for FlashDownload.
 * 
 *    Rev 1.15   Mar 29 2004 14:20:16   mtk00539
 * [New] add baseband chip ECO revision checking flag for FlashDownload.
 * Resolution for 65: [FlashTool v2.5.1008][New] add baseband chip ECO revision checking flag for FlashDownload.
 * 
 *    Rev 1.14   Mar 02 2004 00:28:18   mtk00539
 *  1. [FlashTool][Enhance] automatically select bbchip according to rom bbchip id..
 *  2. [FlashTool][Enhance] automatically load all the resource files.
 *  3. [FlashTool][Enhance] display resource and jump table information.
 *  4. [FlashTool][New] add MT6219 support.
 * Resolution for 54: [FlashTool v2.5.1006][Enhance] bbchip id detection and resource autoload.
 * 
 *    Rev 1.13   Feb 11 2004 17:54:56   mtk00539
 * [Enhance] support selectable download
 * Resolution for 52: [FlashTool v2.5.1002][Enhance] selectable download.
 * 
 *    Rev 1.12   Feb 05 2004 13:40:36   mtk00539
 * adapt to BROM DLL v2.2.1001
 * Resolution for 47: [FlashTool v2.5.1001][New] support multiple concatanated bin files download.
 * 
 *    Rev 1.11   Oct 29 2003 17:39:12   mtk00539
 * modify packet length
 * 
 *    Rev 1.10   Oct 01 2003 23:38:18   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.9   Sep 25 2003 14:03:28   mtk00539
 * adapt brom.dll v2.1.1001, please see SCR(29) for more details.
 * Resolution for 29: [FlashTool v2.4.1001][New] See the reasons below.
 * 
 *    Rev 1.8   Jun 30 2003 19:19:36   mtk00539
 *  1. [FlashTool][Add Features] Split flashtool function into brom.dll
 *  2. [FlashTool][Add Features] Format function: users can format any range you want without downloading procedure.
 *  3. [FlashTool][Add Features] Report format percentage.
 *  4. [FlashTool][Add Features] Check format range.
 *  5. [FlashTool][Add Features] Merge FlashTool for Pluto version.
 *  6. [FlashTool][Add Features] Runtime debug log: you can press (CTRL+ALT+T) to enable/disable debug log whenever you want.
 *  7. [FlashTool][Add Features] Forcedly Stop hot-key: you can forcedly stop FlashTool by pressing CTRL+Z.
 *  8. [FlashTool][BUG FIXED] Fix FlashTool MEM_CMD end_addr bug, FlashTool should use (begin_addr+length-1) as end_addr.
 * Resolution for 11: [FlashTool v2.3.1001][New Version] Split flashtool function into brom.dll
 * 
 *    Rev 1.7   Jun 11 2003 17:53:34   mtk00539
 * 1. Modify BootRom library to support MT6218
 * 2. Modify FlashTool and DA to support AM29PDL128G flash
 * Resolution for 9: [FlashTool v2.2.1005][Add Feature] Support MT6218 and new flash AM29PDL128G
 * 
 *    Rev 1.6   Jun 03 2003 22:24:54   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.5   May 20 2003 16:22:30   mtk00539
 * Support 6205/6205B at 13MHz, 26MHz and 52MHz
 * Resolution for 6: [FlashTool v2.2][AddFeature] Support 6205/6205B at 13MHz, 26MHz and 52MHz.
 * 
 *    Rev 1.4   Jan 09 2003 17:55:32   mtk00303
 * add last 1~3 context switch task ID and frame tick time
 * 
 *    Rev 1.3   Nov 20 2002 19:52:58   mtk00303
 * update for reference phone
 * 
 *    Rev 1.2   Jul 30 2002 10:45:24   admin
 * 2002_0730
 * 
 *    Rev 1.1   Jul 26 2002 11:52:18   admin
 * ver 0726
 * 
 *    Rev 1.0   Jul 20 2002 19:26:14   admin
 * Initial revision.
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/

//---------------------------------------------------------------------------

#ifndef mainH
#define mainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include <Buttons.hpp>
#include <ToolWin.hpp>
#include <Menus.hpp>
#include <ActnList.hpp>
#include <Dialogs.hpp>
#include <ImgList.hpp>
#include <SyncObjs.hpp>
#include "CGAUGES.h"
#include <vector>
#include <list>
#include "Trayicon.h"

#include "stdio.h"

#include "flashtool_handle.h"
#include "flashtool.h"
#include "tboot_1.h"
#include "CGAUGES.h"
#include "param.h"
#include <CheckLst.hpp>

typedef struct
{
/*
    TARGET_TIME_OUT_01_ERROR   = 0x1;
    TARGET_TIME_OUT_LSB_ERROR  = 0x4;
    TARGET_TIME_OUT_MSB_ERROR  = 0x5;
    TARGET_CHECKSUM_ERROR      = 0x2;
    TARGET_BUFFER_FULL_ERROR   = 0x3;
*/
    unsigned char TimeOutErrorCount;
    unsigned char TimeOutLSB_ErrorCount;
    unsigned char TimeOutMSB_ErrorCount;
    unsigned char ChecksumErrorCount;
    unsigned char BufferFullErrorCount;
    unsigned char EraseFlashTimeOutCount;
    unsigned char ProgramFlashTimeOutCount;
    unsigned char UndefinedErrorCount;
} TargetDownloadErrorCount;




#ifndef LAB
    const RS232_TIME_OUT = 10000; // 2002.1.25
    const TOTAL_TIME_OUT_MULTIPLIER = 7;
#else
    const RS232_TIME_OUT = 10000; // 2002.3.12
    const TOTAL_TIME_OUT_MULTIPLIER = 7;
#endif

    const RS232_READBACK_READ_TIME_OUT = 2000; 


class DownloadBinFile {
public:
	DownloadBinFile() {
		m_Filepath = "";
		m_Enable = false;
	}

	~DownloadBinFile() { }

	AnsiString		m_Filepath;
	bool			m_Enable;
};

class DownloadSet {
public:
	DownloadSet() {
		m_Scatter = "";
		m_BootLoader = "";
		m_BootLoader_Enable = false;
		m_BinFiles.clear();
	}
	~DownloadSet() { }

	bool operator == (const DownloadSet	&r_value) {
		if( 0==m_Scatter.AnsiCompareIC(r_value.m_Scatter) && 
			0==m_BootLoader.AnsiCompareIC(r_value.m_BootLoader) &&
			m_BinFiles.size()==r_value.m_BinFiles.size()
		) {
			for(int i=0; i<m_BinFiles.size(); i++) {
				if( 0 != m_BinFiles[i].m_Filepath.AnsiCompareIC(r_value.m_BinFiles[i].m_Filepath) ) {
					return false;
				}
			}
			return true;
		}
		return false;
	}
	
	AnsiString				m_Scatter;
	AnsiString				m_BootLoader;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -