📄 usb_core.s79
字号:
// 251 u32 wIndex0;
// 252 u32 rEP;
// 253
// 254 if ((pInformation->USBwValue != ENDPOINT_STALL)
// 255 || (pInformation->USBwIndex1 != 0))
LDRH R1,[R0, #+2]
CBNZ R1,??Standard_ClearFeature_2
LDRB R1,[R0, #+4]
CBZ R1,??Standard_ClearFeature_3
// 256 {
// 257 return USB_UNSUPPORT;
??Standard_ClearFeature_2:
MOVS R0,#+2
POP {R4-R6,PC}
// 258 }
// 259
// 260 pDev = &Device_Table;
// 261 wIndex0 = pInformation->USBwIndex0;
??Standard_ClearFeature_3:
LDRB R1,[R0, #+5]
// 262 rEP = wIndex0 & ~0x80;
MOVS R2,#+128
MOVS R4,R1
BICS R4,R4,R2
// 263 Related_Endpoint = ENDP0 + rEP;
// 264
// 265 if (ValBit(pInformation->USBwIndex0, 7))
LSLS R2,R1,#+24
BPL.N ??Standard_ClearFeature_4
// 266 {
// 267 /*Get Status of endpoint & stall the request if the related_ENdpoint
// 268 is Disabled*/
// 269 Status = _GetEPTxStatus(Related_Endpoint);
LDR.N R2,??DataTable26 ;; 0x40005c00
LDR R2,[R2, R4, LSL #+2]
ANDS R2,R2,#0x30
B.N ??Standard_ClearFeature_5
// 270 }
// 271 else
// 272 {
// 273 Status = _GetEPRxStatus(Related_Endpoint);
??Standard_ClearFeature_4:
LDR.N R2,??DataTable26 ;; 0x40005c00
LDR R2,[R2, R4, LSL #+2]
ANDS R2,R2,#0x3000
// 274 }
// 275
// 276 if ((rEP >= pDev->Total_Endpoint) || (Status == 0)
// 277 || (pInformation->Current_Configuration == 0))
??Standard_ClearFeature_5:
LDR.N R3,??DataTable25 ;; Device_Table
LDRB R3,[R3, #+0]
CMP R4,R3
BCS.N ??Standard_ClearFeature_2
CMP R2,#+0
BEQ.N ??Standard_ClearFeature_2
LDRB R0,[R0, #+10]
CMP R0,#+0
BEQ.N ??Standard_ClearFeature_2
// 278 {
// 279 return USB_UNSUPPORT;
// 280 }
// 281
// 282
// 283 if (wIndex0 & 0x80)
LDR.N R0,??DataTable26 ;; 0x40005c00
ADDS R5,R0,R4, LSL #+2
LSLS R0,R1,#+24
LDR R0,[R5, #+0]
BPL.N ??Standard_ClearFeature_6
// 284 {
// 285 /* IN endpoint */
// 286 if (_GetTxStallStatus(Related_Endpoint ))
ANDS R0,R0,#0x30
CMP R0,#+16
BNE.N ??Standard_ClearFeature_7
// 287 {
// 288 ClearDTOG_TX(Related_Endpoint);
MOVS R0,R4
_BLF ClearDTOG_TX,??ClearDTOG_TX??rT
// 289 SetEPTxStatus(Related_Endpoint, EP_TX_VALID);
MOVS R1,#+48
MOVS R0,R4
_BLF SetEPTxStatus,??SetEPTxStatus??rT
B.N ??Standard_ClearFeature_7
// 290 }
// 291 }
// 292 else
// 293 {
// 294 /* OUT endpoint */
// 295 if (_GetRxStallStatus(Related_Endpoint))
??Standard_ClearFeature_6:
ANDS R0,R0,#0x3000
CMP R0,#+4096
BNE.N ??Standard_ClearFeature_7
// 296 {
// 297 if (Related_Endpoint == ENDP0)
LDR.N R6,??DataTable27 ;; 0xbf8f
CBNZ R4,??Standard_ClearFeature_8
// 298 {
// 299 /* After clear the STALL, enable the default endpoint receiver */
// 300 SetEPRxCount(Related_Endpoint, Device_Property.MaxPacketSize);
LDR.N R0,??DataTable19 ;; Device_Property + 44
LDRB R1,[R0, #+0]
MOVS R0,#+0
_BLF SetEPRxCount,??SetEPRxCount??rT
// 301 _SetEPRxStatus(Related_Endpoint, EP_RX_VALID);
LDR.N R0,??DataTable26 ;; 0x40005c00
LDR R1,[R0, #+0]
ANDS R6,R6,R1
EORS R1,R6,#0x3000
STR R1,[R0, #+0]
B.N ??Standard_ClearFeature_7
// 302 }
// 303 else
// 304 {
// 305 ClearDTOG_RX(Related_Endpoint);
??Standard_ClearFeature_8:
MOVS R0,R4
_BLF ClearDTOG_RX,??ClearDTOG_RX??rT
// 306 _SetEPRxStatus(Related_Endpoint, EP_RX_VALID);
LDR R0,[R5, #+0]
ANDS R6,R6,R0
EORS R0,R6,#0x3000
STR R0,[R5, #+0]
// 307 }
// 308 }
// 309 }
// 310 pUser_Standard_Requests->User_ClearFeature();
??Standard_ClearFeature_7:
LDR.N R0,??DataTable30 ;; pUser_Standard_Requests
LDR R0,[R0, #+0]
LDR R0,[R0, #+20]
BLX R0
// 311 return USB_SUCCESS;
??Standard_ClearFeature_1:
MOVS R0,#+0
POP {R4-R6,PC} ;; return
CFI EndBlock cfiBlock6
// 312 }
// 313
// 314 return USB_UNSUPPORT;
// 315 }
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable19:
DC32 Device_Property + 44
// 316
// 317 /*******************************************************************************
// 318 * Function Name : Standard_SetEndPointFeature
// 319 * Description : Set or enable a specific feature of EndPoint
// 320 * Input : None.
// 321 * Output : None.
// 322 * Return : - Return USB_SUCCESS, if the request is performed.
// 323 * - Return USB_UNSUPPORT, if the request is invalid.
// 324 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock7 Using cfiCommon0
CFI Function Standard_SetEndPointFeature
THUMB
// 325 RESULT Standard_SetEndPointFeature(void)
// 326 {
// 327 u32 wIndex0;
// 328 u32 Related_Endpoint;
// 329 u32 rEP;
// 330 u32 Status;
// 331
// 332 wIndex0 = pInformation->USBwIndex0;
Standard_SetEndPointFeature:
LDR.N R0,??DataTable31 ;; pInformation
PUSH {R4,LR}
CFI ?RET Frame(CFA, -4)
CFI R4 Frame(CFA, -8)
CFI CFA R13+8
// 333 rEP = wIndex0 & ~0x80;
// 334 Related_Endpoint = ENDP0 + rEP;
MOVS R3,#+128
LDR R1,[R0, #+0]
LDRB R0,[R1, #+5]
MOVS R2,R0
BICS R2,R2,R3
// 335
// 336 if (ValBit(pInformation->USBwIndex0, 7))
LSLS R3,R0,#+24
BPL.N ??Standard_SetEndPointFeature_0
// 337 {
// 338 /* get Status of endpoint & stall the request if the related_ENdpoint
// 339 is Disabled*/
// 340 Status = _GetEPTxStatus(Related_Endpoint);
LDR.N R3,??DataTable26 ;; 0x40005c00
LDR R3,[R3, R2, LSL #+2]
ANDS R3,R3,#0x30
B.N ??Standard_SetEndPointFeature_1
// 341 }
// 342 else
// 343 {
// 344 Status = _GetEPRxStatus(Related_Endpoint);
??Standard_SetEndPointFeature_0:
LDR.N R3,??DataTable26 ;; 0x40005c00
LDR R3,[R3, R2, LSL #+2]
ANDS R3,R3,#0x3000
// 345 }
// 346
// 347 if (Related_Endpoint >= Device_Table.Total_Endpoint
// 348 || pInformation->USBwValue != 0 || Status == 0
// 349 || pInformation->Current_Configuration == 0)
??Standard_SetEndPointFeature_1:
LDR.N R4,??DataTable25 ;; Device_Table
LDRB R4,[R4, #+0]
CMP R2,R4
BCS.N ??Standard_SetEndPointFeature_2
LDRH R4,[R1, #+2]
CBNZ R4,??Standard_SetEndPointFeature_2
CBZ R3,??Standard_SetEndPointFeature_2
LDRB R1,[R1, #+10]
CBNZ R1,??Standard_SetEndPointFeature_3
// 350 {
// 351 return USB_UNSUPPORT;
??Standard_SetEndPointFeature_2:
MOVS R0,#+2
POP {R4,PC}
// 352 }
// 353 else
// 354 {
// 355 if (wIndex0 & 0x80)
??Standard_SetEndPointFeature_3:
LDR.N R1,??DataTable26 ;; 0x40005c00
ADDS R1,R1,R2, LSL #+2
LDR R2,[R1, #+0]
LSLS R0,R0,#+24
BPL.N ??Standard_SetEndPointFeature_4
// 356 {
// 357 /* IN endpoint */
// 358 _SetEPTxStatus(Related_Endpoint, EP_TX_STALL);
LDR.N R0,??Standard_SetEndPointFeature_5 ;; 0x8fbf
ANDS R0,R0,R2
EORS R0,R0,#0x10
B.N ??Standard_SetEndPointFeature_6
// 359 }
// 360
// 361 else
// 362 {
// 363 /* OUT endpoint */
// 364 _SetEPRxStatus(Related_Endpoint, EP_RX_STALL);
??Standard_SetEndPointFeature_4:
LDR.N R0,??DataTable27 ;; 0xbf8f
ANDS R0,R0,R2
EORS R0,R0,#0x1000
??Standard_SetEndPointFeature_6:
STR R0,[R1, #+0]
// 365 }
// 366 }
// 367 pUser_Standard_Requests->User_SetEndPointFeature();
LDR.N R0,??DataTable30 ;; pUser_Standard_Requests
LDR R0,[R0, #+0]
LDR R0,[R0, #+24]
BLX R0
// 368 return USB_SUCCESS;
MOVS R0,#+0
POP {R4,PC} ;; return
Nop
DATA
??Standard_SetEndPointFeature_5:
DC32 0x8fbf
CFI EndBlock cfiBlock7
// 369 }
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable25:
DC32 Device_Table
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable26:
DC32 0x40005c00
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable27:
DC32 0xbf8f
// 370
// 371 /*******************************************************************************
// 372 * Function Name : Standard_SetDeviceFeature.
// 373 * Description : Set or enable a specific feature of Device.
// 374 * Input : None.
// 375 * Output : None.
// 376 * Return : - Return USB_SUCCESS, if the request is performed.
// 377 * - Return USB_UNSUPPORT, if the request is invalid.
// 378 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock8 Using cfiCommon0
CFI Function Standard_SetDeviceFeature
THUMB
// 379 RESULT Standard_SetDeviceFeature(void)
// 380 {
// 381 SetBit(pInformation->Current_Feature, 5);
Standard_SetDeviceFeature:
LDR.N R0,??DataTable31 ;; pInformation
PUSH {LR}
CFI ?RET Frame(CFA, -4)
CFI CFA R13+4
LDR R0,[R0, #+0]
LDRB R1,[R0, #+9]
ORRS R1,R1,#0x20
STRB R1,[R0, #+9]
// 382 pUser_Standard_Requests->User_SetDeviceFeature();
LDR.N R0,??DataTable30 ;; pUser_Standard_Requests
LDR R0,[R0, #+0]
LDR R0,[R0, #+28]
BLX R0
// 383 return USB_SUCCESS;
MOVS R0,#+0
POP {PC} ;; return
CFI EndBlock cfiBlock8
// 384 }
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable30:
DC32 pUser_Standard_Requests
// 385
// 386 /*******************************************************************************
// 387 * Function Name : Standard_GetDescriptorData.
// 388 * Description : Standard_GetDescriptorData is used for descriptors transfer.
// 389 * : This routine is used for the descriptors resident in Flash
// 390 * or RAM
// 391 * pDesc can be in either Flash or RAM
// 392 * The purpose of this routine is to have a versatile way to
// 393 * response descriptors request. It allows user to generate
// 394 * certain descriptors with software or read descriptors from
// 395 * external storage part by part.
// 396 * Input : - Length - Length of the data in this transfer.
// 397 * - pDesc - A pointer points to descriptor struct.
// 398 * The structure gives the initial address of the descriptor and
// 399 * its original size.
// 400 * Output : None.
// 401 * Return : Address of a part of the descriptor pointed by the Usb_
// 402 * wOffset The buffer pointed by this address contains at least
// 403 * Length bytes.
// 404 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock9 Using cfiCommon0
CFI Function Standard_GetDescriptorData
THUMB
// 405 u8 *Standard_GetDescriptorData(u16 Length, ONE_DESCRIPTOR *pDesc)
// 406 {
// 407 u32 wOffset;
// 408
// 409 wOffset = pInformation->Ctrl_Info.Usb_wOffset;
Standard_GetDescriptorData:
LDR.N R2,??DataTable31 ;; pInformation
LDR R2,[R2, #+0]
LDRH R3,[R2, #+18]
// 410 if (Length == 0)
CBNZ R0,??Standard_GetDescriptorData_0
// 411 {
// 412 pInformation->Ctrl_Info.Usb_wLength = pDesc->Descriptor_Size - wOffset;
LDRH R0,[R1, #+4]
SUBS R0,R0,R3
STRH R0,[R2, #+16]
// 413 return 0;
MOVS R0,#+0
BX LR
// 414 }
// 415
// 416 return pDesc->Descriptor + wOffset;
??Standard_GetDescriptorData_0:
LDR R0,[R1, #+0]
ADDS R0,R0,R3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -