- converted sb16 device to a plugin
- moved sb16 presence check to devices.cc - added special make rules for the sb16 and the lowlevel sound support
This commit is contained in:
parent
675f140e37
commit
84b4cf6d4c
@ -56,6 +56,7 @@ WIN32_DLL_IMPORT_LIBRARY=../dllexports.a
|
||||
|
||||
CDROM_OBJS = @CDROM_OBJS@
|
||||
IOAPIC_OBJS = @IOAPIC_OBJS@
|
||||
SOUNDLOW_OBJS = @SOUNDLOW_OBJS@
|
||||
|
||||
BX_INCDIRS = -I.. -I$(srcdir)/.. -I../@INSTRUMENT_DIR@ -I$(srcdir)/../@INSTRUMENT_DIR@
|
||||
LOCAL_CXXFLAGS = $(MCH_CFLAGS)
|
||||
@ -67,7 +68,6 @@ OBJS_THAT_CANNOT_BE_PLUGINS = \
|
||||
pit.o pit82c54.o pit_wrap.o \
|
||||
@IODEBUG_OBJS@ \
|
||||
@NE2K_OBJS@ \
|
||||
@SB16_OBJS@ @SOUNDLOW_OBJS@ \
|
||||
@SLOWDOWN_OBJS@ \
|
||||
$(MCH_OBJS) \
|
||||
$(IOAPIC_OBJS)
|
||||
@ -84,11 +84,13 @@ OBJS_THAT_CAN_BE_PLUGINS = \
|
||||
harddrv.o \
|
||||
dma.o \
|
||||
unmapped.o \
|
||||
@PCI_OBJ@
|
||||
@PCI_OBJ@ \
|
||||
@SB16_OBJS@
|
||||
|
||||
OBJS_THAT_SUPPORT_OTHER_PLUGINS = \
|
||||
scancodes.o \
|
||||
$(CDROM_OBJS)
|
||||
$(CDROM_OBJS) \
|
||||
$(SOUNDLOW_OBJS)
|
||||
|
||||
NONPLUGIN_OBJS = @IODEV_NON_PLUGIN_OBJS@
|
||||
PLUGIN_OBJS = @IODEV_PLUGIN_OBJS@
|
||||
@ -123,6 +125,9 @@ libkeyboard.la: keyboard.lo scancodes.lo
|
||||
libpit.la: pit.lo pit82c54.lo pit_wrap.lo
|
||||
$(LIBTOOL) $(CXX) -module pit.lo pit82c54.lo pit_wrap.lo -o libpit.la -rpath $(PLUGIN_PATH)
|
||||
|
||||
libsb16.la: sb16.lo $(SOUNDLOW_OBJS:.o=.lo)
|
||||
$(LIBTOOL) $(CXX) -module sb16.lo $(SOUNDLOW_OBJS:.o=.lo) -o libsb16.la -rpath $(PLUGIN_PATH)
|
||||
|
||||
#### building DLLs for win32 (tested on cygwin only)
|
||||
%.dll: %.o
|
||||
$(CXX) $(CXXFLAGS) -shared -o $@ $< $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
@ -136,6 +141,9 @@ keyboard.dll: keyboard.o scancodes.o
|
||||
|
||||
pit.dll: pit.o pit82c54.o pit_wrap.o
|
||||
$(CXX) $(CXXFLAGS) -shared -o pit.dll pit.o pit82c54.o pit_wrap.o $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
|
||||
sb16.dll: sb16.o $(SOUNDLOW_OBJS)
|
||||
$(CXX) $(CXXFLAGS) -shared -o sb16.dll sb16.o $(SOUNDLOW_OBJS) $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
##### end DLL section
|
||||
|
||||
clean:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: devices.cc,v 1.42 2002-11-10 08:12:12 vruppert Exp $
|
||||
// $Id: devices.cc,v 1.43 2002-11-13 18:39:38 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -64,7 +64,7 @@ bx_devices_c::bx_devices_c(void)
|
||||
pluginVgaDevice = &stubVga;
|
||||
pluginPicDevice = &stubPic;
|
||||
pluginHardDrive = &stubHardDrive;
|
||||
sb16 = NULL;
|
||||
pluginSB16Device = NULL;
|
||||
ne2k = NULL;
|
||||
g2h = NULL;
|
||||
#if BX_IODEBUG_SUPPORT
|
||||
@ -86,7 +86,7 @@ bx_devices_c::init(BX_MEM_C *newmem)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.42 2002-11-10 08:12:12 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.43 2002-11-13 18:39:38 vruppert Exp $"));
|
||||
mem = newmem;
|
||||
|
||||
/* no read / write handlers defined */
|
||||
@ -169,8 +169,9 @@ bx_devices_c::init(BX_MEM_C *newmem)
|
||||
|
||||
#if BX_SUPPORT_SB16
|
||||
//--- SOUND ---
|
||||
sb16 = &bx_sb16;
|
||||
sb16->init();
|
||||
if (bx_options.sb16.Opresent->get ()) {
|
||||
PLUG_load_plugin(sb16, PLUGTYPE_OPTIONAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*--- VGA adapter ---*/
|
||||
@ -264,7 +265,7 @@ bx_devices_c::reset(unsigned type)
|
||||
pluginDmaDevice->reset(type);
|
||||
pluginFloppyDevice->reset(type);
|
||||
#if BX_SUPPORT_SB16
|
||||
sb16->reset(type);
|
||||
pluginSB16Device->reset(type);
|
||||
#endif
|
||||
pluginVgaDevice->reset(type);
|
||||
pluginPicDevice->reset(type);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: iodev.h,v 1.23 2002-11-11 22:01:08 cbothamy Exp $
|
||||
// $Id: iodev.h,v 1.24 2002-11-13 18:39:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -43,7 +43,6 @@
|
||||
|
||||
class bx_pit_c;
|
||||
class bx_keyb_c;
|
||||
class bx_sb16_c;
|
||||
class bx_ioapic_c;
|
||||
class bx_ne2k_c;
|
||||
class bx_g2h_c;
|
||||
@ -302,7 +301,7 @@ public:
|
||||
bx_vga_stub_c *pluginVgaDevice;
|
||||
bx_pic_stub_c *pluginPicDevice;
|
||||
bx_hard_drive_stub_c *pluginHardDrive;
|
||||
bx_sb16_c *sb16;
|
||||
bx_devmodel_c *pluginSB16Device;
|
||||
bx_ne2k_c *ne2k;
|
||||
bx_g2h_c *g2h;
|
||||
#if BX_IODEBUG_SUPPORT
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: sb16.cc,v 1.28 2002-10-25 11:44:40 bdenney Exp $
|
||||
// $Id: sb16.cc,v 1.29 2002-11-13 18:39:40 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -26,9 +26,29 @@
|
||||
|
||||
// This file (SB16.CC) written and donated by Josef Drexler
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||
// is used to know when we are exporting symbols and when we are importing.
|
||||
#define BX_PLUGGABLE
|
||||
|
||||
#include "bochs.h"
|
||||
#define LOG_THIS bx_sb16.
|
||||
#define LOG_THIS theSB16Device->
|
||||
|
||||
bx_sb16_c *theSB16Device = NULL;
|
||||
|
||||
int
|
||||
libsb16_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
theSB16Device = new bx_sb16_c ();
|
||||
bx_devices.pluginSB16Device = theSB16Device;
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSB16Device, BX_PLUGIN_SB16);
|
||||
return(0); // Success
|
||||
}
|
||||
|
||||
void
|
||||
libsb16_LTX_plugin_fini(void)
|
||||
{
|
||||
}
|
||||
|
||||
// some shortcuts to save typing
|
||||
#define LOGFILE BX_SB16_THIS logfile
|
||||
@ -45,25 +65,17 @@
|
||||
// here's a safe way to print out null pointeres
|
||||
#define MIGHT_BE_NULL(x) ((x==NULL)? "(null)" : x)
|
||||
|
||||
bx_sb16_c bx_sb16;
|
||||
#if BX_USE_SB16_SMF
|
||||
#define this ((void *)&bx_sb16)
|
||||
#endif
|
||||
|
||||
bx_sb16_c::bx_sb16_c(void)
|
||||
{
|
||||
put("SB16");
|
||||
settype(SB16LOG);
|
||||
MPU.timer_handle = BX_NULL_TIMER_HANDLE;
|
||||
DSP.timer_handle = BX_NULL_TIMER_HANDLE;
|
||||
OPL.timer_handle = BX_NULL_TIMER_HANDLE;
|
||||
mpu401.timer_handle = BX_NULL_TIMER_HANDLE;
|
||||
dsp.timer_handle = BX_NULL_TIMER_HANDLE;
|
||||
opl.timer_handle = BX_NULL_TIMER_HANDLE;
|
||||
}
|
||||
|
||||
bx_sb16_c::~bx_sb16_c(void)
|
||||
{
|
||||
if (!bx_options.sb16.Opresent->get ())
|
||||
return;
|
||||
|
||||
switch (bx_options.sb16.Omidimode->get ())
|
||||
{
|
||||
case 2:
|
||||
@ -108,9 +120,6 @@ void bx_sb16_c::init(void)
|
||||
{
|
||||
unsigned addr;
|
||||
|
||||
if (!bx_options.sb16.Opresent->get ())
|
||||
return;
|
||||
|
||||
if ( (strlen(bx_options.sb16.Ologfile->getptr ()) < 1) )
|
||||
bx_options.sb16.Ologlevel->set (0);
|
||||
|
||||
@ -1368,7 +1377,7 @@ void bx_sb16_c::set_irq_dma()
|
||||
|
||||
// And register the new 8bits DMA Channel
|
||||
if ( (!isInitialized) || (oldDMA8 != BX_SB16_DMAL) ) {
|
||||
DEV_dma_register_8bit_channel(BX_SB16_DMAL, bx_sb16.dma_read8, bx_sb16.dma_write8, "SB16");
|
||||
DEV_dma_register_8bit_channel(BX_SB16_DMAL, dma_read8, dma_write8, "SB16");
|
||||
}
|
||||
|
||||
// and the 16 bit DMA
|
||||
@ -1403,7 +1412,7 @@ void bx_sb16_c::set_irq_dma()
|
||||
|
||||
// And register the new 16bits DMA Channel
|
||||
if ( (BX_SB16_DMAH != 0) && (oldDMA16 != BX_SB16_DMAH) ) {
|
||||
DEV_dma_register_16bit_channel(BX_SB16_DMAH, bx_sb16.dma_read16, bx_sb16.dma_write16, "SB16");
|
||||
DEV_dma_register_16bit_channel(BX_SB16_DMAH, dma_read16, dma_write16, "SB16");
|
||||
}
|
||||
|
||||
// If not already initialized
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: sb16.h,v 1.10 2002-11-10 10:14:55 vruppert Exp $
|
||||
// $Id: sb16.h,v 1.11 2002-11-13 18:39:41 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -29,8 +29,8 @@
|
||||
|
||||
#if BX_USE_SB16_SMF
|
||||
# define BX_SB16_SMF static
|
||||
# define BX_SB16_THIS bx_sb16.
|
||||
# define BX_SB16_THISP (&bx_sb16)
|
||||
# define BX_SB16_THIS theSB16Device->
|
||||
# define BX_SB16_THISP (theSB16Device)
|
||||
#else
|
||||
# define BX_SB16_SMF
|
||||
# define BX_SB16_THIS this->
|
||||
@ -59,10 +59,10 @@
|
||||
#define BX_SB16_IOMPULEN 4 // number of addresses covered
|
||||
#define BX_SB16_IOADLIB 0x388 // equivalent to 0x220..0x223 and 0x228..0x229
|
||||
#define BX_SB16_IOADLIBLEN 4 // number of addresses covered
|
||||
#define BX_SB16_IRQ bx_sb16.currentirq
|
||||
#define BX_SB16_IRQ theSB16Device->currentirq
|
||||
#define BX_SB16_IRQMPU BX_SB16_IRQ // IRQ for the MPU401 part - same value
|
||||
#define BX_SB16_DMAL bx_sb16.currentdma8
|
||||
#define BX_SB16_DMAH bx_sb16.currentdma16
|
||||
#define BX_SB16_DMAL theSB16Device->currentdma8
|
||||
#define BX_SB16_DMAH theSB16Device->currentdma16
|
||||
|
||||
/*
|
||||
A few notes:
|
||||
@ -189,13 +189,13 @@ private:
|
||||
class BX_SOUND_OUTPUT_C_DEF;
|
||||
|
||||
// The actual emulator class, emulating the sound blaster ports
|
||||
class bx_sb16_c : public logfunctions {
|
||||
class bx_sb16_c : public bx_devmodel_c {
|
||||
public:
|
||||
|
||||
bx_sb16_c(void);
|
||||
~bx_sb16_c(void);
|
||||
BX_SB16_SMF void init(void);
|
||||
BX_SB16_SMF void reset(unsigned type);
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
|
||||
/* Make writelog available to output functions */
|
||||
BX_SB16_SMF void writelog(int loglevel, const char *str, ...);
|
||||
@ -404,8 +404,6 @@ public:
|
||||
BX_SOUND_VIRTUAL int closewaveoutput();
|
||||
};
|
||||
|
||||
extern bx_sb16_c bx_sb16;
|
||||
|
||||
#define WRITELOG sb16->writelog
|
||||
#define BOTHLOG(x) (x)
|
||||
#define MIDILOG(x) ((bx_options.sb16.Omidimode->get ()>0?x:0x7f))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: plugin.h,v 1.5 2002-11-09 20:51:40 vruppert Exp $
|
||||
// $Id: plugin.h,v 1.6 2002-11-13 18:39:35 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file provides macros and types needed for plugins. It is based on
|
||||
@ -34,6 +34,7 @@ extern "C" {
|
||||
#define BX_PLUGIN_PIC "pic"
|
||||
#define BX_PLUGIN_PCI "pci"
|
||||
#define BX_PLUGIN_PCI2ISA "pci2isa"
|
||||
#define BX_PLUGIN_SB16 "sb16"
|
||||
|
||||
#define BX_REGISTER_DEVICE pluginRegisterDevice
|
||||
#define BX_REGISTER_DEVICE_DEVMODEL(a,b,c,d) pluginRegisterDeviceDevmodel(a,b,c,d)
|
||||
@ -289,6 +290,7 @@ DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(floppy)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(parallel)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci2isa)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(sb16)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(amigaos)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(beos)
|
||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(carbon)
|
||||
|
Loading…
Reference in New Issue
Block a user