Modules | Classes | Typedefs | Functions | Variables
Usbd_interface
Collaboration diagram for Usbd_interface:

Modules

 USB device API return codes
 
 USB device states
 

Classes

struct  _USBDDmaDescriptor
 Struct used for USBD DMA Link List Transfer Descriptor, must be 16-bytes aligned. More...
 
struct  _USBDDriver
 
struct  _USBDDriverDescriptors
 
struct  _USBDTransferBuffer
 Buffer struct used for multi-buffer-listed transfer. More...
 

Typedefs

typedef void(* MblTransferCallback) (void *pArg, uint8_t status)
 
typedef void(* TransferCallback) (void *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
 
typedef struct _USBDDriver USBDDriver
 USB device driver structure, holding a list of descriptors identifying the device as well as the driver current state. More...
 
typedef struct _USBDDriverDescriptors USBDDriverDescriptors
 List of all descriptors used by a USB device driver. Each descriptor can be provided in two versions: full-speed and high-speed. Devices which are not high-speed capable do not need to provided high-speed descriptors and the full-speed qualifier & other speed descriptors. More...
 
typedef struct _USBDTransferBuffer USBDTransferBuffer
 Buffer struct used for multi-buffer-listed transfer. More...
 

Functions

struct _USBDDmaDescriptor __attribute__ ((aligned(16))) USBDDmaDescriptor
 Struct used for USBD DMA Link List Transfer Descriptor, must be 16-bytes aligned. More...
 
static void GetConfiguration (const USBDDriver *pDriver)
 
static void GetDescriptor (const USBDDriver *pDriver, uint8_t type, uint8_t indexRDesc, uint32_t length)
 
static void GetDeviceStatus (const USBDDriver *pDriver)
 
static void GetEndpointStatus (uint8_t bEndpoint)
 
static void GetInterface (const USBDDriver *pDriver, uint8_t infnum)
 
static void SetConfiguration (USBDDriver *pDriver, uint8_t cfgnum)
 
static void SetInterface (USBDDriver *pDriver, uint8_t infnum, uint8_t setting)
 
static void TerminateCtrlInWithNull (void *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
 
void USBD_ConfigureEndpoint (const USBEndpointDescriptor *pDescriptor)
 
void USBD_Connect (void)
 
void USBD_Disconnect (void)
 
void USBD_ForceFullSpeed (void)
 
USBDDriverUSBD_GetDriver (void)
 
uint8_t USBD_GetState (void)
 
void USBD_Halt (uint8_t bEndpoint)
 
void USBD_Init (void)
 
uint8_t USBD_IsHalted (uint8_t bEndpoint)
 
uint8_t USBD_IsHighSpeed (void)
 
uint8_t USBD_Read (uint8_t bEndpoint, void *pData, uint32_t dLength, TransferCallback fCallback, void *pArgument)
 
void USBD_RemoteWakeUp (void)
 
void USBD_RequestHandler (uint8_t bEndpoint, const USBGenericRequest *pRequest)
 
void USBD_ResetHandler ()
 
void USBD_ResumeHandler (void)
 
void USBD_SetAddress (uint8_t address)
 
void USBD_SetConfiguration (uint8_t cfgnum)
 
uint8_t USBD_Stall (uint8_t bEndpoint)
 
void USBD_SuspendHandler (void)
 
void USBD_Test (uint8_t bIndex)
 
void USBD_Unhalt (uint8_t bEndpoint)
 
uint8_t USBD_Write (uint8_t bEndpoint, const void *pData, uint32_t dLength, TransferCallback fCallback, void *pArgument)
 
WEAK void USBDCallbacks_Initialized (void)
 
WEAK void USBDCallbacks_RequestReceived (const USBGenericRequest *request)
 
WEAK void USBDCallbacks_Reset (void)
 
WEAK void USBDCallbacks_Resumed (void)
 
WEAK void USBDCallbacks_Suspended (void)
 
void USBDDriver_clearOTGFeatures (USBDDriver *pDriver)
 
USBConfigurationDescriptor * USBDDriver_GetCfgDescriptors (USBDDriver *pDriver, uint8_t cfgNum)
 
void USBDDriver_Initialize (USBDDriver *pDriver, const USBDDriverDescriptors *pDescriptors, uint8_t *pInterfaces)
 
uint8_t USBDDriver_IsRemoteWakeUpEnabled (const USBDDriver *pDriver)
 
void USBDDriver_RequestHandler (USBDDriver *pDriver, const USBGenericRequest *pRequest)
 
uint8_t USBDDriver_returnOTGFeatures (const USBDDriver *pDriver)
 
static void USBDDriver_Test (const USBDDriver *pDriver, uint8_t test)
 
WEAK void USBDDriverCallbacks_ConfigurationChanged (uint8_t cfgnum)
 
WEAK void USBDDriverCallbacks_InterfaceSettingChanged (uint8_t interface, uint8_t setting)
 

Variables

static uint8_t deviceState
 
uint8_t ForceFS = 0
 
static uint8_t previousDeviceState
 
static USBDDriver usbdDriver
 

Detailed Description

Typedef Documentation

◆ MblTransferCallback

typedef void(* MblTransferCallback) (void *pArg, uint8_t status)

Callback used by MBL transfer functions (USBD_Read & USBD_Write) to notify that a transaction is complete.

Parameters
pArgPointer to callback arguments.
statusUSBD status.

Definition at line 211 of file USBD.h.

◆ TransferCallback

typedef void(* TransferCallback) (void *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)

Callback used by transfer functions (USBD_Read & USBD_Write) to notify that a transaction is complete.

Definition at line 200 of file USBD.h.

◆ USBDDriver

USB device driver structure, holding a list of descriptors identifying the device as well as the driver current state.

◆ USBDDriverDescriptors

List of all descriptors used by a USB device driver. Each descriptor can be provided in two versions: full-speed and high-speed. Devices which are not high-speed capable do not need to provided high-speed descriptors and the full-speed qualifier & other speed descriptors.

◆ USBDTransferBuffer

Buffer struct used for multi-buffer-listed transfer.

The driver can process 255 bytes of buffers or buffer list window.

Function Documentation

◆ __attribute__()

struct _USBDDmaDescriptor __attribute__ ( (aligned(16))  )

Struct used for USBD DMA Link List Transfer Descriptor, must be 16-bytes aligned.

(For USB, DMA transfer is linked to EPs and FIFO address is EP defined)

◆ GetConfiguration()

static void GetConfiguration ( const USBDDriver pDriver)
static

Sends the current configuration number to the host.

Parameters
pDriverPointer to a USBDDriver instance.

Definition at line 134 of file USBDDriver.c.

◆ GetDescriptor()

static void GetDescriptor ( const USBDDriver pDriver,
uint8_t  type,
uint8_t  indexRDesc,
uint32_t  length 
)
static

Sends the requested USB descriptor to the host if available, or STALLs the request.

Parameters
pDriverPointer to a USBDDriver instance.
typeType of the requested descriptor
indexIndex of the requested descriptor.
lengthMaximum number of bytes to return.

Definition at line 220 of file USBDDriver.c.

◆ GetDeviceStatus()

static void GetDeviceStatus ( const USBDDriver pDriver)
static

Sends the current status of the device to the host.

Parameters
pDriverPointer to a USBDDriver instance.

Definition at line 151 of file USBDDriver.c.

◆ GetEndpointStatus()

static void GetEndpointStatus ( uint8_t  bEndpoint)
static

Sends the current status of an endpoints to the USB host.

Parameters
bEndpointEndpoint number.

Definition at line 190 of file USBDDriver.c.

◆ GetInterface()

static void GetInterface ( const USBDDriver pDriver,
uint8_t  infnum 
)
static

Sends the currently active setting of the given interface to the USB host. If alternate settings are not supported, this function STALLs the control pipe.

Parameters
pDriverPointer to a USBDDriver instance.
infnumInterface number.

Definition at line 427 of file USBDDriver.c.

◆ SetConfiguration()

static void SetConfiguration ( USBDDriver pDriver,
uint8_t  cfgnum 
)
static

Configures the device by setting it into the Configured state and initializing all endpoints.

Parameters
pDriverPointer to a USBDDriver instance.
cfgnumConfiguration number to set.

Definition at line 81 of file USBDDriver.c.

◆ SetInterface()

static void SetInterface ( USBDDriver pDriver,
uint8_t  infnum,
uint8_t  setting 
)
static

Sets the active setting of the given interface if the configuration supports it; otherwise, the control pipe is STALLed. If the setting of an interface changes. pDriver Pointer to a USBDDriver instance. infnum Interface number. setting New active setting for the interface.

Definition at line 390 of file USBDDriver.c.

◆ TerminateCtrlInWithNull()

static void TerminateCtrlInWithNull ( void *  pArg,
uint8_t  status,
uint32_t  transferred,
uint32_t  remaining 
)
static

Send a NULL packet

Definition at line 61 of file USBDDriver.c.

◆ USBD_ConfigureEndpoint()

void USBD_ConfigureEndpoint ( const USBEndpointDescriptor *  pDescriptor)

Configures an endpoint according to its Endpoint Descriptor.

Parameters
pDescriptorPointer to an Endpoint descriptor.

Definition at line 165 of file USBD.c.

◆ USBD_Connect()

void USBD_Connect ( void  )

Connects the pull-up on the D+ line of the USB.

Definition at line 490 of file USBD.c.

◆ USBD_Disconnect()

void USBD_Disconnect ( void  )

Disconnects the pull-up from the D+ line of the USB.

Definition at line 499 of file USBD.c.

◆ USBD_ForceFullSpeed()

void USBD_ForceFullSpeed ( void  )

Definition at line 553 of file USBD.c.

◆ USBD_GetDriver()

USBDDriver * USBD_GetDriver ( void  )

Return USBDDriver instance pointer for global usage.

Definition at line 549 of file USBDDriver.c.

◆ USBD_GetState()

uint8_t USBD_GetState ( void  )

Returns the current state of the USB device.

Returns
Device current state.

Definition at line 538 of file USBD.c.

◆ USBD_Halt()

void USBD_Halt ( uint8_t  bEndpoint)

Sets the HALT feature on the given endpoint (if not already in this state).

Parameters
bEndpointEndpoint number.

Definition at line 388 of file USBD.c.

◆ USBD_Init()

void USBD_Init ( void  )

Initializes the USB driver.

Definition at line 518 of file USBD.c.

◆ USBD_IsHalted()

uint8_t USBD_IsHalted ( uint8_t  bEndpoint)

Returns the current Halt status of an endpoint.

Parameters
bEndpointIndex of endpoint
Returns
1 if the endpoint is currently halted; otherwise 0

Definition at line 407 of file USBD.c.

◆ USBD_IsHighSpeed()

uint8_t USBD_IsHighSpeed ( void  )

Indicates if the device is running in high or full-speed. Always returns 0 since UDP does not support high-speed mode.

Definition at line 416 of file USBD.c.

◆ USBD_Read()

uint8_t USBD_Read ( uint8_t  bEndpoint,
void *  pData,
uint32_t  dLength,
TransferCallback  fCallback,
void *  pArgument 
)

Reads incoming data on an USB endpoint This methods sets the transfer descriptor and activate the endpoint interrupt. The actual transfer is then carried out by the endpoint interrupt handler. The Read operation finishes either when the buffer is full, or a short packet (inferior to endpoint maximum size) is received.

The buffer must be kept allocated until the transfer is finished.

Parameters
bEndpointEndpoint number.
pDataPointer to a data buffer.
dLengthSize of the data buffer in bytes.
fCallbackOptional end-of-transfer callback function.
pArgumentOptional argument to the callback function.
Returns
USBD_STATUS_SUCCESS if the read operation has been started; otherwise, the corresponding error code.

Definition at line 318 of file USBD.c.

◆ USBD_RemoteWakeUp()

void USBD_RemoteWakeUp ( void  )

Starts a remote wake-up procedure.

Definition at line 475 of file USBD.c.

◆ USBD_RequestHandler()

void USBD_RequestHandler ( uint8_t  bEndpoint,
const USBGenericRequest pRequest 
)

Handle the USB setup package received, should be invoked when an endpoint got a setup package as request.

Parameters
bEndpointEndpoint number.
pRequestPointer to content of request.

Definition at line 147 of file USBD.c.

◆ USBD_ResetHandler()

void USBD_ResetHandler ( void  )

Handle the USB reset event, should be invoked whenever HW found USB reset signal on bus, which usually is called "end of bus reset" status.

Definition at line 126 of file USBD.c.

◆ USBD_ResumeHandler()

void USBD_ResumeHandler ( void  )

Handle the USB resume event, should be invoked whenever HW reports a resume signal.

Definition at line 105 of file USBD.c.

◆ USBD_SetAddress()

void USBD_SetAddress ( uint8_t  address)

Sets the device address to the given value.

Parameters
addressNew device address.

Definition at line 437 of file USBD.c.

◆ USBD_SetConfiguration()

void USBD_SetConfiguration ( uint8_t  cfgnum)

Sets the current device configuration.

Parameters
cfgnum- Configuration number to set.

Definition at line 453 of file USBD.c.

◆ USBD_Stall()

uint8_t USBD_Stall ( uint8_t  bEndpoint)

Causes the given endpoint to acknowledge the next packet it receives with a STALL handshake.

Parameters
bEndpointEndpoint number.
Returns
USBD_STATUS_SUCCESS or USBD_STATUS_LOCKED.

Definition at line 427 of file USBD.c.

◆ USBD_SuspendHandler()

void USBD_SuspendHandler ( void  )

Handle the USB suspend event, should be invoked whenever HW reports a suspend signal.

Definition at line 83 of file USBD.c.

◆ USBD_Test()

void USBD_Test ( uint8_t  bIndex)

Certification test for High Speed device.

Parameters
bIndexTest to be done

Definition at line 547 of file USBD.c.

◆ USBD_Unhalt()

void USBD_Unhalt ( uint8_t  bEndpoint)

Clears the Halt feature on the given endpoint.

Parameters
bEndpointIndex of endpoint

Definition at line 397 of file USBD.c.

◆ USBD_Write()

uint8_t USBD_Write ( uint8_t  bEndpoint,
const void *  pData,
uint32_t  dLength,
TransferCallback  fCallback,
void *  pArgument 
)

Sends data through a USB endpoint. Sets up the transfer descriptor, writes one or two data payloads (depending on the number of FIFO bank for the endpoint) and then starts the actual transfer. The operation is complete when all the data has been sent.

If the size of the buffer is greater than the size of the endpoint (or twice the size if the endpoint has two FIFO banks), then the buffer must be kept allocated until the transfer is finished. This means that it is not possible to declare it on the stack (i.e. as a local variable of a function which returns after starting a transfer).

Parameters
bEndpointEndpoint number.
pDataPointer to a buffer with the data to send.
dLengthSize of the data buffer.
fCallbackOptional callback function to invoke when the transfer is complete.
pArgumentOptional argument to the callback function.
Returns
USBD_STATUS_SUCCESS if the transfer has been started; otherwise, the corresponding error status code.

Definition at line 191 of file USBD.c.

◆ USBDCallbacks_Initialized()

WEAK void USBDCallbacks_Initialized ( void  )

Invoked after the USB driver has been initialized. By default, do nothing.

Definition at line 54 of file USBDCallbacks.c.

◆ USBDCallbacks_RequestReceived()

WEAK void USBDCallbacks_RequestReceived ( const USBGenericRequest request)

USBDCallbacks_RequestReceived - Invoked when a new SETUP request is received. Does nothing by default.

Parameters
requestPointer to the request to handle.

Definition at line 83 of file USBDCallbacks.c.

◆ USBDCallbacks_Reset()

WEAK void USBDCallbacks_Reset ( void  )

Invoked when the USB driver is reset. Does nothing by default.

Definition at line 62 of file USBDCallbacks.c.

◆ USBDCallbacks_Resumed()

WEAK void USBDCallbacks_Resumed ( void  )

Invoked when the USB device leaves the Suspended state. By default, Do nothing.

Definition at line 76 of file USBDCallbacks.c.

◆ USBDCallbacks_Suspended()

WEAK void USBDCallbacks_Suspended ( void  )

Invoked when the USB device gets suspended. By default, do nothing.

Definition at line 70 of file USBDCallbacks.c.

◆ USBDDriver_clearOTGFeatures()

void USBDDriver_clearOTGFeatures ( USBDDriver pDriver)

Clear OTG features supported

Parameters
pDriverPointer to an USBDDriver instance.
Returns
none

Definition at line 841 of file USBDDriver.c.

◆ USBDDriver_GetCfgDescriptors()

USBConfigurationDescriptor * USBDDriver_GetCfgDescriptors ( USBDDriver pDriver,
uint8_t  cfgNum 
)

Returns configuration descriptor list.

Parameters
pDriverPointer to a USBDDriver instance.
cfgNumReserved.

Definition at line 587 of file USBDDriver.c.

◆ USBDDriver_Initialize()

void USBDDriver_Initialize ( USBDDriver pDriver,
const USBDDriverDescriptors pDescriptors,
uint8_t *  pInterfaces 
)

Initializes a USBDDriver instance with a list of descriptors. If interfaces can have multiple alternate settings, an array to store the current setting for each interface must be provided.

Parameters
pDriverPointer to a USBDDriver instance.
pDescriptorsPointer to a USBDDriverDescriptors instance.
pInterfacesPointer to an array for storing the current alternate setting of each interface (optional).

Definition at line 563 of file USBDDriver.c.

◆ USBDDriver_IsRemoteWakeUpEnabled()

uint8_t USBDDriver_IsRemoteWakeUpEnabled ( const USBDDriver pDriver)

Test if RemoteWakeUP feature is enabled

Parameters
pDriverPointer to an USBDDriver instance.
Returns
1 if remote wake up has been enabled by the host; otherwise, returns 0

Definition at line 821 of file USBDDriver.c.

◆ USBDDriver_RequestHandler()

void USBDDriver_RequestHandler ( USBDDriver pDriver,
const USBGenericRequest pRequest 
)

Handles the given request if it is standard, otherwise STALLs it.

Parameters
pDriverPointer to a USBDDriver instance.
pRequestPointer to a USBGenericRequest instance.

Definition at line 609 of file USBDDriver.c.

◆ USBDDriver_returnOTGFeatures()

uint8_t USBDDriver_returnOTGFeatures ( const USBDDriver pDriver)

Return OTG features supported

Parameters
pDriverPointer to an USBDDriver instance.
Returns
the OTG features

Definition at line 831 of file USBDDriver.c.

◆ USBDDriver_Test()

static void USBDDriver_Test ( const USBDDriver pDriver,
uint8_t  test 
)
static

Performs the selected test on the USB device (high-speed only).

Parameters
testTest selector value.

Definition at line 448 of file USBDDriver.c.

◆ USBDDriverCallbacks_ConfigurationChanged()

void USBDDriverCallbacks_ConfigurationChanged ( uint8_t  cfgnum)

Indicates that the current configuration of the device has changed.

Parameters
cfgnumNew device configuration index.

Definition at line 65 of file USBDDriverCallbacks.c.

◆ USBDDriverCallbacks_InterfaceSettingChanged()

void USBDDriverCallbacks_InterfaceSettingChanged ( uint8_t  interface,
uint8_t  setting 
)

Notifies of a change in the currently active setting of an interface.

Parameters
interfaceNumber of the interface whose setting has changed.
settingNew interface setting.

Definition at line 76 of file USBDDriverCallbacks.c.

Variable Documentation

◆ deviceState

uint8_t deviceState
static

Device current state.

Definition at line 61 of file USBD.c.

◆ ForceFS

uint8_t ForceFS = 0

Definition at line 65 of file USBD.c.

◆ previousDeviceState

uint8_t previousDeviceState
static

Indicates the previous device state

Definition at line 63 of file USBD.c.

◆ usbdDriver

USBDDriver usbdDriver
static

Default device driver instance, for all class drivers in USB Lib.

Definition at line 52 of file USBDDriver.c.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:02