- the status bar indicators for the USB HCs now show the data transfer
This commit is contained in:
parent
153f86b1a8
commit
b7842a169a
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_ohci.cc,v 1.27 2009-04-01 07:27:34 vruppert Exp $
|
||||
// $Id: usb_ohci.cc,v 1.28 2009-04-06 09:30:24 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -90,6 +90,7 @@ bx_usb_ohci_c::bx_usb_ohci_c()
|
||||
put("OHCI");
|
||||
memset((void*)&hub, 0, sizeof(bx_usb_ohci_t));
|
||||
device_buffer = NULL;
|
||||
hub.iolight_timer_index = BX_NULL_TIMER_HANDLE;
|
||||
}
|
||||
|
||||
bx_usb_ohci_c::~bx_usb_ohci_c()
|
||||
@ -135,7 +136,7 @@ void bx_usb_ohci_c::init(void)
|
||||
BX_OHCI_THIS hub.sof_time = 0;
|
||||
|
||||
//FIXME: for now, we want a status bar // hub zero, port zero
|
||||
BX_OHCI_THIS hub.statusbar_id[0] = bx_gui->register_statusitem("OHCI");
|
||||
BX_OHCI_THIS hub.statusbar_id = bx_gui->register_statusitem("OHCI");
|
||||
|
||||
bx_list_c *usb_rt = (bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB);
|
||||
bx_list_c *ohci = (bx_list_c*)SIM->get_param(BXPN_USB_OHCI);
|
||||
@ -155,6 +156,13 @@ void bx_usb_ohci_c::init(void)
|
||||
//HACK: Turn on debug messages from the start
|
||||
//BX_OHCI_THIS setonoff(LOGLEV_DEBUG, ACT_REPORT);
|
||||
|
||||
// register timer for i/o light
|
||||
if (BX_OHCI_THIS hub.iolight_timer_index == BX_NULL_TIMER_HANDLE) {
|
||||
BX_OHCI_THIS hub.iolight_timer_index =
|
||||
DEV_register_timer(this, iolight_timer_handler, 5000, 0,0, "OHCI i/o light");
|
||||
}
|
||||
BX_OHCI_THIS hub.iolight_counter = 0;
|
||||
|
||||
BX_INFO(("USB OHCI initialized"));
|
||||
}
|
||||
|
||||
@ -1184,6 +1192,16 @@ bx_bool bx_usb_ohci_c::process_td(struct OHCI_TD *td, struct OHCI_ED *ed)
|
||||
BX_DEBUG((" td->t = %i ed->c = %i td->di = %i td->r = %i", TD_GET_T(td), ED_GET_C(ed), TD_GET_DI(td), TD_GET_R(td)));
|
||||
BX_DEBUG((" td->cbp = 0x%08X", TD_GET_CBP(td)));
|
||||
|
||||
/* set status bar conditions for device */
|
||||
if (!BX_OHCI_THIS hub.iolight_counter) {
|
||||
if (pid == USB_TOKEN_OUT)
|
||||
bx_gui->statusbar_setitem(BX_OHCI_THIS hub.statusbar_id, 1, 1); // write
|
||||
else
|
||||
bx_gui->statusbar_setitem(BX_OHCI_THIS hub.statusbar_id, 1); // read
|
||||
}
|
||||
BX_OHCI_THIS hub.iolight_counter = 5;
|
||||
bx_pc_system.activate_timer(BX_OHCI_THIS hub.iolight_timer_index, 5000, 0);
|
||||
|
||||
switch (pid) {
|
||||
case USB_TOKEN_SETUP:
|
||||
if (len > 0)
|
||||
@ -1297,6 +1315,22 @@ int bx_usb_ohci_c::broadcast_packet(USBPacket *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void bx_usb_ohci_c::iolight_timer_handler(void *this_ptr)
|
||||
{
|
||||
bx_usb_ohci_c *class_ptr = (bx_usb_ohci_c *) this_ptr;
|
||||
class_ptr->iolight_timer();
|
||||
}
|
||||
|
||||
void bx_usb_ohci_c::iolight_timer()
|
||||
{
|
||||
if (BX_OHCI_THIS hub.iolight_counter > 0) {
|
||||
if (--BX_OHCI_THIS hub.iolight_counter)
|
||||
bx_pc_system.activate_timer(BX_OHCI_THIS hub.iolight_timer_index, 5000, 0);
|
||||
else
|
||||
bx_gui->statusbar_setitem(BX_OHCI_THIS hub.statusbar_id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// pci configuration space read callback handler
|
||||
Bit32u bx_usb_ohci_c::pci_read_handler(Bit8u address, unsigned io_len)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_ohci.h,v 1.14 2009-03-15 12:54:59 vruppert Exp $
|
||||
// $Id: usb_ohci.h,v 1.15 2009-04-06 09:30:25 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -239,7 +239,9 @@ typedef struct {
|
||||
bx_bool use_bulk_head;
|
||||
Bit64u sof_time;
|
||||
|
||||
int statusbar_id[2]; // IDs of the status LEDs
|
||||
int statusbar_id; // ID of the status LEDs
|
||||
int iolight_counter;
|
||||
int iolight_timer_index;
|
||||
} bx_usb_ohci_t;
|
||||
|
||||
|
||||
@ -290,6 +292,10 @@ private:
|
||||
bx_bool read_handler(bx_phy_address addr, unsigned len, void *data, void *param);
|
||||
bx_bool write_handler(bx_phy_address addr, unsigned len, void *data, void *param);
|
||||
#endif
|
||||
|
||||
static void iolight_timer_handler(void *);
|
||||
void iolight_timer(void);
|
||||
|
||||
};
|
||||
|
||||
#endif // BX_IODEV_USB_OHCI_H
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_uhci.cc,v 1.21 2009-03-29 20:48:17 vruppert Exp $
|
||||
// $Id: usb_uhci.cc,v 1.22 2009-04-06 09:30:25 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -63,6 +63,7 @@ bx_usb_uhci_c::bx_usb_uhci_c()
|
||||
put("UHCI");
|
||||
memset((void*)&hub, 0, sizeof(bx_usb_uhci_t));
|
||||
device_buffer = NULL;
|
||||
hub.iolight_timer_index = BX_NULL_TIMER_HANDLE;
|
||||
}
|
||||
|
||||
bx_usb_uhci_c::~bx_usb_uhci_c()
|
||||
@ -109,7 +110,7 @@ void bx_usb_uhci_c::init(void)
|
||||
BX_UHCI_THIS hub.base_ioaddr = 0x0;
|
||||
|
||||
//FIXME: for now, we want a status bar // hub zero, port zero
|
||||
BX_UHCI_THIS hub.statusbar_id[0] = bx_gui->register_statusitem("UHCI");
|
||||
BX_UHCI_THIS hub.statusbar_id = bx_gui->register_statusitem("UHCI");
|
||||
|
||||
bx_list_c *usb_rt = (bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB);
|
||||
bx_list_c *uhci = (bx_list_c*)SIM->get_param(BXPN_USB_UHCI);
|
||||
@ -127,6 +128,13 @@ void bx_usb_uhci_c::init(void)
|
||||
//HACK: Turn on debug messages from the start
|
||||
//BX_UHCI_THIS setonoff(LOGLEV_DEBUG, ACT_REPORT);
|
||||
|
||||
// register timer for i/o light
|
||||
if (BX_UHCI_THIS hub.iolight_timer_index == BX_NULL_TIMER_HANDLE) {
|
||||
BX_UHCI_THIS hub.iolight_timer_index =
|
||||
DEV_register_timer(this, iolight_timer_handler, 5000, 0,0, "UHCI i/o light");
|
||||
}
|
||||
BX_UHCI_THIS hub.iolight_counter = 0;
|
||||
|
||||
BX_INFO(("USB UHCI initialized"));
|
||||
}
|
||||
|
||||
@ -825,6 +833,16 @@ bx_bool bx_usb_uhci_c::DoTransfer(Bit32u address, Bit32u queue_num, struct TD *t
|
||||
//if (dev && dev->in_stall && (pid != USB_TOKEN_SETUP))
|
||||
// return FALSE;
|
||||
|
||||
/* set status bar conditions for device */
|
||||
if (!BX_UHCI_THIS hub.iolight_counter) {
|
||||
if (pid == USB_TOKEN_OUT)
|
||||
bx_gui->statusbar_setitem(BX_UHCI_THIS hub.statusbar_id, 1, 1); // write
|
||||
else
|
||||
bx_gui->statusbar_setitem(BX_UHCI_THIS hub.statusbar_id, 1); // read
|
||||
}
|
||||
BX_UHCI_THIS hub.iolight_counter = 5;
|
||||
bx_pc_system.activate_timer(BX_UHCI_THIS hub.iolight_timer_index, 5000, 0);
|
||||
|
||||
maxlen++;
|
||||
maxlen &= 0x7FF;
|
||||
|
||||
@ -902,6 +920,22 @@ void bx_usb_uhci_c::set_status(struct TD *td, bx_bool stalled, bx_bool data_buff
|
||||
td->dword1 &= ~((1<<28) | (1<<27)); // clear the c_err field in there was an error
|
||||
}
|
||||
|
||||
void bx_usb_uhci_c::iolight_timer_handler(void *this_ptr)
|
||||
{
|
||||
bx_usb_uhci_c *class_ptr = (bx_usb_uhci_c *) this_ptr;
|
||||
class_ptr->iolight_timer();
|
||||
}
|
||||
|
||||
void bx_usb_uhci_c::iolight_timer()
|
||||
{
|
||||
if (BX_UHCI_THIS hub.iolight_counter > 0) {
|
||||
if (--BX_UHCI_THIS hub.iolight_counter)
|
||||
bx_pc_system.activate_timer(BX_UHCI_THIS hub.iolight_timer_index, 5000, 0);
|
||||
else
|
||||
bx_gui->statusbar_setitem(BX_UHCI_THIS hub.statusbar_id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// pci configuration space read callback handler
|
||||
Bit32u bx_usb_uhci_c::pci_read_handler(Bit8u address, unsigned io_len)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_uhci.h,v 1.11 2009-03-15 12:54:59 vruppert Exp $
|
||||
// $Id: usb_uhci.h,v 1.12 2009-04-06 09:30:26 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -158,8 +158,9 @@ typedef struct {
|
||||
Bit8u pci_conf[256];
|
||||
Bit8u devfunc;
|
||||
|
||||
int statusbar_id[2]; // IDs of the status LEDs
|
||||
|
||||
int statusbar_id; // ID of the status LEDs
|
||||
int iolight_counter;
|
||||
int iolight_timer_index;
|
||||
} bx_usb_uhci_t;
|
||||
|
||||
#pragma pack (push, 1)
|
||||
@ -222,6 +223,10 @@ private:
|
||||
Bit32u read(Bit32u address, unsigned io_len);
|
||||
void write(Bit32u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
|
||||
static void iolight_timer_handler(void *);
|
||||
void iolight_timer(void);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user