⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb_core.txt

📁 STM32F103ZET6+UCOSII+UCGUI源码
💻 TXT
📖 第 1 页 / 共 5 页
字号:
;;;690          {
;;;691            CopyRoutine = pProperty->GetConfigDescriptor;
;;;692          }
;;;693          else if (wValue1 == STRING_DESCRIPTOR)
;;;694          {
;;;695            CopyRoutine = pProperty->GetStringDescriptor;
;;;696          }  /* End of GET_DESCRIPTOR */
;;;697        }
;;;698      }
;;;699    
;;;700      /*GET STATUS*/
;;;701      else if ((Request_No == GET_STATUS) && (pInformation->USBwValue == 0)
;;;702               && (pInformation->USBwLength == 0x0002)
;;;703               && (pInformation->USBwIndex1 == 0))
;;;704      {
;;;705        /* GET STATUS for Device*/
;;;706        if ((Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
;;;707            && (pInformation->USBwIndex == 0))
;;;708        {
;;;709          CopyRoutine = Standard_GetStatus;
;;;710        }
;;;711    
;;;712        /* GET STATUS for Interface*/
;;;713        else if (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))
;;;714        {
;;;715          if (((*pProperty->Class_Get_Interface_Setting)(pInformation->USBwIndex0, 0) == USB_SUCCESS)
;;;716              && (pInformation->Current_Configuration != 0))
;;;717          {
;;;718            CopyRoutine = Standard_GetStatus;
;;;719          }
;;;720        }
;;;721    
;;;722        /* GET STATUS for EndPoint*/
;;;723        else if (Type_Recipient == (STANDARD_REQUEST | ENDPOINT_RECIPIENT))
;;;724        {
;;;725          Related_Endpoint = (pInformation->USBwIndex0 & 0x0f);
;;;726          Reserved = pInformation->USBwIndex0 & 0x70;
;;;727    
;;;728          if (ValBit(pInformation->USBwIndex0, 7))
;;;729          {
;;;730            /*Get Status of endpoint & stall the request if the related_ENdpoint
;;;731            is Disabled*/
;;;732            Status = _GetEPTxStatus(Related_Endpoint);
;;;733          }
;;;734          else
;;;735          {
;;;736            Status = _GetEPRxStatus(Related_Endpoint);
;;;737          }
;;;738    
;;;739          if ((Related_Endpoint < Device_Table.Total_Endpoint) && (Reserved == 0)
;;;740              && (Status != 0))
;;;741          {
;;;742            CopyRoutine = Standard_GetStatus;
;;;743          }
;;;744        }
;;;745    
;;;746      }
;;;747    
;;;748      /*GET CONFIGURATION*/
;;;749      else if (Request_No == GET_CONFIGURATION)
;;;750      {
;;;751        if (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
;;;752        {
;;;753          CopyRoutine = Standard_GetConfiguration;
;;;754        }
;;;755      }
;;;756      /*GET INTERFACE*/
;;;757      else if (Request_No == GET_INTERFACE)
;;;758      {
;;;759        if ((Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))
;;;760            && (pInformation->Current_Configuration != 0) && (pInformation->USBwValue == 0)
;;;761            && (pInformation->USBwIndex1 == 0) && (pInformation->USBwLength == 0x0001)
;;;762            && ((*pProperty->Class_Get_Interface_Setting)(pInformation->USBwIndex0, 0) == USB_SUCCESS))
;;;763        {
;;;764          CopyRoutine = Standard_GetInterface;
;;;765        }
;;;766    
;;;767      }
;;;768      
;;;769      if (CopyRoutine)
;;;770      {
;;;771        pInformation->Ctrl_Info.Usb_wOffset = wOffset;
;;;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);
;;;776        Result = USB_SUCCESS;
;;;777      }
;;;778      else
;;;779      {
;;;780        Result = (*pProperty->Class_Data_Setup)(pInformation->USBbRequest);
;;;781        if (Result == USB_NOT_READY)
;;;782        {
;;;783          pInformation->ControlState = PAUSE;
00000a  2609              MOVS     r6,#9
00000c  7842              LDRB     r2,[r0,#1]            ;670
00000e  2700              MOVS     r7,#0                 ;677
000010  6829              LDR      r1,[r5,#0]            ;680
000012  2a06              CMP      r2,#6                 ;680
000014  d10f              BNE      |L3.54|
000016  7802              LDRB     r2,[r0,#0]            ;682
000018  0652              LSLS     r2,r2,#25             ;682
00001a  d170              BNE      |L3.254|
00001c  7880              LDRB     r0,[r0,#2]            ;684
00001e  2801              CMP      r0,#1                 ;685
000020  d101              BNE      |L3.38|
000022  69c9              LDR      r1,[r1,#0x1c]         ;687
000024  e063              B        |L3.238|
                  |L3.38|
000026  2802              CMP      r0,#2                 ;689
000028  d101              BNE      |L3.46|
00002a  6a09              LDR      r1,[r1,#0x20]         ;691
00002c  e05f              B        |L3.238|
                  |L3.46|
00002e  2803              CMP      r0,#3                 ;693
000030  d165              BNE      |L3.254|
000032  6a49              LDR      r1,[r1,#0x24]         ;695
000034  e05b              B        |L3.238|
                  |L3.54|
000036  bb8a              CBNZ     r2,|L3.156|
000038  8842              LDRH     r2,[r0,#2]            ;701
00003a  2a00              CMP      r2,#0                 ;701
00003c  d15f              BNE      |L3.254|
00003e  88c2              LDRH     r2,[r0,#6]            ;702
000040  2a02              CMP      r2,#2                 ;702
000042  d15c              BNE      |L3.254|
000044  7902              LDRB     r2,[r0,#4]            ;703
000046  2a00              CMP      r2,#0                 ;703
000048  d159              BNE      |L3.254|
00004a  7802              LDRB     r2,[r0,#0]            ;706
00004c  0653              LSLS     r3,r2,#25             ;706
00004e  d103              BNE      |L3.88|
000050  8883              LDRH     r3,[r0,#4]            ;707
000052  b90b              CBNZ     r3,|L3.88|
                  |L3.84|
000054  494b              LDR      r1,|L3.388|
000056  e04a              B        |L3.238|
                  |L3.88|
000058  f002027f          AND      r2,r2,#0x7f           ;713
00005c  2a01              CMP      r2,#1                 ;713
00005e  d10a              BNE      |L3.118|
000060  698a              LDR      r2,[r1,#0x18]         ;715
000062  7940              LDRB     r0,[r0,#5]            ;715
000064  2100              MOVS     r1,#0                 ;715
000066  4790              BLX      r2                    ;715
000068  2800              CMP      r0,#0                 ;715
00006a  d148              BNE      |L3.254|
00006c  6820              LDR      r0,[r4,#0]            ;716  ; pInformation
00006e  7a80              LDRB     r0,[r0,#0xa]          ;716
000070  2800              CMP      r0,#0                 ;716
000072  d1ef              BNE      |L3.84|
000074  e043              B        |L3.254|
                  |L3.118|
000076  2a02              CMP      r2,#2                 ;723
000078  d141              BNE      |L3.254|
00007a  7940              LDRB     r0,[r0,#5]            ;725
00007c  4b42              LDR      r3,|L3.392|
00007e  0602              LSLS     r2,r0,#24             ;728
000080  f0000170          AND      r1,r0,#0x70           ;726
000084  f000000f          AND      r0,r0,#0xf            ;725
000088  2a00              CMP      r2,#0                 ;728
00008a  eb030280          ADD      r2,r3,r0,LSL #2       ;732
00008e  f8d22c00          LDR      r2,[r2,#0xc00]        ;732
000092  da04              BGE      |L3.158|
000094  f3c21201          UBFX     r2,r2,#4,#2           ;732
000098  0112              LSLS     r2,r2,#4              ;732
00009a  e003              B        |L3.164|
                  |L3.156|
00009c  e00a              B        |L3.180|
                  |L3.158|
00009e  f3c23201          UBFX     r2,r2,#12,#2          ;736
0000a2  0312              LSLS     r2,r2,#12             ;736
                  |L3.164|
0000a4  4b39              LDR      r3,|L3.396|
0000a6  781b              LDRB     r3,[r3,#0]            ;739  ; Device_Table
0000a8  4283              CMP      r3,r0                 ;739
0000aa  d928              BLS      |L3.254|
0000ac  bb39              CBNZ     r1,|L3.254|
0000ae  2a00              CMP      r2,#0                 ;740
0000b0  d1d0              BNE      |L3.84|
0000b2  e024              B        |L3.254|
                  |L3.180|
0000b4  2a08              CMP      r2,#8                 ;749
0000b6  d104              BNE      |L3.194|
0000b8  7800              LDRB     r0,[r0,#0]            ;751
0000ba  0640              LSLS     r0,r0,#25             ;751
0000bc  d11f              BNE      |L3.254|
0000be  4934              LDR      r1,|L3.400|
0000c0  e015              B        |L3.238|
                  |L3.194|
0000c2  2a0a              CMP      r2,#0xa               ;757
0000c4  d11b              BNE      |L3.254|
0000c6  7802              LDRB     r2,[r0,#0]            ;759
0000c8  f002027f          AND      r2,r2,#0x7f           ;759
0000cc  2a01              CMP      r2,#1                 ;759
0000ce  d116              BNE      |L3.254|
0000d0  7a82              LDRB     r2,[r0,#0xa]          ;760
0000d2  b1a2              CBZ      r2,|L3.254|
0000d4  8842              LDRH     r2,[r0,#2]            ;760
0000d6  b992              CBNZ     r2,|L3.254|
0000d8  7902              LDRB     r2,[r0,#4]            ;761
0000da  b982              CBNZ     r2,|L3.254|
0000dc  88c2              LDRH     r2,[r0,#6]            ;761
0000de  2a01              CMP      r2,#1                 ;761
0000e0  d10d              BNE      |L3.254|
0000e2  698a              LDR      r2,[r1,#0x18]         ;762
0000e4  7940              LDRB     r0,[r0,#5]            ;762
0000e6  2100              MOVS     r1,#0                 ;762
0000e8  4790              BLX      r2                    ;762
0000ea  b940              CBNZ     r0,|L3.254|
0000ec  4929              LDR      r1,|L3.404|
                  |L3.238|
0000ee  b131              CBZ      r1,|L3.254|
0000f0  6820              LDR      r0,[r4,#0]            ;771  ; pInformation
0000f2  8247              STRH     r7,[r0,#0x12]         ;771
0000f4  6181              STR      r1,[r0,#0x18]         ;775
0000f6  2000              MOVS     r0,#0                 ;775
0000f8  4788              BLX      r1                    ;775
0000fa  2000              MOVS     r0,#0                 ;776
0000fc  e00a              B        |L3.276|
                  |L3.254|
0000fe  6829              LDR      r1,[r5,#0]            ;780  ; pProperty
000100  6820              LDR      r0,[r4,#0]            ;780  ; pInformation
000102  6909              LDR      r1,[r1,#0x10]         ;780
000104  7840              LDRB     r0,[r0,#1]            ;780
000106  4788              BLX      r1                    ;780
000108  2803              CMP      r0,#3                 ;781
00010a  d103              BNE      |L3.276|
00010c  6820              LDR      r0,[r4,#0]  ; pInformation
00010e  7206              STRB     r6,[r0,#8]
                  |L3.272|
;;;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    }
000110  e8bd81f0          POP      {r4-r8,pc}
                  |L3.276|
000114  6821              LDR      r1,[r4,#0]            ;788  ; pInformation
000116  8a0a              LDRH     r2,[r1,#0x10]         ;788
000118  f5a2437f          SUB      r3,r2,#0xff00         ;788
00011c  3bff              SUBS     r3,r3,#0xff           ;788
00011e  d101              BNE      |L3.292|
000120  720e              STRB     r6,[r1,#8]            ;791
000122  e7f5              B        |L3.272|
                  |L3.292|
000124  2802              CMP      r0,#2                 ;794
000126  d000              BEQ      |L3.298|
000128  b912              CBNZ     r2,|L3.304|
                  |L3.298|
00012a  2008              MOVS     r0,#8                 ;797
00012c  7208              STRB     r0,[r1,#8]            ;797
00012e  e7ef              B        |L3.272|
                  |L3.304|
000130  7808              LDRB     r0,[r1,#0]            ;802
000132  0600              LSLS     r0,r0,#24             ;802
000134  d51c              BPL      |L3.368|
000136  88c8              LDRH     r0,[r1,#6]            ;805
000138  4282              CMP      r2,r0                 ;808
00013a  d901              BLS      |L3.320|
00013c  8208              STRH     r0,[r1,#0x10]         ;810
00013e  e00f              B        |L3.352|
                  |L3.320|
000140  d20e              BCS      |L3.352|
000142  6828              LDR      r0,[r5,#0]            ;815  ; pProperty

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -