📄 usbddriver.lst
字号:
###############################################################################
# #
# 24/Apr/2009 16:18:16 #
# IAR ARM ANSI C/C++ Compiler V5.11.0.20622/W32 EVALUATION #
# Copyright 1999-2007 IAR Systems. All rights reserved. #
# #
# Cpu mode = arm #
# Endian = little #
# Source file = D:\basic-dataflash-project-at91sam7se-ek\at91lib\usb\dev #
# ice\core\USBDDriver.c #
# Command line = D:\basic-dataflash-project-at91sam7se-ek\at91lib\usb\dev #
# ice\core\USBDDriver.c -D at91sam7se512 -D sram -D #
# TRACE_LEVEL=4 -lC D:\basic-dataflash-project-at91sam7se- #
# ek\at91sam7se-ek\basic-dataflash-project\ewp\at91sam7se5 #
# 12_sram\List\ --remarks --diag_suppress Pe826,Pe1375 -o #
# D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
# asic-dataflash-project\ewp\at91sam7se512_sram\Obj\ #
# --no_cse --no_unroll --no_inline --no_code_motion #
# --no_tbaa --no_clustering --no_scheduling --debug #
# --endian little --cpu ARM7TDMI -e --fpu None #
# --dlib_config "D:\Program Files\arm\ARM\INC\DLib_Config_ #
# Full.h" -I D:\basic-dataflash-project-at91sam7se-ek\at91 #
# sam7se-ek\basic-dataflash-project\ewp\..\..\..\at91lib/p #
# eripherals\ -I D:\basic-dataflash-project-at91sam7se-ek\ #
# at91sam7se-ek\basic-dataflash-project\ewp\..\..\..\at91l #
# ib\ -I D:\basic-dataflash-project-at91sam7se-ek\at91sam7 #
# se-ek\basic-dataflash-project\ewp\..\..\..\at91lib/memor #
# ies\ -I D:\basic-dataflash-project-at91sam7se-ek\at91sam #
# 7se-ek\basic-dataflash-project\ewp\..\..\..\at91lib/boar #
# ds/at91sam7se-ek\ -I "D:\Program Files\arm\ARM\INC\" #
# --interwork --cpu_mode arm -Oh #
# List file = D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
# asic-dataflash-project\ewp\at91sam7se512_sram\List\USBDD #
# river.lst #
# Object file = D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
# asic-dataflash-project\ewp\at91sam7se512_sram\Obj\USBDDr #
# iver.o #
# #
# #
###############################################################################
D:\basic-dataflash-project-at91sam7se-ek\at91lib\usb\device\core\USBDDriver.c
1 /* ----------------------------------------------------------------------------
2 * ATMEL Microcontroller Software Support
3 * ----------------------------------------------------------------------------
4 * Copyright (c) 2008, Atmel Corporation
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * - Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the disclaimer below.
13 *
14 * Atmel's name may not be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * ----------------------------------------------------------------------------
28 */
29
30 //------------------------------------------------------------------------------
31 // Headers
32 //------------------------------------------------------------------------------
33
34 #include "USBDDriver.h"
35 #include "USBDDriverCallbacks.h"
36 #include "USBD.h"
37 #include <board.h>
38 #include <utility/trace.h>
39 #include <usb/common/core/USBGenericDescriptor.h>
40 #include <usb/common/core/USBDeviceDescriptor.h>
41 #include <usb/common/core/USBConfigurationDescriptor.h>
42 #include <usb/common/core/USBDeviceQualifierDescriptor.h>
43 #include <usb/common/core/USBEndpointDescriptor.h>
44 #include <usb/common/core/USBFeatureRequest.h>
45 #include <usb/common/core/USBSetAddressRequest.h>
46 #include <usb/common/core/USBGetDescriptorRequest.h>
47 #include <usb/common/core/USBSetConfigurationRequest.h>
48 #include <usb/common/core/USBInterfaceRequest.h>
49
50 #include <string.h>
\ In section .text, align 4
\ __??Code32?? __intrinsic __code __interwork void *memset(void *, int, size_t)
\ memset:
\ 00000000 10402DE9 PUSH {R4,LR}
\ 00000004 0040A0E1 MOV R4,R0
\ 00000008 0200A0E1 MOV R0,R2
\ 0000000C 0120A0E1 MOV R2,R1
\ 00000010 0010A0E1 MOV R1,R0
\ 00000014 0400A0E1 MOV R0,R4
\ 00000018 ........ BL __aeabi_memset
\ 0000001C 0400A0E1 MOV R0,R4
\ 00000020 1040BDE8 POP {R4,LR}
\ 00000024 1EFF2FE1 BX LR ;; return
51
52 //------------------------------------------------------------------------------
53 // Local functions
54 //------------------------------------------------------------------------------
55
56 //------------------------------------------------------------------------------
57 /// Configures the device by setting it into the Configured state and
58 /// initializing all endpoints.
59 /// \param pDriver Pointer to a USBDDriver instance.
60 /// \param cfgnum Configuration number to set.
61 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
62 static void SetConfiguration(USBDDriver *pDriver, unsigned char cfgnum)
63 {
\ SetConfiguration:
\ 00000000 70402DE9 PUSH {R4-R6,LR}
\ 00000004 28D04DE2 SUB SP,SP,#+40
\ 00000008 0040A0E1 MOV R4,R0
\ 0000000C 0150A0E1 MOV R5,R1
64 USBEndpointDescriptor *pEndpoints[BOARD_USB_NUMENDPOINTS+1];
65 const USBConfigurationDescriptor *pConfiguration;
66
67 // Use different descriptor depending on device speed
68 if (USBD_IsHighSpeed()) {
\ 00000010 ........ BL USBD_IsHighSpeed
\ 00000014 000050E3 CMP R0,#+0
\ 00000018 000094E5 LDR R0,[R4, #+0]
69
70 pConfiguration = pDriver->pDescriptors->pHsConfiguration;
\ 0000001C 14609015 LDRNE R6,[R0, #+20]
71 }
72 else {
73
74 pConfiguration = pDriver->pDescriptors->pFsConfiguration;
\ 00000020 04609005 LDREQ R6,[R0, #+4]
75 }
76
77 // Set & save the desired configuration
78 USBD_SetConfiguration(cfgnum);
\ 00000024 0500A0E1 MOV R0,R5
\ 00000028 ........ BL USBD_SetConfiguration
79 pDriver->cfgnum = cfgnum;
\ 0000002C 0850C4E5 STRB R5,[R4, #+8]
80
81 // If the configuration is not 0, configure endpoints
82 if (cfgnum != 0) {
\ 00000030 000055E3 CMP R5,#+0
\ 00000034 0B00000A BEQ ??SetConfiguration_0
83
84 // Parse configuration to get endpoint descriptors
85 USBConfigurationDescriptor_Parse(pConfiguration, 0, pEndpoints, 0);
\ 00000038 0030A0E3 MOV R3,#+0
\ 0000003C 0D20A0E1 MOV R2,SP
\ 00000040 0010A0E3 MOV R1,#+0
\ 00000044 0600A0E1 MOV R0,R6
\ 00000048 ........ BL USBConfigurationDescriptor_Parse
86
87 // Configure endpoints
88 int i = 0;
\ 0000004C 0D40A0E1 MOV R4,SP
\ 00000050 010000EA B ??SetConfiguration_1
89 while (pEndpoints[i] != 0) {
90
91 USBD_ConfigureEndpoint(pEndpoints[i]);
\ ??SetConfiguration_2:
\ 00000054 040094E4 LDR R0,[R4], #+4
\ 00000058 ........ BL USBD_ConfigureEndpoint
92 i++;
93 }
\ ??SetConfiguration_1:
\ 0000005C 000094E5 LDR R0,[R4, #+0]
\ 00000060 000050E3 CMP R0,#+0
\ 00000064 FAFFFF1A BNE ??SetConfiguration_2
94 }
95 // Should be done before send the ZLP
96 USBDDriverCallbacks_ConfigurationChanged(cfgnum);
\ ??SetConfiguration_0:
\ 00000068 0500A0E1 MOV R0,R5
\ 0000006C ........ BL USBDDriverCallbacks_ConfigurationChanged
97
98 // Acknowledge the request
99 USBD_Write(0, // Endpoint #0
100 0, // No data buffer
101 0, // No data buffer
102 (TransferCallback) 0,
103 (void *) 0);
\ 00000070 08D04DE2 SUB SP,SP,#+8
\ 00000074 0000A0E3 MOV R0,#+0
\ 00000078 00008DE5 STR R0,[SP, #+0]
\ 0000007C 0030A0E3 MOV R3,#+0
\ 00000080 0020A0E1 MOV R2,R0
\ 00000084 0010A0E1 MOV R1,R0
\ 00000088 ........ BL USBD_Write
\ 0000008C 08D08DE2 ADD SP,SP,#+8 ;; stack cleaning
104 }
\ 00000090 28D08DE2 ADD SP,SP,#+40 ;; stack cleaning
\ 00000094 7040BDE8 POP {R4-R6,LR}
\ 00000098 1EFF2FE1 BX LR ;; return
105
106 //------------------------------------------------------------------------------
107 /// Sends the current configuration number to the host.
108 /// \param pDriver Pointer to a USBDDriver instance.
109 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
110 static void GetConfiguration(const USBDDriver *pDriver)
111 {
\ GetConfiguration:
\ 00000000 01402DE9 PUSH {R0,LR}
112 USBD_Write(0, &(pDriver->cfgnum), 1, 0, 0);
\ 00000004 08D04DE2 SUB SP,SP,#+8
\ 00000008 0010A0E3 MOV R1,#+0
\ 0000000C 00108DE5 STR R1,[SP, #+0]
\ 00000010 0030A0E3 MOV R3,#+0
\ 00000014 0120A0E3 MOV R2,#+1
\ 00000018 081080E2 ADD R1,R0,#+8
\ 0000001C ........ B ?Subroutine0
113 }
\ In section .text, align 4, keep-with-next
\ ?Subroutine0:
\ 00000000 0300A0E1 MOV R0,R3
\ ??Subroutine0_0:
\ 00000004 ........ BL USBD_Write
\ 00000008 08D08DE2 ADD SP,SP,#+8 ;; stack cleaning
\ ??Subroutine0_1:
\ 0000000C 0050BDE8 POP {R12,LR}
\ 00000010 1EFF2FE1 BX LR ;; return
114
115 //------------------------------------------------------------------------------
116 /// Sends the current status of the device to the host.
117 /// \param pDriver Pointer to a USBDDriver instance.
118 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
119 static void GetDeviceStatus(const USBDDriver *pDriver)
120 {
\ GetDeviceStatus:
\ 00000000 13402DE9 PUSH {R0,R1,R4,LR}
\ 00000004 0040A0E1 MOV R4,R0
121 unsigned short data = 0;
\ 00000008 0010A0E3 MOV R1,#+0
\ 0000000C B010CDE1 STRH R1,[SP, #+0]
122 const USBConfigurationDescriptor *pConfiguration;
123
124 // Use different configuration depending on device speed
125 if (USBD_IsHighSpeed()) {
\ 00000010 ........ BL USBD_IsHighSpeed
\ 00000014 000050E3 CMP R0,#+0
\ 00000018 000094E5 LDR R0,[R4, #+0]
126
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -