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

📄 usbddriver.lst

📁 ATmel的AT91sam7SE芯片 USB固件开发源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
    388                      //? N?is used to indicate N occurrences of a string of bits or symbols.)
    389                      //A port in Test_Packet mode must send this packet repetitively. The inter-packet timing 
    390                      //must be no less than the minimum allowable inter-packet gap as defined in Section 7.1.18 and 
    391                      //no greater than 125 us.
    392                      // Send ZLP
    393                      USBD_Test(USBFeatureRequest_TESTSENDZLP);
    394                      // Tst PACKET
    395                      USBD_Test(USBFeatureRequest_TESTPACKET);
    396                      while (1);
    397                      break;
    398          
    399                  case USBFeatureRequest_TESTJ:
    400                      //Test mode Test_J:
    401                      //Upon command, a port抯 transceiver must enter the high-speed J state and remain in that
    402                      //state until the exit action is taken. This enables the testing of the high output drive
    403                      //level on the D+ line.
    404                      // Send ZLP
    405                      USBD_Test(USBFeatureRequest_TESTSENDZLP);
    406                      // Tst J
    407                      USBD_Test(USBFeatureRequest_TESTJ);
    408                      while (1);
    409                      break;
    410          
    411                  case USBFeatureRequest_TESTK:
    412                      //Test mode Test_K:
    413                      //Upon command, a port抯 transceiver must enter the high-speed K state and remain in
    414                      //that state until the exit action is taken. This enables the testing of the high output drive
    415                      //level on the D- line.
    416                      // Send a ZLP
    417                      USBD_Test(USBFeatureRequest_TESTSENDZLP);
    418                      USBD_Test(USBFeatureRequest_TESTK);
    419                      while (1);
    420                      break;
    421          
    422                  case USBFeatureRequest_TESTSE0NAK:
    423                      //Test mode Test_SE0_NAK:
    424                      //Upon command, a port抯 transceiver must enter the high-speed receive mode
    425                      //and remain in that mode until the exit action is taken. This enables the testing
    426                      //of output impedance, low level output voltage, and loading characteristics.
    427                      //In addition, while in this mode, upstream facing ports (and only upstream facing ports)
    428                      //must respond to any IN token packet with a NAK handshake (only if the packet CRC is
    429                      //determined to be correct) within the normal allowed device response time. This enables testing of
    430                      //the device squelch level circuitry and, additionally, provides a general purpose stimulus/response
    431                      //test for basic functional testing.
    432                      USBD_Test(USBFeatureRequest_TESTSE0NAK);
    433                      // Send a ZLP
    434                      USBD_Test(USBFeatureRequest_TESTSENDZLP);
    435                      while (1);
    436                      break;
    437          
    438                  default:
    439                      USBD_Stall( 0 );
    440                      break;
    441          
    442              }
    443              // The exit action is to power cycle the device.
    444              // The device must be disconnected from the host
    445          }
    446          #endif
    447          
    448          //------------------------------------------------------------------------------
    449          //      Exported functions
    450          //------------------------------------------------------------------------------
    451          
    452          //------------------------------------------------------------------------------
    453          /// Initializes a USBDDriver instance with a list of descriptors. If
    454          /// interfaces can have multiple alternate settings, an array to store the
    455          /// current setting for each interface must be provided.
    456          /// \param pDriver  Pointer to a USBDDriver instance.
    457          /// \param pDescriptors  Pointer to a USBDDriverDescriptors instance.
    458          /// \param pInterfaces  Pointer to an array for storing the current alternate
    459          ///                     setting of each interface (optional).
    460          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
    461          void USBDDriver_Initialize(
    462              USBDDriver *pDriver,
    463              const USBDDriverDescriptors *pDescriptors,
    464              unsigned char *pInterfaces)
    465          {
   \                     USBDDriver_Initialize:
   \   00000000   70402DE9           PUSH     {R4-R6,LR}
   \   00000004   0040B0E1           MOVS     R4,R0
   \   00000008   0150B0E1           MOVS     R5,R1
   \   0000000C   0260B0E1           MOVS     R6,R2
    466          
    467              pDriver->cfgnum = 0;
   \   00000010   0000A0E3           MOV      R0,#+0
   \   00000014   0800C4E5           STRB     R0,[R4, #+8]
    468          #if (BOARD_USB_BMATTRIBUTES == USBConfigurationDescriptor_SELFPOWERED_RWAKEUP) \
    469              || (BOARD_USB_BMATTRIBUTES == USBConfigurationDescriptor_BUSPOWERED_RWAKEUP)
    470              pDriver->isRemoteWakeUpEnabled = 1;
    471          #else
    472              pDriver->isRemoteWakeUpEnabled = 0;
   \   00000018   0000A0E3           MOV      R0,#+0
   \   0000001C   0900C4E5           STRB     R0,[R4, #+9]
    473          #endif
    474          
    475              pDriver->pDescriptors = pDescriptors;
   \   00000020   005084E5           STR      R5,[R4, #+0]
    476              pDriver->pInterfaces = pInterfaces;
   \   00000024   046084E5           STR      R6,[R4, #+4]
    477          
    478              // Initialize interfaces array if not null
    479              if (pInterfaces != 0) {
   \   00000028   000056E3           CMP      R6,#+0
   \   0000002C   0300000A           BEQ      ??USBDDriver_Initialize_0
    480              
    481                  memset(pInterfaces, sizeof(pInterfaces), 0);
   \   00000030   0020A0E3           MOV      R2,#+0
   \   00000034   0410A0E3           MOV      R1,#+4
   \   00000038   0600B0E1           MOVS     R0,R6
   \   0000003C   ........           BL       memset
    482              }
    483          }
   \                     ??USBDDriver_Initialize_0:
   \   00000040   7040BDE8           POP      {R4-R6,LR}
   \   00000044   1EFF2FE1           BX       LR               ;; return
    484          
    485          //------------------------------------------------------------------------------
    486          /// Handles the given request if it is standard, otherwise STALLs it.
    487          /// \param pDriver  Pointer to a USBDDriver instance.
    488          /// \param pRequest  Pointer to a USBGenericRequest instance.
    489          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
    490          void USBDDriver_RequestHandler(
    491              USBDDriver *pDriver,
    492              const USBGenericRequest *pRequest)
    493          {
   \                     USBDDriver_RequestHandler:
   \   00000000   F14F2DE9           PUSH     {R0,R4-R11,LR}
   \   00000004   0040B0E1           MOVS     R4,R0
   \   00000008   0150B0E1           MOVS     R5,R1
    494              unsigned char cfgnum;
    495              unsigned char infnum;
    496              unsigned char eptnum;
    497              unsigned char setting;
    498              unsigned char type;
    499              unsigned char index;
    500              unsigned int length;
    501              unsigned int address;
    502          
    503              trace_LOG(trace_INFO, "Std ");
   \   0000000C   84039FE5           LDR      R0,??USBDDriver_RequestHandler_1  ;; `?<Constant "Std ">`
   \   00000010   ........           BL       printf
    504              
    505              // Check request code
    506              switch (USBGenericRequest_GetRequest(pRequest)) {
   \   00000014   0500B0E1           MOVS     R0,R5
   \   00000018   ........           BL       USBGenericRequest_GetRequest
   \   0000001C   0B0050E3           CMP      R0,#+11
   \   00000020   D200008A           BHI      ??USBDDriver_RequestHandler_2
   \   00000024   04108FE2           ADR      R1,??USBDDriver_RequestHandler_0
   \   00000028   0010D1E7           LDRB     R1,[R1, R0]
   \   0000002C   01F18FE0           ADD      PC,PC,R1, LSL #+2
   \                     ??USBDDriver_RequestHandler_0:
   \   00000030   3857CF87           DC8      +56,+87,+207,+135
   \   00000034   CF1502CF           DC8      +207,+21,+2,+207
   \   00000038   332AC5B6           DC8      +51,+42,+197,+182
    507          
    508                  case USBGenericRequest_GETDESCRIPTOR:
    509                      trace_LOG(trace_INFO, "Get Descriptor\n");
   \                     ??USBDDriver_RequestHandler_3:
   \   0000003C   58039FE5           LDR      R0,??USBDDriver_RequestHandler_1+0x4  ;; `?<Constant "Get Descriptor\\n">`
   \   00000040   ........           BL       printf
    510                      
    511                      // Send the requested descriptor
    512                      type = USBGetDescriptorRequest_GetDescriptorType(pRequest);
   \   00000044   0500B0E1           MOVS     R0,R5
   \   00000048   ........           BL       USBGetDescriptorRequest_GetDescriptorType
   \   0000004C   0080B0E1           MOVS     R8,R0
    513                      index = USBGetDescriptorRequest_GetDescriptorIndex(pRequest);
   \   00000050   0500B0E1           MOVS     R0,R5
   \   00000054   ........           BL       USBGetDescriptorRequest_GetDescriptorIndex
   \   00000058   0090B0E1           MOVS     R9,R0
    514                      length = USBGenericRequest_GetLength(pRequest);
   \   0000005C   0500B0E1           MOVS     R0,R5
   \   00000060   ........           BL       USBGenericRequest_GetLength
   \   00000064   00A0B0E1           MOVS     R10,R0
    515                      GetDescriptor(pDriver, type, index, length);
   \   00000068   0A30B0E1           MOVS     R3,R10
   \   0000006C   0920B0E1           MOVS     R2,R9
   \   00000070   FF2012E2           ANDS     R2,R2,#0xFF      ;; Zero extend
   \   00000074   0810B0E1           MOVS     R1,R8
   \   00000078   FF1011E2           ANDS     R1,R1,#0xFF      ;; Zero extend
   \   0000007C   0400B0E1           MOVS     R0,R4
   \   00000080   ........           BL       GetDescriptor
   \   00000084   C10000EA           B        ??USBDDriver_RequestHandler_4
    516                      break;
    517          
    518                  case USBGenericRequest_SETADDRESS:
    519                      trace_LOG(trace_INFO, "set address\n");
   \                     ??USBDDriver_RequestHandler_5:
   \   00000088   10039FE5           LDR      R0,??USBDDriver_RequestHandler_1+0x8  ;; `?<Constant "set address\\n">`
   \   0000008C   ........           BL       printf
    520                      
    521                      // Sends a zero-length packet and then set the device address
    522                      address = USBSetAddressRequest_GetAddress(pRequest);
   \   00000090   0500B0E1           MOVS     R0,R5
   \   00000094   ........           BL       USBSetAddressRequest_GetAddress
   \   00000098   00B0B0E1           MOVS     R11,R0
    523          
    524                      if( USBD_IsHighSpeed() ) {
   \   0000009C   ........           BL       USBD_IsHighSpeed
   \   000000A0   000050E3           CMP      R0,#+0
   \   000000A4   0300000A           BEQ      ??USBDDriver_RequestHandler_6
    525          
    526                          USBD_SetAddress( address );
   \   000000A8   0B00B0E1           MOVS     R0,R11
   \   000000AC   FF0010E2           ANDS     R0,R0,#0xFF      ;; Zero extend
   \   000000B0   ........           BL       USBD_SetAddress
   \   000000B4   B50000EA           B        ??USBDDriver_RequestHandler_4
    527                      }
    528                      else {
    529                          USBD_Write(0, 0, 0, (TransferCallback) USBD_SetAddress, (void *) address);
   \                     ??USBDDriver_RequestHandler_6:
   \   000000B8   08D04DE2           SUB      SP,SP,#+8
   \   000000BC   00B08DE5           STR      R11,[SP, #+0]
   \   000000C0   DC329FE5           LDR      R3,??USBDDriver_RequestHandler_1+0xC  ;; USBD_SetAddress
   \   000000C4   0020A0E3   

⌨️ 快捷键说明

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