- modified usb_common plugin implementation to make Windows DLL plugins compile
* added new "pseudo device" for the USB device control (init, send message) * moved register_state() call from the hubs to the common device init code - fixed unresolved symbols in usb_msd code
This commit is contained in:
parent
3eba961c0d
commit
99eb027531
@ -159,8 +159,8 @@ libbx_serial.la: serial.lo serial_raw.lo
|
||||
libbx_vga.la: vga.lo svga_cirrus.lo
|
||||
$(LIBTOOL) --mode=link $(CXX) -module vga.lo svga_cirrus.lo -o libbx_vga.la -rpath $(PLUGIN_PATH)
|
||||
|
||||
libbx_usb_common.la: usb_common.lo $(USBDEV_OBJS:.o=.lo) scsi_device.lo hdimage.lo cdrom.lo
|
||||
$(LIBTOOL) --mode=link $(CXX) -module usb_common.lo $(USBDEV_OBJS:.o=.lo) scsi_device.lo hdimage.lo cdrom.lo -o libbx_usb_common.la -rpath $(PLUGIN_PATH)
|
||||
libbx_usb_common.la: usb_common.lo $(USBDEV_OBJS:.o=.lo) scsi_device.lo hdimage.lo vmware3.lo vmware4.lo $(CDROM_OBJS:.o=.lo)
|
||||
$(LIBTOOL) --mode=link $(CXX) -module usb_common.lo $(USBDEV_OBJS:.o=.lo) scsi_device.lo hdimage.lo vmware3.lo vmware4.lo $(CDROM_OBJS:.o=.lo) -o libbx_usb_common.la -rpath $(PLUGIN_PATH)
|
||||
|
||||
#### building DLLs for win32 (tested on cygwin only)
|
||||
bx_%.dll: %.o
|
||||
@ -194,8 +194,8 @@ bx_serial.dll: serial.o serial_raw.o
|
||||
bx_vga.dll: vga.o svga_cirrus.o
|
||||
$(CXX) $(CXXFLAGS) -shared -o bx_vga.dll vga.o svga_cirrus.o $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
|
||||
bx_usb_common.dll: usb_common.o $(USBDEV_OBJS) scsi_device.o hdimage.o cdrom.o
|
||||
$(CXX) $(CXXFLAGS) -shared -o bx_usb_common.dll usb_common.o $(USBDEV_OBJS) scsi_device.o hdimage.o cdrom.o $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
bx_usb_common.dll: usb_common.o $(USBDEV_OBJS) scsi_device.o hdimage.o vmware3.o vmware4.o $(CDROM_OBJS)
|
||||
$(CXX) $(CXXFLAGS) -shared -o bx_usb_common.dll usb_common.o $(USBDEV_OBJS) scsi_device.o hdimage.o vmware3.o vmware4.o $(CDROM_OBJS) $(WIN32_DLL_IMPORT_LIBRARY)
|
||||
|
||||
##### end DLL section
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: devices.cc,v 1.151 2010-12-06 18:51:13 vruppert Exp $
|
||||
// $Id: devices.cc,v 1.152 2010-12-14 21:20:37 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2009 The Bochs Project
|
||||
@ -89,6 +89,9 @@ void bx_devices_c::init_stubs()
|
||||
#if BX_SUPPORT_APIC
|
||||
pluginIOAPIC = &stubIOAPIC;
|
||||
#endif
|
||||
#if BX_SUPPORT_PCIUSB
|
||||
pluginUsbDevCtl = &stubUsbDevCtl;
|
||||
#endif
|
||||
#if 0
|
||||
g2h = NULL;
|
||||
#endif
|
||||
@ -104,7 +107,7 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
const char *plugname;
|
||||
#endif
|
||||
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.151 2010-12-06 18:51:13 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.152 2010-12-14 21:20:37 vruppert Exp $"));
|
||||
mem = newmem;
|
||||
|
||||
/* set builtin default handlers, will be overwritten by the real default handler */
|
||||
@ -148,8 +151,6 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
mouse_captured = SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get();
|
||||
mouse_type = SIM->get_param_enum(BXPN_MOUSE_TYPE)->get();
|
||||
|
||||
bx_usb_init_device = NULL;
|
||||
|
||||
// register as soon as possible - the devices want to have their timers !
|
||||
bx_virt_timer.init();
|
||||
bx_slowdown_timer.init();
|
||||
@ -1150,20 +1151,6 @@ void bx_devices_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
// USB devices init stuff
|
||||
void bx_devices_c::register_usb_init_device(bx_usb_init_device_t usb_init_device)
|
||||
{
|
||||
bx_usb_init_device = usb_init_device;
|
||||
}
|
||||
|
||||
int bx_devices_c::usb_init_device(const char *devname, logfunctions *hub, void **dev)
|
||||
{
|
||||
if (bx_usb_init_device != NULL) {
|
||||
return bx_usb_init_device(devname, hub, dev);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bx_pci_device_stub_c::register_pci_state(bx_list_c *list, Bit8u *pci_conf)
|
||||
{
|
||||
char name[6];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: iodev.h,v 1.123 2010-12-06 18:51:13 vruppert Exp $
|
||||
// $Id: iodev.h,v 1.124 2010-12-14 21:20:37 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2009 The Bochs Project
|
||||
@ -47,8 +47,6 @@ typedef bx_bool (*bx_keyb_enq_t)(void *, Bit8u *);
|
||||
typedef void (*bx_mouse_enq_t)(void *, int, int, int, unsigned);
|
||||
typedef void (*bx_mouse_enabled_changed_t)(void *, bx_bool);
|
||||
|
||||
typedef int (*bx_usb_init_device_t)(const char *, logfunctions *, void **);
|
||||
|
||||
#if BX_USE_DEV_SMF
|
||||
# define BX_DEV_SMF static
|
||||
# define BX_DEV_THIS bx_devices.
|
||||
@ -345,6 +343,16 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
#if BX_SUPPORT_PCIUSB
|
||||
class BOCHSAPI bx_usb_devctl_stub_c : public bx_devmodel_c {
|
||||
public:
|
||||
virtual int init_device(const char *devname, logfunctions *hub, void **dev, bx_list_c *sr_list) {
|
||||
STUBFUNC(usb_devctl, init_device); return 0;
|
||||
}
|
||||
virtual void usb_send_msg(void *dev, int msg) {}
|
||||
};
|
||||
#endif
|
||||
|
||||
class BOCHSAPI bx_devices_c : public logfunctions {
|
||||
public:
|
||||
bx_devices_c();
|
||||
@ -399,9 +407,6 @@ public:
|
||||
void mouse_enabled_changed(bx_bool enabled);
|
||||
void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
|
||||
void register_usb_init_device(bx_usb_init_device_t usb_init_device);
|
||||
int usb_init_device(const char *devname, logfunctions *hub, void **dev);
|
||||
|
||||
static void timer_handler(void *);
|
||||
void timer(void);
|
||||
|
||||
@ -427,6 +432,9 @@ public:
|
||||
#if BX_SUPPORT_APIC
|
||||
bx_ioapic_stub_c *pluginIOAPIC;
|
||||
#endif
|
||||
#if BX_SUPPORT_PCIUSB
|
||||
bx_usb_devctl_stub_c *pluginUsbDevCtl;
|
||||
#endif
|
||||
#if 0
|
||||
bx_g2h_c *g2h;
|
||||
#endif
|
||||
@ -454,6 +462,9 @@ public:
|
||||
#if BX_SUPPORT_APIC
|
||||
bx_ioapic_stub_c stubIOAPIC;
|
||||
#endif
|
||||
#if BX_SUPPORT_PCIUSB
|
||||
bx_usb_devctl_stub_c stubUsbDevCtl;
|
||||
#endif
|
||||
|
||||
// Some info to pass to devices which can handled bulk IO. This allows
|
||||
// the interface to remain the same for IO devices which can't handle
|
||||
@ -506,8 +517,6 @@ private:
|
||||
bx_keyb_enq_t enq_event;
|
||||
} bx_keyboard;
|
||||
|
||||
bx_usb_init_device_t bx_usb_init_device;
|
||||
|
||||
int timer_handle;
|
||||
|
||||
bx_bool is_harddrv_enabled();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_common.cc,v 1.14 2010-12-06 18:51:13 vruppert Exp $
|
||||
// $Id: usb_common.cc,v 1.15 2010-12-14 21:20:37 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -56,19 +56,21 @@
|
||||
|
||||
#define LOG_THIS
|
||||
|
||||
int usb_init_device(const char *devname, logfunctions *hub, void **dev);
|
||||
bx_usb_devctl_c* theUsbDevCtl = NULL;
|
||||
|
||||
int libusb_common_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
DEV_register_usb_init_device(usb_init_device);
|
||||
theUsbDevCtl = new bx_usb_devctl_c;
|
||||
bx_devices.pluginUsbDevCtl = theUsbDevCtl;
|
||||
return(0); // Success
|
||||
}
|
||||
|
||||
void libusb_common_LTX_plugin_fini(void)
|
||||
{
|
||||
delete theUsbDevCtl;
|
||||
}
|
||||
|
||||
int usb_init_device(const char *devname, logfunctions *hub, void **dev)
|
||||
int bx_usb_devctl_c::init_device(const char *devname, logfunctions *hub, void **dev, bx_list_c *sr_list)
|
||||
{
|
||||
usbdev_type type = USB_DEV_TYPE_NONE;
|
||||
int ports;
|
||||
@ -125,9 +127,17 @@ int usb_init_device(const char *devname, logfunctions *hub, void **dev)
|
||||
hub->panic("unknown USB device: %s", devname);
|
||||
return type;
|
||||
}
|
||||
if (*device != NULL) {
|
||||
(*device)->register_state(sr_list);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
void bx_usb_devctl_c::usb_send_msg(void *dev, int msg)
|
||||
{
|
||||
((usb_device_c*)dev)->usb_send_msg(msg);
|
||||
}
|
||||
|
||||
// Dumps the contents of a buffer to the log file
|
||||
void usb_device_c::usb_dump_packet(Bit8u *data, unsigned size)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_common.h,v 1.13 2010-12-06 18:51:13 vruppert Exp $
|
||||
// $Id: usb_common.h,v 1.14 2010-12-14 21:20:37 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -126,6 +126,14 @@ enum usbdev_type {
|
||||
USB_DEV_TYPE_PRINTER
|
||||
};
|
||||
|
||||
class bx_usb_devctl_c : public bx_usb_devctl_stub_c {
|
||||
public:
|
||||
bx_usb_devctl_c() {}
|
||||
virtual ~bx_usb_devctl_c() {}
|
||||
virtual int init_device(const char *devname, logfunctions *hub, void **dev, bx_list_c *sr_list);
|
||||
virtual void usb_send_msg(void *dev, int msg);
|
||||
};
|
||||
|
||||
class usb_device_c : public logfunctions {
|
||||
public:
|
||||
usb_device_c(void);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_hub.cc,v 1.14 2010-12-06 18:51:13 vruppert Exp $
|
||||
// $Id: usb_hub.cc,v 1.15 2010-12-14 21:20:37 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Volker Ruppert
|
||||
@ -396,7 +396,7 @@ int usb_hub_device_c::handle_control(int request, int value, int index, int leng
|
||||
break;
|
||||
case PORT_RESET:
|
||||
if (hub.usb_port[n].device != NULL) {
|
||||
hub.usb_port[n].device->usb_send_msg(USB_MSG_RESET);
|
||||
DEV_usb_send_msg(hub.usb_port[n].device, USB_MSG_RESET);
|
||||
hub.usb_port[n].PortChange |= PORT_STAT_C_RESET;
|
||||
/* set enable bit */
|
||||
hub.usb_port[n].PortStatus |= PORT_STAT_ENABLE;
|
||||
@ -561,11 +561,10 @@ void usb_hub_device_c::init_device(Bit8u port, const char *devname)
|
||||
BX_ERROR(("init_device(): port%d already in use", port+1));
|
||||
return;
|
||||
}
|
||||
type = DEV_usb_init_device(devname, this, &hub.usb_port[port].device);
|
||||
sprintf(pname, "port%d.device", port+1);
|
||||
bx_list_c *sr_list = (bx_list_c*)SIM->get_param(pname, hub.state);
|
||||
type = DEV_usb_init_device(devname, this, &hub.usb_port[port].device, sr_list);
|
||||
if (hub.usb_port[port].device != NULL) {
|
||||
sprintf(pname, "port%d.device", port+1);
|
||||
bx_list_c *devlist = (bx_list_c*)SIM->get_param(pname, hub.state);
|
||||
hub.usb_port[port].device->register_state(devlist);
|
||||
usb_set_connect_status(port, type, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_ohci.cc,v 1.38 2010-12-06 18:51:13 vruppert Exp $
|
||||
// $Id: usb_ohci.cc,v 1.39 2010-12-14 21:20:37 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -455,11 +455,10 @@ void bx_usb_ohci_c::init_device(Bit8u port, const char *devname)
|
||||
BX_ERROR(("init_device(): port%d already in use", port+1));
|
||||
return;
|
||||
}
|
||||
type = DEV_usb_init_device(devname, BX_OHCI_THIS_PTR, &BX_OHCI_THIS hub.usb_port[port].device);
|
||||
sprintf(pname, "usb_ohci.hub.port%d.device", port+1);
|
||||
bx_list_c *sr_list = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
type = DEV_usb_init_device(devname, BX_OHCI_THIS_PTR, &BX_OHCI_THIS hub.usb_port[port].device, sr_list);
|
||||
if (BX_OHCI_THIS hub.usb_port[port].device != NULL) {
|
||||
sprintf(pname, "usb_ohci.hub.port%d.device", port+1);
|
||||
bx_list_c *devlist = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
BX_OHCI_THIS hub.usb_port[port].device->register_state(devlist);
|
||||
usb_set_connect_status(port, type, 1);
|
||||
}
|
||||
}
|
||||
@ -735,7 +734,7 @@ bx_bool bx_usb_ohci_c::write_handler(bx_phy_address addr, unsigned len, void *da
|
||||
BX_OHCI_THIS hub.op_regs.HcControl.hcfs = 3; // suspend state
|
||||
for (unsigned i=0; i<BX_N_USB_OHCI_PORTS; i++)
|
||||
if (BX_OHCI_THIS hub.usb_port[i].HcRhPortStatus.ccs && (BX_OHCI_THIS hub.usb_port[i].device != NULL))
|
||||
BX_OHCI_THIS hub.usb_port[i].device->usb_send_msg(USB_MSG_RESET);
|
||||
DEV_usb_send_msg(BX_OHCI_THIS hub.usb_port[i].device, USB_MSG_RESET);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -938,7 +937,7 @@ bx_bool bx_usb_ohci_c::write_handler(bx_phy_address addr, unsigned len, void *da
|
||||
BX_OHCI_THIS hub.usb_port[p].HcRhPortStatus.lsda =
|
||||
(BX_OHCI_THIS hub.usb_port[p].device->get_speed() == USB_SPEED_LOW);
|
||||
usb_set_connect_status(p, BX_OHCI_THIS hub.usb_port[p].device->get_type(), 1);
|
||||
BX_OHCI_THIS hub.usb_port[p].device->usb_send_msg(USB_MSG_RESET);
|
||||
DEV_usb_send_msg(BX_OHCI_THIS hub.usb_port[p].device, USB_MSG_RESET);
|
||||
}
|
||||
set_interrupt(OHCI_INTR_RHSC);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_uhci.cc,v 1.30 2010-12-06 18:51:13 vruppert Exp $
|
||||
// $Id: usb_uhci.cc,v 1.31 2010-12-14 21:20:37 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -298,11 +298,10 @@ void bx_usb_uhci_c::init_device(Bit8u port, const char *devname)
|
||||
BX_ERROR(("init_device(): port%d already in use", port+1));
|
||||
return;
|
||||
}
|
||||
type = DEV_usb_init_device(devname, BX_UHCI_THIS_PTR, &BX_UHCI_THIS hub.usb_port[port].device);
|
||||
sprintf(pname, "usb_uhci.hub.port%d.device", port+1);
|
||||
bx_list_c *sr_list = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
type = DEV_usb_init_device(devname, BX_UHCI_THIS_PTR, &BX_UHCI_THIS hub.usb_port[port].device, sr_list);
|
||||
if (BX_UHCI_THIS hub.usb_port[port].device != NULL) {
|
||||
sprintf(pname, "usb_uhci.hub.port%d.device", port+1);
|
||||
bx_list_c *devlist = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
BX_UHCI_THIS hub.usb_port[port].device->register_state(devlist);
|
||||
usb_set_connect_status(port, type, 1);
|
||||
}
|
||||
}
|
||||
@ -463,7 +462,7 @@ void bx_usb_uhci_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
for (unsigned i=0; i<BX_N_USB_UHCI_PORTS; i++) {
|
||||
if (BX_UHCI_THIS hub.usb_port[i].status) {
|
||||
if (BX_UHCI_THIS hub.usb_port[i].device != NULL) {
|
||||
BX_UHCI_THIS hub.usb_port[i].device->usb_send_msg(USB_MSG_RESET);
|
||||
DEV_usb_send_msg(BX_UHCI_THIS hub.usb_port[i].device, USB_MSG_RESET);
|
||||
}
|
||||
}
|
||||
BX_UHCI_THIS hub.usb_port[i].connect_changed = 1;
|
||||
@ -605,7 +604,7 @@ void bx_usb_uhci_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
BX_UHCI_THIS hub.usb_port[port].low_speed =
|
||||
(BX_UHCI_THIS hub.usb_port[port].device->get_speed() == USB_SPEED_LOW);
|
||||
usb_set_connect_status(port, BX_UHCI_THIS hub.usb_port[port].device->get_type(), 1);
|
||||
BX_UHCI_THIS hub.usb_port[port].device->usb_send_msg(USB_MSG_RESET);
|
||||
DEV_usb_send_msg(BX_UHCI_THIS hub.usb_port[port].device, USB_MSG_RESET);
|
||||
}
|
||||
}
|
||||
BX_INFO(("Port%d: Reset", port+1));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: plugin.h,v 1.84 2010-12-06 18:51:12 vruppert Exp $
|
||||
// $Id: plugin.h,v 1.85 2010-12-14 21:20:37 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 The Bochs Project
|
||||
@ -244,9 +244,9 @@ extern "C" {
|
||||
#define DEV_unregister_memory_handlers(rh,wh,b,e) \
|
||||
bx_devices.mem->unregisterMemoryHandlers(rh,wh,b,e)
|
||||
|
||||
///////// USB device init macros
|
||||
#define DEV_register_usb_init_device(a) bx_devices.register_usb_init_device(a)
|
||||
#define DEV_usb_init_device(a,b,c) (usbdev_type)bx_devices.usb_init_device(a,b,(void**)c)
|
||||
///////// USB device macros
|
||||
#define DEV_usb_init_device(a,b,c,d) (usbdev_type)bx_devices.pluginUsbDevCtl->init_device(a,b,(void**)c,d)
|
||||
#define DEV_usb_send_msg(a,b) bx_devices.pluginUsbDevCtl->usb_send_msg((void*)a,b)
|
||||
|
||||
|
||||
#if BX_HAVE_DLFCN_H
|
||||
|
Loading…
Reference in New Issue
Block a user