📄 sst49lf008a.txt
字号:
Software Drivers
49LF008A
8 Mbit Firmware Hub with Top Boot-Block
March 2003
ABOUT THE SOFTWARE
This application note provides software driver examples for 49LF008A, 8 Mbit
Firmware Hub with Top Boot-Block. This device is designed to interface with host
controllers (chipsets) that supports a low-pin-count(LPC) interface for BIOS
applications.
Software driver examples used in this document utilize two programming languages:
(a) high -level "C" for broad platform support and
(b) optimized x86 assembly language.
In many cases, software driver routines can be inserted "as is" into the main body
of code being developed by the system software developers. Extensive comments are
included in each routine to describe the function of each routine. The driver in
"C" language can be used with many microprocessors and microcontrollers, while the
x86 assembly language provides an optimized solution for x86 microprocessors.
There are two hardware pins, WP# and TBL#, are provided for hardware write protection
of device memory in FWH mode. The TBL# is used for the top boot block and needs to set
to high (unprotected state) before programming. The WP# is used for the rest of memory
and needs to set to high (unprotected state) before programming.
ABOUT THE 49LF008A
Companion product datasheets for the 49LF008A should be reviewed in conjunction
with this application note for a complete understanding of the device.
Both the C and x86 assembly code in the document contain the following
routines, in this order:
Name Function
------------------------------------------------------------------
Check_SST_49LF008A Check manufacturer and device ID
Check_SST49LF008A_JedecIDs Check manufacturer and device ID by reading
JEDEC ID registers
Erase_Entire_Chip Erase the contents of the entire chip
Erase_One_Sector Erase a sector of 4096 bytes
Erase_One_Block Erase a block of 64 Kbytes
Read_T_MINUS15_LK_Register Read status byte of T_MINUS15_LK_Register
Block Locking Register
Write_T_MINUS15_LK_Register Write status byte to T_MINUS15_LK_Register
Block Locking Register
Erase_Block_T_MINUS15 Erase the block of T_MINUS05
Program_One_Byte Alter data in one byte
Program_One_Sector Alter data in 4096 bytes sector
Program_One_Block Alter data in 64 Kbytes block
Check_Toggle_Ready End of internal program or erase detection using
Toggle bit
Check_Data_Polling End of internal program or erase detection using
Data# polling
Read_SST49LF008A_GPI_Register Fetch the content of GPI Register
*/
//"C" LANGUAGE DRIVERS
/***********************************************************************/
/* Copyright Silicon Storage Technology, Inc. (SST), 1994-2003 */
/* Example "C" Language Drivers of 49LF008A, 8 Mbit Firmware Hub Flash */
/* Read-Compatible Flash */
/* Nelson Wang, Silicon Storage Technology, Inc. */
/* */
/* Revision 1.1, March 31, 2003 */
/* */
/* This file requires these external "timing" routines: */
/* */
/* 1.) Delay_150_Nano_Seconds */
/* 2.) Delay_25_Milli_Seconds */
/* 3.) Delay_100_Milli_Seconds */
/***********************************************************************/
#define FALSE 0
#define TRUE 1
#define SECTOR_SIZE 4096 /* Must be 4 Kbytes for 49LF008A */
#define BLOCK_SIZE 65536 /* Must be 64 Kbytes for 49LF008A */
#define SST_ID 0xBF /* SST Manufacturer's ID code */
#define SST_49LF008A 0x5A /* 49LF008A device code */
#define SST_49LF008A_M_ID 0xFFBC0000 /* 49LF008A Manufacturer's ID */
/* register address for boot device, FWH mode*/
/*should be modified by user for other strapping*/
#define SST_49LF008A_D_ID 0xFFBC0001 /* 49LF008A Device ID */
/* register address for boot device, FWH mode */
/*should be modified by user for other strapping*/
#define SST_49LF008A_GPI 0xFFBC0100 /* 49LF008A GPI register address */
/* for boot device, FWH mode */
#define SST_49LF008A_T_MINUS15_LKReg 0xFFB00002 /*49LF008A Locking Register*/
/*for block15 of the boot device should be*/
/*modified by user for other strapping or other block*/
typedef unsigned char BYTE;
typedef unsigned long int Uint32;
Uint32 system_base = 0xFFF00000; /* 4GB System Memory Address for boot device*/
/* in FWH mode. It should be modified by user for other memory strapping*/
#define sysAddress(offset) (*(volatile BYTE *)(system_base + offset))
/* -------------------------------------------------------------------- */
/* EXTERNAL ROUTINES */
/* -------------------------------------------------------------------- */
extern void Delay_150_Nano_Seconds();
extern void Delay_25_Milli_Seconds();
extern void Delay_100_Milli_Seconds();
int Check_Toggle_Ready (Uint32 Dst);
/************************************************************************/
/* PROCEDURE: Check_SST_49LF008A (PP/FWH mode) */
/* */
/* This procedure decides whether a physical hardware device has a */
/* SST 49LF008A 8 Mbit Firmware Hub Flash installed or not. */
/* Input: */
/* None */
/* */
/* Output: */
/* return TRUE: indicates a SST 49LF008A */
/* return FALSE: indicates not a SST 49LF008A */
/************************************************************************/
int Check_SST_49LF008A()
{
BYTE SST_id1;
BYTE SST_id2;
int ReturnStatus;
/* Issue the Software Product ID code to 49LF008A */
sysAddress(0x5555) = 0xAA; /* write data 0xAA to device addr 0x5555*/
sysAddress(0x2AAA) = 0x55; /* write data 0x55 to device addr 0x2AAA*/
sysAddress(0x5555) = 0x90; /* write data 0x90 to device addr 0x5555*/
Delay_150_Nano_Seconds(); /* Tida Max 150ns for 49LF008A*/
/* Read the product ID from 49LF008A */
SST_id1 = sysAddress(0x0000); /* get first ID byte */
SST_id2 = sysAddress(0x0001); /* get second ID byte */
/* Determine whether there is a SST 49LF008A installed or not */
if ((SST_id1 == SST_ID) && (SST_id2 ==SST_49LF008A))
ReturnStatus = TRUE;
else
ReturnStatus = FALSE;
/* Issue the Soffware Product ID Exit code thus returning the */
/* 49LF008A to the normal operation */
sysAddress(0x5555) = 0xAA; /* write data 0xAA to device addr 0x5555*/
sysAddress(0x2AAA) = 0x55; /* write data 0x55 to device addr 0x2AAA*/
sysAddress(0x5555) = 0xF0; /* write data 0xF0 to device addr 0x5555*/
Delay_150_Nano_Seconds(); /* Tida Max 150ns for 49LF008A*/
return (ReturnStatus);
}
/************************************************************************/
/* PROCEDURE: Check_SST49LF008A_JedecIDs (FWH mode) */
/* */
/* This procedure decides whether a physical hardware device has a */
/* SST 49LF008A 8 Mbit FWH Flash installed or not by reading JEDEC */
/* ID registers of Boot Device (Device #0). */
/* */
/* For Boot Configuration from Top of the 4 Gbytes System Memory, the */
/* address of Manufacturer ID Register(M-ID) = FFBC0000H, and the */
/* address of Device ID Register(D-ID) = FFBC0001H. */
/* */
/* Input: */
/* None */
/* */
/* Output: */
/* return TRUE: indicates a SST49LF008A */
/* return FALSE: indicates not a SST49LF008A */
/************************************************************************/
int Check_SST49LF008A_JedecIDs()
{
BYTE SST_id1;
BYTE SST_id2;
int ReturnStatus;
SST_id1 = *(volatile BYTE *)(SST_49LF008A_M_ID); /*get first ID byte */
SST_id2 = *(volatile BYTE *)(SST_49LF008A_D_ID); /*get second ID byte*/
/* Determine whether there is a SST 49LF008A installed or not */
if ((SST_id1 == SST_ID) && (SST_id2 ==SST_49LF008A))
ReturnStatus = TRUE;
else
ReturnStatus = FALSE;
return (ReturnStatus);
}
/************************************************************************/
/* PROCEDURE: Erase_Entire_Chip (PP Mode only) */
/* */
/* This procedure can be used to erase the entire chip. Chip-Erase is */
/* only available in PP mode. */
/* */
/* Input: */
/* NONE */
/* */
/* Output: */
/* NONE */
/************************************************************************/
void Erase_Entire_Chip()
{
/* Issue the Sector Erase command to 49LF008A */
sysAddress(0x5555) = 0xAA; /* write data 0xAA to device addr 0x5555*/
sysAddress(0x2AAA) = 0x55; /* write data 0x55 to device addr 0x2AAA*/
sysAddress(0x5555) = 0x80; /* write data 0x80 to device addr 0x5555*/
sysAddress(0x5555) = 0xAA; /* write data 0xAA to device addr 0x5555*/
sysAddress(0x2AAA) = 0x55; /* write data 0x55 to device addr 0x2AAA*/
sysAddress(0x5555) = 0x10; /* write data 0x10 to device addr 0x5555*/
Delay_100_Milli_Seconds(); /* 70ms typical for chip erase */
}
/************************************************************************/
/* PROCEDURE: Erase_One_Sector (FWH/PP Mode) */
/* */
/* This procedure can be used to erase a total of 4096 bytes. */
/* */
/* In FWH mode, the block containning the sector to be erased needs to */
/* be unlocked first. Please refers the sample routine */
/* Erase_Block_T_MINUS15() for a detail of usage. */
/* */
/* Input: */
/* Dst device address at which the sector erase */
/* operations will start. */
/* */
/* Output: */
/* NONE */
/************************************************************************/
void Erase_One_Sector(Uint32 Dst)
{
/* Issue the Sector Erase command to 49LF008A */
sysAddress(0x5555) = 0xAA; /* write data 0xAA to device addr 0x5555*/
sysAddress(0x2AAA) = 0x55; /* write data 0x55 to device addr 0x2AAA*/
sysAddress(0x5555) = 0x80; /* write data 0x80 to device addr 0x5555*/
sysAddress(0x5555) = 0xAA; /* write data 0xAA to device addr 0x5555*/
sysAddress(0x2AAA) = 0x55; /* write data 0x55 to device addr 0x2AAA*/
sysAddress(Dst) = 0x30; /* write data 0x30 to device sector addr*/
Delay_25_Milli_Seconds(); /* Max Tse 25 ms */
}
/************************************************************************/
/* PROCEDURE: Erase_One_Block (FWH/PP Mode) */
/* */
/* This procedure can be used to erase a total of 64 Kbytes. */
/* */
/* In FWH mode, the block to be erased needs to be unlocked first. */
/* Please refers the sample routine */
/* Erase_Block_T_MINUS15() for a detail of usage. */
/* */
/* For FWH mode, please refer to subroutine Erase_Block_T_MINUS15() */
/* for a detailed description. */
/* */
/* Input: */
/* Dst device address at which the block erase */
/* operation will start. */
/* */
/* Output: */
/* NONE */
/************************************************************************/
void Erase_One_Block(Uint32 Dst)
{
/* Issue the Block Erase command to 49LF008A */
sysAddress(0x5555) = 0xAA; /* write data 0xAA to device addr 0x5555*/
sysAddress(0x2AAA) = 0x55; /* write data 0x55 to device addr 0x2AAA*/
sysAddress(0x5555) = 0x80; /* write data 0x80 to device addr 0x5555*/
sysAddress(0x5555) = 0xAA; /* write data 0xAA to device addr 0x5555*/
sysAddress(0x2AAA) = 0x55; /* write data 0x55 to device addr 0x2AAA*/
sysAddress(Dst) = 0x50; /* write data 0x50 to device block addr */
Delay_25_Milli_Seconds(); /* Max Tbe 25 ms */
}
/************************************************************************/
/* PROCEDURE: Read_T_MINUS15_LK_Register (FWH mode) */
/* */
/* This sample subroutine reads the status byte of block register */
/* T_MINUS15_LK_Register from the Boot Device(Device #0) of SST49LF008A */
/* */
/* The address of T_MINUS15_LK_Register = FFB00002H */
/* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -