Style and indent changes
This commit is contained in:
parent
c66191bd13
commit
242c2fa51c
@ -1,5 +1,5 @@
|
||||
|
||||
// $Id: biosdev.h,v 1.4 2004-09-05 17:55:12 vruppert Exp $
|
||||
// $Id: biosdev.h,v 1.5 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -25,8 +25,10 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
#define BX_BIOS_MESSAGE_SIZE 80
|
||||
#ifndef BX_IODEV_BIOSDEV_H
|
||||
#define BX_IODEV_BIOSDEV_H
|
||||
|
||||
#define BX_BIOS_MESSAGE_SIZE 80
|
||||
|
||||
#if BX_USE_BIOS_SMF
|
||||
# define BX_BIOS_SMF static
|
||||
@ -36,11 +38,10 @@
|
||||
# define BX_BIOS_THIS this->
|
||||
#endif
|
||||
|
||||
|
||||
class bx_biosdev_c : public bx_devmodel_c {
|
||||
public:
|
||||
bx_biosdev_c(void);
|
||||
~bx_biosdev_c(void);
|
||||
bx_biosdev_c();
|
||||
~bx_biosdev_c();
|
||||
|
||||
virtual void init(void);
|
||||
virtual void reset (unsigned type);
|
||||
@ -60,6 +61,7 @@ private:
|
||||
Bit8u vgabios_message[BX_BIOS_MESSAGE_SIZE];
|
||||
unsigned int vgabios_message_i;
|
||||
bx_bool vgabios_panic_flag;
|
||||
} s; // state information
|
||||
} s; // state information
|
||||
};
|
||||
|
||||
};
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cdrom.cc,v 1.87 2005-12-27 13:21:25 vruppert Exp $
|
||||
// $Id: cdrom.cc,v 1.88 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -31,6 +31,8 @@
|
||||
// ioctl() calls and such. Should be fairly easy to add support
|
||||
// for your OS if it is not supported yet.
|
||||
|
||||
#ifndef BX_IODEV_CDROM_H
|
||||
#define BX_IODEV_CDROM_H
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||
@ -530,7 +532,7 @@ cdrom_interface::cdrom_interface(char *dev)
|
||||
|
||||
void
|
||||
cdrom_interface::init(void) {
|
||||
BX_DEBUG(("Init $Id: cdrom.cc,v 1.87 2005-12-27 13:21:25 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: cdrom.cc,v 1.88 2006-03-07 18:16:40 sshwarts Exp $"));
|
||||
BX_INFO(("file = '%s'",path));
|
||||
}
|
||||
|
||||
@ -1484,3 +1486,5 @@ void cdrom_interface::seek(int lba)
|
||||
}
|
||||
|
||||
#endif /* if BX_SUPPORT_CDROM */
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cmos.h,v 1.13 2005-12-04 17:43:09 vruppert Exp $
|
||||
// $Id: cmos.h,v 1.14 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -24,6 +24,8 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_CMOS_H
|
||||
#define BX_IODEV_CMOS_H
|
||||
|
||||
#if BX_USE_CMOS_SMF
|
||||
# define BX_CMOS_SMF static
|
||||
@ -36,8 +38,8 @@
|
||||
|
||||
class bx_cmos_c : public bx_cmos_stub_c {
|
||||
public:
|
||||
bx_cmos_c(void);
|
||||
~bx_cmos_c(void);
|
||||
bx_cmos_c();
|
||||
~bx_cmos_c();
|
||||
|
||||
virtual void init(void);
|
||||
virtual void checksum_cmos(void);
|
||||
@ -87,4 +89,6 @@ private:
|
||||
BX_CMOS_SMF void update_clock(void);
|
||||
BX_CMOS_SMF void update_timeval(void);
|
||||
BX_CMOS_SMF void CRA_change(void);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: crc32.h,v 1.4 2004-09-05 10:30:18 vruppert Exp $
|
||||
// $Id: crc32.h,v 1.5 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/* CRC-32 calculator
|
||||
@ -9,7 +9,7 @@
|
||||
#ifndef _CRC_32_H_
|
||||
#define _CRC_32_H_
|
||||
|
||||
#include "../config.h"
|
||||
#include "config.h"
|
||||
|
||||
class CRC_Generator {
|
||||
private:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: dma.h,v 1.17 2005-04-06 21:09:25 vruppert Exp $
|
||||
// $Id: dma.h,v 1.18 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -37,13 +37,10 @@
|
||||
# define BX_DMA_THIS this->
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
class bx_dma_c : public bx_dma_stub_c {
|
||||
public:
|
||||
|
||||
bx_dma_c();
|
||||
~bx_dma_c(void);
|
||||
~bx_dma_c();
|
||||
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
@ -87,15 +84,15 @@ private:
|
||||
Bit8u address_decrement;
|
||||
Bit8u autoinit_enable;
|
||||
Bit8u transfer_type;
|
||||
} mode;
|
||||
} mode;
|
||||
Bit16u base_address;
|
||||
Bit16u current_address;
|
||||
Bit16u base_count;
|
||||
Bit16u current_count;
|
||||
Bit8u page_reg;
|
||||
bx_bool used;
|
||||
} chan[4]; /* DMA channels 0..3 */
|
||||
} s[2]; // state information DMA-1 / DMA-2
|
||||
} chan[4]; /* DMA channels 0..3 */
|
||||
} s[2]; // state information DMA-1 / DMA-2
|
||||
|
||||
bx_bool HLDA; // Hold Acknowlege
|
||||
bx_bool TC; // Terminal Count
|
||||
@ -107,8 +104,7 @@ private:
|
||||
void (* dmaWrite8)(Bit8u *data_byte);
|
||||
void (* dmaRead16)(Bit16u *data_word);
|
||||
void (* dmaWrite16)(Bit16u *data_word);
|
||||
} h[4]; // DMA read and write handlers
|
||||
|
||||
};
|
||||
} h[4]; // DMA read and write handlers
|
||||
};
|
||||
|
||||
#endif // #ifndef _PCDMA_H
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: extfpuirq.cc,v 1.6 2004-06-19 15:20:11 sshwarts Exp $
|
||||
// $Id: extfpuirq.cc,v 1.7 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -48,8 +48,7 @@ libextfpuirq_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char
|
||||
return(0); // Success
|
||||
}
|
||||
|
||||
void
|
||||
libextfpuirq_LTX_plugin_fini(void)
|
||||
void libextfpuirq_LTX_plugin_fini(void)
|
||||
{
|
||||
}
|
||||
|
||||
@ -62,40 +61,32 @@ bx_extfpuirq_c::bx_extfpuirq_c(void)
|
||||
bx_extfpuirq_c::~bx_extfpuirq_c(void)
|
||||
{
|
||||
// nothing for now
|
||||
BX_DEBUG(("Exit."));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bx_extfpuirq_c::init(void)
|
||||
void bx_extfpuirq_c::init(void)
|
||||
{
|
||||
// called once when bochs initializes
|
||||
DEV_register_iowrite_handler(this, write_handler, 0x00F0, "External FPU IRQ", 1);
|
||||
DEV_register_irq(13, "External FPU IRQ");
|
||||
}
|
||||
|
||||
void
|
||||
bx_extfpuirq_c::reset(unsigned type)
|
||||
void bx_extfpuirq_c::reset(unsigned type)
|
||||
{
|
||||
// We should handle IGNNE here
|
||||
DEV_pic_lower_irq(13);
|
||||
}
|
||||
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
void
|
||||
bx_extfpuirq_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_extfpuirq_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_EFI_SMF
|
||||
bx_extfpuirq_c *class_ptr = (bx_extfpuirq_c *) this_ptr;
|
||||
|
||||
class_ptr->write(address, value, io_len);
|
||||
}
|
||||
|
||||
void
|
||||
bx_extfpuirq_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_extfpuirq_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -104,4 +95,3 @@ bx_extfpuirq_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
// We should handle IGNNE here
|
||||
DEV_pic_lower_irq(13);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: extfpuirq.h,v 1.2 2003-01-07 08:17:15 cbothamy Exp $
|
||||
// $Id: extfpuirq.h,v 1.3 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -24,6 +24,9 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_EXTFPUIRQ_H
|
||||
#define BX_IODEV_EXTFPUIRQ_H
|
||||
|
||||
|
||||
#if BX_USE_EFI_SMF
|
||||
# define BX_EXTFPUIRQ_SMF static
|
||||
@ -35,10 +38,9 @@
|
||||
|
||||
|
||||
class bx_extfpuirq_c : public bx_devmodel_c {
|
||||
|
||||
public:
|
||||
bx_extfpuirq_c(void);
|
||||
~bx_extfpuirq_c(void);
|
||||
bx_extfpuirq_c();
|
||||
~bx_extfpuirq_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
|
||||
@ -48,4 +50,6 @@ private:
|
||||
#if !BX_USE_EFI_SMF
|
||||
void write(Bit32u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: floppy.h,v 1.26 2005-11-22 18:34:51 vruppert Exp $
|
||||
// $Id: floppy.h,v 1.27 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -24,7 +24,8 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
#ifndef BX_IODEV_FLOPPY_H
|
||||
#define BX_IODEV_FLOPPY_H
|
||||
|
||||
#define FROM_FLOPPY 10
|
||||
#define TO_FLOPPY 11
|
||||
@ -197,4 +198,6 @@ typedef struct _BLOCK_DEV_PARAMS {
|
||||
} BLOCK_DEV_PARAMS, *PBLOCK_DEV_PARAMS;
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gameport.cc,v 1.6 2004-06-19 15:20:11 sshwarts Exp $
|
||||
// $Id: gameport.cc,v 1.7 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2003 MandrakeSoft S.A.
|
||||
@ -59,8 +59,7 @@ UINT STDCALL joyGetPos(UINT, LPJOYINFO);
|
||||
|
||||
bx_gameport_c *theGameport = NULL;
|
||||
|
||||
int
|
||||
libgameport_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
int libgameport_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
theGameport = new bx_gameport_c ();
|
||||
bx_devices.pluginGameport = theGameport;
|
||||
@ -68,26 +67,23 @@ libgameport_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char
|
||||
return(0); // Success
|
||||
}
|
||||
|
||||
void
|
||||
libgameport_LTX_plugin_fini(void)
|
||||
void libgameport_LTX_plugin_fini(void)
|
||||
{
|
||||
}
|
||||
|
||||
bx_gameport_c::bx_gameport_c(void)
|
||||
bx_gameport_c::bx_gameport_c()
|
||||
{
|
||||
put("GAME");
|
||||
settype(EXTFPUIRQLOG);
|
||||
}
|
||||
|
||||
bx_gameport_c::~bx_gameport_c(void)
|
||||
bx_gameport_c::~bx_gameport_c()
|
||||
{
|
||||
if (joyfd >= 0) close(joyfd);
|
||||
BX_DEBUG(("Exit."));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bx_gameport_c::init(void)
|
||||
void bx_gameport_c::init(void)
|
||||
{
|
||||
// Allocate the gameport IO address range 0x200..0x207
|
||||
for (unsigned addr=0x200; addr<0x208; addr++) {
|
||||
@ -117,14 +113,12 @@ bx_gameport_c::init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
bx_gameport_c::reset(unsigned type)
|
||||
void bx_gameport_c::reset(unsigned type)
|
||||
{
|
||||
// nothing for now
|
||||
}
|
||||
|
||||
void
|
||||
bx_gameport_c::poll_joydev(void)
|
||||
void bx_gameport_c::poll_joydev(void)
|
||||
{
|
||||
#ifdef __linux__
|
||||
struct js_event e;
|
||||
@ -172,22 +166,17 @@ bx_gameport_c::poll_joydev(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
Bit32u
|
||||
bx_gameport_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
Bit32u bx_gameport_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_GAME_SMF
|
||||
bx_gameport_c *class_ptr = (bx_gameport_c *) this_ptr;
|
||||
|
||||
return( class_ptr->read(address, io_len) );
|
||||
return class_ptr->read(address, io_len);
|
||||
}
|
||||
|
||||
|
||||
Bit32u
|
||||
bx_gameport_c::read(Bit32u address, unsigned io_len)
|
||||
Bit32u bx_gameport_c::read(Bit32u address, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -216,20 +205,17 @@ bx_gameport_c::read(Bit32u address, unsigned io_len)
|
||||
}
|
||||
|
||||
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
void
|
||||
bx_gameport_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_gameport_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_GAME_SMF
|
||||
bx_gameport_c *class_ptr = (bx_gameport_c *) this_ptr;
|
||||
|
||||
class_ptr->write(address, value, io_len);
|
||||
}
|
||||
|
||||
void
|
||||
bx_gameport_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_gameport_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gameport.h,v 1.1 2003-06-21 12:55:19 vruppert Exp $
|
||||
// $Id: gameport.h,v 1.2 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2003 MandrakeSoft S.A.
|
||||
@ -24,6 +24,8 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_GAMEPORT_H
|
||||
#define BX_IODEV_GAMEPORT_H
|
||||
|
||||
#if BX_USE_GAME_SMF
|
||||
# define BX_GAMEPORT_SMF static
|
||||
@ -35,10 +37,9 @@
|
||||
|
||||
|
||||
class bx_gameport_c : public bx_devmodel_c {
|
||||
|
||||
public:
|
||||
bx_gameport_c(void);
|
||||
~bx_gameport_c(void);
|
||||
bx_gameport_c();
|
||||
~bx_gameport_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
|
||||
@ -60,4 +61,6 @@ private:
|
||||
Bit32u read(Bit32u address, unsigned io_len);
|
||||
void write(Bit32u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: guest2host.cc,v 1.14 2004-06-19 15:20:12 sshwarts Exp $
|
||||
// $Id: guest2host.cc,v 1.15 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
bx_g2h_c bx_g2h;
|
||||
|
||||
bx_g2h_c::bx_g2h_c(void)
|
||||
bx_g2h_c::bx_g2h_c()
|
||||
{
|
||||
put("G2H");
|
||||
settype(G2HLOG);
|
||||
@ -40,36 +40,32 @@ bx_g2h_c::bx_g2h_c(void)
|
||||
for (i=0; i<BX_MAX_G2H_CHANNELS; i++) {
|
||||
s.callback[i].f = NULL;
|
||||
s.callback[i].used = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bx_g2h_c::~bx_g2h_c(void)
|
||||
bx_g2h_c::~bx_g2h_c()
|
||||
{
|
||||
// nothing for now
|
||||
BX_DEBUG(("Exit."));
|
||||
}
|
||||
|
||||
void
|
||||
bx_g2h_c::init(void)
|
||||
void bx_g2h_c::init(void)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: guest2host.cc,v 1.14 2004-06-19 15:20:12 sshwarts Exp $"));
|
||||
BX_DEBUG(("Init $Id: guest2host.cc,v 1.15 2006-03-07 18:16:40 sshwarts Exp $"));
|
||||
// Reserve a dword port for this interface
|
||||
for (Bit32u addr=BX_G2H_PORT; addr<=(BX_G2H_PORT+3); addr++) {
|
||||
bx_devices.register_io_read_handler(&bx_g2h,
|
||||
inp_handler, addr, "g2h");
|
||||
bx_devices.register_io_write_handler(&bx_g2h,
|
||||
outp_handler, addr, "g2h");
|
||||
}
|
||||
}
|
||||
memset(&bx_g2h.s, 0, sizeof(bx_g2h.s));
|
||||
}
|
||||
|
||||
void
|
||||
bx_g2h_c::reset(unsigned type)
|
||||
void bx_g2h_c::reset(unsigned type)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned
|
||||
bx_g2h_c::acquire_channel(bx_g2h_callback_t f)
|
||||
unsigned bx_g2h_c::acquire_channel(bx_g2h_callback_t f)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
@ -78,32 +74,30 @@ bx_g2h_c::acquire_channel(bx_g2h_callback_t f)
|
||||
bx_g2h.s.callback[i].f = f;
|
||||
bx_g2h.s.callback[i].used = 1;
|
||||
return(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BX_INFO(("g2h: attempt to acquire channel: maxed out"));
|
||||
return(BX_G2H_ERROR); // No more free channels
|
||||
return BX_G2H_ERROR; // No more free channels
|
||||
}
|
||||
|
||||
unsigned
|
||||
bx_g2h_c::deacquire_channel(unsigned channel)
|
||||
unsigned bx_g2h_c::deacquire_channel(unsigned channel)
|
||||
{
|
||||
if ( (channel >= BX_MAX_G2H_CHANNELS) ||
|
||||
(bx_g2h.s.callback[channel].used==0) ) {
|
||||
BX_PANIC(("g2h: attempt to deacquire channel %u: not acquired",
|
||||
channel));
|
||||
}
|
||||
(bx_g2h.s.callback[channel].used==0) )
|
||||
{
|
||||
BX_PANIC(("g2h: attempt to deacquire channel %u: not acquired", channel));
|
||||
}
|
||||
bx_g2h.s.callback[channel].used = 0;
|
||||
bx_g2h.s.callback[channel].f = NULL;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
Bit32u
|
||||
bx_g2h_c::inp_handler(void *this_ptr, Bit32u addr, unsigned io_len)
|
||||
Bit32u bx_g2h_c::inp_handler(void *this_ptr, Bit32u addr, unsigned io_len)
|
||||
{
|
||||
UNUSED(this_ptr);
|
||||
|
||||
@ -116,11 +110,7 @@ bx_g2h_c::inp_handler(void *this_ptr, Bit32u addr, unsigned io_len)
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
bx_g2h_c::outp_handler(void *this_ptr, Bit32u addr,
|
||||
Bit32u val32, unsigned io_len)
|
||||
void bx_g2h_c::outp_handler(void *this_ptr, Bit32u addr, Bit32u val32, unsigned io_len)
|
||||
{
|
||||
UNUSED(this_ptr);
|
||||
|
||||
@ -132,7 +122,7 @@ bx_g2h_c::outp_handler(void *this_ptr, Bit32u addr,
|
||||
if ( (bx_g2h.s.packet_count==0) && (val32!=BX_G2H_MAGIC) ) {
|
||||
BX_INFO(("g2h: IO W: Not magic header."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
bx_g2h.s.guest_packet[bx_g2h.s.packet_count++] = val32;
|
||||
if (bx_g2h.s.packet_count >= BX_G2H_PACKET_SIZE) {
|
||||
unsigned channel;
|
||||
@ -141,11 +131,11 @@ bx_g2h_c::outp_handler(void *this_ptr, Bit32u addr,
|
||||
channel = bx_g2h.s.guest_packet[1];
|
||||
if (channel >= BX_MAX_G2H_CHANNELS) {
|
||||
BX_PANIC(("g2h: channel (%u) out of bounds", channel));
|
||||
}
|
||||
}
|
||||
if (bx_g2h.s.callback[channel].used==0) {
|
||||
BX_PANIC(("g2h: channel (%u) not active", channel));
|
||||
}
|
||||
}
|
||||
bx_g2h.s.callback[channel].f(&bx_g2h.s.guest_packet);
|
||||
bx_g2h.s.packet_count = 0; // Ready for next packet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: guest2host.h,v 1.8 2002-12-06 18:48:08 bdenney Exp $
|
||||
// $Id: guest2host.h,v 1.9 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -36,18 +36,16 @@
|
||||
#define BX_G2H_PACKET_SIZE 5
|
||||
|
||||
|
||||
|
||||
typedef Bit32u bx_guest_packet_t[BX_G2H_PACKET_SIZE];
|
||||
typedef void (*bx_g2h_callback_t)(bx_guest_packet_t *);
|
||||
|
||||
|
||||
|
||||
class bx_g2h_c : public logfunctions {
|
||||
public:
|
||||
bx_g2h_c(void);
|
||||
~bx_g2h_c(void);
|
||||
static void init(void);
|
||||
void reset (unsigned type);
|
||||
bx_g2h_c();
|
||||
~bx_g2h_c();
|
||||
static void init(void);
|
||||
void reset(unsigned type);
|
||||
unsigned acquire_channel(bx_g2h_callback_t);
|
||||
unsigned deacquire_channel(unsigned channel);
|
||||
|
||||
@ -61,7 +59,7 @@ private:
|
||||
struct {
|
||||
bx_g2h_callback_t f;
|
||||
bx_bool used;
|
||||
} callback[BX_MAX_G2H_CHANNELS];
|
||||
} callback[BX_MAX_G2H_CHANNELS];
|
||||
|
||||
// Define the data received from the guest OS.
|
||||
// dword0: magic number, should be BX_G2H_MAGIC
|
||||
@ -71,7 +69,7 @@ private:
|
||||
// dword4: address of return data structure in guest physical memory
|
||||
unsigned packet_count;
|
||||
bx_guest_packet_t guest_packet;
|
||||
} s;
|
||||
};
|
||||
} s;
|
||||
};
|
||||
|
||||
extern bx_g2h_c bx_g2h;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: harddrv.cc,v 1.163 2006-02-26 19:11:20 vruppert Exp $
|
||||
// $Id: harddrv.cc,v 1.164 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -103,7 +103,7 @@ libharddrv_LTX_plugin_fini(void)
|
||||
{
|
||||
}
|
||||
|
||||
bx_hard_drive_c::bx_hard_drive_c(void)
|
||||
bx_hard_drive_c::bx_hard_drive_c()
|
||||
{
|
||||
#if DLL_HD_SUPPORT
|
||||
# error code must be fixed to use DLL_HD_SUPPORT and 4 ata channels
|
||||
@ -118,27 +118,24 @@ bx_hard_drive_c::bx_hard_drive_c(void)
|
||||
iolight_timer_index = BX_NULL_TIMER_HANDLE;
|
||||
}
|
||||
|
||||
|
||||
bx_hard_drive_c::~bx_hard_drive_c(void)
|
||||
bx_hard_drive_c::~bx_hard_drive_c()
|
||||
{
|
||||
BX_DEBUG(("Exit."));
|
||||
for (Bit8u channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
if (channels[channel].drives[0].hard_drive != NULL ) /* DT 17.12.2001 21:55 */
|
||||
if (channels[channel].drives[0].hard_drive != NULL) /* DT 17.12.2001 21:55 */
|
||||
{
|
||||
delete channels[channel].drives[0].hard_drive;
|
||||
channels[channel].drives[0].hard_drive = NULL;
|
||||
channels[channel].drives[0].hard_drive = NULL;
|
||||
}
|
||||
if ( channels[channel].drives[1].hard_drive != NULL )
|
||||
if ( channels[channel].drives[1].hard_drive != NULL)
|
||||
{
|
||||
delete channels[channel].drives[1].hard_drive;
|
||||
channels[channel].drives[1].hard_drive = NULL; /* DT 17.12.2001 21:56 */
|
||||
channels[channel].drives[1].hard_drive = NULL; /* DT 17.12.2001 21:56 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bx_hard_drive_c::init(void)
|
||||
void bx_hard_drive_c::init(void)
|
||||
{
|
||||
Bit8u channel;
|
||||
char string[5];
|
||||
@ -146,7 +143,7 @@ bx_hard_drive_c::init(void)
|
||||
char ata_name[20];
|
||||
bx_list_c *base;
|
||||
|
||||
BX_DEBUG(("Init $Id: harddrv.cc,v 1.163 2006-02-26 19:11:20 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: harddrv.cc,v 1.164 2006-03-07 18:16:40 sshwarts Exp $"));
|
||||
|
||||
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
sprintf(ata_name, "ata.%d.resources", channel);
|
||||
@ -165,14 +162,14 @@ bx_hard_drive_c::init(void)
|
||||
BX_HD_THIS channels[channel].ioaddr1,
|
||||
BX_HD_THIS channels[channel].ioaddr2,
|
||||
BX_HD_THIS channels[channel].irq));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
BX_HD_THIS channels[channel].ioaddr1 = 0;
|
||||
BX_HD_THIS channels[channel].ioaddr2 = 0;
|
||||
BX_HD_THIS channels[channel].irq = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
sprintf(string ,"ATA%d", channel);
|
||||
@ -190,8 +187,8 @@ bx_hard_drive_c::init(void)
|
||||
BX_HD_THIS channels[channel].ioaddr1+addr, strdup(string), 1);
|
||||
DEV_register_iowrite_handler(this, write_handler,
|
||||
BX_HD_THIS channels[channel].ioaddr1+addr, strdup(string), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We don't want to register addresses 0x3f6 and 0x3f7 as they are handled by the floppy controller
|
||||
if ((BX_HD_THIS channels[channel].ioaddr2 != 0) && (BX_HD_THIS channels[channel].ioaddr2 != 0x3f0)) {
|
||||
@ -200,11 +197,11 @@ bx_hard_drive_c::init(void)
|
||||
BX_HD_THIS channels[channel].ioaddr2+addr, strdup(string), 1);
|
||||
DEV_register_iowrite_handler(this, write_handler,
|
||||
BX_HD_THIS channels[channel].ioaddr2+addr, strdup(string), 1);
|
||||
}
|
||||
}
|
||||
|
||||
BX_HD_THIS channels[channel].drive_select = 0;
|
||||
}
|
||||
|
||||
BX_HD_THIS channels[channel].drive_select = 0;
|
||||
}
|
||||
|
||||
channel = 0;
|
||||
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
@ -600,8 +597,7 @@ bx_hard_drive_c::init(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::reset(unsigned type)
|
||||
void bx_hard_drive_c::reset(unsigned type)
|
||||
{
|
||||
for (unsigned channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
if (BX_HD_THIS channels[channel].irq)
|
||||
@ -609,16 +605,13 @@ bx_hard_drive_c::reset(unsigned type)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::iolight_timer_handler(void *this_ptr)
|
||||
void bx_hard_drive_c::iolight_timer_handler(void *this_ptr)
|
||||
{
|
||||
bx_hard_drive_c *class_ptr = (bx_hard_drive_c *) this_ptr;
|
||||
|
||||
class_ptr->iolight_timer();
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::iolight_timer()
|
||||
void bx_hard_drive_c::iolight_timer()
|
||||
{
|
||||
for (unsigned channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
for (unsigned device=0; device<2; device++) {
|
||||
@ -648,18 +641,14 @@ bx_hard_drive_c::iolight_timer()
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
Bit32u
|
||||
bx_hard_drive_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
Bit32u bx_hard_drive_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_HD_SMF
|
||||
bx_hard_drive_c *class_ptr = (bx_hard_drive_c *) this_ptr;
|
||||
|
||||
return( class_ptr->read(address, io_len) );
|
||||
return class_ptr->read(address, io_len);
|
||||
}
|
||||
|
||||
|
||||
Bit32u
|
||||
bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
Bit32u bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -725,10 +714,10 @@ bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
DEV_bulk_io_host_addr() += transferLen;
|
||||
BX_SELECTED_CONTROLLER(channel).buffer_index += transferLen;
|
||||
value32 = 0; // Value returned not important;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
{
|
||||
value32 = 0L;
|
||||
switch(io_len){
|
||||
case 4:
|
||||
@ -737,9 +726,9 @@ bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
case 2:
|
||||
value32 |= (BX_SELECTED_CONTROLLER(channel).buffer[BX_SELECTED_CONTROLLER(channel).buffer_index+1] << 8);
|
||||
value32 |= BX_SELECTED_CONTROLLER(channel).buffer[BX_SELECTED_CONTROLLER(channel).buffer_index];
|
||||
}
|
||||
BX_SELECTED_CONTROLLER(channel).buffer_index += io_len;
|
||||
}
|
||||
BX_SELECTED_CONTROLLER(channel).buffer_index += io_len;
|
||||
}
|
||||
|
||||
// if buffer completely read
|
||||
if (BX_SELECTED_CONTROLLER(channel).buffer_index >= 512) {
|
||||
@ -760,7 +749,7 @@ bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
|
||||
if (BX_SELECTED_CONTROLLER(channel).sector_count==0) {
|
||||
BX_SELECTED_CONTROLLER(channel).status.drq = 0;
|
||||
}
|
||||
}
|
||||
else { /* read next one into controller buffer */
|
||||
off_t logical_sector;
|
||||
off_t ret;
|
||||
@ -771,13 +760,13 @@ bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
if (!calculate_logical_address(channel, &logical_sector)) {
|
||||
BX_ERROR(("multi-sector read reached invalid sector %lu, aborting", (unsigned long)logical_sector));
|
||||
command_aborted (channel, BX_SELECTED_CONTROLLER(channel).current_command);
|
||||
GOTO_RETURN_VALUE ;
|
||||
GOTO_RETURN_VALUE;
|
||||
}
|
||||
ret = BX_SELECTED_DRIVE(channel).hard_drive->lseek(logical_sector * 512, SEEK_SET);
|
||||
if (ret < 0) {
|
||||
BX_ERROR(("could not lseek() hard drive image file"));
|
||||
command_aborted (channel, BX_SELECTED_CONTROLLER(channel).current_command);
|
||||
GOTO_RETURN_VALUE ;
|
||||
GOTO_RETURN_VALUE;
|
||||
}
|
||||
/* set status bar conditions for device */
|
||||
if (!BX_SELECTED_DRIVE(channel).iolight_counter)
|
||||
@ -789,14 +778,14 @@ bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
BX_ERROR(("logical sector was %lu", (unsigned long)logical_sector));
|
||||
BX_ERROR(("could not read() hard drive image file at byte %lu", (unsigned long)logical_sector*512));
|
||||
command_aborted (channel, BX_SELECTED_CONTROLLER(channel).current_command);
|
||||
GOTO_RETURN_VALUE ;
|
||||
GOTO_RETURN_VALUE;
|
||||
}
|
||||
|
||||
BX_SELECTED_CONTROLLER(channel).buffer_index = 0;
|
||||
raise_interrupt(channel);
|
||||
}
|
||||
}
|
||||
GOTO_RETURN_VALUE ;
|
||||
GOTO_RETURN_VALUE;
|
||||
break;
|
||||
|
||||
case 0xec: // IDENTIFY DEVICE
|
||||
@ -1125,21 +1114,17 @@ bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
return value8;
|
||||
}
|
||||
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
void
|
||||
bx_hard_drive_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_hard_drive_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_HD_SMF
|
||||
bx_hard_drive_c *class_ptr = (bx_hard_drive_c *) this_ptr;
|
||||
|
||||
class_ptr->write(address, value, io_len);
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -2497,7 +2482,7 @@ bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
default:
|
||||
BX_ERROR(("IO write to 0x%04x: unknown command 0x%02x", address, value));
|
||||
command_aborted(channel, value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x16: // hard disk adapter control 0x3f6
|
||||
@ -2565,8 +2550,7 @@ bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::close_harddrive(void)
|
||||
void bx_hard_drive_c::close_harddrive(void)
|
||||
{
|
||||
for (Bit8u channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
if(BX_HD_THIS channels[channel].drives[0].hard_drive != NULL)
|
||||
@ -2576,7 +2560,6 @@ bx_hard_drive_c::close_harddrive(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bx_bool BX_CPP_AttrRegparmN(2)
|
||||
bx_hard_drive_c::calculate_logical_address(Bit8u channel, off_t *sector)
|
||||
{
|
||||
@ -2632,8 +2615,7 @@ bx_hard_drive_c::increment_address(Bit8u channel)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::identify_ATAPI_drive(Bit8u channel)
|
||||
void bx_hard_drive_c::identify_ATAPI_drive(Bit8u channel)
|
||||
{
|
||||
unsigned i;
|
||||
char serial_number[21];
|
||||
@ -2737,8 +2719,7 @@ bx_hard_drive_c::identify_ATAPI_drive(Bit8u channel)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::identify_drive(Bit8u channel)
|
||||
void bx_hard_drive_c::identify_drive(Bit8u channel)
|
||||
{
|
||||
unsigned i;
|
||||
char serial_number[21];
|
||||
@ -3092,7 +3073,7 @@ bx_hard_drive_c::identify_drive(Bit8u channel)
|
||||
temp16 = BX_SELECTED_DRIVE(channel).id_drive[i];
|
||||
BX_SELECTED_CONTROLLER(channel).buffer[i*2] = temp16 & 0x00ff;
|
||||
BX_SELECTED_CONTROLLER(channel).buffer[i*2+1] = temp16 >> 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BX_CPP_AttrRegparmN(3)
|
||||
@ -3149,8 +3130,7 @@ bx_hard_drive_c::init_send_atapi_command(Bit8u channel, Bit8u command, int req_l
|
||||
// }
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::atapi_cmd_error(Bit8u channel, sense_t sense_key, asc_t asc, bx_bool show)
|
||||
void bx_hard_drive_c::atapi_cmd_error(Bit8u channel, sense_t sense_key, asc_t asc, bx_bool show)
|
||||
{
|
||||
if (show) {
|
||||
BX_ERROR(("ata%d-%d: atapi_cmd_error: key=%02x asc=%02x", channel, BX_SLAVE_SELECTED(channel), sense_key, asc));
|
||||
@ -3173,20 +3153,19 @@ bx_hard_drive_c::atapi_cmd_error(Bit8u channel, sense_t sense_key, asc_t asc, bx
|
||||
BX_SELECTED_DRIVE(channel).sense.ascq = 0;
|
||||
}
|
||||
|
||||
void BX_CPP_AttrRegparmN(1)
|
||||
void BX_CPP_AttrRegparmN(1)
|
||||
bx_hard_drive_c::atapi_cmd_nop(Bit8u channel)
|
||||
{
|
||||
BX_SELECTED_CONTROLLER(channel).interrupt_reason.i_o = 1;
|
||||
BX_SELECTED_CONTROLLER(channel).interrupt_reason.c_d = 1;
|
||||
BX_SELECTED_CONTROLLER(channel).interrupt_reason.rel = 0;
|
||||
BX_SELECTED_CONTROLLER(channel).status.busy = 0;
|
||||
BX_SELECTED_CONTROLLER(channel).status.drive_ready = 1;
|
||||
BX_SELECTED_CONTROLLER(channel).status.drq = 0;
|
||||
BX_SELECTED_CONTROLLER(channel).status.err = 0;
|
||||
BX_SELECTED_CONTROLLER(channel).interrupt_reason.i_o = 1;
|
||||
BX_SELECTED_CONTROLLER(channel).interrupt_reason.c_d = 1;
|
||||
BX_SELECTED_CONTROLLER(channel).interrupt_reason.rel = 0;
|
||||
BX_SELECTED_CONTROLLER(channel).status.busy = 0;
|
||||
BX_SELECTED_CONTROLLER(channel).status.drive_ready = 1;
|
||||
BX_SELECTED_CONTROLLER(channel).status.drq = 0;
|
||||
BX_SELECTED_CONTROLLER(channel).status.err = 0;
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::init_mode_sense_single(Bit8u channel, const void* src, int size)
|
||||
void bx_hard_drive_c::init_mode_sense_single(Bit8u channel, const void* src, int size)
|
||||
{
|
||||
char ata_name[20];
|
||||
|
||||
@ -3233,8 +3212,7 @@ bx_hard_drive_c::raise_interrupt(Bit8u channel)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::command_aborted(Bit8u channel, unsigned value)
|
||||
void bx_hard_drive_c::command_aborted(Bit8u channel, unsigned value)
|
||||
{
|
||||
BX_DEBUG(("aborting on command 0x%02x {%s}", value, BX_SELECTED_TYPE_STRING(channel)));
|
||||
BX_SELECTED_CONTROLLER(channel).current_command = 0;
|
||||
@ -3249,39 +3227,35 @@ bx_hard_drive_c::command_aborted(Bit8u channel, unsigned value)
|
||||
raise_interrupt(channel);
|
||||
}
|
||||
|
||||
Bit32u
|
||||
bx_hard_drive_c::get_device_handle(Bit8u channel, Bit8u device)
|
||||
Bit32u bx_hard_drive_c::get_device_handle(Bit8u channel, Bit8u device)
|
||||
{
|
||||
BX_DEBUG(("get_device_handle %d %d",channel, device));
|
||||
if ((channel < BX_MAX_ATA_CHANNEL) && (device < 2)) {
|
||||
return ((channel*2) + device);
|
||||
}
|
||||
}
|
||||
|
||||
return BX_MAX_ATA_CHANNEL*2;
|
||||
}
|
||||
|
||||
Bit32u
|
||||
bx_hard_drive_c::get_first_cd_handle(void)
|
||||
Bit32u bx_hard_drive_c::get_first_cd_handle(void)
|
||||
{
|
||||
for (Bit8u channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
if (BX_DRIVE_IS_CD(channel,0)) return (channel*2);
|
||||
if (BX_DRIVE_IS_CD(channel,1)) return ((channel*2) + 1);
|
||||
}
|
||||
}
|
||||
return BX_MAX_ATA_CHANNEL*2;
|
||||
}
|
||||
|
||||
unsigned
|
||||
bx_hard_drive_c::get_cd_media_status(Bit32u handle)
|
||||
unsigned bx_hard_drive_c::get_cd_media_status(Bit32u handle)
|
||||
{
|
||||
if ( handle >= BX_MAX_ATA_CHANNEL*2 ) return 0;
|
||||
if (handle >= BX_MAX_ATA_CHANNEL*2) return 0;
|
||||
|
||||
Bit8u channel = handle / 2;
|
||||
Bit8u device = handle % 2;
|
||||
return( BX_HD_THIS channels[channel].drives[device].cdrom.ready );
|
||||
}
|
||||
|
||||
unsigned
|
||||
bx_hard_drive_c::set_cd_media_status(Bit32u handle, unsigned status)
|
||||
unsigned bx_hard_drive_c::set_cd_media_status(Bit32u handle, unsigned status)
|
||||
{
|
||||
char ata_name[20];
|
||||
|
||||
@ -3336,8 +3310,7 @@ bx_hard_drive_c::set_cd_media_status(Bit32u handle, unsigned status)
|
||||
return (BX_HD_THIS channels[channel].drives[device].cdrom.ready);
|
||||
}
|
||||
|
||||
bx_bool
|
||||
bx_hard_drive_c::bmdma_present(void)
|
||||
bx_bool bx_hard_drive_c::bmdma_present(void)
|
||||
{
|
||||
#if BX_SUPPORT_PCI
|
||||
if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) {
|
||||
@ -3348,8 +3321,7 @@ bx_hard_drive_c::bmdma_present(void)
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_PCI
|
||||
bx_bool
|
||||
bx_hard_drive_c::bmdma_read_sector(Bit8u channel, Bit8u *buffer, Bit32u *sector_size)
|
||||
bx_bool bx_hard_drive_c::bmdma_read_sector(Bit8u channel, Bit8u *buffer, Bit32u *sector_size)
|
||||
{
|
||||
off_t logical_sector;
|
||||
off_t ret;
|
||||
@ -3413,8 +3385,7 @@ bx_hard_drive_c::bmdma_read_sector(Bit8u channel, Bit8u *buffer, Bit32u *sector_
|
||||
return 1;
|
||||
}
|
||||
|
||||
bx_bool
|
||||
bx_hard_drive_c::bmdma_write_sector(Bit8u channel, Bit8u *buffer)
|
||||
bx_bool bx_hard_drive_c::bmdma_write_sector(Bit8u channel, Bit8u *buffer)
|
||||
{
|
||||
off_t logical_sector;
|
||||
off_t ret;
|
||||
@ -3450,8 +3421,7 @@ bx_hard_drive_c::bmdma_write_sector(Bit8u channel, Bit8u *buffer)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
bx_hard_drive_c::bmdma_complete(Bit8u channel)
|
||||
void bx_hard_drive_c::bmdma_complete(Bit8u channel)
|
||||
{
|
||||
BX_SELECTED_CONTROLLER(channel).status.busy = 0;
|
||||
BX_SELECTED_CONTROLLER(channel).status.drive_ready = 1;
|
||||
@ -3485,31 +3455,28 @@ void bx_hard_drive_c::set_signature(Bit8u channel, Bit8u id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
error_recovery_t::error_recovery_t ()
|
||||
{
|
||||
if (sizeof(error_recovery_t) != 8) {
|
||||
BX_PANIC(("error_recovery_t has size != 8"));
|
||||
}
|
||||
if (sizeof(error_recovery_t) != 8) {
|
||||
BX_PANIC(("error_recovery_t has size != 8"));
|
||||
}
|
||||
|
||||
data[0] = 0x01;
|
||||
data[1] = 0x06;
|
||||
data[2] = 0x00;
|
||||
data[3] = 0x05; // Try to recover 5 times
|
||||
data[4] = 0x00;
|
||||
data[5] = 0x00;
|
||||
data[6] = 0x00;
|
||||
data[7] = 0x00;
|
||||
data[0] = 0x01;
|
||||
data[1] = 0x06;
|
||||
data[2] = 0x00;
|
||||
data[3] = 0x05; // Try to recover 5 times
|
||||
data[4] = 0x00;
|
||||
data[5] = 0x00;
|
||||
data[6] = 0x00;
|
||||
data[7] = 0x00;
|
||||
}
|
||||
|
||||
Bit16u BX_CPP_AttrRegparmN(1)
|
||||
read_16bit(const Bit8u* buf)
|
||||
Bit16u BX_CPP_AttrRegparmN(1) read_16bit(const Bit8u* buf)
|
||||
{
|
||||
return (buf[0] << 8) | buf[1];
|
||||
return (buf[0] << 8) | buf[1];
|
||||
}
|
||||
|
||||
Bit32u BX_CPP_AttrRegparmN(1)
|
||||
read_32bit(const Bit8u* buf)
|
||||
Bit32u BX_CPP_AttrRegparmN(1) read_32bit(const Bit8u* buf)
|
||||
{
|
||||
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
|
||||
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: harddrv.h,v 1.38 2006-02-06 21:27:34 vruppert Exp $
|
||||
// $Id: harddrv.h,v 1.39 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -24,6 +24,9 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_HDDRIVE_H
|
||||
#define BX_IODEV_HDDRIVE_H
|
||||
|
||||
typedef enum _sense {
|
||||
SENSE_NONE = 0, SENSE_NOT_READY = 2, SENSE_ILLEGAL_REQUEST = 5,
|
||||
SENSE_UNIT_ATTENTION = 6
|
||||
@ -153,9 +156,8 @@ typedef enum {
|
||||
|
||||
class bx_hard_drive_c : public bx_hard_drive_stub_c {
|
||||
public:
|
||||
|
||||
bx_hard_drive_c(void);
|
||||
virtual ~bx_hard_drive_c(void);
|
||||
bx_hard_drive_c();
|
||||
virtual ~bx_hard_drive_c();
|
||||
virtual void close_harddrive(void);
|
||||
virtual void init();
|
||||
virtual void reset(unsigned type);
|
||||
@ -236,5 +238,6 @@ private:
|
||||
} channels[BX_MAX_ATA_CHANNEL];
|
||||
|
||||
int iolight_timer_index;
|
||||
};
|
||||
|
||||
};
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: iodev.h,v 1.70 2006-03-06 19:23:13 sshwarts Exp $
|
||||
// $Id: iodev.h,v 1.71 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -259,8 +259,8 @@ class BOCHSAPI bx_vga_stub_c : public bx_devmodel_c {
|
||||
virtual void dump_status(void) {}
|
||||
};
|
||||
|
||||
class BOCHSAPI bx_pci_stub_c : public bx_devmodel_c {
|
||||
public:
|
||||
class BOCHSAPI bx_pci_bridge_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),
|
||||
@ -402,7 +402,7 @@ public:
|
||||
#if BX_SUPPORT_APIC
|
||||
bx_ioapic_c *ioapic;
|
||||
#endif
|
||||
bx_pci_stub_c *pluginPciBridge;
|
||||
bx_pci_bridge_stub_c *pluginPciBridge;
|
||||
bx_pci2isa_stub_c *pluginPci2IsaBridge;
|
||||
bx_pci_ide_stub_c *pluginPciIdeController;
|
||||
bx_devmodel_c *pluginPciVgaAdapter;
|
||||
@ -449,7 +449,7 @@ public:
|
||||
bx_pic_stub_c stubPic;
|
||||
bx_floppy_stub_c stubFloppy;
|
||||
bx_vga_stub_c stubVga;
|
||||
bx_pci_stub_c stubPci;
|
||||
bx_pci_bridge_stub_c stubPci;
|
||||
bx_pci2isa_stub_c stubPci2Isa;
|
||||
bx_pci_ide_stub_c stubPciIde;
|
||||
bx_ne2k_stub_c stubNE2k;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ne2k.h,v 1.16 2004-09-05 10:30:19 vruppert Exp $
|
||||
// $Id: ne2k.h,v 1.17 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -33,6 +33,8 @@
|
||||
// to provide a windowed memory region for the chip and a MAC address.
|
||||
//
|
||||
|
||||
#ifndef BX_IODEV_NE2K
|
||||
#define BX_IODEV_NE2K
|
||||
|
||||
#if BX_USE_NE2K_SMF
|
||||
# define BX_NE2K_SMF static
|
||||
@ -256,3 +258,5 @@ private:
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: parallel.h,v 1.12 2004-01-27 21:38:51 vruppert Exp $
|
||||
// $Id: parallel.h,v 1.13 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -24,6 +24,9 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_PARPORT_H
|
||||
#define BX_IODEV_PARPORT_H
|
||||
|
||||
|
||||
#if BX_USE_PAR_SMF
|
||||
# define BX_PAR_SMF static
|
||||
@ -62,7 +65,6 @@ typedef struct {
|
||||
} bx_par_t;
|
||||
|
||||
|
||||
|
||||
class bx_parallel_c : public bx_devmodel_c {
|
||||
public:
|
||||
|
||||
@ -82,4 +84,6 @@ private:
|
||||
Bit32u read(Bit32u address, unsigned io_len);
|
||||
void write(Bit32u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci.cc,v 1.44 2006-03-03 20:15:07 sshwarts Exp $
|
||||
// $Id: pci.cc,v 1.45 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -38,11 +38,11 @@
|
||||
|
||||
#define LOG_THIS thePciBridge->
|
||||
|
||||
bx_pci_c *thePciBridge = NULL;
|
||||
bx_pci_bridge_c *thePciBridge = NULL;
|
||||
|
||||
int libpci_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
thePciBridge = new bx_pci_c ();
|
||||
thePciBridge = new bx_pci_bridge_c ();
|
||||
bx_devices.pluginPciBridge = thePciBridge;
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePciBridge, BX_PLUGIN_PCI);
|
||||
return(0); // Success
|
||||
@ -52,19 +52,19 @@ void libpci_LTX_plugin_fini(void)
|
||||
{
|
||||
}
|
||||
|
||||
bx_pci_c::bx_pci_c()
|
||||
bx_pci_bridge_c::bx_pci_bridge_c()
|
||||
{
|
||||
put("PCI");
|
||||
settype(PCILOG);
|
||||
}
|
||||
|
||||
bx_pci_c::~bx_pci_c()
|
||||
bx_pci_bridge_c::~bx_pci_bridge_c()
|
||||
{
|
||||
// nothing for now
|
||||
BX_DEBUG(("Exit."));
|
||||
}
|
||||
|
||||
void bx_pci_c::init(void)
|
||||
void bx_pci_bridge_c::init(void)
|
||||
{
|
||||
// called once when bochs initializes
|
||||
unsigned i;
|
||||
@ -111,7 +111,7 @@ void bx_pci_c::init(void)
|
||||
}
|
||||
|
||||
void
|
||||
bx_pci_c::reset(unsigned type)
|
||||
bx_pci_bridge_c::reset(unsigned type)
|
||||
{
|
||||
unsigned i;
|
||||
char devname[80];
|
||||
@ -153,15 +153,15 @@ bx_pci_c::reset(unsigned type)
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
Bit32u bx_pci_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
Bit32u bx_pci_bridge_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCI_SMF
|
||||
bx_pci_c *class_ptr = (bx_pci_c *) this_ptr;
|
||||
bx_pci_bridge_c *class_ptr = (bx_pci_bridge_c *) this_ptr;
|
||||
|
||||
return class_ptr->read(address, io_len);
|
||||
}
|
||||
|
||||
Bit32u bx_pci_c::read(Bit32u address, unsigned io_len)
|
||||
Bit32u bx_pci_bridge_c::read(Bit32u address, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -205,15 +205,15 @@ Bit32u bx_pci_c::read(Bit32u address, unsigned io_len)
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
void bx_pci_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_pci_bridge_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCI_SMF
|
||||
bx_pci_c *class_ptr = (bx_pci_c *) this_ptr;
|
||||
bx_pci_bridge_c *class_ptr = (bx_pci_bridge_c *) this_ptr;
|
||||
|
||||
class_ptr->write(address, value, io_len);
|
||||
}
|
||||
|
||||
void bx_pci_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_pci_bridge_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -265,14 +265,14 @@ void bx_pci_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
// static pci configuration space read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
Bit32u bx_pci_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
|
||||
Bit32u bx_pci_bridge_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCI_SMF
|
||||
bx_pci_c *class_ptr = (bx_pci_c *) this_ptr;
|
||||
bx_pci_bridge_c *class_ptr = (bx_pci_bridge_c *) this_ptr;
|
||||
return class_ptr->pci_read(address, io_len);
|
||||
}
|
||||
|
||||
Bit32u bx_pci_c::pci_read(Bit8u address, unsigned io_len)
|
||||
Bit32u bx_pci_bridge_c::pci_read(Bit8u address, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -294,14 +294,14 @@ Bit32u bx_pci_c::pci_read(Bit8u address, unsigned io_len)
|
||||
// static pci configuration space write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
void bx_pci_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
|
||||
void bx_pci_bridge_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCI_SMF
|
||||
bx_pci_c *class_ptr = (bx_pci_c *) this_ptr;
|
||||
bx_pci_bridge_c *class_ptr = (bx_pci_bridge_c *) this_ptr;
|
||||
class_ptr->pci_write(address, value, io_len);
|
||||
}
|
||||
|
||||
void bx_pci_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
void bx_pci_bridge_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -330,7 +330,7 @@ void bx_pci_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
}
|
||||
|
||||
|
||||
Bit8u bx_pci_c::rd_memType(Bit32u addr)
|
||||
Bit8u bx_pci_bridge_c::rd_memType(Bit32u addr)
|
||||
{
|
||||
switch ((addr & 0xFC000) >> 12) {
|
||||
case 0xC0:
|
||||
@ -374,7 +374,7 @@ Bit8u bx_pci_c::rd_memType(Bit32u addr)
|
||||
return(0); // keep compiler happy
|
||||
}
|
||||
|
||||
Bit8u bx_pci_c::wr_memType(Bit32u addr)
|
||||
Bit8u bx_pci_bridge_c::wr_memType(Bit32u addr)
|
||||
{
|
||||
switch ((addr & 0xFC000) >> 12) {
|
||||
case 0xC0:
|
||||
@ -418,7 +418,7 @@ Bit8u bx_pci_c::wr_memType(Bit32u addr)
|
||||
return(0); // keep compiler happy
|
||||
}
|
||||
|
||||
void bx_pci_c::print_i440fx_state()
|
||||
void bx_pci_bridge_c::print_i440fx_state()
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -437,7 +437,7 @@ void bx_pci_c::print_i440fx_state()
|
||||
}
|
||||
|
||||
bx_bool
|
||||
bx_pci_c::register_pci_handlers( void *this_ptr, bx_pci_read_handler_t f1,
|
||||
bx_pci_bridge_c::register_pci_handlers( void *this_ptr, bx_pci_read_handler_t f1,
|
||||
bx_pci_write_handler_t f2, Bit8u *devfunc,
|
||||
const char *name, const char *descr)
|
||||
{
|
||||
@ -482,7 +482,7 @@ bx_pci_c::register_pci_handlers( void *this_ptr, bx_pci_read_handler_t f1,
|
||||
}
|
||||
}
|
||||
|
||||
bx_bool bx_pci_c::is_pci_device(const char *name)
|
||||
bx_bool bx_pci_bridge_c::is_pci_device(const char *name)
|
||||
{
|
||||
unsigned i;
|
||||
char devname[80];
|
||||
@ -498,7 +498,7 @@ bx_bool bx_pci_c::is_pci_device(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bx_bool bx_pci_c::pci_set_base_mem(void *this_ptr, memory_handler_t f1, memory_handler_t f2,
|
||||
bx_bool bx_pci_bridge_c::pci_set_base_mem(void *this_ptr, memory_handler_t f1, memory_handler_t f2,
|
||||
Bit32u *addr, Bit8u *pci_conf, unsigned size)
|
||||
{
|
||||
Bit32u newbase;
|
||||
@ -525,7 +525,7 @@ bx_bool bx_pci_c::pci_set_base_mem(void *this_ptr, memory_handler_t f1, memory_h
|
||||
return 0;
|
||||
}
|
||||
|
||||
bx_bool bx_pci_c::pci_set_base_io(void *this_ptr, bx_read_handler_t f1, bx_write_handler_t f2,
|
||||
bx_bool bx_pci_bridge_c::pci_set_base_io(void *this_ptr, bx_read_handler_t f1, bx_write_handler_t f2,
|
||||
Bit32u *addr, Bit8u *pci_conf, unsigned size,
|
||||
const Bit8u *iomask, const char *name)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci.h,v 1.22 2006-03-03 20:15:07 sshwarts Exp $
|
||||
// $Id: pci.h,v 1.23 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -24,6 +24,8 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_PCI_BRIDGE_H
|
||||
#define BX_IODEV_PCI_BRIDGE_H
|
||||
|
||||
#define BX_MAX_PCI_DEVICES 20
|
||||
|
||||
@ -52,11 +54,10 @@ typedef struct {
|
||||
Bit8u pci_conf[256];
|
||||
} bx_def440fx_t;
|
||||
|
||||
|
||||
class bx_pci_c : public bx_pci_stub_c {
|
||||
class bx_pci_bridge_c : public bx_pci_bridge_stub_c {
|
||||
public:
|
||||
bx_pci_c();
|
||||
~bx_pci_c();
|
||||
bx_pci_bridge_c();
|
||||
~bx_pci_bridge_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual bx_bool register_pci_handlers(void *this_ptr,
|
||||
@ -103,3 +104,5 @@ private:
|
||||
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci2isa.cc,v 1.25 2006-01-02 22:26:27 vruppert Exp $
|
||||
// $Id: pci2isa.cc,v 1.26 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -40,8 +40,7 @@
|
||||
|
||||
bx_pci2isa_c *thePci2IsaBridge = NULL;
|
||||
|
||||
int
|
||||
libpci2isa_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
int libpci2isa_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
thePci2IsaBridge = new bx_pci2isa_c ();
|
||||
bx_devices.pluginPci2IsaBridge = thePci2IsaBridge;
|
||||
@ -49,26 +48,20 @@ libpci2isa_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *
|
||||
return(0); // Success
|
||||
}
|
||||
|
||||
void
|
||||
libpci2isa_LTX_plugin_fini(void)
|
||||
{
|
||||
}
|
||||
void libpci2isa_LTX_plugin_fini(void) {}
|
||||
|
||||
bx_pci2isa_c::bx_pci2isa_c(void)
|
||||
bx_pci2isa_c::bx_pci2isa_c()
|
||||
{
|
||||
put("P2I");
|
||||
settype(PCI2ISALOG);
|
||||
}
|
||||
|
||||
bx_pci2isa_c::~bx_pci2isa_c(void)
|
||||
bx_pci2isa_c::~bx_pci2isa_c()
|
||||
{
|
||||
// nothing for now
|
||||
BX_DEBUG(("Exit."));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bx_pci2isa_c::init(void)
|
||||
void bx_pci2isa_c::init(void)
|
||||
{
|
||||
unsigned i;
|
||||
// called once when bochs initializes
|
||||
@ -111,8 +104,7 @@ bx_pci2isa_c::init(void)
|
||||
BX_P2I_THIS s.pci_conf[0x63] = 0x80;
|
||||
}
|
||||
|
||||
void
|
||||
bx_pci2isa_c::reset(unsigned type)
|
||||
void bx_pci2isa_c::reset(unsigned type)
|
||||
{
|
||||
BX_P2I_THIS s.pci_conf[0x05] = 0x00;
|
||||
BX_P2I_THIS s.pci_conf[0x06] = 0x00;
|
||||
@ -152,8 +144,7 @@ bx_pci2isa_c::reset(unsigned type)
|
||||
BX_P2I_THIS s.pci_reset = 0x00;
|
||||
}
|
||||
|
||||
void
|
||||
bx_pci2isa_c::pci_register_irq(unsigned pirq, unsigned irq)
|
||||
void bx_pci2isa_c::pci_register_irq(unsigned pirq, unsigned irq)
|
||||
{
|
||||
if ((irq < 16) && (((1 << irq) & 0xdef8) > 0)) {
|
||||
if (BX_P2I_THIS s.pci_conf[0x60 + pirq] < 16) {
|
||||
@ -167,8 +158,7 @@ bx_pci2isa_c::pci_register_irq(unsigned pirq, unsigned irq)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_pci2isa_c::pci_unregister_irq(unsigned pirq)
|
||||
void bx_pci2isa_c::pci_unregister_irq(unsigned pirq)
|
||||
{
|
||||
Bit8u irq = BX_P2I_THIS s.pci_conf[0x60 + pirq];
|
||||
if (irq < 16) {
|
||||
@ -181,8 +171,7 @@ bx_pci2isa_c::pci_unregister_irq(unsigned pirq)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_pci2isa_c::pci_set_irq(Bit8u devfunc, unsigned line, bx_bool level)
|
||||
void bx_pci2isa_c::pci_set_irq(Bit8u devfunc, unsigned line, bx_bool level)
|
||||
{
|
||||
Bit8u pirq = ((devfunc >> 3) + line - 2) & 0x03;
|
||||
Bit8u irq = BX_P2I_THIS s.pci_conf[0x60 + pirq];
|
||||
@ -203,22 +192,17 @@ bx_pci2isa_c::pci_set_irq(Bit8u devfunc, unsigned line, bx_bool level)
|
||||
}
|
||||
}
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
Bit32u
|
||||
bx_pci2isa_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
Bit32u bx_pci2isa_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_P2I_SMF
|
||||
bx_pci2isa_c *class_ptr = (bx_pci2isa_c *) this_ptr;
|
||||
|
||||
return( class_ptr->read(address, io_len) );
|
||||
return class_ptr->read(address, io_len);
|
||||
}
|
||||
|
||||
|
||||
Bit32u
|
||||
bx_pci2isa_c::read(Bit32u address, unsigned io_len)
|
||||
Bit32u bx_pci2isa_c::read(Bit32u address, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -245,21 +229,17 @@ bx_pci2isa_c::read(Bit32u address, unsigned io_len)
|
||||
return(0xffffffff);
|
||||
}
|
||||
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
void
|
||||
bx_pci2isa_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_pci2isa_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_P2I_SMF
|
||||
bx_pci2isa_c *class_ptr = (bx_pci2isa_c *) this_ptr;
|
||||
|
||||
class_ptr->write(address, value, io_len);
|
||||
}
|
||||
|
||||
void
|
||||
bx_pci2isa_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_pci2isa_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -303,21 +283,17 @@ bx_pci2isa_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
}
|
||||
|
||||
|
||||
// static pci configuration space read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
// static pci configuration space read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
Bit32u
|
||||
bx_pci2isa_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
|
||||
Bit32u bx_pci2isa_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_P2I_SMF
|
||||
bx_pci2isa_c *class_ptr = (bx_pci2isa_c *) this_ptr;
|
||||
|
||||
return( class_ptr->pci_read(address, io_len) );
|
||||
return class_ptr->pci_read(address, io_len);
|
||||
}
|
||||
|
||||
|
||||
Bit32u
|
||||
bx_pci2isa_c::pci_read(Bit8u address, unsigned io_len)
|
||||
Bit32u bx_pci2isa_c::pci_read(Bit8u address, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -331,26 +307,23 @@ bx_pci2isa_c::pci_read(Bit8u address, unsigned io_len)
|
||||
}
|
||||
BX_DEBUG(("PIIX3 PCI-to-ISA read register 0x%02x value 0x%08x", address, value));
|
||||
return value;
|
||||
}
|
||||
}
|
||||
else
|
||||
return(0xffffffff);
|
||||
}
|
||||
|
||||
|
||||
// static pci configuration space write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
// static pci configuration space write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
void
|
||||
bx_pci2isa_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
|
||||
void bx_pci2isa_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_P2I_SMF
|
||||
bx_pci2isa_c *class_ptr = (bx_pci2isa_c *) this_ptr;
|
||||
|
||||
class_ptr->pci_write(address, value, io_len);
|
||||
}
|
||||
|
||||
void
|
||||
bx_pci2isa_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
void bx_pci2isa_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci2isa.h,v 1.9 2004-09-25 22:15:02 vruppert Exp $
|
||||
// $Id: pci2isa.h,v 1.10 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -25,6 +25,9 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
#ifndef BX_IODEV_PIC2ISA_H
|
||||
#define BX_IODEV_PIC2ISA_H
|
||||
|
||||
#if BX_USE_P2I_SMF
|
||||
# define BX_P2I_SMF static
|
||||
# define BX_P2I_THIS thePci2IsaBridge->
|
||||
@ -35,13 +38,12 @@
|
||||
|
||||
|
||||
class bx_pci2isa_c : public bx_pci2isa_stub_c {
|
||||
|
||||
public:
|
||||
bx_pci2isa_c(void);
|
||||
~bx_pci2isa_c(void);
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void pci_set_irq(Bit8u devfunc, unsigned line, bx_bool level);
|
||||
bx_pci2isa_c();
|
||||
~bx_pci2isa_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void pci_set_irq(Bit8u devfunc, unsigned line, bx_bool level);
|
||||
|
||||
private:
|
||||
|
||||
@ -52,7 +54,7 @@ private:
|
||||
Bit8u irq_registry[16];
|
||||
Bit32u irq_level[16];
|
||||
Bit8u pci_reset;
|
||||
} s;
|
||||
} s;
|
||||
|
||||
static void pci_register_irq(unsigned pirq, unsigned irq);
|
||||
static void pci_unregister_irq(unsigned pirq);
|
||||
@ -67,4 +69,6 @@ private:
|
||||
Bit32u pci_read(Bit8u address, unsigned io_len);
|
||||
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci_ide.h,v 1.8 2006-03-06 19:23:13 sshwarts Exp $
|
||||
// $Id: pci_ide.h,v 1.9 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -24,6 +24,8 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_PCIIDE_H
|
||||
#define BX_IODEV_PCIIDE_H
|
||||
|
||||
#if BX_USE_PIDE_SMF
|
||||
# define BX_PIDE_SMF static
|
||||
@ -35,16 +37,14 @@
|
||||
# define BX_PIDE_THIS_PTR this
|
||||
#endif
|
||||
|
||||
|
||||
class bx_pci_ide_c : public bx_pci_ide_stub_c {
|
||||
|
||||
public:
|
||||
bx_pci_ide_c();
|
||||
~bx_pci_ide_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
~bx_pci_ide_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual bx_bool bmdma_present(void);
|
||||
virtual void bmdma_set_irq(Bit8u channel);
|
||||
virtual void bmdma_set_irq(Bit8u channel);
|
||||
|
||||
static void timer_handler(void *);
|
||||
BX_PIDE_SMF void timer(void);
|
||||
@ -77,4 +77,6 @@ private:
|
||||
Bit32u pci_read(Bit8u address, unsigned io_len);
|
||||
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,34 +39,30 @@
|
||||
|
||||
bx_pcidev_c* thePciDevAdapter = 0;
|
||||
|
||||
int
|
||||
libpcidev_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
int libpcidev_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
thePciDevAdapter = new bx_pcidev_c ();
|
||||
thePciDevAdapter = new bx_pcidev_c();
|
||||
bx_devices.pluginPciDevAdapter = thePciDevAdapter;
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePciDevAdapter, BX_PLUGIN_PCIDEV);
|
||||
return 0; // Success
|
||||
}
|
||||
|
||||
void
|
||||
libpcidev_LTX_plugin_fini(void)
|
||||
void libpcidev_LTX_plugin_fini(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bx_pcidev_c::bx_pcidev_c(void)
|
||||
bx_pcidev_c::bx_pcidev_c()
|
||||
{
|
||||
put("PCI2H");
|
||||
settype(PCIDEVLOG);
|
||||
}
|
||||
|
||||
bx_pcidev_c::~bx_pcidev_c(void)
|
||||
bx_pcidev_c::~bx_pcidev_c()
|
||||
{
|
||||
// nothing for now
|
||||
BX_DEBUG(("Exit."));
|
||||
}
|
||||
|
||||
|
||||
static void pcidev_sighandler(int param)
|
||||
{
|
||||
unsigned long irq = ((bx_pcidev_c *)bx_devices.pluginPciDevAdapter)->irq;
|
||||
@ -79,8 +75,7 @@ static void pcidev_sighandler(int param)
|
||||
DEV_pic_raise_irq(irq);
|
||||
}
|
||||
|
||||
|
||||
static bx_bool pcidev_mem_read_handler(unsigned long addr, unsigned long len, void *data, void *param)
|
||||
static bx_bool pcidev_mem_read_handler(unsigned long addr, unsigned long len, void *data, void *param)
|
||||
{
|
||||
struct region_struct *region = (struct region_struct *)param;
|
||||
bx_pcidev_c *pcidev = region->pcidev;
|
||||
@ -96,15 +91,15 @@ static bx_bool pcidev_mem_read_handler(unsigned long addr, unsigned long len, v
|
||||
switch(len) {
|
||||
case 1:
|
||||
ret = ioctl(fd, PCIDEV_IOCTL_READ_MEM_BYTE, &io);
|
||||
*(unsigned char *)data = io.value;
|
||||
*(Bit8u *)data = io.value;
|
||||
break;
|
||||
case 2:
|
||||
ret = ioctl(fd, PCIDEV_IOCTL_READ_MEM_WORD, &io);
|
||||
*(unsigned short *)data = io.value;
|
||||
*(Bit16u *)data = io.value;
|
||||
break;
|
||||
case 4:
|
||||
ret = ioctl(fd, PCIDEV_IOCTL_READ_MEM_DWORD, &io);
|
||||
*(unsigned long *)data = io.value;
|
||||
*(Bit32u *)data = io.value;
|
||||
break;
|
||||
default:
|
||||
BX_ERROR(("Unsupported pcidev read mem operation"));
|
||||
@ -132,15 +127,15 @@ static bx_bool pcidev_mem_write_handler(unsigned long addr, unsigned long len, v
|
||||
io.address = addr + region->host_start - region->start;
|
||||
switch(len) {
|
||||
case 1:
|
||||
io.value = *(unsigned char *)data;
|
||||
io.value = *(Bit8u *)data;
|
||||
ret = ioctl(fd, PCIDEV_IOCTL_WRITE_MEM_BYTE, &io);
|
||||
break;
|
||||
case 2:
|
||||
io.value = *(unsigned short *)data;
|
||||
io.value = *(Bit16u *)data;
|
||||
ret = ioctl(fd, PCIDEV_IOCTL_WRITE_MEM_WORD, &io);
|
||||
break;
|
||||
case 4:
|
||||
io.value = *(unsigned long *)data;
|
||||
io.value = *(Bit32u *)data;
|
||||
ret = ioctl(fd, PCIDEV_IOCTL_WRITE_MEM_DWORD, &io);
|
||||
break;
|
||||
default:
|
||||
@ -156,8 +151,7 @@ static bx_bool pcidev_mem_write_handler(unsigned long addr, unsigned long len, v
|
||||
|
||||
static const char * const pcidev_name = "Experimental PCI 2 host PCI";
|
||||
|
||||
void
|
||||
bx_pcidev_c::init(void)
|
||||
void bx_pcidev_c::init(void)
|
||||
{
|
||||
// called once when bochs initializes
|
||||
BX_PCIDEV_THIS pcidev_fd = -1;
|
||||
@ -281,17 +275,12 @@ bx_pcidev_c::init(void)
|
||||
//ioctl(fd, PCIDEV_IOCTL_INTERRUPT_TEST, 1);
|
||||
}
|
||||
|
||||
void
|
||||
bx_pcidev_c::reset(unsigned type)
|
||||
{
|
||||
}
|
||||
void bx_pcidev_c::reset(unsigned type) { }
|
||||
|
||||
// static pci configuration space read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
// static pci configuration space read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
Bit32u
|
||||
bx_pcidev_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
|
||||
Bit32u bx_pcidev_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCIDEV_SMF
|
||||
bx_pcidev_c *class_ptr = (bx_pcidev_c *) this_ptr;
|
||||
@ -299,9 +288,7 @@ bx_pcidev_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
|
||||
return class_ptr->pci_read(address, io_len);
|
||||
}
|
||||
|
||||
|
||||
Bit32u
|
||||
bx_pcidev_c::pci_read(Bit8u address, unsigned io_len)
|
||||
Bit32u bx_pcidev_c::pci_read(Bit8u address, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -505,18 +492,14 @@ bx_pcidev_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
BX_ERROR(("pcidev config write error"));
|
||||
}
|
||||
|
||||
|
||||
Bit32u
|
||||
bx_pcidev_c::read_handler(void *param, Bit32u address, unsigned io_len)
|
||||
Bit32u bx_pcidev_c::read_handler(void *param, Bit32u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCIDEV_SMF
|
||||
bx_pcidev_c *class_ptr = ((struct region_struct *)param)->pcidev;
|
||||
|
||||
return class_ptr->read(param, address, io_len);
|
||||
}
|
||||
|
||||
Bit32u
|
||||
bx_pcidev_c::read(void *param, Bit32u address, unsigned io_len)
|
||||
Bit32u bx_pcidev_c::read(void *param, Bit32u address, unsigned io_len)
|
||||
{
|
||||
#endif // !BX_USE_PCIDEV_SMF
|
||||
struct region_struct *region = (struct region_struct *)param;
|
||||
@ -548,17 +531,14 @@ bx_pcidev_c::read(void *param, Bit32u address, unsigned io_len)
|
||||
return io.value;
|
||||
}
|
||||
|
||||
void
|
||||
bx_pcidev_c::write_handler(void *param, Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_pcidev_c::write_handler(void *param, Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCIDEV_SMF
|
||||
bx_pcidev_c *class_ptr = ((struct region_struct *)param)->pcidev;
|
||||
|
||||
class_ptr->write(param, address, value, io_len);
|
||||
}
|
||||
|
||||
void
|
||||
bx_pcidev_c::write(void *param, Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_pcidev_c::write(void *param, Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
//UNUSED(this_ptr);
|
||||
|
@ -16,6 +16,9 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef BX_IODEV_PCIDEV_H
|
||||
#define BX_IODEV_PCIDEV_H
|
||||
|
||||
#if BX_USE_PCIDEV_SMF
|
||||
# define BX_PCIDEV_THIS thePciDevAdapter->
|
||||
# define BX_PCIDEV_THIS_ thePciDevAdapter
|
||||
@ -37,8 +40,8 @@
|
||||
class bx_pcidev_c : public bx_devmodel_c
|
||||
{
|
||||
public:
|
||||
bx_pcidev_c(void);
|
||||
~bx_pcidev_c(void);
|
||||
bx_pcidev_c();
|
||||
~bx_pcidev_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
|
||||
@ -64,3 +67,5 @@ private:
|
||||
void write(void *param, Bit32u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pcipnic.h,v 1.3 2004-07-13 17:45:34 vruppert Exp $
|
||||
// $Id: pcipnic.h,v 1.4 2006-03-07 18:16:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2003 Fen Systems Ltd.
|
||||
@ -19,6 +19,9 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_PCIPNIC_H
|
||||
#define BX_IODEV_PCIPNIC_H
|
||||
|
||||
#include "pnic_api.h"
|
||||
|
||||
#if BX_USE_PCIPNIC_SMF
|
||||
@ -57,16 +60,14 @@ typedef struct {
|
||||
} bx_pnic_t;
|
||||
|
||||
|
||||
class bx_pcipnic_c : public bx_devmodel_c
|
||||
{
|
||||
class bx_pcipnic_c : public bx_devmodel_c {
|
||||
public:
|
||||
bx_pcipnic_c(void);
|
||||
~bx_pcipnic_c(void);
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
bx_pcipnic_c();
|
||||
~bx_pcipnic_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
|
||||
private:
|
||||
|
||||
bx_pnic_t s;
|
||||
|
||||
static void set_irq_level(bx_bool level);
|
||||
@ -89,5 +90,6 @@ private:
|
||||
static void exec_command(void);
|
||||
static void rx_handler(void *arg, const void *buf, unsigned len);
|
||||
BX_PNIC_SMF void rx_frame(const void *buf, unsigned io_len);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pciusb.cc,v 1.34 2006-03-06 19:23:13 sshwarts Exp $
|
||||
// $Id: pciusb.cc,v 1.35 2006-03-07 18:16:41 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -59,8 +59,7 @@ bx_pciusb_c* theUSBDevice = NULL;
|
||||
const Bit8u usb_iomask[32] = {2, 1, 2, 1, 2, 1, 2, 0, 4, 0, 0, 0, 1, 0, 0, 0,
|
||||
3, 1, 3, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
int
|
||||
libpciusb_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
int libpciusb_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
theUSBDevice = new bx_pciusb_c ();
|
||||
bx_devices.pluginPciUSBAdapter = theUSBDevice;
|
||||
@ -68,19 +67,17 @@ libpciusb_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *a
|
||||
return 0; // Success
|
||||
}
|
||||
|
||||
void
|
||||
libpciusb_LTX_plugin_fini(void)
|
||||
void libpciusb_LTX_plugin_fini(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bx_pciusb_c::bx_pciusb_c(void)
|
||||
bx_pciusb_c::bx_pciusb_c()
|
||||
{
|
||||
put("USB");
|
||||
settype(PCIUSBLOG);
|
||||
}
|
||||
|
||||
bx_pciusb_c::~bx_pciusb_c(void)
|
||||
bx_pciusb_c::~bx_pciusb_c()
|
||||
{
|
||||
//TODO: free BX_USB_THIS device_buffer
|
||||
|
||||
@ -92,9 +89,7 @@ bx_pciusb_c::~bx_pciusb_c(void)
|
||||
BX_DEBUG(("Exit."));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bx_pciusb_c::init(void)
|
||||
void bx_pciusb_c::init(void)
|
||||
{
|
||||
// called once when bochs initializes
|
||||
|
||||
@ -138,8 +133,7 @@ bx_pciusb_c::init(void)
|
||||
//BX_USB_THIS setonoff(LOGLEV_DEBUG, ACT_REPORT);
|
||||
}
|
||||
|
||||
void
|
||||
bx_pciusb_c::reset(unsigned type)
|
||||
void bx_pciusb_c::reset(unsigned type)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
@ -245,8 +239,7 @@ bx_pciusb_c::reset(unsigned type)
|
||||
init_device(1, SIM->get_param_string(BXPN_USB1_PORT2)->getptr());
|
||||
}
|
||||
|
||||
void
|
||||
bx_pciusb_c::init_device(Bit8u port, char *devname)
|
||||
void bx_pciusb_c::init_device(Bit8u port, char *devname)
|
||||
{
|
||||
Bit8u type = USB_DEV_TYPE_NONE;
|
||||
bx_bool connected = 0;
|
||||
@ -283,27 +276,22 @@ bx_pciusb_c::init_device(Bit8u port, char *devname)
|
||||
usb_set_connect_status(port, type, connected);
|
||||
}
|
||||
|
||||
void
|
||||
bx_pciusb_c::set_irq_level(bx_bool level)
|
||||
void bx_pciusb_c::set_irq_level(bx_bool level)
|
||||
{
|
||||
DEV_pci_set_irq(BX_USB_THIS hub[0].devfunc, BX_USB_THIS hub[0].pci_conf[0x3d], level);
|
||||
}
|
||||
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
// static IO port read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
Bit32u
|
||||
bx_pciusb_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
Bit32u bx_pciusb_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCIUSB_SMF
|
||||
bx_pciusb_c *class_ptr = (bx_pciusb_c *) this_ptr;
|
||||
|
||||
return( class_ptr->read(address, io_len) );
|
||||
return class_ptr->read(address, io_len);
|
||||
}
|
||||
|
||||
|
||||
Bit32u
|
||||
bx_pciusb_c::read(Bit32u address, unsigned io_len)
|
||||
Bit32u bx_pciusb_c::read(Bit32u address, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -390,21 +378,17 @@ bx_pciusb_c::read(Bit32u address, unsigned io_len)
|
||||
return(val);
|
||||
}
|
||||
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
// static IO port write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
void
|
||||
bx_pciusb_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_pciusb_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCIUSB_SMF
|
||||
bx_pciusb_c *class_ptr = (bx_pciusb_c *) this_ptr;
|
||||
|
||||
class_ptr->write(address, value, io_len);
|
||||
}
|
||||
|
||||
void
|
||||
bx_pciusb_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
void bx_pciusb_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -1295,8 +1279,8 @@ bx_bool bx_pciusb_c::DoTransfer(Bit32u address, Bit32u queue_num, struct TD *td)
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned bx_pciusb_c::GetDescriptor(struct USB_DEVICE *dev, struct REQUEST_PACKET *packet) {
|
||||
|
||||
unsigned bx_pciusb_c::GetDescriptor(struct USB_DEVICE *dev, struct REQUEST_PACKET *packet)
|
||||
{
|
||||
Bit8u *p = device_buffer;
|
||||
unsigned i, j, fnd, ret = 0; // ret = 0 = no error
|
||||
|
||||
@ -1417,8 +1401,8 @@ unsigned bx_pciusb_c::GetDescriptor(struct USB_DEVICE *dev, struct REQUEST_PACKE
|
||||
|
||||
// If the request fails, set the stall bit ????
|
||||
void bx_pciusb_c::set_status(struct TD *td, bx_bool stalled, bx_bool data_buffer_error, bx_bool babble,
|
||||
bx_bool nak, bx_bool crc_time_out, bx_bool bitstuff_error, Bit16u act_len) {
|
||||
|
||||
bx_bool nak, bx_bool crc_time_out, bx_bool bitstuff_error, Bit16u act_len)
|
||||
{
|
||||
// clear out the bits we can modify and/or want zero
|
||||
td->dword1 &= 0xDF00F800;
|
||||
|
||||
@ -1434,22 +1418,17 @@ void bx_pciusb_c::set_status(struct TD *td, bx_bool stalled, bx_bool data_buffer
|
||||
td->dword1 &= ~((1<<28) | (1<<27)); // clear the c_err field in there was an error
|
||||
}
|
||||
|
||||
|
||||
// static pci configuration space read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
// static pci configuration space read callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
Bit32u
|
||||
bx_pciusb_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
|
||||
Bit32u bx_pciusb_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCIUSB_SMF
|
||||
bx_pciusb_c *class_ptr = (bx_pciusb_c *) this_ptr;
|
||||
|
||||
return class_ptr->pci_read(address, io_len);
|
||||
}
|
||||
|
||||
|
||||
Bit32u
|
||||
bx_pciusb_c::pci_read(Bit8u address, unsigned io_len)
|
||||
Bit32u bx_pciusb_c::pci_read(Bit8u address, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -1509,20 +1488,17 @@ bx_pciusb_c::pci_read(Bit8u address, unsigned io_len)
|
||||
}
|
||||
|
||||
|
||||
// static pci configuration space write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
// static pci configuration space write callback handler
|
||||
// redirects to non-static class handler to avoid virtual functions
|
||||
|
||||
void
|
||||
bx_pciusb_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
|
||||
void bx_pciusb_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_PCIUSB_SMF
|
||||
bx_pciusb_c *class_ptr = (bx_pciusb_c *) this_ptr;
|
||||
|
||||
class_ptr->pci_write(address, value, io_len);
|
||||
}
|
||||
|
||||
void
|
||||
bx_pciusb_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
void bx_pciusb_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
{
|
||||
#else
|
||||
UNUSED(this_ptr);
|
||||
@ -1590,8 +1566,7 @@ bx_pciusb_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
BX_DEBUG(("USB PCI write register 0x%02x value 0x%s", address, szTmp));
|
||||
}
|
||||
|
||||
void
|
||||
bx_pciusb_c::usb_mouse_enable(bx_bool enable)
|
||||
void bx_pciusb_c::usb_mouse_enable(bx_bool enable)
|
||||
{
|
||||
BX_USB_THIS mouse_connected = enable;
|
||||
if (BX_USB_THIS last_connect != enable) {
|
||||
@ -1601,8 +1576,7 @@ bx_pciusb_c::usb_mouse_enable(bx_bool enable)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_pciusb_c::usb_set_connect_status(Bit8u port, int type, bx_bool connected)
|
||||
void bx_pciusb_c::usb_set_connect_status(Bit8u port, int type, bx_bool connected)
|
||||
{
|
||||
if (BX_USB_THIS hub[0].usb_port[port].device_num > -1) {
|
||||
if (BX_USB_THIS hub[0].device[BX_USB_THIS hub[0].usb_port[port].device_num].dev_type == type) {
|
||||
@ -1670,8 +1644,7 @@ bx_pciusb_c::usb_set_connect_status(Bit8u port, int type, bx_bool connected)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_pciusb_c::usb_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state)
|
||||
void bx_pciusb_c::usb_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state)
|
||||
{
|
||||
// scale down the motion
|
||||
if ( (delta_x < -1) || (delta_x > 1) )
|
||||
@ -1714,8 +1687,7 @@ bx_pciusb_c::usb_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned butto
|
||||
BX_USB_THIS b_state = (Bit8u) button_state;
|
||||
}
|
||||
|
||||
bx_bool
|
||||
bx_pciusb_c::usb_key_enq(Bit8u *scan_code)
|
||||
bx_bool bx_pciusb_c::usb_key_enq(Bit8u *scan_code)
|
||||
{
|
||||
bx_bool is_break_code = 0;
|
||||
Bit8u our_scan_code[8];
|
||||
@ -1792,21 +1764,19 @@ bx_pciusb_c::usb_key_enq(Bit8u *scan_code)
|
||||
return fnd;
|
||||
}
|
||||
|
||||
bx_bool
|
||||
bx_pciusb_c::usb_keyboard_connected()
|
||||
bx_bool bx_pciusb_c::usb_keyboard_connected()
|
||||
{
|
||||
return BX_USB_THIS keyboard_connected;
|
||||
}
|
||||
|
||||
bx_bool
|
||||
bx_pciusb_c::usb_mouse_connected()
|
||||
bx_bool bx_pciusb_c::usb_mouse_connected()
|
||||
{
|
||||
return BX_USB_THIS mouse_connected;
|
||||
}
|
||||
|
||||
// Dumps the contents of a buffer to the log file
|
||||
void
|
||||
bx_pciusb_c::dump_packet(Bit8u *data, unsigned size) {
|
||||
void bx_pciusb_c::dump_packet(Bit8u *data, unsigned size)
|
||||
{
|
||||
char the_packet[256], str[16];
|
||||
strcpy(the_packet, "Packet contents (in hex):");
|
||||
unsigned offset = 0;
|
||||
@ -1827,9 +1797,9 @@ bx_pciusb_c::dump_packet(Bit8u *data, unsigned size) {
|
||||
// packet is the data coming in/going out
|
||||
// size is the size of the data
|
||||
// out = 1 if Host to Device, 0 it Device to Host
|
||||
bx_bool
|
||||
bx_pciusb_c::flash_stick(Bit8u *packet, Bit16u size, bx_bool out) {
|
||||
|
||||
|
||||
bx_bool bx_pciusb_c::flash_stick(Bit8u *packet, Bit16u size, bx_bool out)
|
||||
{
|
||||
// packet contains the SCSI interface command
|
||||
dump_packet(packet, size);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pciusb.h,v 1.14 2005-11-29 20:46:17 vruppert Exp $
|
||||
// $Id: pciusb.h,v 1.15 2006-03-07 18:16:41 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -26,6 +26,9 @@
|
||||
|
||||
// Benjamin D Lunt (fys at frontiernet net) coded most of this usb emulation.
|
||||
|
||||
#ifndef BX_IODEV_PCIUSB_H
|
||||
#define BX_IODEV_PCIUSB_H
|
||||
|
||||
#if BX_USE_PCIUSB_SMF
|
||||
# define BX_USB_THIS theUSBDevice->
|
||||
# define BX_USB_THIS_PTR theUSBDevice
|
||||
@ -332,19 +335,18 @@ struct HCSTACK {
|
||||
bx_bool t;
|
||||
};
|
||||
|
||||
class bx_pciusb_c : public bx_usb_stub_c
|
||||
{
|
||||
class bx_pciusb_c : public bx_usb_stub_c {
|
||||
public:
|
||||
bx_pciusb_c(void);
|
||||
~bx_pciusb_c(void);
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned);
|
||||
virtual void usb_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
virtual void usb_mouse_enable(bx_bool enable);
|
||||
bx_pciusb_c();
|
||||
~bx_pciusb_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned);
|
||||
virtual void usb_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
virtual void usb_mouse_enable(bx_bool enable);
|
||||
virtual bx_bool usb_key_enq(Bit8u *scan_code);
|
||||
virtual bx_bool usb_keyboard_connected();
|
||||
virtual bx_bool usb_mouse_connected();
|
||||
static char *usb_param_handler(bx_param_string_c *param, int set, char *val, int maxlen);
|
||||
static char *usb_param_handler(bx_param_string_c *param, int set, char *val, int maxlen);
|
||||
|
||||
private:
|
||||
|
||||
@ -376,8 +378,8 @@ private:
|
||||
bx_bool mouse_connected;
|
||||
bx_bool flash_connected;
|
||||
|
||||
static void init_device(Bit8u port, char *devname);
|
||||
static void usb_set_connect_status(Bit8u port, int type, bx_bool connected);
|
||||
static void init_device(Bit8u port, char *devname);
|
||||
static void usb_set_connect_status(Bit8u port, int type, bx_bool connected);
|
||||
|
||||
static void usb_timer_handler(void *);
|
||||
void usb_timer(void);
|
||||
@ -400,3 +402,4 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pcivga.h,v 1.3 2003-01-27 21:11:55 vruppert Exp $
|
||||
// $Id: pcivga.h,v 1.4 2006-03-07 18:16:41 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002,2003 Mike Nordell
|
||||
@ -18,20 +18,21 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_PCIVGA_H
|
||||
#define BX_IODEV_PCIVGA_H
|
||||
|
||||
#if BX_USE_PCIVGA_SMF
|
||||
# define BX_PCIVGA_THIS thePciVgaAdapter->
|
||||
#else
|
||||
# define BX_PCIVGA_THIS this->
|
||||
#endif
|
||||
|
||||
|
||||
class bx_pcivga_c : public bx_devmodel_c
|
||||
{
|
||||
class bx_pcivga_c : public bx_devmodel_c {
|
||||
public:
|
||||
bx_pcivga_c(void);
|
||||
~bx_pcivga_c(void);
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
bx_pcivga_c();
|
||||
~bx_pcivga_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
|
||||
private:
|
||||
|
||||
@ -46,3 +47,5 @@ private:
|
||||
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pic.h,v 1.14 2006-01-05 21:57:58 vruppert Exp $
|
||||
// $Id: pic.h,v 1.15 2006-03-07 18:16:41 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -24,6 +24,8 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_PIC_H
|
||||
#define BX_IODEV_PIC_H
|
||||
|
||||
#if BX_USE_PIC_SMF
|
||||
# define BX_PIC_SMF static
|
||||
@ -33,8 +35,6 @@
|
||||
# define BX_PIC_THIS this->
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
Bit8u single_PIC; /* 0=cascaded PIC, 1=master only */
|
||||
Bit8u interrupt_offset; /* programmable interrupt vector offset */
|
||||
@ -42,7 +42,7 @@ typedef struct {
|
||||
Bit8u slave_connect_mask; /* for master, a bit for each interrupt line
|
||||
0=not connect to a slave, 1=connected */
|
||||
Bit8u slave_id; /* for slave, id number of slave PIC */
|
||||
} u;
|
||||
} u;
|
||||
Bit8u sfnm; /* specially fully nested mode: 0=no, 1=yes*/
|
||||
Bit8u buffered_mode; /* 0=no buffered mode, 1=buffered mode */
|
||||
Bit8u master_slave; /* master/slave: 0=slave PIC, 1=master PIC */
|
||||
@ -59,32 +59,31 @@ typedef struct {
|
||||
bx_bool in_init;
|
||||
bx_bool requires_4;
|
||||
int byte_expected;
|
||||
} init;
|
||||
} init;
|
||||
bx_bool special_mask;
|
||||
bx_bool polled; /* Set when poll command is issued. */
|
||||
bx_bool rotate_on_autoeoi; /* Set when should rotate in auto-eoi mode. */
|
||||
Bit8u edge_level; /* bitmap for irq mode (0=edge, 1=level) */
|
||||
} bx_pic_t;
|
||||
} bx_pic_t;
|
||||
|
||||
|
||||
class bx_pic_c : public bx_pic_stub_c {
|
||||
|
||||
public:
|
||||
bx_pic_c(void);
|
||||
~bx_pic_c(void);
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void lower_irq(unsigned irq_no);
|
||||
virtual void raise_irq(unsigned irq_no);
|
||||
virtual void set_mode(bx_bool ma_sl, Bit8u mode);
|
||||
virtual Bit8u IAC(void);
|
||||
virtual void show_pic_state(void);
|
||||
bx_pic_c();
|
||||
~bx_pic_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void lower_irq(unsigned irq_no);
|
||||
virtual void raise_irq(unsigned irq_no);
|
||||
virtual void set_mode(bx_bool ma_sl, Bit8u mode);
|
||||
virtual Bit8u IAC(void);
|
||||
virtual void show_pic_state(void);
|
||||
|
||||
private:
|
||||
struct {
|
||||
bx_pic_t master_pic;
|
||||
bx_pic_t slave_pic;
|
||||
} s;
|
||||
} s;
|
||||
|
||||
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);
|
||||
@ -97,3 +96,5 @@ private:
|
||||
BX_PIC_SMF void service_slave_pic(void);
|
||||
BX_PIC_SMF void clear_highest_interrupt(bx_pic_t *pic);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: sb16.h,v 1.22 2006-03-03 20:29:50 vruppert Exp $
|
||||
// $Id: sb16.h,v 1.23 2006-03-07 18:16:41 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -26,6 +26,8 @@
|
||||
|
||||
// This file (SB16.H) written and donated by Josef Drexler
|
||||
|
||||
#ifndef BX_IODEV_SB16_H
|
||||
#define BX_IODEV_SB16_H
|
||||
|
||||
#if BX_USE_SB16_SMF
|
||||
# define BX_SB16_SMF static
|
||||
@ -201,8 +203,8 @@ public:
|
||||
/* Make writelog available to output functions */
|
||||
BX_SB16_SMF void writelog(int loglev, const char *str, ...);
|
||||
// return midimode and wavemode setting (for lowlevel output class)
|
||||
int get_midimode() {return midimode;}
|
||||
int get_wavemode() {return wavemode;}
|
||||
int get_midimode() const {return midimode;}
|
||||
int get_wavemode() const {return wavemode;}
|
||||
// runtimer parameter handler
|
||||
static Bit64s sb16_param_handler(bx_param_c *param, int set, Bit64s val);
|
||||
|
||||
@ -403,18 +405,18 @@ public:
|
||||
bx_sound_output_c(bx_sb16_c *sb16);
|
||||
BX_SOUND_VIRTUAL ~bx_sound_output_c();
|
||||
|
||||
BX_SOUND_VIRTUAL int waveready();
|
||||
BX_SOUND_VIRTUAL int midiready();
|
||||
BX_SOUND_VIRTUAL int waveready();
|
||||
BX_SOUND_VIRTUAL int midiready();
|
||||
|
||||
BX_SOUND_VIRTUAL int openmidioutput(char *device);
|
||||
BX_SOUND_VIRTUAL int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int closemidioutput();
|
||||
BX_SOUND_VIRTUAL int openmidioutput(char *device);
|
||||
BX_SOUND_VIRTUAL int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int closemidioutput();
|
||||
|
||||
BX_SOUND_VIRTUAL int openwaveoutput(char *device);
|
||||
BX_SOUND_VIRTUAL int startwaveplayback(int frequency, int bits, int stereo, int format);
|
||||
BX_SOUND_VIRTUAL int sendwavepacket(int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int stopwaveplayback();
|
||||
BX_SOUND_VIRTUAL int closewaveoutput();
|
||||
BX_SOUND_VIRTUAL int openwaveoutput(char *device);
|
||||
BX_SOUND_VIRTUAL int startwaveplayback(int frequency, int bits, int stereo, int format);
|
||||
BX_SOUND_VIRTUAL int sendwavepacket(int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int stopwaveplayback();
|
||||
BX_SOUND_VIRTUAL int closewaveoutput();
|
||||
};
|
||||
|
||||
#define WRITELOG sb16->writelog
|
||||
@ -426,3 +428,5 @@ public:
|
||||
#define MIDILOG(x) ((sb16->get_midimode()>0?x:0x7f))
|
||||
#define WAVELOG(x) ((sb16->get_wavemode()>0?x:0x7f))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: scancodes.h,v 1.4 2002-10-24 21:07:51 bdenney Exp $
|
||||
// $Id: scancodes.h,v 1.5 2006-03-07 18:16:41 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -18,6 +18,8 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_SCANCODES_H
|
||||
#define BX_SCANCODES_H
|
||||
|
||||
// Translation table of the 8042
|
||||
extern unsigned char translation8042[256];
|
||||
@ -25,7 +27,9 @@ extern unsigned char translation8042[256];
|
||||
typedef struct {
|
||||
const char *make;
|
||||
const char *brek;
|
||||
}scancode;
|
||||
} scancode;
|
||||
|
||||
// Scancodes table
|
||||
extern scancode scancodes[BX_KEY_NBKEYS][3];
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: serial.h,v 1.26 2005-07-10 16:51:09 vruppert Exp $
|
||||
// $Id: serial.h,v 1.27 2006-03-07 18:16:41 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -25,6 +25,9 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
#ifndef BX_IODEV_SERIAL_H
|
||||
#define BX_IODEV_SERIAL_H
|
||||
|
||||
// Peter Grehan (grehan@iprg.nokia.com) coded most of this
|
||||
// serial emulation.
|
||||
|
||||
@ -199,11 +202,11 @@ typedef struct {
|
||||
|
||||
class bx_serial_c : public bx_serial_stub_c {
|
||||
public:
|
||||
bx_serial_c(void);
|
||||
~bx_serial_c(void);
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void serial_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
bx_serial_c();
|
||||
~bx_serial_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void serial_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
|
||||
private:
|
||||
bx_serial_t s[BX_SERIAL_MAXDEV];
|
||||
@ -239,5 +242,6 @@ private:
|
||||
Bit32u read(Bit32u address, unsigned io_len);
|
||||
void write(Bit32u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: unmapped.h,v 1.10 2002-10-24 21:07:52 bdenney Exp $
|
||||
// $Id: unmapped.h,v 1.11 2006-03-07 18:16:41 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -24,8 +24,8 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
|
||||
#ifndef BX_IODEV_UNMAPPED_H
|
||||
#define BX_IODEV_UNMAPPED_H
|
||||
|
||||
#if BX_USE_UM_SMF
|
||||
# define BX_UM_SMF static
|
||||
@ -35,12 +35,10 @@
|
||||
# define BX_UM_THIS this->
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
class bx_unmapped_c : public bx_devmodel_c {
|
||||
public:
|
||||
bx_unmapped_c(void);
|
||||
~bx_unmapped_c(void);
|
||||
bx_unmapped_c();
|
||||
~bx_unmapped_c();
|
||||
|
||||
virtual void init(void);
|
||||
virtual void reset (unsigned type);
|
||||
@ -54,11 +52,11 @@ private:
|
||||
void write(Bit32u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
|
||||
|
||||
struct {
|
||||
Bit8u port80;
|
||||
Bit8u port8e;
|
||||
Bit8u shutdown;
|
||||
} s; // state information
|
||||
} s; // state information
|
||||
};
|
||||
|
||||
};
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: vga.h,v 1.50 2006-01-07 12:10:59 vruppert Exp $
|
||||
// $Id: vga.h,v 1.51 2006-03-07 18:16:41 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -24,6 +24,9 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#ifndef BX_IODEV_VGA_H
|
||||
#define BX_IODEV_VGA_H
|
||||
|
||||
// Make colour
|
||||
#define MAKE_COLOUR(red, red_shiftfrom, red_shiftto, red_mask, \
|
||||
green, green_shiftfrom, green_shiftto, green_mask, \
|
||||
@ -127,7 +130,6 @@
|
||||
# define BX_VGA_THIS this->
|
||||
#endif
|
||||
|
||||
|
||||
class bx_vga_c : public bx_vga_stub_c {
|
||||
public:
|
||||
|
||||
@ -182,13 +184,13 @@ protected:
|
||||
// 1 = 400 lines
|
||||
// 2 = 350 lines
|
||||
// 3 - 480 lines
|
||||
} misc_output;
|
||||
} misc_output;
|
||||
|
||||
struct {
|
||||
Bit8u address;
|
||||
Bit8u reg[0x19];
|
||||
bx_bool write_protect;
|
||||
} CRTC;
|
||||
} CRTC;
|
||||
|
||||
struct {
|
||||
bx_bool flip_flop; /* 0 = address, 1 = data-write */
|
||||
@ -207,8 +209,8 @@ protected:
|
||||
bx_bool pixel_panning_compat;
|
||||
bx_bool pixel_clock_select;
|
||||
bx_bool internal_palette_size;
|
||||
} mode_ctrl;
|
||||
} attribute_ctrl;
|
||||
} mode_ctrl;
|
||||
} attribute_ctrl;
|
||||
|
||||
struct {
|
||||
Bit8u write_data_register;
|
||||
@ -220,10 +222,9 @@ protected:
|
||||
Bit8u red;
|
||||
Bit8u green;
|
||||
Bit8u blue;
|
||||
} data[256];
|
||||
} data[256];
|
||||
Bit8u mask;
|
||||
} pel;
|
||||
|
||||
} pel;
|
||||
|
||||
struct {
|
||||
Bit8u index;
|
||||
@ -247,7 +248,7 @@ protected:
|
||||
Bit8u color_dont_care;
|
||||
Bit8u bitmask;
|
||||
Bit8u latch[4];
|
||||
} graphics_ctrl;
|
||||
} graphics_ctrl;
|
||||
|
||||
struct {
|
||||
Bit8u index;
|
||||
@ -260,7 +261,7 @@ protected:
|
||||
bx_bool extended_mem;
|
||||
bx_bool odd_even;
|
||||
bx_bool chain_four;
|
||||
} sequencer;
|
||||
} sequencer;
|
||||
|
||||
bx_bool vga_enabled;
|
||||
bx_bool vga_mem_updated;
|
||||
@ -302,12 +303,12 @@ protected:
|
||||
bx_bool vbe_get_capabilities;
|
||||
bx_bool vbe_8bit_dac;
|
||||
#endif
|
||||
} s; // state information
|
||||
} s; // state information
|
||||
|
||||
|
||||
#if !BX_USE_VGA_SMF
|
||||
Bit32u read(Bit32u address, unsigned io_len);
|
||||
void write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log);
|
||||
void write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log);
|
||||
#else
|
||||
void write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log);
|
||||
#endif
|
||||
@ -316,7 +317,7 @@ protected:
|
||||
|
||||
#if !BX_USE_VGA_SMF
|
||||
Bit32u vbe_read(Bit32u address, unsigned io_len);
|
||||
void vbe_write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log);
|
||||
void vbe_write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log);
|
||||
#else
|
||||
void vbe_write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log);
|
||||
#endif
|
||||
@ -335,10 +336,11 @@ protected:
|
||||
BX_VGA_SMF void update(void);
|
||||
BX_VGA_SMF void determine_screen_dimensions(unsigned *piHeight,
|
||||
unsigned *piWidth);
|
||||
};
|
||||
};
|
||||
|
||||
#if BX_SUPPORT_CLGD54XX
|
||||
void
|
||||
libvga_set_smf_pointer(bx_vga_c *theVga_ptr);
|
||||
void libvga_set_smf_pointer(bx_vga_c *theVga_ptr);
|
||||
#include "iodev/svga_cirrus.h"
|
||||
#endif // BX_SUPPORT_CLGD54XX
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user