📄 clr_alg.lst
字号:
DSPA -S -l -v2xx clr_alg.asm
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:09 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
clr_alg.asm PAGE 1
1 ;--------------------------------------------------------------------------------------------------
2 ; Filename : CLR_ALG.ASM
3 ; Last Modified : 25 May 2001.
4 ; Version : 1.0
5 ; Originator : Texas Instruments, DSP Digital Control Systems Group.
6 ;--------------------------------------------------------------------------------------------------
7 ; Description:
8 ;
9 ; This file contains the implementation of the core algorithm for clearing the LF240x Flash. This
10 ; algorithm is generic to any sector, and performs the pre-erase conditioning for the flash module
11 ; on these parts.
12 ;--------------------------------------------------------------------------------------------------
13 ;--------------------------------------------------------------------------------------------------
14 ; Revision History
15 ;
16 ; Ver 1.0 (25 May 2001)
17 ;
18 ; Comments: Derived from previous source code. Several modifications in place for
19 ; enhanced embeddability.
20 ;--------------------------------------------------------------------------------------------------
21 ;--------------------------------------------------------------------------------------------------
22
23 .def CLEAR_FLASH
24
25 ;--------------------------------------------------------------------------------------------------
26 ; Symbols imported by this file
27 ;--------------------------------------------------------------------------------------------------
28 .include "..\include\var.h"
29 .include "..\include\rundefs.h"
30
31 ;--------------------------------------------------------------------------------------------------
32 ; Program sections generated by this file:
33 ; All code in this algorithm implementation is assembled into the named section 'ALG_Text".
34 ; Any relocation sensitive code is placed in the named
35 ; section 'CSPL_text'.
36 ;--------------------------------------------------------------------------------------------------
37 0000 .sect "CLR_text"
38
39 ;--------------------------------------------------------------------------------------------------
40 ; Define macros to set the Flash Mode.
41 ; ACCESS_REGS gives access to the Flash Registers in the Pgm Mem Space and ACCESS_ARRAY gives
42 ; access to the Flash ARRAY in Pgm Mem Space.
43 ;--------------------------------------------------------------------------------------------------
44 ACCESS_REGS .macro
45 OUT 07fh,0ff0fh
46 .endm
47
48 ACCESS_ARRAY .macro
49 IN 07fh,0ff0fh
50 .endm
51
52 ;--------------------------------------------------------------------------------------------------
53 ; Define Short DELAY loop macro.
54 ; This will be used to generate a short delay upto 256 cycles.
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:09 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
clr_alg.asm PAGE 2
55 ;--------------------------------------------------------------------------------------------------
56 SDELAY .macro COUNT
57 RPT COUNT
58 NOP
59 .endm
60 ;--------------------------------------------------------------------------------------------------
61 ; CLEAR_FLASH:
62 ;
63 ; This function is the user level interface to the implementation of the clear algorithm for
64 ; pre-erase conditioning of the TMS320LF2407 flash array.
65 ; This function is desginated as a LEVEL_1 subroutine.
66 ;--------------------------------------------------------------------------------------------------
67 0000 CLEAR_FLASH: ;Call label for asm client applications.
68 0000 _clearFlash: ;Call label for C client applications.
69
70 0000 .label ClearAlgoStartMain
71
72
73 0000 bc00! LDP #flashAlgoVars.ADDR ;Set the DP to the flash algo vars.
74
75 0001 SECTOR_0:
76 0001 100e! LACC flashAlgoVars.SECTOR_CMD ;Get the sector processing command.
77 0002 bfb0 AND #000Fh ;Mask out unwanted bits.
0003 000f
78
79 0004 e388 BCND NO_SECTORS,EQ ;If no sectors are set, then goto
0005 003c+
80 ;error reporting routine.
81
82 0006 be0a SFR ;Get Bit 0.
83 0007 900e! SACL flashAlgoVars.SECTOR_CMD ;Store the rest of the command back.
84 ;--------------------------------------------------------------------------------------------------
85 0008 e301 BCND SECTOR_1,NC ;If bit 0 is set, clear sector 0.
0009 0012+
86
87 000a ae07! SPLK #0000h,flashAlgoVars.FL_SECST ;Set up first addr of sector 0.
000b 0000
88 000c ae08! SPLK #0FFFh,flashAlgoVars.FL_SECEND ;Set up last addr of sector 0.
000d 0fff
89 000e ae0d! SPLK #0001h,flashAlgoVars.SECTOR_KEY ;Pass the sector enable key.
000f 0001
90 0010 7a80 CALL CLEAR_SECTOR ;Call clear_sector to clear sector 0.
0011 0044+
91 ;--------------------------------------------------------------------------------------------------
92 0012 SECTOR_1:
93 0012 100e! LACC flashAlgoVars.SECTOR_CMD ;Get the sector processing command.
94 0013 be0a SFR ;Mask out unwanted bits.
95 0014 900e! SACL flashAlgoVars.SECTOR_CMD ;Store the rest of the command back.
96 0015 e301 BCND SECTOR_2,NC ;If bit 1 is set, clear sector 1.
0016 001f+
97
98 0017 ae07! SPLK #1000h,flashAlgoVars.FL_SECST ;Set up first addr of sector 1.
0018 1000
99 0019 ae08! SPLK #3FFFh,flashAlgoVars.FL_SECEND ;Set up last addr of sector 1.
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:09 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
clr_alg.asm PAGE 3
001a 3fff
100 001b ae0d! SPLK #0002h,flashAlgoVars.SECTOR_KEY ;Pass the sector enable key.
001c 0002
101 001d 7a80 CALL CLEAR_SECTOR ;Call clear_sector to clear
001e 0044+
102 ; Sector 1 if requested
103 ;--------------------------------------------------------------------------------------------------
104
105
106 001f SECTOR_2:
107 001f 100e! LACC flashAlgoVars.SECTOR_CMD ;Get the sector processing command.
108 0020 be0a SFR ;Mask out unwanted bits.
109 0021 900e! SACL flashAlgoVars.SECTOR_CMD ;Store the rest of the command back.
110 0022 e301 BCND SECTOR_3,NC ;If bit 2 is set, clear sector 2.
0023 002c+
111
112 0024 ae07! SPLK #4000h,flashAlgoVars.FL_SECST ;Set up first address of sector 2.
0025 4000
113 0026 ae08! SPLK #6FFFh,flashAlgoVars.FL_SECEND ;Set up last address of sector 2.
0027 6fff
114 0028 ae0d! SPLK #0004h,flashAlgoVars.SECTOR_KEY ;Pass the sector enable key.
0029 0004
115 002a 7a80 CALL CLEAR_SECTOR ;Call clear_sector to clear sector 2.
002b 0044+
116
117 002c SECTOR_3:
118 002c 100e! LACC flashAlgoVars.SECTOR_CMD ;Get the sector processing command.
119 002d be0a SFR ;Mask out unwanted bits.
120 002e 900e! SACL flashAlgoVars.SECTOR_CMD ;Store the rest of the command back.
121 002f e301 BCND SECTORS_DONE,NC ;If bit 3 is set, clear sector 3.
0030 0039+
122
123 0031 ae07! SPLK #7000h,flashAlgoVars.FL_SECST ;Set up first address of sector 3.
0032 7000
124 0033 ae08! SPLK #7FFFh,flashAlgoVars.FL_SECEND ;Set up last address of sector 3.
0034 7fff
125 0035 ae0d! SPLK #0008h,flashAlgoVars.SECTOR_KEY ;Pass the sector enable key.
0036 0008
126 0037 7a80 CALL CLEAR_SECTOR ;Call clear_sector to clear sector 3.
0038 0044+
127
128 0039 SECTORS_DONE:
129 0039 ae0f! SPLK #0,flashAlgoVars.ALGO_STATUS ;No errors encountered.
003a 0000
130 003b ef00 RET
131
132 003c NO_SECTORS:
133 003c ae0f! SPLK #10,flashAlgoVars.ALGO_STATUS ;No sectors specified for clear.
003d 000a
134 003e ef00 RET
135
136 003f ERROR1:
137 ;--------------------------------------------------------------------------------------------------
138 ; IMPORTANT NOTE:
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:09 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
clr_alg.asm PAGE 4
139 ;
140 ; This code is executed in LEVEL_3, during a call to CLR_LOOP (which is a LEVEL_3 routine).
141 ; This routine is returning control to the LEVEL_0 (Caller's level). So it is performing the
142 ; function of a LEVEL_1 routine.
143 ; So, It is EXTREMELY important that this routine adjust the stack depth by the proper amount.
144 ; This routine must therefore remove two (2) words from the stack.
145 ;--------------------------------------------------------------------------------------------------
146 003f 8a01! POPD flashAlgoVars.PAD ;Adjust stack depth 1.
147 0040 8a01! POPD flashAlgoVars.PAD ;Adjust stack depth 2.
148
149 0041 ae0f! SPLK #1,flashAlgoVars.ALGO_STATUS ;Error encountered in CLEAR.
0042 0001
150 0043 ef00 RET
151
152 ;--------------------------------------------------------------------------------------------------
153 ; CLEAR_SECTOR:
154 ;
155 ; This function is the implementation of the clear algorithm for the pre-erase preconditioning of
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -