summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIngHK <[email protected]>2024-03-30 14:57:22 +0100
committerIngHK <[email protected]>2024-03-31 10:27:00 +0200
commitf3fccaad2657fae7957523aee5ec1698b55470c4 (patch)
tree154d24e2b7e514bba8c5c0e312beeaa50ef10e6a /src
parent0bb26c97c316cbf3dc0b6e70234c958cf361da73 (diff)
improved/fixed trigger 1st retryable EP
Diffstat (limited to 'src')
-rw-r--r--src/portable/analog/max3421/hcd_max3421.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/portable/analog/max3421/hcd_max3421.c b/src/portable/analog/max3421/hcd_max3421.c
index 335d78481..2dc8f2e18 100644
--- a/src/portable/analog/max3421/hcd_max3421.c
+++ b/src/portable/analog/max3421/hcd_max3421.c
@@ -949,7 +949,6 @@ void hcd_int_handler(uint8_t rhport, bool in_isr) {
#if CFG_TUH_MAX3421_MAX_ATTEMPS_PER_FRAME
// retry EPs
- max3421_ep_t * next_ep = NULL;
for (size_t i = 0; i < CFG_TUH_MAX3421_ENDPOINT_TOTAL; i++) {
max3421_ep_t * ep = &_hcd_data.ep[i];
// set retryable EPs to pending
@@ -960,20 +959,17 @@ void hcd_int_handler(uint8_t rhport, bool in_isr) {
// putchar('0' + ep->ep_num);
#endif
ep->state = EP_STATE_PENDING;
- if (next_ep == NULL) {
- next_ep = &_hcd_data.ep[i];
- }
- }
- }
- // trigger 1st retryable EP
- if (next_ep) {
- if ( !atomic_flag_test_and_set(&_hcd_data.busy) ) {
+ // trigger 1st retryable EP
+ if (ep->packet_size) { // first test packet_size before atomic_flag_test_and_set()
+ if (!atomic_flag_test_and_set(&_hcd_data.busy) ) {
#if PUTCHAR_LOGS // TODO to be deleted later
- putchar(next_ep->ep_dir ? 't' : 'T');
- putchar('0' + next_ep->daddr);
-// putchar('0' + next_ep->ep_num);
+ putchar(ep->ep_dir ? 't' : 'T');
+ putchar('0' + ep->daddr);
+// putchar('0' + ep->ep_num);
#endif
- xact_inout(rhport, next_ep, true, in_isr);
+ xact_inout(rhport, ep, true, in_isr);
+ }
+ }
}
}
#endif