- definition of the number of USB ports moved to bochs.h

- create config parameters for USB depending of the defined number of ports
- removed obsolete comment
- bx_param_num_c flag USE_SPIN_CONTROL now available for all config interfaces
This commit is contained in:
Volker Ruppert 2009-03-15 12:54:59 +00:00
parent 4470c6a1c8
commit 2b6ba5e44c
8 changed files with 70 additions and 81 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.242 2009-02-23 11:06:53 vruppert Exp $
// $Id: bochs.h,v 1.243 2009-03-15 12:54:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -502,6 +502,9 @@ extern bx_bool bx_gui_sighandler;
#define BX_N_OPTRAM_IMAGES 4
#define BX_N_SERIAL_PORTS 4
#define BX_N_PARALLEL_PORTS 2
#define BX_N_USB_UHCI_PORTS 2
#define BX_N_USB_OHCI_PORTS 2
#define BX_N_USB_HUB_PORTS 8
#define BX_N_PCI_SLOTS 5
#define BX_N_USER_PLUGINS 8

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.160 2009-03-10 19:33:03 vruppert Exp $
// $Id: config.cc,v 1.161 2009-03-15 12:54:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -524,9 +524,7 @@ void bx_init_options()
1, 2048,
BX_DEFAULT_MEM_MEGS);
ramsize->set_ask_format("Enter memory size (MB): [%d] ");
#if BX_WITH_WX
ramsize->set_options(bx_param_num_c::USE_SPIN_CONTROL);
#endif
path = new bx_param_filename_c(rom,
"path",
@ -1385,18 +1383,16 @@ void bx_init_options()
"Enables the UHCI emulation",
0);
enabled->set_enabled(BX_SUPPORT_USB_UHCI);
port = new bx_param_string_c(menu,
"port1",
"Port #1 device",
"Device connected to USB port #1",
"", BX_PATHNAME_LEN);
port->set_group(group);
port = new bx_param_string_c(menu,
"port2",
"Port #2 device",
"Device connected to USB port #2",
"", BX_PATHNAME_LEN);
port->set_group(group);
deplist = new bx_list_c(NULL, 2);
for (i=0; i<BX_N_USB_UHCI_PORTS; i++) {
sprintf(name, "port%d", i+1);
sprintf(label, "Port #%d device", i+1);
sprintf(descr, "Device connected to UHCI port #%d", i+1);
port = new bx_param_string_c(menu, name, label, descr, "", BX_PATHNAME_LEN);
port->set_group(group);
deplist->add(port);
}
enabled->set_dependent_list(deplist);
// OHCI options
strcpy(group, "USB OHCI");
@ -1409,18 +1405,16 @@ void bx_init_options()
"Enables the OHCI emulation",
0);
enabled->set_enabled(BX_SUPPORT_USB_OHCI);
port = new bx_param_string_c(menu,
"port1",
"Port #1 device",
"Device connected to USB port #1",
"", BX_PATHNAME_LEN);
port->set_group(group);
port = new bx_param_string_c(menu,
"port2",
"Port #2 device",
"Device connected to USB port #2",
"", BX_PATHNAME_LEN);
port->set_group(group);
deplist = new bx_list_c(NULL, 2);
for (i=0; i<BX_N_USB_OHCI_PORTS; i++) {
sprintf(name, "port%d", i+1);
sprintf(label, "Port #%d device", i+1);
sprintf(descr, "Device connected to OHCI port #%d", i+1);
port = new bx_param_string_c(menu, name, label, descr, "", BX_PATHNAME_LEN);
port->set_group(group);
deplist->add(port);
}
enabled->set_dependent_list(deplist);
// network subtree
bx_list_c *network = new bx_list_c(root_param, "network", "Network Configuration");
@ -1600,11 +1594,9 @@ void bx_init_options()
0, BX_MAX_BIT32U,
0);
#if BX_WITH_WX
midimode->set_options(bx_param_num_c::USE_SPIN_CONTROL);
wavemode->set_options(bx_param_num_c::USE_SPIN_CONTROL);
loglevel->set_options(bx_param_num_c::USE_SPIN_CONTROL);
#endif
loglevel->set_group("SB16");
dmatimer->set_group("SB16");
enabled->set_dependent_list(menu->clone());

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: usb_common.cc,v 1.8 2009-03-12 20:24:56 vruppert Exp $
// $Id: usb_common.cc,v 1.9 2009-03-15 12:54:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
@ -96,7 +96,7 @@ usbdev_type usb_init_device(const char *devname, logfunctions *hub, usb_device_c
if (strlen(devname) > 3) {
if (devname[3] == ':') {
ports = atoi(&devname[4]);
if ((ports < 2) || (ports > 8)) {
if ((ports < 2) || (ports > BX_N_USB_HUB_PORTS)) {
hub->panic("USB device 'hub': invalid number of ports");
}
} else {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: usb_hub.h,v 1.2 2009-03-12 20:24:56 vruppert Exp $
// $Id: usb_hub.h,v 1.3 2009-03-15 12:54:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 Volker Ruppert
@ -25,7 +25,7 @@
#define BX_IODEV_USB_HUB_H
#define USB_HUB_NUM_PORTS 8
// number of ports defined in bochs.h
class usb_hub_device_c : public usb_device_c {
public:
@ -51,7 +51,7 @@ private:
Bit16u PortStatus;
Bit16u PortChange;
} usb_port[USB_HUB_NUM_PORTS];
} usb_port[BX_N_USB_HUB_PORTS];
} hub;
int broadcast_packet(USBPacket *p);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: usb_ohci.cc,v 1.21 2009-03-09 23:18:52 vruppert Exp $
// $Id: usb_ohci.cc,v 1.22 2009-03-15 12:54:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
@ -29,12 +29,6 @@
#define BX_PLUGGABLE
// TODO:
// if not Operational, stop the two timers to free cpu bandwidth,
// then start them again when in Operational? (Maybe only if not
// in operational for more than 10 frames.
#include "iodev.h"
#if BX_SUPPORT_PCI && BX_SUPPORT_USB_OHCI
@ -105,7 +99,7 @@ bx_usb_ohci_c::~bx_usb_ohci_c()
if (BX_OHCI_THIS device_buffer != NULL)
delete [] BX_OHCI_THIS device_buffer;
for (int i=0; i<USB_OHCI_NUM_PORTS; i++) {
for (int i=0; i<BX_N_USB_OHCI_PORTS; i++) {
sprintf(pname, "port%d", i+1);
SIM->get_param_string(pname, SIM->get_param(BXPN_USB_OHCI))->set_handler(NULL);
remove_device(i);
@ -146,7 +140,7 @@ void bx_usb_ohci_c::init(void)
bx_list_c *usb_rt = (bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB);
bx_list_c *ohci = new bx_list_c(usb_rt, "ohci", "OHCI Configuration");
ohci->get_options()->set(bx_list_c::SHOW_PARENT);
for (i=0; i<USB_OHCI_NUM_PORTS; i++) {
for (i=0; i<BX_N_USB_OHCI_PORTS; i++) {
sprintf(pname, "port%d", i+1);
port = SIM->get_param_string(pname, SIM->get_param(BXPN_USB_OHCI));
ohci->add(port);
@ -300,10 +294,10 @@ void bx_usb_ohci_c::reset_hc()
BX_OHCI_THIS hub.op_regs.HcRhDescriptorA.dt = 0;
BX_OHCI_THIS hub.op_regs.HcRhDescriptorA.nps = 0;
BX_OHCI_THIS hub.op_regs.HcRhDescriptorA.psm = 1;
BX_OHCI_THIS hub.op_regs.HcRhDescriptorA.ndp = USB_OHCI_NUM_PORTS;
BX_OHCI_THIS hub.op_regs.HcRhDescriptorA.ndp = BX_N_USB_OHCI_PORTS;
// HcRhDescriptorB
BX_OHCI_THIS hub.op_regs.HcRhDescriptorB.ppcm = ((1 << USB_OHCI_NUM_PORTS) - 1) << 1;
BX_OHCI_THIS hub.op_regs.HcRhDescriptorB.ppcm = ((1 << BX_N_USB_OHCI_PORTS) - 1) << 1;
BX_OHCI_THIS hub.op_regs.HcRhDescriptorB.dr = 0x0000;
// HcRhStatus
@ -317,7 +311,7 @@ void bx_usb_ohci_c::reset_hc()
BX_OHCI_THIS hub.op_regs.HcRhStatus.lps = 0;
// HcRhPortStatus[x]
for (i=0; i<USB_OHCI_NUM_PORTS; i++) {
for (i=0; i<BX_N_USB_OHCI_PORTS; i++) {
reset_port(i);
if (BX_OHCI_THIS hub.usb_port[i].device == NULL) {
sprintf(pname, "port%d", i+1);
@ -403,7 +397,7 @@ void bx_usb_ohci_c::register_state(void)
new bx_shadow_bool_c(reg, "drwe", &BX_OHCI_THIS hub.op_regs.HcRhStatus.drwe);
new bx_shadow_bool_c(reg, "oci", &BX_OHCI_THIS hub.op_regs.HcRhStatus.oci);
new bx_shadow_bool_c(reg, "lps", &BX_OHCI_THIS hub.op_regs.HcRhStatus.lps);
for (i=0; i<USB_OHCI_NUM_PORTS; i++) {
for (i=0; i<BX_N_USB_OHCI_PORTS; i++) {
sprintf(portnum, "port%d", i+1);
port = new bx_list_c(hub, portnum, 2);
reg = new bx_list_c(port, "HcRhPortStatus", 12);
@ -437,7 +431,7 @@ void bx_usb_ohci_c::after_restore_state(void)
4096)) {
BX_INFO(("new base address: 0x%04x", BX_OHCI_THIS hub.base_addr));
}
for (int j=0; j<USB_OHCI_NUM_PORTS; j++) {
for (int j=0; j<BX_N_USB_OHCI_PORTS; j++) {
if (BX_OHCI_THIS hub.usb_port[j].device != NULL) {
BX_OHCI_THIS hub.usb_port[j].device->after_restore_state();
}
@ -626,17 +620,17 @@ bx_bool bx_usb_ohci_c::read_handler(bx_phy_address addr, unsigned len, void *dat
break;
case 0x60: // HcRhPortStatus[3]
#if (USB_OHCI_NUM_PORTS < 4)
#if (BX_N_USB_OHCI_PORTS < 4)
val = 0;
break;
#endif
case 0x5C: // HcRhPortStatus[2]
#if (USB_OHCI_NUM_PORTS < 3)
#if (BX_N_USB_OHCI_PORTS < 3)
val = 0;
break;
#endif
case 0x58: // HcRhPortStatus[1]
#if (USB_OHCI_NUM_PORTS < 2)
#if (BX_N_USB_OHCI_PORTS < 2)
val = 0;
break;
#endif
@ -733,7 +727,7 @@ bx_bool bx_usb_ohci_c::write_handler(bx_phy_address addr, unsigned len, void *da
BX_OHCI_THIS hub.op_regs.HcCommandStatus.hcr = 1;
BX_OHCI_THIS reset_hc();
BX_OHCI_THIS hub.op_regs.HcControl.hcfs = 3; // suspend state
for (unsigned i=0; i<USB_OHCI_NUM_PORTS; i++)
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);
}
@ -871,20 +865,20 @@ bx_bool bx_usb_ohci_c::write_handler(bx_phy_address addr, unsigned len, void *da
if (value & (1<<17)) BX_OHCI_THIS hub.op_regs.HcRhStatus.ocic = 1;
if (value & (1<<16)) {
if (BX_OHCI_THIS hub.op_regs.HcRhDescriptorA.psm == 0) {
for (p=0; p<USB_OHCI_NUM_PORTS; p++)
for (p=0; p<BX_N_USB_OHCI_PORTS; p++)
BX_OHCI_THIS hub.usb_port[p].HcRhPortStatus.pps = 1;
} else {
for (p=0; p<USB_OHCI_NUM_PORTS; p++)
for (p=0; p<BX_N_USB_OHCI_PORTS; p++)
if ((BX_OHCI_THIS hub.op_regs.HcRhDescriptorB.ppcm & (1<<p)) == 0)
BX_OHCI_THIS hub.usb_port[p].HcRhPortStatus.pps = 1;
}
}
if (value & (1<<0)) {
if (BX_OHCI_THIS hub.op_regs.HcRhDescriptorA.psm == 0) {
for (p=0; p<USB_OHCI_NUM_PORTS; p++)
for (p=0; p<BX_N_USB_OHCI_PORTS; p++)
BX_OHCI_THIS hub.usb_port[p].HcRhPortStatus.pps = 0;
} else {
for (p=0; p<USB_OHCI_NUM_PORTS; p++)
for (p=0; p<BX_N_USB_OHCI_PORTS; p++)
if (!(BX_OHCI_THIS hub.op_regs.HcRhDescriptorB.ppcm & (1<<p)))
BX_OHCI_THIS hub.usb_port[p].HcRhPortStatus.pps = 0;
}
@ -893,15 +887,15 @@ bx_bool bx_usb_ohci_c::write_handler(bx_phy_address addr, unsigned len, void *da
}
case 0x60: // HcRhPortStatus[3]
#if (USB_OHCI_NUM_PORTS < 4)
#if (BX_N_USB_OHCI_PORTS < 4)
break;
#endif
case 0x5C: // HcRhPortStatus[2]
#if (USB_OHCI_NUM_PORTS < 3)
#if (BX_N_USB_OHCI_PORTS < 3)
break;
#endif
case 0x58: // HcRhPortStatus[1]
#if (USB_OHCI_NUM_PORTS < 2)
#if (BX_N_USB_OHCI_PORTS < 2)
break;
#endif
case 0x54: { // HcRhPortStatus[0]
@ -1284,7 +1278,7 @@ int bx_usb_ohci_c::broadcast_packet(USBPacket *p)
int i, ret;
ret = USB_RET_NODEV;
for (i = 0; i < USB_OHCI_NUM_PORTS && ret == USB_RET_NODEV; i++) {
for (i = 0; i < BX_N_USB_OHCI_PORTS && ret == USB_RET_NODEV; i++) {
if ((BX_OHCI_THIS hub.usb_port[i].device != NULL) &&
(BX_OHCI_THIS hub.usb_port[i].HcRhPortStatus.ccs)) {
ret = BX_OHCI_THIS hub.usb_port[i].device->handle_packet(p);
@ -1461,7 +1455,7 @@ const char *bx_usb_ohci_c::usb_param_handler(bx_param_string_c *param, int set,
if (set) {
portnum = atoi(param->get_name()+4) - 1;
bx_bool empty = ((strlen(val) == 0) || (!strcmp(val, "none")));
if ((portnum >= 0) && (portnum < USB_OHCI_NUM_PORTS)) {
if ((portnum >= 0) && (portnum < BX_N_USB_OHCI_PORTS)) {
BX_INFO(("USB port #%d experimental device change", portnum+1));
if (empty && BX_OHCI_THIS hub.usb_port[portnum].HcRhPortStatus.ccs) {
if (BX_OHCI_THIS hub.usb_port[portnum].device != NULL) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: usb_ohci.h,v 1.13 2009-03-09 23:18:52 vruppert Exp $
// $Id: usb_ohci.h,v 1.14 2009-03-15 12:54:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
@ -30,7 +30,7 @@
# define BX_OHCI_THIS_PTR this
#endif
#define USB_OHCI_NUM_PORTS 2
// number of ports defined in bochs.h
#define OHCI_INTR_SO (1<<0) // Scheduling overrun
#define OHCI_INTR_WD (1<<1) // HcDoneHead writeback
@ -230,7 +230,7 @@ typedef struct {
bx_bool pes; // 1 bit PortEnableStatus = 0b RW RW
bx_bool ccs; // 1 bit CurrentConnectStatus = 0b RW RW
} HcRhPortStatus;
} usb_port[USB_OHCI_NUM_PORTS];
} usb_port[BX_N_USB_OHCI_PORTS];
Bit8u pci_conf[256];
Bit8u devfunc;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: usb_uhci.cc,v 1.18 2009-03-09 18:28:17 vruppert Exp $
// $Id: usb_uhci.cc,v 1.19 2009-03-15 12:54:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
@ -72,7 +72,7 @@ bx_usb_uhci_c::~bx_usb_uhci_c()
if (BX_UHCI_THIS device_buffer != NULL)
delete [] BX_UHCI_THIS device_buffer;
for (int i=0; i<USB_UHCI_NUM_PORTS; i++) {
for (int i=0; i<BX_N_USB_UHCI_PORTS; i++) {
sprintf(pname, "port%d", i+1);
SIM->get_param_string(pname, SIM->get_param(BXPN_USB_UHCI))->set_handler(NULL);
remove_device(i);
@ -114,7 +114,7 @@ void bx_usb_uhci_c::init(void)
bx_list_c *usb_rt = (bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB);
bx_list_c *uhci = new bx_list_c(usb_rt, "uhci", "UHCI Configuration");
uhci->get_options()->set(bx_list_c::SHOW_PARENT);
for (i=0; i<USB_UHCI_NUM_PORTS; i++) {
for (i=0; i<BX_N_USB_UHCI_PORTS; i++) {
sprintf(pname, "port%d", i+1);
port = SIM->get_param_string(pname, SIM->get_param(BXPN_USB_UHCI));
uhci->add(port);
@ -190,7 +190,7 @@ void bx_usb_uhci_c::reset(unsigned type)
BX_UHCI_THIS hub.usb_frame_num.frame_num = 0x0000;
BX_UHCI_THIS hub.usb_frame_base.frame_base = 0x00000000;
BX_UHCI_THIS hub.usb_sof.sof_timing = 0x40;
for (j=0; j<USB_UHCI_NUM_PORTS; j++) {
for (j=0; j<BX_N_USB_UHCI_PORTS; j++) {
BX_UHCI_THIS hub.usb_port[j].connect_changed = 0;
BX_UHCI_THIS hub.usb_port[j].line_dminus = 0;
BX_UHCI_THIS hub.usb_port[j].line_dplus = 0;
@ -218,7 +218,7 @@ void bx_usb_uhci_c::register_state(void)
bx_list_c *hub, *usb_cmd, *usb_st, *usb_en, *port;
bx_list_c *list = new bx_list_c(SIM->get_bochs_root(), "usb_uhci", "USB UHCI State");
hub = new bx_list_c(list, "hub", USB_UHCI_NUM_PORTS + 7);
hub = new bx_list_c(list, "hub", BX_N_USB_UHCI_PORTS + 7);
usb_cmd = new bx_list_c(hub, "usb_command", 8);
new bx_shadow_bool_c(usb_cmd, "max_packet_size", &BX_UHCI_THIS hub.usb_command.max_packet_size);
new bx_shadow_bool_c(usb_cmd, "configured", &BX_UHCI_THIS hub.usb_command.configured);
@ -243,7 +243,7 @@ void bx_usb_uhci_c::register_state(void)
new bx_shadow_num_c(hub, "frame_num", &BX_UHCI_THIS hub.usb_frame_num.frame_num, BASE_HEX);
new bx_shadow_num_c(hub, "frame_base", &BX_UHCI_THIS hub.usb_frame_base.frame_base, BASE_HEX);
new bx_shadow_num_c(hub, "sof_timing", &BX_UHCI_THIS hub.usb_sof.sof_timing, BASE_HEX);
for (j=0; j<USB_UHCI_NUM_PORTS; j++) {
for (j=0; j<BX_N_USB_UHCI_PORTS; j++) {
sprintf(portnum, "port%d", j+1);
port = new bx_list_c(hub, portnum, 11);
new bx_shadow_bool_c(port, "suspend", &BX_UHCI_THIS hub.usb_port[j].suspend);
@ -274,7 +274,7 @@ void bx_usb_uhci_c::after_restore_state(void)
{
BX_INFO(("new base address: 0x%04x", BX_UHCI_THIS hub.base_ioaddr));
}
for (int j=0; j<USB_UHCI_NUM_PORTS; j++) {
for (int j=0; j<BX_N_USB_UHCI_PORTS; j++) {
if (BX_UHCI_THIS hub.usb_port[j].device != NULL) {
BX_UHCI_THIS hub.usb_port[j].device->after_restore_state();
}
@ -389,7 +389,7 @@ Bit32u bx_usb_uhci_c::read(Bit32u address, unsigned io_len)
case 0x12: // port #2
case 0x13:
port = (offset & 0x0F) >> 1;
if (port < USB_UHCI_NUM_PORTS) {
if (port < BX_N_USB_UHCI_PORTS) {
val = BX_UHCI_THIS hub.usb_port[port].suspend << 12
| 1 << 10 // some Root Hubs have bit 10 set ?????
| BX_UHCI_THIS hub.usb_port[port].reset << 9
@ -454,7 +454,7 @@ void bx_usb_uhci_c::write(Bit32u address, Bit32u value, unsigned io_len)
// HCRESET
if (BX_UHCI_THIS hub.usb_command.host_reset) {
BX_UHCI_THIS reset(0);
for (unsigned i=0; i<USB_UHCI_NUM_PORTS; i++) {
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);
@ -562,7 +562,7 @@ void bx_usb_uhci_c::write(Bit32u address, Bit32u value, unsigned io_len)
case 0x10: // port #1
case 0x12: // port #2
port = (offset & 0x0F) >> 1;
if ((port < USB_UHCI_NUM_PORTS) && (io_len == 2)) {
if ((port < BX_N_USB_UHCI_PORTS) && (io_len == 2)) {
// If the ports reset bit is set, don't allow any writes unless the new write will clear the reset bit
if (BX_UHCI_THIS hub.usb_port[port].reset & (value & (1<<9)))
break;
@ -627,7 +627,7 @@ void bx_usb_uhci_c::usb_timer(void)
// If the "global reset" bit was set by software
if (BX_UHCI_THIS global_reset) {
for (i=0; i<USB_UHCI_NUM_PORTS; i++) {
for (i=0; i<BX_N_USB_UHCI_PORTS; i++) {
BX_UHCI_THIS hub.usb_port[i].able_changed = 0;
BX_UHCI_THIS hub.usb_port[i].connect_changed = 0;
BX_UHCI_THIS hub.usb_port[i].enabled = 0;
@ -873,7 +873,7 @@ int bx_usb_uhci_c::broadcast_packet(USBPacket *p)
int i, ret;
ret = USB_RET_NODEV;
for (i = 0; i < USB_UHCI_NUM_PORTS && ret == USB_RET_NODEV; i++) {
for (i = 0; i < BX_N_USB_UHCI_PORTS && ret == USB_RET_NODEV; i++) {
if ((BX_UHCI_THIS hub.usb_port[i].device != NULL) &&
(BX_UHCI_THIS hub.usb_port[i].enabled)) {
ret = BX_UHCI_THIS hub.usb_port[i].device->handle_packet(p);
@ -1085,7 +1085,7 @@ const char *bx_usb_uhci_c::usb_param_handler(bx_param_string_c *param, int set,
if (set) {
portnum = atoi(param->get_name()+4) - 1;
bx_bool empty = ((strlen(val) == 0) || (!strcmp(val, "none")));
if ((portnum >= 0) && (portnum < USB_UHCI_NUM_PORTS)) {
if ((portnum >= 0) && (portnum < BX_N_USB_UHCI_PORTS)) {
BX_INFO(("USB port #%d experimental device change", portnum+1));
if (empty && BX_UHCI_THIS hub.usb_port[portnum].status) {
if (BX_UHCI_THIS hub.usb_port[portnum].device != NULL) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: usb_uhci.h,v 1.10 2009-03-05 19:12:23 vruppert Exp $
// $Id: usb_uhci.h,v 1.11 2009-03-15 12:54:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
@ -29,7 +29,7 @@
# define BX_UHCI_THIS_PTR this
#endif
#define USB_UHCI_NUM_PORTS 2 /* UHCI supports 2 ports per root hub */
// defined in bochs.h: UHCI supports 2 ports per root hub
typedef struct {
Bit32u base_ioaddr;
@ -153,7 +153,7 @@ typedef struct {
bx_bool enabled;
bx_bool connect_changed;
bx_bool status;
} usb_port[USB_UHCI_NUM_PORTS];
} usb_port[BX_N_USB_UHCI_PORTS];
Bit8u pci_conf[256];
Bit8u devfunc;