; generated by ARM C/C++ Compiler, 4.1 [Build 713]
; commandline ArmCC [--list --split_sections --debug -c --asm --interleave -o.\Obj\usb_core.o --asm_dir=.\List\ --list_dir=.\List\ --depend=.\Obj\usb_core.d --cpu=Cortex-M3 --apcs=interwork -O3 -I.\usb_library\inc -IC:\Keil\ARM\CMSIS\Include -IC:\Keil\ARM\INC\ST\STM32F10x -D__MICROLIB -DVECT_TAB_FLASH --omf_browse=.\Obj\usb_core.crf usb_library\src\usb_core.c]
                          THUMB

                          AREA ||i.DataStageIn||, CODE, READONLY, ALIGN=2

                  DataStageIn PROC
;;;482    *******************************************************************************/
;;;483    void DataStageIn(void)
000000  e92d47f0          PUSH     {r4-r10,lr}
;;;484    {
;;;485      ENDPOINT_INFO *pEPinfo = &pInformation->Ctrl_Info;
000004  f8df9074          LDR      r9,|L1.124|
;;;486      u32 save_wLength = pEPinfo->Usb_wLength;
;;;487      u32 ControlState = pInformation->ControlState;
;;;488    
;;;489      u8 *DataBuffer;
;;;490      u32 Length;
;;;491    
;;;492      if ((save_wLength == 0) && (ControlState == LAST_IN_DATA))
;;;493      {
;;;494        /* no more data to send so STALL the TX Status*/
;;;495        ControlState = WAIT_STATUS_OUT;
;;;496        vSetEPTxStatus(EP_TX_STALL);
000008  f8df8074          LDR      r8,|L1.128|
00000c  f8d91000          LDR      r1,[r9,#0]            ;485  ; pInformation
000010  f1010510          ADD      r5,r1,#0x10           ;485
000014  8a08              LDRH     r0,[r1,#0x10]         ;486
000016  7a09              LDRB     r1,[r1,#8]            ;487
000018  b908              CBNZ     r0,|L1.30|
00001a  2904              CMP      r1,#4                 ;492
00001c  d029              BEQ      |L1.114|
                  |L1.30|
;;;497        goto Expect_Status_Out;
;;;498      }
;;;499    
;;;500      Length = pEPinfo->PacketSize;
00001e  88ac              LDRH     r4,[r5,#4]
;;;501      ControlState = (save_wLength <= Length) ? LAST_IN_DATA : IN_DATA;
000020  2604              MOVS     r6,#4
000022  42a0              CMP      r0,r4
000024  d900              BLS      |L1.40|
000026  2602              MOVS     r6,#2
                  |L1.40|
;;;502    
;;;503      if (Length > save_wLength)
000028  4284              CMP      r4,r0
00002a  d900              BLS      |L1.46|
;;;504      {
;;;505        Length = save_wLength;
00002c  4604              MOV      r4,r0
                  |L1.46|
;;;506      }
;;;507    
;;;508      DataBuffer = (*pEPinfo->CopyData)(Length);
00002e  b2a0              UXTH     r0,r4
000030  68a9              LDR      r1,[r5,#8]
000032  4607              MOV      r7,r0
000034  4788              BLX      r1
000036  4682              MOV      r10,r0
;;;509    
;;;510      UserToPMABufferCopy(DataBuffer, GetEPTxAddr(ENDP0), Length);
000038  2000              MOVS     r0,#0
00003a  f7fffffe          BL       GetEPTxAddr
00003e  4601              MOV      r1,r0
000040  463a              MOV      r2,r7
000042  4650              MOV      r0,r10
000044  f7fffffe          BL       UserToPMABufferCopy
000048  4639              MOV      r1,r7
;;;511    
;;;512      SetEPTxCount(ENDP0, Length);
00004a  2000              MOVS     r0,#0
00004c  f7fffffe          BL       SetEPTxCount
;;;513    
;;;514      pEPinfo->Usb_wLength -= Length;
000050  8828              LDRH     r0,[r5,#0]
;;;515      pEPinfo->Usb_wOffset += Length;
;;;516      vSetEPTxStatus(EP_TX_VALID);
000052  2130              MOVS     r1,#0x30
000054  1b00              SUBS     r0,r0,r4              ;514
000056  8028              STRH     r0,[r5,#0]            ;514
000058  8868              LDRH     r0,[r5,#2]            ;515
00005a  4420              ADD      r0,r0,r4              ;515
00005c  8068              STRH     r0,[r5,#2]            ;515
00005e  f8a81000          STRH     r1,[r8,#0]
;;;517    
;;;518      USB_StatusOut();/* Expect the host to abort the data IN stage */
000062  0208              LSLS     r0,r1,#8
000064  4907              LDR      r1,|L1.132|
000066  8008              STRH     r0,[r1,#0]
                  |L1.104|
;;;519    
;;;520    Expect_Status_Out:
;;;521      pInformation->ControlState = ControlState;
000068  f8d90000          LDR      r0,[r9,#0]  ; pInformation
00006c  7206              STRB     r6,[r0,#8]
;;;522    }
00006e  e8bd87f0          POP      {r4-r10,pc}
                  |L1.114|
000072  2607              MOVS     r6,#7                 ;495
000074  2110              MOVS     r1,#0x10              ;496
000076  f8a81000          STRH     r1,[r8,#0]            ;496
00007a  e7f5              B        |L1.104|
;;;523    
                          ENDP

                  |L1.124|
                          DCD      pInformation
                  |L1.128|
                          DCD      SaveTState
                  |L1.132|
                          DCD      SaveRState

                          AREA ||i.DataStageOut||, CODE, READONLY, ALIGN=2

                  DataStageOut PROC
;;;425    *******************************************************************************/
;;;426    void DataStageOut(void)
000000  e92d47f0          PUSH     {r4-r10,lr}
;;;427    {
;;;428      ENDPOINT_INFO *pEPinfo = &pInformation->Ctrl_Info;
000004  4e23              LDR      r6,|L2.148|
;;;429      u32 save_rLength;
;;;430    
;;;431      save_rLength = pEPinfo->Usb_rLength;
;;;432    
;;;433      if (pEPinfo->CopyData && save_rLength)
;;;434      {
;;;435        u8 *Buffer;
;;;436        u32 Length;
;;;437    
;;;438        Length = pEPinfo->PacketSize;
;;;439        if (Length > save_rLength)
;;;440        {
;;;441          Length = save_rLength;
;;;442        }
;;;443    
;;;444        Buffer = (*pEPinfo->CopyData)(Length);
;;;445        pEPinfo->Usb_rLength -= Length;
;;;446        pEPinfo->Usb_rOffset += Length;
;;;447    
;;;448        PMAToUserBufferCopy(Buffer, GetEPRxAddr(ENDP0), Length);
;;;449      }
;;;450    
;;;451      if (pEPinfo->Usb_rLength != 0)
;;;452      {
;;;453        vSetEPRxStatus(EP_RX_VALID);/* re-enable for next data reception */
;;;454        SetEPTxCount(ENDP0, 0);
;;;455        vSetEPTxStatus(EP_TX_VALID);/* Expect the host to abort the data OUT stage */
000006  f8df9090          LDR      r9,|L2.152|
00000a  f04f0830          MOV      r8,#0x30
00000e  6834              LDR      r4,[r6,#0]            ;431  ; pInformation
000010  f8340f10          LDRH     r0,[r4,#0x10]!        ;431
000014  68a1              LDR      r1,[r4,#8]            ;433
000016  b1b1              CBZ      r1,|L2.70|
000018  b308              CBZ      r0,|L2.94|
00001a  88a5              LDRH     r5,[r4,#4]            ;438
00001c  4285              CMP      r5,r0                 ;439
00001e  d900              BLS      |L2.34|
000020  4605              MOV      r5,r0                 ;441
                  |L2.34|
000022  b2a8              UXTH     r0,r5                 ;444
000024  4607              MOV      r7,r0                 ;444
000026  4788              BLX      r1                    ;444
000028  4682              MOV      r10,r0                ;444
00002a  8820              LDRH     r0,[r4,#0]            ;445
00002c  1b40              SUBS     r0,r0,r5              ;445
00002e  8020              STRH     r0,[r4,#0]            ;445
000030  8860              LDRH     r0,[r4,#2]            ;446
000032  4428              ADD      r0,r0,r5              ;446
000034  8060              STRH     r0,[r4,#2]            ;446
000036  2000              MOVS     r0,#0                 ;448
000038  f7fffffe          BL       GetEPRxAddr
00003c  4601              MOV      r1,r0                 ;448
00003e  463a              MOV      r2,r7                 ;448
000040  4650              MOV      r0,r10                ;448
000042  f7fffffe          BL       PMAToUserBufferCopy
                  |L2.70|
000046  8820              LDRH     r0,[r4,#0]            ;451
000048  b148              CBZ      r0,|L2.94|
00004a  4914              LDR      r1,|L2.156|
00004c  f44f5040          MOV      r0,#0x3000            ;453
000050  8008              STRH     r0,[r1,#0]            ;453
000052  2100              MOVS     r1,#0                 ;454
000054  4608              MOV      r0,r1                 ;454
000056  f7fffffe          BL       SetEPTxCount
00005a  f8a98000          STRH     r8,[r9,#0]
                  |L2.94|
;;;456      }
;;;457      /* Set the next State*/
;;;458      if (pEPinfo->Usb_rLength >= pEPinfo->PacketSize)
00005e  8820              LDRH     r0,[r4,#0]
000060  88a1              LDRH     r1,[r4,#4]
000062  4288              CMP      r0,r1
000064  d301              BCC      |L2.106|
;;;459      {
;;;460        pInformation->ControlState = OUT_DATA;
000066  2003              MOVS     r0,#3
000068  e001              B        |L2.110|
                  |L2.106|
;;;461      }
;;;462      else
;;;463      {
;;;464        if (pEPinfo->Usb_rLength > 0)
00006a  b120              CBZ      r0,|L2.118|
;;;465        {
;;;466          pInformation->ControlState = LAST_OUT_DATA;
00006c  2005              MOVS     r0,#5
                  |L2.110|
00006e  6831              LDR      r1,[r6,#0]            ;460  ; pInformation
000070  7208              STRB     r0,[r1,#8]            ;460
                  |L2.114|
;;;467        }
;;;468        else if (pEPinfo->Usb_rLength == 0)
;;;469        {
;;;470          pInformation->ControlState = WAIT_STATUS_IN;
;;;471          USB_StatusIn();
;;;472        }
;;;473      }
;;;474    }
000072  e8bd87f0          POP      {r4-r10,pc}
                  |L2.118|
000076  6831              LDR      r1,[r6,#0]            ;470  ; pInformation
000078  2006              MOVS     r0,#6                 ;470
00007a  7208              STRB     r0,[r1,#8]            ;470
00007c  4908              LDR      r1,|L2.160|
00007e  2000              MOVS     r0,#0                 ;471
000080  6809              LDR      r1,[r1,#0]            ;471
000082  4a08              LDR      r2,|L2.164|
000084  b289              UXTH     r1,r1                 ;471
000086  eb020141          ADD      r1,r2,r1,LSL #1       ;471
00008a  6048              STR      r0,[r1,#4]            ;471
00008c  f8a98000          STRH     r8,[r9,#0]            ;471
000090  e7ef              B        |L2.114|
;;;475    
                          ENDP

000092  0000              DCW      0x0000
                  |L2.148|
                          DCD      pInformation
                  |L2.152|
                          DCD      SaveTState
                  |L2.156|
                          DCD      SaveRState
                  |L2.160|
                          DCD      0x40005c50
                  |L2.164|
                          DCD      0x40006000

                          AREA ||i.Data_Setup0||, CODE, READONLY, ALIGN=2

                  Data_Setup0 PROC
;;;654    *******************************************************************************/
;;;655    void Data_Setup0(void)
000000  b570              PUSH     {r4-r6,lr}
;;;656    {
;;;657      u8 *(*CopyRoutine)(u16);
;;;658      RESULT Result;
;;;659      u32 Request_No = pInformation->USBbRequest;
000002  4c53              LDR      r4,|L3.336|
;;;660    
;;;661      u32 Related_Endpoint, Reserved;
;;;662      u32 wOffset, Status;
;;;663    
;;;664    
;;;665    
;;;666      CopyRoutine = NULL;
;;;667      wOffset = 0;
;;;668    
;;;669      if (Request_No == GET_DESCRIPTOR)
;;;670      {
;;;671        if (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
;;;672        {
;;;673          u8 wValue1 = pInformation->USBwValue1;
;;;674          if (wValue1 == DEVICE_DESCRIPTOR)
;;;675          {
;;;676            CopyRoutine = pProperty->GetDeviceDescriptor;
000004  4d53              LDR      r5,|L3.340|
;;;677          }
;;;678          else if (wValue1 == CONFIG_DESCRIPTOR)
;;;679          {
;;;680            CopyRoutine = pProperty->GetConfigDescriptor;
;;;681          }
;;;682          else if (wValue1 == STRING_DESCRIPTOR)
;;;683          {
;;;684            CopyRoutine = pProperty->GetStringDescriptor;
;;;685          }  /* End of GET_DESCRIPTOR */
;;;686        }
;;;687      }
;;;688    
;;;689      /*GET STATUS*/
;;;690      else if ((Request_No == GET_STATUS) && (pInformation->USBwValue == 0)
;;;691               && (pInformation->USBwLength == 0x0002)
;;;692               && (pInformation->USBwIndex1 == 0))
;;;693      {
;;;694        /* GET STATUS for Device*/
;;;695        if ((Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
;;;696            && (pInformation->USBwIndex == 0))
;;;697        {
;;;698          CopyRoutine = Standard_GetStatus;
;;;699        }
;;;700    
;;;701        /* GET STATUS for Interface*/
;;;702        else if (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))
;;;703        {
;;;704          if (((*pProperty->Class_Get_Interface_Setting)(pInformation->USBwIndex0, 0) == USB_SUCCESS)
;;;705              && (pInformation->Current_Configuration != 0))
;;;706          {
;;;707            CopyRoutine = Standard_GetStatus;
;;;708          }
;;;709        }
;;;710    
;;;711        /* GET STATUS for EndPoint*/
;;;712        else if (Type_Recipient == (STANDARD_REQUEST | ENDPOINT_RECIPIENT))
;;;713        {
;;;714          Related_Endpoint = (pInformation->USBwIndex0 & 0x0f);
;;;715          Reserved = pInformation->USBwIndex0 & 0x70;
;;;716    
;;;717          if (ValBit(pInformation->USBwIndex0, 7))
;;;718          {
;;;719            /*Get Status of endpoint & stall the request if the related_ENdpoint
;;;720            is Disabled*/
;;;721            Status = _GetEPTxStatus(Related_Endpoint);
;;;722          }
;;;723          else
;;;724          {
;;;725            Status = _GetEPRxStatus(Related_Endpoint);
;;;726          }
;;;727    
;;;728          if ((Related_Endpoint < Device_Table.Total_Endpoint) && (Reserved == 0)
;;;729              && (Status != 0))
;;;730          {
;;;731            CopyRoutine = Standard_GetStatus;
;;;732          }
;;;733        }
;;;734    
;;;735      }
;;;736    
;;;737      /*GET CONFIGURATION*/
;;;738      else if (Request_No == GET_CONFIGURATION)
;;;739      {
;;;740        if (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
;;;741        {
;;;742          CopyRoutine = Standard_GetConfiguration;
;;;743        }
;;;744      }
;;;745      /*GET INTERFACE*/
;;;746      else if (Request_No == GET_INTERFACE)
;;;747      {
;;;748        if ((Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))
;;;749            && (pInformation->Current_Configuration != 0) && (pInformation->USBwValue == 0)
;;;750            && (pInformation->USBwIndex1 == 0) && (pInformation->USBwLength == 0x0001)
;;;751            && ((*pProperty->Class_Get_Interface_Setting)(pInformation->USBwIndex0, 0) == USB_SUCCESS))
;;;752        {
;;;753          CopyRoutine = Standard_GetInterface;
;;;754        }
;;;755    
;;;756      }
;;;757    
;;;758    
;;;759      if (CopyRoutine)
;;;760      {
;;;761        pInformation->Ctrl_Info.Usb_wOffset = wOffset;
;;;762        pInformation->Ctrl_Info.CopyData = CopyRoutine;
;;;763        /* sb in the original the cast to word was directly */
;;;764        /* now the cast is made step by step */
;;;765        (*CopyRoutine)(0);
;;;766        Result = USB_SUCCESS;
;;;767      }
;;;768      else
;;;769      {
;;;770        Result = (*pProperty->Class_Data_Setup)(pInformation->USBbRequest);
;;;771        if (Result == USB_NOT_READY)
;;;772        {
;;;773          pInformation->ControlState = PAUSE;
000006  2609              MOVS     r6,#9
000008  6820              LDR      r0,[r4,#0]            ;659  ; pInformation
00000a  6829              LDR      r1,[r5,#0]            ;669
00000c  7842              LDRB     r2,[r0,#1]            ;659
00000e  2a06              CMP      r2,#6                 ;669
000010  d005              BEQ      |L3.30|
000012  b1aa              CBZ      r2,|L3.64|
000014  2a08              CMP      r2,#8                 ;738
000016  d04b              BEQ      |L3.176|
000018  2a0a              CMP      r2,#0xa               ;746
00001a  d04e              BEQ      |L3.186|
00001c  e06a              B        |L3.244|
                  |L3.30|
00001e  7802              LDRB     r2,[r0,#0]            ;671
000020  0652              LSLS     r2,r2,#25             ;671
000022  d167              BNE      |L3.244|
000024  7880              LDRB     r0,[r0,#2]            ;673
000026  2801              CMP      r0,#1                 ;674
000028  d004              BEQ      |L3.52|
00002a  2802              CMP      r0,#2                 ;678
00002c  d004              BEQ      |L3.56|
00002e  2803              CMP      r0,#3                 ;682
000030  d004              BEQ      |L3.60|
000032  e05f              B        |L3.244|
                  |L3.52|
000034  69c9              LDR      r1,[r1,#0x1c]         ;676
000036  e054              B        |L3.226|
                  |L3.56|
000038  6a09              LDR      r1,[r1,#0x20]         ;680
00003a  e052              B        |L3.226|
                  |L3.60|
00003c  6a49              LDR      r1,[r1,#0x24]         ;684
00003e  e050              B        |L3.226|
                  |L3.64|
000040  8842              LDRH     r2,[r0,#2]            ;690
000042  bba2              CBNZ     r2,|L3.174|
000044  88c2              LDRH     r2,[r0,#6]            ;691
000046  2a02              CMP      r2,#2                 ;691
000048  d154              BNE      |L3.244|
00004a  7902              LDRB     r2,[r0,#4]            ;692
00004c  bb7a              CBNZ     r2,|L3.174|
00004e  7802              LDRB     r2,[r0,#0]            ;695
000050  0653              LSLS     r3,r2,#25             ;695
000052  d101              BNE      |L3.88|
000054  8883              LDRH     r3,[r0,#4]            ;696
000056  b133              CBZ      r3,|L3.102|
                  |L3.88|
000058  f002027f          AND      r2,r2,#0x7f           ;702
00005c  2a01              CMP      r2,#1                 ;702
00005e  d004              BEQ      |L3.106|
000060  2a02              CMP      r2,#2                 ;712
000062  d00c              BEQ      |L3.126|
000064  e046              B        |L3.244|
                  |L3.102|
000066  493c              LDR      r1,|L3.344|
000068  e03b              B        |L3.226|
                  |L3.106|
00006a  698a              LDR      r2,[r1,#0x18]         ;704
00006c  7940              LDRB     r0,[r0,#5]            ;704
00006e  2100              MOVS     r1,#0                 ;704
000070  4790              BLX      r2                    ;704
000072  b9e0              CBNZ     r0,|L3.174|
000074  6820              LDR      r0,[r4,#0]            ;705  ; pInformation
000076  7a80              LDRB     r0,[r0,#0xa]          ;705
000078  2800              CMP      r0,#0                 ;705
00007a  d1f4              BNE      |L3.102|
00007c  e03a              B        |L3.244|
                  |L3.126|
00007e  7941              LDRB     r1,[r0,#5]            ;714
000080  f001000f          AND      r0,r1,#0xf            ;714
000084  f0010270          AND      r2,r1,#0x70           ;715
000088  060b              LSLS     r3,r1,#24             ;717
00008a  4934              LDR      r1,|L3.348|
00008c  f8511020          LDR      r1,[r1,r0,LSL #2]     ;725
000090  d503              BPL      |L3.154|
000092  f3c11101          UBFX     r1,r1,#4,#2           ;721
000096  0109              LSLS     r1,r1,#4              ;721
000098  e002              B        |L3.160|
                  |L3.154|
00009a  f3c13101          UBFX     r1,r1,#12,#2          ;725
00009e  0309              LSLS     r1,r1,#12             ;725
                  |L3.160|
0000a0  4b2f              LDR      r3,|L3.352|
0000a2  781b              LDRB     r3,[r3,#0]            ;728  ; Device_Table
0000a4  4283              CMP      r3,r0                 ;728
0000a6  d925              BLS      |L3.244|
0000a8  b90a              CBNZ     r2,|L3.174|
0000aa  2900              CMP      r1,#0                 ;729
0000ac  d1db              BNE      |L3.102|
                  |L3.174|
0000ae  e021              B        |L3.244|
                  |L3.176|
0000b0  7800              LDRB     r0,[r0,#0]            ;740
0000b2  0640              LSLS     r0,r0,#25             ;740
0000b4  d11e              BNE      |L3.244|
0000b6  492b              LDR      r1,|L3.356|
0000b8  e013              B        |L3.226|
                  |L3.186|
0000ba  7802              LDRB     r2,[r0,#0]            ;748
0000bc  f002027f          AND      r2,r2,#0x7f           ;748
0000c0  2a01              CMP      r2,#1                 ;748
0000c2  d117              BNE      |L3.244|
0000c4  7a82              LDRB     r2,[r0,#0xa]          ;749
0000c6  b1aa              CBZ      r2,|L3.244|
0000c8  8842              LDRH     r2,[r0,#2]            ;749
0000ca  b99a              CBNZ     r2,|L3.244|
0000cc  7902              LDRB     r2,[r0,#4]            ;750
0000ce  b98a              CBNZ     r2,|L3.244|
0000d0  88c2              LDRH     r2,[r0,#6]            ;750
0000d2  2a01              CMP      r2,#1                 ;750
0000d4  d10e              BNE      |L3.244|
0000d6  698a              LDR      r2,[r1,#0x18]         ;751
0000d8  7940              LDRB     r0,[r0,#5]            ;751
0000da  2100              MOVS     r1,#0                 ;751
0000dc  4790              BLX      r2                    ;751
0000de  b948              CBNZ     r0,|L3.244|
0000e0  4921              LDR      r1,|L3.360|
                  |L3.226|
0000e2  b139              CBZ      r1,|L3.244|
0000e4  6820              LDR      r0,[r4,#0]            ;761  ; pInformation
0000e6  2200              MOVS     r2,#0                 ;761
0000e8  8242              STRH     r2,[r0,#0x12]         ;761
0000ea  6181              STR      r1,[r0,#0x18]         ;765
0000ec  4610              MOV      r0,r2                 ;765
0000ee  4788              BLX      r1                    ;765
0000f0  2000              MOVS     r0,#0                 ;766
0000f2  e006              B        |L3.258|
                  |L3.244|
0000f4  6829              LDR      r1,[r5,#0]            ;770  ; pProperty
0000f6  6820              LDR      r0,[r4,#0]            ;770  ; pInformation
0000f8  6909              LDR      r1,[r1,#0x10]         ;770
0000fa  7840              LDRB     r0,[r0,#1]            ;770
0000fc  4788              BLX      r1                    ;770
0000fe  2803              CMP      r0,#3                 ;771
000100  d007              BEQ      |L3.274|
                  |L3.258|
;;;774          return;
;;;775        }
;;;776      }
;;;777    
;;;778      if (pInformation->Ctrl_Info.Usb_wLength == 0xFFFF)
000102  6821              LDR      r1,[r4,#0]  ; pInformation
000104  8a0a              LDRH     r2,[r1,#0x10]
000106  f5a2437f          SUB      r3,r2,#0xff00
00010a  3bff              SUBS     r3,r3,#0xff
00010c  d104              BNE      |L3.280|
;;;779      {
;;;780        /* Data is not ready, wait it */
;;;781        pInformation->ControlState = PAUSE;
00010e  720e              STRB     r6,[r1,#8]
;;;782        return;
;;;783      }
;;;784      if ((Result == USB_UNSUPPORT) || (pInformation->Ctrl_Info.Usb_wLength == 0))
;;;785      {
;;;786        /* Unsupported request */
;;;787        pInformation->ControlState = STALLED;
;;;788        return;
;;;789      }
;;;790    
;;;791    
;;;792      if (ValBit(pInformation->USBbmRequestType, 7))
;;;793      {
;;;794        /* Device ==> Host */
;;;795        u32 wLength = pInformation->USBwLength;
;;;796    
;;;797        /* Restrict the data length to be the one host asks */
;;;798        if (pInformation->Ctrl_Info.Usb_wLength > wLength)
;;;799        {
;;;800          pInformation->Ctrl_Info.Usb_wLength = wLength;
;;;801        }
;;;802    
;;;803        pInformation->Ctrl_Info.PacketSize = pProperty->MaxPacketSize;
;;;804        DataStageIn();
;;;805      }
;;;806      else
;;;807      {
;;;808        pInformation->ControlState = OUT_DATA;
;;;809        vSetEPRxStatus(EP_RX_VALID);/* enable for next data reception */
;;;810      }
;;;811    
;;;812      return;
;;;813    }
000110  bd70              POP      {r4-r6,pc}
                  |L3.274|
000112  6820              LDR      r0,[r4,#0]            ;773  ; pInformation
000114  7206              STRB     r6,[r0,#8]            ;773
000116  bd70              POP      {r4-r6,pc}
                  |L3.280|
000118  2802              CMP      r0,#2                 ;784
00011a  d00f              BEQ      |L3.316|
00011c  b172              CBZ      r2,|L3.316|
00011e  7808              LDRB     r0,[r1,#0]            ;792
000120  0600              LSLS     r0,r0,#24             ;792
000122  d50e              BPL      |L3.322|
000124  88c8              LDRH     r0,[r1,#6]            ;795
000126  4282              CMP      r2,r0                 ;798
000128  d900              BLS      |L3.300|
00012a  8208              STRH     r0,[r1,#0x10]         ;800
                  |L3.300|
00012c  6828              LDR      r0,[r5,#0]            ;803  ; pProperty
00012e  f890002c          LDRB     r0,[r0,#0x2c]         ;803
000132  8288              STRH     r0,[r1,#0x14]         ;803
000134  e8bd4070          POP      {r4-r6,lr}            ;804
000138  f7ffbffe          B.W      DataStageIn
                  |L3.316|
00013c  2008              MOVS     r0,#8                 ;787
00013e  7208              STRB     r0,[r1,#8]            ;787
000140  bd70              POP      {r4-r6,pc}
                  |L3.322|
000142  2003              MOVS     r0,#3                 ;808
000144  7208              STRB     r0,[r1,#8]            ;808
000146  4909              LDR      r1,|L3.364|
000148  0300              LSLS     r0,r0,#12             ;809
00014a  8008              STRH     r0,[r1,#0]            ;809
00014c  bd70              POP      {r4-r6,pc}
;;;814    
                          ENDP

00014e  0000              DCW      0x0000
                  |L3.336|
                          DCD      pInformation
                  |L3.340|
                          DCD      pProperty
                  |L3.344|
                          DCD      Standard_GetStatus
                  |L3.348|
                          DCD      0x40005c00
                  |L3.352|
                          DCD      Device_Table
                  |L3.356|
                          DCD      Standard_GetConfiguration
                  |L3.360|
                          DCD      Standard_GetInterface
                  |L3.364|
                          DCD      SaveRState

                          AREA ||i.In0_Process||, CODE, READONLY, ALIGN=2

                  In0_Process PROC
;;;865    *******************************************************************************/
;;;866    u8 In0_Process(void)
000000  b510              PUSH     {r4,lr}
;;;867    {
;;;868      u32 ControlState = pInformation->ControlState;
000002  4c13              LDR      r4,|L4.80|
000004  6820              LDR      r0,[r4,#0]  ; pInformation
000006  7a01              LDRB     r1,[r0,#8]
;;;869    
;;;870      if ((ControlState == IN_DATA) || (ControlState == LAST_IN_DATA))
000008  2902              CMP      r1,#2
00000a  d004              BEQ      |L4.22|
00000c  2904              CMP      r1,#4
00000e  d002              BEQ      |L4.22|
;;;871      {
;;;872        DataStageIn();
;;;873        /* ControlState may be changed outside the function */
;;;874        ControlState = pInformation->ControlState;
;;;875      }
;;;876    
;;;877      else if (ControlState == WAIT_STATUS_IN)
000010  2906              CMP      r1,#6
000012  d005              BEQ      |L4.32|
000014  e015              B        |L4.66|
                  |L4.22|
000016  f7fffffe          BL       DataStageIn
00001a  6820              LDR      r0,[r4,#0]            ;874  ; pInformation
00001c  7a00              LDRB     r0,[r0,#8]            ;874
00001e  e011              B        |L4.68|
                  |L4.32|
;;;878      {
;;;879        if ((pInformation->USBbRequest == SET_ADDRESS) &&
000020  7841              LDRB     r1,[r0,#1]
000022  2905              CMP      r1,#5
000024  d109              BNE      |L4.58|
;;;880            (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT)))
000026  7801              LDRB     r1,[r0,#0]
000028  0649              LSLS     r1,r1,#25
00002a  d106              BNE      |L4.58|
;;;881        {
;;;882          SetDeviceAddress(pInformation->USBwValue0);
00002c  78c0              LDRB     r0,[r0,#3]
00002e  f7fffffe          BL       SetDeviceAddress
;;;883          pUser_Standard_Requests->User_SetDeviceAddress();
000032  4808              LDR      r0,|L4.84|
000034  6800              LDR      r0,[r0,#0]  ; pUser_Standard_Requests
000036  6a00              LDR      r0,[r0,#0x20]
000038  4780              BLX      r0
                  |L4.58|
;;;884        }
;;;885        (*pProperty->Process_Status_IN)();
00003a  4807              LDR      r0,|L4.88|
00003c  6800              LDR      r0,[r0,#0]  ; pProperty
00003e  6880              LDR      r0,[r0,#8]
000040  4780              BLX      r0
                  |L4.66|
;;;886        ControlState = STALLED;
;;;887      }
;;;888    
;;;889      else
;;;890      {
;;;891        ControlState = STALLED;
000042  2008              MOVS     r0,#8
                  |L4.68|
;;;892      }
;;;893    
;;;894      pInformation->ControlState = ControlState;
000044  6821              LDR      r1,[r4,#0]  ; pInformation
000046  7208              STRB     r0,[r1,#8]
;;;895    
;;;896      return Post0_Process();
000048  e8bd4010          POP      {r4,lr}
00004c  f7ffbffe          B.W      Post0_Process
;;;897    }
;;;898    
                          ENDP

                  |L4.80|
                          DCD      pInformation
                  |L4.84|
                          DCD      pUser_Standard_Requests
                  |L4.88|
                          DCD      pProperty

                          AREA ||i.NOP_Process||, CODE, READONLY, ALIGN=1

                  NOP_Process PROC
;;;986    *******************************************************************************/
;;;987    void NOP_Process(void)
000000  4770              BX       lr
;;;988    {
;;;989    }
;;;990    
                          ENDP


                          AREA ||i.NoData_Setup0||, CODE, READONLY, ALIGN=2

                  NoData_Setup0 PROC
;;;530    *******************************************************************************/
;;;531    void NoData_Setup0(void)
000000  b570              PUSH     {r4-r6,lr}
;;;532    {
;;;533      RESULT Result = USB_UNSUPPORT;
;;;534      u32 RequestNo = pInformation->USBbRequest;
000002  4d30              LDR      r5,|L6.196|
000004  6828              LDR      r0,[r5,#0]  ; pInformation
;;;535      u32 ControlState;
;;;536    
;;;537      if (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
000006  7801              LDRB     r1,[r0,#0]
000008  7844              LDRB     r4,[r0,#1]            ;534
00000a  064a              LSLS     r2,r1,#25
00000c  d006              BEQ      |L6.28|
;;;538      {
;;;539        /* Device Request*/
;;;540        /* SET_CONFIGURATION*/
;;;541        if (RequestNo == SET_CONFIGURATION)
;;;542        {
;;;543          Result = Standard_SetConfiguration();
;;;544        }
;;;545    
;;;546        /*SET ADDRESS*/
;;;547        else if (RequestNo == SET_ADDRESS)
;;;548        {
;;;549          if ((pInformation->USBwValue0 > 127) || (pInformation->USBwValue1 != 0)
;;;550              || (pInformation->USBwIndex != 0)
;;;551              || (pInformation->Current_Configuration != 0))
;;;552            /* Device Address should be 127 or less*/
;;;553          {
;;;554            ControlState = STALLED;
;;;555            goto exit_NoData_Setup0;
;;;556          }
;;;557          else
;;;558          {
;;;559            Result = USB_SUCCESS;
;;;560          }
;;;561        }
;;;562        /*SET FEATURE for Device*/
;;;563        else if (RequestNo == SET_FEATURE)
;;;564        {
;;;565          if ((pInformation->USBwValue0 == DEVICE_REMOTE_WAKEUP)
;;;566              && (pInformation->USBwIndex == 0)
;;;567              && (ValBit(pInformation->Current_Feature, 5)))
;;;568          {
;;;569            Result = Standard_SetDeviceFeature();
;;;570          }
;;;571          else
;;;572          {
;;;573            Result = USB_UNSUPPORT;
;;;574          }
;;;575        }
;;;576        /*Clear FEATURE for Device */
;;;577        else if (RequestNo == CLEAR_FEATURE)
;;;578        {
;;;579          if (pInformation->USBwValue0 == DEVICE_REMOTE_WAKEUP
;;;580              && pInformation->USBwIndex == 0
;;;581              && ValBit(pInformation->Current_Feature, 5))
;;;582          {
;;;583            Result = Standard_ClearFeature();
;;;584          }
;;;585          else
;;;586          {
;;;587            Result = USB_UNSUPPORT;
;;;588          }
;;;589        }
;;;590    
;;;591      }
;;;592    
;;;593      /* Interface Request*/
;;;594      else if (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))
00000e  f001007f          AND      r0,r1,#0x7f
000012  2801              CMP      r0,#1
000014  d02b              BEQ      |L6.110|
;;;595      {
;;;596        /*SET INTERFACE*/
;;;597        if (RequestNo == SET_INTERFACE)
;;;598        {
;;;599          Result = Standard_SetInterface();
;;;600        }
;;;601      }
;;;602    
;;;603      /* EndPoint Request*/
;;;604      else if (Type_Recipient == (STANDARD_REQUEST | ENDPOINT_RECIPIENT))
000016  2802              CMP      r0,#2
000018  d02e              BEQ      |L6.120|
00001a  e038              B        |L6.142|
                  |L6.28|
00001c  2c09              CMP      r4,#9                 ;541
00001e  d006              BEQ      |L6.46|
000020  2c05              CMP      r4,#5                 ;547
000022  d007              BEQ      |L6.52|
000024  2c03              CMP      r4,#3                 ;563
000026  d00e              BEQ      |L6.70|
000028  2c01              CMP      r4,#1                 ;577
00002a  d017              BEQ      |L6.92|
00002c  e02f              B        |L6.142|
                  |L6.46|
00002e  f7fffffe          BL       Standard_SetConfiguration
000032  e02b              B        |L6.140|
                  |L6.52|
000034  78c1              LDRB     r1,[r0,#3]            ;549
000036  297f              CMP      r1,#0x7f              ;549
000038  d831              BHI      |L6.158|
00003a  7881              LDRB     r1,[r0,#2]            ;549
00003c  bb79              CBNZ     r1,|L6.158|
00003e  8881              LDRH     r1,[r0,#4]            ;550
000040  bb69              CBNZ     r1,|L6.158|
000042  7a80              LDRB     r0,[r0,#0xa]          ;551
000044  e02a              B        |L6.156|
                  |L6.70|
000046  78c1              LDRB     r1,[r0,#3]            ;565
000048  2901              CMP      r1,#1                 ;565
00004a  d120              BNE      |L6.142|
00004c  8881              LDRH     r1,[r0,#4]            ;566
00004e  b9f1              CBNZ     r1,|L6.142|
000050  7a40              LDRB     r0,[r0,#9]            ;567
000052  0680              LSLS     r0,r0,#26             ;567
000054  d51b              BPL      |L6.142|
000056  f7fffffe          BL       Standard_SetDeviceFeature
00005a  e017              B        |L6.140|
                  |L6.92|
00005c  78c1              LDRB     r1,[r0,#3]            ;579
00005e  2901              CMP      r1,#1                 ;579
000060  d115              BNE      |L6.142|
000062  8881              LDRH     r1,[r0,#4]            ;580
000064  b999              CBNZ     r1,|L6.142|
000066  7a40              LDRB     r0,[r0,#9]            ;581
000068  0680              LSLS     r0,r0,#26             ;581
00006a  d40a              BMI      |L6.130|
00006c  e00f              B        |L6.142|
                  |L6.110|
00006e  2c0b              CMP      r4,#0xb               ;597
000070  d10d              BNE      |L6.142|
000072  f7fffffe          BL       Standard_SetInterface
000076  e009              B        |L6.140|
                  |L6.120|
;;;605      {
;;;606        /*CLEAR FEATURE for EndPoint*/
;;;607        if (RequestNo == CLEAR_FEATURE)
000078  2c01              CMP      r4,#1
00007a  d002              BEQ      |L6.130|
;;;608        {
;;;609          Result = Standard_ClearFeature();
;;;610        }
;;;611        /* SET FEATURE for EndPoint*/
;;;612        else if (RequestNo == SET_FEATURE)
00007c  2c03              CMP      r4,#3
00007e  d003              BEQ      |L6.136|
000080  e005              B        |L6.142|
                  |L6.130|
000082  f7fffffe          BL       Standard_ClearFeature
000086  e001              B        |L6.140|
                  |L6.136|
;;;613        {
;;;614          Result = Standard_SetEndPointFeature();
000088  f7fffffe          BL       Standard_SetEndPointFeature
                  |L6.140|
;;;615        }
;;;616      }
;;;617      else
;;;618      {
;;;619        Result = USB_UNSUPPORT;
;;;620      }
;;;621    
;;;622    
;;;623      if (Result != USB_SUCCESS)
00008c  b158              CBZ      r0,|L6.166|
                  |L6.142|
;;;624      {
;;;625        Result = (*pProperty->Class_NoData_Setup)(RequestNo);
00008e  480e              LDR      r0,|L6.200|
000090  6800              LDR      r0,[r0,#0]  ; pProperty
000092  6941              LDR      r1,[r0,#0x14]
000094  b2e0              UXTB     r0,r4
000096  4788              BLX      r1
;;;626        if (Result == USB_NOT_READY)
000098  2803              CMP      r0,#3
00009a  d002              BEQ      |L6.162|
                  |L6.156|
;;;627        {
;;;628          ControlState = PAUSE;
;;;629          goto exit_NoData_Setup0;
;;;630        }
;;;631      }
;;;632    
;;;633      if (Result != USB_SUCCESS)
00009c  b118              CBZ      r0,|L6.166|
                  |L6.158|
;;;634      {
;;;635        ControlState = STALLED;
00009e  2008              MOVS     r0,#8
;;;636        goto exit_NoData_Setup0;
0000a0  e00d              B        |L6.190|
                  |L6.162|
0000a2  2009              MOVS     r0,#9                 ;628
0000a4  e00b              B        |L6.190|
                  |L6.166|
;;;637      }
;;;638    
;;;639      ControlState = WAIT_STATUS_IN;/* After no data stage SETUP */
;;;640    
;;;641      USB_StatusIn();
0000a6  4a09              LDR      r2,|L6.204|
0000a8  2006              MOVS     r0,#6                 ;639
0000aa  2100              MOVS     r1,#0
0000ac  6812              LDR      r2,[r2,#0]
0000ae  4b08              LDR      r3,|L6.208|
0000b0  b292              UXTH     r2,r2
0000b2  eb030242          ADD      r2,r3,r2,LSL #1
0000b6  6051              STR      r1,[r2,#4]
0000b8  4a06              LDR      r2,|L6.212|
0000ba  2130              MOVS     r1,#0x30
0000bc  8011              STRH     r1,[r2,#0]
                  |L6.190|
;;;642    
;;;643    exit_NoData_Setup0:
;;;644      pInformation->ControlState = ControlState;
0000be  6829              LDR      r1,[r5,#0]  ; pInformation
0000c0  7208              STRB     r0,[r1,#8]
;;;645      return;
;;;646    }
0000c2  bd70              POP      {r4-r6,pc}
;;;647    
                          ENDP

                  |L6.196|
                          DCD      pInformation
                  |L6.200|
                          DCD      pProperty
                  |L6.204|
                          DCD      0x40005c50
                  |L6.208|
                          DCD      0x40006000
                  |L6.212|
                          DCD      SaveTState

                          AREA ||i.Out0_Process||, CODE, READONLY, ALIGN=2

                  Out0_Process PROC
;;;905    *******************************************************************************/
;;;906    u8 Out0_Process(void)
000000  b510              PUSH     {r4,lr}
;;;907    {
;;;908      u32 ControlState = pInformation->ControlState;
000002  4c0d              LDR      r4,|L7.56|
000004  6820              LDR      r0,[r4,#0]  ; pInformation
000006  7a00              LDRB     r0,[r0,#8]
;;;909    
;;;910      if ((ControlState == OUT_DATA) || (ControlState == LAST_OUT_DATA))
000008  2803              CMP      r0,#3
00000a  d004              BEQ      |L7.22|
00000c  2805              CMP      r0,#5
00000e  d002              BEQ      |L7.22|
;;;911      {
;;;912        DataStageOut();
;;;913        ControlState = pInformation->ControlState; /* may be changed outside the function */
;;;914      }
;;;915    
;;;916      else if (ControlState == WAIT_STATUS_OUT)
000010  2807              CMP      r0,#7
000012  d005              BEQ      |L7.32|
000014  e008              B        |L7.40|
                  |L7.22|
000016  f7fffffe          BL       DataStageOut
00001a  6820              LDR      r0,[r4,#0]            ;913  ; pInformation
00001c  7a00              LDRB     r0,[r0,#8]            ;913
00001e  e004              B        |L7.42|
                  |L7.32|
;;;917      {
;;;918        (*pProperty->Process_Status_OUT)();
000020  4806              LDR      r0,|L7.60|
000022  6800              LDR      r0,[r0,#0]  ; pProperty
000024  68c0              LDR      r0,[r0,#0xc]
000026  4780              BLX      r0
                  |L7.40|
;;;919        ControlState = STALLED;
;;;920      }
;;;921    
;;;922      else if ((ControlState == IN_DATA) || (ControlState == LAST_IN_DATA))
;;;923      {
;;;924        /* host aborts the transfer before finish */
;;;925        ControlState = STALLED;
000028  2008              MOVS     r0,#8
                  |L7.42|
;;;926      }
;;;927    
;;;928      /* Unexpect state, STALL the endpoint */
;;;929      else
;;;930      {
;;;931        ControlState = STALLED;
;;;932      }
;;;933    
;;;934      pInformation->ControlState = ControlState;
00002a  6821              LDR      r1,[r4,#0]  ; pInformation
00002c  7208              STRB     r0,[r1,#8]
;;;935    
;;;936      return Post0_Process();
00002e  e8bd4010          POP      {r4,lr}
000032  f7ffbffe          B.W      Post0_Process
;;;937    }
;;;938    
                          ENDP

000036  0000              DCW      0x0000
                  |L7.56|
                          DCD      pInformation
                  |L7.60|
                          DCD      pProperty

                          AREA ||i.Post0_Process||, CODE, READONLY, ALIGN=2

                  Post0_Process PROC
;;;946    *******************************************************************************/
;;;947    u8 Post0_Process(void)
000000  480b              LDR      r0,|L8.48|
;;;948    {
000002  b510              PUSH     {r4,lr}
;;;949      SetEPRxCount(ENDP0, Device_Property.MaxPacketSize);
000004  f890102c          LDRB     r1,[r0,#0x2c]  ; Device_Property
000008  2000              MOVS     r0,#0
00000a  f7fffffe          BL       SetEPRxCount
;;;950    
;;;951      if (pInformation->ControlState == STALLED)
00000e  4809              LDR      r0,|L8.52|
000010  6800              LDR      r0,[r0,#0]  ; pInformation
000012  7a01              LDRB     r1,[r0,#8]
000014  2908              CMP      r1,#8
000016  d105              BNE      |L8.36|
;;;952      {
;;;953        vSetEPRxStatus(EP_RX_STALL);
000018  4a07              LDR      r2,|L8.56|
00001a  0248              LSLS     r0,r1,#9
00001c  8010              STRH     r0,[r2,#0]
;;;954        vSetEPTxStatus(EP_TX_STALL);
00001e  4a07              LDR      r2,|L8.60|
000020  2010              MOVS     r0,#0x10
000022  8010              STRH     r0,[r2,#0]
                  |L8.36|
;;;955      }
;;;956    
;;;957      return (pInformation->ControlState == PAUSE);
000024  2001              MOVS     r0,#1
000026  2909              CMP      r1,#9
000028  d000              BEQ      |L8.44|
00002a  2000              MOVS     r0,#0
                  |L8.44|
;;;958    }
00002c  bd10              POP      {r4,pc}
;;;959    
                          ENDP

00002e  0000              DCW      0x0000
                  |L8.48|
                          DCD      Device_Property
                  |L8.52|
                          DCD      pInformation
                  |L8.56|
                          DCD      SaveRState
                  |L8.60|
                          DCD      SaveTState

                          AREA ||i.SetDeviceAddress||, CODE, READONLY, ALIGN=2

                  SetDeviceAddress PROC
;;;966    *******************************************************************************/
;;;967    void SetDeviceAddress(u8 Val)
000000  b5f0              PUSH     {r4-r7,lr}
;;;968    {
;;;969      u32 i;
;;;970      u32 nEP = Device_Table.Total_Endpoint;
000002  490c              LDR      r1,|L9.52|
;;;971    
;;;972      /* set address in every used endpoint */
;;;973      for (i = 0; i < nEP; i++)
;;;974      {
;;;975        _SetEPAddress((u8)i, (u8)i);
000004  4e0c              LDR      r6,|L9.56|
000006  f648778f          MOV      r7,#0x8f8f
00000a  780a              LDRB     r2,[r1,#0]            ;970  ; Device_Table
00000c  2100              MOVS     r1,#0                 ;973
00000e  e008              B        |L9.34|
                  |L9.16|
000010  b2cb              UXTB     r3,r1
000012  eb060483          ADD      r4,r6,r3,LSL #2
000016  6825              LDR      r5,[r4,#0]
000018  b2ad              UXTH     r5,r5
00001a  403d              ANDS     r5,r5,r7
00001c  431d              ORRS     r5,r5,r3
00001e  6025              STR      r5,[r4,#0]
000020  1c49              ADDS     r1,r1,#1              ;973
                  |L9.34|
000022  4291              CMP      r1,r2                 ;973
000024  d3f4              BCC      |L9.16|
;;;976      } /* for */
;;;977      _SetDADDR(Val | DADDR_EF); /* set device address and enable function */
000026  4904              LDR      r1,|L9.56|
000028  f0400080          ORR      r0,r0,#0x80
00002c  314c              ADDS     r1,r1,#0x4c
00002e  6008              STR      r0,[r1,#0]
;;;978    }
000030  bdf0              POP      {r4-r7,pc}
;;;979    
                          ENDP

000032  0000              DCW      0x0000
                  |L9.52|
                          DCD      Device_Table
                  |L9.56|
                          DCD      0x40005c00

                          AREA ||i.Setup0_Process||, CODE, READONLY, ALIGN=2

                  Setup0_Process PROC
;;;821    *******************************************************************************/
;;;822    u8 Setup0_Process(void)
000000  b570              PUSH     {r4-r6,lr}
;;;823    {
;;;824    
;;;825      union
;;;826      {
;;;827        u8* b;
;;;828        u16* w;
;;;829      } pBuf;
;;;830    
;;;831      pBuf.b = PMAAddr + (u8 *)(_GetEPRxAddr(ENDP0) * 2); /* *2 for 32 bits addr */
000002  4816              LDR      r0,|L10.92|
000004  6800              LDR      r0,[r0,#0]
;;;832    
;;;833      if (pInformation->ControlState != PAUSE)
000006  4d17              LDR      r5,|L10.100|
000008  b281              UXTH     r1,r0                 ;831
00000a  4815              LDR      r0,|L10.96|
00000c  eb000141          ADD      r1,r0,r1,LSL #1       ;831
000010  6889              LDR      r1,[r1,#8]            ;831
000012  b289              UXTH     r1,r1                 ;831
000014  eb000441          ADD      r4,r0,r1,LSL #1       ;831
000018  6828              LDR      r0,[r5,#0]  ; pInformation
00001a  7a01              LDRB     r1,[r0,#8]
00001c  2909              CMP      r1,#9
00001e  d00f              BEQ      |L10.64|
;;;834      {
;;;835        pInformation->USBbmRequestType = *pBuf.b++; /* bmRequestType */
000020  7821              LDRB     r1,[r4,#0]
000022  7001              STRB     r1,[r0,#0]
;;;836        pInformation->USBbRequest = *pBuf.b++; /* bRequest */
000024  7861              LDRB     r1,[r4,#1]
000026  7041              STRB     r1,[r0,#1]
;;;837        pBuf.w++;  /* word not accessed because of 32 bits addressing */
;;;838        pInformation->USBwValue = ByteSwap(*pBuf.w++); /* wValue */
000028  88a0              LDRH     r0,[r4,#4]
00002a  f7fffffe          BL       ByteSwap
00002e  6829              LDR      r1,[r5,#0]  ; pInformation
000030  8048              STRH     r0,[r1,#2]
;;;839        pBuf.w++;  /* word not accessed because of 32 bits addressing */
;;;840        pInformation->USBwIndex  = ByteSwap(*pBuf.w++); /* wIndex */
000032  8920              LDRH     r0,[r4,#8]
000034  f7fffffe          BL       ByteSwap
000038  6829              LDR      r1,[r5,#0]  ; pInformation
00003a  8088              STRH     r0,[r1,#4]
;;;841        pBuf.w++;  /* word not accessed because of 32 bits addressing */
;;;842        pInformation->USBwLength = *pBuf.w; /* wLength */
00003c  89a0              LDRH     r0,[r4,#0xc]
00003e  80c8              STRH     r0,[r1,#6]
                  |L10.64|
;;;843      }
;;;844    
;;;845      pInformation->ControlState = SETTING_UP;
000040  6828              LDR      r0,[r5,#0]  ; pInformation
000042  2101              MOVS     r1,#1
000044  7201              STRB     r1,[r0,#8]
;;;846      if (pInformation->USBwLength == 0)
000046  88c0              LDRH     r0,[r0,#6]
000048  b128              CBZ      r0,|L10.86|
;;;847      {
;;;848        /* Setup with no data stage */
;;;849        NoData_Setup0();
;;;850      }
;;;851      else
;;;852      {
;;;853        /* Setup with data stage */
;;;854        Data_Setup0();
00004a  f7fffffe          BL       Data_Setup0
                  |L10.78|
;;;855      }
;;;856      return Post0_Process();
00004e  e8bd4070          POP      {r4-r6,lr}
000052  f7ffbffe          B.W      Post0_Process
                  |L10.86|
000056  f7fffffe          BL       NoData_Setup0
00005a  e7f8              B        |L10.78|
;;;857    }
;;;858    
                          ENDP

                  |L10.92|
                          DCD      0x40005c50
                  |L10.96|
                          DCD      0x40006000
                  |L10.100|
                          DCD      pInformation

                          AREA ||i.Standard_ClearFeature||, CODE, READONLY, ALIGN=2

                  Standard_ClearFeature PROC
;;;235    *******************************************************************************/
;;;236    RESULT Standard_ClearFeature(void)
000000  b570              PUSH     {r4-r6,lr}
;;;237    {
;;;238      u32     Type_Rec = Type_Recipient;
000002  4832              LDR      r0,|L11.204|
000004  6801              LDR      r1,[r0,#0]  ; pInformation
000006  7808              LDRB     r0,[r1,#0]
000008  f010007f          ANDS     r0,r0,#0x7f
;;;239      u32     Status;
;;;240    
;;;241    
;;;242      if (Type_Rec == (STANDARD_REQUEST | DEVICE_RECIPIENT))
00000c  d002              BEQ      |L11.20|
;;;243      {/*Device Clear Feature*/
;;;244        ClrBit(pInformation->Current_Feature, 5);
;;;245        return USB_SUCCESS;
;;;246      }
;;;247      else if (Type_Rec == (STANDARD_REQUEST | ENDPOINT_RECIPIENT))
00000e  2802              CMP      r0,#2
000010  d005              BEQ      |L11.30|
000012  e059              B        |L11.200|
                  |L11.20|
000014  7a48              LDRB     r0,[r1,#9]            ;244
000016  f00000df          AND      r0,r0,#0xdf           ;244
00001a  7248              STRB     r0,[r1,#9]            ;244
00001c  e045              B        |L11.170|
                  |L11.30|
;;;248      {/*EndPoint Clear Feature*/
;;;249        DEVICE* pDev;
;;;250        u32 Related_Endpoint;
;;;251        u32 wIndex0;
;;;252        u32 rEP;
;;;253    
;;;254        if ((pInformation->USBwValue != ENDPOINT_STALL)
00001e  8848              LDRH     r0,[r1,#2]
000020  2800              CMP      r0,#0
000022  d151              BNE      |L11.200|
;;;255            || (pInformation->USBwIndex1 != 0))
000024  7908              LDRB     r0,[r1,#4]
000026  bbf0              CBNZ     r0,|L11.166|
;;;256        {
;;;257          return USB_UNSUPPORT;
;;;258        }
;;;259    
;;;260        pDev = &Device_Table;
;;;261        wIndex0 = pInformation->USBwIndex0;
000028  794a              LDRB     r2,[r1,#5]
;;;262        rEP = wIndex0 & ~0x80;
;;;263        Related_Endpoint = ENDP0 + rEP;
;;;264    
;;;265        if (ValBit(pInformation->USBwIndex0, 7))
;;;266        {
;;;267          /*Get Status of endpoint & stall the request if the related_ENdpoint
;;;268          is Disabled*/
;;;269          Status = _GetEPTxStatus(Related_Endpoint);
00002a  4c2a              LDR      r4,|L11.212|
00002c  f0220080          BIC      r0,r2,#0x80           ;262
000030  0615              LSLS     r5,r2,#24             ;265
000032  4b27              LDR      r3,|L11.208|
;;;270        }
;;;271        else
;;;272        {
;;;273          Status = _GetEPRxStatus(Related_Endpoint);
000034  f8545020          LDR      r5,[r4,r0,LSL #2]
000038  d503              BPL      |L11.66|
00003a  f3c51501          UBFX     r5,r5,#4,#2           ;269
00003e  012d              LSLS     r5,r5,#4              ;269
000040  e002              B        |L11.72|
                  |L11.66|
000042  f3c53501          UBFX     r5,r5,#12,#2
000046  032d              LSLS     r5,r5,#12
                  |L11.72|
;;;274        }
;;;275    
;;;276        if ((rEP >= pDev->Total_Endpoint) || (Status == 0)
000048  781e              LDRB     r6,[r3,#0]
00004a  4603              MOV      r3,r0
00004c  4286              CMP      r6,r0
00004e  d93b              BLS      |L11.200|
000050  b34d              CBZ      r5,|L11.166|
;;;277            || (pInformation->Current_Configuration == 0))
000052  7a89              LDRB     r1,[r1,#0xa]
000054  b339              CBZ      r1,|L11.166|
;;;278        {
;;;279          return USB_UNSUPPORT;
;;;280        }
;;;281    
;;;282    
;;;283        if (wIndex0 & 0x80)
000056  0611              LSLS     r1,r2,#24
000058  d50e              BPL      |L11.120|
;;;284        {
;;;285          /* IN endpoint */
;;;286          if (_GetTxStallStatus(Related_Endpoint ))
00005a  f8541020          LDR      r1,[r4,r0,LSL #2]
00005e  f3c11101          UBFX     r1,r1,#4,#2
000062  2901              CMP      r1,#1
000064  d11b              BNE      |L11.158|
;;;287          {
;;;288            ClearDTOG_TX(Related_Endpoint);
000066  b2d8              UXTB     r0,r3
000068  4604              MOV      r4,r0
00006a  f7fffffe          BL       ClearDTOG_TX
;;;289            SetEPTxStatus(Related_Endpoint, EP_TX_VALID);
00006e  2130              MOVS     r1,#0x30
000070  4620              MOV      r0,r4
000072  f7fffffe          BL       SetEPTxStatus
000076  e012              B        |L11.158|
                  |L11.120|
;;;290          }
;;;291        }
;;;292        else
;;;293        {
;;;294          /* OUT endpoint */
;;;295          if (_GetRxStallStatus(Related_Endpoint))
000078  eb040580          ADD      r5,r4,r0,LSL #2
00007c  6829              LDR      r1,[r5,#0]
00007e  f3c13101          UBFX     r1,r1,#12,#2
000082  2901              CMP      r1,#1
000084  d10b              BNE      |L11.158|
;;;296          {
;;;297            if (Related_Endpoint == ENDP0)
;;;298            {
;;;299              /* After clear the STALL, enable the default endpoint receiver */
;;;300              SetEPRxCount(Related_Endpoint, Device_Property.MaxPacketSize);
;;;301              _SetEPRxStatus(Related_Endpoint, EP_RX_VALID);
000086  f64b768f          MOV      r6,#0xbf8f
00008a  b180              CBZ      r0,|L11.174|
;;;302            }
;;;303            else
;;;304            {
;;;305              ClearDTOG_RX(Related_Endpoint);
00008c  b2d8              UXTB     r0,r3
00008e  f7fffffe          BL       ClearDTOG_RX
;;;306              _SetEPRxStatus(Related_Endpoint, EP_RX_VALID);
000092  6828              LDR      r0,[r5,#0]
000094  b280              UXTH     r0,r0
000096  4030              ANDS     r0,r0,r6
000098  f4805040          EOR      r0,r0,#0x3000
00009c  6028              STR      r0,[r5,#0]
                  |L11.158|
;;;307            }
;;;308          }
;;;309        }
;;;310        pUser_Standard_Requests->User_ClearFeature();
00009e  480e              LDR      r0,|L11.216|
0000a0  6800              LDR      r0,[r0,#0]  ; pUser_Standard_Requests
0000a2  6940              LDR      r0,[r0,#0x14]
0000a4  e000              B        |L11.168|
                  |L11.166|
0000a6  e00f              B        |L11.200|
                  |L11.168|
0000a8  4780              BLX      r0
                  |L11.170|
;;;311        return USB_SUCCESS;
0000aa  2000              MOVS     r0,#0
;;;312      }
;;;313    
;;;314      return USB_UNSUPPORT;
;;;315    }
0000ac  bd70              POP      {r4-r6,pc}
                  |L11.174|
0000ae  480b              LDR      r0,|L11.220|
0000b0  f890102c          LDRB     r1,[r0,#0x2c]         ;300  ; Device_Property
0000b4  2000              MOVS     r0,#0                 ;300
0000b6  f7fffffe          BL       SetEPRxCount
0000ba  6820              LDR      r0,[r4,#0]            ;301
0000bc  b280              UXTH     r0,r0                 ;301
0000be  4030              ANDS     r0,r0,r6              ;301
0000c0  f4805040          EOR      r0,r0,#0x3000         ;301
0000c4  6020              STR      r0,[r4,#0]            ;301
0000c6  e7ea              B        |L11.158|
                  |L11.200|
0000c8  2002              MOVS     r0,#2                 ;314
0000ca  bd70              POP      {r4-r6,pc}
;;;316    
                          ENDP

                  |L11.204|
                          DCD      pInformation
                  |L11.208|
                          DCD      Device_Table
                  |L11.212|
                          DCD      0x40005c00
                  |L11.216|
                          DCD      pUser_Standard_Requests
                  |L11.220|
                          DCD      Device_Property

                          AREA ||i.Standard_GetConfiguration||, CODE, READONLY, ALIGN=2

                  Standard_GetConfiguration PROC
;;;55     *******************************************************************************/
;;;56     u8 *Standard_GetConfiguration(u16 Length)
000000  b510              PUSH     {r4,lr}
;;;57     {
;;;58       if (Length == 0)
;;;59       {
;;;60         pInformation->Ctrl_Info.Usb_wLength =
000002  4c07              LDR      r4,|L12.32|
000004  b130              CBZ      r0,|L12.20|
;;;61           sizeof(pInformation->Current_Configuration);
;;;62         return 0;
;;;63       }
;;;64       pUser_Standard_Requests->User_GetConfiguration();
000006  4807              LDR      r0,|L12.36|
000008  6800              LDR      r0,[r0,#0]  ; pUser_Standard_Requests
00000a  6800              LDR      r0,[r0,#0]
00000c  4780              BLX      r0
;;;65       return (u8 *)&pInformation->Current_Configuration;
00000e  6820              LDR      r0,[r4,#0]  ; pInformation
000010  300a              ADDS     r0,r0,#0xa
;;;66     }
000012  bd10              POP      {r4,pc}
                  |L12.20|
000014  6821              LDR      r1,[r4,#0]            ;60  ; pInformation
000016  2001              MOVS     r0,#1                 ;60
000018  8208              STRH     r0,[r1,#0x10]         ;60
00001a  2000              MOVS     r0,#0                 ;62
00001c  bd10              POP      {r4,pc}
;;;67     
                          ENDP

00001e  0000              DCW      0x0000
                  |L12.32|
                          DCD      pInformation
                  |L12.36|
                          DCD      pUser_Standard_Requests

                          AREA ||i.Standard_GetDescriptorData||, CODE, READONLY, ALIGN=2

                  Standard_GetDescriptorData PROC
;;;404    *******************************************************************************/
;;;405    u8 *Standard_GetDescriptorData(u16 Length, ONE_DESCRIPTOR *pDesc)
000000  4a05              LDR      r2,|L13.24|
;;;406    {
;;;407      u32  wOffset;
;;;408    
;;;409      wOffset = pInformation->Ctrl_Info.Usb_wOffset;
000002  6813              LDR      r3,[r2,#0]  ; pInformation
000004  8a5a              LDRH     r2,[r3,#0x12]
;;;410      if (Length == 0)
000006  b110              CBZ      r0,|L13.14|
;;;411      {
;;;412        pInformation->Ctrl_Info.Usb_wLength = pDesc->Descriptor_Size - wOffset;
;;;413        return 0;
;;;414      }
;;;415    
;;;416      return pDesc->Descriptor + wOffset;
000008  6808              LDR      r0,[r1,#0]
00000a  4410              ADD      r0,r0,r2
;;;417    }
00000c  4770              BX       lr
                  |L13.14|
00000e  8888              LDRH     r0,[r1,#4]            ;412
000010  1a80              SUBS     r0,r0,r2              ;412
000012  8218              STRH     r0,[r3,#0x10]         ;412
000014  2000              MOVS     r0,#0                 ;413
000016  4770              BX       lr
;;;418    
                          ENDP

                  |L13.24|
                          DCD      pInformation

                          AREA ||i.Standard_GetInterface||, CODE, READONLY, ALIGN=2

                  Standard_GetInterface PROC
;;;101    *******************************************************************************/
;;;102    u8 *Standard_GetInterface(u16 Length)
000000  b510              PUSH     {r4,lr}
;;;103    {
;;;104      if (Length == 0)
;;;105      {
;;;106        pInformation->Ctrl_Info.Usb_wLength =
000002  4c07              LDR      r4,|L14.32|
000004  b130              CBZ      r0,|L14.20|
;;;107          sizeof(pInformation->Current_AlternateSetting);
;;;108        return 0;
;;;109      }
;;;110      pUser_Standard_Requests->User_GetInterface();
000006  4807              LDR      r0,|L14.36|
000008  6800              LDR      r0,[r0,#0]  ; pUser_Standard_Requests
00000a  6880              LDR      r0,[r0,#8]
00000c  4780              BLX      r0
;;;111      return (u8 *)&pInformation->Current_AlternateSetting;
00000e  6820              LDR      r0,[r4,#0]  ; pInformation
000010  300c              ADDS     r0,r0,#0xc
;;;112    }
000012  bd10              POP      {r4,pc}
                  |L14.20|
000014  6821              LDR      r1,[r4,#0]            ;106  ; pInformation
000016  2001              MOVS     r0,#1                 ;106
000018  8208              STRH     r0,[r1,#0x10]         ;106
00001a  2000              MOVS     r0,#0                 ;108
00001c  bd10              POP      {r4,pc}
;;;113    
                          ENDP

00001e  0000              DCW      0x0000
                  |L14.32|
                          DCD      pInformation
                  |L14.36|
                          DCD      pUser_Standard_Requests

                          AREA ||i.Standard_GetStatus||, CODE, READONLY, ALIGN=2

                  Standard_GetStatus PROC
;;;157    *******************************************************************************/
;;;158    u8 *Standard_GetStatus(u16 Length)
000000  491e              LDR      r1,|L15.124|
;;;159    {
000002  b510              PUSH     {r4,lr}
;;;160      if (Length == 0)
;;;161      {
;;;162        pInformation->Ctrl_Info.Usb_wLength = 2;
000004  6809              LDR      r1,[r1,#0]
000006  b160              CBZ      r0,|L15.34|
;;;163        return 0;
;;;164      }
;;;165    
;;;166      StatusInfo.w = 0;
000008  481d              LDR      r0,|L15.128|
00000a  2200              MOVS     r2,#0
00000c  8002              STRH     r2,[r0,#0]
;;;167      /* Reset Status Information */
;;;168    
;;;169      if (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
00000e  780a              LDRB     r2,[r1,#0]
000010  0653              LSLS     r3,r2,#25
000012  d00a              BEQ      |L15.42|
;;;170      {
;;;171        /*Get Device Status */
;;;172        u8 Feature = pInformation->Current_Feature;
;;;173    
;;;174        /* Remote Wakeup enabled */
;;;175        if (ValBit(Feature, 5))
;;;176        {
;;;177          SetBit(StatusInfo0, 1);
;;;178        }
;;;179    
;;;180        /* Self-powered */
;;;181        if (ValBit(Feature, 6))
;;;182        {
;;;183          SetBit(StatusInfo0, 0);
;;;184        }
;;;185        else /* Bus-powered */
;;;186        {
;;;187          ClrBit(StatusInfo0, 0);
;;;188        }
;;;189      }
;;;190      /*Interface Status*/
;;;191      else if (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))
000014  f002027f          AND      r2,r2,#0x7f
000018  2a01              CMP      r2,#1
00001a  d013              BEQ      |L15.68|
;;;192      {
;;;193        return (u8 *)&StatusInfo;
;;;194      }
;;;195      /*Get EndPoint Status*/
;;;196      else if (Type_Recipient == (STANDARD_REQUEST | ENDPOINT_RECIPIENT))
00001c  2a02              CMP      r2,#2
00001e  d013              BEQ      |L15.72|
000020  e001              B        |L15.38|
                  |L15.34|
000022  2002              MOVS     r0,#2                 ;162
000024  8208              STRH     r0,[r1,#0x10]         ;162
                  |L15.38|
;;;197      {
;;;198        u8 Related_Endpoint;
;;;199        u8 wIndex0 = pInformation->USBwIndex0;
;;;200    
;;;201        Related_Endpoint = (wIndex0 & 0x0f);
;;;202        if (ValBit(wIndex0, 7))
;;;203        {
;;;204          /* IN endpoint */
;;;205          if (_GetTxStallStatus(Related_Endpoint))
;;;206          {
;;;207            SetBit(StatusInfo0, 0); /* IN Endpoint stalled */
;;;208          }
;;;209        }
;;;210        else
;;;211        {
;;;212          /* OUT endpoint */
;;;213          if (_GetRxStallStatus(Related_Endpoint))
;;;214          {
;;;215            SetBit(StatusInfo0, 0); /* OUT Endpoint stalled */
;;;216          }
;;;217        }
;;;218    
;;;219      }
;;;220      else
;;;221      {
;;;222        return NULL;
000026  2000              MOVS     r0,#0
;;;223      }
;;;224      pUser_Standard_Requests->User_GetStatus();
;;;225      return (u8 *)&StatusInfo;
;;;226    }
000028  bd10              POP      {r4,pc}
                  |L15.42|
00002a  7a49              LDRB     r1,[r1,#9]            ;172
00002c  068a              LSLS     r2,r1,#26             ;175
00002e  d503              BPL      |L15.56|
000030  7802              LDRB     r2,[r0,#0]            ;177  ; StatusInfo
000032  f0420202          ORR      r2,r2,#2              ;177
000036  7002              STRB     r2,[r0,#0]            ;177
                  |L15.56|
000038  0649              LSLS     r1,r1,#25             ;181
00003a  d410              BMI      |L15.94|
00003c  7801              LDRB     r1,[r0,#0]            ;187  ; StatusInfo
00003e  f00101fe          AND      r1,r1,#0xfe           ;187
000042  e00f              B        |L15.100|
                  |L15.68|
000044  480e              LDR      r0,|L15.128|
000046  bd10              POP      {r4,pc}
                  |L15.72|
000048  794a              LDRB     r2,[r1,#5]            ;199
00004a  f002010f          AND      r1,r2,#0xf            ;201
00004e  0613              LSLS     r3,r2,#24             ;202
000050  4a0c              LDR      r2,|L15.132|
000052  f8521021          LDR      r1,[r2,r1,LSL #2]     ;213
000056  d507              BPL      |L15.104|
000058  f3c11101          UBFX     r1,r1,#4,#2           ;205
00005c  e006              B        |L15.108|
                  |L15.94|
00005e  7801              LDRB     r1,[r0,#0]            ;207  ; StatusInfo
000060  f0410101          ORR      r1,r1,#1              ;207
                  |L15.100|
000064  7001              STRB     r1,[r0,#0]            ;207
000066  e003              B        |L15.112|
                  |L15.104|
000068  f3c13101          UBFX     r1,r1,#12,#2          ;213
                  |L15.108|
00006c  2901              CMP      r1,#1                 ;205
00006e  d0f6              BEQ      |L15.94|
                  |L15.112|
000070  4805              LDR      r0,|L15.136|
000072  6800              LDR      r0,[r0,#0]            ;224  ; pUser_Standard_Requests
000074  6900              LDR      r0,[r0,#0x10]         ;224
000076  4780              BLX      r0                    ;224
000078  e7e4              B        |L15.68|
;;;227    
                          ENDP

00007a  0000              DCW      0x0000
                  |L15.124|
                          DCD      pInformation
                  |L15.128|
                          DCD      ||.data||
                  |L15.132|
                          DCD      0x40005c00
                  |L15.136|
                          DCD      pUser_Standard_Requests

                          AREA ||i.Standard_SetConfiguration||, CODE, READONLY, ALIGN=2

                  Standard_SetConfiguration PROC
;;;76     *******************************************************************************/
;;;77     RESULT Standard_SetConfiguration(void)
000000  480a              LDR      r0,|L16.44|
;;;78     {
000002  b510              PUSH     {r4,lr}
;;;79     
;;;80       if ((pInformation->USBwValue0 <=
000004  6800              LDR      r0,[r0,#0]  ; pInformation
000006  4a0a              LDR      r2,|L16.48|
000008  78c1              LDRB     r1,[r0,#3]
00000a  7852              LDRB     r2,[r2,#1]  ; Device_Table
00000c  4291              CMP      r1,r2
00000e  d803              BHI      |L16.24|
;;;81           Device_Table.Total_Configuration) && (pInformation->USBwValue1 == 0)
000010  7882              LDRB     r2,[r0,#2]
000012  b90a              CBNZ     r2,|L16.24|
;;;82           && (pInformation->USBwIndex == 0)) /*call Back usb spec 2.0*/
000014  8882              LDRH     r2,[r0,#4]
000016  b10a              CBZ      r2,|L16.28|
                  |L16.24|
;;;83       {
;;;84         pInformation->Current_Configuration = pInformation->USBwValue0;
;;;85         pUser_Standard_Requests->User_SetConfiguration();
;;;86         return USB_SUCCESS;
;;;87       }
;;;88       else
;;;89       {
;;;90         return USB_UNSUPPORT;
000018  2002              MOVS     r0,#2
;;;91       }
;;;92     }
00001a  bd10              POP      {r4,pc}
                  |L16.28|
00001c  7281              STRB     r1,[r0,#0xa]          ;84
00001e  4805              LDR      r0,|L16.52|
000020  6800              LDR      r0,[r0,#0]            ;85  ; pUser_Standard_Requests
000022  6840              LDR      r0,[r0,#4]            ;85
000024  4780              BLX      r0                    ;85
000026  2000              MOVS     r0,#0                 ;86
000028  bd10              POP      {r4,pc}
;;;93     
                          ENDP

00002a  0000              DCW      0x0000
                  |L16.44|
                          DCD      pInformation
                  |L16.48|
                          DCD      Device_Table
                  |L16.52|
                          DCD      pUser_Standard_Requests

                          AREA ||i.Standard_SetDeviceFeature||, CODE, READONLY, ALIGN=2

                  Standard_SetDeviceFeature PROC
;;;378    *******************************************************************************/
;;;379    RESULT Standard_SetDeviceFeature(void)
000000  4806              LDR      r0,|L17.28|
;;;380    {
000002  b510              PUSH     {r4,lr}
;;;381      SetBit(pInformation->Current_Feature, 5);
000004  6800              LDR      r0,[r0,#0]  ; pInformation
000006  7a41              LDRB     r1,[r0,#9]
000008  f0410120          ORR      r1,r1,#0x20
00000c  7241              STRB     r1,[r0,#9]
;;;382      pUser_Standard_Requests->User_SetDeviceFeature();
00000e  4804              LDR      r0,|L17.32|
000010  6800              LDR      r0,[r0,#0]  ; pUser_Standard_Requests
000012  69c0              LDR      r0,[r0,#0x1c]
000014  4780              BLX      r0
;;;383      return USB_SUCCESS;
000016  2000              MOVS     r0,#0
;;;384    }
000018  bd10              POP      {r4,pc}
;;;385    
                          ENDP

00001a  0000              DCW      0x0000
                  |L17.28|
                          DCD      pInformation
                  |L17.32|
                          DCD      pUser_Standard_Requests

                          AREA ||i.Standard_SetEndPointFeature||, CODE, READONLY, ALIGN=2

                  Standard_SetEndPointFeature PROC
;;;324    *******************************************************************************/
;;;325    RESULT Standard_SetEndPointFeature(void)
000000  b570              PUSH     {r4-r6,lr}
;;;326    {
;;;327      u32    wIndex0;
;;;328      u32    Related_Endpoint;
;;;329      u32    rEP;
;;;330      u32   Status;
;;;331    
;;;332      wIndex0 = pInformation->USBwIndex0;
000002  481b              LDR      r0,|L18.112|
000004  6803              LDR      r3,[r0,#0]  ; pInformation
;;;333      rEP = wIndex0 & ~0x80;
;;;334      Related_Endpoint = ENDP0 + rEP;
;;;335    
;;;336      if (ValBit(pInformation->USBwIndex0, 7))
;;;337      {
;;;338        /* get Status of endpoint & stall the request if the related_ENdpoint
;;;339        is Disabled*/
;;;340        Status = _GetEPTxStatus(Related_Endpoint);
000006  481b              LDR      r0,|L18.116|
000008  7959              LDRB     r1,[r3,#5]            ;332
00000a  f0210580          BIC      r5,r1,#0x80           ;333
00000e  eb000085          ADD      r0,r0,r5,LSL #2
000012  060c              LSLS     r4,r1,#24             ;336
;;;341      }
;;;342      else
;;;343      {
;;;344        Status = _GetEPRxStatus(Related_Endpoint);
000014  6804              LDR      r4,[r0,#0]
000016  f0210280          BIC      r2,r1,#0x80           ;333
00001a  d503              BPL      |L18.36|
00001c  f3c41401          UBFX     r4,r4,#4,#2           ;340
000020  0124              LSLS     r4,r4,#4              ;340
000022  e002              B        |L18.42|
                  |L18.36|
000024  f3c43401          UBFX     r4,r4,#12,#2
000028  0324              LSLS     r4,r4,#12
                  |L18.42|
;;;345      }
;;;346    
;;;347      if (Related_Endpoint >= Device_Table.Total_Endpoint
00002a  4d13              LDR      r5,|L18.120|
00002c  782d              LDRB     r5,[r5,#0]  ; Device_Table
00002e  4295              CMP      r5,r2
000030  d90f              BLS      |L18.82|
;;;348          || pInformation->USBwValue != 0 || Status == 0
000032  885a              LDRH     r2,[r3,#2]
000034  b96a              CBNZ     r2,|L18.82|
000036  b164              CBZ      r4,|L18.82|
;;;349          || pInformation->Current_Configuration == 0)
000038  7a9a              LDRB     r2,[r3,#0xa]
00003a  b152              CBZ      r2,|L18.82|
;;;350      {
;;;351        return USB_UNSUPPORT;
;;;352      }
;;;353      else
;;;354      {
;;;355        if (wIndex0 & 0x80)
00003c  0609              LSLS     r1,r1,#24
00003e  2900              CMP      r1,#0
;;;356        {
;;;357          /* IN endpoint */
;;;358          _SetEPTxStatus(Related_Endpoint, EP_TX_STALL);
;;;359        }
;;;360    
;;;361        else
;;;362        {
;;;363          /* OUT endpoint */
;;;364          _SetEPRxStatus(Related_Endpoint, EP_RX_STALL);
000040  6801              LDR      r1,[r0,#0]
000042  b289              UXTH     r1,r1
000044  da07              BGE      |L18.86|
000046  f64872bf          MOV      r2,#0x8fbf            ;358
00004a  4011              ANDS     r1,r1,r2              ;358
00004c  f0810110          EOR      r1,r1,#0x10           ;358
000050  e006              B        |L18.96|
                  |L18.82|
000052  2002              MOVS     r0,#2                 ;351
;;;365        }
;;;366      }
;;;367      pUser_Standard_Requests->User_SetEndPointFeature();
;;;368      return USB_SUCCESS;
;;;369    }
000054  bd70              POP      {r4-r6,pc}
                  |L18.86|
000056  f64b728f          MOV      r2,#0xbf8f            ;364
00005a  4011              ANDS     r1,r1,r2              ;364
00005c  f4815180          EOR      r1,r1,#0x1000         ;364
                  |L18.96|
000060  6001              STR      r1,[r0,#0]            ;358
000062  4806              LDR      r0,|L18.124|
000064  6800              LDR      r0,[r0,#0]            ;367  ; pUser_Standard_Requests
000066  6980              LDR      r0,[r0,#0x18]         ;367
000068  4780              BLX      r0                    ;367
00006a  2000              MOVS     r0,#0                 ;368
00006c  bd70              POP      {r4-r6,pc}
;;;370    
                          ENDP

00006e  0000              DCW      0x0000
                  |L18.112|
                          DCD      pInformation
                  |L18.116|
                          DCD      0x40005c00
                  |L18.120|
                          DCD      Device_Table
                  |L18.124|
                          DCD      pUser_Standard_Requests

                          AREA ||i.Standard_SetInterface||, CODE, READONLY, ALIGN=2

                  Standard_SetInterface PROC
;;;122    *******************************************************************************/
;;;123    RESULT Standard_SetInterface(void)
000000  b510              PUSH     {r4,lr}
;;;124    {
;;;125      RESULT Re;
;;;126      /*Test if the specified Interface and Alternate Setting are supported by
;;;127        the application Firmware*/
;;;128      Re = (*pProperty->Class_Get_Interface_Setting)(pInformation->USBwIndex0, pInformation->USBwValue0);
000002  4c0e              LDR      r4,|L19.60|
000004  4a0e              LDR      r2,|L19.64|
000006  6820              LDR      r0,[r4,#0]  ; pInformation
000008  6812              LDR      r2,[r2,#0]  ; pProperty
00000a  78c1              LDRB     r1,[r0,#3]
00000c  6992              LDR      r2,[r2,#0x18]
00000e  7940              LDRB     r0,[r0,#5]
000010  4790              BLX      r2
;;;129    
;;;130      if (pInformation->Current_Configuration != 0)
000012  6821              LDR      r1,[r4,#0]  ; pInformation
000014  7a8a              LDRB     r2,[r1,#0xa]
000016  b122              CBZ      r2,|L19.34|
;;;131      {
;;;132        if ((Re != USB_SUCCESS) || (pInformation->USBwIndex1 != 0)
000018  b918              CBNZ     r0,|L19.34|
00001a  7908              LDRB     r0,[r1,#4]
00001c  b908              CBNZ     r0,|L19.34|
;;;133            || (pInformation->USBwValue1 != 0))
00001e  7888              LDRB     r0,[r1,#2]
000020  b108              CBZ      r0,|L19.38|
                  |L19.34|
;;;134        {
;;;135          return  USB_UNSUPPORT;
;;;136        }
;;;137        else if (Re == USB_SUCCESS)
;;;138        {
;;;139          pUser_Standard_Requests->User_SetInterface();
;;;140          pInformation->Current_Interface = pInformation->USBwIndex0;
;;;141          pInformation->Current_AlternateSetting = pInformation->USBwValue0;
;;;142          return USB_SUCCESS;
;;;143        }
;;;144    
;;;145      }
;;;146    
;;;147      return USB_UNSUPPORT;
000022  2002              MOVS     r0,#2
;;;148    }
000024  bd10              POP      {r4,pc}
                  |L19.38|
000026  4807              LDR      r0,|L19.68|
000028  6800              LDR      r0,[r0,#0]            ;139  ; pUser_Standard_Requests
00002a  68c0              LDR      r0,[r0,#0xc]          ;139
00002c  4780              BLX      r0                    ;139
00002e  6820              LDR      r0,[r4,#0]            ;140  ; pInformation
000030  7941              LDRB     r1,[r0,#5]            ;140
000032  72c1              STRB     r1,[r0,#0xb]          ;140
000034  78c1              LDRB     r1,[r0,#3]            ;141
000036  7301              STRB     r1,[r0,#0xc]          ;141
000038  2000              MOVS     r0,#0                 ;142
00003a  bd10              POP      {r4,pc}
;;;149    
                          ENDP

                  |L19.60|
                          DCD      pInformation
                  |L19.64|
                          DCD      pProperty
                  |L19.68|
                          DCD      pUser_Standard_Requests

                          AREA ||.data||, DATA, ALIGN=1

                  StatusInfo
000000  0000              DCB      0x00,0x00
