2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2004-07-04 21:10:05 +04:00
|
|
|
// $Id: iodev.h,v 1.46 2004-07-04 17:07:48 vruppert Exp $
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2002-06-16 19:02:28 +04:00
|
|
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// MandrakeSoft S.A.
|
|
|
|
// 43, rue d'Aboukir
|
|
|
|
// 75002 Paris - France
|
|
|
|
// http://www.linux-mandrake.com/
|
|
|
|
// http://www.mandrakesoft.com/
|
|
|
|
//
|
2004-01-15 05:08:37 +03:00
|
|
|
// I/O port handlers API Copyright (C) 2003 by Frank Cornelis
|
|
|
|
//
|
2001-04-10 05:04:59 +04:00
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
2004-06-19 19:20:15 +04:00
|
|
|
#ifndef IODEV_H
|
|
|
|
#define IODEV_H
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2004-06-19 19:20:15 +04:00
|
|
|
#include "bochs.h"
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2003-07-31 19:29:34 +04:00
|
|
|
/* maximum number of emulated devices allowed. floppy, vga, etc...
|
2001-04-10 05:04:59 +04:00
|
|
|
you can increase this to anything below 256 since an 8-bit handle
|
|
|
|
is used for each device */
|
2003-07-31 19:29:34 +04:00
|
|
|
#define BX_MAX_IO_DEVICES 30
|
2002-10-25 01:07:56 +04:00
|
|
|
|
|
|
|
/* the last device in the array is the "default" I/O device */
|
|
|
|
#define BX_DEFAULT_IO_DEVICE (BX_MAX_IO_DEVICES-1)
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
/* number of IRQ lines supported. In an ISA PC there are two
|
|
|
|
PIC chips cascaded together. each has 8 IRQ lines, so there
|
|
|
|
should be 16 IRQ's total */
|
|
|
|
#define BX_MAX_IRQS 16
|
|
|
|
#define BX_NO_IRQ -1
|
|
|
|
|
|
|
|
|
|
|
|
class bx_pit_c;
|
|
|
|
class bx_keyb_c;
|
2001-05-23 11:48:11 +04:00
|
|
|
class bx_ioapic_c;
|
2001-04-10 05:04:59 +04:00
|
|
|
class bx_g2h_c;
|
2001-09-14 19:01:29 +04:00
|
|
|
#if BX_IODEBUG_SUPPORT
|
|
|
|
class bx_iodebug_c;
|
|
|
|
#endif
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef Bit32u (*bx_read_handler_t)(void *, Bit32u, unsigned);
|
|
|
|
typedef void (*bx_write_handler_t)(void *, Bit32u, Bit32u, unsigned);
|
|
|
|
|
|
|
|
|
|
|
|
#if BX_USE_DEV_SMF
|
|
|
|
# define BX_DEV_SMF static
|
|
|
|
# define BX_DEV_THIS bx_devices.
|
|
|
|
#else
|
|
|
|
# define BX_DEV_SMF
|
|
|
|
# define BX_DEV_THIS this->
|
|
|
|
#endif
|
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// bx_devmodel_c declaration
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// This class defines virtual methods that are common to all devices.
|
|
|
|
// Child classes do not need to implement all of them, because in this
|
|
|
|
// definition they are defined as empty, as opposed to being pure
|
|
|
|
// virtual (= 0).
|
|
|
|
class BOCHSAPI bx_devmodel_c : public logfunctions {
|
|
|
|
public:
|
|
|
|
virtual ~bx_devmodel_c () {}
|
|
|
|
virtual void init_mem(BX_MEM_C *) {}
|
|
|
|
virtual void init(void) {}
|
|
|
|
virtual void reset(unsigned type) {}
|
|
|
|
virtual void device_load_state () {}
|
|
|
|
virtual void device_save_state () {}
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// declare stubs for devices
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#define STUBFUNC(dev,method) \
|
|
|
|
pluginlog->panic("%s called in %s stub. you must not have loaded the %s plugin", #dev, #method, #dev )
|
|
|
|
|
|
|
|
class BOCHSAPI bx_keyb_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
|
|
|
virtual ~bx_keyb_stub_c () {}
|
|
|
|
// stubs for bx_keyb_c methods
|
|
|
|
virtual void mouse_motion(int delta_x, int delta_y, unsigned button_state) {
|
|
|
|
STUBFUNC(keyboard, mouse_motion);
|
|
|
|
}
|
2003-07-13 23:51:21 +04:00
|
|
|
virtual void gen_scancode(Bit32u key) {
|
2002-10-25 01:07:56 +04:00
|
|
|
STUBFUNC(keyboard, gen_scancode);
|
|
|
|
}
|
|
|
|
virtual void paste_bytes(Bit8u *data, Bit32s length) {
|
|
|
|
STUBFUNC(keyboard, paste_bytes);
|
|
|
|
}
|
|
|
|
virtual void paste_delay_changed () {
|
|
|
|
STUBFUNC(keyboard, paste_delay_changed);
|
|
|
|
}
|
|
|
|
virtual void mouse_enabled_changed(bool enabled) {
|
|
|
|
STUBFUNC(keyboard, mouse_enabled_changed);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class BOCHSAPI bx_hard_drive_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
|
|
|
virtual void close_harddrive(void) {
|
|
|
|
STUBFUNC(HD, close_harddrive);
|
|
|
|
}
|
|
|
|
virtual void init() {
|
|
|
|
STUBFUNC(HD, init);
|
|
|
|
}
|
|
|
|
virtual void reset(unsigned type) {
|
|
|
|
STUBFUNC(HD, reset);
|
|
|
|
}
|
|
|
|
virtual Bit32u get_device_handle(Bit8u channel, Bit8u device) {
|
|
|
|
STUBFUNC(HD, get_device_handle); return 0;
|
|
|
|
}
|
|
|
|
virtual Bit32u get_first_cd_handle(void) {
|
|
|
|
STUBFUNC(HD, get_first_cd_handle); return 0;
|
|
|
|
}
|
|
|
|
virtual unsigned get_cd_media_status(Bit32u handle) {
|
|
|
|
STUBFUNC(HD, get_cd_media_status); return 0;
|
|
|
|
}
|
|
|
|
virtual unsigned set_cd_media_status(Bit32u handle, unsigned status) {
|
|
|
|
STUBFUNC(HD, set_cd_media_status); return 0;
|
|
|
|
}
|
|
|
|
virtual Bit32u virt_read_handler(Bit32u address, unsigned io_len)
|
|
|
|
{
|
|
|
|
STUBFUNC(HD, virt_read_handler); return 0;
|
|
|
|
}
|
|
|
|
virtual void virt_write_handler(Bit32u address,
|
|
|
|
Bit32u value, unsigned io_len)
|
|
|
|
{
|
|
|
|
STUBFUNC(HD, virt_write_handler);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class BOCHSAPI bx_floppy_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
|
|
|
virtual unsigned get_media_status(unsigned drive) {
|
|
|
|
STUBFUNC(floppy, get_media_status); return 0;
|
|
|
|
}
|
|
|
|
virtual unsigned set_media_status(unsigned drive, unsigned status) {
|
|
|
|
STUBFUNC(floppy, set_media_status); return 0;
|
|
|
|
}
|
|
|
|
};
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
class BOCHSAPI bx_cmos_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
|
|
|
virtual Bit32u get_reg(unsigned reg) {
|
|
|
|
STUBFUNC(cmos, get_reg); return 0;
|
|
|
|
}
|
|
|
|
virtual void set_reg(unsigned reg, Bit32u val) {
|
|
|
|
STUBFUNC(cmos, set_reg);
|
|
|
|
}
|
|
|
|
virtual time_t get_timeval() {
|
2002-11-12 01:01:08 +03:00
|
|
|
// STUBFUNC(cmos, get_timeval);
|
|
|
|
return 0;
|
2002-10-25 01:07:56 +04:00
|
|
|
}
|
|
|
|
virtual void checksum_cmos(void) {
|
|
|
|
STUBFUNC(cmos, checksum);
|
|
|
|
}
|
|
|
|
};
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
class BOCHSAPI bx_dma_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
|
|
|
virtual unsigned registerDMA8Channel(
|
|
|
|
unsigned channel,
|
|
|
|
void (* dmaRead)(Bit8u *data_byte),
|
|
|
|
void (* dmaWrite)(Bit8u *data_byte),
|
|
|
|
const char *name
|
|
|
|
) {
|
|
|
|
STUBFUNC(dma, registerDMA8Channel); return 0;
|
|
|
|
}
|
|
|
|
virtual unsigned registerDMA16Channel(
|
|
|
|
unsigned channel,
|
|
|
|
void (* dmaRead)(Bit16u *data_word),
|
|
|
|
void (* dmaWrite)(Bit16u *data_word),
|
|
|
|
const char *name
|
|
|
|
) {
|
|
|
|
STUBFUNC(dma, registerDMA16Channel); return 0;
|
|
|
|
}
|
|
|
|
virtual unsigned unregisterDMAChannel(unsigned channel) {
|
|
|
|
STUBFUNC(dma, unregisterDMAChannel); return 0;
|
|
|
|
}
|
|
|
|
virtual unsigned get_TC(void) {
|
|
|
|
STUBFUNC(dma, get_TC); return 0;
|
|
|
|
}
|
2002-10-25 15:44:41 +04:00
|
|
|
virtual void set_DRQ(unsigned channel, bx_bool val) {
|
2002-10-25 01:07:56 +04:00
|
|
|
STUBFUNC(dma, set_DRQ);
|
|
|
|
}
|
|
|
|
virtual void raise_HLDA(void) {
|
|
|
|
STUBFUNC(dma, raise_HLDA);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class BOCHSAPI bx_pic_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
|
|
|
virtual void raise_irq(unsigned irq_no) {
|
|
|
|
STUBFUNC(pic, raise_irq);
|
|
|
|
}
|
|
|
|
virtual void lower_irq(unsigned irq_no) {
|
|
|
|
STUBFUNC(pic, lower_irq);
|
|
|
|
}
|
|
|
|
virtual Bit8u IAC(void) {
|
|
|
|
STUBFUNC(pic, IAC); return 0;
|
|
|
|
}
|
2003-08-04 20:03:09 +04:00
|
|
|
virtual void show_pic_state(void) {
|
|
|
|
STUBFUNC(pic, show_pic_state);
|
|
|
|
}
|
2002-10-25 01:07:56 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
class BOCHSAPI bx_vga_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
|
|
|
virtual void redraw_area(unsigned x0, unsigned y0,
|
|
|
|
unsigned width, unsigned height) {
|
|
|
|
STUBFUNC(vga, redraw_area);
|
|
|
|
}
|
|
|
|
virtual Bit8u mem_read(Bit32u addr) {
|
|
|
|
STUBFUNC(vga, mem_read); return 0;
|
|
|
|
}
|
|
|
|
virtual void mem_write(Bit32u addr, Bit8u value) {
|
|
|
|
STUBFUNC(vga, mem_write);
|
|
|
|
}
|
|
|
|
virtual void get_text_snapshot(Bit8u **text_snapshot,
|
|
|
|
unsigned *txHeight, unsigned *txWidth) {
|
|
|
|
STUBFUNC(vga, get_text_snapshot);
|
|
|
|
}
|
|
|
|
virtual void trigger_timer(void *this_ptr) {
|
|
|
|
STUBFUNC(vga, trigger_timer);
|
|
|
|
}
|
|
|
|
virtual void set_update_interval (unsigned interval) {
|
|
|
|
STUBFUNC(vga, set_update_interval);
|
|
|
|
}
|
2002-12-28 14:49:17 +03:00
|
|
|
virtual Bit8u get_actl_palette_idx(Bit8u index) {
|
|
|
|
return 0;
|
|
|
|
}
|
2002-10-25 01:07:56 +04:00
|
|
|
};
|
|
|
|
|
2002-11-09 23:51:40 +03:00
|
|
|
class BOCHSAPI bx_pci_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
|
|
|
virtual bx_bool register_pci_handlers(void *this_ptr,
|
|
|
|
Bit32u (*bx_pci_read_handler)(void *, Bit8u, unsigned),
|
|
|
|
void(*bx_pci_write_handler)(void *, Bit8u, Bit32u, unsigned),
|
2004-06-29 23:24:34 +04:00
|
|
|
Bit8u *devfunc, const char *name,
|
|
|
|
const char *descr) {
|
2002-11-09 23:51:40 +03:00
|
|
|
STUBFUNC(pci, register_pci_handlers); return 0;
|
|
|
|
}
|
2004-06-29 23:24:34 +04:00
|
|
|
virtual bx_bool is_pci_device (const char *name) {
|
|
|
|
return 0;
|
2004-01-15 05:08:37 +03:00
|
|
|
}
|
2002-11-09 23:51:40 +03:00
|
|
|
virtual Bit8u rd_memType (Bit32u addr) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
virtual Bit8u wr_memType (Bit32u addr) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
virtual void print_i440fx_state(void) {}
|
|
|
|
};
|
|
|
|
|
2004-07-02 02:18:20 +04:00
|
|
|
class BOCHSAPI bx_pci2isa_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
2004-07-04 21:10:05 +04:00
|
|
|
virtual void pci_set_irq (Bit8u devfunc, unsigned line, bx_bool level) {
|
2004-07-02 02:18:20 +04:00
|
|
|
STUBFUNC(pci2isa, pci_set_irq);
|
|
|
|
}
|
2004-07-04 21:10:05 +04:00
|
|
|
virtual void pci_init_irq (Bit8u devfunc, unsigned line, unsigned irq) {
|
|
|
|
STUBFUNC(pci2isa, pci_init_irq);
|
|
|
|
}
|
2004-07-02 02:18:20 +04:00
|
|
|
};
|
|
|
|
|
2002-11-19 21:56:39 +03:00
|
|
|
class BOCHSAPI bx_ne2k_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
|
|
|
virtual void print_info(FILE *file, int page, int reg, int nodups) {}
|
|
|
|
};
|
|
|
|
|
2004-02-02 02:42:04 +03:00
|
|
|
class BOCHSAPI bx_speaker_stub_c : public bx_devmodel_c {
|
|
|
|
public:
|
|
|
|
virtual void beep_on(float frequency) {}
|
|
|
|
virtual void beep_off() {}
|
|
|
|
};
|
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
class BOCHSAPI bx_devices_c : public logfunctions {
|
2001-04-10 05:04:59 +04:00
|
|
|
public:
|
|
|
|
bx_devices_c(void);
|
|
|
|
~bx_devices_c(void);
|
2002-08-27 23:54:46 +04:00
|
|
|
// Register I/O addresses and IRQ lines. Initialize any internal
|
|
|
|
// structures. init() is called only once, even if the simulator
|
|
|
|
// reboots or is restarted.
|
2001-05-23 11:48:11 +04:00
|
|
|
void init(BX_MEM_C *);
|
2002-08-27 23:54:46 +04:00
|
|
|
// Enter reset state in response to a reset condition.
|
|
|
|
// The types of reset conditions are defined in bochs.h:
|
|
|
|
// power-on, hardware, or software.
|
|
|
|
void reset(unsigned type);
|
2001-05-23 11:48:11 +04:00
|
|
|
BX_MEM_C *mem; // address space associated with these devices
|
2004-01-15 05:08:37 +03:00
|
|
|
bx_bool register_io_read_handler(void *this_ptr, bx_read_handler_t f,
|
|
|
|
Bit32u addr, const char *name, Bit8u mask );
|
|
|
|
bx_bool unregister_io_read_handler( void *this_ptr, bx_read_handler_t f,
|
|
|
|
Bit32u addr, Bit8u mask );
|
2003-07-31 16:04:48 +04:00
|
|
|
bx_bool register_io_write_handler(void *this_ptr, bx_write_handler_t f, Bit32u addr, const char *name, Bit8u mask );
|
2004-01-15 05:08:37 +03:00
|
|
|
bx_bool unregister_io_write_handler( void *this_ptr, bx_write_handler_t f,
|
|
|
|
Bit32u addr, Bit8u mask );
|
|
|
|
bx_bool register_io_read_handler_range( void *this_ptr, bx_read_handler_t f,
|
|
|
|
Bit32u begin_addr, Bit32u end_addr,
|
|
|
|
const char *name, Bit8u mask );
|
|
|
|
bx_bool register_io_write_handler_range( void *this_ptr, bx_write_handler_t f,
|
|
|
|
Bit32u begin_addr, Bit32u end_addr,
|
|
|
|
const char *name, Bit8u mask );
|
|
|
|
bx_bool unregister_io_read_handler_range( void *this_ptr, bx_read_handler_t f,
|
|
|
|
Bit32u begin, Bit32u end, Bit8u mask );
|
|
|
|
bx_bool unregister_io_write_handler_range( void *this_ptr, bx_write_handler_t f,
|
|
|
|
Bit32u begin, Bit32u end, Bit8u mask );
|
2003-07-31 16:04:48 +04:00
|
|
|
bx_bool register_default_io_read_handler(void *this_ptr, bx_read_handler_t f, const char *name, Bit8u mask );
|
|
|
|
bx_bool register_default_io_write_handler(void *this_ptr, bx_write_handler_t f, const char *name, Bit8u mask );
|
2002-10-25 15:44:41 +04:00
|
|
|
bx_bool register_irq(unsigned irq, const char *name);
|
|
|
|
bx_bool unregister_irq(unsigned irq, const char *name);
|
2001-04-10 05:04:59 +04:00
|
|
|
void iodev_init(void);
|
2003-03-03 02:59:12 +03:00
|
|
|
Bit32u inp(Bit16u addr, unsigned io_len) BX_CPP_AttrRegparmN(2);
|
|
|
|
void outp(Bit16u addr, Bit32u value, unsigned io_len) BX_CPP_AttrRegparmN(3);
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
static void timer_handler(void *);
|
|
|
|
void timer(void);
|
|
|
|
|
2004-02-02 02:42:04 +03:00
|
|
|
bx_devmodel_c *pluginBiosDevice;
|
|
|
|
bx_ioapic_c *ioapic;
|
|
|
|
bx_pci_stub_c *pluginPciBridge;
|
2004-07-02 02:18:20 +04:00
|
|
|
bx_pci2isa_stub_c *pluginPci2IsaBridge;
|
2004-06-10 00:55:58 +04:00
|
|
|
bx_devmodel_c *pluginPciIdeController;
|
2004-02-02 02:42:04 +03:00
|
|
|
bx_devmodel_c *pluginPciVgaAdapter;
|
|
|
|
bx_devmodel_c *pluginPciDevAdapter;
|
|
|
|
bx_devmodel_c *pluginPciUSBAdapter;
|
|
|
|
bx_devmodel_c *pluginPciPNicAdapter;
|
|
|
|
bx_pit_c *pit;
|
|
|
|
bx_keyb_stub_c *pluginKeyboard;
|
|
|
|
bx_dma_stub_c *pluginDmaDevice;
|
|
|
|
bx_floppy_stub_c *pluginFloppyDevice;
|
|
|
|
bx_cmos_stub_c *pluginCmosDevice;
|
|
|
|
bx_devmodel_c *pluginSerialDevice;
|
|
|
|
bx_devmodel_c *pluginParallelDevice;
|
|
|
|
bx_devmodel_c *pluginUnmapped;
|
|
|
|
bx_vga_stub_c *pluginVgaDevice;
|
|
|
|
bx_pic_stub_c *pluginPicDevice;
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_hard_drive_stub_c *pluginHardDrive;
|
2004-02-02 02:42:04 +03:00
|
|
|
bx_devmodel_c *pluginSB16Device;
|
|
|
|
bx_ne2k_stub_c *pluginNE2kDevice;
|
|
|
|
bx_g2h_c *g2h;
|
|
|
|
bx_devmodel_c *pluginExtFpuIrq;
|
|
|
|
bx_devmodel_c *pluginGameport;
|
|
|
|
bx_speaker_stub_c *pluginSpeaker;
|
2001-09-14 19:01:29 +04:00
|
|
|
#if BX_IODEBUG_SUPPORT
|
2004-02-02 02:42:04 +03:00
|
|
|
bx_iodebug_c *iodebug;
|
2001-09-14 19:01:29 +04:00
|
|
|
#endif
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
// stub classes that the pointers (above) can point to until a plugin is
|
|
|
|
// loaded
|
|
|
|
bx_cmos_stub_c stubCmos;
|
|
|
|
bx_keyb_stub_c stubKeyboard;
|
|
|
|
bx_hard_drive_stub_c stubHardDrive;
|
|
|
|
bx_dma_stub_c stubDma;
|
|
|
|
bx_pic_stub_c stubPic;
|
|
|
|
bx_floppy_stub_c stubFloppy;
|
|
|
|
bx_vga_stub_c stubVga;
|
2002-11-09 23:51:40 +03:00
|
|
|
bx_pci_stub_c stubPci;
|
2004-07-02 02:18:20 +04:00
|
|
|
bx_pci2isa_stub_c stubPci2Isa;
|
2002-11-19 21:56:39 +03:00
|
|
|
bx_ne2k_stub_c stubNE2k;
|
2004-02-03 00:47:26 +03:00
|
|
|
bx_speaker_stub_c stubSpeaker;
|
2002-10-25 01:07:56 +04:00
|
|
|
|
2002-09-09 20:56:56 +04:00
|
|
|
// Some info to pass to devices which can handled bulk IO. This allows
|
|
|
|
// the interface to remain the same for IO devices which can't handle
|
|
|
|
// bulk IO. We should probably implement special INPBulk() and OUTBulk()
|
|
|
|
// functions which stick these values in the bx_devices_c class, and
|
|
|
|
// then call the normal functions rather than having gross globals
|
|
|
|
// variables.
|
|
|
|
Bit32u bulkIOHostAddr;
|
|
|
|
unsigned bulkIOQuantumsRequested;
|
|
|
|
unsigned bulkIOQuantumsTransferred;
|
|
|
|
|
2001-04-10 05:04:59 +04:00
|
|
|
private:
|
2002-10-25 01:07:56 +04:00
|
|
|
|
2004-01-15 05:08:37 +03:00
|
|
|
struct io_handler_struct {
|
|
|
|
struct io_handler_struct *next;
|
|
|
|
struct io_handler_struct *prev;
|
|
|
|
void *funct; // C++ type checking is great, but annoying
|
|
|
|
void *this_ptr;
|
|
|
|
const char *handler_name; // name of device
|
|
|
|
int usage_count;
|
|
|
|
Bit8u mask; // io_len mask
|
|
|
|
};
|
|
|
|
struct io_handler_struct io_read_handlers;
|
|
|
|
struct io_handler_struct io_write_handlers;
|
|
|
|
#define PORTS 0x10000
|
|
|
|
struct io_handler_struct **read_port_to_handler;
|
|
|
|
struct io_handler_struct **write_port_to_handler;
|
|
|
|
|
2001-04-10 05:04:59 +04:00
|
|
|
// more for informative purposes, the names of the devices which
|
|
|
|
// are use each of the IRQ 0..15 lines are stored here
|
|
|
|
const char *irq_handler_name[BX_MAX_IRQS];
|
|
|
|
|
|
|
|
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);
|
|
|
|
BX_DEV_SMF Bit32u port92_read(Bit32u address, unsigned io_len);
|
|
|
|
BX_DEV_SMF void port92_write(Bit32u address, Bit32u value, unsigned io_len);
|
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
static Bit32u default_read_handler(void *this_ptr, Bit32u address, unsigned io_len);
|
|
|
|
static void default_write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
|
|
|
|
|
2001-04-10 05:04:59 +04:00
|
|
|
int timer_handle;
|
2002-10-25 15:44:41 +04:00
|
|
|
bx_bool is_serial_enabled ();
|
2003-01-28 19:58:10 +03:00
|
|
|
bx_bool is_usb_enabled ();
|
2002-10-25 15:44:41 +04:00
|
|
|
bx_bool is_parallel_enabled ();
|
2001-04-10 05:04:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-11-09 23:51:40 +03:00
|
|
|
#if BX_PCI_SUPPORT
|
2001-04-10 05:04:59 +04:00
|
|
|
#include "iodev/pci.h"
|
2002-09-16 23:18:58 +04:00
|
|
|
#include "iodev/pci2isa.h"
|
2004-06-10 00:55:58 +04:00
|
|
|
#include "iodev/pci_ide.h"
|
2003-01-11 01:43:54 +03:00
|
|
|
#if BX_PCI_VGA_SUPPORT
|
|
|
|
#include "iodev/pcivga.h"
|
|
|
|
#endif
|
2004-01-15 05:08:37 +03:00
|
|
|
#if BX_PCI_DEV_SUPPORT
|
|
|
|
#include "iodev/pcidev.h"
|
|
|
|
#endif
|
2003-01-28 19:58:10 +03:00
|
|
|
#if BX_PCI_USB_SUPPORT
|
|
|
|
#include "iodev/pciusb.h"
|
|
|
|
#endif
|
2002-11-09 23:51:40 +03:00
|
|
|
#endif
|
2002-10-26 17:14:11 +04:00
|
|
|
#include "iodev/vga.h"
|
2001-06-12 17:07:43 +04:00
|
|
|
#if BX_SUPPORT_APIC
|
2001-05-23 11:48:11 +04:00
|
|
|
# include "iodev/ioapic.h"
|
|
|
|
#endif
|
2002-04-02 01:53:23 +04:00
|
|
|
#include "iodev/biosdev.h"
|
2001-04-10 05:04:59 +04:00
|
|
|
#include "iodev/cmos.h"
|
|
|
|
#include "iodev/dma.h"
|
|
|
|
#include "iodev/floppy.h"
|
|
|
|
#include "iodev/harddrv.h"
|
2003-05-03 20:37:18 +04:00
|
|
|
#include "iodev/vmware3.h"
|
2001-09-14 19:01:29 +04:00
|
|
|
#if BX_IODEBUG_SUPPORT
|
|
|
|
# include "iodev/iodebug.h"
|
|
|
|
#endif
|
2001-04-10 05:04:59 +04:00
|
|
|
#include "iodev/keyboard.h"
|
|
|
|
#include "iodev/parallel.h"
|
|
|
|
#include "iodev/pic.h"
|
|
|
|
#include "iodev/pit.h"
|
2001-07-02 00:49:46 +04:00
|
|
|
#include "iodev/pit_wrap.h"
|
2003-02-17 06:58:29 +03:00
|
|
|
#include "iodev/virt_timer.h"
|
2001-04-10 05:04:59 +04:00
|
|
|
#include "iodev/serial.h"
|
|
|
|
#if BX_SUPPORT_SB16
|
|
|
|
# include "iodev/sb16.h"
|
|
|
|
#endif
|
|
|
|
#include "iodev/unmapped.h"
|
|
|
|
#include "iodev/eth.h"
|
|
|
|
#include "iodev/ne2k.h"
|
2004-01-13 22:21:21 +03:00
|
|
|
#if BX_PCI_PNIC_SUPPORT
|
|
|
|
#include "iodev/pcipnic.h"
|
|
|
|
#endif
|
2001-04-10 05:04:59 +04:00
|
|
|
#include "iodev/guest2host.h"
|
2001-08-18 07:28:23 +04:00
|
|
|
#include "iodev/slowdown_timer.h"
|
2003-01-06 05:20:47 +03:00
|
|
|
#include "iodev/extfpuirq.h"
|
2003-06-21 16:55:19 +04:00
|
|
|
#include "iodev/gameport.h"
|
2004-02-02 02:42:04 +03:00
|
|
|
#include "iodev/speaker.h"
|
2004-06-19 19:20:15 +04:00
|
|
|
|
|
|
|
#if ( BX_PROVIDE_DEVICE_MODELS==1 )
|
|
|
|
BOCHSAPI extern bx_devices_c bx_devices;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* IODEV_H */
|