📄 sst39sf040.txt
字号:
Delay_25_Milli_Seconds(); /* check DATABOOK for the most */
/* accurate value -- Tse */
}
/************************************************************************/
/* PROCEDURE: Program_One_Byte */
/* */
/* This procedure can be used to program ONE byte of date to the */
/* 39SF040. */
/* */
/* NOTE: It is mandatory that the sector containing the byte to be */
/* programmed was ERASED first. */
/* */
/* Input: */
/* SrcByte The BYTE which will be written to the 39SF040. */
/* Dst DESTINATION address which will be written with the */
/* data passed in from SrcByte */
/* */
/* Output: */
/* None */
/************************************************************************/
void Program_One_Byte (BYTE SrcByte, BYTE far *Dst)
{
BYTE far *SourceBuf;
BYTE far *DestBuf;
int Index;
DestBuf = Dst;
Temp = (BYTE far *)0xA0005555; /* set up address to be A000:555h */
*Temp = 0xAA; /* write data 0xAA to the address */
Temp = (BYTE far *)0xA0002AAA; /* set up address to be A000:2AAAh */
*Temp = 0x55; /* write data 0x55 to the address */
Temp = (BYTE far *)0xA0005555; /* set up address to be A000:5555h */
*Temp = 0xA0; /* write data 0xA0 to the address */
*DestBuf = SrcByte; /* transfer the byte to destination */
Check_Toggle_Ready(DestBuf); /* wait for TOGGLE bit to get ready */
}
/************************************************************************/
/* PROCEDURE: Program_One_Sector */
/* */
/* This procedure can be used to program a total of 4096 bytes of data */
/* to the SST's 39SF040. */
/* */
/* Input: */
/* Src SOURCE address containing the data which will be */
/* written to the 39SF040. */
/* Dst DESTINATION address which will be written with the */
/* data passed in from Src */
/* */
/* Output: */
/* None */
/************************************************************************/
void Program_One_Sector (BYTE far *Src, BYTE far *Dst)
{
BYTE far *Temp;
BYTE far *SourceBuf;
BYTE far *DestBuf;
int Index;
SourceBuf = Src;
DestBuf = Dst;
Erase_One_Sector(Src); /* erase the sector first */
for (Index = 0; Index < SECTOR_SIZE; Index++)
{
Temp = (BYTE far *)0xA0005555; /* set up address to be A000:555h */
*Temp = 0xAA; /* write data 0xAA to the address */
Temp = (BYTE far *)0xA0002AAA; /* set up address to be A000:2AAAh*/
*Temp = 0x55; /* write data 0x55 to the address */
Temp = (BYTE far *)0xA0005555; /* set up address to be A000:5555h*/
*Temp = 0xA0; /* write data 0xA0 to the address */
Temp = DestBuf;
/* save the original Destination address */
*DestBuf++ = *SourceBuf++;
/* transfer data from source to destination */
Check_Toggle_Ready(Temp);
/* wait for TOGGLE bit to get ready */
}
}
/************************************************************************/
/* PROCEDURE: Check_Toggle_Ready */
/* */
/* During the internal program cycle, any consecutive read operation */
/* on DQ6 will produce alternating 0's and 1's i.e. toggling between */
/* 0 and 1. When the program cycle is completed, DQ6 of the data will */
/* stop toggling. After the DQ6 data bit stops toggling, the device is */
/* ready for next operation. */
/* */
/* Input: */
/* Dst must already set-up by the caller */
/* */
/* Output: */
/* None */
/************************************************************************/
void Check_Toggle_Ready (BYTE far *Dst)
{
BYTE Loop = TRUE;
BYTE PreData;
BYTE CurrData;
unsigned long TimeOut = 0;
PreData = *Dst;
PreData = PreData & 0x40;
while ((TimeOut< 0x07FFFFFF) && (Loop))
{
CurrData = *Dst;
CurrData = CurrData & 0x40;
if (PreData == CurrData)
Loop = FALSE; /* ready to exit the while loop */
PreData = CurrData;
TimeOut++;
}
}
/************************************************************************/
/* PROCEDURE: Check_Data_Polling */
/* */
/* During the internal program cycle, any attempt to read DQ7 of the */
/* last byte loaded during the page/byte-load cycle will receive the */
/* complement of the true data. Once the program cycle is completed, */
/* DQ7 will show true data. */
/* */
/* Input: */
/* Dst must already be set-up by the caller */
/* TrueData this is the original (true) data */
/* */
/* Output: */
/* None */
/************************************************************************/
void Check_Data_Polling (BYTE far *Dst, BYTE TrueData)
{
BYTE Loop = TRUE;
BYTE CurrData;
unsigned long TimeOut = 0;
TrueData = TrueData & 0x80;
while ((TimeOut< 0x07FFFFFF) && (Loop))
{
CurrData = *Dst;
CurrData = CurrData & 0x80;
if (TrueData == CurrData)
Loop = FALSE; /* ready to exit the while loop */
TimeOut++;
}
}
8086 ASSEMBLY LANGUAGE DRIVERS
; ======================================================================
; Copyright Silicon Storage Technology, Inc. (SST), 1994-2001
; EXAMPLE 8086 Assembly Language Drivers for 39SF040 4 Mbit(512 x 8)
; Multi-Purpose Flash
; Frank Cirimele, Silicon Storage Technology, Inc.
;
; Revision 1.0, Sept. 12, 2000
;
; This file requires these external "timing" routines:
;
; 1.) Delay_150_Nano_Seconds
; 2.) Delay_25_Milli_Seconds
; 3.) Delay_100_Milli_Seconds
; ======================================================================
SECTOR_SIZE EQU 4096 ; Must be 4096 bytes for 39SF040
SST_ID EQU 0BFh ; SST Manufacturer's ID code
SST_39SF040 EQU 0B7h ; SST 39SF040 device code
CHIP_ERASE_COMMAND EQU 010h
SECTOR_ERASE_COMMAND EQU 030h
ABS_SEGMENT EQU 0A000h
extrn Delay_150_Nano_Seconds:near
extrn Delay_25_Milli_Seconds:near
extrn Delay_100_Milli_Seconds:near
;=======================================================================
; PROCEDURE: Check_SST_39SF040
;
; This procedure decides whether a physical hardware device has a SST's
; 39SF040 4 Mbit(512 x 8) Multi-Purpose Flash installed or not.
;
; Input:
; None
;
; Output:
; carry bit: CLEARED means a SST 39SF040 is installed
; carry bit: SET means NOT a SST 39SF040 is NOT installed
;
;=======================================================================
Check_SST_39SF040 proc near
push ax ; preserve registers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -