Skip to content

Commit

Permalink
Abilty to limit iterations in hci processing loop
Browse files Browse the repository at this point in the history
Fixes #1455
  • Loading branch information
peterharperuk committed Oct 24, 2024
1 parent 3708588 commit 9a50132
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/rp2_common/pico_cyw43_driver/btstack_hci_transport_cyw43.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ static void hci_transport_cyw43_process(void) {
CYW43_THREAD_LOCK_CHECK
uint32_t len = 0;
bool has_work;
#ifdef PICO_BTSTACK_CYW43_MAX_HCI_PROCESS_LOOP_COUNT
uint32_t loop_count = 0;
#endif
do {
int err = cyw43_bluetooth_hci_read(hci_packet_with_pre_buffer, sizeof(hci_packet_with_pre_buffer), &len);
BT_DEBUG("bt in len=%lu err=%d\n", len, err);
Expand All @@ -148,6 +151,13 @@ static void hci_transport_cyw43_process(void) {
} else {
has_work = false;
}
// PICO_CONFIG: PICO_BTSTACK_CYW43_MAX_HCI_PROCESS_LOOP_COUNT, max number of iterations of the hci processing loop, type=int, default=infinite, advanced=true, group=pico_btstack
#ifdef PICO_BTSTACK_CYW43_MAX_HCI_PROCESS_LOOP_COUNT
loop_count++;
if (loop_count > PICO_BTSTACK_CYW43_MAX_HCI_PROCESS_LOOP_COUNT) {
break;
}
#endif
} while (has_work);
}

Expand Down

0 comments on commit 9a50132

Please sign in to comment.