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

📄 usb_core.s79

📁 用于监视I2C通信总线
💻 S79
📖 第 1 页 / 共 5 页
字号:
        LDR      R0,[R0, #+0]
        LDR      R0,[R0, #+4]
        BLX      R0
//   86     return USB_SUCCESS;
        MOVS     R0,#+0
        POP      {PC}
//   87   }
//   88   else
//   89   {
//   90     return USB_UNSUPPORT;
??Standard_SetConfiguration_1:
        MOVS     R0,#+2
        POP      {PC}             ;; return
        Nop      
        DATA
??Standard_SetConfiguration_0:
        DC32     Device_Table + 1
        CFI EndBlock cfiBlock1
//   91   }
//   92 }
//   93 
//   94 /*******************************************************************************
//   95 * Function Name  : Standard_GetInterface.
//   96 * Description    : Return the Alternate Setting of the current interface.
//   97 * Input          : Length - How many bytes are needed.
//   98 * Output         : None.
//   99 * Return         : Return 0, if the request is invalid when "Length" is 0.
//  100 *                  Return "Buffer" if the "Length" is not 0.
//  101 *******************************************************************************/

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function Standard_GetInterface
        THUMB
//  102 u8 *Standard_GetInterface(u16 Length)
//  103 {
Standard_GetInterface:
        PUSH     {R4,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
//  104   if (Length == 0)
        LDR.N    R4,??DataTable31  ;; pInformation
        CBNZ     R0,??Standard_GetInterface_0
//  105   {
//  106     pInformation->Ctrl_Info.Usb_wLength =
//  107       sizeof(pInformation->Current_AlternateSetting);
        B.N      ?Subroutine0
//  108     return 0;
//  109   }
//  110   pUser_Standard_Requests->User_GetInterface();
??Standard_GetInterface_0:
        LDR.N    R0,??DataTable30  ;; pUser_Standard_Requests
        LDR      R0,[R0, #+0]
        LDR      R0,[R0, #+8]
        BLX      R0
//  111   return (u8 *)&pInformation->Current_AlternateSetting;
        LDR      R0,[R4, #+0]
        ADDS     R0,R0,#+12
        POP      {R4,PC}          ;; return
        CFI EndBlock cfiBlock2
//  112 }

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock3 Using cfiCommon0
        CFI NoFunction
        CFI CFA R13+8
        CFI R4 Frame(CFA, -8)
        CFI ?RET Frame(CFA, -4)
        THUMB
?Subroutine0:
        MOVS     R1,#+1
        LDR      R0,[R4, #+0]
        STRH     R1,[R0, #+16]
        MOVS     R0,#+0
        POP      {R4,PC}
        CFI EndBlock cfiBlock3
//  113 
//  114 /*******************************************************************************
//  115 * Function Name  : Standard_SetInterface.
//  116 * Description    : This routine is called to set the interface.
//  117 *                  Then each class should configure the interface them self.
//  118 * Input          : None.
//  119 * Output         : None.
//  120 * Return         : - Return USB_SUCCESS, if the request is performed.
//  121 *                  - Return USB_UNSUPPORT, if the request is invalid.
//  122 *******************************************************************************/

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock4 Using cfiCommon0
        CFI Function Standard_SetInterface
        THUMB
//  123 RESULT Standard_SetInterface(void)
//  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);
Standard_SetInterface:
        LDR.N    R2,??DataTable6  ;; pProperty
        PUSH     {R4,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
        LDR.N    R4,??DataTable31  ;; pInformation
        LDR      R2,[R2, #+0]
        LDR      R0,[R4, #+0]
        LDR      R2,[R2, #+24]
        LDRB     R1,[R0, #+3]
        LDRB     R0,[R0, #+5]
        BLX      R2
//  129 
//  130   if (pInformation->Current_Configuration != 0)
        LDR      R1,[R4, #+0]
        LDRB     R2,[R1, #+10]
        CBZ      R2,??Standard_SetInterface_0
//  131   {
//  132     if ((Re != USB_SUCCESS) || (pInformation->USBwIndex1 != 0)
//  133         || (pInformation->USBwValue1 != 0))
        CBNZ     R0,??Standard_SetInterface_0
        LDRB     R0,[R1, #+4]
        CBNZ     R0,??Standard_SetInterface_0
        LDRB     R0,[R1, #+2]
        CBZ      R0,??Standard_SetInterface_1
//  134     {
//  135       return  USB_UNSUPPORT;
??Standard_SetInterface_0:
        MOVS     R0,#+2
        POP      {R4,PC}
//  136     }
//  137     else if (Re == USB_SUCCESS)
//  138     {
//  139       pUser_Standard_Requests->User_SetInterface();
??Standard_SetInterface_1:
        LDR.N    R0,??DataTable30  ;; pUser_Standard_Requests
        LDR      R0,[R0, #+0]
        LDR      R0,[R0, #+12]
        BLX      R0
//  140       pInformation->Current_Interface = pInformation->USBwIndex0;
        LDR      R0,[R4, #+0]
        LDRB     R1,[R0, #+5]
        STRB     R1,[R0, #+11]
//  141       pInformation->Current_AlternateSetting = pInformation->USBwValue0;
        LDR      R0,[R4, #+0]
        LDRB     R1,[R0, #+3]
        STRB     R1,[R0, #+12]
//  142       return USB_SUCCESS;
        MOVS     R0,#+0
        POP      {R4,PC}          ;; return
        CFI EndBlock cfiBlock4
//  143     }
//  144 
//  145   }
//  146 
//  147   return USB_UNSUPPORT;
//  148 }

        RSEG CODE:CODE:NOROOT(2)
        DATA
??DataTable6:
        DC32     pProperty
//  149 
//  150 /*******************************************************************************
//  151 * Function Name  : Standard_GetStatus.
//  152 * Description    : Copy the device request data to "StatusInfo buffer".
//  153 * Input          : - Length - How many bytes are needed.
//  154 * Output         : None.
//  155 * Return         : Return 0, if the request is at end of data block,
//  156 *                  or is invalid when "Length" is 0.
//  157 *******************************************************************************/

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock5 Using cfiCommon0
        CFI Function Standard_GetStatus
        THUMB
//  158 u8 *Standard_GetStatus(u16 Length)
//  159 {
//  160   if (Length == 0)
Standard_GetStatus:
        LDR.N    R1,??DataTable31  ;; pInformation
        PUSH     {R4,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
        LDR      R1,[R1, #+0]
        CBNZ     R0,??Standard_GetStatus_0
//  161   {
//  162     pInformation->Ctrl_Info.Usb_wLength = 2;
        MOVS     R0,#+2
        STRH     R0,[R1, #+16]
//  163     return 0;
//  164   }
//  165 
//  166   StatusInfo.w = 0;
//  167   /* Reset Status Information */
//  168 
//  169   if (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
//  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     /* Bus-powered */
//  181     if (ValBit(Feature, 6))
//  182     {
//  183       ClrBit(StatusInfo0, 0);
//  184     }
//  185     else /* Self-powered */
//  186     {
//  187       SetBit(StatusInfo0, 0);
//  188     }
//  189   }
//  190   /*Interface Status*/
//  191   else if (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))
//  192   {
//  193     return (u8 *)&StatusInfo;
//  194   }
//  195   /*Get EndPoint Status*/
//  196   else if (Type_Recipient == (STANDARD_REQUEST | ENDPOINT_RECIPIENT))
//  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;
??Standard_GetStatus_1:
        MOVS     R0,#+0
        POP      {R4,PC}
//  223   }
??Standard_GetStatus_0:
        LDR.N    R4,??Standard_GetStatus_2  ;; StatusInfo
        MOVS     R0,#+0
        STRH     R0,[R4, #+0]
        LDRB     R0,[R1, #+0]
        LSLS     R2,R0,#+25
        BNE.N    ??Standard_GetStatus_3
        LDRB     R0,[R1, #+9]
        LSLS     R1,R0,#+26
        BPL.N    ??Standard_GetStatus_4
        LDRB     R1,[R4, #+0]
        ORRS     R1,R1,#0x2
        STRB     R1,[R4, #+0]
??Standard_GetStatus_4:
        LSLS     R0,R0,#+25
        LDRB     R0,[R4, #+0]
        BPL.N    ??Standard_GetStatus_5
        ANDS     R0,R0,#0xFE
??Standard_GetStatus_6:
        STRB     R0,[R4, #+0]
        B.N      ??Standard_GetStatus_7
??Standard_GetStatus_5:
        ORRS     R0,R0,#0x1
        B.N      ??Standard_GetStatus_6
??Standard_GetStatus_3:
        LSLS     R2,R0,#+25
        LSRS     R2,R2,#+25
        CMP      R2,#+1
        BNE.N    ??Standard_GetStatus_8
??Standard_GetStatus_9:
        MOVS     R0,R4
        POP      {R4,PC}          ;; return
??Standard_GetStatus_8:
        LSLS     R0,R0,#+25
        LSRS     R0,R0,#+25
        CMP      R0,#+2
        BNE.N    ??Standard_GetStatus_1
        LDRB     R1,[R1, #+5]
        LDRB     R0,[R4, #+0]
        LSLS     R2,R1,#+28
        LSRS     R2,R2,#+28
        ORRS     R0,R0,#0x1
        LSLS     R1,R1,#+24
        BPL.N    ??Standard_GetStatus_10
        LDR.N    R1,??DataTable26  ;; 0x40005c00
        LDR      R1,[R1, R2, LSL #+2]
        ANDS     R1,R1,#0x30
        CMP      R1,#+16
        BNE.N    ??Standard_GetStatus_7
        B.N      ??Standard_GetStatus_6
??Standard_GetStatus_10:
        LDR.N    R1,??DataTable26  ;; 0x40005c00
        LDR      R1,[R1, R2, LSL #+2]
        ANDS     R1,R1,#0x3000
        CMP      R1,#+4096
        IT      EQ 
        STRBEQ   R0,[R4, #+0]
//  224   pUser_Standard_Requests->User_GetStatus();
??Standard_GetStatus_7:
        LDR.N    R0,??DataTable30  ;; pUser_Standard_Requests
        LDR      R0,[R0, #+0]
        LDR      R0,[R0, #+16]
        BLX      R0
        B.N      ??Standard_GetStatus_9
        Nop      
        DATA
??Standard_GetStatus_2:
        DC32     StatusInfo
        CFI EndBlock cfiBlock5
//  225   return (u8 *)&StatusInfo;
//  226 }
//  227 
//  228 /*******************************************************************************
//  229 * Function Name  : Standard_ClearFeature.
//  230 * Description    : Clear or disable a specific feature.
//  231 * Input          : None.
//  232 * Output         : None.
//  233 * Return         : - Return USB_SUCCESS, if the request is performed.
//  234 *                  - Return USB_UNSUPPORT, if the request is invalid.
//  235 *******************************************************************************/

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock6 Using cfiCommon0
        CFI Function Standard_ClearFeature
        THUMB
//  236 RESULT Standard_ClearFeature(void)
//  237 {
//  238   u32     Type_Rec = Type_Recipient;
Standard_ClearFeature:
        LDR.N    R0,??DataTable31  ;; pInformation
        PUSH     {R4-R6,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R6 Frame(CFA, -8)
        CFI R5 Frame(CFA, -12)
        CFI R4 Frame(CFA, -16)
        CFI CFA R13+16
        LDR      R0,[R0, #+0]
        LDRB     R1,[R0, #+0]
        LSLS     R1,R1,#+25
        LSRS     R1,R1,#+25
//  239   u32     Status;
//  240 
//  241 
//  242   if (Type_Rec == (STANDARD_REQUEST | DEVICE_RECIPIENT))
        BNE.N    ??Standard_ClearFeature_0
//  243   {/*Device Clear Feature*/
//  244     ClrBit(pInformation->Current_Feature, 5);
        LDRB     R1,[R0, #+9]
        ANDS     R1,R1,#0xDF
        STRB     R1,[R0, #+9]
//  245     return USB_SUCCESS;
        B.N      ??Standard_ClearFeature_1
//  246   }
//  247   else if (Type_Rec == (STANDARD_REQUEST | ENDPOINT_RECIPIENT))
??Standard_ClearFeature_0:
        CMP      R1,#+2
        BNE.N    ??Standard_ClearFeature_2
//  248   {/*EndPoint Clear Feature*/
//  249     DEVICE* pDev;
//  250     u32 Related_Endpoint;

⌨️ 快捷键说明

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