📄 sst49lf008a.txt
字号:
; 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 4 Kbytes for 49LF008A
BLOCK_SIZE EQU 65536 ; Must be 64 Kbytes for 49LF008A
SST_ID EQU 0BFh ; SST Manufacturer's ID code
SST_49LF008A EQU 05Ah ; SST 49LF008A device code
SST_49LF008A_GPI EQU 0FFBC0100h ; SST 49LF008A GPI address
SST_49LF008A_M_ID EQU 0FFBC0000h ; SST 49LF008A Manufacturer's ID(for boot device)
SST_49LF008A_D_ID EQU 0FFBC0001h ; SST 49LF008A Device ID(for boot device)
SST_49LF008A_T_MINUS15_LKReg EQU 0FFB00002h ; SST 49LF008A Block15 Locking Register(boot device)
CHIP_ERASE_COMMAND EQU 010h
SECTOR_ERASE_COMMAND EQU 030h
BLOCK_ERASE_COMMAND EQU 050h
extrn ABS_SEGMENT ;system address of the device
extrn Delay_150_Nano_Seconds:near
extrn Delay_25_Milli_Seconds:near
extrn Delay_100_Milli_Seconds:near
;=======================================================================
; PROCEDURE: Check_SST_49LF008A (FWH/PP mode)
;
; This procedure decides whether a physical hardware device has a SST's
; 49LF008A 8 Mbit Firmware Hub Flash installed or not.
;
; Input:
; None
;
; Output:
; carry bit: CLEARED means a SST 49LF008A is installed
; carry bit: SET means a SST 49LF008A is NOT installed
;
;=======================================================================
Check_SST_49LF008A proc near
push ax ; preserve registers?value
push ds
pushf ; save interrupt state
; It is mandatory to maintain pushf as the last push instruction.
cli
mov ax, ABS_SEGMENT ; 32bit address
mov ds, ax
mov ds:byte ptr [5555h], 0AAh ; issue the 3-byte product ID
mov ds:byte ptr [2AAAh], 055h ; command to the 49LF008A
mov ds:byte ptr [5555h], 090h
call Delay_150_Nano_Seconds ; insert delay = Tida
mov al, ds:[0]
cmp al, SST_ID ; is this a SST part?
jne CSC5 ; NO, then return Carry set
mov al,ds:[1]
cmp al, SST_49LF008A ; Is it a 49LF008A?
jne CSC5 ; NO, then Non-SST part and
; set carry flag
CSC4:
pop ax ; get flags from stack
and ax, 0FFFEh ; and clear carry flag
jmp short CSC6
CSC5:
pop ax ; get flags from stack
or ax, 0001h ; and set carry flag
; save the result on the STACK
CSC6:
push ax ; return flags to stack
;
; Issue the Software Product ID Exit code thus returning the 49LF008A
; to the read operation mode.
;
mov ds:byte ptr [5555h], 0AAh ; issue the 3-byte product ID
mov ds:byte ptr [2AAAh], 055h ; exit command sequence to
mov ds:byte ptr [5555h], 0F0h ; the 49LF008A
call Delay_150_Nano_Seconds ; insert delay = Tida
popf ; restore flags
pop ds ; restore registers
pop ax
ret
Check_SST_49LF008A endp
;=======================================================================
; PROCEDURE: Check_SST49LF008A_JedecIDs (FWH mode)
;
; This procedure decides whether a physical hardware device has a SST's
; 49LF008A 8 Mbit Firmware Hub Flash installed or not.
;
; Input:
; None
;
; Output:
; carry bit: CLEARED means a SST 49LF008A is installed
; carry bit: SET means a SST 49LF008A is NOT installed
;
;=======================================================================
Check_SST49LF008A_JedecIDs proc near
push ax ; preserve registers?value
push ds
pushf ; save interrupt state
; It is mandatory to maintain pushf as the last push instruction.
mov al, byte ptr[SST_49LF008A_M_ID] ; 32bit address
cmp al, SST_ID ; is this a SST part?
jne CSJ2 ; NO, then return Carry set
mov al,byte ptr[SST_49LF008A_D_ID] ; 32bit address
cmp al, SST_49LF008A ; Is it a 49LF008A?
jne CSJ2 ; NO, then Non-SST part and
; set carry flag
CSJ1:
pop ax ; get flags from stack
and ax, 0FFFEh ; and clear carry flag
jmp short CSJ3
CSJ2:
pop ax ; get flags from stack
or ax, 0001h ; and set carry flag
CSJ3:
push ax ; return flags to stack
popf ; restore flags
pop ds ; restore registers
pop ax
ret
Check_SST49LF008A_JedecIDs endp
; =====================================================================
; PROCEDURE: Erase_Entire_Chip (PP Mode ONLY)
;
; This procedure can be used to erase the entire contents of
; SST's 49LF008A. Chip-Erase is only available in PP mode.
;
; Input:
; es:di points to the beginning address of the 49LF008A chip
; which will be erased.
;
; Output:
; None
; =====================================================================
Erase_Entire_Chip proc near
mov es:byte ptr [5555h], 0AAh ; issue 6-byte chip
mov es:byte ptr [2AAAh], 055h ; erase command sequence
mov es:byte ptr [5555h], 080h
mov es:byte ptr [5555h], 0AAh
mov es:byte ptr [2AAAh], 055h
mov es:byte ptr [5555h], CHIP_ERASE_COMMAND
call Delay_100_Milli_Seconds ; insert delay = Tsce
ret
Erase_Entire_Chip endp
; =====================================================================
; PROCEDURE: Erase_One_Sector (FWH/PP Mode)
;
; This procedure can be used to erase a sector, or total of 4096 bytes,
; in the SST49LF008A.
;
; In FWH mode, the block containning the sector to be erased needs to be
; unlocked first. Please refers the subroutine:
; Erase_Block_T_Minus15 for a detail of usage.
;
; Input:
; es:di points to the beginning address of the "Destination" address
; which will be erased.
; Output:
; None
; =====================================================================
Erase_One_Sector proc near
push ax ; save register
mov es:byte ptr [5555h], 0AAh ; send 6-byte code for
mov es:byte ptr [2AAAh], 055h ; sector erase
mov es:byte ptr [5555h], 080h
mov es:byte ptr [5555h], 0AAh
mov es:byte ptr [2AAAh], 055h
mov al, SECTOR_ERASE_COMMAND
mov byte ptr es:[di], al
call Delay_25_Milli_Seconds ; insert delay = Tse
pop ax ; restore register
ret
Erase_One_Sector endp
; =====================================================================
; PROCEDURE: Erase_One_Block (FWH/PP Mode)
;
; This procedure can be used to erase a block, or total of 64 Kbytes,
; in the SST49LF008A.
;
; In FWH mode, the block to be erased needs to be unlocked first.
; Please refers the subroutine:
; Erase_Block_T_Minus15 for a detail of usage.
;
; Input:
; es:di points to the beginning address of the "Destination" block
; which will be erased.
;
; Output:
; None
; =====================================================================
Erase_One_Block proc near
push ax ; save register
mov es:byte ptr [5555h], 0AAh ; send 6-byte code for
mov es:byte ptr [2AAAh], 055h ; sector erase
mov es:byte ptr [5555h], 080h
mov es:byte ptr [5555h], 0AAh
mov es:byte ptr [2AAAh], 055h
mov al, BLOCK_ERASE_COMMAND
mov byte ptr es:[di], al
call Delay_25_Milli_Seconds ; insert delay = Tbe
pop ax ; restore register
ret
Erase_One_Block endp
; =====================================================================
; 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
;
; Input:
; None
;
; Output:
; register value will be in AL
; =====================================================================
Read_T_MINUS15_LK_Register proc near
mov al,byte ptr[SST_49LF008A_T_MINUS15_LKReg]
;store block register value to AL
ret
Read_T_MINUS15_LK_Register endp
; =====================================================================
; PROCEDURE: Write_T_MINUS15_LK_Register (FWH mode)
;
; This sample subroutine writes new status byte to block locking reg.
; T_MINUS15_LK_Register of Boot Device(Device #0) of SST49LF008A
;
; The address of T_MINUS15_LK_Register = FFB00002H
;
; Input:
; AL the new status byte to be written
;
; Output:
; None
; =====================================================================
Write_T_MINUS15_LK_Register proc near
mov byte ptr[SST_49LF008A_T_MINUS15_LKReg], al
;store AL value to block register
ret
Write_T_MINUS15_LK_Register endp
; =====================================================================
; PROCEDURE: Erase_Block_T_MINUS15 (FWH Mode)
;
; This sample subroutine can be used to erase the block of T_MINUS15
; in Boot Device (Devoce #0) of SST49LF008A in FWH mode.
;
; SST49LF008A has 16 uniform, 64 KByte blocks: T_BLOCK, T_MINUS01 --
; T_MINUS15.
;
; The block of T_MINUS15 has an address range from FFF0FFFFH --
; FFF00000H in the System of 4 Gbytes Memory Map and its block locking
; register: T_MINUS15_LK_Register = FFB00002H.
;
; Before erasing the block, the user needs to unlock the block first.
; To unlock the block, the user needs to refer two sample subroutines
; Read_T_MINUS15_LK_Register() and Write_T_MINUS15_LK_Register().
;
; Input:
; es:di DESTINATION address at which the erase operation will
; start.
; Output:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -