summaryrefslogtreecommitdiff
path: root/src/host/usbh.c
diff options
context:
space:
mode:
authorCédric Berger <[email protected]>2026-02-01 21:08:03 +0100
committerCédric Berger <[email protected]>2026-02-01 21:08:03 +0100
commitb73df6c22e4743f9232f7922fe2cf0fbd05a3a2e (patch)
treecbc738198112e8563fe85e7b78dfdd48c095a01d /src/host/usbh.c
parentdc00f3536f7f636ffea639430faa2d828317137c (diff)
Limit events processed by tud_task_ext() / tuh_task_ext()
Diffstat (limited to 'src/host/usbh.c')
-rw-r--r--src/host/usbh.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c
index a725b7c8b..cc99c0a53 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -599,8 +599,13 @@ 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");
+ }
+#endif
hcd_event_t event;
if (!osal_queue_receive(_usbh_q, &event, timeout_ms)) { return; }