SAMV71 Xplained Ultra Software Package 1.4

Implementation of UHC
[USB host Controller (UHC)]

Collaboration diagram for Implementation of UHC:

Internal variables to manage the USB host stack



typedef void(* USBH_sof_timeout_callback_t )(void)
 Type of callback on a SOF timeout.
uint8_t USBH_sof_timeout
 Number of SOF remaining before call USBH_sof_timeout_callback callback.
#define UHC_ENUM_NB_TRY   4
 Maximum try to enumerate a device.
#define UHC_USB_ADD_NOT_VALID   0xFF
 Entry point of all devices connected on USB tree.
#define UHC_DEVICE_ENUM_ADD   1
 USB address of the USB device under enumeration process.
#define USBH_dev_enum   (&USBH_device_root)
 Device under enumeration process.
#define USBH_power_running   0
 Total power of the devices connected.
#define UHC_NB_UHI   (sizeof(USBH_uhis)/sizeof(USBH_uhis[0]))
 Number of UHI available.

Callbacks used by USB Host Driver (UHD) to notify events



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.

Functions to control the USB host stack



void USBH_start (void)
 Starts the host mode.
void USBH_stop (bool b_id_stop)
 Stops the host mode.
void USBH_suspend (bool b_remotewakeup)
 Suspends a USB line.
bool USBH_is_suspend (void)
 Test if the suspend state is enabled on the USB line.
void USBH_resume (void)
 Resumes the USB line.

User functions to manage the devices



uint8_t USBH_get_device_number (void)
 Returns the number of connected devices.
char * USBH_dev_get_string_manufacturer (USBH_device_t *dev)
 Gets the USB string manufacturer from a USB device.
char * USBH_dev_get_string_product (USBH_device_t *dev)
 Gets the USB string product from a USB device.
char * USBH_dev_get_string_serial (USBH_device_t *dev)
 Gets the USB string serial from a USB device.
char * USBH_dev_get_string (USBH_device_t *dev, uint8_t str_id)
 Gets a USB string from a USB device.
uint16_t USBH_dev_get_power (USBH_device_t *dev)
 Gets the maximum consumption of a device (mA).
USBH_Speed_t USBH_dev_get_speed (USBH_device_t *dev)
 Returns the current device speed.
bool USBH_dev_is_high_speed_support (USBH_device_t *dev)
 Tests if the device supports the USB high speed This function can wait the end of a setup request and the timing can be long (1ms to 5s). Thus, do not call it in an interrupt routine.

Detailed Description

Internal implementation


Function Documentation

uint16_t USBH_dev_get_power ( USBH_device_t dev  ) 

Gets the maximum consumption of a device (mA).

Parameters:
dev Device to request
Returns:
Maximum consumption of the device (mA)

Definition at line 1212 of file USBH.c.

USBH_Speed_t USBH_dev_get_speed ( USBH_device_t dev  ) 

Returns the current device speed.

Parameters:
dev Device to request
Returns:
Device speed

Definition at line 1217 of file USBH.c.

char* USBH_dev_get_string ( USBH_device_t dev,
uint8_t  str_id 
)

Gets a USB string from a USB device.

This function waits the end of setup requests and the timing can be long (3ms to 15s). Thus, do not call it in an interrupt routine. This function allocates a buffer which must be free by user application.

Parameters:
dev Device to request
str_id String ID requested
Returns:
Pointer on unicode string, or NULL if function fails.

Definition at line 1147 of file USBH.c.

Here is the call graph for this function:

char* USBH_dev_get_string_manufacturer ( USBH_device_t dev  ) 

Gets the USB string manufacturer from a USB device.

This function waits the end of setup requests and the timing can be long (3ms to 15s). Thus, do not call it in an interrupt routine. This function allocates a buffer which must be free by user application.

Parameters:
dev Device to request
Returns:
Pointer on unicode string, or NULL if function fails.

Definition at line 1123 of file USBH.c.

Here is the call graph for this function:

char* USBH_dev_get_string_product ( USBH_device_t dev  ) 

Gets the USB string product from a USB device.

This function waits the end of setup requests and the timing can be long (3ms to 15s). Thus, do not call it in an interrupt routine. This function allocates a buffer which must be free by user application.

Parameters:
dev Device to request
Returns:
Pointer on unicode string, or NULL if function fails.

Definition at line 1131 of file USBH.c.

Here is the call graph for this function:

char* USBH_dev_get_string_serial ( USBH_device_t dev  ) 

Gets the USB string serial from a USB device.

This function waits the end of setup requests and the timing can be long (3ms to 15s). Thus, do not call it in an interrupt routine. This function allocates a buffer which must be free by user application.

Parameters:
dev Device to request
Returns:
Pointer on unicode string, or NULL if function fails.

Definition at line 1139 of file USBH.c.

Here is the call graph for this function:

bool USBH_dev_is_high_speed_support ( USBH_device_t dev  ) 

Tests if the device supports the USB high speed This function can wait the end of a setup request and the timing can be long (1ms to 5s). Thus, do not call it in an interrupt routine.

Parameters:
dev Device to request
Returns:
True, if high speed is supported

Definition at line 1222 of file USBH.c.

Here is the call graph for this function:

uint8_t USBH_get_device_number ( void   ) 

Returns the number of connected devices.

Returns:
Number of device connected on USB tree

Definition at line 1102 of file USBH.c.

bool USBH_is_suspend ( void   ) 

Test if the suspend state is enabled on the USB line.

Returns:
USB line in SUSPEND state or device not connected, if true

Definition at line 1058 of file USBH.c.

Here is the call graph for this function:

void USBH_notify_connection ( bool  b_plug  ) 

Notify device connection or disconnection.

Parameters:
b_plug Device connection, if true

Definition at line 971 of file USBH.c.

void USBH_notify_sof ( bool  b_micro  ) 

Notify each start of frame sent by driver.

Parameters:
b_micro It is a micro start of frame, if true

Definition at line 990 of file USBH.c.

void USBH_stop ( bool  b_id_stop  ) 

Stops the host mode.

Parameters:
b_id_stop Stop USB ID pin management, if true.

Definition at line 1038 of file USBH.c.

Here is the call graph for this function:

void USBH_suspend ( bool  b_remotewakeup  ) 

Suspends a USB line.

Parameters:
b_remotewakeup Authorize the remote wakeup features, if true

Definition at line 1044 of file USBH.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines