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

📄 flash_dev_tbl.h

📁 MTK手机平台下载工具FLASHTOOL驱动源码
💻 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) 2004
*
*******************************************************************************/

/*******************************************************************************
 *
 * Filename:
 * ---------
 *	 flash_dev_tbl.h 
 *
 * Project:
 * --------
 *   FlashTool Download Agent 
 *
 * Description:
 * ------------
 *   Flash device table 
 *
 * Author:
 * -------
 *	 Amos Hsu 
 *
 *==============================================================================
 * 				HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * $Revision:   1.5  $
 * $Modtime:   Oct 19 2005 11:05:04  $
 * $Log:   //mtkvs01/vmdata/flash_tool/archives/DA/INC/flash_dev_tbl.h-arc  $
 * 
 *    Rev 1.5   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.4   Feb 16 2005 17:23:58   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.3   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.2   Nov 05 2004 10:37:28   mtk00539
 *  1. [DA][BUG FIX] Fix format progress report error, percentage variable should not just use uint8.
 *  2. [DA][BUG FIX] Fix command error for AMD protection routines.
 *  3. [DA][Enhance] Fix UART_Printf compile warning in UART.C
 * Resolution for 96: [BROM_DLL v2.4.1007][New] Implement S/W compatible mechanism for MT6218B_FN and MT6218B_GN.
 * 
 *    Rev 1.1   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.0   Jul 19 2004 01:45:22   mtk00539
 * Initial revision.
 * 
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *==============================================================================
 *******************************************************************************/
#ifndef _FLASH_DEV_TBL_H_
#define _FLASH_DEV_TBL_H_

#include "SW_TYPES.H"
#include "DOWNLOAD.H"

#define MAX_SECTOR_REGION_PER_DIE	4
#define MAX_STATUS_CHECK_RETRY		5

// flash command callback function 
typedef bool		(*CB_NOR_CHECK_DEV_ID)(const uint16 dev, volatile uint16 *die1_addr, volatile uint16 *die2_addr);
typedef bool		(*CB_NOR_CHECK_DEV_IDLE)(const uint32 addr);
typedef void		(*CB_NOR_SECTOR_ERASE)(const uint32 blockaddr);
typedef STATUS_E	(*CB_NOR_SECTOR_ERASE_CHECK_DONE)(const uint32 blockaddr);
typedef void		(*CB_NOR_PROGRAM_PRE_PROCESS)(const uint16 dev);
typedef void		(*CB_NOR_PROGRAM_POST_PROCESS)(const uint16 dev);
typedef void		(*CB_NOR_PROGRAM_ENTER)(const uint32 blockaddr);
typedef void		(*CB_NOR_PROGRAM_EXIT)(const uint32 blockaddr);
typedef void		(*CB_NOR_PROGRAM)(const uint32 blockaddr, const uint32 prog_addr, const uint16 data);
typedef STATUS_E	(*CB_NOR_PROGRAM_CHECK_DONE)(const uint32 prog_addr);
typedef void		(*CB_NOR_BUF_PROGRAM)(const uint32 blockaddr, const uint32 prog_addr, const uint16 *data, const uint32 length_in_word);
typedef STATUS_E	(*CB_NOR_BUF_PROGRAM_CHECK_DONE)(const uint32 prog_addr);

typedef struct {
	CB_NOR_CHECK_DEV_ID				m_cb_chk_dev_id;
	CB_NOR_CHECK_DEV_IDLE			m_cb_chk_dev_idle;
	CB_NOR_SECTOR_ERASE				m_cb_sec_erase;
	CB_NOR_SECTOR_ERASE_CHECK_DONE	m_cb_sec_erase_chk_done;
	CB_NOR_PROGRAM_PRE_PROCESS		m_cb_pgm_pre_process;
	CB_NOR_PROGRAM_POST_PROCESS		m_cb_pgm_post_process;
	CB_NOR_PROGRAM_ENTER			m_cb_pgm_enter;
	CB_NOR_PROGRAM_EXIT				m_cb_pgm_exit;
	CB_NOR_PROGRAM					m_cb_pgm;
	CB_NOR_PROGRAM_CHECK_DONE		m_cb_pgm_check_done;
	CB_NOR_BUF_PROGRAM				m_cb_buf_pgm;
	CB_NOR_BUF_PROGRAM_CHECK_DONE	m_cb_buf_pgm_check_done;
} NOR_CMD_Callback_S;

typedef struct {
	// sector layout 
	uint32		m_base_offset;
	uint32		m_sector_count;
	uint32		m_sector_size;
} NOR_SectorRegion_S;

typedef struct {

	// total size (in bytes) on this die 
	uint32		m_size;

	// grouped sector region map 
	NOR_SectorRegion_S	m_region_map[MAX_SECTOR_REGION_PER_DIE];

} NOR_Die_Layout_S;

typedef struct {

	// memory layout map for each die 
	const NOR_Die_Layout_S	*m_die_layout;

} NOR_Die_Info_S;

typedef struct {

	// die info 
	NOR_Die_Info_S	m_die[MAX_DIE_IN_MCP];

	// die count 
	uint16		m_die_count;

	// H/W flash manufacture id and device code 
	uint16		m_manufacture_code;
	uint16		m_dev_code;
	uint16		m_ext_dev_code1;
	uint16		m_ext_dev_code2;

} NOR_HW_Info_S;

typedef struct {

	// flash id defined in DOWNLOAD.H 
	NOR_DeviceID_E			m_device_id;

	// flash device H/W info 
	NOR_HW_Info_S		m_hw_info;

	// flash command callback function 
	const NOR_CMD_Callback_S	*m_cmd;

} NOR_Device_S;

#ifdef __cplusplus
extern "C" {
#endif

extern const NOR_Device_S 	g_FlashDevTbl[];
extern uint16				g_FlashType;

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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