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

📄 amd29lv004.h

📁 Coldfire MCF5282 DBug bootloader
💻 H
字号:
/****************************************************************************************/
/*											*/
/*  File:		amd29lv004.h							*/
/*  Date:		19 December 1997						*/
/*  Purpose:		Header file containing data definitions for the 128Kx8		*/
/*			AMD 29LV004 Flash memory device.				*/
/*											*/
/*											*/
/****************************************************************************************/

#ifndef _AMD29LV004_H
#define _AMD29LV004_H

/****************************************************************************************/
/*											*/
/*  These are descriptors for the internal layout of the AMDF29LV004 Flash.		*/
/*											*/
/****************************************************************************************/

#define AMD29LV004_BLOCK_SIZE		(8 * 1024)
#define AMD29LV004_BLOCKS		(64)

#define AMD29LV004_ADDR1		(0x555)
#define AMD29LV004_ADDR2		(0x2AA)

/****************************************************************************************/
/*											*/
/*  These are the command lines to be used with a 32-bit bus				*/
/*											*/
/****************************************************************************************/

#if (defined(AMD29LV004_32BIT_WIDE))

typedef volatile uint32		AMD29LV004_CELL;

	/************************************************************************/
	/*  Used to enter Reset/Read mode.					*/
	/************************************************************************/
#define AMD29LV004_READ_CMD		(0xF0F0F0F0)

	/************************************************************************/
	/*  Prepares Flash for command.  Used by all except			*/
	/*  Reset/Read, Erase Suspend, and Erase Resume commands.		*/
	/************************************************************************/
#define AMD29LV004_UNLOCK_CMD1		(0xAAAAAAAA)
#define AMD29LV004_UNLOCK_CMD2		(0x55555555)

	/************************************************************************/
	/*  Used to read device data (manuf, id) and verify sector protection.	*/
	/************************************************************************/
#define AMD29LV004_AUTOSELECT_CMD	(0x90909090)

	/************************************************************************/
	/*  Prepares the Flash for programming.					*/
	/************************************************************************/
#define AMD29LV004_BYTEPROG_CMD3	(0xA0A0A0A0)

	/************************************************************************/
	/*  Prepares the Flash for an erase command.				*/
	/*  Unlock must be sent again before the erase commmand.		*/
	/************************************************************************/
#define AMD29LV004_ERASE_CMD		(0x80808080)

	/************************************************************************/
	/*  Chip Erase command.							*/
	/************************************************************************/
#define AMD29LV004_CHIPERASE_CMD	(0x10101010)

	/************************************************************************/
	/*  Sector Erase command.						*/
	/************************************************************************/
#define AMD29LV004_SECTORERASE_CMD	(0x30303030)

	/************************************************************************/
	/*  Chip identification information.  May be top boot block or bottom.	*/
	/*  Top is default if nothing is defined.				*/
	/************************************************************************/
#define AMD29LV004_AMD_CODE		(0x01010101)
#if (defined(AMD29LV004B))
 #define AMD29LV004_DEVICE_CODE		(0xB6B6B6B6)
#else	/* AMD29LV004B */
 #define AMD29LV004_DEVICE_CODE		(0xB5B5B5B5)
#endif	/* AMD29LV004B */

	/************************************************************************/
	/*  Mask for bit that signifies the end of a Sector Erase.		*/
	/************************************************************************/
#define AMD29LV004_ERASE_DONE		(0x80808080)

	/************************************************************************/
	/*  Mask for bit that signifies the end of a Sector Program		*/
	/************************************************************************/
#define AMD29LV004_DATA_POLL_MASK	(0x80808080)

	/************************************************************************/
	/*  Mask for bit that signifies error in Sector Erase or Program	*/
	/************************************************************************/
#define AMD29LV004_TIME_EXCEEDED	(0x20202020)

#endif	/* AMD29LV004_32BIT_WIDE */

/****************************************************************************************/
/*											*/
/*  These are the command lines to be used with a 16-bit bus				*/
/*	(See comments from 32-bit bus section above)					*/
/*											*/
/****************************************************************************************/

#if (defined(AMD29LV004_16BIT_WIDE))

typedef volatile uint16		AMD29LV004_CELL;

#define AMD29LV004_READ_CMD		(0xF0F0)

#define AMD29LV004_UNLOCK_CMD1		(0xAAAA)
#define AMD29LV004_UNLOCK_CMD2		(0x5555)

#define AMD29LV004_AUTOSELECT_CMD	(0x9090)
#define AMD29LV004_BYTEPROG_CMD		(0xA0A0)

#define AMD29LV004_ERASE_CMD		(0x8080)
#define AMD29LV004_CHIPERASE_CMD	(0x1010)
#define AMD29LV004_SECTORERASE_CMD	(0x3030)

#define AMD29LV004_AMD_CODE		(0x0101)
#if (defined(AMD29LV004B))
 #define AMD29LV004_DEVICE_CODE		(0xB6B6)
#else	/* AMD29LV004B */
 #define AMD29LV004_DEVICE_CODE		(0xB5B5)
#endif	/* AMD29LV004B */

#define AMD29LV004_ERASE_DONE		(0x8080)
#define AMD29LV004_DATA_POLL_MASK	(0x8080)
#define AMD29LV004_TIME_EXCEEDED	(0x2020)

#endif	/* AMD29LV004_16BIT_WIDE */

/****************************************************************************************/
/*											*/
/*  These are the command lines to be used with a 8-bit bus				*/
/*	(See comments from 32-bit bus section above)					*/
/*											*/
/****************************************************************************************/

#if (defined(AMD29LV004_8BIT_WIDE))

typedef volatile uint8		AMD29LV004_CELL;

#define AMD29LV004_READ_CMD		(0xF0)

#define AMD29LV004_UNLOCK_CMD1		(0xAA)
#define AMD29LV004_UNLOCK_CMD2		(0x55)

#define AMD29LV004_AUTOSELECT_CMD	(0x90)
#define AMD29LV004_BYTEPROG_CMD		(0xA0)

#define AMD29LV004_ERASE_CMD		(0x80)
#define AMD29LV004_CHIPERASE_CMD	(0x10)
#define AMD29LV004_SECTORERASE_CMD	(0x30)

#define AMD29LV004_AMD_CODE		(0x01)
#if (defined(AMD29LV004B))
 #define AMD29LV004_DEVICE_CODE		(0xB6)
#else	/* AMD29LV004B */
 #define AMD29LV004_DEVICE_CODE		(0xB5)
#endif	/* AMD29LV004B */

#define AMD29LV004_ERASE_DONE		(0x80)
#define AMD29LV004_DATA_POLL_MASK	(0x80)
#define AMD29LV004_TIME_EXCEEDED	(0x20)

#endif	/* AMD29LV004_8BIT_WIDE */

/****************************************************************************************/
/*											*/
/*  Setup Internal structures								*/
/*											*/
/****************************************************************************************/

typedef enum
{
	AMD29LV004_SECTOR_0 = 0,
	AMD29LV004_SECTOR_1 = 8,
	AMD29LV004_SECTOR_2 = 16,
	AMD29LV004_SECTOR_3 = 24,
	AMD29LV004_SECTOR_4 = 32,
	AMD29LV004_SECTOR_5 = 40,
	AMD29LV004_SECTOR_6 = 48,
	AMD29LV004_SECTOR_7 = 56,
	AMD29LV004_SECTOR_8 = 60,
	AMD29LV004_SECTOR_9 = 61,
	AMD29LV004_SECTOR_10 = 62
} AMD29LV004_SECTOR;

typedef volatile struct
{
	AMD29LV004_CELL		manuf;
	AMD29LV004_CELL		id;
	AMD29LV004_CELL		dataA[AMD29LV004_ADDR2 - 2];
	AMD29LV004_CELL		cmdreg2;
	AMD29LV004_CELL		dataB[AMD29LV004_ADDR1 - AMD29LV004_ADDR2 - 1];
	AMD29LV004_CELL		cmdreg1;
} AMD29LV004_DEVICE;

typedef volatile struct
{
	AMD29LV004_CELL		data[AMD29LV004_BLOCK_SIZE];
} AMD29LV004_SECTORDATA;

typedef volatile union
{
	AMD29LV004_DEVICE	device;
	AMD29LV004_SECTORDATA	sector[AMD29LV004_BLOCKS];
} AMD29LV004;

/****************************************************************************************/

#endif /* _AMD29LV004_H */

⌨️ 快捷键说明

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