Texas Instruments TMS320F20x/F24x DSP Computer Drive User Manual


 
Assembly Source for Algorithms
PRELIMINARY
A-10
PRELIMINARY
A.1.3 Erase Algorithm, SERA20.ASM
This code is an implementation of the erase algorithm described in section 3.3
on page 3-10.
Memory section: fl_ers
Entry point: GERS
Parameters to be declared and initialized by the calling code are:
- PROTECT defines the values of bits 8–15 of SEG_CTR during the erase
algorithm.
- SEG_ST defines the start address of the flash array to be erased.
- SEG_END defines the end address of the flash array to be erased.
Return value: ERROR (@BASE+15); 0 = Pass, 1 = Fail
**************************************************************
* ERASE subroutine **
* **
* TMS320F2XX Flash Utilities. **
* Revision: 2.0, 9/10/97 **
* Revision: 2.1, 1/31/98 **
* **
* Filename: sera20.asm **
* **
* Called by: c2xx_bex.asm or flash application programs. **
* **
* !!CAUTION – INITIALIZE DP BEFORE CALLING THIS ROUTINE!! **
* **
* Function: Erases one or more contiguous segments of **
* flash array 0/1 as specified by the **
* following variables. **
* SEG_ST Segment start address **
* SEG_END Segment end address **
* PROTECT Sector protect enable **
* **
* The algorithm used is XOR–VER1, which means that in **
* addition to the VER1 read mode, an XOR readback is used **
* to gain more margin. During the read portion of the **
* erase, two reads are performed for each address; for the **
* first read, all address bits are complemented using a **
* logical XOR with the array end address. The data read **
* during the first read is discarded, and the second read **
* is performed on the actual address. This scheme **
* simulates the worst–case branching condition for code **
* executing from the flash array. **