Skip to content

Commit

Permalink
gdb_if: Allow sleeping on no data for dwc2-using platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
ALTracer authored and dragonmux committed Dec 16, 2023
1 parent 72f0121 commit 8eaaa63
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/platforms/common/stm32/gdb_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,19 @@ static void gdb_if_update_buf(void)
count_out = usbd_ep_read_packet(usbdev, CDCACM_GDB_ENDPOINT, buffer_out, CDCACM_PACKET_SIZE);
out_ptr = 0;
#else
__asm__ volatile("cpsid i; isb");
cm_disable_interrupts();
__asm__ volatile("isb");
if (count_new) {
memcpy(buffer_out, double_buffer_out, count_new);
count_out = count_new;
count_new = 0;
out_ptr = 0;
usbd_ep_nak_set(usbdev, CDCACM_GDB_ENDPOINT, 0);
}
__asm__ volatile("cpsie i; isb");
cm_enable_interrupts();
__asm__ volatile("isb");
if (!count_new)
__WFI();
#endif
if (!count_out)
__WFI();
Expand Down

0 comments on commit 8eaaa63

Please sign in to comment.