From 83571bb3440ba3ce9b65b27fa22650ada77e00d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miran=20Gr=C4=8Da?= Date: Fri, 4 Aug 2023 21:50:25 +0200 Subject: [PATCH] Update net_rtl8139.c Make the RTL8139 timer use the actual PCI bus speed. --- src/network/net_rtl8139.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/network/net_rtl8139.c b/src/network/net_rtl8139.c index 80f6b2287..25e30d24f 100644 --- a/src/network/net_rtl8139.c +++ b/src/network/net_rtl8139.c @@ -33,6 +33,7 @@ #include <86box/network.h> #include <86box/bswap.h> #include <86box/nvr.h> +#include <86box/cpu.h> #include <86box/net_rtl8139.h> #define PCI_PERIOD 30 /* 30 ns period = 33.333333 Mhz frequency */ @@ -3157,7 +3158,7 @@ static void rtl8139_timer(void *opaque) { RTL8139State *s = opaque; - timer_on_auto(&s->timer, 1. / 33.); + timer_on_auto(&s->timer, 1000000.0 / ((double) cpu_pci_speed)); if (!s->clock_enabled) { @@ -3303,7 +3304,7 @@ nic_init(const device_t *info) s->nic = network_attach(s, (uint8_t*)&s->eeprom.contents[7], rtl8139_do_receive, rtl8139_set_link_status); timer_add(&s->timer, rtl8139_timer, s, 0); - timer_on_auto(&s->timer, 1. / 33.); + timer_on_auto(&s->timer, 1000000.0 / cpu_pci_speed); s->cplus_txbuffer = NULL; s->cplus_txbuffer_len = 0;