SAMV71 Xplained Ultra Software Package 1.5

Usbd_interface
[USB Stack Device]

Collaboration diagram for Usbd_interface:

Data Structures

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

Modules

 USB device API return codes
 USB device states

Typedefs

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

Functions

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

Variables

uint8_t ForceFS = 0

Typedef Documentation

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:
pArg Pointer to callback arguments.
status USBD status.

Definition at line 209 of file USBD.h.

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 198 of file USBD.h.


Function Documentation

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)

void USBD_ConfigureEndpoint ( const USBEndpointDescriptor *  pDescriptor  ) 

Configures an endpoint according to its Endpoint Descriptor.

Parameters:
pDescriptor Pointer to an Endpoint descriptor.

Definition at line 165 of file USBD.c.

Here is the call graph for this function:

void USBD_Connect ( void   ) 

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

Definition at line 490 of file USBD.c.

Here is the call graph for this function:

void USBD_Disconnect ( void   ) 

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

Definition at line 499 of file USBD.c.

Here is the call graph for this function:

USBDDriver * USBD_GetDriver ( void   ) 

Return USBDDriver instance pointer for global usage.

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.

void USBD_Halt ( uint8_t  bEndpoint  ) 

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

Parameters:
bEndpoint Endpoint number.

Definition at line 388 of file USBD.c.

Here is the call graph for this function:

void USBD_Init ( void   ) 

Initializes the USB driver.

Definition at line 518 of file USBD.c.

Here is the call graph for this function:

uint8_t USBD_IsHalted ( uint8_t  bEndpoint  ) 

Returns the current Halt status of an endpoint.

Parameters:
bEndpoint Index of endpoint
Returns:
1 if the endpoint is currently halted; otherwise 0

Definition at line 407 of file USBD.c.

Here is the call graph for this function:

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.

Here is the call graph for this function:

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:
bEndpoint Endpoint number.
pData Pointer to a data buffer.
dLength Size of the data buffer in bytes.
fCallback Optional end-of-transfer callback function.
pArgument Optional 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.

Here is the call graph for this function:

void USBD_RemoteWakeUp ( void   ) 

Starts a remote wake-up procedure.

Definition at line 475 of file USBD.c.

Here is the call graph for this function:

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:
bEndpoint Endpoint number.
pRequest Pointer to content of request.

Definition at line 147 of file USBD.c.

Here is the call graph for this function:

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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

void USBD_SetAddress ( uint8_t  address  ) 

Sets the device address to the given value.

Parameters:
address New device address.

Definition at line 437 of file USBD.c.

Here is the call graph for this function:

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.

Here is the call graph for this function:

uint8_t USBD_Stall ( uint8_t  bEndpoint  ) 

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

Parameters:
bEndpoint Endpoint number.
Returns:
USBD_STATUS_SUCCESS or USBD_STATUS_LOCKED.

Definition at line 427 of file USBD.c.

Here is the call graph for this function:

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.

Here is the call graph for this function:

void USBD_Test ( uint8_t  bIndex  ) 

Certification test for High Speed device.

Parameters:
bIndex Test to be done

Definition at line 547 of file USBD.c.

Here is the call graph for this function:

void USBD_Unhalt ( uint8_t  bEndpoint  ) 

Clears the Halt feature on the given endpoint.

Parameters:
bEndpoint Index of endpoint

Definition at line 397 of file USBD.c.

Here is the call graph for this function:

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:
bEndpoint Endpoint number.
pData Pointer to a buffer with the data to send.
dLength Size of the data buffer.
fCallback Optional callback function to invoke when the transfer is complete.
pArgument Optional 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.

Here is the call graph for this function:

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.

WEAK void USBDCallbacks_RequestReceived ( const USBGenericRequest request  ) 

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

Parameters:
request Pointer to the request to handle.

Definition at line 83 of file USBDCallbacks.c.

Here is the call graph for this function:

WEAK void USBDCallbacks_Reset ( void   ) 

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

Definition at line 62 of file USBDCallbacks.c.

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.

WEAK void USBDCallbacks_Suspended ( void   ) 

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

Definition at line 70 of file USBDCallbacks.c.

void USBDDriver_clearOTGFeatures ( USBDDriver pDriver  ) 

Clear OTG features supported

Parameters:
pDriver Pointer to an USBDDriver instance.
Returns:
none
USBConfigurationDescriptor * USBDDriver_GetCfgDescriptors ( USBDDriver pDriver,
uint8_t  cfgNum 
)

Returns configuration descriptor list.

Parameters:
pDriver Pointer to a USBDDriver instance.
cfgNum Reserved.
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:
pDriver Pointer to a USBDDriver instance.
pDescriptors Pointer to a USBDDriverDescriptors instance.
pInterfaces Pointer to an array for storing the current alternate setting of each interface (optional).
uint8_t USBDDriver_IsRemoteWakeUpEnabled ( const USBDDriver pDriver  ) 

Test if RemoteWakeUP feature is enabled

Parameters:
pDriver Pointer to an USBDDriver instance.
Returns:
1 if remote wake up has been enabled by the host; otherwise, returns 0
void USBDDriver_RequestHandler ( USBDDriver pDriver,
const USBGenericRequest pRequest 
)

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

Parameters:
pDriver Pointer to a USBDDriver instance.
pRequest Pointer to a USBGenericRequest instance.
uint8_t USBDDriver_returnOTGFeatures ( const USBDDriver pDriver  ) 

Return OTG features supported

Parameters:
pDriver Pointer to an USBDDriver instance.
Returns:
the OTG features
WEAK void USBDDriverCallbacks_ConfigurationChanged ( uint8_t  cfgnum  ) 

Indicates that the current configuration of the device has changed.

Parameters:
cfgnum New device configuration index.
WEAK void USBDDriverCallbacks_InterfaceSettingChanged ( uint8_t  interface,
uint8_t  setting 
)

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

Parameters:
interface Number of the interface whose setting has changed.
setting New interface setting.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines