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

📄 usb_core.txt

📁 STM32F103ZET6+UCOSII+UCGUI源码
💻 TXT
📖 第 1 页 / 共 5 页
字号:
;;;634      if (Result != USB_SUCCESS)
000088  b160              CBZ      r0,|L6.164|
                  |L6.138|
;;;635      {
;;;636        Result = (*pProperty->Class_NoData_Setup)(RequestNo);
00008a  480f              LDR      r0,|L6.200|
00008c  6800              LDR      r0,[r0,#0]  ; pProperty
00008e  6941              LDR      r1,[r0,#0x14]
000090  b2e0              UXTB     r0,r4
000092  4788              BLX      r1
;;;637        if (Result == USB_NOT_READY)
000094  2803              CMP      r0,#3
000096  d102              BNE      |L6.158|
;;;638        {
;;;639          ControlState = PAUSE;
000098  2009              MOVS     r0,#9
;;;640          goto exit_NoData_Setup0;
00009a  e00f              B        |L6.188|
                  |L6.156|
00009c  e000              B        |L6.160|
                  |L6.158|
;;;641        }
;;;642      }
;;;643    
;;;644      if (Result != USB_SUCCESS)
00009e  b108              CBZ      r0,|L6.164|
                  |L6.160|
;;;645      {
;;;646        ControlState = STALLED;
0000a0  2008              MOVS     r0,#8
;;;647        goto exit_NoData_Setup0;
0000a2  e00b              B        |L6.188|
                  |L6.164|
;;;648      }
;;;649    
;;;650      ControlState = WAIT_STATUS_IN;/* After no data stage SETUP */
;;;651    
;;;652      USB_StatusIn();
0000a4  4a09              LDR      r2,|L6.204|
0000a6  2006              MOVS     r0,#6                 ;650
0000a8  6813              LDR      r3,[r2,#0]
0000aa  2100              MOVS     r1,#0
0000ac  4a08              LDR      r2,|L6.208|
0000ae  b29b              UXTH     r3,r3
0000b0  eb020243          ADD      r2,r2,r3,LSL #1
0000b4  6051              STR      r1,[r2,#4]
0000b6  4a07              LDR      r2,|L6.212|
0000b8  2130              MOVS     r1,#0x30
0000ba  8011              STRH     r1,[r2,#0]
                  |L6.188|
;;;653    
;;;654    exit_NoData_Setup0:
;;;655      pInformation->ControlState = ControlState;
0000bc  6829              LDR      r1,[r5,#0]  ; pInformation
0000be  7208              STRB     r0,[r1,#8]
;;;656      return;
;;;657    }
0000c0  bd70              POP      {r4-r6,pc}
;;;658    
                          ENDP

0000c2  0000              DCW      0x0000
                  |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
;;;927    *******************************************************************************/
;;;928    u8 Out0_Process(void)
000000  b510              PUSH     {r4,lr}
;;;929    {
;;;930      u32 ControlState = pInformation->ControlState;
000002  4c0c              LDR      r4,|L7.52|
000004  6820              LDR      r0,[r4,#0]  ; pInformation
000006  7a00              LDRB     r0,[r0,#8]
;;;931    
;;;932      if ((ControlState == OUT_DATA) || (ControlState == LAST_OUT_DATA))
000008  2803              CMP      r0,#3
00000a  d001              BEQ      |L7.16|
00000c  2805              CMP      r0,#5
00000e  d104              BNE      |L7.26|
                  |L7.16|
;;;933      {
;;;934        DataStageOut();
000010  f7fffffe          BL       DataStageOut
;;;935        ControlState = pInformation->ControlState; /* may be changed outside the function */
000014  6820              LDR      r0,[r4,#0]  ; pInformation
000016  7a00              LDRB     r0,[r0,#8]
000018  e006              B        |L7.40|
                  |L7.26|
;;;936      }
;;;937    
;;;938      else if (ControlState == WAIT_STATUS_OUT)
00001a  2807              CMP      r0,#7
00001c  d103              BNE      |L7.38|
;;;939      {
;;;940        (*pProperty->Process_Status_OUT)();
00001e  4806              LDR      r0,|L7.56|
000020  6800              LDR      r0,[r0,#0]  ; pProperty
000022  68c0              LDR      r0,[r0,#0xc]
000024  4780              BLX      r0
                  |L7.38|
;;;941        ControlState = STALLED;
;;;942      }
;;;943    
;;;944      else if ((ControlState == IN_DATA) || (ControlState == LAST_IN_DATA))
;;;945      {
;;;946        /* host aborts the transfer before finish */
;;;947        ControlState = STALLED;
000026  2008              MOVS     r0,#8
                  |L7.40|
;;;948      }
;;;949    
;;;950      /* Unexpect state, STALL the endpoint */
;;;951      else
;;;952      {
;;;953        ControlState = STALLED;
;;;954      }
;;;955    
;;;956      pInformation->ControlState = ControlState;
000028  6821              LDR      r1,[r4,#0]  ; pInformation
00002a  7208              STRB     r0,[r1,#8]
;;;957    
;;;958      return Post0_Process();
00002c  e8bd4010          POP      {r4,lr}
000030  f7ffbffe          B.W      Post0_Process
;;;959    }
;;;960    
                          ENDP

                  |L7.52|
                          DCD      pInformation
                  |L7.56|
                          DCD      pProperty

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

                  Post0_Process PROC
;;;968    *******************************************************************************/
;;;969    u8 Post0_Process(void)
000000  b510              PUSH     {r4,lr}
;;;970    {
;;;971      SetEPRxCount(ENDP0, Device_Property.MaxPacketSize);
000002  480b              LDR      r0,|L8.48|
000004  f890102c          LDRB     r1,[r0,#0x2c]  ; Device_Property
000008  2000              MOVS     r0,#0
00000a  f7fffffe          BL       SetEPRxCount
;;;972    
;;;973      if (pInformation->ControlState == STALLED)
00000e  4809              LDR      r0,|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|
;;;974      {
;;;975        vSetEPRxStatus(EP_RX_STALL);
000018  4a07              LDR      r2,|L8.56|
00001a  0248              LSLS     r0,r1,#9
00001c  8010              STRH     r0,[r2,#0]
;;;976        vSetEPTxStatus(EP_TX_STALL);
00001e  4a07              LDR      r2,|L8.60|
000020  2010              MOVS     r0,#0x10
000022  8010              STRH     r0,[r2,#0]
                  |L8.36|
;;;977      }
;;;978    
;;;979      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|
;;;980    }
00002c  bd10              POP      {r4,pc}
;;;981    
                          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
;;;988    *******************************************************************************/
;;;989    void SetDeviceAddress(u8 Val)
000000  b5f0              PUSH     {r4-r7,lr}
;;;990    {
;;;991      u32 i;
;;;992      u32 nEP = Device_Table.Total_Endpoint;
000002  490c              LDR      r1,|L9.52|
;;;993    
;;;994      /* set address in every used endpoint */
;;;995      for (i = 0; i < nEP; i++)
;;;996      {
;;;997        _SetEPAddress((u8)i, (u8)i);
000004  4f0c              LDR      r7,|L9.56|
000006  780e              LDRB     r6,[r1,#0]            ;992  ; Device_Table
000008  2100              MOVS     r1,#0                 ;995
00000a  f648758f          MOV      r5,#0x8f8f
00000e  e00a              B        |L9.38|
                  |L9.16|
000010  b2ca              UXTB     r2,r1
000012  eb070382          ADD      r3,r7,r2,LSL #2
000016  f8d34c00          LDR      r4,[r3,#0xc00]
00001a  b2a4              UXTH     r4,r4
00001c  402c              ANDS     r4,r4,r5
00001e  4314              ORRS     r4,r4,r2
000020  f8c34c00          STR      r4,[r3,#0xc00]
000024  1c49              ADDS     r1,r1,#1              ;995
                  |L9.38|
000026  42b1              CMP      r1,r6                 ;995
000028  d3f2              BCC      |L9.16|
;;;998      } /* for */
;;;999      _SetDADDR(Val | DADDR_EF); /* set device address and enable function */
00002a  f0400080          ORR      r0,r0,#0x80
00002e  f8c70c4c          STR      r0,[r7,#0xc4c]
;;;1000   }
000032  bdf0              POP      {r4-r7,pc}
;;;1001   
                          ENDP

                  |L9.52|
                          DCD      Device_Table
                  |L9.56|
                          DCD      0x40005000

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

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

⌨️ 快捷键说明

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