-
Notifications
You must be signed in to change notification settings - Fork 34
feature(usb_host): Support multiple DWC OTG peripheral ports in Host mode #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
roma-jam
wants to merge
17
commits into
refactor/usb_host_cleanup_hub_parent_child_dependencies
Choose a base branch
from
feature/usb_host_multiple_root_ports
base: refactor/usb_host_cleanup_hub_parent_child_dependencies
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
508a1b4
refactor(enum): Removed parent_dev_hdl and parent_port_num, replaced …
roma-jam 663be6a
refactor(hub): Removed parent_dev_hdl from dev tree node structure
roma-jam d23d9fb
refactor(ext_hub): Removed unused calls as hub driver doesn't have pa…
roma-jam 24e14ff
refactor(ext_hub): Added device speed getter to stop using parent_dev…
roma-jam 173aa63
refactor(ext_port): Removed parent_dev_hdl and port_num from event
roma-jam 4ae9d24
change(ext_port_test): Applied new ext_port_event callback
roma-jam ad2f788
refactor(ext_port): Removed parent_dev_hdl from the port object
roma-jam 3e13334
change(ext_port_test): Applied new port alloc configuration (without …
roma-jam c4d4297
refactor(usbh): Moved parent information from usbh to hub driver
roma-jam 838c260
refactor(hub): Moved list to dymanic member as the get parent info co…
roma-jam e928ef9
refactor(usbh): Cleaned up parent_dev_hdl from the usbh object
roma-jam 1e2be8f
refactor(ext_hub): Added hcd port handle getter for external hub
roma-jam 4cbacdb
refactor(usbh): Added hcd port handle getter for external hub
roma-jam 5eecf45
refactor(hcd): Added getter for the port number
roma-jam 82402a0
refactor(hub): Isolated root_port object to have multiple hcd handles
roma-jam 60465ad
feature(usb_host): Added handling of peripheral map during install
roma-jam 85b3cc0
refactor(usb_host_mock): Adapted hub_root_start and hub_root_stop api
roma-jam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD | ||
| * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
@@ -111,86 +111,107 @@ esp_err_t hub_uninstall(void); | |
| * | ||
| * @note This function should only be called from the Host Library task | ||
| * | ||
| * @param[in] port_idx Root port index | ||
| * | ||
| * @return | ||
| * - ESP_OK: Hub driver started successfully | ||
| * - ESP_ERR_INVALID_STATE: Hub driver is not installed, or root port is in other state than not powered | ||
| */ | ||
| esp_err_t hub_root_start(void); | ||
| esp_err_t hub_root_start(uint8_t port_idx); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During the |
||
|
|
||
| /** | ||
| * @brief Stops the Hub driver's root port | ||
| * | ||
| * This will power OFF the root port | ||
| * | ||
| * @param[in] port_idx Root port index | ||
| * | ||
| * @return | ||
| * - ESP_OK: Hub driver started successfully | ||
| * - ESP_ERR_INVALID_STATE: Hub driver is not installed, or root port is in not powered state | ||
| */ | ||
| esp_err_t hub_root_stop(void); | ||
| esp_err_t hub_root_stop(uint8_t port_idx); | ||
|
|
||
| /** | ||
| * @brief Indicate to the Hub driver that a device's port can be recycled | ||
| * | ||
| * The device connected to the port has been freed. The Hub driver can now recycled the port | ||
| * The device connected to the port has been freed. | ||
| * The Hub driver can now recycled the node and re-enable the port while it it still present. | ||
| * | ||
| * @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) | ||
| * @param[in] dev_uid Device's unique ID | ||
| * @param[in] node_uid Device's node unique ID | ||
| * | ||
| * @return | ||
| * - ESP_OK: device's port can be recycled | ||
| * - ESP_ERR_INVALID_STATE: Hub driver is not installed | ||
| * - ESP_ERR_NOT_SUPPORTED: Recycling External Port is not available (External Hub support disabled), | ||
| * or ext hub port error | ||
| * - ESP_ERR_NOT_FOUND: Device's node is not found | ||
| */ | ||
| esp_err_t hub_port_recycle(usb_device_handle_t parent_dev_hdl, uint8_t parent_port_num, unsigned int dev_uid); | ||
| esp_err_t hub_node_recycle(unsigned int node_uid); | ||
|
|
||
| /** | ||
| * @brief Reset the port | ||
| * @brief Reset the device in the port, related to the specific Device Tree node | ||
| * | ||
| * @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) | ||
| * @param[in] node_uid Device's node unique ID | ||
| * | ||
| * @return | ||
| * - ESP_OK: Port reset successful | ||
| * - ESP_OK if device in port reset successful | ||
| * - ESP_ERR_INVALID_STATE: Hub driver is not installed | ||
| * - ESP_ERR_NOT_SUPPORTED: Resetting External Port is not available (External Hub support disabled), | ||
| * or ext hub port error | ||
| * - ESP_ERR_NOT_FOUND: Device's node is not found | ||
| */ | ||
| esp_err_t hub_port_reset(usb_device_handle_t parent_dev_hdl, uint8_t parent_port_num); | ||
| esp_err_t hub_node_reset(unsigned int node_uid); | ||
|
|
||
| /** | ||
| * @brief Activate the port | ||
| * @brief Port, related to the specific Device Tree node, has an active device | ||
| * | ||
| * @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) | ||
| * @param[in] node_uid Device's node unique ID | ||
| * | ||
| * @return | ||
| * - ESP_OK: Port activated successfully | ||
| * - ESP_ERR_NOT_SUPPORTED: Activating External Port is not available (External Hub support disabled), | ||
| * - ESP_OK if Port, related to the Device Tree node was activated successfully | ||
| * - ESP_ERR_NOT_SUPPORTED if activating Port is not available (External Hub support disabled), | ||
| * or ext hub port error | ||
| * - ESP_ERR_NOT_FOUND if Device's node is not found | ||
| */ | ||
| esp_err_t hub_port_active(usb_device_handle_t parent_dev_hdl, uint8_t parent_port_num); | ||
| esp_err_t hub_node_active(unsigned int node_uid); | ||
|
|
||
| /** | ||
| * @brief Disable the port | ||
| * @brief Disable the port, related to the specific Device Tree node | ||
| * | ||
| * @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) | ||
| * @param[in] node_uid Device's node unique ID | ||
| * | ||
| * @return | ||
| * - ESP_OK: Port has been disabled without error | ||
| * - ESP_ERR_INVALID_STATE: Port can't be disabled in current state | ||
| * - ESP_ERR_NOT_SUPPORTED: This function is not support by the selected port | ||
| * - ESP_ERR_NOT_FOUND: Device's node is not found | ||
| */ | ||
| esp_err_t hub_node_disable(unsigned int node_uid); | ||
|
|
||
| /** | ||
| * @brief Get the node information of the device | ||
| * | ||
| * @note This function should only be called from the Host Library task | ||
| * | ||
| * @param[in] node_uid Device's node unique ID | ||
| * @param[out] info Device information | ||
| * | ||
| * @return | ||
| * - ESP_ERR_NOT_ALLOWED if the Hub driver is not installed | ||
| * - ESP_ERR_INVALID_ARG if the info pointer is NULL | ||
| * - ESP_ERR_NOT_FOUND if the device node is not found | ||
| * - ESP_OK if Device's information obtained successfully | ||
| */ | ||
| esp_err_t hub_port_disable(usb_device_handle_t parent_dev_hdl, uint8_t parent_port_num); | ||
| esp_err_t hub_node_get_info(unsigned int node_uid, usb_parent_dev_info_t *info); | ||
|
|
||
| /** | ||
| * @brief Notify Hub driver that new device has been attached | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can add get_port_number to the function name? Right now, if you don't' look at the prefix
hcd_port, the function name is justget_numer. But up to you.