SAMV71 Xplained Ultra Software Package 1.5

USBHDriver.h File Reference

Common API for USB Host Drivers (UHD). More...

#include "USBDescriptors.h"
#include "USBRequests.h"
#include "board.h"

Go to the source code of this file.

Typedefs

typedef void(* uhd_callback_reset_t )(void)
 End of reset callback function type. Registered by uhd_send_reset() Callback called when reset event is completed.
typedef bool(* uhd_callback_setup_run_t )(uint8_t add, uint8_t **payload, uint16_t *payload_size)
 Data setup transfer callback function type. Registered by USBH_HAL_SetupReq() Called during DATA phase when the (payload) buffer is full or empty. Then the setup request is halted. A new buffer can be provided to continue the DATA phase or abort DATA phase.
typedef void(* uhd_callback_setup_end_t )(uint8_t add, USBH_XfrStatus_t status, uint16_t payload_trans)
 End of setup callback function type. Registered by USBH_HAL_SetupReq() Called when the setup request is completed.
typedef void(* uhd_callback_trans_t )(uint8_t add, uint8_t ep, USBH_XfrStatus_t status, uint32_t nb_transfered)
 End of transfer callback function type. Registered by USBH_HAL_RunEndpoint() Callback called by USB interrupt after data transfer or abort (reset,...).

Enumerations

enum  USBH_Speed_t { UHD_SPEED_LOW = 0, UHD_SPEED_FULL = 1, UHD_SPEED_HIGH = 2 }
 

Device speed.


enum  USBH_XfrStatus_t {
  UHD_TRANS_NOERROR = 0, UHD_TRANS_DISCONNECT, UHD_TRANS_CRC, UHD_TRANS_DT_MISMATCH,
  UHD_TRANS_STALL, UHD_TRANS_NOTRESPONDING, UHD_TRANS_PIDFAILURE, UHD_TRANS_TIMEOUT,
  UHD_TRANS_ABORTED
}
 

Endpoint transfer status The status field is updated after each transaction attempt, whether successful or not.

More...

Functions

void USBHS_SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize)
void USBHS_SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
void USBH_HAL_EnableUsbHost (void)
 Enables the USB host mode Start the ID pin management if the ID pin is available.
void USBH_HAL_DisableUsb (bool b_id_stop)
 Disables the USB host mode.
USBH_Speed_t USBH_HAL_GetSpeed (void)
 Returns the speed of connected device.
uint16_t USBH_HAL_GetFrameNum (void)
 Returns the current Start Of Frame (SOF) number.
uint16_t USBH_HAL_GetMicroFrameNum (void)
 Returns the current micro start of frame number.
void USBH_HAL_Reset (uhd_callback_reset_t callback)
 Enables the Reset state on the USB line.
void USBH_HAL_Suspend (void)
 Enables the suspend state on the USB line. The SUSPEND state is enable when SOF are disabled on USB line.
bool USBH_HAL_IsSuspended (void)
 Test if the suspend state is enabled on the USB line.
void USBH_HAL_Resume (void)
 Enables the IDLE state on the USB line. The IDLE state is enable when SOF are present on USB line. A Downstream Resume signal can be sent.
bool USBH_HAL_SetupReq (uint8_t add, USBGenericRequest *req, uint8_t *payload, uint16_t payload_size, uhd_callback_setup_run_t callback_run, uhd_callback_setup_end_t callback_end)
 Add a setup request in the control endpoint setup queue. Note: Request timeout is 5s.
Endpoint Management

The following functions allow drivers to create and remove endpoints, as well as set, clear and query their "halted" and "wedged" states.

bool USBH_HAL_ConfigureControlPipe (uint8_t add, uint16_t ep_size)
 Configures and enables a control endpoint 0.
bool USBH_HAL_ConfigurePipe (uint8_t add, USBEndpointDescriptor *ep_desc)
 Configures and enables an endpoint.
void USBH_HAL_FreePipe (uint8_t add, uint8_t endp)
 Disables an endpoint or all endpoint of a device.
bool USBH_HAL_RunEndpoint (uint8_t add, uint8_t endp, bool b_shortpacket, uint8_t *buf, uint32_t buf_size, uint16_t timeout, uhd_callback_trans_t callback)
 Allows to receive or send data on an endpoint.
void USBH_HAL_AbortEndPoint (uint8_t add, uint8_t endp)
 Aborts an on-going transfer on an endpoint.
UHC callbacks to provide for UHD

The following callbacks are used by UHD.

void USBH_start (void)
 Starts the host mode.
void USBH_stop (bool b_id_stop)
 Stops the host mode.
void USBH_notify_connection (bool b_plug)
 Notify device connection or disconnection.
void USBH_notify_sof (bool b_micro)
 Notify each start of frame sent by driver.
void USBH_notify_resume (void)
 Notify that a resume bus occurs A resume can occur after a downstream or an upstream resume.

Detailed Description

Common API for USB Host Drivers (UHD).

Definition in file USBHDriver.h.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines