EFM32 Wonder Gecko Software Documentation  efm32wg-doc-5.1.2
em_usbh.c File Reference

Detailed Description

USB protocol stack library API for EFM32/EZR32.

Version
5.1.2

License

(C) Copyright 2014 Silicon Labs, http://www.silabs.com

This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file em_usbh.c.

#include "em_device.h"
#include "em_usb.h"
#include "em_cmu.h"
#include "em_core.h"
#include "em_usbtypes.h"
#include "em_usbhal.h"
#include "em_usbh.h"
#include "em_gpio.h"

Go to the source code of this file.

Functions

int USBH_AssignHostChannel (USBH_Ep_TypeDef *ep, uint8_t hcnum)
 Assign a host channel to a given endpoint. More...
 
int USBH_ControlMsg (USBH_Ep_TypeDef *ep, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength, void *data, int timeout, USB_XferCompleteCb_TypeDef callback)
 Send a SETUP command to a device, non-blocking version. More...
 
int USBH_ControlMsgB (USBH_Ep_TypeDef *ep, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength, void *data, int timeout)
 Send a SETUP command to a device, blocking version. More...
 
bool USBH_DeviceConnected (void)
 Check if a device is connected. More...
 
int USBH_GetConfigurationDescriptorB (USBH_Device_TypeDef *device, void *buf, int len, uint8_t configIndex)
 Read a configuration descriptor from a device. More...
 
int USBH_GetDeviceDescriptorB (USBH_Device_TypeDef *device, void *buf, int len)
 Read a device descriptor from a device. More...
 
uint8_t USBH_GetPortSpeed (void)
 Get the bus speed of the device attached to the USB port. More...
 
int USBH_GetStringB (USBH_Device_TypeDef *device, uint8_t *buf, int bufLen, uint8_t stringIndex, uint16_t langID)
 Read a string descriptor from a device. More...
 
int USBH_Init (const USBH_Init_TypeDef *p)
 Initialize host protocol stack data structures. More...
 
int USBH_InitDeviceData (USBH_Device_TypeDef *device, const uint8_t *buf, USBH_Ep_TypeDef *ep, int numEp, uint8_t deviceSpeed)
 Populate device and endpoint data structures with data retrieved during device enumeration. More...
 
int USBH_PortReset (void)
 Drive reset signalling on the USB port. More...
 
int USBH_PortResume (void)
 Drive resume signalling on the USB port. More...
 
void USBH_PortSuspend (void)
 Set the USB port in suspend mode.
 
int USBH_PrintConfigurationDescriptor (const USB_ConfigurationDescriptor_TypeDef *config, int maxLen)
 Pretty print a configuration descriptor on the debug serial port. More...
 
int USBH_PrintDeviceDescriptor (const USB_DeviceDescriptor_TypeDef *device)
 Pretty print a device descriptor on the debug serial port. More...
 
int USBH_PrintEndpointDescriptor (const USB_EndpointDescriptor_TypeDef *endpoint)
 Pretty print an endpoint descriptor on the debug serial port. More...
 
int USBH_PrintInterfaceDescriptor (const USB_InterfaceDescriptor_TypeDef *interface)
 Pretty print an interface descriptor on the debug serial port. More...
 
void USBH_PrintString (const char *pre, const USB_StringDescriptor_TypeDef *s, const char *post)
 Print a USB string descriptor on the debug serial port. More...
 
USB_ConfigurationDescriptor_TypeDefUSBH_QGetConfigurationDescriptor (const uint8_t *buf, int configIndex)
 Return a pointer to a configuration descriptor. More...
 
USB_DeviceDescriptor_TypeDefUSBH_QGetDeviceDescriptor (const uint8_t *buf)
 Return a pointer to the device descriptor. More...
 
USB_EndpointDescriptor_TypeDefUSBH_QGetEndpointDescriptor (const uint8_t *buf, int configIndex, int interfaceIndex, int endpointIndex)
 Return a pointer to an endpoint descriptor. More...
 
USB_InterfaceDescriptor_TypeDefUSBH_QGetInterfaceDescriptor (const uint8_t *buf, int configIndex, int interfaceIndex)
 Return a pointer to an interface descriptor. More...
 
int USBH_QueryDeviceB (uint8_t *buf, size_t bufsize, uint8_t deviceSpeed)
 Will request both the device descriptor and the entire configuration descriptor from the device at USB address 0. More...
 
int USBH_Read (USBH_Ep_TypeDef *ep, void *data, int byteCount, int timeout, USB_XferCompleteCb_TypeDef callback)
 Read data from device endpoint, non-blocking version. More...
 
int USBH_ReadB (USBH_Ep_TypeDef *ep, void *data, int byteCount, int timeout)
 Read data from device endpoint, blocking version. More...
 
int USBH_SetAddressB (USBH_Device_TypeDef *device, uint8_t deviceAddress)
 Give a device an USB address. More...
 
int USBH_SetAltInterfaceB (USBH_Device_TypeDef *device, uint8_t interfaceIndex, uint8_t alternateSetting)
 Activate a device interface within current device configuration. More...
 
int USBH_SetConfigurationB (USBH_Device_TypeDef *device, uint8_t configValue)
 Activate a device configuration. More...
 
int USBH_StallEpB (USBH_Ep_TypeDef *ep)
 Set an endpoint in the stalled (halted) state. More...
 
void USBH_Stop (void)
 Stop USB host operation. More...
 
int USBH_UnStallEpB (USBH_Ep_TypeDef *ep)
 Reset stall state on a stalled (halted) endpoint. More...
 
int USBH_WaitForDeviceConnectionB (uint8_t *buf, int timeoutInSeconds)
 Wait for device connection. More...
 
int USBH_Write (USBH_Ep_TypeDef *ep, void *data, int byteCount, int timeout, USB_XferCompleteCb_TypeDef callback)
 Write data to device endpoint, non-blocking version. More...
 
int USBH_WriteB (USBH_Ep_TypeDef *ep, void *data, int byteCount, int timeout)
 Write data to device endpoint, blocking version. More...