Skip to content

Commit

Permalink
improved/fixed trigger 1st retryable EP
Browse files Browse the repository at this point in the history
  • Loading branch information
heikokue committed Mar 31, 2024
1 parent 0bb26c9 commit f3fccaa
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/portable/analog/max3421/hcd_max3421.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f3fccaa

Please sign in to comment.