📄 era_alg.lst
字号:
140
141 ;--------------------------------------------------------------------------------------------------
142 ; ERASE_SECTOR:
143 ;--------------------------------------------------------------------------------------------------
144 ; This function is the implementation of the erase algorithm for the pre-program
145 ; conditioning of the flash array. This function is desginated as a LEVEL_1
146 ; subroutine.
147 ;--------------------------------------------------------------------------------------------------
148 0043 ERASE_SECTOR:
149 0043 ae05! SPLK #MX_ECNT,flashAlgoVars.PLS_CNT ;Initialize the program pulse count.
0044 09c4
150 0045 ae03! SPLK #0ffffh,flashAlgoVars.DATA ;Load 0ffffh for compare.
0046 ffff
151
152 0047 a800! BLDD #flashAlgoVars.FL_SECST,flashAlgoVars.ADDR ;Point address to the start of sector.
0048 0007!
153 0049 ae06! SPLK #0000,flashAlgoVars.LASTVER ;Initialize LASTVERIFY Flag
004a 0000
154 ;--------------------------------------------------------------------------------------------------
155 ; ENABLE
156 ;--------------------------------------------------------------------------------------------------
157 ; Enable the flash for erase:
158 ; To accept commands the following must happen:
159 ; 1. Place the flash in the register mode.
160 ; 2. Copy the sector key to the SECT register.
161 ; 3. Enable the core by setting Bit 0 of the ENAB Register
162 ;--------------------------------------------------------------------------------------------------
163 004b ENABLE: ACCESS_REGS ;Put the flash in register mode.
1 004b 0c7f OUT 07fh,0ff0fh
004c ff0f
164
165 004d bf80 LACC #SECT ;Enable sector.
004e 0006
166 004f a801! BLDD #flashAlgoVars.SECTOR_KEY,flashAlgoVars.PAD ;Copy the sector key
0050 000d!
167 0051 a701! TBLW flashAlgoVars.PAD ;
168 ;
169 0052 bf80 LACC #ENAB ;Enable core.
0053 0005
170 0054 ae01! SPLK #0001h,flashAlgoVars.PAD ;
0055 0001
171 0056 a701! TBLW flashAlgoVars.PAD ;
172
173 0057 7980 B ERVER ;Enter erase loop from the erase verify.
0058 0082+
174
175 ;--------------------------------------------------------------------------------------------------
176 ; PERASE:
177 ;--------------------------------------------------------------------------------------------------
178 ; This loop erases the sector, based on the address passed by the caller in
179 ; flashAlgoVars.FL_SECST.
180 ;--------------------------------------------------------------------------------------------------
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:10 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
era_alg.asm PAGE 5
181 0059 PERASE:
182 0059 1005! LACC flashAlgoVars.PLS_CNT ;Get the pulse counter value.
183 005a e388 BCND ERROR,EQ ;If remaining pulses == 0 then
005b 00b0+
184 ;commence the error handling.
185 ;--------------------------------------------------------------------------------------------------
186 005c bf80 LACC #WADDR ;The sector is selected by writing
005d 0002
187 ;WADDR with the first address of
188 ;the sector
189 005e 7a80 CALL SETWADDR ;Execute the write to WADDR.
005f 0000+
190
191 0060 bf80 LACC #WDATA ;Load the WDATA register with 0xffff.
0061 0003
192 0062 a703! TBLW flashAlgoVars.DATA
193 ;--------------------------------------------------------------------------------------------------
194 0063 bf80 LACC #CTRL ;Setup the erase mode.
0064 0001
195 0065 ae01! SPLK #0001,flashAlgoVars.PAD
0066 0001
196 0067 a701! TBLW flashAlgoVars.PAD
197 ;--------------------------------------------------------------------------------------------------
198 0068 SDELAY #T_esu_er ;T_esu(ER) Delay.
1 0068 bb3a RPT #T_esu_er
1 0069 8b00 NOP
199 ;--------------------------------------------------------------------------------------------------
200 006a bf80 LACC #PMPC ;Activate the erase mode.
006b 0000
201 006c ae01! SPLK #0005h,flashAlgoVars.PAD
006d 0005
202 006e a701! TBLW flashAlgoVars.PAD
203 ;--------------------------------------------------------------------------------------------------
204 006f b78d EPW: LAR AR7,#ERASE_PULSE ;Call the delay routine to define the
205 0070 7a8f CALL DELAY,AR7 ;erase pulse width to T_erase(E)
0071 0127+
206 ;--------------------------------------------------------------------------------------------------
207 0072 ae04! SPLK #0000h,flashAlgoVars.PAD1 ;De-activate the erase mode.
0073 0000
208 0074 7a80 CALL CLRCMD
0075 011f+
209 ;--------------------------------------------------------------------------------------------------
210 0076 SDELAY #T_eh_er ;T_eh(ER) ;Algo delay.
1 0076 bbb2 RPT #T_eh_er
1 0077 8b00 NOP
211 ;--------------------------------------------------------------------------------------------------
212 0078 bf80 LACC #CTRL ;Exit the Erase mode.
0079 0001
213 007a ae01! SPLK #0000,flashAlgoVars.PAD
007b 0000
214 007c a701! TBLW flashAlgoVars.PAD
215 ;--------------------------------------------------------------------------------------------------
216 007d SDELAY #Teh_C ;Wait in normal mode.
1 007d bb3a RPT #Teh_C
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:10 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
era_alg.asm PAGE 6
1 007e 8b00 NOP
217 ;--------------------------------------------------------------------------------------------------
218 007f 1005! LACC flashAlgoVars.PLS_CNT ;Advance the erase pulse counter.
219 0080 ba01 SUB #1h
220 0081 9005! SACL flashAlgoVars.PLS_CNT
221 ;--------------------------------------------------------------------------------------------------
222 ; ERVER: ERASE Verify
223 ;--------------------------------------------------------------------------------------------------
224 ; This subroutine checks the flash to see if the flash is erased.
225 ; To do this it does the followign steps:
226 ; 1. Reads the flash array in erase verify mode.
227 ; 2. Branches to the Erase routine if a word is non-FFFFh
228 ; 3. If all the words in the sector are ffffh then it transfers control
229 ; to PASSERVER.
230 ;--------------------------------------------------------------------------------------------------
231 0082 a800! ERVER: BLDD #flashAlgoVars.FL_SECST,flashAlgoVars.ADDR ;Init ADDR to first location in sector.
0083 0007!
232
233 0084 bf80 B0 LACC #CTRL ;Init the Erase verify mode.
0085 0001
234 0086 ae01! SPLK #0002,flashAlgoVars.PAD
0087 0002
235 0088 a701! TBLW flashAlgoVars.PAD
236 0089 SDELAY #T_eva_e ;T_eva(E) ; Algo Delay.
1 0089 bb01 RPT #T_eva_e
1 008a 8b00 NOP
237
238 008b B1
239
240 008b 7a80 CALL READWORD ;Read out the word in erase ver mode.
008c 00b6+
241
242 008d COMPARE:
243 008d 6902! LACL flashAlgoVars.READ ;Check to see if the word read out is
244 008e bfd0 XOR #0FFFFh ;0ffffh.
008f ffff
245 0090 e308 BCND PROCEED_TO_ERASE,NEQ ;If not, then proceed to apply an erase
0091 009b+
246 ;pulse to the sector.
247
248 0092 1000! LACC flashAlgoVars.ADDR ;See if the current address is
249 0093 3008! SUB flashAlgoVars.FL_SECEND ;end-of-sector. If so, transfer control
250 0094 e388 BCND PASSERVER,EQ ;to PASSERVER.
0095 00a4+
251
252 0096 2008! ADD flashAlgoVars.FL_SECEND ;Increment the ADDR counter variable.
253 0097 b801 ADD #1 ;to next address
254 0098 9000! SACL flashAlgoVars.ADDR ;Store back incremented variable.
255
256 0099 7980 B B1 ;Proceed to check the next word.
009a 008b+
257
258 009b PROCEED_TO_ERASE:
259
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:10 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
era_alg.asm PAGE 7
260 009b bf80 LACC #CTRL ;Exit the Erase verify mode.
009c 0001
261 009d ae01! SPLK #0000,flashAlgoVars.PAD
009e 0000
262 009f a701! TBLW flashAlgoVars.PAD
263
264 00a0 SDELAY #Tevh_C ;Wait in normal mode.
1 00a0 bb3a RPT #Tevh_C
1 00a1 8b00 NOP
265
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -