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

RL-USB Host Functions

The following RL-USB Host Functions are important to understand the RL-USB Host Software Stack. RL-USB Host functions are categorized into:

  • Core functions
    initialize and run the USB Host Core. These functions are part of the RL-USB Library.

    Function Name Description
    usbh_init Initializes the USB Host Stack and USB Host Controller Hardware.
    usbh_init_all Initializes the USB Host Stack and all of the USB Host Controllers Hardware.
    usbh_uninit Uninitializes the USB Host Stack and USB Host Controller Hardware.
    usbh_uninit_all Uninitializes the USB Host Stack and all of the USB Host Controllers Hardware.
    usbh_engine Handles USB Host events and executes enumeration.
    usbh_engine_all Handles USB Hosts events and executes enumeration.
    usbh_get_last_error Returns last error that happened on the USB Host Core.
    usbh_get_error_string Returns string with name of requested error code.
  • Memory management functions
    provide simple memory management for the USB Host stack.

    Function Name Description
    usbh_mem_init Initializes the memory pool.
    usbh_mem_alloc Allocates a block of memory form the memory pool.
    usbh_mem_free Frees a previously allocated block of memory.
  • OHCI Compliant USB Host Controller Hardware layer functions
    interact with the OHCI USB Host Controller Hardware. In most cases, these functions are provided in an external module for devices that have an OHCI compliant USB Host Controller. For devices without this module, adapt the functions manually. Provided modules are located in the folder \ARM\RL\USB\Drivers and have the name usbh_ohci_device family name.c.

    Function Name Description
    get_capabilities Report driver capabilities.
    delay_ms Delays execution for a specified time in milliseconds.
    reg_wr Writes data to the OHCI register.
    reg_rd Reads data from the OHCI register.
    pins_config Configures or unconfigures pins used by the OHCI Controller.
    init Initializes or uninitializes the OHCI Controller. For example: clocks.
    port_power Drives port power pin on or off (VBUS).
    irq_en Enables or disables the OHCI Controller interrupt.
  • Custom EHCI for NXP devices USB Host Controller Hardware layer functions
    interact with the custom EHCI for NXP devices USB Host Controller Hardware. In most cases, these functions are provided in an external module for devices that have an custom EHCI for NXP devices compliant USB Host Controller. For devices without this module, adapt the functions manually. Provided modules are located in the folder \ARM\RL\USB\Drivers and have the name usbh_ehci_device family name.c.

    Function Name Description
    get_capabilities Report driver capabilities.
    delay_ms Delays execution for a specified time in milliseconds.
    reg_wr Writes data to the EHCI register.
    reg_rd Reads data from the EHCI register.
    pins_config Configures or unconfigures pins used by the EHCI Controller.
    init Initializes or uninitializes the EHCI Controller. For example: clocks.
    port_power Drives port power pin on or off (VBUS).
    irq_en Enables or disables the EHCI Controller interrupt.
  • Custom USB Host Controller Hardware layer functions
    interact with the Custom USB Host Controller Hardware. In most cases, these functions are provided in an external module for devices that have Custom USB Host Controller. For devices without this module, adapt the functions manually. Provided modules are located in the folder \ARM\RL\USB\Drivers and have the name usbh_device family name.c.

    Function Name Description
    get_capabilities Report driver capabilities.
    delay_ms Delays execution for a specified time in milliseconds.
    pins_config Configures or unconfigures pins used by the USB Host Controller.
    init Initializes or uninitializes the USB Host Controller. For example: clocks.
    port_power Drives port power pin on or off (VBUS).
    port_reset Do a port reset.
    get_connect Get the port connection status.
    get_speed Get the port enumerated speed.
    ep_add Add endpoint.
    ep_config Configure endpoint.
    ep_remove Remove endpoint.
    urb_submit Submit the communication request.
    urb_cancel Cancel the communication request.
  • HID Class specific functions
    enable the USB Host to support USB Human Interface Devices.

    Function Name Description
    usbh_hid_status Returns the HID device connection status.
    usbh_hid_data_in Retrieves the raw data received from the HID device.
    usbh_hid_data_out Sends the raw data to the HID device.
    usbh_hid_kbd_getkey Retrieves the signals sent by a USB keyboard.
    usbh_hid_mouse_getdata Retrieves the signals sent by a USB mouse.
    usbh_hid_parse_report_desc Enables user to analyze report descriptor.
    usbh_hid_data_in_callback Enables user to analyze and act upon received report data.
    usbh_hid_get_last_error Returns last error that happened on the human interface device instance.
  • MSC Class specific functions
    enable the USB Host to support USB Mass Storage Devices.

    Function Name Description
    usbh_msc_status Returns the MSC device connection status.
    usbh_msc_write Writes data from a buffer to MSC device sectors.
    usbh_msc_read Reads MSC device sector data into a buffer.
    usbh_msc_read_config Reads the USB MSC device configuration and checks whether the device is compatible with the Flash File System.
    usbh_msc_get_last_error Returns last error that happened on the mass storage device instance.
  • USB Device Class specific functions
    enable the USB Host to support additional USB Device Class. Functions listed below provide class interface to the USB Host Core, also functions that provide application with class functionality need to be implemented but their names and functionality depend on class supported.

    Function Name Description
    Config Config function should configure resources for a device of specified class.
    UnConfig UnConfig function should unconfigure resources previously configured for a device of specified class.
    Init Init function should initialize the device of a specified class.
    UnInit UnInit function should uninitialize the device of a specified class.
    GetLastError GetLastError function should return the last error code of the device of specified class.
  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.