mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-11 21:10:20 +00:00
feat(ext_hub): Added External Hub driver
This commit is contained in:
@@ -8,10 +8,15 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_err.h"
|
||||
#include "usb_private.h"
|
||||
#include "usbh.h"
|
||||
|
||||
#if CONFIG_USB_HOST_HUBS_SUPPORTED
|
||||
#define ENABLE_USB_HUBS 1
|
||||
#endif // CONFIG_USB_HOST_HUBS_SUPPORTED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -138,6 +143,50 @@ esp_err_t hub_port_recycle(usb_device_handle_t parent_dev_hdl, uint8_t parent_po
|
||||
*/
|
||||
esp_err_t hub_port_reset(usb_device_handle_t parent_dev_hdl, uint8_t parent_port_num);
|
||||
|
||||
/**
|
||||
* @brief Activate the port
|
||||
*
|
||||
* @note This function should only be called from the Host Library task
|
||||
*
|
||||
* @param[in] parent_dev_hdl Parent device handle (is used to get the External Hub handle)
|
||||
* @param[in] parent_port_num Parent number (is used to specify the External Port)
|
||||
* @return
|
||||
* - ESP_OK: Success
|
||||
*/
|
||||
esp_err_t hub_port_active(usb_device_handle_t parent_dev_hdl, uint8_t parent_port_num);
|
||||
|
||||
#if ENABLE_USB_HUBS
|
||||
/**
|
||||
* @brief Notify Hub driver that new device has been attached
|
||||
*
|
||||
* If device is has a HUB class, then it will be added as External Hub to Hub Driver.
|
||||
*
|
||||
* @param[in] dev_addr Device bus address
|
||||
* @return
|
||||
* - ESP_OK: Success
|
||||
*/
|
||||
esp_err_t hub_notify_new_dev(uint8_t dev_addr);
|
||||
|
||||
/**
|
||||
* @brief Notify Hub driver that device has been removed
|
||||
*
|
||||
* If the device was an External Hub, then it will be removed from the Hub Driver.
|
||||
*
|
||||
* @param[in] dev_addr Device bus address
|
||||
* @return
|
||||
* - ESP_OK: Success
|
||||
*/
|
||||
esp_err_t hub_notify_dev_gone(uint8_t dev_addr);
|
||||
|
||||
/**
|
||||
* @brief Notify Hub driver that all devices should be freed
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Success
|
||||
*/
|
||||
esp_err_t hub_notify_all_free(void);
|
||||
#endif // ENABLE_USB_HUBS
|
||||
|
||||
/**
|
||||
* @brief Hub driver's processing function
|
||||
*
|
||||
|
Reference in New Issue
Block a user