📄 clr_alg.lst
字号:
156 ; the flash array. This function is desginated as a LEVEL_2 subroutine.
157 ;--------------------------------------------------------------------------------------------------
158 0044 CLEAR_SECTOR:
159 ;--------------------------------------------------------------------------------------------------
160 ; Enable the flash for programming:
161 ; To accept programming commands the following must happen:
162 ; 1. Place the flash in the register mode.
163 ; 2. Copy the sector key to the SECT register.
164 ; 3. Enable the core by setting Bit 0 of the ENAB Register
165 ;--------------------------------------------------------------------------------------------------
166 0044 ENABLE: ACCESS_REGS ;Put the flash in register mode.
1 0044 0c7f OUT 07fh,0ff0fh
0045 ff0f
167 0046 bf80 LACC #SECT ;Enable sector.
0047 0006
168
169 0048 a801! BLDD #flashAlgoVars.SECTOR_KEY,flashAlgoVars.PAD
0049 000d!
170 004a a701! TBLW flashAlgoVars.PAD
171
172 004b bf80 LACC #ENAB ;Enable core.
004c 0005
173 004d ae01! SPLK #0001h,flashAlgoVars.PAD ;
004e 0001
174 004f a701! TBLW flashAlgoVars.PAD ;
175 ;--------------------------------------------------------------------------------------------------
176 ; Next, the following steps are performed
177 ; 1. DATA is set to 0000h for use in the compare stage, since in clear the flash is set to all
178 ; words = 0000h.
179 ; 2. Calls the Level 2 routine CLR_LOOP to clear the sector user space.
180 ; 3. Calls the Level 2 routine CLR_LOOP to clear the sector base space.
181 ; This clears out any bits in the base sector space that were not mapped into the user space.
182 ; 4. It then calls the Level2 routine CLR_LOOP to clear the redundant
183 ; row bits, that were not mapped into the user space.
184 ;--------------------------------------------------------------------------------------------------
185 0050 ae03! SPLK #0000h,flashAlgoVars.DATA ;Load 0000h for compare.
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:09 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
clr_alg.asm PAGE 5
0051 0000
186 0052 ae09! SPLK #0000h,flashAlgoVars.FL_CMD ;Setup the routine to address the base space.
0053 0000
187 0054 ae0c! SPLK #0001H,flashAlgoVars.FAIL_CMD ;Setup the routine to fail if any bits in
0055 0001
188 ;the user space fail to clear.
189 0056 7a80 CALL CLR_LOOP ;Call the CLR_Loop routine to clear
0057 006c+
190 ;the user space.
191
192 0058 100d! LACC flashAlgoVars.SECTOR_KEY ;Get the sector key.
193 0059 bfb0 AND #0006H ;Mask out bits for sectors 0 and 3.
005a 0006
194 005b e388 BCND NO_RED_CLEAR,EQ ;Perform NOROWRED and PRECON steps only
005c 0069+
195 ;for sectors 1 and 2.
196
197 005d ae09! SPLK #0080h,flashAlgoVars.FL_CMD ;Setup the NOROWRED mode.
005e 0080
198 005f ae0c! SPLK #0000H,flashAlgoVars.FAIL_CMD ;Set up the routine to ingnore failure of
0060 0000
199 ;bits to program on MX_PCNT pulses.
200 0061 7a80 CALL CLR_LOOP ;Clear the base sector space (NOROWRED)
0062 006c+
201
202 0063 ae09! SPLK #0100h,flashAlgoVars.FL_CMD ;Setup the redundancy precondition mode.
0064 0100
203 0065 ae0c! SPLK #0000H,flashAlgoVars.FAIL_CMD ;Set up the routine to ingnore failure of
0066 0000
204 ;bits to program on MX_PCNT pulses.
205 0067 7a80 CALL CLR_LOOP ;Call the CLR_Loop routine to clear
0068 006c+
206 ;the redundant bits.
207 0069 NO_RED_CLEAR:
208 0069 7a80 CALL END1
006a 00e1+
209 006b ef00 RET
210
211 ;--------------------------------------------------------------------------------------------------
212 ; CLR_LOOP:
213 ;--------------------------------------------------------------------------------------------------
214 ; This function is desginated as a LEVEL_3 subroutine.
215 ;--------------------------------------------------------------------------------------------------
216 ; This function is the implementation for the clear loop. It reads the flash one word at a
217 ; time in PROGVER mode. It then compares this word to the word in DATA. In case of the this
218 ; algo, it is always 0000h. If then goes processes the next word if it is already zero,
219 ; else it enters BITMASK to form the bitmask for applying programming pulses to the Flash array.
220 ;--------------------------------------------------------------------------------------------------
221 006c CLR_LOOP:
222 006c ae05! SPLK #MX_PCNT,flashAlgoVars.PLS_CNT ;Initialize the program pulse count.
006d 00fa
223 006e a800! BLDD #flashAlgoVars.FL_SECST,flashAlgoVars.ADDR
006f 0007!
224 ;Initialize the address counter.
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:09 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
clr_alg.asm PAGE 6
225
226 0070 PGVERON:
227 0070 bf80 LACC #WADDR ;Load the WADDR Register with the address of
0071 0002
228 0072 7a80 CALL SETWADDR ;the word to be programmed.
0073 0000+
229
230 0074 1009! LACC flashAlgoVars.FL_CMD
231 0075 bfd0 XOR #0004h ;(PROGVER Command)Program Verification Command.
0076 0004
232 0077 9001! SACL flashAlgoVars.PAD
233
234 0078 bf80 LACC #CTRL ;Enter the PROGVER mode.
0079 0001
235 007a a701! TBLW flashAlgoVars.PAD
236 007b SDELAY #T_pvsu ;Wait for T_pvsu(P)
1 007b bb3a RPT #T_pvsu
1 007c 8b00 NOP
237
238 007d bf80 LACC #PMPC
007e 0000
239 007f ae01! SPLK #0005h,flashAlgoVars.PAD
0080 0005
240 0081 a701! TBLW flashAlgoVars.PAD ;Activate the PGVER Mode by writing to
241 ;PMPC.
242 0082 SDELAY #T_pva_e ;Wait T_pva(E)
1 0082 bb07 RPT #T_pva_e
1 0083 8b00 NOP
243 0084 7a80 CALL READWORD
0085 00da+
244
245 0086 PGVEROFF:
246 0086 ae04! SPLK #0000h,flashAlgoVars.PAD1 ;Clear out PMPC.
0087 0000
247 0088 7a80 CALL CLRCMD ;
0089 00e8+
248
249 008a SDELAY #Tpv_h_P ; Wait for Program verify hold time
1 008a bb3a RPT #Tpv_h_P
1 008b 8b00 NOP
250
251 008c ae04! SPLK #0001h,flashAlgoVars.PAD1 ;Clear out PMPC and CTRL
008d 0001
252 008e 7a80 CALL CLRCMD ;Since PMPC is cleared already, it is unchanged.
008f 00e8+
253
254 0090 SDELAY #Tpv_h_C ;Hold the normal read mode.
1 0090 bb3a RPT #Tpv_h_C
1 0091 8b00 NOP
255
256
257 0092 COMPARE:
258 0092 1002! LACC flashAlgoVars.READ ;Get the value of the word read out during
259 ;Program Verify.
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:09 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
clr_alg.asm PAGE 7
260 0093 bfc0 OR #0000h ;OR this value with 0000h
0094 0000
261 0095 e388 BCND NEXTWORD,EQ ;If == 0000h then this word (*ADDR) is
0096 00ad+
262 ;programmed, process the next word.
263 ;--------------------------------------------------------------------------------------------------
264 ; BITMASK:
265 ; This section forms the bitmask to write to the WDATA register.
266 ; READ contains the value read during program verify above,
267 ; and this is used to build the mask.
268 ; Once the mask is built, the sub-routine PROG is called.
269 ;--------------------------------------------------------------------------------------------------
270 ; Notes on building the mask:
271 ;
272 ; ** IMPORTANT: This mask building assumes processing is always to clear the
273 ; ** flash, i.e. the end value in the flash is assumed to be 0000h.
274 ; **
275 ;
276 ; This works as follows:
277 ; 1. Get the value read out during program verify.
278 ; 2. Any bits that are 0s should not get any more pulses. While any bits that are 1s
279 ; should get pulses.
280 ; 3. To apply pulses bits in the WDATA register should be 0s.
281 ; 4. XOR the read value with 0ffffh. This inverts all bits in the read value. So bits that
282 ; are 0s send 1s in the corresponding bits in WDATA and bits that are 1s send 0s in the
283 ; corresponding bits in WDATA.
284 ; 5. This ensures that prog applied pulses to those bits read out as 1s.
285 ;--------------------------------------------------------------------------------------------------
286 0097 1002! LACC flashAlgoVars.READ ;Get the value read during program verify
287 0098 bfd0 XOR #0ffffh ;Acc has the bits now to be written to WDATA.
0099 ffff
288 009a 9003! SACL flashAlgoVars.DATA,0 ;Store acc in flashAlgoVars.DATA
289 009b 7a80 CALL PROG ;Call the PROGRAM routine, that applies the
009c 00b9+
290 ;pulses.
291 ;--------------------------------------------------------------------------------------------------
292 ; PGCNT: Program Pulse Count Advance / Check:
293 ; 1. Advance the pulse counter.
294 ; 2. Check the pulse counter to see if this has exceeded limits.
295 ; 3. Error handling if (2) is true.
296 ;--------------------------------------------------------------------------------------------------
297 009d 1005! PGCNT: LACC flashAlgoVars.PLS_CNT ;Decrement the pulse counter
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -