Header File:         #include <USB_API.H>

This documentation describes the CLIB API of the IPC@CHIP® RTOS dual-mode USB-driver. The SC1x3/SC2x disposes of a USB-controller that is compliant with the USB specification version 1.1.
Though the USB-API hides much of the complexity of the USB, one should fly over the specification to get a grasp of how USB works.
We also recommend to take notice of the Requirements and Recommendations for USB Products with Embedded Hosts and/or Multiple Receptacles.

The USB-driver can be used in Device mode to implement a USB device (resp. function) which will then be connected to e.g. a PC-Host; or it can be used in Host mode. In this case USB devices can be connected to the IPC@CHIP® handled by device-specific drivers that use the USB-API.
The RTOS USB-driver can operate in only one mode at a time. To implement a USB Function (Device) using this API, an additional circuit is needed, which manages attach- and speed-detection. A diagram is included in the hardware manual of the SC1x3/SC2x showing how to prepare your hardware to operate in both modes. Any PIO can be used to control this circuit. The API switches the PIO as needed.

Please note that there's no Hub support in Host mode and that there are some restrictions regarding data structures handled by the RTOS USB-driver necessary to keep the driver small and fast. These mainly concern Configurations, Interfaces and Alternate Settings. These restrictions should not constrain you much when implementing a USB-device and most devices connected to an IPC@CHIP® operating in Host mode will fulfil the conditions too.
  • There can only be one Configuration. (It is uncommon to use more than one Configuration though the specification allows it.)
  • There can be at most 10 Interfaces.
  • Each interface can have maximal 12 alternate settings.
  • Alternate settings in Device mode can only be used to alter the maximum packet size and the polling interval of its assigned endpoints. It is impossible to change e.g. the number of assigned endpoints. This would also be very uncommon. In Host mode a device may also have a different number of endpoints and different transfer types in Alternate Settings.

    Common     Device mode only     Host mode only


Common Functions

usbSendSend data
usbFreeReceiveBufferHand a receive buffer back to the driver
usbWakeupWake up suspended nodes
usbSofNotifyEnable/disable notification of SOF events

Device mode only Functions

usbDeviceInitInitialise driver for Device mode
usbDeviceDeinitDeinitialise Device mode driver
usbDeviceRegisterInterfaceRegister an interface
usbDeviceRegisterAltSettingRegister an Alternate Setting
usbDeviceGetEpsGet numbers of endpoints associated with an interface
usbDeviceConfigEpConfigure an endpoint
usbDeviceAddSpecificDescAdd a class- or verndor-specific descriptor
usbDeviceStartStart the Device mode driver
usbDeviceStopStop the Device mode driver
usbDeviceStallEpSet STALL condition for an endpoint
usbDeviceEnableEpEnable/disable OUT direction of an endpoint

Host mode only Functions

usbHostInitInitialise driver for Host mode
usbHostDeinitDeinitialise Host mode driver
usbHostIssueTokenIssue token
usbHostClearQueueClear an endpoint's queues
usbHostReserveEp0Reserve endpoint 0
usbHostReleaseEp0Release endpoint 0
usbHostGetDeviceInfoGet Device information
usbHostGetConfigInfoGet Configuration information
usbHostGetInterfaceInfoGet Interface information
usbHostGetEpInfoGet Endpoint information
usbHostGetStringGet string
usbHostGetStatusGet status
usbHostSetClearFeatureSet/clear feature
usbHostSetInterfaceSet interface

List of C Libraries
@CHIP-RTOS Main Index

End of document