From cef74b528a59fba94540b9a9a71e50ef7f667ce8 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Sun, 27 Nov 2005 17:49:59 +0000 Subject: [PATCH] - moved runtime handler for 'vga_update_interval' into the device (TODO: this could be done with some parameters, e.g. mouse, keyboard, usb) --- bochs/config.cc | 9 +-------- bochs/iodev/iodev.h | 5 +---- bochs/iodev/svga_cirrus.cc | 18 ++++++++++-------- bochs/iodev/svga_cirrus.h | 4 ++-- bochs/iodev/vga.cc | 21 +++++++++++++-------- bochs/iodev/vga.h | 6 +++--- bochs/plugin.h | 4 +--- 7 files changed, 31 insertions(+), 36 deletions(-) diff --git a/bochs/config.cc b/bochs/config.cc index aa4d33241..a7d18eeeb 100755 --- a/bochs/config.cc +++ b/bochs/config.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: config.cc,v 1.62 2005-11-27 09:00:20 vruppert Exp $ +// $Id: config.cc,v 1.63 2005-11-27 17:49:58 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -59,11 +59,6 @@ bx_param_handler (bx_param_c *param, int set, Bit64s val) { bx_id id = param->get_id (); switch (id) { - case BXP_VGA_UPDATE_INTERVAL: - // if after init, notify the vga device to change its timer. - if (set && SIM->get_init_done ()) - DEV_vga_set_update_interval ((unsigned int)val); - break; case BXP_MOUSE_ENABLED: // if after init, notify the GUI if (set && SIM->get_init_done ()) { @@ -1155,8 +1150,6 @@ void bx_init_options () "Number of microseconds between VGA updates", 1, BX_MAX_BIT32U, 40000); - bx_options.Ovga_update_interval->set_handler (bx_param_handler); - bx_options.Ovga_update_interval->set_runtime_param (1); bx_options.Ovga_update_interval->set_ask_format ("Type a new value for VGA update interval: [%d] "); bx_options.Ovga_extension = new bx_param_string_c (BXP_VGA_EXTENSION, diff --git a/bochs/iodev/iodev.h b/bochs/iodev/iodev.h index 9742d223b..5a40fdb62 100644 --- a/bochs/iodev/iodev.h +++ b/bochs/iodev/iodev.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: iodev.h,v 1.64 2005-11-15 17:19:28 vruppert Exp $ +// $Id: iodev.h,v 1.65 2005-11-27 17:49:58 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -257,9 +257,6 @@ class BOCHSAPI bx_vga_stub_c : public bx_devmodel_c { virtual void trigger_timer(void *this_ptr) { STUBFUNC(vga, trigger_timer); } - virtual void set_update_interval (unsigned interval) { - STUBFUNC(vga, set_update_interval); - } virtual Bit8u get_actl_palette_idx(Bit8u index) { return 0; } diff --git a/bochs/iodev/svga_cirrus.cc b/bochs/iodev/svga_cirrus.cc index 09e5fa683..96faf51c1 100644 --- a/bochs/iodev/svga_cirrus.cc +++ b/bochs/iodev/svga_cirrus.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: svga_cirrus.cc,v 1.25 2005-11-15 17:19:28 vruppert Exp $ +// $Id: svga_cirrus.cc,v 1.26 2005-11-27 17:49:59 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (c) 2004 Makoto Suzuki (suzu) @@ -263,7 +263,7 @@ bx_svga_cirrus_c::init(void) BX_CIRRUS_THIS bx_vga_c::init_iohandlers( svga_read_handler, svga_write_handler); BX_CIRRUS_THIS bx_vga_c::init_systemtimer( - svga_timer_handler); + svga_timer_handler, svga_param_handler); #if BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI BX_CIRRUS_THIS pci_enabled = DEV_is_pci_device("cirrus"); #endif @@ -285,7 +285,7 @@ bx_svga_cirrus_c::init(void) BX_CIRRUS_THIS bx_vga_c::init_iohandlers( bx_vga_c::read_handler, bx_vga_c::write_handler); BX_CIRRUS_THIS bx_vga_c::init_systemtimer( - bx_vga_c::timer_handler); + bx_vga_c::timer_handler, bx_vga_c::vga_param_handler); } } @@ -748,12 +748,14 @@ bx_svga_cirrus_c::trigger_timer(void *this_ptr) BX_CIRRUS_THIS timer_handler(this_ptr); } - void -bx_svga_cirrus_c::set_update_interval (unsigned interval) +Bit64s bx_svga_cirrus_c::svga_param_handler(bx_param_c *param, int set, Bit64s val) { - BX_INFO (("Changing timer interval to %d", interval)); - BX_CIRRUS_THIS svga_timer_handler (theSvga); - bx_pc_system.activate_timer (BX_CIRRUS_THIS timer_id, interval, 1); + if (set) { + BX_INFO (("Changing timer interval to %d", (Bit32u)val)); + BX_CIRRUS_THIS svga_timer_handler (theSvga); + bx_pc_system.activate_timer (BX_CIRRUS_THIS timer_id, (Bit32u)val, 1); + } + return val; } Bit8u diff --git a/bochs/iodev/svga_cirrus.h b/bochs/iodev/svga_cirrus.h index 666b4f9ef..00421b887 100644 --- a/bochs/iodev/svga_cirrus.h +++ b/bochs/iodev/svga_cirrus.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: svga_cirrus.h,v 1.5 2005-04-13 18:39:26 vruppert Exp $ +// $Id: svga_cirrus.h,v 1.6 2005-11-27 17:49:59 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (c) 2004 Makoto Suzuki (suzu) @@ -74,7 +74,6 @@ public: virtual void get_text_snapshot(Bit8u **text_snapshot, unsigned *txHeight, unsigned *txWidth); virtual void trigger_timer(void *this_ptr); - virtual void set_update_interval (unsigned interval); virtual Bit8u get_actl_palette_idx(Bit8u index); private: @@ -86,6 +85,7 @@ private: #endif // !BX_USE_CIRRUS_SMF static void svga_timer_handler(void *); + static Bit64s svga_param_handler(bx_param_c *param, int set, Bit64s val); BX_CIRRUS_SMF void svga_timer(void); BX_CIRRUS_SMF void svga_modeupdate(void); BX_CIRRUS_SMF void svga_update(void); diff --git a/bochs/iodev/vga.cc b/bochs/iodev/vga.cc index 70ef6e39b..b2c2f9065 100644 --- a/bochs/iodev/vga.cc +++ b/bochs/iodev/vga.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: vga.cc,v 1.122 2005-10-27 17:53:39 vruppert Exp $ +// $Id: vga.cc,v 1.123 2005-11-27 17:49:59 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -270,7 +270,7 @@ bx_vga_c::init(void) } #if !BX_SUPPORT_CLGD54XX - BX_VGA_THIS init_systemtimer(timer_handler); + BX_VGA_THIS init_systemtimer(timer_handler, vga_param_handler); #endif // !BX_SUPPORT_CLGD54XX /* video card with BIOS ROM */ @@ -376,12 +376,14 @@ bx_vga_c::init_iohandlers(bx_read_handler_t f_read, bx_write_handler_t f_write) } void -bx_vga_c::init_systemtimer(bx_timer_handler_t f_timer) +bx_vga_c::init_systemtimer(bx_timer_handler_t f_timer, param_event_handler f_param) { BX_INFO(("interval=%u", bx_options.Ovga_update_interval->get ())); if (BX_VGA_THIS timer_id == BX_NULL_TIMER_HANDLE) { BX_VGA_THIS timer_id = bx_pc_system.register_timer(this, f_timer, bx_options.Ovga_update_interval->get (), 1, 1, "vga"); + bx_options.Ovga_update_interval->set_handler (f_param); + bx_options.Ovga_update_interval->set_runtime_param (1); } } @@ -1371,12 +1373,15 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log) } } -void -bx_vga_c::set_update_interval (unsigned interval) +Bit64s bx_vga_c::vga_param_handler(bx_param_c *param, int set, Bit64s val) { - BX_INFO (("Changing timer interval to %d\n", interval)); - BX_VGA_THIS timer_handler (theVga); - bx_pc_system.activate_timer (BX_VGA_THIS timer_id, interval, 1); + // handler for runtime parameter 'vga_update_interval' + if (set) { + BX_INFO (("Changing timer interval to %d", (Bit32u)val)); + BX_VGA_THIS timer_handler (theVga); + bx_pc_system.activate_timer (BX_VGA_THIS timer_id, (Bit32u)val, 1); + } + return val; } void diff --git a/bochs/iodev/vga.h b/bochs/iodev/vga.h index 8aaf86cac..33b201770 100644 --- a/bochs/iodev/vga.h +++ b/bochs/iodev/vga.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: vga.h,v 1.48 2005-10-27 17:53:41 vruppert Exp $ +// $Id: vga.h,v 1.49 2005-11-27 17:49:59 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -150,14 +150,13 @@ public: virtual void redraw_area(unsigned x0, unsigned y0, unsigned width, unsigned height); - virtual void set_update_interval (unsigned interval); virtual void get_text_snapshot(Bit8u **text_snapshot, unsigned *txHeight, unsigned *txWidth); virtual Bit8u get_actl_palette_idx(Bit8u index); protected: void init_iohandlers(bx_read_handler_t f_read, bx_write_handler_t f_write); - void init_systemtimer(bx_timer_handler_t f_timer); + void init_systemtimer(bx_timer_handler_t f_timer, param_event_handler f_param); static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len); static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len); @@ -329,6 +328,7 @@ protected: public: static void timer_handler(void *); BX_VGA_SMF void timer(void); + static Bit64s vga_param_handler(bx_param_c *param, int set, Bit64s val); protected: BX_VGA_SMF void update(void); diff --git a/bochs/plugin.h b/bochs/plugin.h index 66af534dd..320dd5e14 100644 --- a/bochs/plugin.h +++ b/bochs/plugin.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: plugin.h,v 1.42 2005-10-30 14:14:02 vruppert Exp $ +// $Id: plugin.h,v 1.43 2005-11-27 17:49:58 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // This file provides macros and types needed for plugins. It is based on @@ -174,8 +174,6 @@ extern "C" { (bx_devices.pluginVgaDevice->get_text_snapshot(rawsnap, height, width)) #define DEV_vga_refresh() \ (bx_devices.pluginVgaDevice->trigger_timer(bx_devices.pluginVgaDevice)) -#define DEV_vga_set_update_interval(val) \ - (bx_devices.pluginVgaDevice->set_update_interval(val)) #define DEV_vga_get_actl_pal_idx(index) (bx_devices.pluginVgaDevice->get_actl_palette_idx(index)) #define DEV_vga_dump_status() (bx_devices.pluginVgaDevice->dump_status())