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

📄 usb_core.txt

📁 MP3_PLAYER.rar
💻 TXT
📖 第 1 页 / 共 5 页
字号:
;;;758        }
;;;759    
;;;760      }
;;;761    
;;;762    
;;;763      if (CopyRoutine)
0000e8  b139              CBZ      r1,|L12.250|
;;;764      {
;;;765        pInformation->Ctrl_Info.Usb_wOffset = wOffset;
0000ea  6830              LDR      r0,[r6,#0]  ; pInformation
0000ec  2200              MOVS     r2,#0
0000ee  8242              STRH     r2,[r0,#0x12]
;;;766        pInformation->Ctrl_Info.CopyData = CopyRoutine;
;;;767        /* sb in the original the cast to word was directly */
;;;768        /* now the cast is made step by step */
;;;769        (*CopyRoutine)(0);
0000f0  6181              STR      r1,[r0,#0x18]
0000f2  4610              MOV      r0,r2
0000f4  4788              BLX      r1
;;;770        Result = USB_SUCCESS;
0000f6  2000              MOVS     r0,#0
0000f8  e009              B        |L12.270|
                  |L12.250|
;;;771      }
;;;772      else
;;;773      {
;;;774        Result = (*pProperty->Class_Data_Setup)(pInformation->USBbRequest);
0000fa  6821              LDR      r1,[r4,#0]  ; pProperty
0000fc  6830              LDR      r0,[r6,#0]  ; pInformation
0000fe  6909              LDR      r1,[r1,#0x10]
000100  7840              LDRB     r0,[r0,#1]
000102  4788              BLX      r1
;;;775        if (Result == USB_NOT_READY)
000104  2803              CMP      r0,#3
000106  d102              BNE      |L12.270|
;;;776        {
;;;777          pInformation->ControlState = PAUSE;
000108  6830              LDR      r0,[r6,#0]  ; pInformation
00010a  7205              STRB     r5,[r0,#8]
;;;778          return;
;;;779        }
;;;780      }
;;;781    
;;;782      if (pInformation->Ctrl_Info.Usb_wLength == 0xFFFF)
;;;783      {
;;;784        /* Data is not ready, wait it */
;;;785        pInformation->ControlState = PAUSE;
;;;786        return;
;;;787      }
;;;788      if ((Result == USB_UNSUPPORT) || (pInformation->Ctrl_Info.Usb_wLength == 0))
;;;789      {
;;;790        /* Unsupported request */
;;;791        pInformation->ControlState = STALLED;
;;;792        return;
;;;793      }
;;;794    
;;;795    
;;;796      if (ValBit(pInformation->USBbmRequestType, 7))
;;;797      {
;;;798        /* Device ==> Host */
;;;799        u32 wLength = pInformation->USBwLength;
;;;800    
;;;801        /* Restrict the data length to be the one host asks */
;;;802        if (pInformation->Ctrl_Info.Usb_wLength > wLength)
;;;803        {
;;;804          pInformation->Ctrl_Info.Usb_wLength = wLength;
;;;805        }
;;;806    
;;;807        pInformation->Ctrl_Info.PacketSize = pProperty->MaxPacketSize;
;;;808        DataStageIn();
;;;809      }
;;;810      else
;;;811      {
;;;812        pInformation->ControlState = OUT_DATA;
;;;813        vSetEPRxStatus(EP_RX_VALID);/* enable for next data reception */
;;;814      }
;;;815    
;;;816      return;
;;;817    }
00010c  bd70              POP      {r4-r6,pc}
                  |L12.270|
00010e  6831              LDR      r1,[r6,#0]            ;782  ; pInformation
000110  8a0a              LDRH     r2,[r1,#0x10]         ;782
000112  f5a2437f          SUB      r3,r2,#0xff00         ;782
000116  3bff              SUBS     r3,r3,#0xff           ;782
000118  d101              BNE      |L12.286|
00011a  720d              STRB     r5,[r1,#8]            ;785
00011c  bd70              POP      {r4-r6,pc}
                  |L12.286|
00011e  2802              CMP      r0,#2                 ;788
000120  d000              BEQ      |L12.292|
000122  b912              CBNZ     r2,|L12.298|
                  |L12.292|
000124  2008              MOVS     r0,#8                 ;791
000126  7208              STRB     r0,[r1,#8]            ;791
000128  bd70              POP      {r4-r6,pc}
                  |L12.298|
00012a  7808              LDRB     r0,[r1,#0]            ;796
00012c  0600              LSLS     r0,r0,#24             ;796
00012e  d50b              BPL      |L12.328|
000130  88c8              LDRH     r0,[r1,#6]            ;799
000132  4282              CMP      r2,r0                 ;802
000134  d900              BLS      |L12.312|
000136  8208              STRH     r0,[r1,#0x10]         ;804
                  |L12.312|
000138  6820              LDR      r0,[r4,#0]            ;807  ; pProperty
00013a  f890002c          LDRB     r0,[r0,#0x2c]         ;807
00013e  8288              STRH     r0,[r1,#0x14]         ;807
000140  e8bd4070          POP      {r4-r6,lr}            ;808
000144  f7ffbffe          B.W      DataStageIn
                  |L12.328|
000148  2003              MOVS     r0,#3                 ;812
00014a  7208              STRB     r0,[r1,#8]            ;812
00014c  4908              LDR      r1,|L12.368|
00014e  0300              LSLS     r0,r0,#12             ;813
000150  8008              STRH     r0,[r1,#0]            ;813  ; SaveRState
000152  bd70              POP      {r4-r6,pc}
;;;818    
                          ENDP

                  |L12.340|
000154  00000000          DCD      pInformation
                  |L12.344|
000158  00000000          DCD      pProperty
                  |L12.348|
00015c  00000000          DCD      Standard_GetStatus
                  |L12.352|
000160  40005000          DCD      0x40005000
                  |L12.356|
000164  00000000          DCD      Device_Table
                  |L12.360|
000168  00000000          DCD      Standard_GetConfiguration
                  |L12.364|
00016c  00000000          DCD      Standard_GetInterface
                  |L12.368|
000170  00000000          DCD      SaveRState

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

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

00002e  0000              DCW      0x0000
                  |L13.48|
000030  00000000          DCD      Device_Property
                  |L13.52|
000034  00000000          DCD      pInformation
                  |L13.56|
000038  00000000          DCD      SaveRState
                  |L13.60|
00003c  00000000          DCD      SaveTState

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

                  Setup0_Process PROC
;;;826    u8 Setup0_Process(void)
;;;827    {
000000  b570              PUSH     {r4-r6,lr}
000002  4817              LDR      r0,|L14.96|
;;;828    
;;;829      union
;;;830      {
;;;831        u8* b;
;;;832        u16* w;
;;;833      } pBuf;
;;;834    
;;;835      pBuf.b = PMAAddr + (u8 *)(_GetEPRxAddr(ENDP0) * 2); /* *2 for 32 bits addr */
000004  6801              LDR      r1,[r0,#0]
000006  4817              LDR      r0,|L14.100|
000008  b289              UXTH     r1,r1
00000a  eb000141          ADD      r1,r0,r1,LSL #1
00000e  6889              LDR      r1,[r1,#8]
;;;836    
;;;837      if (pInformation->ControlState != PAUSE)
000010  4d15              LDR      r5,|L14.104|
000012  b289              UXTH     r1,r1                 ;835
000014  eb000441          ADD      r4,r0,r1,LSL #1       ;835
000018  6828              LDR      r0,[r5,#0]  ; pInformation
00001a  7a01              LDRB     r1,[r0,#8]
00001c  2909              CMP      r1,#9
00001e  d011              BEQ      |L14.68|
;;;838      {
;;;839        pInformation->USBbmRequestType = *pBuf.b++; /* bmRequestType */
000020  7821              LDRB     r1,[r4,#0]
000022  7001              STRB     r1,[r0,#0]
;;;840        pInformation->USBbRequest = *pBuf.b++; /* bRequest */
000024  f8141f01          LDRB     r1,[r4,#1]!
000028  7041              STRB     r1,[r0,#1]
00002a  1c64              ADDS     r4,r4,#1
;;;841        pBuf.w++;  /* word not accessed because of 32 bits addressing */
;;;842        pInformation->USBwValue = ByteSwap(*pBuf.w++); /* wValue */
00002c  8860              LDRH     r0,[r4,#2]
00002e  f7fffffe          BL       ByteSwap
000032  6829              LDR      r1,[r5,#0]  ; pInformation
000034  8048              STRH     r0,[r1,#2]
;;;843        pBuf.w++;  /* word not accessed because of 32 bits addressing */
;;;844        pInformation->USBwIndex  = ByteSwap(*pBuf.w++); /* wIndex */
000036  88e0              LDRH     r0,[r4,#6]
000038  f7fffffe          BL       ByteSwap
00003c  6829              LDR      r1,[r5,#0]  ; pInformation
00003e  8088              STRH     r0,[r1,#4]
;;;845        pBuf.w++;  /* word not accessed because of 32 bits addressing */
;;;846        pInformation->USBwLength = *pBuf.w; /* wLength */
000040  8960              LDRH     r0,[r4,#0xa]
000042  80c8              STRH     r0,[r1,#6]
                  |L14.68|
;;;847      }
;;;848    
;;;849      pInformation->ControlState = SETTING_UP;
000044  6828              LDR      r0,[r5,#0]  ; pInformation
000046  2101              MOVS     r1,#1
000048  7201              STRB     r1,[r0,#8]
;;;850      if (pInformation->USBwLength == 0)
00004a  88c0              LDRH     r0,[r0,#6]
00004c  b910              CBNZ     r0,|L14.84|
;;;851      {
;;;852        /* Setup with no data stage */
;;;853        NoData_Setup0();
00004e  f7fffffe          BL       NoData_Setup0
000052  e001              B        |L14.88|
                  |L14.84|
;;;854      }
;;;855      else
;;;856      {
;;;857        /* Setup with data stage */
;;;858        Data_Setup0();
000054  f7fffffe          BL       Data_Setup0
                  |L14.88|
;;;859      }
;;;860      return Post0_Process();
000058  e8bd4070          POP      {r4-r6,lr}
00005c  f7ffbffe          B.W      Post0_Process
;;;861    }
;;;862    
                          ENDP

                  |L14.96|
000060  40005c50          DCD      0x40005c50
                  |L14.100|
000064  40006000          DCD      0x40006000
                  |L14.104|
000068  00000000          DCD      pInformation

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

                  SetDeviceAddress PROC
;;;971    void SetDeviceAddress(u8 Val)
;;;972    {
000000  b5f0              PUSH     {r4-r7,lr}
;;;973      u32 i;
;;;974      u32 nEP = Device_Table.Total_Endpoint;
000002  490c              LDR      r1,|L15.52|
;;;975    
;;;976      /* set address in every used endpoint */
;;;977      for (i = 0; i < nEP; i++)
000004  4e0c              LDR      r6,|L15.56|
000006  780d              LDRB     r5,[r1,#0]            ;974  ; Device_Table
000008  2100              MOVS     r1,#0
00000a  f648778f          MOV      r7,#0x8f8f
00000e  e00a              B        |L15.38|
                  |L15.16|
;;;978      {
;;;979        _SetEPAddress((u8)i, (u8)i);
000010  b2ca              UXTB     r2,r1
000012  eb060382          ADD      r3,r6,r2,LSL #2
000016  f8d34c00          LDR      r4,[r3,#0xc00]
00001a  b2a4              UXTH     r4,r4
00001c  403c              ANDS     r4,r4,r7
00001e  4314              ORRS     r4,r4,r2
000020  f8c34c00          STR      r4,[r3,#0xc00]
000024  1c49              ADDS     r1,r1,#1              ;977
                  |L15.38|
000026  42a9              CMP      r1,r5                 ;977
000028  d3f2              BCC      |L15.16|
;;;980      } /* for */
;;;981      _SetDADDR(Val | DADDR_EF); /* set device address and enable function */
00002a  f0400080          ORR      r0,r0,#0x80
00002e  f8c60c4c          STR      r0,[r6,#0xc4c]
;;;982    }
000032  bdf0              POP      {r4-r7,pc}
;;;983    
                          ENDP

                  |L15.52|

⌨️ 快捷键说明

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