📄 usb_core.txt
字号:
0000b6 7800 LDRB r0,[r0,#0]
0000b8 0640 LSLS r0,r0,#25
0000ba d11f BNE |L12.252|
;;;752 {
;;;753 CopyRoutine = Standard_GetConfiguration;
0000bc 4934 LDR r1,|L12.400|
0000be e015 B |L12.236|
|L12.192|
;;;754 }
;;;755 }
;;;756 /*GET INTERFACE*/
;;;757 else if (Request_No == GET_INTERFACE)
0000c0 2a0a CMP r2,#0xa
0000c2 d11b BNE |L12.252|
;;;758 {
;;;759 if ((Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))
0000c4 7802 LDRB r2,[r0,#0]
0000c6 f002027f AND r2,r2,#0x7f
0000ca 2a01 CMP r2,#1
0000cc d116 BNE |L12.252|
;;;760 && (pInformation->Current_Configuration != 0) && (pInformation->USBwValue == 0)
0000ce 7a82 LDRB r2,[r0,#0xa]
0000d0 b1a2 CBZ r2,|L12.252|
0000d2 8842 LDRH r2,[r0,#2]
0000d4 b992 CBNZ r2,|L12.252|
;;;761 && (pInformation->USBwIndex1 == 0) && (pInformation->USBwLength == 0x0001)
0000d6 7902 LDRB r2,[r0,#4]
0000d8 b982 CBNZ r2,|L12.252|
0000da 88c2 LDRH r2,[r0,#6]
0000dc 2a01 CMP r2,#1
0000de d10d BNE |L12.252|
;;;762 && ((*pProperty->Class_Get_Interface_Setting)(pInformation->USBwIndex0, 0) == USB_SUCCESS))
0000e0 698a LDR r2,[r1,#0x18]
0000e2 7940 LDRB r0,[r0,#5]
0000e4 2100 MOVS r1,#0
0000e6 4790 BLX r2
0000e8 b940 CBNZ r0,|L12.252|
;;;763 {
;;;764 CopyRoutine = Standard_GetInterface;
0000ea 492a LDR r1,|L12.404|
|L12.236|
;;;765 }
;;;766
;;;767 }
;;;768
;;;769 if (CopyRoutine)
0000ec b131 CBZ r1,|L12.252|
;;;770 {
;;;771 pInformation->Ctrl_Info.Usb_wOffset = wOffset;
0000ee 6838 LDR r0,[r7,#0] ; pInformation
0000f0 8246 STRH r6,[r0,#0x12]
;;;772 pInformation->Ctrl_Info.CopyData = CopyRoutine;
;;;773 /* sb in the original the cast to word was directly */
;;;774 /* now the cast is made step by step */
;;;775 (*CopyRoutine)(0);
0000f2 6181 STR r1,[r0,#0x18]
0000f4 2000 MOVS r0,#0
0000f6 4788 BLX r1
;;;776 Result = USB_SUCCESS;
0000f8 2000 MOVS r0,#0
0000fa e00a B |L12.274|
|L12.252|
;;;777 }
;;;778 else
;;;779 {
;;;780 Result = (*pProperty->Class_Data_Setup)(pInformation->USBbRequest);
0000fc 6821 LDR r1,[r4,#0] ; pProperty
0000fe 6838 LDR r0,[r7,#0] ; pInformation
000100 6909 LDR r1,[r1,#0x10]
000102 7840 LDRB r0,[r0,#1]
000104 4788 BLX r1
;;;781 if (Result == USB_NOT_READY)
000106 2803 CMP r0,#3
000108 d103 BNE |L12.274|
;;;782 {
;;;783 pInformation->ControlState = PAUSE;
00010a 6838 LDR r0,[r7,#0] ; pInformation
00010c 7205 STRB r5,[r0,#8]
|L12.270|
;;;784 return;
;;;785 }
;;;786 }
;;;787
;;;788 if (pInformation->Ctrl_Info.Usb_wLength == 0xFFFF)
;;;789 {
;;;790 /* Data is not ready, wait it */
;;;791 pInformation->ControlState = PAUSE;
;;;792 return;
;;;793 }
;;;794 if ((Result == USB_UNSUPPORT) || (pInformation->Ctrl_Info.Usb_wLength == 0))
;;;795 {
;;;796 /* Unsupported request */
;;;797 pInformation->ControlState = STALLED;
;;;798 return;
;;;799 }
;;;800
;;;801
;;;802 if (ValBit(pInformation->USBbmRequestType, 7))
;;;803 {
;;;804 /* Device ==> Host */
;;;805 vu32 wLength = pInformation->USBwLength;
;;;806
;;;807 /* Restrict the data length to be the one host asks */
;;;808 if (pInformation->Ctrl_Info.Usb_wLength > wLength)
;;;809 {
;;;810 pInformation->Ctrl_Info.Usb_wLength = wLength;
;;;811 }
;;;812
;;;813 else if (pInformation->Ctrl_Info.Usb_wLength < pInformation->USBwLength)
;;;814 {
;;;815 if (pInformation->Ctrl_Info.Usb_wLength < pProperty->MaxPacketSize)
;;;816 {
;;;817 Data_Mul_MaxPacketSize = FALSE;
;;;818 }
;;;819 else if ((pInformation->Ctrl_Info.Usb_wLength % pProperty->MaxPacketSize) == 0)
;;;820 {
;;;821 Data_Mul_MaxPacketSize = TRUE;
;;;822 }
;;;823 }
;;;824
;;;825 pInformation->Ctrl_Info.PacketSize = pProperty->MaxPacketSize;
;;;826 DataStageIn();
;;;827 }
;;;828 else
;;;829 {
;;;830 pInformation->ControlState = OUT_DATA;
;;;831 vSetEPRxStatus(EP_RX_VALID); /* enable for next data reception */
;;;832 }
;;;833
;;;834 return;
;;;835 }
00010e e8bd81f0 POP {r4-r8,pc}
|L12.274|
000112 6839 LDR r1,[r7,#0] ;788 ; pInformation
000114 8a0a LDRH r2,[r1,#0x10] ;788
000116 f5a2437f SUB r3,r2,#0xff00 ;788
00011a 3bff SUBS r3,r3,#0xff ;788
00011c d101 BNE |L12.290|
00011e 720d STRB r5,[r1,#8] ;791
000120 e7f5 B |L12.270|
|L12.290|
000122 2802 CMP r0,#2 ;794
000124 d000 BEQ |L12.296|
000126 b912 CBNZ r2,|L12.302|
|L12.296|
000128 2008 MOVS r0,#8 ;797
00012a 7208 STRB r0,[r1,#8] ;797
00012c e7ef B |L12.270|
|L12.302|
00012e 7808 LDRB r0,[r1,#0] ;802
000130 0600 LSLS r0,r0,#24 ;802
000132 d51c BPL |L12.366|
000134 88c8 LDRH r0,[r1,#6] ;805
000136 4282 CMP r2,r0 ;808
000138 d901 BLS |L12.318|
00013a 8208 STRH r0,[r1,#0x10] ;810
00013c e00f B |L12.350|
|L12.318|
00013e d20e BCS |L12.350|
000140 6820 LDR r0,[r4,#0] ;815 ; pProperty
000142 4b15 LDR r3,|L12.408|
000144 f890002c LDRB r0,[r0,#0x2c] ;815
000148 4282 CMP r2,r0 ;815
00014a d201 BCS |L12.336|
00014c 701e STRB r6,[r3,#0] ;817 ; Data_Mul_MaxPacketSize
00014e e006 B |L12.350|
|L12.336|
000150 fbb2f5f0 UDIV r5,r2,r0 ;819
000154 fb002015 MLS r0,r0,r5,r2 ;819
000158 b908 CBNZ r0,|L12.350|
00015a 2001 MOVS r0,#1 ;821
00015c 7018 STRB r0,[r3,#0] ;821 ; Data_Mul_MaxPacketSize
|L12.350|
00015e 6820 LDR r0,[r4,#0] ;825 ; pProperty
000160 f890002c LDRB r0,[r0,#0x2c] ;825
000164 8288 STRH r0,[r1,#0x14] ;825
000166 e8bd41f0 POP {r4-r8,lr} ;826
00016a f7ffbffe B.W DataStageIn
|L12.366|
00016e 2003 MOVS r0,#3 ;830
000170 7208 STRB r0,[r1,#8] ;830
000172 490a LDR r1,|L12.412|
000174 0300 LSLS r0,r0,#12 ;831
000176 8008 STRH r0,[r1,#0] ;831 ; SaveRState
000178 e7c9 B |L12.270|
;;;836
ENDP
00017a 0000 DCW 0x0000
|L12.380|
00017c 00000000 DCD pInformation
|L12.384|
000180 00000000 DCD pProperty
|L12.388|
000184 00000000 DCD Standard_GetStatus
|L12.392|
000188 40005000 DCD 0x40005000
|L12.396|
00018c 00000000 DCD Device_Table
|L12.400|
000190 00000000 DCD Standard_GetConfiguration
|L12.404|
000194 00000000 DCD Standard_GetInterface
|L12.408|
000198 00000000 DCD ||.data||
|L12.412|
00019c 00000000 DCD SaveRState
AREA ||i.Post0_Process||, CODE, READONLY, ALIGN=2
Post0_Process PROC
;;;969 u8 Post0_Process(void)
;;;970 {
000000 b510 PUSH {r4,lr}
;;;971 SetEPRxCount(ENDP0, Device_Property.MaxPacketSize);
000002 480b LDR r0,|L13.48|
000004 f890102c LDRB r1,[r0,#0x2c] ; Device_Property
000008 2000 MOVS r0,#0
00000a f7fffffe BL SetEPRxCount
;;;972
;;;973 if (pInformation->ControlState == STALLED)
00000e 4809 LDR r0,|L13.52|
000010 6800 LDR r0,[r0,#0] ; pInformation
000012 7a01 LDRB r1,[r0,#8]
000014 2908 CMP r1,#8
000016 d105 BNE |L13.36|
;;;974 {
;;;975 vSetEPRxStatus(EP_RX_STALL);
000018 4a07 LDR r2,|L13.56|
00001a 0248 LSLS r0,r1,#9
00001c 8010 STRH r0,[r2,#0] ; SaveRState
;;;976 vSetEPTxStatus(EP_TX_STALL);
00001e 4a07 LDR r2,|L13.60|
000020 2010 MOVS r0,#0x10
000022 8010 STRH r0,[r2,#0] ; SaveTState
|L13.36|
;;;977 }
;;;978
;;;979 return (pInformation->ControlState == PAUSE);
000024 2001 MOVS r0,#1
000026 2909 CMP r1,#9
000028 d000 BEQ |L13.44|
00002a 2000 MOVS r0,#0
|L13.44|
;;;980 }
00002c bd10 POP {r4,pc}
;;;981
ENDP
00002e 0000 DCW 0x0000
|L13.48|
000030 00000000 DCD Device_Property
|L13.52|
000034 00000000 DCD pInformation
|L13.56|
000038 00000000 DCD SaveRState
|L13.60|
00003c 00000000 DCD SaveTState
AREA ||i.Setup0_Process||, CODE, READONLY, ALIGN=2
Setup0_Process PROC
;;;844 u8 Setup0_Process(void)
;;;845 {
000000 b570 PUSH {r4-r6,lr}
000002 4817 LDR r0,|L14.96|
;;;846
;;;847 union
;;;848 {
;;;849 u8* b;
;;;850 u16* w;
;;;851 } pBuf;
;;;852
;;;853 pBuf.b = PMAAddr + (u8 *)(_GetEPRxAddr(ENDP0) * 2); /* *2 for 32 bits addr */
000004 6801 LDR r1,[r0,#0]
000006 4817 LDR r0,|L14.100|
000008 b289 UXTH r1,r1
00000a eb000141 ADD r1,r0,r1,LSL #1
00000e 6889 LDR r1,[r1,#8]
;;;854
;;;855 if (pInformation->ControlState != PAUSE)
000010 4d15 LDR r5,|L14.104|
000012 b289 UXTH r1,r1 ;853
000014 eb000441 ADD r4,r0,r1,LSL #1 ;853
000018 6828 LDR r0,[r5,#0] ; pInformation
00001a 7a01 LDRB r1,[r0,#8]
00001c 2909 CMP r1,#9
00001e d011 BEQ |L14.68|
;;;856 {
;;;857 pInformation->USBbmRequestType = *pBuf.b++; /* bmRequestType */
000020 7821 LDRB r1,[r4,#0]
000022 7001 STRB r1,[r0,#0]
;;;858 pInformation->USBbRequest = *pBuf.b++; /* bRequest */
000024 f8141f01 LDRB r1,[r4,#1]!
000028 7041 STRB r1,[r0,#1]
00002a 1c64 ADDS r4,r4,#1
;;;859 pBuf.w++; /* word not accessed because of 32 bits addressing */
;;;860 pInformation->USBwValue = ByteSwap(*pBuf.w++); /* wValue */
00002c 8860 LDRH r0,[r4,#2]
00002e f7fffffe BL ByteSwap
000032 6829 LDR r1,[r5,#0] ; pInformation
000034 8048 STRH r0,[r1,#2]
;;;861 pBuf.w++; /* word not accessed because of 32 bits addressing */
;;;862 pInformation->USBwIndex = ByteSwap(*pBuf.w++); /* wIndex */
000036 88e0 LDRH r0,[r4,#6]
000038 f7fffffe BL ByteSwap
00003c 6829 LDR r1,[r5,#0] ; pInformation
00003e 8088 STRH r0,[r1,#4]
;;;863 pBuf.w++; /* word not accessed because of 32 bits addressing */
;;;864 pInformation->USBwLength = *pBuf.w; /* wLength */
000040 8960 LDRH r0,[r4,#0xa]
000042 80c8 STRH r0,[r1,#6]
|L14.68|
;;;865 }
;;;866
;;;867 pInformation->ControlState = SETTING_UP;
000044 6828 LDR r
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -