diff options
| author | IngHK <[email protected]> | 2024-04-04 14:17:17 +0200 |
|---|---|---|
| committer | IngHK <[email protected]> | 2024-04-04 14:17:17 +0200 |
| commit | f00e698ae2a470d749331361ef0b031af96cdbd6 (patch) | |
| tree | a4236e27551fb8d6a17b6e64d142ffd22ec92b6c /src | |
| parent | 0c5e14cdaa98b3d801fcaf05e3b6c941031a55b2 (diff) | |
| parent | 5738757e2ca73ab003df5bfbf5ec7b60850ef88b (diff) | |
Merge remote-tracking branch 'remotes/hathach/master' into cdch_upgrade
Diffstat (limited to 'src')
| -rw-r--r-- | src/device/usbd.c | 5 | ||||
| -rw-r--r-- | src/portable/analog/max3421/hcd_max3421.c | 15 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c index 96d0b698b..8f98862c6 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -1181,6 +1181,11 @@ bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer, uint16_t t // TU_VERIFY(tud_ready()); TU_LOG_USBD(" Queue EP %02X with %u bytes ...\r\n", ep_addr, total_bytes); +#if CFG_TUD_LOG_LEVEL >= 3 + if(dir == TUSB_DIR_IN) { + TU_LOG_MEM(CFG_TUD_LOG_LEVEL, buffer, total_bytes, 2); + } +#endif // Attempt to transfer on a busy endpoint, sound like an race condition ! TU_ASSERT(_usbd_dev.ep_status[epnum][dir].busy == 0); diff --git a/src/portable/analog/max3421/hcd_max3421.c b/src/portable/analog/max3421/hcd_max3421.c index 242c65501..059f674cd 100644 --- a/src/portable/analog/max3421/hcd_max3421.c +++ b/src/portable/analog/max3421/hcd_max3421.c @@ -654,7 +654,7 @@ static void xact_generic(uint8_t rhport, max3421_ep_t *ep, bool switch_ep, bool // status if (ep->buf == NULL || ep->total_len == 0) { - uint8_t const hxfr = HXFR_HS | (ep->hxfr_bm.is_out ? HXFR_OUT_NIN : 0); + uint8_t const hxfr = (uint8_t) (HXFR_HS | (ep->hxfr & HXFR_OUT_NIN)); peraddr_write(rhport, ep->daddr, in_isr); hxfr_write(rhport, hxfr, in_isr); return; @@ -676,19 +676,18 @@ bool hcd_edpt_xfer(uint8_t rhport, uint8_t daddr, uint8_t ep_addr, uint8_t * buf max3421_ep_t* ep = find_opened_ep(daddr, ep_num, ep_dir); TU_VERIFY(ep); - // control transfer can switch direction - ep->hxfr_bm.is_out = ep_dir ? 0u : 1u; + if (ep_num == 0) { + // control transfer can switch direction + ep->hxfr_bm.is_out = ep_dir ? 0 : 1; + ep->hxfr_bm.is_setup = 0; + ep->data_toggle = 1; + } ep->buf = buffer; ep->total_len = buflen; ep->xferred_len = 0; ep->state = EP_STATE_ATTEMPT_1; - if (ep_num == 0) { - ep->hxfr_bm.is_setup = 0; - ep->data_toggle = 1; - } - // carry out transfer if not busy if (!atomic_flag_test_and_set(&_hcd_data.busy)) { xact_generic(rhport, ep, true, false); |
