Skip to content

Commit 5cc5c0e

Browse files
committed
Add option to disable USB SOF intterupt.
1 parent e766f8e commit 5cc5c0e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

hw/arm/prusa/stm32f407/stm32f4xx_usb.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,8 @@ struct STM32F4xxUSBState {
668668
#endif
669669
bool debug;
670670

671+
bool disable_sofi;
672+
671673
bool is_device_mode;
672674

673675
char cdc_in;
@@ -932,7 +934,10 @@ static void STM32F4xx_sof(STM32F4xxUSBState *s)
932934
s->sof_time += s->usb_frame_time;
933935
// trace_usb_stm_sof(s->sof_time);
934936
STM32F4xx_eof_timer(s);
935-
STM32F4xx_raise_global_irq(s, GINTSTS_SOF);
937+
if (!s->disable_sofi)
938+
{
939+
STM32F4xx_raise_global_irq(s, GINTSTS_SOF);
940+
}
936941
}
937942

938943
/* Do frame processing on frame boundary */
@@ -3174,6 +3179,11 @@ static void STM32F4xx_realize(DeviceState *dev, Error **errp)
31743179
s->cdc_timer = timer_new_us(QEMU_CLOCK_VIRTUAL, STM32F4xx_cdc_helper, s);
31753180
s->async_bh = qemu_bh_new(STM32F4xx_work_bh, s);
31763181

3182+
if (s->disable_sofi)
3183+
{
3184+
printf("USB SOF Int disabled.\n");
3185+
}
3186+
31773187
sysbus_init_irq(sbd, &s->irq);
31783188

31793189
qemu_chr_fe_set_handlers(&s->cdc, f4xx_usb_cdc_can_receive, f4xx_usb_cdc_receive, NULL,
@@ -3303,6 +3313,7 @@ static Property STM32F4xx_usb_properties[] = {
33033313
DEFINE_PROP_UINT32("usb_version", STM32F4xxUSBState, usb_version, 2),
33043314
DEFINE_PROP_CHR("chardev", STM32F4xxUSBState, cdc),
33053315
DEFINE_PROP_LINK("system-memory", STM32F4xxUSBState, cpu_mr, TYPE_MEMORY_REGION, MemoryRegion*),
3316+
DEFINE_PROP_BOOL("disable_sof_interrupt", STM32F4xxUSBState, disable_sofi, false),
33063317
DEFINE_PROP_END_OF_LIST(),
33073318
};
33083319

0 commit comments

Comments
 (0)