Data Structures | Macros | Typedefs | Enumerations
usb_dev_object.h File Reference

This file contains device object data structure - a structure which is a wrapper that encapsulates the driver components used to manage a single device controller. More...

#include "usb_spec_defines.h"

Data Structures

struct  usbConfigSection
 declaration of Generic usb request. More...
 
struct  usbConfigHeader
 This is the top level structure defining a USB device configuration descriptor. A configuration descriptor contains a collection of device- specific descriptors in addition to the basic config, interface and endpoint descriptors. To allow flexibility in constructing the configuration, the descriptor is described in terms of a list of data blocks. The first block must contain the configuration descriptor itself and the following blocks are appended to this in order to produce the full descriptor sent to the host in response to a GetDescriptor request for the configuration descriptor. More...
 
struct  usbDescriptor
 USB descriptor structure which presents a combined view of all descriptors used by a gadget/host. This data structure is common to both host and device stacks.In the host case , the protocol core would copy the descriptors received by the host into this structure. In the gadget stack , the function/gadget driver populates this structure. More...
 
struct  usbClassAction
 Gadget action object structure which compiles a list of actions that can be performed on any USB function or pGadget. These functions would be called by the gadget driver. More...
 
struct  usbClassObj
 This structure defines the generic USB class object which is used by the protocol layer ot interact with the required class driver. The class needs to register with the protocol layer before this object can be used. More...
 
struct  usbDevEndptInfo
 This structure defines the configurable paramters of an endpoint. The protocol core is expected to call the config routine with this structure populated as many times as there are endpoints. More...
 
struct  usbDmaEvt
 Structure containing information regarding system DMA events. More...
 
struct  usbDevEvt
 Structure containing information regarding events that can be raised by the device control driver. More...
 
struct  usbDevChara
 Function pointer to function which is used by the core to set device charectristics such as device speed, device address,Number of endpoints required and their endpoint numbers. Fifo config must be done by dcd. More...
 
struct  usbDevRequest
 USB request structure which encapsulates information required by the dcd to genererate USB traffic. More...
 
struct  usbDevCoreCallback
 Device object core call back functions which would be used by dcds to to communicate with the device protocol core - (device manager block being a part of it). More...
 
struct  usbDevDcdAction
 Dcd driver actions Structure which collates all actions required by the dcds to implement The protocol core call these actions to generate USB traffic. More...
 
struct  usbDcd
 
struct  usbGadgetObj
 Device object structure which holds information related to a particular device controller - which assumes the role of one device. More...
 

Macros

#define MAX_GADGET_EVENTS   (32U)
 Maximum number of gadget events that can be stored in the event Array. TBD - make this a list. More...
 
#define MAX_DMA_EVENTS   (1U)
 Max number of system DMA buffer Events.
 
#define MAX_NUM_REQUESTS   (32U)
 Maximum number of DMA events.
 

Typedefs

typedef struct usbDevRequest usbEndpt0Request_t
 Forward declaration of dcd object .
 
typedef struct usbDevRequest usbEndptRequest_t
 declaration of EP0 request.
 
typedef struct usbConfigSection usbConfigSection_t
 declaration of Generic usb request. More...
 
typedef struct usbConfigHeader usbConfigHeader_t
 This is the top level structure defining a USB device configuration descriptor. A configuration descriptor contains a collection of device- specific descriptors in addition to the basic config, interface and endpoint descriptors. To allow flexibility in constructing the configuration, the descriptor is described in terms of a list of data blocks. The first block must contain the configuration descriptor itself and the following blocks are appended to this in order to produce the full descriptor sent to the host in response to a GetDescriptor request for the configuration descriptor.
 
typedef struct usbDescriptor usbDescriptor_t
 USB descriptor structure which presents a combined view of all descriptors used by a gadget/host. This data structure is common to both host and device stacks.In the host case , the protocol core would copy the descriptors received by the host into this structure. In the gadget stack , the function/gadget driver populates this structure.
 
typedef enum usbEndpt0event usbEndpt0event_t
 structure defining possible events on Endpoint zero . DCD would uses these events to communicate to the protocol Core.
 
typedef enum usbGenericEvent usbGenericEvent_t
 structure defining possible events on all other endpoints. DCD would uses these events to communicate to the protocol Core.
 
typedef enum usbDeviceState usbDeviceState_t
 Enum containing current state of the Gadget.
 
typedef struct usbClassAction usbClassAction_t
 Gadget action object structure which compiles a list of actions that can be performed on any USB function or pGadget. These functions would be called by the gadget driver.
 
typedef struct usbClassObj usbClassObj_t
 This structure defines the generic USB class object which is used by the protocol layer ot interact with the required class driver. The class needs to register with the protocol layer before this object can be used.
 
typedef struct usbDevEndptInfo usbDevEndptInfo_t
 This structure defines the configurable paramters of an endpoint. The protocol core is expected to call the config routine with this structure populated as many times as there are endpoints.
 
typedef struct usbDmaEvt usbDmaEvt_t
 Structure containing information regarding system DMA events.
 
typedef struct usbDevEvt usbDevEvt_t
 Structure containing information regarding events that can be raised by the device control driver.
 
typedef enum usbDeviceDcdChara usbDeviceDcdChara_t
 This enum selcts the param the core wants the dcd to set. Initially the core sets the device speed and dsiables remote wake up.
 
typedef struct usbDevChara usbDevChara_t
 Function pointer to function which is used by the core to set device charectristics such as device speed, device address,Number of endpoints required and their endpoint numbers. Fifo config must be done by dcd.
 
typedef struct usbDevRequest usbDevRequest_t
 USB request structure which encapsulates information required by the dcd to genererate USB traffic.
 
typedef struct usbDevCoreCallback usbDevCoreCallback_t
 Device object core call back functions which would be used by dcds to to communicate with the device protocol core - (device manager block being a part of it).
 
typedef struct usbDevDcdAction usbDevDcdAction_t
 Dcd driver actions Structure which collates all actions required by the dcds to implement The protocol core call these actions to generate USB traffic.
 
typedef struct usbDcd usbDcd_t
 
typedef struct usbGadgetObj usbGadgetObj_t
 Device object structure which holds information related to a particular device controller - which assumes the role of one device.
 

Enumerations

enum  usbEndpt0event {
  USB_ENDPT0_EVENT_SETUP_PACKET_RECEIVED = 0U, USB_ENDPT0_SOF_RECEIVED = 1U, USB_ENDPT0_EVENT_DATA_IN_NAK = 2U, USB_ENDPT0_EVENT_DATA_IN_PARTIAL = 3U,
  USB_ENDPT0_EVENT_DATA_IN_COMPLETE = 4U, USB_ENDPT0_EVENT_DATA_OUT_NAK = 5U, USB_ENDPT0_EVENT_DATA_OUT_PARTIAL = 6U, USB_ENDPT0_EVENT_DATA_OUT_COMPLETE = 7U,
  USB_ENDPT0_EVENT_DATA_TOGGLE_ERROR = 8U, USB_ENDPT0_EVENT_TIMEOUT_ERROR = 9U, USB_ENDPT0_EVENT_BUS_ERROR = 10U
}
 structure defining possible events on Endpoint zero . DCD would uses these events to communicate to the protocol Core. More...
 
enum  usbGenericEvent {
  USB_GENERIC_EVENT_SOF_INTERRUPT = 0U, USB_GENERIC_EVENT_NAK_TIMEOUT = 1U, USB_GENERIC_EVENT_DATA_IN_NAK = 2U, USB_GENERIC_EVENT_DATA_IN_PARTIAL = 3U,
  USB_GENERIC_EVENT_DATA_IN_COMPLETE = 4U, USB_GENERIC_EVENT_DATA_OUT_NAK = 5U, USB_GENERIC_EVENT_DATA_OUT_PARTIAL = 6U, USB_GENERIC_EVENT_DATA_OUT_COMPLETE = 7U,
  USB_GENERIC_EVENT_DATA_TOGGLE_ERROR = 8U, USB_GENERIC_EVENT_TIMEOUT_ERROR = 9U, USB_GENERIC_EVENT_BUS_ERROR = 10U
}
 structure defining possible events on all other endpoints. DCD would uses these events to communicate to the protocol Core. More...
 
enum  usbDeviceState {
  USB_DEVICE_STATE_UNKNOWN = 0U, USB_DEVICE_STATE_INITIALIZED = 1U, USB_DEVICE_STATE_CONNECTED = 2U, USB_DEVICE_STATE_RESET = 3U,
  USB_DEVICE_STATE_ADDRESSED = 4U, USB_DEVICE_STATE_CONFIGURED = 5U, USB_DEVICE_STATE_ENUM_COMPLETE = 6U, USB_DEVICE_STATE_STALLED_ENDPOINT = 7U,
  USB_DEVICE_STATE_INITIATE_SUSPENDED = 8U, USB_DEVICE_STATE_SUSPENDED = 9U, USB_DEVICE_STATE_LPM_ACTIVE = 10U, USB_DEVICE_STATE_ERROR = 11U
}
 Enum containing current state of the Gadget. More...
 
enum  usbDeviceDcdChara {
  USB_DEVICE_DCD_CHARA_MIN = 1U, USB_DEVICE_DCD_CHARA_SPEED = USB_DEVICE_DCD_CHARA_MIN, USB_DEVICE_DCD_CHARA_ADDRESS = 2U, USB_DEVICE_DCD_EP_CONFIG = 3U,
  USB_DEVICE_DCD_CHARA_MAX = 4U, USB_DEVICE_DCD_CHARA_REMOTE_WAKE = USB_DEVICE_DCD_CHARA_MAX
}
 This enum selcts the param the core wants the dcd to set. Initially the core sets the device speed and dsiables remote wake up. More...
 

Detailed Description

This file contains device object data structure - a structure which is a wrapper that encapsulates the driver components used to manage a single device controller.

Macro Definition Documentation

#define MAX_GADGET_EVENTS   (32U)

Maximum number of gadget events that can be stored in the event Array. TBD - make this a list.

Copyright (c) Texas Instruments Incorporated 2015-2016

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Typedef Documentation

declaration of Generic usb request.

This structure defines the contiguous block of data which contains a group of descriptors that form a part of a contiguous descriptor for a device. It is assumed that a config section contains only whole descriptors. It is not valid to split a single descriptor across multiple sections.

typedef struct usbDcd usbDcd_t

Sample Device controller object - each Device controller instance would create an instance and register with the core

Enumeration Type Documentation

This enum selcts the param the core wants the dcd to set. Initially the core sets the device speed and dsiables remote wake up.

Enumerator
USB_DEVICE_DCD_CHARA_MIN 

min value of this enum .

USB_DEVICE_DCD_CHARA_SPEED 

this param when selected sets dcd speed.

USB_DEVICE_DCD_CHARA_ADDRESS 

this param when selected sets dcd address.

USB_DEVICE_DCD_EP_CONFIG 

this param when selected EP config.

USB_DEVICE_DCD_CHARA_MAX 

max value of this enum .

USB_DEVICE_DCD_CHARA_REMOTE_WAKE 

this param when selected enables or disables remote wakeup.

Enum containing current state of the Gadget.

Enumerator
USB_DEVICE_STATE_UNKNOWN 

Unknown state - State of data structures unknown.

USB_DEVICE_STATE_INITIALIZED 

Device data structures initialized, controller inite'd.

USB_DEVICE_STATE_CONNECTED 

Connected to host.

USB_DEVICE_STATE_RESET 

Host has driven reset.

USB_DEVICE_STATE_ADDRESSED 

address set.

USB_DEVICE_STATE_CONFIGURED 

configuration value sent by host accepted - internal setConfig () has returned successfully.

USB_DEVICE_STATE_ENUM_COMPLETE 

enumeration is complete. If some custom enumeration commands are sent by host the this state is different from configured state.

USB_DEVICE_STATE_STALLED_ENDPOINT 

One of the endpoints in the device is stalled.

USB_DEVICE_STATE_INITIATE_SUSPENDED 

Device is starting the suspend procedure.

USB_DEVICE_STATE_SUSPENDED 

Device is in suspend state.

USB_DEVICE_STATE_LPM_ACTIVE 

Low power mode active.

USB_DEVICE_STATE_ERROR 

Unknown error in device.

structure defining possible events on Endpoint zero . DCD would uses these events to communicate to the protocol Core.

Enumerator
USB_ENDPT0_EVENT_SETUP_PACKET_RECEIVED 

A setup packet was received.

USB_ENDPT0_SOF_RECEIVED 

Incase we need the SOF interrupt for any contingency.

USB_ENDPT0_EVENT_DATA_IN_NAK 

IN endpoint buffer currently has no data to transfer and hence NAKing.

USB_ENDPT0_EVENT_DATA_IN_PARTIAL 

one transaction (any one) transaction of a multi stage transaction is complete.

USB_ENDPT0_EVENT_DATA_IN_COMPLETE 

Control data transaction is complete.

USB_ENDPT0_EVENT_DATA_OUT_NAK 

Out endpoint zero has no data and is being currently polled by the host.

USB_ENDPT0_EVENT_DATA_OUT_PARTIAL 

one transaction (any one) transaction of a multi stage transaction is complete.

USB_ENDPT0_EVENT_DATA_OUT_COMPLETE 

Last requested OUT data transfer is complete.

USB_ENDPT0_EVENT_DATA_TOGGLE_ERROR 

Data toggle error has occured - retry the transfer.

USB_ENDPT0_EVENT_TIMEOUT_ERROR 

Host has not responded to a transaction (a packet level ACK is missing) with in the USB mandated time.

USB_ENDPT0_EVENT_BUS_ERROR 

All other bus errors - eg transaction error, frame number mismatch .

structure defining possible events on all other endpoints. DCD would uses these events to communicate to the protocol Core.

Enumerator
USB_GENERIC_EVENT_SOF_INTERRUPT 

Event representing the reception of an SOF frame.

USB_GENERIC_EVENT_NAK_TIMEOUT 

host has stopped polling because of a timeout.

USB_GENERIC_EVENT_DATA_IN_NAK 

IN endpoint buffer currently has no data to transfer and hence NAKing.

USB_GENERIC_EVENT_DATA_IN_PARTIAL 

one transaction (any one) of a multi stage transaction is done.

USB_GENERIC_EVENT_DATA_IN_COMPLETE 

A data IN request made to dcd is complete.

USB_GENERIC_EVENT_DATA_OUT_NAK 

Out endpoint zero has no data and is being currently polled by the host.

USB_GENERIC_EVENT_DATA_OUT_PARTIAL 

one transaction (any one) transaction of a multi stage transaction is complete.

USB_GENERIC_EVENT_DATA_OUT_COMPLETE 

Last requested OUT data transfer is complete.

USB_GENERIC_EVENT_DATA_TOGGLE_ERROR 

Data toggle error has occured - retry the transfer.

USB_GENERIC_EVENT_TIMEOUT_ERROR 

Host has not responded to a transaction (a packet level ACK is missing) with in the USB mandated time.

USB_GENERIC_EVENT_BUS_ERROR 

All other bus errors - eg transaction error, frame number mismatch .


Copyright 2016, Texas Instruments Incorporated