Keil Logo

Technical Support

On-Line Manuals

RL-ARM User's Guide (MDK v4)

RL-RTX RL-FlashFS RL-TCPnet RL-CAN RL-USB RL-USB for USB Device Applications RL-USB Device Library RL-USB Device Features RL-USB Device Software Stack RL-USB Device Functions RL-USB Device Source Files RL-USB Device Configuration Audio Device (ADC) Options Communication Device (CDC) - ACM Options Human Interface Device (HID) Options Mass Storage Device (MSC) Options Create USB Device Applications Create ADC Applications Create CDC ACM Applications Create HID Applications Create MSC Applications Create Composite Applications Test USB Device Applications Compliance Tests Test HID Client Application RL-USB for USB Host Applications RL-USB Host Library RL-USB Host Features RL-USB Host Software Stack RL-USB Host Functions RL-USB Host Source Files RL-USB Host Configuration Host Controller Driver Selection Host Controller Driver Configuration Host Class Driver Selection Create USB Host Applications Create USB Host HID Applications HID_Kbd Example Create USB Host MSC Applications Create USB Host Class Driver RL-USB Host Constants and Structures Error constants Speed constants Transaction Packet Type constants Transaction Error Type constants USB Request Block structure (USBH_URB) Endpoint structure (USBH_EP) Driver Capabilites structure (USBH_HCI_CAP) Device Class Instance structure (USBH_DCI) Host Controller Instance structure (USBH_HCI) Host Controller Driver structure (USBH_HCD) USB Concepts USB Transfer Rates USB Network Basic Communication Model USB Protocol Control Transfer Interrupt Transfer Isochronous Transfer Bulk Transfer Descriptors Device Configuration Device Descriptor Configuration Descriptor Interface Descriptor Endpoint Descriptor Device Qualifier Descriptor Example Programs Library Reference Appendix

USB Request Block structure (USBH_URB)

USB Request Block (USBH_URB) structure represents communication structure between USB Host core and USB Host driver.

typedef volatile struct {               /* USB Request Block (URB)            */
  U8          *ptrDataBuffer;           /* Pointer to Data Buffer             */
  U8          *ptrCurrentDataBuffer;    /* Pointer to Current pos in Data Buff*/
  U32          DataLength;              /* Data Length                        */
  U32          DataTransferred;         /* Data Transferred                   */
  union {
    U32        Parameters;              /* Transfer Parameters                */
    struct {
      U32      PacketType        :  4;  /* Packet Type                        */
      U32      ToggleBit         :  1;  /* Toggle Bit Value                   */
      U32      ToggleForce       :  1;  /* Toggle Bit Forced (if cleared
                                           ToggleBit value is ignored)        */
    };
  };
  union {
    U32        Status;                  /* Status                             */
    struct {
      U32      Submitted         :  1;  /* URB Submit Status                  */
      U32      InProgress        :  1;  /* URB Processing In Progress Status  */
      U32      Cancelled         :  1;  /* URB Cancel Status                  */
      U32      Completed         :  1;  /* URB Completition Status            */
      U32      Timeout           :  1;  /* URB Timeout Status                 */
      U32      ResponsePacketType:  4;  /* Response Packet Type               */
      U32      Reserved          :  7;  /* Reserved bits to reposition other  */
      U32      Error             :  8;  /* URB Error        Status            */
    };
  };
  U32          NAKRetries;              /* Number of NAK retries              */
  U32          TimeoutCount;            /* Transaction Timeout Counter        */
  void       (*CompletedCallback)(void);/* URB Completition Callback Function */
} USBH_URB;

Explanation of USBH_URB structure elements:

  • ptrDataBuffer represents a pointer to data for the transfer.
  • ptrCurrentDataBuffer represents a pointer to current data for the transfer. It is used for restarting transmissions due to errors.
  • DataLength represents number of bytes to transfer.
  • DataTransferred represents number of bytes actually transferred.
  • Parameters represents various transfer parameters.
    • PacketType represents packet type for the transfer (USBH_PACKET_xxxx).
    • ToggleBit represents starting toggle bit value for the first packet of the transfer.
    • ToggleForce determines if toggle bit value from ToggleBit is forced as a new toggle value for next transfer. For example this bit should be __FALSE for bulk transfers except first as toggle bit is alternated in packets during bulk transfers.
  • Status represents various transfer status information.
    • Submitted represents submit condition. When application sets Submitted to __TRUE the transfer will be executed as soon as possible.
    • InProgress represents execution status of the transfer. If it is __TRUE means that transfer is in progress and currently being executed.
    • Cancelled represents cancelled condition. If it is __TRUE means that transfer was cancelled due to some error condition.
    • Completed represents completion condition. If it is __TRUE means that transfer has completed (it can also complete with errors, in that case transfer should be repeated).
    • Timeout represents timeout condition. If it is __TRUE means that transfer has not finished and did not complete due to the timeout condition.
    • ResponsePacketType represents responding packet type. For example if data was transmitted to a device response packet could be USBH_PACKET_ACK, USBH_PACKET_NAK or USBH_PACKET_STALL (for full/low speed transfer).
    • Reserved bits are used only for padding but can in future be used for some additional functionality.
    • Error represents error that happened during the transfer.
  • NAKRetries represent number of NAKs that transfer will wait for before terminating.
  • TimeoutCount represent number of milliseconds that can expire between request and response on the bus during this transfer before transfer will be terminated.
  • CompletedCallback represent pointer to a function which will be called when transfer is completed (even when there were errors during the transfer).
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.