Texas Instruments TMS320F20x/F24x DSP Computer Drive User Manual


 
Assembly Source for Algorithms
PRELIMINARY
A-13
Assembly Source Listings and Program Examples
PRELIMINARY
***** If here, then an error has occurred.
EXIT SPLK #1,ERROR ;Update error flag
SPLK #STOP,BASE_0 ;Stop command.
CALL SET_MODE ;Disable any flash cmds.
B DONE ;Get outa here.
************************************************************
.page
**************************************************
* SET_MODE: This routine sets the flash in the *
* mode specified by the contents of BASE_0. This *
* can be used for VER0,VER1,INVERASE, or STOP. *
* AR6: Parameter passed to DELAY. *
**************************************************
SET_MODE
CALL REGS ;ACCESS FLASH REGS
LACL FL_ST ;ACC => SEG_CTR.
TBLW BASE_0 ;Activate MODE.
LAR AR6,#D10 ;SET DELAY
CALL DELAY,*,AR6 ;WAIT *
CALL ARRAY ;ACCESS FLASH ARRAY *
RET
************************************************
* INV_ERASE: This routine is used to check for *
* depletion in the flash array. *
* AR2 Used for main banz loop *
* BASE_0 Parameter passed to Set_mode *
* BASE_1 Used for flash address *
* BASE_2 Used for flash data *
************************************************
INV_ERASE
SPLK #INV_ER,BASE_0
CALL SET_MODE ;Set inverse–erase mode.
BLDD #FL_ST,BASE_1;Array start address.
LAR AR2,#31 ;Loop count.
MAR *,AR2
NEXT_IVERS
LACL BASE_1 ;Get address.
TBLR BASE_2 ;Dummy read.
TBLR BASE_2 ;Read data.
ADD #1 ;Increment address.
SACL BASE_1 ;Save address.
ZAC
ADD BASE_2 ;Add data.
BCND EXIT,NEQ ;If ACC<>0, then fail.
*Else continue, until until done with row.
BANZ NEXT_IVERS ;Loop 32 times.
SPLK #STOP,BASE_0 ;Stop command.
CALL SET_MODE ;Disable any flash cmds.
RET ;If here then test passed.
.page
*************************************************************
* ERASE_A: This subroutine applies one erase pulse to the *
* flash array. *