crc16.lst
来自「dsp tmslf2407a 汇编,c的原代码,包括i2c,scitimer,f」· LST 代码 · 共 451 行 · 第 1/2 页
LST
451 行
C:\tic2xx\c2000\cgtools\bin\dspa.exe -v2xx -s -x crc16.asm D:\DSP3_1205\crc16.obj -tC:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\crc16.tmp
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Thu Dec 8 11:06:28 2005
Copyright (c) 1987-1999 Texas Instruments Incorporated
crc16.asm PAGE 1
1 *******************************************************
2 * TMS320C2x/C2xx/C5x ANSI C Codegen Version 7.00
3 *******************************************************
4 ; C:\tic2xx\c2000\cgtools\bin\dspac.exe -v2xx crc16.c C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\crc16.if
5 ; dspopt NOT RUN
6 ; C:\tic2xx\c2000\cgtools\bin\dspcg.exe -o -v2xx -o C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\crc16.if C:\DOCUME~
7 .port
8 .file "crc16.c"
9 .file "global.h"
10 .globl _port8001
11 .file "crc16.c"
12 .globl _deviceAddr
13 .globl _pcdata
14 .globl _crc16Calculate
15 .globl _verifyType
16 .globl _chkCRC_re
17 0000 .text
18
19 .sym _crc16Calculate,_crc16Calculate,44,2,0
20 .globl _crc16Calculate
21
22 .func 20
23 ;>>>> uchar crc16Calculate(uchar *pBuf, uchar byLen)
24 ******************************************************
25 * FUNCTION DEF : _crc16Calculate
26 ******************************************************
27 0000 _crc16Calculate:
28
29 0000 LF1 .set 0
30
31 0000 8aa0 POPD *+
32 0001 80a0 SAR AR0,*+
33 0002 8180 SAR AR1,*
34 0003 b004 LARK AR0,4
35 0004 00ea LAR AR0,*0+,AR2
36
37 .sym _pBuf,-3+LF1,28,9,16
38 .sym _byLen,-4+LF1,12,9,16
39 .sym _current_crc_value,1,14,1,16
40 .sym _i,2,12,1,16
41 .sym _j,3,12,1,16
42 .line 2
43 ;>>>> unsigned int current_crc_value;
44 ;>>>> uchar i,j;
45 .line 6
46 ;>>>> current_crc_value = PRESET_VALUE;
47 0005 b201 LARK AR2,1
48 0006 8be0 MAR *0+
49 0007 aea0 SPLK #65535,*+
0008 ffff
50 .line 7
51 ;>>>> for(i=0;i<byLen;i++)
52 0009 b900 LACK 0
53 000a 9080 SACL *
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Thu Dec 8 11:06:28 2005
Copyright (c) 1987-1999 Texas Instruments Incorporated
crc16.asm PAGE 2
54 000b 6980 ZALS *
55 000c 7c06 SBRK 6-LF1
56 000d 6680 SUBS *
57 000e e38c BGEZ L2
000f 0043'
58 0010 7806 ADRK 6-LF1
59 0011 L1:
60 .line 9
61 ;>>>> current_crc_value = current_crc_value^pBuf[i];
62 0011 1080 LAC *
63 0012 7c05 SBRK 5-LF1
64 0013 2088 ADD * ,AR0
65 0014 9080 SACL *
66 0015 038b LAR AR3,* ,AR3
67 0016 108a LAC * ,AR2
68 0017 7804 ADRK 4-LF1
69 0018 6c80 XOR *
70 0019 9080 SACL *
71 .line 10
72 ;>>>> for(j=0;j<8;j++)
73 001a b900 LACK 0
74 001b 7802 ADRK 2
75 001c 9080 SACL *
76 001d 6980 ZALS *
77 001e ba08 SUBK 8
78 001f e38c BGEZ L4
0020 0038'
79 0021 7c02 SBRK 2
80 0022 L3:
81 .line 12
82 ;>>>> if(current_crc_value & 0x0001)
83 0022 4f80 BIT * ,15
84 0023 e200 BBZ L5
0024 002c'
85 .line 13
86 ;>>>> current_crc_value = (current_crc_value>>1)^POLYNOMIAL;
87 ;>>>> else
88 0025 be46 RSXM
89 0026 1e80 LAC * ,14
90 0027 bfdf XORK 33800,15
0028 8408
91 0029 9980 SACH * ,1
92 002a 7980 B L6
002b 002f'
93 002c L5:
94 .line 15
95 ;>>>> current_crc_value = (current_crc_value>>1);
96 002c be46 RSXM
97 002d 1e80 LAC * ,14
98 002e 9980 SACH * ,1
99 002f L6:
100 .line 10
101 002f 7802 ADRK 2
102 0030 1080 LAC *
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Thu Dec 8 11:06:28 2005
Copyright (c) 1987-1999 Texas Instruments Incorporated
crc16.asm PAGE 3
103 0031 b801 ADDK 1
104 0032 9080 SACL *
105 0033 6980 ZALS *
106 0034 ba08 SUBK 8
107 0035 7c02 SBRK 2
108 0036 e344 BLZ L3
0037 0022'
109 0038 L4:
110 .line 7
111 0038 b202 LARK AR2,2
112 0039 8be0 MAR *0+
113 003a 1080 LAC *
114 003b b801 ADDK 1
115 003c 9080 SACL *
116 003d 6980 ZALS *
117 003e 7c06 SBRK 6-LF1
118 003f 6680 SUBS *
119 0040 7806 ADRK 6-LF1
120 0041 e344 BLZ L1
0042 0011'
121 0043 L2:
122 .line 18
123 ;>>>> current_crc_value = ~current_crc_value;
124 0043 b201 LARK AR2,1
125 0044 8be0 MAR *0+
126 0045 1080 LAC *
127 0046 be01 CMPL
128 0047 9080 SACL *
129 .line 19
130 ;>>>> return(current_crc_value);
131 0048 6980 ZALS *
132 0049 EPI0_1:
133 .line 20
134 0049 8b89 MAR * ,AR1
135 004a 7c05 SBRK 5
136 004b 0090 LAR AR0,*-
137 004c 7680 PSHD *
138 004d ef00 RET
139
140 .endfunc 39,000000000H,4
141
142 .sym _verifyType,_verifyType,44,2,0
143 .globl _verifyType
144
145 .func 41
146 ;>>>> uchar verifyType()
147 ;>>>> uchar type;
148 ******************************************************
149 * FUNCTION DEF : _verifyType
150 ******************************************************
151 004e _verifyType:
152 004e 8aa0 POPD *+
153 004f 80a0 SAR AR0,*+
154 0050 8180 SAR AR1,*
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Thu Dec 8 11:06:28 2005
Copyright (c) 1987-1999 Texas Instruments Incorporated
crc16.asm PAGE 4
155 0051 b002 LARK AR0,2
156 0052 00e0 LAR AR0,*0+
157
158 .sym _type,1,12,1,16
159 .line 5
160 ;>>>> if( deviceAddr == pcdata[1] ){ type = 1;} /*地址合法*/
161 0053 bc00! LDPK _deviceAddr
162 0054 1000! LAC _deviceAddr
163 0055 bc00! LDPK _pcdata+1
164 0056 3001! SUB _pcdata+1
165 0057 e308 BNZ L7
0058 0060'
166 0059 b901 LACK 1
167 005a 8b8a MAR * ,AR2
168 005b b201 LARK AR2,1
169 005c 8be0 MAR *0+
170 005d 9080 SACL *
171 005e 7980 B L8
005f 007b'
172 0060 L7:
173 .line 6
174 ;>>>> else if(pcdata[1] == 0xfe) { type = 2;} /*广播地址*/
175 0060 1001! LAC _pcdata+1
176 0061 bafe SUBK 254
177 0062 e308 BNZ L9
0063 006b'
178 0064 b902 LACK 2
179 0065 8b8a MAR * ,AR2
180 0066 b201 LARK AR2,1
181 0067 8be0 MAR *0+
182 0068 9080 SACL *
183 0069 7980 B L8
006a 007b'
184 006b L9:
185 .line 7
186 ;>>>> else if(pcdata[1] == 0xff) { type = 3;} /**/
187 006b 1001! LAC _pcdata+1
188 006c baff SUBK 255
189 006d e308 BNZ L10
006e 0076'
190 006f b903 LACK 3
191 0070 8b8a MAR * ,AR2
192 0071 b201 LARK AR2,1
193 0072 8be0 MAR *0+
194 0073 9080 SACL *
195 0074 7980 B L8
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?