diff options
| author | Ha Thach <[email protected]> | 2024-04-04 14:35:29 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-04-04 14:35:29 +0700 |
| commit | 177b388be0f430ef09ad2caf61cd70acd574c0d5 (patch) | |
| tree | 4126a61278ccaeed3f0bacc724e0aaf8c51054a5 /src | |
| parent | 66cdf6d097d76f8d21ed4314651ac730d4023f99 (diff) | |
| parent | ebe692350047b7b2a5b46de7894352934c4200aa (diff) | |
Merge pull request #2571 from hathach/fix-max3421-rp2040-build
fix build with rp2040 + max3421
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/analog/max3421/hcd_max3421.c | 15 |
1 files changed, 7 insertions, 8 deletions
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); |
