Texas Instruments TMS320F20x/F24x DSP Computer Drive User Manual


 
C-Callable Interface to Flash Algorithms
PRELIMINARY
A-30
PRELIMINARY
ADD #1 ;Increment fail count.
SACL ERS_COUNT ;Save new count.
SUB #10 ;CHECK for max of 10.
BCND ers_error,GT ;If ers_cout>10 then hard fail.
CALL FLWS ;Else, try to recover from depletion.
LACL ERROR ;Check for FLASH–WRITE error.
BCND ers_error,neq ;If couldn’t recover, then hard fail.
B ers_loop ;Else, try erase again.
ers_error:
LACL #0 ;Error while erasing.
ers_done:
LAR AR1,SV_AR1 ;Restore AR1.
CLRC OVM ;Disable overflow.
********************************************
;Begin C Post Processing
mar *,ar1
sbrk #1
lar ar6,*– ;save FP
lar ar0,*– ;save ar6
pshd * ;pop return address, push on s/w stack
;End C Post Processing
ret
*****************END of _erase****************************
**********************************************************
* function program(PROTECT,PRG_bufaddr,PRG_paddr, *
* PRG_length) *
* Status will be returned in the accumulator. *
* 0 = Fail, 1 = Pass *
*********************************************************
* This function performs the program operation on the *
* ’F2XX flash. The values to be programmed will be read *
* from a buffer in data memory. The function can program*
* one to n words of flash in a single call; restricted *
* only by the data buffer size. If the function passes, *
* the flash was programmed correctly. The function is *
* controlled by the following parameter list: *
* 1)PROTECT –flash segments to protect. *
* 2)PRG_bufaddr –Start address of program buffer in *
* data memory. *
* 3)PRG_paddr –Start address of flash locations to *
* be programmed. *
* 4)PRG_length –Number of words to be programmed. *
* *
* To program 20 words of flash1 starting at address *
* 0x4020, from a buffer at 0x0800@data use this: *
* program(0xff00,0x0800,0x4020,20). *
*********************************************************
_program:
PRG_PARAMS .set 4
AR_STACK .set ar1
;**Parameters to be popped from s/w stack.
AR_PROTECT .set ar2
AR_bufaddr .set ar3
AR_paddr .set ar4
AR_length .set ar5