From c897ffa619e9bc728cde9e2485e87a72e2de3b63 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Thu, 30 Mar 2017 18:08:15 +0000 Subject: [PATCH] Cleanups in the Bochs system timer code - Now using macro DEV_register_timer() in all devices and lowlevel modules. - Removed unused timer stuff from the plugin.cc/.h code. --- bochs/iodev/acpi.cc | 2 +- bochs/iodev/busmouse.cc | 2 +- bochs/iodev/devices.cc | 2 +- bochs/iodev/floppy.cc | 2 +- bochs/iodev/keyboard.cc | 2 +- bochs/iodev/network/e1000.cc | 3 +-- bochs/iodev/network/eth_fbsd.cc | 4 ++-- bochs/iodev/network/eth_linux.cc | 4 ++-- bochs/iodev/network/eth_null.cc | 4 ++-- bochs/iodev/network/eth_slirp.cc | 4 ++-- bochs/iodev/network/eth_socket.cc | 4 ++-- bochs/iodev/network/eth_tap.cc | 4 ++-- bochs/iodev/network/eth_tuntap.cc | 4 ++-- bochs/iodev/network/eth_vde.cc | 4 ++-- bochs/iodev/network/eth_vnet.cc | 3 +-- bochs/iodev/network/eth_win32.cc | 2 +- bochs/iodev/network/ne2k.cc | 4 ++-- bochs/iodev/serial.cc | 12 ++++++------ bochs/iodev/sound/es1370.cc | 6 +++--- bochs/iodev/sound/sb16.cc | 6 +++--- bochs/iodev/sound/soundalsa.cc | 2 +- bochs/iodev/sound/soundlow.cc | 2 +- bochs/iodev/sound/soundoss.cc | 2 +- bochs/iodev/sound/soundsdl.cc | 2 +- bochs/iodev/sound/soundwin.cc | 2 +- bochs/iodev/usb/uhci_core.cc | 2 +- bochs/iodev/usb/usb_ehci.cc | 2 +- bochs/iodev/usb/usb_ohci.cc | 2 +- bochs/iodev/usb/usb_xhci.cc | 2 +- bochs/plugin.cc | 24 ------------------------ bochs/plugin.h | 14 ++++---------- 31 files changed, 51 insertions(+), 83 deletions(-) diff --git a/bochs/iodev/acpi.cc b/bochs/iodev/acpi.cc index a6e56db95..01356413d 100644 --- a/bochs/iodev/acpi.cc +++ b/bochs/iodev/acpi.cc @@ -130,7 +130,7 @@ void bx_acpi_ctrl_c::init(void) if (BX_ACPI_THIS s.timer_index == BX_NULL_TIMER_HANDLE) { BX_ACPI_THIS s.timer_index = - bx_pc_system.register_timer(this, timer_handler, 1000, 0, 0, "ACPI"); + DEV_register_timer(this, timer_handler, 1000, 0, 0, "ACPI"); } DEV_register_iowrite_handler(this, write_handler, ACPI_DBG_IO_ADDR, "ACPI", 4); diff --git a/bochs/iodev/busmouse.cc b/bochs/iodev/busmouse.cc index 1b1a9c4c8..1547bf77a 100644 --- a/bochs/iodev/busmouse.cc +++ b/bochs/iodev/busmouse.cc @@ -114,7 +114,7 @@ void bx_busm_c::init(void) // Call our timer routine at 30hz BX_BUSM_THIS timer_index = - bx_pc_system.register_timer(this, timer_handler, 33334, 1, 1, "bus mouse timer"); + DEV_register_timer(this, timer_handler, 33334, 1, 1, "bus mouse timer"); for (int i=0x23C; i<=0x23F; i++) { DEV_register_ioread_handler(this, read_handler, i, "Bus Mouse", 1); diff --git a/bochs/iodev/devices.cc b/bochs/iodev/devices.cc index 78120edc8..21e61f483 100644 --- a/bochs/iodev/devices.cc +++ b/bochs/iodev/devices.cc @@ -298,7 +298,7 @@ void bx_devices_c::init(BX_MEM_C *newmem) } if (timer_handle != BX_NULL_TIMER_HANDLE) { - timer_handle = bx_pc_system.register_timer(this, timer_handler, + timer_handle = DEV_register_timer(this, timer_handler, (unsigned) BX_IODEV_HANDLER_PERIOD, 1, 1, "devices.cc"); } diff --git a/bochs/iodev/floppy.cc b/bochs/iodev/floppy.cc index e5784f6e0..02666b5c0 100644 --- a/bochs/iodev/floppy.cc +++ b/bochs/iodev/floppy.cc @@ -285,7 +285,7 @@ void bx_floppy_ctrl_c::init(void) if (BX_FD_THIS s.floppy_timer_index == BX_NULL_TIMER_HANDLE) { BX_FD_THIS s.floppy_timer_index = - bx_pc_system.register_timer(this, timer_handler, 250, 0, 0, "floppy"); + DEV_register_timer(this, timer_handler, 250, 0, 0, "floppy"); } /* phase out s.non_dma in favor of using FD_MS_NDMA, more like hardware */ BX_FD_THIS s.main_status_reg &= ~FD_MS_NDMA; // enable DMA from start diff --git a/bochs/iodev/keyboard.cc b/bochs/iodev/keyboard.cc index d5d035382..4e0a42c64 100644 --- a/bochs/iodev/keyboard.cc +++ b/bochs/iodev/keyboard.cc @@ -129,7 +129,7 @@ void bx_keyb_c::init(void) 0x0060, "8042 Keyboard controller", 1); DEV_register_iowrite_handler(this, write_handler, 0x0064, "8042 Keyboard controller", 1); - BX_KEY_THIS timer_handle = bx_pc_system.register_timer(this, timer_handler, + BX_KEY_THIS timer_handle = DEV_register_timer(this, timer_handler, SIM->get_param_num(BXPN_KBD_SERIAL_DELAY)->get(), 1, 1, "8042 Keyboard controller"); diff --git a/bochs/iodev/network/e1000.cc b/bochs/iodev/network/e1000.cc index fe5cb7a85..e9a486aba 100644 --- a/bochs/iodev/network/e1000.cc +++ b/bochs/iodev/network/e1000.cc @@ -473,8 +473,7 @@ void bx_e1000_c::init(void) if (BX_E1000_THIS s.tx_timer_index == BX_NULL_TIMER_HANDLE) { BX_E1000_THIS s.tx_timer_index = - bx_pc_system.register_timer(this, tx_timer_handler, 0, - 0, 0, "e1000"); // one-shot, inactive + DEV_register_timer(this, tx_timer_handler, 0, 0, 0, "e1000"); // one-shot, inactive } BX_E1000_THIS s.statusbar_id = bx_gui->register_statusitem("E1000", 1); diff --git a/bochs/iodev/network/eth_fbsd.cc b/bochs/iodev/network/eth_fbsd.cc index f2a78bb5d..6f03b9203 100644 --- a/bochs/iodev/network/eth_fbsd.cc +++ b/bochs/iodev/network/eth_fbsd.cc @@ -285,8 +285,8 @@ bx_fbsd_pktmover_c::bx_fbsd_pktmover_c(const char *netif, // Start the rx poll this->rx_timer_index = - bx_pc_system.register_timer(this, this->rx_timer_handler, BX_BPF_POLL, - 1, 1, "eth_fbsd"); // continuous, active + DEV_register_timer(this, this->rx_timer_handler, BX_BPF_POLL, 1, 1, + "eth_fbsd"); // continuous, active this->rxh = rxh; this->rxstat = rxstat; diff --git a/bochs/iodev/network/eth_linux.cc b/bochs/iodev/network/eth_linux.cc index a2cfe2c11..ceb83eac1 100644 --- a/bochs/iodev/network/eth_linux.cc +++ b/bochs/iodev/network/eth_linux.cc @@ -239,8 +239,8 @@ bx_linux_pktmover_c::bx_linux_pktmover_c(const char *netif, // Start the rx poll this->rx_timer_index = - bx_pc_system.register_timer(this, this->rx_timer_handler, BX_PACKET_POLL, - 1, 1, "eth_linux"); // continuous, active + DEV_register_timer(this, this->rx_timer_handler, BX_PACKET_POLL, 1, 1, + "eth_linux"); // continuous, active this->rxh = rxh; this->rxstat = rxstat; diff --git a/bochs/iodev/network/eth_null.cc b/bochs/iodev/network/eth_null.cc index fb022578a..94614ea3f 100644 --- a/bochs/iodev/network/eth_null.cc +++ b/bochs/iodev/network/eth_null.cc @@ -105,8 +105,8 @@ bx_null_pktmover_c::bx_null_pktmover_c(const char *netif, #if BX_ETH_NULL_LOGGING // Start the rx poll this->rx_timer_index = - bx_pc_system.register_timer(this, this->rx_timer_handler, 1000, - 1, 1, "eth_null"); // continuous, active + DEV_register_timer(this, this->rx_timer_handler, 1000, 1, 1, + "eth_null"); // continuous, active this->rxh = rxh; this->rxstat = rxstat; // eventually Bryce wants txlog to dump in pcap format so that diff --git a/bochs/iodev/network/eth_slirp.cc b/bochs/iodev/network/eth_slirp.cc index eec07eceb..4841e6997 100644 --- a/bochs/iodev/network/eth_slirp.cc +++ b/bochs/iodev/network/eth_slirp.cc @@ -322,8 +322,8 @@ bx_slirp_pktmover_c::bx_slirp_pktmover_c(const char *netif, (status == BX_NETDEV_100MBIT) ? 100 : 10; if (bx_slirp_instances == 0) { rx_timer_index = - bx_pc_system.register_timer(this, this->rx_timer_handler, 1000, - 1, 1, "eth_slirp"); + DEV_register_timer(this, this->rx_timer_handler, 1000, 1, 1, + "eth_slirp"); #ifndef WIN32 signal(SIGPIPE, SIG_IGN); #endif diff --git a/bochs/iodev/network/eth_socket.cc b/bochs/iodev/network/eth_socket.cc index ddb3e4bd9..82f70e821 100644 --- a/bochs/iodev/network/eth_socket.cc +++ b/bochs/iodev/network/eth_socket.cc @@ -261,8 +261,8 @@ bx_socket_pktmover_c::bx_socket_pktmover_c(const char *netif, // Start the rx poll // this->rx_timer_index = - bx_pc_system.register_timer(this, this->rx_timer_handler, BX_PACKET_POLL, - 1, 1, "eth_socket"); // continuous, active + DEV_register_timer(this, this->rx_timer_handler, BX_PACKET_POLL, 1, 1, + "eth_socket"); // continuous, active this->rxh = rxh; this->rxstat = rxstat; diff --git a/bochs/iodev/network/eth_tap.cc b/bochs/iodev/network/eth_tap.cc index 510357cf5..592695842 100644 --- a/bochs/iodev/network/eth_tap.cc +++ b/bochs/iodev/network/eth_tap.cc @@ -279,8 +279,8 @@ bx_tap_pktmover_c::bx_tap_pktmover_c(const char *netif, // Start the rx poll this->rx_timer_index = - bx_pc_system.register_timer(this, this->rx_timer_handler, 1000, - 1, 1, "eth_tap"); // continuous, active + DEV_register_timer(this, this->rx_timer_handler, 1000, 1, 1, + "eth_tap"); // continuous, active this->rxh = rxh; this->rxstat = rxstat; memcpy(&guest_macaddr[0], macaddr, 6); diff --git a/bochs/iodev/network/eth_tuntap.cc b/bochs/iodev/network/eth_tuntap.cc index c1c705f3a..c6e487b1c 100644 --- a/bochs/iodev/network/eth_tuntap.cc +++ b/bochs/iodev/network/eth_tuntap.cc @@ -203,8 +203,8 @@ bx_tuntap_pktmover_c::bx_tuntap_pktmover_c(const char *netif, // Start the rx poll this->rx_timer_index = - bx_pc_system.register_timer(this, this->rx_timer_handler, 1000, - 1, 1, "eth_tuntap"); // continuous, active + DEV_register_timer(this, this->rx_timer_handler, 1000, 1, 1, + "eth_tuntap"); // continuous, active this->rxh = rxh; this->rxstat = rxstat; memcpy(&guest_macaddr[0], macaddr, 6); diff --git a/bochs/iodev/network/eth_vde.cc b/bochs/iodev/network/eth_vde.cc index e3dcbea65..04be33ac1 100644 --- a/bochs/iodev/network/eth_vde.cc +++ b/bochs/iodev/network/eth_vde.cc @@ -165,8 +165,8 @@ bx_vde_pktmover_c::bx_vde_pktmover_c(const char *netif, // Start the rx poll this->rx_timer_index = - bx_pc_system.register_timer(this, this->rx_timer_handler, 1000, - 1, 1, "eth_vde"); // continuous, active + DEV_register_timer(this, this->rx_timer_handler, 1000, 1, 1, + "eth_vde"); // continuous, active this->rxh = rxh; this->rxstat = rxstat; #if BX_ETH_VDE_LOGGING diff --git a/bochs/iodev/network/eth_vnet.cc b/bochs/iodev/network/eth_vnet.cc index dcdbd1521..b14b700cf 100644 --- a/bochs/iodev/network/eth_vnet.cc +++ b/bochs/iodev/network/eth_vnet.cc @@ -252,8 +252,7 @@ void bx_vnet_pktmover_c::pktmover_init( this->netdev_speed = (status == BX_NETDEV_1GBIT) ? 1000 : (status == BX_NETDEV_100MBIT) ? 100 : 10; this->rx_timer_index = - bx_pc_system.register_timer(this, this->rx_timer_handler, 1000, - 0, 0, "eth_vnet"); + DEV_register_timer(this, this->rx_timer_handler, 1000, 0, 0, "eth_vnet"); BX_INFO(("'vnet' network driver initialized")); bx_vnet_instances++; diff --git a/bochs/iodev/network/eth_win32.cc b/bochs/iodev/network/eth_win32.cc index 693152b4c..de11a9410 100644 --- a/bochs/iodev/network/eth_win32.cc +++ b/bochs/iodev/network/eth_win32.cc @@ -346,7 +346,7 @@ bx_win32_pktmover_c::bx_win32_pktmover_c( BX_PANIC(("Could not allocate a recv packet")); } rx_timer_index = - bx_pc_system.register_timer(this, this->rx_timer_handler, 10000, 1, 1, "eth_win32"); + DEV_register_timer(this, this->rx_timer_handler, 10000, 1, 1, "eth_win32"); #if BX_ETH_WIN32_LOGGING pktlog_txt = fopen("eth_win32-pktlog.txt", "wb"); diff --git a/bochs/iodev/network/ne2k.cc b/bochs/iodev/network/ne2k.cc index a7739c916..bac1cfdfa 100644 --- a/bochs/iodev/network/ne2k.cc +++ b/bochs/iodev/network/ne2k.cc @@ -215,8 +215,8 @@ void bx_ne2k_c::init(void) if (BX_NE2K_THIS s.tx_timer_index == BX_NULL_TIMER_HANDLE) { BX_NE2K_THIS s.tx_timer_index = - bx_pc_system.register_timer(this, tx_timer_handler, 0, - 0,0, "ne2k"); // one-shot, inactive + DEV_register_timer(this, tx_timer_handler, 0, 0, 0, + "ne2k"); // one-shot, inactive } // Register the IRQ and i/o port addresses if (!BX_NE2K_THIS s.pci_enabled) { diff --git a/bochs/iodev/serial.cc b/bochs/iodev/serial.cc index 9cbe3fcdd..fbb4c3499 100644 --- a/bochs/iodev/serial.cc +++ b/bochs/iodev/serial.cc @@ -293,21 +293,21 @@ bx_serial_c::init(void) if (BX_SER_THIS s[i].tx_timer_index == BX_NULL_TIMER_HANDLE) { BX_SER_THIS s[i].tx_timer_index = - bx_pc_system.register_timer(this, tx_timer_handler, 0, - 0,0, "serial.tx"); // one-shot, inactive + DEV_register_timer(this, tx_timer_handler, 0, 0, 0, + "serial.tx"); // one-shot, inactive bx_pc_system.setTimerParam(BX_SER_THIS s[i].tx_timer_index, i); } if (BX_SER_THIS s[i].rx_timer_index == BX_NULL_TIMER_HANDLE) { BX_SER_THIS s[i].rx_timer_index = - bx_pc_system.register_timer(this, rx_timer_handler, 0, - 0,0, "serial.rx"); // one-shot, inactive + DEV_register_timer(this, rx_timer_handler, 0, 0, 0, + "serial.rx"); // one-shot, inactive bx_pc_system.setTimerParam(BX_SER_THIS s[i].rx_timer_index, i); } if (BX_SER_THIS s[i].fifo_timer_index == BX_NULL_TIMER_HANDLE) { BX_SER_THIS s[i].fifo_timer_index = - bx_pc_system.register_timer(this, fifo_timer_handler, 0, - 0,0, "serial.fifo"); // one-shot, inactive + DEV_register_timer(this, fifo_timer_handler, 0, 0, 0, + "serial.fifo"); // one-shot, inactive bx_pc_system.setTimerParam(BX_SER_THIS s[i].fifo_timer_index, i); } diff --git a/bochs/iodev/sound/es1370.cc b/bochs/iodev/sound/es1370.cc index 9d1f65921..fe274cdc2 100644 --- a/bochs/iodev/sound/es1370.cc +++ b/bochs/iodev/sound/es1370.cc @@ -293,19 +293,19 @@ void bx_es1370_c::init(void) BX_ES1370_THIS s.mpu_outputinit = (BX_ES1370_THIS midimode & 1); if (BX_ES1370_THIS s.dac1_timer_index == BX_NULL_TIMER_HANDLE) { - BX_ES1370_THIS s.dac1_timer_index = bx_pc_system.register_timer + BX_ES1370_THIS s.dac1_timer_index = DEV_register_timer (BX_ES1370_THIS_PTR, es1370_timer_handler, 1, 1, 0, "es1370.dac1"); // DAC1 timer: inactive, continuous, frequency variable bx_pc_system.setTimerParam(BX_ES1370_THIS s.dac1_timer_index, 0); } if (BX_ES1370_THIS s.dac2_timer_index == BX_NULL_TIMER_HANDLE) { - BX_ES1370_THIS s.dac2_timer_index = bx_pc_system.register_timer + BX_ES1370_THIS s.dac2_timer_index = DEV_register_timer (BX_ES1370_THIS_PTR, es1370_timer_handler, 1, 1, 0, "es1370.dac2"); // DAC2 timer: inactive, continuous, frequency variable bx_pc_system.setTimerParam(BX_ES1370_THIS s.dac2_timer_index, 1); } if (BX_ES1370_THIS s.mpu_timer_index == BX_NULL_TIMER_HANDLE) { - BX_ES1370_THIS s.mpu_timer_index = bx_pc_system.register_timer + BX_ES1370_THIS s.mpu_timer_index = DEV_register_timer (BX_ES1370_THIS_PTR, mpu_timer_handler, 500000 / 384, 1, 1, "es1370.mpu"); // midi timer: active, continuous, 500000 / 384 seconds (384 = delta time, 500000 = sec per beat at 120 bpm. Don't change this!) } diff --git a/bochs/iodev/sound/sb16.cc b/bochs/iodev/sound/sb16.cc index 1c8c60315..f012edc09 100644 --- a/bochs/iodev/sound/sb16.cc +++ b/bochs/iodev/sound/sb16.cc @@ -396,19 +396,19 @@ void bx_sb16_c::init(void) // initialize the timers if (MPU.timer_handle == BX_NULL_TIMER_HANDLE) { - MPU.timer_handle = bx_pc_system.register_timer + MPU.timer_handle = DEV_register_timer (BX_SB16_THISP, mpu_timer, 500000 / 384, 1, 1, "sb16.mpu"); // midi timer: active, continuous, 500000 / 384 seconds (384 = delta time, 500000 = sec per beat at 120 bpm. Don't change this!) } if (DSP.timer_handle == BX_NULL_TIMER_HANDLE) { - DSP.timer_handle = bx_pc_system.register_timer + DSP.timer_handle = DEV_register_timer (BX_SB16_THISP, dsp_dmatimer, 1, 1, 0, "sb16.dsp"); // dma timer: inactive, continuous, frequency variable } if (OPL.timer_handle == BX_NULL_TIMER_HANDLE) { - OPL.timer_handle = bx_pc_system.register_timer + OPL.timer_handle = DEV_register_timer (BX_SB16_THISP, opl_timer, 80, 1, 0, "sb16.opl"); // opl timer: inactive, continuous, frequency 80us } diff --git a/bochs/iodev/sound/soundalsa.cc b/bochs/iodev/sound/soundalsa.cc index 5bdaba6ca..2726bd422 100644 --- a/bochs/iodev/sound/soundalsa.cc +++ b/bochs/iodev/sound/soundalsa.cc @@ -203,7 +203,7 @@ int bx_soundlow_wavein_alsa_c::openwaveinput(const char *wavedev, sound_record_h { record_handler = rh; if (rh != NULL) { - record_timer_index = bx_pc_system.register_timer(this, record_timer_handler, 1, 1, 0, "wavein"); + record_timer_index = DEV_register_timer(this, record_timer_handler, 1, 1, 0, "wavein"); // record timer: inactive, continuous, frequency variable } wavein_param.samplerate = 0; diff --git a/bochs/iodev/sound/soundlow.cc b/bochs/iodev/sound/soundlow.cc index d6548c7c1..3716658eb 100644 --- a/bochs/iodev/sound/soundlow.cc +++ b/bochs/iodev/sound/soundlow.cc @@ -518,7 +518,7 @@ int bx_soundlow_wavein_c::openwaveinput(const char *wavedev, sound_record_handle UNUSED(wavedev); record_handler = rh; if (rh != NULL) { - record_timer_index = bx_pc_system.register_timer(this, record_timer_handler, 1, 1, 0, "wavein"); + record_timer_index = DEV_register_timer(this, record_timer_handler, 1, 1, 0, "wavein"); // record timer: inactive, continuous, frequency variable } return BX_SOUNDLOW_OK; diff --git a/bochs/iodev/sound/soundoss.cc b/bochs/iodev/sound/soundoss.cc index 486608c39..76b175dc0 100644 --- a/bochs/iodev/sound/soundoss.cc +++ b/bochs/iodev/sound/soundoss.cc @@ -186,7 +186,7 @@ int bx_soundlow_wavein_oss_c::openwaveinput(const char *wavedev, sound_record_ha { record_handler = rh; if (rh != NULL) { - record_timer_index = bx_pc_system.register_timer(this, record_timer_handler, 1, 1, 0, "soundlnx"); + record_timer_index = DEV_register_timer(this, record_timer_handler, 1, 1, 0, "soundlnx"); // record timer: inactive, continuous, frequency variable } if (wavein_fd == -1) { diff --git a/bochs/iodev/sound/soundsdl.cc b/bochs/iodev/sound/soundsdl.cc index 3b55b5136..955a20847 100644 --- a/bochs/iodev/sound/soundsdl.cc +++ b/bochs/iodev/sound/soundsdl.cc @@ -203,7 +203,7 @@ int bx_soundlow_wavein_sdl2_c::openwaveinput(const char *wavedev, sound_record_h UNUSED(wavedev); record_handler = rh; if (rh != NULL) { - record_timer_index = bx_pc_system.register_timer(this, record_timer_handler, 1, 1, 0, "wavein"); + record_timer_index = DEV_register_timer(this, record_timer_handler, 1, 1, 0, "wavein"); // record timer: inactive, continuous, frequency variable } return BX_SOUNDLOW_OK; diff --git a/bochs/iodev/sound/soundwin.cc b/bochs/iodev/sound/soundwin.cc index 64dfeef08..1cef5cccb 100644 --- a/bochs/iodev/sound/soundwin.cc +++ b/bochs/iodev/sound/soundwin.cc @@ -244,7 +244,7 @@ int bx_soundlow_wavein_win_c::openwaveinput(const char *wavedev, sound_record_ha UNUSED(wavedev); record_handler = rh; if (rh != NULL) { - record_timer_index = bx_pc_system.register_timer(this, record_timer_handler, 1, 1, 0, "soundwin"); + record_timer_index = DEV_register_timer(this, record_timer_handler, 1, 1, 0, "soundwin"); // record timer: inactive, continuous, frequency variable } recording = 0; diff --git a/bochs/iodev/usb/uhci_core.cc b/bochs/iodev/usb/uhci_core.cc index 56800fd4e..cf1896bff 100644 --- a/bochs/iodev/usb/uhci_core.cc +++ b/bochs/iodev/usb/uhci_core.cc @@ -78,7 +78,7 @@ void bx_uhci_core_c::init_uhci(Bit8u devfunc, Bit16u devid, Bit8u headt, Bit8u i // Call our timer routine every 1mS (1,000uS) // Continuous and active hub.timer_index = - bx_pc_system.register_timer(this, uhci_timer_handler, 1000, 1,1, "usb.timer"); + DEV_register_timer(this, uhci_timer_handler, 1000, 1,1, "usb.timer"); hub.devfunc = devfunc; DEV_register_pci_handlers(this, &hub.devfunc, BX_PLUGIN_USB_UHCI, diff --git a/bochs/iodev/usb/usb_ehci.cc b/bochs/iodev/usb/usb_ehci.cc index 3b9ba1d12..8b2a8331a 100644 --- a/bochs/iodev/usb/usb_ehci.cc +++ b/bochs/iodev/usb/usb_ehci.cc @@ -234,7 +234,7 @@ void bx_usb_ehci_c::init(void) // Call our frame timer routine every 1mS (1,024uS) // Continuous and active - BX_EHCI_THIS hub.frame_timer_index = bx_pc_system.register_timer(this, ehci_frame_handler, + BX_EHCI_THIS hub.frame_timer_index = DEV_register_timer(this, ehci_frame_handler, FRAME_TIMER_USEC, 1, 1, "ehci.frame_timer"); BX_EHCI_THIS devfunc = 0x07; diff --git a/bochs/iodev/usb/usb_ohci.cc b/bochs/iodev/usb/usb_ohci.cc index 45412db44..c45e8885e 100644 --- a/bochs/iodev/usb/usb_ohci.cc +++ b/bochs/iodev/usb/usb_ohci.cc @@ -174,7 +174,7 @@ void bx_usb_ohci_c::init(void) // Call our frame timer routine every 1mS (1,000uS) // Continuous and active BX_OHCI_THIS hub.frame_timer_index = - bx_pc_system.register_timer(this, usb_frame_handler, 1000, 1,1, "ohci.frame_timer"); + DEV_register_timer(this, usb_frame_handler, 1000, 1,1, "ohci.frame_timer"); BX_OHCI_THIS hub.devfunc = 0x00; DEV_register_pci_handlers(this, &BX_OHCI_THIS hub.devfunc, BX_PLUGIN_USB_OHCI, diff --git a/bochs/iodev/usb/usb_xhci.cc b/bochs/iodev/usb/usb_xhci.cc index 879ae5708..c9e6bfaba 100644 --- a/bochs/iodev/usb/usb_xhci.cc +++ b/bochs/iodev/usb/usb_xhci.cc @@ -257,7 +257,7 @@ void bx_usb_xhci_c::init(void) } BX_XHCI_THIS xhci_timer_index = - bx_pc_system.register_timer(this, xhci_timer_handler, 1024, 1, 1, "xhci_timer"); + DEV_register_timer(this, xhci_timer_handler, 1024, 1, 1, "xhci_timer"); BX_XHCI_THIS devfunc = 0x00; DEV_register_pci_handlers(this, &BX_XHCI_THIS devfunc, BX_PLUGIN_USB_XHCI, diff --git a/bochs/plugin.cc b/bochs/plugin.cc index c6a654cc6..b416a0e76 100644 --- a/bochs/plugin.cc +++ b/bochs/plugin.cc @@ -86,10 +86,6 @@ int (*pluginRegisterDefaultIOReadHandler)(void *thisPtr, ioReadHandler_t callbac const char *name, Bit8u mask) = 0; int (*pluginRegisterDefaultIOWriteHandler)(void *thisPtr, ioWriteHandler_t callback, const char *name, Bit8u mask) = 0; -int (*pluginRegisterTimer)(void *this_ptr, void (*funct)(void *), - Bit32u useconds, bx_bool continuous, -bx_bool active, const char* name) = 0; - void (*pluginActivateTimer)(unsigned id, Bit32u usec, bx_bool continuous) = 0; void (*pluginHRQHackCallback)(void); unsigned pluginHRQ = 0; @@ -256,23 +252,6 @@ builtinRegisterDefaultIOWriteHandler(void *thisPtr, ioWriteHandler_t callback, return 0; } - static int -builtinRegisterTimer(void *this_ptr, void (*funct)(void *), - Bit32u useconds, bx_bool continuous, - bx_bool active, const char* name) -{ - int id = bx_pc_system.register_timer (this_ptr, funct, useconds, continuous, active, name); - pluginlog->ldebug("plugin %s registered timer %d", name, id); - return id; -} - - static void -builtinActivateTimer(unsigned id, Bit32u usec, bx_bool continuous) -{ - bx_pc_system.activate_timer (id, usec, continuous); - pluginlog->ldebug("plugin activated timer %d", id); -} - #if BX_PLUGINS /************************************************************************/ /* Plugin initialization / deinitialization */ @@ -495,9 +474,6 @@ plugin_startup(void) pluginRegisterDefaultIOReadHandler = builtinRegisterDefaultIOReadHandler; pluginRegisterDefaultIOWriteHandler = builtinRegisterDefaultIOWriteHandler; - pluginRegisterTimer = builtinRegisterTimer; - pluginActivateTimer = builtinActivateTimer; - pluginlog = new logfunctions(); pluginlog->put("PLUGIN"); #if BX_PLUGINS && !defined(WIN32) diff --git a/bochs/plugin.h b/bochs/plugin.h index 5a544ef6c..a0189cf2a 100644 --- a/bochs/plugin.h +++ b/bochs/plugin.h @@ -141,10 +141,7 @@ extern "C" { #define DEV_reset_devices(type) {bx_devices.reset(type); } #define DEV_register_state() {bx_devices.register_state(); } #define DEV_after_restore_state() {bx_devices.after_restore_state(); } - #define DEV_register_timer(a,b,c,d,e,f) bx_pc_system.register_timer(a,b,c,d,e,f) -#define DEV_mouse_enabled_changed(en) (bx_devices.mouse_enabled_changed(en)) -#define DEV_mouse_motion(dx, dy, dz, bs, absxy) (bx_devices.mouse_motion(dx, dy, dz, bs, absxy)) ///////// Removable devices macros #define DEV_optional_key_enq(a) (bx_devices.optional_key_enq(a)) @@ -172,6 +169,10 @@ extern "C" { (bx_devices.pluginKeyboard->paste_bytes(bytes,count)) #define DEV_kbd_release_keys() (bx_devices.pluginKeyboard->release_keys()) +///////// mouse macros +#define DEV_mouse_enabled_changed(en) (bx_devices.mouse_enabled_changed(en)) +#define DEV_mouse_motion(dx, dy, dz, bs, absxy) (bx_devices.mouse_motion(dx, dy, dz, bs, absxy)) + ///////// hard drive macros #define DEV_hd_read_handler(a, b, c) \ (bx_devices.pluginHardDrive->virt_read_handler(b, c)) @@ -332,13 +333,6 @@ BOCHSAPI extern int (*pluginRegisterDefaultIOWriteHandler)(void *thisPtr, ioWrit BOCHSAPI extern void (*pluginRegisterIRQ)(unsigned irq, const char *name); BOCHSAPI extern void (*pluginUnregisterIRQ)(unsigned irq, const char *name); -/* === Timer stuff === */ -BOCHSAPI extern int (*pluginRegisterTimer)(void *this_ptr, void (*funct)(void *), - Bit32u useconds, bx_bool continuous, - bx_bool active, const char *name); - -BOCHSAPI extern void (*pluginActivateTimer)(unsigned id, Bit32u usec, bx_bool continuous); - /* === HRQ stuff === */ BOCHSAPI extern void (*pluginSetHRQ)(unsigned val); BOCHSAPI extern void (*pluginSetHRQHackCallback)(void (*callback)(void));