USB

The USB Library provides a set of data types and functions for creating USB device, host, or dual mode applications. USB library can be found in the /libraries/communications/usb directory of the C2000Ware installation. Pre-built library and source code for the USB library are provided. Reference examples for host, device and dual mode operation are also included in the Driverlib examples directory of C2000Ware installation. The USB library can be categorized into following main groups: device mode specific functions, host mode specific functions and general purpose functions.

USB library’s device mode functions provide four API layers relevant to the development of USB device applications:

  • Device Class APIs

  • Device Class Driver APIs

  • The USB Device API

  • The USB DriverLib API

Source code and headers for the device mode USB functions can be found in the device directory of the USB library tree, typically libraries/communications/usb/<device>/include/device and libraries/communications/usb/<device>/source/device.

USB DriverLib API is the lowest layer in the USB device stack is the USB driver. This is typically not used for any application development but can be used for development of USB stack. USB Device API provides a group of functions specifically intended to allow development of fully featured USB device applications. These APIs can be used in the development of USB device class drivers and can also be used directly.

Device Class Driver APIs provide high level USB function to applications wishing to offer particular USB features with minimal application overhead. Device class drivers are currently provided to allow creation of a generic bulk device, a Communication Device Class (virtual serial port) device and a Human Interface Device class device (mouse, keyboard, etc.)

Device Class APIs provided an additional layer to specialize the device operation and simplify the interface to the application.

USB library’s host mode functions provide the following four layers:

  • Device APIs (Mouse, Keyboard, Filesystem)

  • Host Class Driver APIs (HID, Mass Storage, Hub)

  • Host Controller APIs

  • DriverLib USB Driver APIs

Source code and headers for the device host mode USB functions can be found in the device directory of the USB library tree, typically libraries/communications/usb/<device>/include/host and libraries/communications/usb/<device>/source/host

USB DriverLib API is the lowest layer in the USB device stack is the USB driver. This is typically not used for any application development but can be used for development of USB stack.

The host controller APIs provide all of the functionality necessary to provide enumeration of devices. This is the lowest level of the driver interface which interacts directly with the DriverLib USB APIs.

The host class drivers provide access to devices that use a common USB class interface. The USB library currently supports the following USB class drivers: Mass Storage Class (MSC) and Human Interface Device (HID) and Hub.

The Host Device APIs provide interfaces for a HID mouse, a HID keyboard and a mass storage device

General purpose functions included in the USB library are not specific to USB host or device operation and are provided for general use in the development of USB applications.

Source code and headers for the general-purpose USB functions can be found in the top level directory of the USB library tree, typically libraries/communications/usb/<device>/include and libraries/communications/usb/<device>/source.