
PRELIMINARY
;**Variables included from flash algorithms.
| .include ºsvar20.hº | ;Variable declarations | |
| .ref | GCLR | ;References clear algo. | 
| .ref | GPGMJ | ;References program algo. | 
| .ref | GERS | ;References erase algo. | 
| .ref | FLWS | ;References flash±write algo. | 
| ;**Parameters used by flash algorithms. | ||
| .def | PRG_bufaddr, PRG_paddr | |
| .def | PRG_length, PARMS | |
| .def | SEG_ST,SEG_END,PROTECT | |
*************************************************************
| VARS: .usect ºPRG_dataº,16 ;This is an uninitialized data | * | 
| ;section required by the standard * | |
| ;flash algos for temporary | * | 
| ;variables. Pointers to this | * | 
| ;space are hardcoded in SVAR20.H, * | |
| ;and variables are init'd at | * | 
| ;run time. | * | 
*************************************************************
| PARMS: .usect ºPRG_parmº,10 ;This is an uninitialized data | * | 
| ;section used for temporary | * | 
| ;variables and for passing | * | 
| ;parameters to the flash | * | 
| ;algorithms. | * | 
*************************************************************
PROTECT .set PARMS ;Segment enable bits.*
*************************************************************
*****Parameters needed for Programming algorithm. ********
*************************************************************
| PRG_bufaddr | .set | PARMS+1 | ;Addr of buffer for pgm data | * | 
| PRG_paddr | .set | PARMS+2 | ;First flash addr to program | * | 
| PRG_length | .set | PARMS+3 | ;Length of block to program | * | 
*************************************************************
**Parameters needed for CLEAR, ERASE, and FLW algorithms. *
*************************************************************
| SEG_ST | .set | PARMS+4 | ;Segment | start address. | * | 
| SEG_END | .set | PARMS+5 | ;Segment | end address. | * | 
*************************************************************
****Other misc variables.****
*************************************************************
| ERS_COUNT .set | PARMS+6 | ;Used | for erase fail count. | * | |
| SV_AR1 | .set | PARMS+7 | ;Used | to save AR1. | * | 
**************************************************************
.sect ºPRG_textº
**********************************************************
| * | function erase(PROTECT,SEG_ST,SEG_END) | * | 
| * Status is returned in the accumulator. | * | |
| * | 0 = Fail,1 = Pass | * | 
**********************************************************
| * | This function performs the clear and erase operation | * | 
| * | on the 'F2XX flash. If the erase operation fails, the * | |
| * | flash±write operation is used to try to recover from | * | 
| * | depletion. If the array recovers, the entire process | * | 
| * | (clr+ers+flw) is repeated a maximum of 10 times. The | * | 
| * | return value indicates the status. If this function | * | 
| PRELIMINARY |