Internal implementation.
Functions | |
static void | uhc_remotewakeup (bool b_enable) |
Enables or disables the remote wakeup feature of all devices connected. More... | |
static void | uhc_request_bos_desc (uint16_t length, const uhd_callback_setup_end_t callback) |
Requests the USB structure of the USB BOS descriptor. More... | |
static void | uhc_setup_request_callback (usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans) |
Callback used to signal the end of a setup request. More... | |
Internal variables to manage the USB host stack | |
typedef void(* | uhc_sof_timeout_callback_t )(void) |
Type of callback on a SOF timeout. More... | |
static uhc_device_t | g_uhc_device_root |
Entry point of all devices connected on USB tree. More... | |
static uint8_t | uhc_enum_try |
Number of enumeration try. More... | |
static uhc_sof_timeout_callback_t | uhc_sof_timeout_callback |
Callback currently registered on a SOF timeout. More... | |
uint8_t | uhc_sof_timeout |
Number of SOF remaining before call uhc_sof_timeout_callback callback. More... | |
static uhi_api_t | uhc_uhis [] = {USB_HOST_UHI} |
Array of all UHI available. More... | |
static volatile bool | uhc_setup_request_finish |
Volatile flag to pool the end of Get USB string setup request. More... | |
static volatile bool | uhc_setup_request_finish_status |
Volatile flag to know the status of Get USB string setup request. More... | |
#define | UHC_ENUM_NB_TRY 4 |
Maximum try to enumerate a device. More... | |
#define | UHC_USB_ADD_NOT_VALID 0xFF |
Entry point of all devices connected on USB tree. More... | |
#define | UHC_DEVICE_ENUM_ADD 1 |
USB address of the USB device under enumeration process. More... | |
#define | uhc_dev_enum (&g_uhc_device_root) |
Device under enumeration process. More... | |
#define | uhc_power_running 0 |
Total power of the devices connected. More... | |
#define | UHC_NB_UHI (sizeof(uhc_uhis)/sizeof(uhc_uhis[0])) |
Number of UHI available. More... | |
Internal functions to manage the USB device enumeration | |
static void | uhc_enable_timeout_callback (uint8_t timeout, uhc_sof_timeout_callback_t callback) |
Enable a internal timeout on SOF events. More... | |
static void | uhc_enumeration_suspend (void) |
Enters a specific device in USB suspend mode Suspend the USB line or a port on USB hub. More... | |
static void | uhc_enumeration_reset (uhd_callback_reset_t callback) |
Sends the USB Reset signal on the USB line of a device. More... | |
static void | uhc_connection_tree (bool b_plug, uhc_device_t *dev) |
Manage a device plug or unplug on the USB tree. More... | |
static void | uhc_enumeration_step1 (void) |
Device enumeration step 1 Reset USB line. More... | |
static void | uhc_enumeration_step2 (void) |
Device enumeration step 2 Lets USB line in IDLE state during 20ms. More... | |
static void | uhc_enumeration_step3 (void) |
Device enumeration step 3 Reset USB line. More... | |
static void | uhc_enumeration_step4 (void) |
Device enumeration step 4 Lets USB line in IDLE state during 100ms. More... | |
static void | uhc_enumeration_step5 (void) |
Device enumeration step 5 Requests the USB device descriptor. More... | |
static void | uhc_enumeration_step6 (usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans) |
Device enumeration step 6 End of Get device descriptor request. More... | |
static void | uhc_enumeration_step7 (void) |
Device enumeration step 7 Reset USB line. More... | |
static void | uhc_enumeration_step8 (void) |
Device enumeration step 8 Lets USB line in IDLE state during 100ms. More... | |
static void | uhc_enumeration_step9 (void) |
Device enumeration step 9 Send a Set address setup request. More... | |
static void | uhc_enumeration_step10 (usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans) |
Device enumeration step 10 End of Set address request. More... | |
static void | uhc_enumeration_step11 (void) |
Device enumeration step 11 Updates USB host pipe with the new USB address. More... | |
static void | uhc_enumeration_step12 (usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans) |
Device enumeration step 12 Requests the first USB structure of the USB configuration descriptor. More... | |
static void | uhc_enumeration_step13 (usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans) |
Device enumeration step 13 Requests a complete Get configuration descriptor. More... | |
static void | uhc_enumeration_step14 (usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans) |
Device enumeration step 14 Enable USB configuration, if unless one USB interface is supported by UHIs. More... | |
static void | uhc_enumeration_step15 (usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans) |
Device enumeration step 15 Enables UHI interfaces. More... | |
static void | uhc_enumeration_step16_lpm (void) |
Device enumeration step 16 (LPM only) Requests first part of the USB BOS descriptor. More... | |
static void | uhc_enumeration_step17_lpm (usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans) |
Device enumeration step 17 (LPM only) Check LPM support through the BOS descriptor received and request the whole BOS descriptor. More... | |
static void | uhc_enumeration_step18_lpm (usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans) |
Device enumeration step 18 (LPM only) Check LPM support through the BOS descriptor received. More... | |
static void | uhc_enumeration_error (uhc_enum_status_t status) |
Manage error during device enumeration. More... | |
Callbacks used by USB Host Driver (UHD) to notify events | |
void | uhc_notify_connection (bool b_plug) |
Notify device connection or disconnection. More... | |
void | uhc_notify_sof (bool b_micro) |
Notify each start of frame sent by driver. More... | |
void | uhc_notify_resume (void) |
Notify that a resume bus occurs A resume can occur after a downstream or an upstream resume. More... | |
void | uhc_notify_resume_lpm (void) |
Notify that a resume bus occurs after a L1 state A resume can occur after a downstream or an upstream resume. More... | |
Functions to control the USB host stack | |
void | uhc_start (void) |
Starts the host mode. More... | |
void | uhc_stop (bool b_id_stop) |
Stops the host mode. More... | |
void | uhc_suspend (bool b_remotewakeup) |
Suspends a USB line. More... | |
bool | uhc_is_suspend (void) |
Test if the suspend state is enabled on the USB line. More... | |
void | uhc_resume (void) |
Resumes the USB line. More... | |
bool | uhc_suspend_lpm (bool b_remotewakeup, uint8_t hird) |
Suspends a USB line through LPM feature. More... | |
User functions to manage the devices | |
uint8_t | uhc_get_device_number (void) |
Returns the number of connected devices. More... | |
char * | uhc_dev_get_string_manufacturer (uhc_device_t *dev) |
Gets the USB string manufacturer from a USB device. More... | |
char * | uhc_dev_get_string_product (uhc_device_t *dev) |
Gets the USB string product from a USB device. More... | |
char * | uhc_dev_get_string_serial (uhc_device_t *dev) |
Gets the USB string serial from a USB device. More... | |
char * | uhc_dev_get_string (uhc_device_t *dev, uint8_t str_id) |
Gets a USB string from a USB device. More... | |
uint16_t | uhc_dev_get_power (uhc_device_t *dev) |
Gets the maximum consumption of a device (mA) More... | |
uhd_speed_t | uhc_dev_get_speed (uhc_device_t *dev) |
Returns the current device speed. More... | |
bool | uhc_dev_is_high_speed_support (uhc_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). More... | |
void | uhc_dev_reset (uhc_device_t *dev) |
Reset to re-enumerate. More... | |
#define uhc_dev_enum (&g_uhc_device_root) |
Device under enumeration process.
Referenced by uhc_enumeration_step13().
#define UHC_DEVICE_ENUM_ADD 1 |
USB address of the USB device under enumeration process.
Referenced by uhc_enumeration_step11(), uhc_enumeration_step12(), uhc_enumeration_step13(), uhc_enumeration_step14(), uhc_enumeration_step9(), and uhc_request_bos_desc().
#define UHC_ENUM_NB_TRY 4 |
Maximum try to enumerate a device.
Referenced by uhc_enumeration_error().
Number of UHI available.
Referenced by uhc_connection_tree(), uhc_dev_reset(), uhc_enumeration_step14(), uhc_enumeration_step15(), and uhc_notify_sof().
#define uhc_power_running 0 |
Total power of the devices connected.
Referenced by uhc_connection_tree(), uhc_enumeration_step13(), and uhc_notify_connection().
#define UHC_USB_ADD_NOT_VALID 0xFF |
Entry point of all devices connected on USB tree.
Referenced by uhc_connection_tree(), uhc_get_device_number(), uhc_is_suspend(), uhc_notify_connection(), and uhc_start().
typedef void(* uhc_sof_timeout_callback_t)(void) |
Type of callback on a SOF timeout.
|
static |
Manage a device plug or unplug on the USB tree.
b_plug | true, if it is a device connection |
dev | Information about device connected or disconnected |
References uhc_device_t::address, uhc_device_t::conf_desc, dev, UHC_CONNECTION_EVENT, uhc_enum_try, uhc_enumeration_step1(), UHC_NB_UHI, uhc_power_running, uhc_sof_timeout, UHC_USB_ADD_NOT_VALID, uhd_ep_free(), and uhi_api_t::uninstall.
Referenced by uhc_notify_connection().
uint16_t uhc_dev_get_power | ( | uhc_device_t * | dev | ) |
Gets the maximum consumption of a device (mA)
dev | Device to request |
References usb_conf_desc_t::bMaxPower, and uhc_device_t::conf_desc.
uhd_speed_t uhc_dev_get_speed | ( | uhc_device_t * | dev | ) |
Returns the current device speed.
dev | Device to request |
References uhc_device_t::speed.
char* uhc_dev_get_string | ( | uhc_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.
dev | Device to request |
str_id | String ID requested |
References usb_str_desc_t::bLength, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, le16_to_cpu, usb_str_lgid_desc_t::string, uhc_setup_request_callback(), uhc_setup_request_finish, uhc_setup_request_finish_status, uhd_setup_request(), UNUSED, USB_DT_STRING, USB_REQ_DIR_IN, USB_REQ_GET_DESCRIPTOR, USB_REQ_RECIP_DEVICE, USB_REQ_TYPE_STANDARD, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
Referenced by uhc_dev_get_string_manufacturer(), uhc_dev_get_string_product(), and uhc_dev_get_string_serial().
char* uhc_dev_get_string_manufacturer | ( | uhc_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.
dev | Device to request |
References uhc_device_t::dev_desc, usb_dev_desc_t::iManufacturer, and uhc_dev_get_string().
char* uhc_dev_get_string_product | ( | uhc_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.
dev | Device to request |
References uhc_device_t::dev_desc, usb_dev_desc_t::iProduct, and uhc_dev_get_string().
char* uhc_dev_get_string_serial | ( | uhc_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.
dev | Device to request |
References uhc_device_t::dev_desc, usb_dev_desc_t::iSerialNumber, and uhc_dev_get_string().
bool uhc_dev_is_high_speed_support | ( | uhc_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.
dev | Device to request |
References usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhc_device_t::speed, uhc_setup_request_callback(), uhc_setup_request_finish, uhc_setup_request_finish_status, uhd_setup_request(), UHD_SPEED_FULL, UHD_SPEED_HIGH, USB_DT_DEVICE_QUALIFIER, USB_REQ_DIR_IN, USB_REQ_GET_DESCRIPTOR, USB_REQ_RECIP_DEVICE, USB_REQ_TYPE_STANDARD, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
void uhc_dev_reset | ( | uhc_device_t * | dev | ) |
Reset to re-enumerate.
dev | Device to request |
References uhc_device_t::conf_desc, dev, uhc_enum_try, uhc_enumeration_step3(), UHC_NB_UHI, and uhi_api_t::uninstall.
|
static |
Enable a internal timeout on SOF events.
timeout | value of timeout (ms) |
callback | Callback to call at the end of timeout |
References uhc_sof_timeout, and uhc_sof_timeout_callback.
Referenced by uhc_enumeration_step10(), uhc_enumeration_step2(), uhc_enumeration_step4(), uhc_enumeration_step6(), and uhc_enumeration_step8().
|
static |
Manage error during device enumeration.
status | Enumeration error occurred |
References uhc_device_t::address, uhc_device_t::conf_desc, UHC_ENUM_DISCONNECT, UHC_ENUM_EVENT, UHC_ENUM_NB_TRY, uhc_enum_try, uhc_enumeration_step1(), uhc_enumeration_suspend(), and uhd_ep_free().
Referenced by uhc_enumeration_step10(), uhc_enumeration_step11(), uhc_enumeration_step12(), uhc_enumeration_step13(), uhc_enumeration_step14(), uhc_enumeration_step15(), uhc_enumeration_step17_lpm(), uhc_enumeration_step18_lpm(), uhc_enumeration_step5(), uhc_enumeration_step6(), uhc_enumeration_step9(), and uhc_request_bos_desc().
|
static |
Sends the USB Reset signal on the USB line of a device.
callback | Callback to call at the end of Reset signal |
References uhd_send_reset().
Referenced by uhc_enumeration_step1(), uhc_enumeration_step3(), and uhc_enumeration_step7().
|
static |
Device enumeration step 1 Reset USB line.
References uhc_enumeration_reset(), and uhc_enumeration_step2().
Referenced by uhc_connection_tree(), and uhc_enumeration_error().
|
static |
Device enumeration step 10 End of Set address request.
Lets USB line in IDLE state during 20ms.
add | USB address of the setup request |
status | Transfer status |
payload_trans | Number of data transfered during DATA phase |
References uhc_enable_timeout_callback(), UHC_ENUM_DISCONNECT, UHC_ENUM_FAIL, uhc_enumeration_error(), uhc_enumeration_step11(), UHD_TRANS_DISCONNECT, UHD_TRANS_NOERROR, and UNUSED.
Referenced by uhc_enumeration_step9().
|
static |
Device enumeration step 11 Updates USB host pipe with the new USB address.
Requests a complete USB device descriptor.
References usb_dev_desc_t::bMaxPacketSize0, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhc_device_t::dev_desc, UHC_DEVICE_ENUM_ADD, UHC_ENUM_HARDWARE_LIMIT, UHC_ENUM_MEMORY_LIMIT, uhc_enumeration_error(), uhc_enumeration_step12(), uhd_ep0_alloc(), uhd_ep_free(), uhd_setup_request(), USB_DT_DEVICE, USB_REQ_DIR_IN, USB_REQ_GET_DESCRIPTOR, USB_REQ_RECIP_DEVICE, USB_REQ_TYPE_STANDARD, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
Referenced by uhc_enumeration_step10().
|
static |
Device enumeration step 12 Requests the first USB structure of the USB configuration descriptor.
add | USB address of the setup request |
status | Transfer status |
payload_trans | Number of data transfered during DATA phase |
References Assert, usb_dev_desc_t::bDescriptorType, usb_setup_req_t::bmRequestType, usb_dev_desc_t::bNumConfigurations, usb_setup_req_t::bRequest, uhc_device_t::conf_desc, uhc_device_t::dev_desc, UHC_DEVICE_CONF, UHC_DEVICE_ENUM_ADD, UHC_ENUM_DISCONNECT, UHC_ENUM_FAIL, UHC_ENUM_MEMORY_LIMIT, uhc_enumeration_error(), uhc_enumeration_step13(), uhd_setup_request(), UHD_TRANS_DISCONNECT, UHD_TRANS_NOERROR, UNUSED, USB_DT_CONFIGURATION, USB_DT_DEVICE, USB_REQ_DIR_IN, USB_REQ_GET_DESCRIPTOR, USB_REQ_RECIP_DEVICE, USB_REQ_TYPE_STANDARD, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
Referenced by uhc_enumeration_step11().
|
static |
Device enumeration step 13 Requests a complete Get configuration descriptor.
add | USB address of the setup request |
status | Transfer status |
payload_trans | Number of data transfered during DATA phase |
References Assert, usb_conf_desc_t::bConfigurationValue, usb_conf_desc_t::bDescriptorType, usb_conf_desc_t::bmAttributes, usb_conf_desc_t::bMaxPower, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhc_device_t::conf_desc, dev, le16_to_cpu, uhc_dev_enum, UHC_DEVICE_ENUM_ADD, UHC_ENUM_DISCONNECT, UHC_ENUM_EVENT, UHC_ENUM_FAIL, UHC_ENUM_MEMORY_LIMIT, UHC_ENUM_OVERCURRENT, uhc_enumeration_error(), uhc_enumeration_step14(), uhc_enumeration_suspend(), uhc_power_running, uhd_setup_request(), UHD_TRANS_DISCONNECT, UHD_TRANS_NOERROR, UNUSED, USB_CONFIG_ATTR_SELF_POWERED, USB_DT_CONFIGURATION, USB_HOST_POWER_MAX, USB_REQ_DIR_IN, USB_REQ_GET_DESCRIPTOR, USB_REQ_RECIP_DEVICE, USB_REQ_TYPE_STANDARD, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, usb_conf_desc_t::wTotalLength, and usb_setup_req_t::wValue.
Referenced by uhc_enumeration_step12().
|
static |
Device enumeration step 14 Enable USB configuration, if unless one USB interface is supported by UHIs.
add | USB address of the setup request |
status | Transfer status |
payload_trans | Number of data transfered during DATA phase |
References usb_conf_desc_t::bConfigurationValue, usb_conf_desc_t::bDescriptorType, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhc_device_t::conf_desc, le16_to_cpu, UHC_DEVICE_ENUM_ADD, UHC_ENUM_DISCONNECT, UHC_ENUM_EVENT, UHC_ENUM_FAIL, UHC_ENUM_HARDWARE_LIMIT, UHC_ENUM_MEMORY_LIMIT, UHC_ENUM_SUCCESS, UHC_ENUM_UNSUPPORTED, uhc_enumeration_error(), uhc_enumeration_step15(), uhc_enumeration_suspend(), UHC_NB_UHI, uhd_ep_free(), uhd_setup_request(), UHD_TRANS_DISCONNECT, UHD_TRANS_NOERROR, UNUSED, USB_DT_CONFIGURATION, USB_REQ_DIR_OUT, USB_REQ_RECIP_DEVICE, USB_REQ_SET_CONFIGURATION, USB_REQ_TYPE_STANDARD, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, usb_conf_desc_t::wTotalLength, and usb_setup_req_t::wValue.
Referenced by uhc_enumeration_step13().
|
static |
Device enumeration step 15 Enables UHI interfaces.
add | USB address of the setup request |
status | Transfer status |
payload_trans | Number of data transfered during DATA phase |
References usb_dev_desc_t::bcdUSB, uhc_device_t::dev_desc, uhi_api_t::enable, LE16, uhc_device_t::lpm_desc, UHC_ENUM_DISCONNECT, UHC_ENUM_EVENT, UHC_ENUM_FAIL, UHC_ENUM_SUCCESS, uhc_enum_try, uhc_enumeration_error(), uhc_enumeration_step16_lpm(), UHC_NB_UHI, UHD_TRANS_DISCONNECT, UHD_TRANS_NOERROR, uhi_api_t::uninstall, UNUSED, and USB_V2_1.
Referenced by uhc_enumeration_step14().
|
static |
Device enumeration step 16 (LPM only) Requests first part of the USB BOS descriptor.
References uhc_enumeration_step17_lpm(), and uhc_request_bos_desc().
Referenced by uhc_enumeration_step15().
|
static |
Device enumeration step 17 (LPM only) Check LPM support through the BOS descriptor received and request the whole BOS descriptor.
add | USB address of the setup request |
status | Transfer status |
payload_trans | Number of data transfered during DATA phase |
References usb_dev_bos_desc_t::bDescriptorType, usb_dev_lpm_desc_t::bos, le16_to_cpu, uhc_device_t::lpm_desc, UHC_ENUM_DISCONNECT, UHC_ENUM_EVENT, UHC_ENUM_FAIL, UHC_ENUM_SUCCESS, uhc_enum_try, uhc_enumeration_error(), uhc_enumeration_step18_lpm(), uhc_request_bos_desc(), UHD_TRANS_DISCONNECT, UHD_TRANS_NOERROR, UHD_TRANS_STALL, UNUSED, USB_DT_BOS, and usb_dev_bos_desc_t::wTotalLength.
Referenced by uhc_enumeration_step16_lpm().
|
static |
Device enumeration step 18 (LPM only) Check LPM support through the BOS descriptor received.
add | USB address of the setup request |
status | Transfer status |
payload_trans | Number of data transfered during DATA phase |
References usb_dev_bos_desc_t::bDescriptorType, usb_dev_bos_desc_t::bNumDeviceCaps, usb_dev_lpm_desc_t::bos, le16_to_cpu, uhc_device_t::lpm_desc, UHC_ENUM_DISCONNECT, UHC_ENUM_EVENT, UHC_ENUM_FAIL, UHC_ENUM_SUCCESS, uhc_enum_try, uhc_enumeration_error(), UHD_TRANS_DISCONNECT, UHD_TRANS_NOERROR, UHD_TRANS_STALL, UNUSED, USB_DC_EXT_LPM, USB_DC_USB20_EXTENSION, USB_DT_BOS, USB_DT_DEVICE_CAPABILITY, and usb_dev_bos_desc_t::wTotalLength.
Referenced by uhc_enumeration_step17_lpm().
|
static |
Device enumeration step 2 Lets USB line in IDLE state during 20ms.
References uhc_enable_timeout_callback(), and uhc_enumeration_step3().
Referenced by uhc_enumeration_step1().
|
static |
Device enumeration step 3 Reset USB line.
References uhc_enumeration_reset(), and uhc_enumeration_step4().
Referenced by uhc_dev_reset(), and uhc_enumeration_step2().
|
static |
Device enumeration step 4 Lets USB line in IDLE state during 100ms.
References uhc_device_t::speed, uhc_enable_timeout_callback(), uhc_enumeration_step5(), and uhd_get_speed().
Referenced by uhc_enumeration_step3().
|
static |
Device enumeration step 5 Requests the USB device descriptor.
This setup request can be aborted because the control endpoint size is unknown.
References usb_dev_desc_t::bMaxPacketSize0, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhc_device_t::dev_desc, UHC_ENUM_HARDWARE_LIMIT, UHC_ENUM_MEMORY_LIMIT, uhc_enumeration_error(), uhc_enumeration_step6(), uhd_ep0_alloc(), uhd_ep_free(), uhd_setup_request(), USB_DT_DEVICE, USB_REQ_DIR_IN, USB_REQ_GET_DESCRIPTOR, USB_REQ_RECIP_DEVICE, USB_REQ_TYPE_STANDARD, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
Referenced by uhc_enumeration_step4().
|
static |
Device enumeration step 6 End of Get device descriptor request.
Wait 20ms in IDLE state.
add | USB address of the setup request |
status | Transfer status |
payload_trans | Number of data transfered during DATA phase |
References usb_dev_desc_t::bDescriptorType, uhc_device_t::dev_desc, uhc_enable_timeout_callback(), UHC_ENUM_DISCONNECT, UHC_ENUM_FAIL, uhc_enumeration_error(), uhc_enumeration_step7(), UHD_TRANS_DISCONNECT, UHD_TRANS_NOERROR, UNUSED, and USB_DT_DEVICE.
Referenced by uhc_enumeration_step5().
|
static |
Device enumeration step 7 Reset USB line.
References uhc_enumeration_reset(), and uhc_enumeration_step8().
Referenced by uhc_enumeration_step6().
|
static |
Device enumeration step 8 Lets USB line in IDLE state during 100ms.
References uhc_enable_timeout_callback(), and uhc_enumeration_step9().
Referenced by uhc_enumeration_step7().
|
static |
Device enumeration step 9 Send a Set address setup request.
References uhc_device_t::address, usb_dev_desc_t::bMaxPacketSize0, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, dev, uhc_device_t::dev_desc, g_uhc_device_root, UHC_DEVICE_ENUM_ADD, UHC_ENUM_HARDWARE_LIMIT, UHC_ENUM_MEMORY_LIMIT, uhc_enumeration_error(), uhc_enumeration_step10(), uhd_ep0_alloc(), uhd_ep_free(), uhd_setup_request(), USB_REQ_DIR_OUT, USB_REQ_RECIP_DEVICE, USB_REQ_SET_ADDRESS, USB_REQ_TYPE_STANDARD, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
Referenced by uhc_enumeration_step8().
|
static |
Enters a specific device in USB suspend mode Suspend the USB line or a port on USB hub.
References uhd_suspend().
Referenced by uhc_enumeration_error(), uhc_enumeration_step13(), and uhc_enumeration_step14().
uint8_t uhc_get_device_number | ( | void | ) |
Returns the number of connected devices.
References uhc_device_t::address, dev, g_uhc_device_root, and UHC_USB_ADD_NOT_VALID.
bool uhc_is_suspend | ( | void | ) |
Test if the suspend state is enabled on the USB line.
References uhc_device_t::address, UHC_USB_ADD_NOT_VALID, and uhd_is_suspend().
Referenced by uhc_resume().
void uhc_notify_connection | ( | bool | b_plug | ) |
Notify device connection or disconnection.
b_plug | Device connection, if true |
References uhc_device_t::address, Assert, uhc_connection_tree(), uhc_power_running, and UHC_USB_ADD_NOT_VALID.
Referenced by _uhd_connect(), _uhd_disconnect(), and uhd_disable().
void uhc_notify_resume | ( | void | ) |
Notify that a resume bus occurs A resume can occur after a downstream or an upstream resume.
References uhc_remotewakeup(), and UHC_WAKEUP_EVENT.
Referenced by _uhd_sof_interrupt().
void uhc_notify_resume_lpm | ( | void | ) |
Notify that a resume bus occurs after a L1 state A resume can occur after a downstream or an upstream resume.
References UHC_WAKEUP_EVENT.
Referenced by _uhd_downstream_resume(), _uhd_upstream_resume(), and _uhd_wakeup().
void uhc_notify_sof | ( | bool | b_micro | ) |
Notify each start of frame sent by driver.
b_micro | It is a micro start of frame, if true |
References uhi_api_t::sof_notify, UHC_NB_UHI, uhc_sof_timeout, and uhc_sof_timeout_callback.
Referenced by _uhd_sof_interrupt().
|
static |
Enables or disables the remote wakeup feature of all devices connected.
b_enable | true to enable remote wakeup feature, else disable. |
References uhc_device_t::address, usb_conf_desc_t::bmAttributes, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhc_device_t::conf_desc, dev, g_uhc_device_root, uhd_setup_request(), USB_CONFIG_ATTR_REMOTE_WAKEUP, USB_DEV_FEATURE_REMOTE_WAKEUP, USB_REQ_CLEAR_FEATURE, USB_REQ_DIR_OUT, USB_REQ_RECIP_DEVICE, USB_REQ_SET_FEATURE, USB_REQ_TYPE_STANDARD, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
Referenced by uhc_notify_resume(), and uhc_suspend().
|
static |
Requests the USB structure of the USB BOS descriptor.
References Assert, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhc_device_t::lpm_desc, UHC_DEVICE_ENUM_ADD, UHC_ENUM_MEMORY_LIMIT, uhc_enumeration_error(), uhd_setup_request(), USB_DT_BOS, USB_REQ_DIR_IN, USB_REQ_GET_DESCRIPTOR, USB_REQ_RECIP_DEVICE, USB_REQ_TYPE_STANDARD, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
Referenced by uhc_enumeration_step16_lpm(), and uhc_enumeration_step17_lpm().
void uhc_resume | ( | void | ) |
Resumes the USB line.
References uhc_is_suspend(), and uhd_resume().
Referenced by run_test_downstream(), and run_test_downstream_disconnection().
|
static |
Callback used to signal the end of a setup request.
add | USB address of the setup request |
status | Transfer status |
payload_trans | Number of data transfered during DATA phase |
References uhc_setup_request_finish, uhc_setup_request_finish_status, UHD_TRANS_NOERROR, and UNUSED.
Referenced by uhc_dev_get_string(), and uhc_dev_is_high_speed_support().
void uhc_start | ( | void | ) |
Starts the host mode.
References uhc_device_t::address, uhc_sof_timeout, UHC_USB_ADD_NOT_VALID, and uhd_enable().
Referenced by run_test_start_uhc(), and usb_dual_enable().
void uhc_stop | ( | bool | b_id_stop | ) |
Stops the host mode.
b_id_stop | Stop USB ID pin management, if true. |
References uhd_disable().
Referenced by run_test_stop_uhc().
void uhc_suspend | ( | bool | b_remotewakeup | ) |
Suspends a USB line.
b_remotewakeup | Authorize the remote wakeup features, if true |
References uhc_enum_try, uhc_remotewakeup(), and uhd_suspend().
Referenced by run_test_disconnection_in_suspend(), run_test_downstream(), run_test_downstream_disconnection(), run_test_upstream_fs(), run_test_upstream_hs(), and run_test_upstream_ls().
Suspends a USB line through LPM feature.
b_remotewakeup | Authorize the remote wakeup features, if true |
hird | Host Initiated Resume Duration |
References uhc_device_t::lpm_desc, uhc_enum_try, and uhd_suspend_lpm().
|
static |
Entry point of all devices connected on USB tree.
Referenced by uhc_enumeration_step9(), uhc_get_device_number(), and uhc_remotewakeup().
|
static |
Number of enumeration try.
Referenced by uhc_connection_tree(), uhc_dev_reset(), uhc_enumeration_error(), uhc_enumeration_step15(), uhc_enumeration_step17_lpm(), uhc_enumeration_step18_lpm(), uhc_suspend(), and uhc_suspend_lpm().
|
static |
Volatile flag to pool the end of Get USB string setup request.
Referenced by uhc_dev_get_string(), uhc_dev_is_high_speed_support(), and uhc_setup_request_callback().
|
static |
Volatile flag to know the status of Get USB string setup request.
Referenced by uhc_dev_get_string(), uhc_dev_is_high_speed_support(), and uhc_setup_request_callback().
uint8_t uhc_sof_timeout |
Number of SOF remaining before call uhc_sof_timeout_callback callback.
Referenced by uhc_connection_tree(), uhc_enable_timeout_callback(), uhc_notify_sof(), and uhc_start().
|
static |
Callback currently registered on a SOF timeout.
Referenced by uhc_enable_timeout_callback(), and uhc_notify_sof().
|
static |
Array of all UHI available.