📄 usbddriver.lst
字号:
127 pConfiguration = pDriver->pDescriptors->pHsConfiguration;
\ 0000001C 14009015 LDRNE R0,[R0, #+20]
128 }
129 else {
130
131 pConfiguration = pDriver->pDescriptors->pFsConfiguration;
\ 00000020 04009005 LDREQ R0,[R0, #+4]
132 }
133
134 // Check current configuration for power mode (if device is configured)
135 if (pDriver->cfgnum != 0) {
\ 00000024 0810D4E5 LDRB R1,[R4, #+8]
\ 00000028 000051E3 CMP R1,#+0
\ 0000002C 0400000A BEQ ??GetDeviceStatus_0
136
137 if (USBConfigurationDescriptor_IsSelfPowered(pConfiguration)) {
\ 00000030 ........ BL USBConfigurationDescriptor_IsSelfPowered
\ 00000034 000050E3 CMP R0,#+0
138
139 data |= 1;
\ 00000038 B000DD11 LDRHNE R0,[SP, #+0]
\ 0000003C 01008013 ORRNE R0,R0,#0x1
\ 00000040 B000CD11 STRHNE R0,[SP, #+0]
140 }
141 }
142
143 // Check if remote wake-up is enabled
144 if (pDriver->isRemoteWakeUpEnabled) {
\ ??GetDeviceStatus_0:
\ 00000044 0900D4E5 LDRB R0,[R4, #+9]
\ 00000048 000050E3 CMP R0,#+0
145
146 data |= 2;
\ 0000004C B000DD11 LDRHNE R0,[SP, #+0]
\ 00000050 02008013 ORRNE R0,R0,#0x2
\ 00000054 B000CD11 STRHNE R0,[SP, #+0]
147 }
148
149 // Send the device status
150 USBD_Write(0, &data, 2, 0, 0);
\ 00000058 08D04DE2 SUB SP,SP,#+8
\ 0000005C 0000A0E3 MOV R0,#+0
\ 00000060 00008DE5 STR R0,[SP, #+0]
\ 00000064 0030A0E3 MOV R3,#+0
\ 00000068 0220A0E3 MOV R2,#+2
\ 0000006C 08108DE2 ADD R1,SP,#+8
\ 00000070 ........ BL USBD_Write
\ 00000074 08D08DE2 ADD SP,SP,#+8 ;; stack cleaning
151 }
\ 00000078 1C40BDE8 POP {R2-R4,LR}
\ 0000007C 1EFF2FE1 BX LR ;; return
152
153 //------------------------------------------------------------------------------
154 /// Sends the current status of an endpoints to the USB host.
155 /// \param bEndpoint Endpoint number.
156 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
157 static void GetEndpointStatus(unsigned char bEndpoint)
158 {
\ GetEndpointStatus:
\ 00000000 01402DE9 PUSH {R0,LR}
159 unsigned short data = 0;
\ 00000004 0020A0E3 MOV R2,#+0
\ 00000008 B020CDE1 STRH R2,[SP, #+0]
160
161 // Check if the endpoint exists
162 if (bEndpoint > BOARD_USB_NUMENDPOINTS) {
\ 0000000C 090050E3 CMP R0,#+9
\ 00000010 0200003A BCC ??GetEndpointStatus_0
163
164 USBD_Stall(0);
\ 00000014 0000A0E3 MOV R0,#+0
\ 00000018 ........ BL USBD_Stall
\ 0000001C 0B0000EA B ??GetEndpointStatus_1
165 }
166 else {
167
168 // Check if the endpoint if currently halted
169 if (USBD_IsHalted(bEndpoint)) {
\ ??GetEndpointStatus_0:
\ 00000020 ........ BL USBD_IsHalted
\ 00000024 000050E3 CMP R0,#+0
170
171 data = 1;
\ 00000028 0110A013 MOVNE R1,#+1
\ 0000002C B010CD11 STRHNE R1,[SP, #+0]
172 }
173
174 // Send the endpoint status
175 USBD_Write(0, &data, 2, 0, 0);
\ 00000030 08D04DE2 SUB SP,SP,#+8
\ 00000034 0000A0E3 MOV R0,#+0
\ 00000038 00008DE5 STR R0,[SP, #+0]
\ 0000003C 0030A0E3 MOV R3,#+0
\ 00000040 0220A0E3 MOV R2,#+2
\ 00000044 08108DE2 ADD R1,SP,#+8
\ 00000048 ........ BL USBD_Write
\ 0000004C 08D08DE2 ADD SP,SP,#+8 ;; stack cleaning
176 }
177 }
\ ??GetEndpointStatus_1:
\ 00000050 ........ B ??Subroutine0_1
178
179 //------------------------------------------------------------------------------
180 /// Sends the requested USB descriptor to the host if available, or STALLs the
181 /// request.
182 /// \param pDriver Pointer to a USBDDriver instance.
183 /// \param type Type of the requested descriptor
184 /// \param index Index of the requested descriptor.
185 /// \param length Maximum number of bytes to return.
186 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
187 static void GetDescriptor(
188 const USBDDriver *pDriver,
189 unsigned char type,
190 unsigned char index,
191 unsigned int length)
192 {
\ GetDescriptor:
\ 00000000 F14F2DE9 PUSH {R0,R4-R11,LR}
\ 00000004 00B0A0E1 MOV R11,R0
\ 00000008 0140A0E1 MOV R4,R1
\ 0000000C 0250A0E1 MOV R5,R2
\ 00000010 0360A0E1 MOV R6,R3
193 const USBDeviceDescriptor *pDevice;
194 const USBConfigurationDescriptor *pConfiguration;
195 const USBDeviceQualifierDescriptor *pQualifier;
196 const USBConfigurationDescriptor *pOtherSpeed;
197 const USBGenericDescriptor **pStrings =
198 (const USBGenericDescriptor **) pDriver->pDescriptors->pStrings;
\ 00000014 00109BE5 LDR R1,[R11, #+0]
\ 00000018 201091E5 LDR R1,[R1, #+32]
\ 0000001C 00108DE5 STR R1,[SP, #+0]
199 unsigned char numStrings = pDriver->pDescriptors->numStrings;
\ 00000020 00009BE5 LDR R0,[R11, #+0]
\ 00000024 2470D0E5 LDRB R7,[R0, #+36]
200 const USBGenericDescriptor *pString;
201
202 // Use different set of descriptors depending on device speed
203 if (USBD_IsHighSpeed()) {
\ 00000028 ........ BL USBD_IsHighSpeed
\ 0000002C 000050E3 CMP R0,#+0
\ 00000030 00009BE5 LDR R0,[R11, #+0]
\ 00000034 0400000A BEQ ??GetDescriptor_1
204
205 TRACE_DEBUG("HS ");
206 pDevice = pDriver->pDescriptors->pHsDevice;
\ 00000038 108090E5 LDR R8,[R0, #+16]
207 pConfiguration = pDriver->pDescriptors->pHsConfiguration;
\ 0000003C 149090E5 LDR R9,[R0, #+20]
208 pQualifier = pDriver->pDescriptors->pHsQualifier;
\ 00000040 18A090E5 LDR R10,[R0, #+24]
209 pOtherSpeed = pDriver->pDescriptors->pHsOtherSpeed;
\ 00000044 1CB090E5 LDR R11,[R0, #+28]
\ 00000048 030000EA B ??GetDescriptor_2
210 }
211 else {
212
213 TRACE_DEBUG("FS ");
214 pDevice = pDriver->pDescriptors->pFsDevice;
\ ??GetDescriptor_1:
\ 0000004C 008090E5 LDR R8,[R0, #+0]
215 pConfiguration = pDriver->pDescriptors->pFsConfiguration;
\ 00000050 049090E5 LDR R9,[R0, #+4]
216 pQualifier = pDriver->pDescriptors->pFsQualifier;
\ 00000054 08A090E5 LDR R10,[R0, #+8]
217 pOtherSpeed = pDriver->pDescriptors->pFsOtherSpeed;
\ 00000058 0CB090E5 LDR R11,[R0, #+12]
218 }
219
220 // Check the descriptor type
221 switch (type) {
\ ??GetDescriptor_2:
\ 0000005C 010044E2 SUB R0,R4,#+1
\ 00000060 060050E3 CMP R0,#+6
\ 00000064 6000008A BHI ??GetDescriptor_3
\ 00000068 04108FE2 ADR R1,??GetDescriptor_0
\ 0000006C 0010D1E7 LDRB R1,[R1, R0]
\ 00000070 01F18FE0 ADD PC,PC,R1, LSL #+2
\ ??GetDescriptor_0:
\ 00000074 0111485D DC8 +1,+17,+72,+93
\ 00000078 5D213300 DC8 +93,+33,+51,+0
222
223 case USBGenericDescriptor_DEVICE:
224 TRACE_INFO_WP("Dev ");
\ ??GetDescriptor_4:
\ 0000007C ........ LDR R0,??DataTable1 ;; `?<Constant "Dev ">`
\ 00000080 ........ BL printf
225
226 // Adjust length and send descriptor
227 if (length > USBGenericDescriptor_GetLength((USBGenericDescriptor *) pDevice)) {
\ 00000084 0800A0E1 MOV R0,R8
\ 00000088 ........ BL USBGenericDescriptor_GetLength
\ 0000008C 060050E1 CMP R0,R6
\ 00000090 0200002A BCS ??GetDescriptor_5
228
229 length = USBGenericDescriptor_GetLength((USBGenericDescriptor *) pDevice);
\ 00000094 0800A0E1 MOV R0,R8
\ 00000098 ........ BL USBGenericDescriptor_GetLength
\ 0000009C 0060A0E1 MOV R6,R0
230 }
231 USBD_Write(0, pDevice, length, 0, 0);
\ ??GetDescriptor_5:
\ 000000A0 08D04DE2 SUB SP,SP,#+8
\ 000000A4 0000A0E3 MOV R0,#+0
\ 000000A8 00008DE5 STR R0,[SP, #+0]
\ 000000AC 0030A0E3 MOV R3,#+0
\ 000000B0 0620A0E1 MOV R2,R6
\ 000000B4 0810A0E1 MOV R1,R8
\ ??GetDescriptor_6:
\ 000000B8 320000EA B ??GetDescriptor_7
232 break;
233
234 case USBGenericDescriptor_CONFIGURATION:
235 TRACE_INFO_WP("Cfg ");
\ ??GetDescriptor_8:
\ 000000BC 40019FE5 LDR R0,??GetDescriptor_9 ;; `?<Constant "Cfg ">`
\ 000000C0 ........ BL printf
236
237 // Adjust length and send descriptor
238 if (length > USBConfigurationDescriptor_GetTotalLength(pConfiguration)) {
\ 000000C4 0900A0E1 MOV R0,R9
\ 000000C8 ........ BL USBConfigurationDescriptor_GetTotalLength
\ 000000CC 060050E1 CMP R0,R6
\ 000000D0 0200002A BCS ??GetDescriptor_10
239
240 length = USBConfigurationDescriptor_GetTotalLength(pConfiguration);
\ 000000D4 0900A0E1 MOV R0,R9
\ 000000D8 ........ BL USBConfigurationDescriptor_GetTotalLength
\ 000000DC 0060A0E1 MOV R6,R0
241 }
242 USBD_Write(0, pConfiguration, length, 0, 0);
\ ??GetDescriptor_10:
\ 000000E0 08D04DE2 SUB SP,SP,#+8
\ 000000E4 0000A0E3 MOV R0,#+0
\ 000000E8 00008DE5 STR R0,[SP, #+0]
\ 000000EC 0030A0E3 MOV R3,#+0
\ 000000F0 0620A0E1 MOV R2,R6
\ 000000F4 0910A0E1 MOV R1,R9
\ 000000F8 220000EA B ??GetDescriptor_7
243 break;
244
245 case USBGenericDescriptor_DEVICEQUALIFIER:
246 TRACE_INFO_WP("Qua ");
\ ??GetDescriptor_11:
\ 000000FC 04019FE5 LDR R0,??GetDescriptor_9+0x4 ;; `?<Constant "Qua ">`
\ 00000100 ........ BL printf
247
248 // Check if descriptor exists
249 if (!pQualifier) {
\ 00000104 00005AE3 CMP R10,#+0
\ 00000108 3A00000A BEQ ??GetDescriptor_12
250
251 USBD_Stall(0);
252 }
253 else {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -