mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
fix(usb/hal/dwc): Correct host channel number calculation
The hardware field `ghwcfg2.numhstchnl` is zero-based, meaning the actual number of available host channels is `numhstchnl + 1`. This off-by-one error caused the USB Host controller to report N-1 channels instead of N, leading to premature "No more HCD channels available" errors when connecting multiple devices. This issue affects ESP32-S2, ESP32-S3, and ESP32-P4.
This commit is contained in:
parent
aa424235e2
commit
dfd8098716
@ -362,7 +362,7 @@ static inline unsigned usb_dwc_ll_ghwcfg_get_hsphy_type(usb_dwc_dev_t *hw)
|
||||
|
||||
static inline unsigned usb_dwc_ll_ghwcfg_get_channel_num(usb_dwc_dev_t *hw)
|
||||
{
|
||||
return hw->ghwcfg2_reg.numhstchnl;
|
||||
return hw->ghwcfg2_reg.numhstchnl + 1;
|
||||
}
|
||||
|
||||
// --------------------------- HPTXFSIZ Register -------------------------------
|
||||
|
@ -361,7 +361,7 @@ static inline unsigned usb_dwc_ll_ghwcfg_get_hsphy_type(usb_dwc_dev_t *hw)
|
||||
|
||||
static inline unsigned usb_dwc_ll_ghwcfg_get_channel_num(usb_dwc_dev_t *hw)
|
||||
{
|
||||
return hw->ghwcfg2_reg.numhstchnl;
|
||||
return hw->ghwcfg2_reg.numhstchnl + 1;
|
||||
}
|
||||
|
||||
// --------------------------- HPTXFSIZ Register -------------------------------
|
||||
|
@ -361,7 +361,7 @@ static inline unsigned usb_dwc_ll_ghwcfg_get_hsphy_type(usb_dwc_dev_t *hw)
|
||||
|
||||
static inline unsigned usb_dwc_ll_ghwcfg_get_channel_num(usb_dwc_dev_t *hw)
|
||||
{
|
||||
return hw->ghwcfg2_reg.numhstchnl;
|
||||
return hw->ghwcfg2_reg.numhstchnl + 1;
|
||||
}
|
||||
|
||||
// --------------------------- HPTXFSIZ Register -------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user