summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-04-03 18:11:33 +0700
committerhathach <[email protected]>2025-04-03 18:11:33 +0700
commit4787cd5f546eabad630fc5c22f37f67a076ac37e (patch)
treef0632cb93b46ef040346b316796b4368ae541d01 /src
parent8c1802e41d37c915334a19b859b24cb2a1b48ee5 (diff)
fix(hcd) hcd_edpt_open() return true if endpoint is already opened.
Diffstat (limited to 'src')
-rw-r--r--src/host/hcd.h1
-rw-r--r--src/portable/analog/max3421/hcd_max3421.c2
-rw-r--r--src/portable/ehci/ehci.c4
3 files changed, 5 insertions, 2 deletions
diff --git a/src/host/hcd.h b/src/host/hcd.h
index aa9e9cf3b..b20d96d54 100644
--- a/src/host/hcd.h
+++ b/src/host/hcd.h
@@ -163,6 +163,7 @@ void hcd_device_close(uint8_t rhport, uint8_t dev_addr);
//--------------------------------------------------------------------+
// Open an endpoint
+// return true if successfully opened or endpoint is currently opened
bool hcd_edpt_open(uint8_t rhport, uint8_t daddr, tusb_desc_endpoint_t const * ep_desc);
// Close an endpoint
diff --git a/src/portable/analog/max3421/hcd_max3421.c b/src/portable/analog/max3421/hcd_max3421.c
index 3fbf950a4..bb33200f2 100644
--- a/src/portable/analog/max3421/hcd_max3421.c
+++ b/src/portable/analog/max3421/hcd_max3421.c
@@ -611,7 +611,7 @@ bool hcd_edpt_open(uint8_t rhport, uint8_t daddr, tusb_desc_endpoint_t const * e
ep = &_hcd_data.ep[0];
}else {
if (NULL != find_ep_not_addr0(daddr, ep_num, ep_dir)) {
- return false; // endpoint already opened
+ return true; // already opened
}
ep = allocate_ep();
TU_ASSERT(ep);
diff --git a/src/portable/ehci/ehci.c b/src/portable/ehci/ehci.c
index 292a352fb..7451f69a3 100644
--- a/src/portable/ehci/ehci.c
+++ b/src/portable/ehci/ehci.c
@@ -381,7 +381,9 @@ bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const
if (ep_desc->bEndpointAddress == 0) {
p_qhd = qhd_control(dev_addr);
} else {
- TU_VERIFY(NULL == qhd_get_from_addr(dev_addr, ep_desc->bEndpointAddress)); // ep not opened yet
+ if (NULL != qhd_get_from_addr(dev_addr, ep_desc->bEndpointAddress)) {
+ return true; // already opened
+ }
p_qhd = qhd_find_free();
}
TU_ASSERT(p_qhd);