On-Chip Routines Source Code
On-Chip FLASH Programming Routines, Rev. 4
Freescale Semiconductor
25
;* more than Offset samples = 1 means bit is detected as a logic 1
BitX2: equ 210 ;delay count for ~2 bit times
;* 2 bit time is not accurate
BitTimeE: equ 76 ;delay count for 1 bit time (Ext) and
BitTimeI: equ 129 ; (Int) used in PutByte
BrkTimeE: equ 232 ;delay count for 10 bit times (Ext)
BrkTimeI: equ 123 ; and (Int) used in EchoBrk
;*********************************************************************
;* EQUATES and VARIABLES for FLASH routines
;*********************************************************************
DATSTRC: equ RamStart+8 ;leave 8-byte offset from start of
; RAM for future requirement
MASSBIT: equ 6 ;MASS bit of CTRLBYT located in bit 6
ROWSIZE: equ 32 ;FLASH ROW size
org DATSTRC
;* The following variables set by user
CTRLBYT: rmb 1 ;control byte for erase operation
; selection
CPUSPD: rmb 1 ;CPU bus speed (nearest integer of
; bus freq (in MHz) * 4)
LADDR: rmb 2 ;last address
DATA: rmb ROWSIZE ;allocation/use of this space depends
; on a device
RamPntrLo: equ LADDR ;LADDR loc. reused as RAM pointer in
; PRGRNGE routine
ByteCntr: equ LADDR+1 ;LADDR+1 loc. reused as Byte Count in
; PRGRNGE routine
;* These times are for use by ERARNGE
LoopErase: equ 20 ;total Terase time (~ 4ms)
; =20+(EraseLOOP*(3*CPUSPD*TERASE+26))
TERASE: equ 17 ;FLASH erase time between COP service
; COP is serviced every ~200 us =
; 3*CPUSPD*TERASE+26 (bus cycles)
TNVHL: equ 9 ;FLASH high-voltage hold time (>= 100us)
; = 3*SPUSPD*TNVHL+19 (bus cycles)
LoopCOP: equ 6 ;COP is serviced when LoopCOP reaches
; to zero
;*********************************************************************
;* JUMP TABLE
;*********************************************************************
org JumpTable
ByteGet: jmp GetByte ;receive one byte data from a host
BytePut: jmp PutByte ;send one byte data to a host
RNGRDVR: jmp RDVRRNG ;read/verify FLASH data
RNGEERA: jmp ERARNGE ;erase FLASH
RNGEPRG: jmp PRGRNGE ;program FLASH
NUSDEL: jmp DELNUS ;generate delay
**********************************************************************
* ROUTINES
**********************************************************************
org FlashROM