Skip to content

Commit 726c60a

Browse files
committed
Fix buffer indexing bug
1 parent 6b5d36f commit 726c60a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

hw/arm/prusa/stm32f407/stm32f4xx_usb.c

+1
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,7 @@ static uint64_t STM32F4xx_glbreg_read(void *ptr, hwaddr addr, int index,
11851185
if (s->debug) printf("RX fifo pop (STSP): %08x @ %u\n", s->fifo_ram[s->rx_fifo_head], s->rx_fifo_head);
11861186
if(s->rx_fifo_level>0) {
11871187
val = s->fifo_ram[s->rx_fifo_head++];
1188+
s->rx_fifo_head %= STM32F4xx_RX_FIFO_SIZE;
11881189
s->rx_fifo_level--;
11891190
} // else: val will be 0 from s->GRXSTSP;
11901191
break;

0 commit comments

Comments
 (0)