Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/device/usbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,14 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr) {
return;
}

// Loop until there is no more events in the queue
while (1) {
// Loop until there are no more events in the queue or CFG_TUD_TASK_EVENTS_PER_RUN is reached
for (unsigned epr = 0;; epr++) {
#if CFG_TUD_TASK_EVENTS_PER_RUN > 0
if (epr >= CFG_TUD_TASK_EVENTS_PER_RUN) {
TU_LOG_USBD("USBD event limit (" TU_XSTRING(CFG_TUD_TASK_EVENTS_PER_RUN) ") reached\r\n");
break;
}
#endif
dcd_event_t event;
if (!osal_queue_receive(_usbd_q, &event, timeout_ms)) {
return;
Expand Down
10 changes: 8 additions & 2 deletions src/host/usbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,14 @@ void tuh_task_ext(uint32_t timeout_ms, bool in_isr) {
return;
}

// Loop until there is no more events in the queue
while (1) {
// Loop until there are no more events in the queue or CFG_TUH_TASK_EVENTS_PER_RUN is reached
for (unsigned epr = 0;; epr++) {
#if CFG_TUH_TASK_EVENTS_PER_RUN > 0
if (epr >= CFG_TUH_TASK_EVENTS_PER_RUN) {
TU_LOG_USBH("USBH event limit (" TU_XSTRING(CFG_TUH_TASK_EVENTS_PER_RUN) ") reached\r\n");
break;
}
#endif
hcd_event_t event;
if (!osal_queue_receive(_usbh_q, &event, timeout_ms)) { return; }

Expand Down
10 changes: 10 additions & 0 deletions src/tusb_option.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,11 @@
#define CFG_TUD_INTERFACE_MAX 16
#endif

// max events processed in one tud_task_ext() call, 0 for unlimited
#ifndef CFG_TUD_TASK_EVENTS_PER_RUN
#define CFG_TUD_TASK_EVENTS_PER_RUN 16
#endif

// default to max hardware endpoint, but can be smaller to save RAM
#ifndef CFG_TUD_ENDPPOINT_MAX
#define CFG_TUD_ENDPPOINT_MAX TUP_DCD_ENDPOINT_MAX
Expand Down Expand Up @@ -679,6 +684,11 @@
#define CFG_TUH_MEM_DCACHE_LINE_SIZE CFG_TUSB_MEM_DCACHE_LINE_SIZE
#endif

// max events processed in one tuh_task_ext() call, 0 for unlimited
#ifndef CFG_TUH_TASK_EVENTS_PER_RUN
#define CFG_TUH_TASK_EVENTS_PER_RUN 16
#endif

//------------- CLASS -------------//

#ifndef CFG_TUH_HUB
Expand Down
Loading