usbddriver.lst
来自「ATmel的AT91sam7SE芯片 USB固件开发源代码」· LST 代码 · 共 1,117 行 · 第 1/5 页
LST
1,117 行
\ 000000B4 1C309FE5 LDR R3,??SetConfiguration_4 ;; USBDDriverCallbacks_ConfigurationChanged
\ 000000B8 0020A0E3 MOV R2,#+0
\ 000000BC 0010A0E3 MOV R1,#+0
\ 000000C0 0000A0E3 MOV R0,#+0
\ 000000C4 ........ BL USBD_Write
\ 000000C8 08D08DE2 ADD SP,SP,#+8 ;; stack cleaning
106 }
\ 000000CC 24D08DE2 ADD SP,SP,#+36 ;; stack cleaning
\ 000000D0 F040BDE8 POP {R4-R7,LR}
\ 000000D4 1EFF2FE1 BX LR ;; return
\ ??SetConfiguration_4:
\ 000000D8 ........ DC32 USBDDriverCallbacks_ConfigurationChanged
107
108 //------------------------------------------------------------------------------
109 /// Sends the current configuration number to the host.
110 /// \param pDriver Pointer to a USBDDriver instance.
111 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
112 static void GetConfiguration(const USBDDriver *pDriver)
113 {
\ GetConfiguration:
\ 00000000 10402DE9 PUSH {R4,LR}
\ 00000004 0040B0E1 MOVS R4,R0
114 USBD_Write(0, &(pDriver->cfgnum), 1, 0, 0);
\ 00000008 08D04DE2 SUB SP,SP,#+8
\ 0000000C 0000A0E3 MOV R0,#+0
\ 00000010 00008DE5 STR R0,[SP, #+0]
\ 00000014 0030A0E3 MOV R3,#+0
\ 00000018 0120A0E3 MOV R2,#+1
\ 0000001C 081094E2 ADDS R1,R4,#+8
\ 00000020 0000A0E3 MOV R0,#+0
\ 00000024 ........ BL USBD_Write
\ 00000028 08D08DE2 ADD SP,SP,#+8 ;; stack cleaning
115 }
\ 0000002C 1040BDE8 POP {R4,LR}
\ 00000030 1EFF2FE1 BX LR ;; return
116
117 //------------------------------------------------------------------------------
118 /// Sends the current status of the device to the host.
119 /// \param pDriver Pointer to a USBDDriver instance.
120 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
121 static void GetDeviceStatus(const USBDDriver *pDriver)
122 {
\ GetDeviceStatus:
\ 00000000 31402DE9 PUSH {R0,R4,R5,LR}
\ 00000004 0040B0E1 MOVS R4,R0
123 unsigned short data = 0;
\ 00000008 0010A0E3 MOV R1,#+0
\ 0000000C B010CDE1 STRH R1,[SP, #+0]
124 const USBConfigurationDescriptor *pConfiguration;
125
126 // Use different configuration depending on device speed
127 if (USBD_IsHighSpeed()) {
\ 00000010 ........ BL USBD_IsHighSpeed
\ 00000014 000050E3 CMP R0,#+0
\ 00000018 0300000A BEQ ??GetDeviceStatus_0
128
129 pConfiguration = pDriver->pDescriptors->pHsConfiguration;
\ 0000001C 000094E5 LDR R0,[R4, #+0]
\ 00000020 140090E5 LDR R0,[R0, #+20]
\ 00000024 0050B0E1 MOVS R5,R0
\ 00000028 020000EA B ??GetDeviceStatus_1
130 }
131 else {
132
133 pConfiguration = pDriver->pDescriptors->pFsConfiguration;
\ ??GetDeviceStatus_0:
\ 0000002C 000094E5 LDR R0,[R4, #+0]
\ 00000030 040090E5 LDR R0,[R0, #+4]
\ 00000034 0050B0E1 MOVS R5,R0
134 }
135
136 // Check current configuration for power mode (if device is configured)
137 if (pDriver->cfgnum != 0) {
\ ??GetDeviceStatus_1:
\ 00000038 0800D4E5 LDRB R0,[R4, #+8]
\ 0000003C 000050E3 CMP R0,#+0
\ 00000040 0600000A BEQ ??GetDeviceStatus_2
138
139 if (USBConfigurationDescriptor_IsSelfPowered(pConfiguration)) {
\ 00000044 0500B0E1 MOVS R0,R5
\ 00000048 ........ BL USBConfigurationDescriptor_IsSelfPowered
\ 0000004C 000050E3 CMP R0,#+0
\ 00000050 0200000A BEQ ??GetDeviceStatus_2
140
141 data |= 1;
\ 00000054 B000DDE1 LDRH R0,[SP, #+0]
\ 00000058 010090E3 ORRS R0,R0,#0x1
\ 0000005C B000CDE1 STRH R0,[SP, #+0]
142 }
143 }
144
145 // Check if remote wake-up is enabled
146 if (pDriver->isRemoteWakeUpEnabled) {
\ ??GetDeviceStatus_2:
\ 00000060 0900D4E5 LDRB R0,[R4, #+9]
\ 00000064 000050E3 CMP R0,#+0
\ 00000068 0200000A BEQ ??GetDeviceStatus_3
147
148 data |= 2;
\ 0000006C B000DDE1 LDRH R0,[SP, #+0]
\ 00000070 020090E3 ORRS R0,R0,#0x2
\ 00000074 B000CDE1 STRH R0,[SP, #+0]
149 }
150
151 // Send the device status
152 USBD_Write(0, &data, 2, 0, 0);
\ ??GetDeviceStatus_3:
\ 00000078 08D04DE2 SUB SP,SP,#+8
\ 0000007C 0000A0E3 MOV R0,#+0
\ 00000080 00008DE5 STR R0,[SP, #+0]
\ 00000084 0030A0E3 MOV R3,#+0
\ 00000088 0220A0E3 MOV R2,#+2
\ 0000008C 08108DE2 ADD R1,SP,#+8
\ 00000090 0000A0E3 MOV R0,#+0
\ 00000094 ........ BL USBD_Write
\ 00000098 08D08DE2 ADD SP,SP,#+8 ;; stack cleaning
153 }
\ 0000009C 3840BDE8 POP {R3-R5,LR}
\ 000000A0 1EFF2FE1 BX LR ;; return
154
155 //------------------------------------------------------------------------------
156 /// Sends the current status of an endpoints to the USB host.
157 /// \param eptnum Endpoint number.
158 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
159 static void GetEndpointStatus(unsigned char eptnum)
160 {
\ GetEndpointStatus:
\ 00000000 13402DE9 PUSH {R0,R1,R4,LR}
\ 00000004 0040B0E1 MOVS R4,R0
161 // Check if the endpoint exists
162 if (eptnum > BOARD_USB_NUMENDPOINTS) {
\ 00000008 FF4014E2 ANDS R4,R4,#0xFF ;; Zero extend
\ 0000000C 090054E3 CMP R4,#+9
\ 00000010 0200003A BCC ??GetEndpointStatus_0
163
164 USBD_Stall(0);
\ 00000014 0000A0E3 MOV R0,#+0
\ 00000018 ........ BL USBD_Stall
\ 0000001C 110000EA B ??GetEndpointStatus_1
165 }
166 else {
167
168 unsigned short data = 0;
\ ??GetEndpointStatus_0:
\ 00000020 0010A0E3 MOV R1,#+0
\ 00000024 B010CDE1 STRH R1,[SP, #+0]
169
170 // Check if the endpoint if currently halted
171 if (USBD_IsHalted(eptnum)) {
\ 00000028 0400B0E1 MOVS R0,R4
\ 0000002C FF0010E2 ANDS R0,R0,#0xFF ;; Zero extend
\ 00000030 ........ BL USBD_IsHalted
\ 00000034 000050E3 CMP R0,#+0
\ 00000038 0100000A BEQ ??GetEndpointStatus_2
172
173 data = 1;
\ 0000003C 0110A0E3 MOV R1,#+1
\ 00000040 B010CDE1 STRH R1,[SP, #+0]
174 }
175
176 // Send the endpoint status
177 USBD_Write(0, &data, 2, 0, 0);
\ ??GetEndpointStatus_2:
\ 00000044 08D04DE2 SUB SP,SP,#+8
\ 00000048 0000A0E3 MOV R0,#+0
\ 0000004C 00008DE5 STR R0,[SP, #+0]
\ 00000050 0030A0E3 MOV R3,#+0
\ 00000054 0220A0E3 MOV R2,#+2
\ 00000058 08108DE2 ADD R1,SP,#+8
\ 0000005C 0000A0E3 MOV R0,#+0
\ 00000060 ........ BL USBD_Write
\ 00000064 08D08DE2 ADD SP,SP,#+8 ;; stack cleaning
178 }
179 }
\ ??GetEndpointStatus_1:
\ 00000068 1C40BDE8 POP {R2-R4,LR}
\ 0000006C 1EFF2FE1 BX LR ;; return
180
181 //------------------------------------------------------------------------------
182 /// Sends the requested USB descriptor to the host if available, or STALLs the
183 /// request.
184 /// \param pDriver Pointer to a USBDDriver instance.
185 /// \param type Type of the requested descriptor
186 /// \param index Index of the requested descriptor.
187 /// \param length Maximum number of bytes to return.
188 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
189 static void GetDescriptor(
190 const USBDDriver *pDriver,
191 unsigned char type,
192 unsigned char index,
193 unsigned int length)
194 {
\ GetDescriptor:
\ 00000000 F24F2DE9 PUSH {R1,R4-R11,LR}
\ 00000004 08D04DE2 SUB SP,SP,#+8
\ 00000008 0040B0E1 MOVS R4,R0
\ 0000000C 0250B0E1 MOVS R5,R2
\ 00000010 0360B0E1 MOVS R6,R3
195 const USBDeviceDescriptor *pDevice;
196 const USBConfigurationDescriptor *pConfiguration;
197 const USBDeviceQualifierDescriptor *pQualifier;
198 const USBConfigurationDescriptor *pOtherSpeed;
199 const USBGenericDescriptor **pStrings =
200 (const USBGenericDescriptor **) pDriver->pDescriptors->pStrings;
\ 00000014 001094E5 LDR R1,[R4, #+0]
\ 00000018 201091E5 LDR R1,[R1, #+32]
\ 0000001C 04108DE5 STR R1,[SP, #+4]
201 unsigned char numStrings = pDriver->pDescriptors->numStrings;
\ 00000020 001094E5 LDR R1,[R4, #+0]
\ 00000024 2410D1E5 LDRB R1,[R1, #+36]
\ 00000028 0010CDE5 STRB R1,[SP, #+0]
202 const USBGenericDescriptor *pString;
203
204 // Use different set of descriptors depending on device speed
205 if (USBD_IsHighSpeed()) {
\ 0000002C ........ BL USBD_IsHighSpeed
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?