|
EZR32 Happy Gecko Software Documentation
ezr32hg-doc-5.1.2
|
USB protocol stack library API for EFM32/EZR32.
(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_usb.h.
#include "em_device.h"#include "em_assert.h"#include "usbconfig.h"#include <string.h>#include <stddef.h>#include "em_common.h"#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | USB_ConfigurationDescriptor_TypeDef |
| USB Configuration Descriptor. More... | |
| struct | USB_DeviceDescriptor_TypeDef |
| USB Device Descriptor. More... | |
| struct | USB_EndpointDescriptor_TypeDef |
| USB Endpoint Descriptor. More... | |
| struct | USB_InterfaceDescriptor_TypeDef |
| USB Interface Descriptor. More... | |
| struct | USB_Setup_TypeDef |
| USB Setup request package. More... | |
| struct | USB_StringDescriptor_TypeDef |
| USB String Descriptor. More... | |
| struct | USBD_Callbacks_TypeDef |
| USB Device stack callback structure. More... | |
| struct | USBD_Init_TypeDef |
| USB Device stack initialization structure. More... | |
Typedefs | |
| typedef unsigned short | char16_t |
| typedef int(* | USB_XferCompleteCb_TypeDef) (USB_Status_TypeDef status, uint32_t xferred, uint32_t remaining) |
| USB transfer callback function. More... | |
| typedef struct USBD_Callbacks_TypeDef | USBD_Callbacks_TypeDef |
| USB Device stack callback structure. More... | |
| typedef void(* | USBD_DeviceStateChangeCb_TypeDef) (USBD_State_TypeDef oldState, USBD_State_TypeDef newState) |
| USB State change callback function. More... | |
| typedef bool(* | USBD_IsSelfPoweredCb_TypeDef) (void) |
| USB power mode callback function. More... | |
| typedef int(* | USBD_SetupCmdCb_TypeDef) (const USB_Setup_TypeDef *setup) |
| USB setup request callback function. More... | |
| typedef void(* | USBD_SofIntCb_TypeDef) (uint16_t sofNr) |
| USB Start Of Frame (SOF) interrupt callback function. More... | |
| typedef void(* | USBD_UsbResetCb_TypeDef) (void) |
| USB Reset callback function. More... | |
| typedef void(* | USBTIMER_Callback_TypeDef) (void) |
| USBTIMER callback function. More... | |
Enumerations | |
| enum | USB_Status_TypeDef { USB_STATUS_OK = 0, USB_STATUS_REQ_ERR = -1, USB_STATUS_EP_BUSY = -2, USB_STATUS_REQ_UNHANDLED = -3, USB_STATUS_ILLEGAL = -4, USB_STATUS_EP_STALLED = -5, USB_STATUS_EP_ABORTED = -6, USB_STATUS_EP_ERROR = -7, USB_STATUS_EP_NAK = -8, USB_STATUS_DEVICE_UNCONFIGURED = -9, USB_STATUS_DEVICE_SUSPENDED = -10, USB_STATUS_DEVICE_RESET = -11, USB_STATUS_TIMEOUT = -12, USB_STATUS_DEVICE_REMOVED = -13, USB_STATUS_HC_BUSY = -14, USB_STATUS_DEVICE_MALFUNCTION = -15, USB_STATUS_PORT_OVERCURRENT = -16 } |
| USB transfer status enumerator. More... | |
| enum | USBD_State_TypeDef { USBD_STATE_NONE = 0, USBD_STATE_ATTACHED = 1, USBD_STATE_POWERED = 2, USBD_STATE_DEFAULT = 3, USBD_STATE_ADDRESSED = 4, USBD_STATE_CONFIGURED = 5, USBD_STATE_SUSPENDED = 6, USBD_STATE_LASTMARKER = 7 } |
| USB device state enumerator. More... | |
Functions | |
| char * | USB_GetErrorMsgString (int error) |
| Return an error message string for a given error code. More... | |
| void | USB_PrintErrorMsgString (char *pre, int error) |
| Format and print a text string given an error code, prepends an optional user supplied leader string. More... | |
| int | USB_PRINTF (const char *format,...) |
| Transmit "printf" formated data on the debug serial port. More... | |
| int | USB_PUTCHAR (char c) |
| Transmit a single char on the debug serial port. More... | |
| void | USB_PUTS (const char *p) |
| Transmit a zero terminated string on the debug serial port. More... | |
| void | USBD_AbortAllTransfers (void) |
| Abort all pending transfers. More... | |
| int | USBD_AbortTransfer (int epAddr) |
| Abort a pending transfer on a specific endpoint. More... | |
| void | USBD_Connect (void) |
| Start USB device operation. More... | |
| void | USBD_Disconnect (void) |
| Stop USB device operation. More... | |
| bool | USBD_EpIsBusy (int epAddr) |
| Check if an endpoint is busy doing a transfer. More... | |
| USBD_State_TypeDef | USBD_GetUsbState (void) |
| Get current USB device state. More... | |
| const char * | USBD_GetUsbStateName (USBD_State_TypeDef state) |
| Get a string naming a device USB state. More... | |
| int | USBD_Init (const USBD_Init_TypeDef *p) |
| Initializes USB device hardware and internal protocol stack data structures, then connects the data-line (D+ or D-) pullup resistor to signal host that enumeration can begin. More... | |
| int | USBD_Read (int epAddr, void *data, int byteCount, USB_XferCompleteCb_TypeDef callback) |
| Start a read (OUT) transfer on an endpoint. More... | |
| int | USBD_RemoteWakeup (void) |
| Perform a remote wakeup signalling sequence. More... | |
| bool | USBD_SafeToEnterEM2 (void) |
| Check if it is ok to enter energy mode EM2. More... | |
| int | USBD_StallEp (int epAddr) |
| Set an endpoint in the stalled (halted) state. More... | |
| void | USBD_Stop (void) |
| Stop USB device stack operation. More... | |
| int | USBD_UnStallEp (int epAddr) |
| Reset stall state on a stalled (halted) endpoint. More... | |
| int | USBD_Write (int epAddr, void *data, int byteCount, USB_XferCompleteCb_TypeDef callback) |
| Start a write (IN) transfer on an endpoint. More... | |
| void | USBTIMER_DelayMs (uint32_t msec) |
| Active wait millisecond delay function. Can also be used inside interrupt handlers. More... | |
| void | USBTIMER_DelayUs (uint32_t usec) |
| Active wait microsecond delay function. Can also be used inside interrupt handlers. More... | |
| void | USBTIMER_Init (void) |
| Activate the hardware timer used to pace the 1 millisecond timer system. More... | |