Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
usb_dwc_dcd.h File Reference

Device Abstraction layer header for USB DWC3 device contoller driver. More...

#include "hw_dwc_usb.h"
#include "hw_trb_device.h"
#include "hw_depcmdpar.h"
#include "usb_dcd_interface.h"

Data Structures

struct  usbDwcDcdDEpEvnt
 This structure contains the device endpoint specific event details. More...
 
struct  usbDwcDcdDEvnt
 This structure contains the device specific event buffer details. More...
 
union  usbDwcDcdEvnt
 This union contains the Event buffer description. The events can be of two types: More...
 
struct  usbDwcDcdDEpCmdParms
 Device physical endpoint Command parameters. More...
 
struct  usbDEpTrb
 This structure defines the bit fields required for USB endpoint TRB. More...
 
struct  usbDwcDcdDevice
 Dwc3 device object used by the DWC3 driver. More...
 

Macros

#define USB_DCD_DWC_EVNT_BUF_MAX   (32U)
 Macro to contain the maximum number of elements in a buffer.
 

Typedefs

typedef struct usbDwcDcdDEpEvnt usbDwcDcdDEpEvnt_t
 This structure contains the device endpoint specific event details.
 
typedef struct usbDwcDcdDEvnt usbDwcDcdDEvnt_t
 This structure contains the device specific event buffer details.
 
typedef union usbDwcDcdEvnt usbDwcDcdEvnt_t
 This union contains the Event buffer description. The events can be of two types: More...
 
typedef struct usbDwcDcdDEpCmdParms usbDwcDcdDEpCmdParms_t
 Device physical endpoint Command parameters.
 
typedef enum usbDEpCmdType usbDEpCmdType_t
 This enum contains the types of commands that can be issued by the DWC3 device controller.
 
typedef enum usbDwcDcdTrbCtrl usbDwcDcdTrbCtrl_t
 This enum indicates the type of the TRB being used.
 
typedef enum usbDwcDcdEvntType usbDwcDcdEvntType_t
 This enum contains the possible endpoint event.
 
typedef enum usbDwcDcdEp0State usbDwcDcdEp0State_t
 This enum contains the possible values of state of endpoint 0.
 
typedef struct usbDwcDcdDevice usbDwcDcdDevice_t
 Dwc3 device object used by the DWC3 driver.
 

Enumerations

enum  usbDEpCmdType {
  USB_D_EP_CMD_SETEPCFG = DWC_USB_DEPCMD_0_CMDTYP_DEPCFG, USB_D_EP_CMD_SETEPXFERRESCFG = DWC_USB_DEPCMD_0_CMDTYP_DEPXFERCFG, USB_D_EP_CMD_GETEPSTATE = DWC_USB_DEPCMD_0_CMDTYP_DEPGETDSEQ, USB_D_EP_CMD_SETSTALL = DWC_USB_DEPCMD_0_CMDTYP_DEPSETSTALL,
  USB_D_EP_CMD_CLRSTALL = DWC_USB_DEPCMD_0_CMDTYP_DEPCSTALL, USB_D_EP_CMD_STRTXFER = DWC_USB_DEPCMD_0_CMDTYP_DEPSTRTXFER, USB_D_EP_CMD_UPDXFER = DWC_USB_DEPCMD_0_CMDTYP_DEPUPDXFER, USB_D_EP_CMD_ENDXFER = DWC_USB_DEPCMD_0_CMDTYP_DEPENDXFER,
  USB_D_EP_CMD_STARTCFG = DWC_USB_DEPCMD_0_CMDTYP_DEPSTARTCFG
}
 This enum contains the types of commands that can be issued by the DWC3 device controller. More...
 
enum  usbDwcDcdTrbCtrl {
  USB_DWC_DCD_TRB_CTRL_NORMAL = TRB_CONTROL_TRBCTL_NORMAL, USB_DWC_DCD_TRB_CTRL_SETUP = TRB_CONTROL_TRBCTL_CSET, USB_DWC_DCD_TRB_CTRL_STATUS2 = TRB_CONTROL_TRBCTL_CSTS2, USB_DWC_DCD_TRB_CTRL_STATUS3 = TRB_CONTROL_TRBCTL_CSTS3,
  USB_DWC_DCD_TRB_CTRL_CTRL_DATA1 = TRB_CONTROL_TRBCTL_CDAT1, USB_DWC_DCD_TRB_CTRL_ISO_FIRST = TRB_CONTROL_TRBCTL_ISO1 , USB_DWC_DCD_TRB_CTRL_LINK = TRB_CONTROL_TRBCTL_LINK
}
 This enum indicates the type of the TRB being used. More...
 
enum  usbDwcDcdEvntType { USB_DWC_DCD_EVNT_TYPE_XFERCOMPLETE = 1U, USB_DWD_DCD_EVNT_TYPE_XFERNRDY = 3U }
 This enum contains the possible endpoint event. More...
 
enum  usbDwcDcdEp0State {
  USB_DWC_DCD_EP0_STATE_SETUP = 0, USB_DWC_DCD_EP0_STATE_DATA_IN, USB_DWC_DCD_EP0_STATE_DATA_OUT, USB_DWC_DCD_EP0_STATE_STATUS2,
  USB_DWC_DCD_EP0_STATE_STATUS3_IN, USB_DWC_DCD_EP0_STATE_STATUS3_OUT, USB_DWC_DCD_EP0_STATE_STALL
}
 This enum contains the possible values of state of endpoint 0. More...
 

Functions

struct usbDEpTrb __attribute__ ((packed)) usbDEpTrb_t
 This structure defines the bit fields required for USB endpoint TRB. More...
 
uint32_t USBDwcDcdInit (usbDcd_t *pDcdObject)
 USB DWC3 device controller driver core init API. More...
 
uint32_t USBDwcDcdIntrHandler (usbDwcDcdDevice_t *dwc3)
 USB DWC3 device interrupt handler. This will get all the device and endpoint events for all the endpoints. More...
 
uint32_t USBDwcDcdConfigDevChara (usbDcd_t *pDcdObject, usbDevChara_t *pDevCharacteristic)
 This API sets the device characteristics. More...
 
uint32_t USBDwcDcdEp0Req (usbDcd_t *pDcdObject, usbEndpt0Request_t req)
 Endpoint 0 request for control endpoint. More...
 
uint32_t USBDwcDcdEpReq (usbDcd_t *pDcdObject, usbEndptRequest_t req)
 Endpoint request for control bulk and isoch transfers for all endpoints other than endpoint 0. More...
 
void usbDwcDcdEnableWrapperIntr (uint32_t baseAddr)
 Enable all the wrapper interrupts. More...
 

Variables

uint32_t bufPtrLow
 
uint32_t bufPtrHigh
 
uint32_t bufSize
 
uint32_t packetCntM1
 
uint32_t rsvd1
 
uint32_t trbSts
 
uint32_t hwo
 
uint32_t lst
 
uint32_t trbCtrl
 
uint32_t ispImi
 
uint32_t ioc
 
uint32_t rsvd2
 
uint32_t streamId
 
uint32_t rsvd3
 

Detailed Description

Device Abstraction layer header for USB DWC3 device contoller driver.

Typedef Documentation

This union contains the Event buffer description. The events can be of two types:

  • Device endpoint specific event.
  • Device specific event.

Enumeration Type Documentation

This enum contains the types of commands that can be issued by the DWC3 device controller.

Enumerator
USB_D_EP_CMD_SETEPCFG 

Set endpoint configuration

USB_D_EP_CMD_SETEPXFERRESCFG 

Set endpoint transfer resource configuration

USB_D_EP_CMD_GETEPSTATE 

Get endpoint device state

USB_D_EP_CMD_SETSTALL 

Set endpoint stall

USB_D_EP_CMD_CLRSTALL 

Clear Endpoint stall

USB_D_EP_CMD_STRTXFER 

Start transfer command

USB_D_EP_CMD_UPDXFER 

Update transfer command

USB_D_EP_CMD_ENDXFER 

End transfer Command

USB_D_EP_CMD_STARTCFG 

Start Endpoint configuration

This enum contains the possible values of state of endpoint 0.

Enumerator
USB_DWC_DCD_EP0_STATE_SETUP 

Setup state for endpoint 0

USB_DWC_DCD_EP0_STATE_DATA_IN 

Data in state for endpoint 0

USB_DWC_DCD_EP0_STATE_DATA_OUT 

Data out phase for endpoint 0

USB_DWC_DCD_EP0_STATE_STATUS2 

Status 2 state for endpoint 0

USB_DWC_DCD_EP0_STATE_STATUS3_IN 

Status 3 in state for endpoint 0

USB_DWC_DCD_EP0_STATE_STATUS3_OUT 

Status 3 out state for endpoint 0

USB_DWC_DCD_EP0_STATE_STALL 

Endpoint 0 in stalled state

This enum contains the possible endpoint event.

Enumerator
USB_DWC_DCD_EVNT_TYPE_XFERCOMPLETE 

Transfer complete event on a endpoint

USB_DWD_DCD_EVNT_TYPE_XFERNRDY 

Transfer not ready even ton a endpoint

This enum indicates the type of the TRB being used.

Enumerator
USB_DWC_DCD_TRB_CTRL_NORMAL 

Normal TRB for Control data2+, bulk and interrupt

USB_DWC_DCD_TRB_CTRL_SETUP 

Control setup TRB

USB_DWC_DCD_TRB_CTRL_STATUS2 

Control status 2

USB_DWC_DCD_TRB_CTRL_STATUS3 

Control status 3

USB_DWC_DCD_TRB_CTRL_CTRL_DATA1 

control data 1

USB_DWC_DCD_TRB_CTRL_ISO_FIRST 

Isochronous First

USB_DWC_DCD_TRB_CTRL_LINK 

Isochronous TRB

Function Documentation

struct __attribute__ ( (packed)  )

This structure defines the bit fields required for USB endpoint TRB.

This structure describes the USB configuration descriptor as defined in USB 2.0 specification section 9.6.3. This structure also applies to the USB other speed configuration descriptor defined in section 9.6.4.

The length of this descriptor in bytes. All interface descriptors are 9 bytes long.

The type of the descriptor. For an interface descriptor, this will be USB_DTYPE_INTERFACE (4).

The number of this interface. This is a zero based index into the array of concurrent interfaces supported by this configuration.

The value used to select this alternate setting for the interface defined in bInterfaceNumber.

The number of endpoints used by this interface (excluding endpoint zero).

The interface class code as assigned by the USB-IF.

The interface subclass code as assigned by the USB-IF.

The interface protocol code as assigned by the USB-IF.

The index of a string descriptor describing this interface.

The length of this descriptor in bytes. All configuration descriptors are 9 bytes long.

The type of the descriptor. For a configuration descriptor, this will be USB_DTYPE_CONFIGURATION (2).

The total length of data returned for this configuration. This includes the combined length of all descriptors (configuration, interface, endpoint and class- or vendor-specific) returned for this configuration.

The number of interface supported by this configuration.

The value used as an argument to the SetConfiguration standard request to select this configuration.

The index of a string descriptor describing this configuration.

Attributes of this configuration.

The maximum power consumption of the USB device from the bus in this configuration when the device is fully operational. This is expressed in units of 2mA so, for example, 100 represents 200mA.

The length of this descriptor in bytes. All interface descriptors are 9 bytes long.

The type of the descriptor. For an interface descriptor, this will be USB_DTYPE_INTERFACE (4).

The number of this interface. This is a zero based index into the array of concurrent interfaces supported by this configuration.

The value used to select this alternate setting for the interface defined in bInterfaceNumber.

The number of endpoints used by this interface (excluding endpoint zero).

The interface class code as assigned by the USB-IF.

The interface subclass code as assigned by the USB-IF.

The interface protocol code as assigned by the USB-IF.

The index of a string descriptor describing this interface.

The length of this descriptor in bytes. All endpoint descriptors are 7 bytes long.

The type of the descriptor. For an endpoint descriptor, this will be USB_DTYPE_ENDPOINT (5).

The address of the endpoint. This field contains the endpoint number ORed with flag USB_EP_DESC_OUT or USB_EP_DESC_IN to indicate the endpoint direction.

The endpoint transfer type, USB_EP_ATTR_CONTROL, USB_EP_ATTR_ISOC, USB_EP_ATTR_BULK or USB_EP_ATTR_INT and, if isochronous, additional flags indicating usage type and synchronization method.

The maximum packet size this endpoint is capable of sending or receiving when this configuration is selected. For high speed isochronous or interrupt endpoints, bits 11 and 12 are used to pass additional information.

The polling interval for data transfers expressed in frames or micro frames depending upon the operating speed.

uint32_t USBDwcDcdConfigDevChara ( usbDcd_t pDcdObject,
usbDevChara_t pDevCharacteristic 
)

This API sets the device characteristics.

Parameters
pDcdObjectpointer to the USB device control object.
pDevCharacteristicpointer to the device characteristics structure.
void usbDwcDcdEnableWrapperIntr ( uint32_t  baseAddr)

Enable all the wrapper interrupts.

Parameters
baseAddrBaseaddress of USB wrapper register
uint32_t USBDwcDcdEp0Req ( usbDcd_t pDcdObject,
usbEndpt0Request_t  req 
)

Endpoint 0 request for control endpoint.

Parameters
pDcdObjectpointer to the USB device control object.
reqUSB request which needs to be handled for endpoint 0
uint32_t USBDwcDcdEpReq ( usbDcd_t pDcdObject,
usbEndptRequest_t  req 
)

Endpoint request for control bulk and isoch transfers for all endpoints other than endpoint 0.

Parameters
pDcdObjectpointer to the USB device control object.
reqUSB request which needs to be handled for endpoint other than endpoint 0.
uint32_t USBDwcDcdInit ( usbDcd_t pDcdObject)

USB DWC3 device controller driver core init API.

Parameters
pDcdObjectpointer to the USB device control driver object
uint32_t USBDwcDcdIntrHandler ( usbDwcDcdDevice_t dwc3)

USB DWC3 device interrupt handler. This will get all the device and endpoint events for all the endpoints.

Parameters
dwc3pointer to the dwc3 object

Variable Documentation

uint32_t bufPtrHigh

Buffer pointer high address

uint32_t bufPtrLow

Buffer pointer low address

uint32_t bufSize

Buffer size to be used

uint32_t hwo

Hardware owner of descriptor

uint32_t ioc

Interrupt on complete

uint32_t ispImi

Interrupt on short packet/ Missed ISOC

uint32_t lst

Last TRB

uint32_t packetCntM1

Packet count M1

uint32_t rsvd1

Reserved fields

uint32_t rsvd2

Reserved fields

uint32_t rsvd3

Reserved fields

uint32_t streamId

Stream ID

uint32_t trbCtrl

TRB control

uint32_t trbSts

TRB status


Copyright 2016, Texas Instruments Incorporated