📄 era_alg.lst
字号:
DSPA -S -l -v2xx era_alg.asm
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:10 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
era_alg.asm PAGE 1
1 ;--------------------------------------------------------------------------------------------------
2 ; Filename : ERA_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 ERASING the TMS320LF240x Flash.
10 ; This algorithm is generic to any sector, and performs the pre-erase conditioning for the flash
11 ; module 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 ;--------------------------------------------------------------------------------------------------
24 ; Symbols exported from this file
25 ;--------------------------------------------------------------------------------------------------
26 .globl ERASE_FLASH
27
28 ;--------------------------------------------------------------------------------------------------
29 ; Import symbols (and other information) from VAR.H
30 ;--------------------------------------------------------------------------------------------------
31 .include "..\include\var.h"
32
33 .include "..\include\rundefs.h"
34
35 ;--------------------------------------------------------------------------------------------------
36 ; Program sections generated by this file:
37 ; All code in this algorithm implementation is assembled into the named
38 ; section 'ALG_Text". Any relocation sensitive code is placed in the named
39 ; section 'ESPL_text'.
40 ;--------------------------------------------------------------------------------------------------
41 0000 .sect "ERA_text"
42 ;--------------------------------------------------------------------------------------------------
43 ; Define macros to set the Flash Mode.
44 ; ACCESS_REGS gives access to the Flash Registers in the Pgm Mem Space
45 ; and ACCESS_ARRAY gives access to the Flash ARRAY in Pgm Mem Space.
46 ;
47 ;--------------------------------------------------------------------------------------------------
48 ACCESS_REGS .macro
49 OUT 07fh,0ff0fh
50 .endm
51
52 ACCESS_ARRAY .macro
53 IN 07fh,0ff0fh
54 .endm
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:10 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
era_alg.asm PAGE 2
55
56 ;--------------------------------------------------------------------------------------------------
57 ; Define Short DELAY loop macro.
58 ; This will be used to generate a short delay upto 256 cycles.
59 ;--------------------------------------------------------------------------------------------------
60 SDELAY .macro COUNT
61 RPT COUNT
62 NOP
63 .endm
64 ;--------------------------------------------------------------------------------------------------
65 ; ERASE_FLASH: Implementation of the user call for the flash erase routine. Call this with a valid
66 ; sector mask in flashAlgoVars.SECTOR_MASK to erase any sector combination in the flash.
67 ;--------------------------------------------------------------------------------------------------
68
69 0000 .label EraseAlgoStartMain
70
71 0000 ERASE_FLASH: ; Call label for assembly-language client applications.
72 0000 _eraseFlash: ; Call label for C-language client applications.
73
74 0000 bc00! LDP #flashAlgoVars.ADDR ;Set the DP to the flash algo vars.
75
76 0001 SECTOR_0:
77 0001 100e! LACC flashAlgoVars.SECTOR_CMD ;Get the sector processing command.
78 0002 bfb0 AND #000Fh ;Mask out unwanted bits.
0003 000f
79
80 0004 e388 BCND NO_SECTORS,EQ ;If no sectors are set, then goto
0005 003c+
81 ;error reporting routine.
82
83 0006 be0a SFR ;Get Bit 0.
84 0007 900e! SACL flashAlgoVars.SECTOR_CMD ;Store the rest of the command back.
85 ;--------------------------------------------------------------------------------------------------
86 0008 e301 BCND SECTOR_1,NC ;If bit 0 is set, clear sector 0.
0009 0012+
87
88 000a ae07! SPLK #0000h,flashAlgoVars.FL_SECST ;Set up first addr of sector 0.
000b 0000
89 000c ae08! SPLK #0FFFh,flashAlgoVars.FL_SECEND ;Set up last addr of sector 0.
000d 0fff
90 000e ae0d! SPLK #0001h,flashAlgoVars.SECTOR_KEY ;Pass the sector enable key.
000f 0001
91 0010 7a80 CALL ERASE_SECTOR ;Call clear_sector to clear sector 0.
0011 0043+
92 ;--------------------------------------------------------------------------------------------------
93 0012 SECTOR_1:
94 0012 100e! LACC flashAlgoVars.SECTOR_CMD ;Get the sector processing command.
95 0013 be0a SFR ;Mask out unwanted bits.
96 0014 900e! SACL flashAlgoVars.SECTOR_CMD ;Store the rest of the command back.
97 0015 e301 BCND SECTOR_2,NC ;If bit 1 is set, clear sector 1.
0016 001f+
98
99 0017 ae07! SPLK #1000h,flashAlgoVars.FL_SECST ;Set up first addr of sector 1.
0018 1000
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:10 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
era_alg.asm PAGE 3
100 0019 ae08! SPLK #3FFFh,flashAlgoVars.FL_SECEND ;Set up last addr of sector 1.
001a 3fff
101 001b ae0d! SPLK #0002h,flashAlgoVars.SECTOR_KEY ;Pass the sector enable key.
001c 0002
102 001d 7a80 CALL ERASE_SECTOR ;Call clear_sector to clear
001e 0043+
103 ; Sector 1 if requested
104 ;--------------------------------------------------------------------------------------------------
105
106
107 001f SECTOR_2:
108 001f 100e! LACC flashAlgoVars.SECTOR_CMD ;Get the sector processing command.
109 0020 be0a SFR ;Mask out unwanted bits.
110 0021 900e! SACL flashAlgoVars.SECTOR_CMD ;Store the rest of the command back.
111 0022 e301 BCND SECTOR_3,NC ;If bit 2 is set, clear sector 2.
0023 002c+
112
113 0024 ae07! SPLK #4000h,flashAlgoVars.FL_SECST ;Set up first address of sector 2.
0025 4000
114 0026 ae08! SPLK #6FFFh,flashAlgoVars.FL_SECEND ;Set up last address of sector 2.
0027 6fff
115 0028 ae0d! SPLK #0004h,flashAlgoVars.SECTOR_KEY ;Pass the sector enable key.
0029 0004
116 002a 7a80 CALL ERASE_SECTOR ;Call clear_sector to clear sector 2.
002b 0043+
117
118 002c SECTOR_3:
119 002c 100e! LACC flashAlgoVars.SECTOR_CMD ;Get the sector processing command.
120 002d be0a SFR ;Mask out unwanted bits.
121 002e 900e! SACL flashAlgoVars.SECTOR_CMD ;Store the rest of the command back.
122 002f e301 BCND SECTORS_DONE,NC ;If bit 3 is set, clear sector 3.
0030 0039+
123
124 0031 ae07! SPLK #7000h,flashAlgoVars.FL_SECST ;Set up first address of sector 3.
0032 7000
125 0033 ae08! SPLK #7FFFh,flashAlgoVars.FL_SECEND ;Set up last address of sector 3.
0034 7fff
126 0035 ae0d! SPLK #0008h,flashAlgoVars.SECTOR_KEY ;Pass the sector enable key.
0036 0008
127 0037 7a80 CALL ERASE_SECTOR ;Call clear_sector to clear sector 3.
0038 0043+
128
129 0039 SECTORS_DONE:
130 0039 ae0f! SPLK #0,flashAlgoVars.ALGO_STATUS ;No errors encountered.
003a 0000
131 003b ef00 RET
132
133 003c NO_SECTORS:
134 003c ae0f! SPLK #11,flashAlgoVars.ALGO_STATUS ;No sectors specified for erase.
003d 000b
135 003e ef00 RET
136
137 003f 8a01! ERROR1: POPD flashAlgoVars.PAD ;Adjust stack depth.
138 0040 ae0f! SPLK #2,flashAlgoVars.ALGO_STATUS ;Error encountered in ERASE.
TMS320C24xx COFF Assembler Version 7.02 Tue Jul 29 10:56:10 2003
Copyright (c) 1987-2002 Texas Instruments Incorporated
era_alg.asm PAGE 4
0041 0002
139 0042 ef00 RET
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -