?? chap9.lst
字號:
1 .file "chap9.c"
2 .arch atmega16
3 __SREG__ = 0x3f
4 __SP_H__ = 0x3e
5 __SP_L__ = 0x3d
6 __tmp_reg__ = 0
7 __zero_reg__ = 1
8 .global __do_copy_data
9 .global __do_clear_bss
11 .text
12 .Ltext0:
106 .global EP2_RXDescr
107 .data
110 EP2_RXDescr:
111 0000 07 .byte 7
112 0001 05 .byte 5
113 0002 02 .byte 2
114 0003 02 .byte 2
115 0004 4000 .word 64
116 0006 0A .byte 10
117 .global EP2_TXDescr
120 EP2_TXDescr:
121 0007 07 .byte 7
122 0008 05 .byte 5
123 0009 82 .byte -126
124 000a 02 .byte 2
125 000b 4000 .word 64
126 000d 0A .byte 10
127 .global EP1_RXDescr
130 EP1_RXDescr:
131 000e 07 .byte 7
132 000f 05 .byte 5
133 0010 01 .byte 1
134 0011 03 .byte 3
135 0012 0400 .word 4
136 0014 0A .byte 10
137 .global EP1_TXDescr
140 EP1_TXDescr:
141 0015 07 .byte 7
142 0016 05 .byte 5
143 0017 81 .byte -127
144 0018 03 .byte 3
145 0019 0400 .word 4
146 001b 0A .byte 10
147 .global InterfaceDescr
150 InterfaceDescr:
151 001c 09 .byte 9
152 001d 04 .byte 4
153 001e 00 .byte 0
154 001f 00 .byte 0
155 0020 04 .byte 4
156 0021 DC .byte -36
157 0022 A0 .byte -96
158 0023 B0 .byte -80
159 0024 00 .byte 0
160 .global ConfigDescr
163 ConfigDescr:
164 0025 09 .byte 9
165 0026 02 .byte 2
166 0027 2E00 .word 46
167 0029 01 .byte 1
168 002a 01 .byte 1
169 002b 00 .byte 0
170 002c 80 .byte -128
171 002d C8 .byte -56
172 .global DeviceDescr
175 DeviceDescr:
176 002e 12 .byte 18
177 002f 01 .byte 1
178 0030 0001 .word 256
179 0032 DC .byte -36
180 0033 00 .byte 0
181 0034 00 .byte 0
182 0035 10 .byte 16
183 0036 7104 .word 1137
184 0038 FF0F .word 4095
185 003a 0001 .word 256
186 003c 00 .byte 0
187 003d 00 .byte 0
188 003e 02 .byte 2
189 003f 01 .byte 1
190 .global StandardDeviceRequest
193 StandardDeviceRequest:
194 0040 0000 .word pm(get_status)
195 0042 0000 .word pm(clear_feature)
196 0044 0000 .word pm(reserved)
197 0046 0000 .word pm(set_feature)
198 0048 0000 .word pm(reserved)
199 004a 0000 .word pm(set_address)
200 004c 0000 .word pm(get_descriptor)
201 004e 0000 .word pm(reserved)
202 0050 0000 .word pm(get_configuration)
203 0052 0000 .word pm(set_configuration)
204 0054 0000 .word pm(get_interface)
205 0056 0000 .word pm(set_interface)
206 0058 0000 .word pm(reserved)
207 005a 0000 .word pm(reserved)
208 005c 0000 .word pm(reserved)
209 005e 0000 .word pm(reserved)
210 .text
212 .global reserved
214 reserved:
1:chap9.c **** //********************************
2:chap9.c **** //標準設備請求處理chap9.c
3:chap9.c **** //編譯環境WinAVRGCC
4:chap9.c **** //2007-01-9
5:chap9.c **** //Hjxiang
6:chap9.c **** //********************************
7:chap9.c **** //標準C頭文件
8:chap9.c **** #include <stdint.h>
9:chap9.c **** #include <stdlib.h>
10:chap9.c **** //AVR頭文件
11:chap9.c **** #include <avr/io.h>
12:chap9.c **** #include <avr/signal.h>
13:chap9.c **** #include <avr/delay.h>
14:chap9.c **** //自定義頭文件
15:chap9.c **** #include "usb.h"
16:chap9.c **** #include "d12ic.h"
17:chap9.c **** #include "chap9.h"
18:chap9.c ****
19:chap9.c **** /**********************************
20:chap9.c **** USB標準請求程序調用到的子程序
21:chap9.c **** **********************************/
22:chap9.c **** //保留子程序
23:chap9.c **** void reserved(void)
24:chap9.c **** {
216 .LM1:
217 /* prologue: frame size=0 */
218 /* prologue end (size=0) */
25:chap9.c **** stall_ep0(); //返回STALL
220 .LM2:
221 0000 0E94 0000 call stall_ep0
222 /* epilogue: frame size=0 */
223 0004 0895 ret
224 /* epilogue end (size=1) */
225 /* function reserved size 3 (2) */
227 .Lscope0:
229 .global init_unconfig
231 init_unconfig:
26:chap9.c **** }
27:chap9.c **** //進入地址狀態,禁止0除外的所有端點
28:chap9.c **** void init_unconfig(void)
29:chap9.c **** {
233 .LM3:
234 /* prologue: frame size=0 */
235 /* prologue end (size=0) */
30:chap9.c **** D12_SetEndpointEnable(0); //禁止除0外的所有端點
237 .LM4:
238 0006 80E0 ldi r24,lo8(0)
239 0008 0E94 0000 call D12_SetEndpointEnable
240 /* epilogue: frame size=0 */
241 000c 0895 ret
242 /* epilogue end (size=1) */
243 /* function init_unconfig size 4 (3) */
245 .Lscope1:
247 .global init_config
249 init_config:
31:chap9.c **** }
32:chap9.c **** //配置處理,允許端點收發
33:chap9.c **** void init_config(void)
34:chap9.c **** {
251 .LM5:
252 /* prologue: frame size=0 */
253 /* prologue end (size=0) */
35:chap9.c **** D12_SetEndpointEnable(1); //允許端點收發
255 .LM6:
256 000e 81E0 ldi r24,lo8(1)
257 0010 0E94 0000 call D12_SetEndpointEnable
258 /* epilogue: frame size=0 */
259 0014 0895 ret
260 /* epilogue end (size=1) */
261 /* function init_config size 4 (3) */
263 .Lscope2:
267 .global single_transmit
269 single_transmit:
36:chap9.c **** }
37:chap9.c **** //通過端點索引1發送數據(Data類型)
38:chap9.c **** void single_transmit(unsigned char *buf,unsigned char len)
39:chap9.c **** {
271 .LM7:
272 /* prologue: frame size=0 */
273 /* prologue end (size=0) */
274 0016 AC01 movw r20,r24
40:chap9.c **** if(len <= EP0_PACKET_SIZE)
276 .LM8:
277 0018 6131 cpi r22,lo8(17)
278 001a 18F4 brsh .L4
41:chap9.c **** {
42:chap9.c **** D12_WriteEndpoint(1,len,buf);
280 .LM9:
281 001c 81E0 ldi r24,lo8(1)
282 001e 0E94 0000 call D12_WriteEndpoint
283 .L4:
284 0022 0895 ret
285 /* epilogue: frame size=0 */
286 /* epilogue: noreturn */
287 /* epilogue end (size=0) */
288 /* function single_transmit size 7 (7) */
290 .Lscope3:
294 .global code_transmit
296 code_transmit:
43:chap9.c **** }
44:chap9.c **** }
45:chap9.c **** //通過端點索引1發送數據(CODE類型)
46:chap9.c **** void code_transmit(unsigned char *pRomData,unsigned short len)
47:chap9.c **** {
298 .LM10:
299 /* prologue: frame size=0 */
300 /* prologue end (size=0) */
301 0024 AC01 movw r20,r24
48:chap9.c **** ControlData.wCount=0;
303 .LM11:
304 0026 1092 0000 sts (ControlData+10)+1,__zero_reg__
305 002a 1092 0000 sts ControlData+10,__zero_reg__
49:chap9.c **** if(ControlData.wLength>len)
307 .LM12:
308 002e 8091 0000 lds r24,ControlData+8
309 0032 9091 0000 lds r25,(ControlData+8)+1
310 0036 6817 cp r22,r24
311 0038 7907 cpc r23,r25
312 003a 20F4 brsh .L7
50:chap9.c **** ControlData.wLength=len; //發送數據長度控制
314 .LM13:
315 003c 7093 0000 sts (ControlData+8)+1,r23
316 0040 6093 0000 sts ControlData+8,r22
317 .L7:
51:chap9.c **** ControlData.pData=pRomData;
319 .LM14:
320 0044 5093 0000 sts (ControlData+12)+1,r21
321 0048 4093 0000 sts ControlData+12,r20
52:chap9.c **** if(ControlData.wLength>=EP0_PACKET_SIZE)
323 .LM15:
324 004c 8091 0000 lds r24,ControlData+8
325 0050 9091 0000 lds r25,(ControlData+8)+1
326 0054 4097 sbiw r24,16
327 0056 B0F0 brlo .L8
53:chap9.c **** {
54:chap9.c **** D12_WriteEndpoint(1,EP0_PACKET_SIZE,ControlData.pData);
329 .LM16:
330 0058 60E1 ldi r22,lo8(16)
331 005a 81E0 ldi r24,lo8(1)
332 005c 0E94 0000 call D12_WriteEndpoint
55:chap9.c **** ControlData.wCount += EP0_PACKET_SIZE;
334 .LM17:
335 0060 8091 0000 lds r24,ControlData+10
336 0064 9091 0000 lds r25,(ControlData+10)+1
337 0068 4096 adiw r24,16
338 006a 9093 0000 sts (ControlData+10)+1,r25
339 006e 8093 0000 sts ControlData+10,r24
56:chap9.c **** DISABLE;
341 .LM18:
342 /* #APP */
343 0072 F894 cli
57:chap9.c **** bEPPflags.bits.control_state=USB_TRANSMIT; //標志發送狀態
345 .LM19:
346 /* #NOAPP */
347 0074 8091 0000 lds r24,bEPPflags
348 0078 8F73 andi r24,lo8(63)
349 007a 8064 ori r24,lo8(64)
350 007c 8093 0000 sts bEPPflags,r24
58:chap9.c **** ENABLE;
352 .LM20:
353 /* #APP */
354 0080 7894 sei
355 /* #NOAPP */
356 0082 0895 ret
357 .L8:
59:chap9.c **** }
60:chap9.c **** else
61:chap9.c **** {
62:chap9.c **** D12_WriteEndpoint(1,ControlData.wLength,pRomData);
359 .LM21:
360 0084 6091 0000 lds r22,ControlData+8
361 0088 81E0 ldi r24,lo8(1)
362 008a 0E94 0000 call D12_WriteEndpoint
63:chap9.c **** ControlData.wCount += ControlData.wLength;
364 .LM22:
365 008e 8091 0000 lds r24,ControlData+10
366 0092 9091 0000 lds r25,(ControlData+10)+1
367 0096 2091 0000 lds r18,ControlData+8
368 009a 3091 0000 lds r19,(ControlData+8)+1
369 009e 820F add r24,r18
370 00a0 931F adc r25,r19
371 00a2 9093 0000 sts (ControlData+10)+1,r25
372 00a6 8093 0000 sts ControlData+10,r24
64:chap9.c **** DISABLE;
374 .LM23:
375 /* #APP */
376 00aa F894 cli
65:chap9.c **** bEPPflags.bits.control_state=USB_IDLE; //標志發送狀態
378 .LM24:
379 /* #NOAPP */
380 00ac 8091 0000 lds r24,bEPPflags
381 00b0 8F73 andi r24,lo8(63)
382 00b2 8093 0000 sts bEPPflags,r24
66:chap9.c **** ENABLE;
384 .LM25:
385 /* #APP */
386 00b6 7894 sei
387 /* #NOAPP */
388 00b8 0895 ret
389 /* epilogue: frame size=0 */
390 /* epilogue: noreturn */
391 /* epilogue end (size=0) */
392 /* function code_transmit size 80 (80) */
394 .Lscope4:
396 .global get_status
398 get_status:
67:chap9.c **** }
68:chap9.c **** }
69:chap9.c **** /**********************************
70:chap9.c **** USB標準請求服務子程序
71:chap9.c **** **********************************/
72:chap9.c **** //獲取狀態
73:chap9.c **** void get_status(void)
74:chap9.c **** {
400 .LM26:
401 /* prologue: frame size=2 */
402 00ba CF93 push r28
403 00bc DF93 push r29
404 00be CDB7 in r28,__SP_L__
405 00c0 DEB7 in r29,__SP_H__
406 00c2 2297 sbiw r28,2
407 00c4 0FB6 in __tmp_reg__,__SREG__
408 00c6 F894 cli
409 00c8 DEBF out __SP_H__,r29
410 00ca 0FBE out __SREG__,__tmp_reg__
411 00cc CDBF out __SP_L__,r28
412 /* prologue end (size=10) */
75:chap9.c **** unsigned char endp,txdat[2];
76:chap9.c **** unsigned char bRecipient=ControlData.DeviceRequest.bmRequestType & USB_RECIPIENT;
414 .LM27:
415 00ce 8091 0000 lds r24,ControlData
416 00d2 8F71 andi r24,lo8(31)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -