- implemented "auto-off" status LED feature and removed old "iolight" code

This commit is contained in:
Volker Ruppert 2011-12-28 14:53:05 +00:00
parent 864ea23b5b
commit ea80df55e6
6 changed files with 22 additions and 117 deletions

View File

@ -87,7 +87,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;
hub.frame_timer_index = BX_NULL_TIMER_HANDLE;
}
bx_usb_ohci_c::~bx_usb_ohci_c()
@ -117,7 +117,7 @@ void bx_usb_ohci_c::init(void)
// Call our frame timer routine every 1mS (1,000uS)
// Continuous and active
BX_OHCI_THIS hub.frame_index =
BX_OHCI_THIS hub.frame_timer_index =
bx_pc_system.register_timer(this, usb_frame_handler, 1000, 1,1, "ohci.frame_timer");
BX_OHCI_THIS hub.devfunc = 0x00;
@ -134,7 +134,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 = bx_gui->register_statusitem("OHCI");
BX_OHCI_THIS hub.statusbar_id = bx_gui->register_statusitem("OHCI", 1);
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);
@ -158,13 +158,6 @@ 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;
// register handler for correct device connect handling after runtime config
SIM->register_runtime_config_handler(BX_OHCI_THIS_PTR, runtime_config_handler);
BX_OHCI_THIS hub.device_change = 0;
@ -1205,14 +1198,10 @@ bx_bool bx_usb_ohci_c::process_td(struct OHCI_TD *td, struct OHCI_ED *ed)
/* set status bar conditions for device */
if ((len > 0) && (BX_OHCI_THIS hub.statusbar_id >= 0)) {
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);
if (pid == USB_TOKEN_IN)
bx_gui->statusbar_setitem(BX_OHCI_THIS hub.statusbar_id, 1); // read
else
bx_gui->statusbar_setitem(BX_OHCI_THIS hub.statusbar_id, 1, 1); // write
}
switch (pid) {
@ -1335,22 +1324,6 @@ 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);
}
}
void bx_usb_ohci_c::runtime_config_handler(void *this_ptr)
{
bx_usb_ohci_c *class_ptr = (bx_usb_ohci_c *) this_ptr;

View File

@ -136,8 +136,7 @@ struct OHCI_ISO_TD {
typedef struct {
int frame_index;
int interval_index;
int frame_timer_index;
struct OHCI_OP_REGS {
Bit16u HcRevision;
@ -237,8 +236,6 @@ typedef struct {
Bit64u sof_time;
int statusbar_id; // ID of the status LEDs
int iolight_counter;
int iolight_timer_index;
Bit8u device_change;
} bx_usb_ohci_t;
@ -291,9 +288,6 @@ private:
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);
static void runtime_config_handler(void *);
void runtime_config(void);
};

View File

@ -60,7 +60,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;
hub.timer_index = BX_NULL_TIMER_HANDLE;
}
bx_usb_uhci_c::~bx_usb_uhci_c()
@ -108,7 +108,7 @@ void bx_usb_uhci_c::init(void)
BX_UHCI_THIS pci_base_address[4] = 0x0;
//FIXME: for now, we want a status bar // hub zero, port zero
BX_UHCI_THIS hub.statusbar_id = bx_gui->register_statusitem("UHCI");
BX_UHCI_THIS hub.statusbar_id = bx_gui->register_statusitem("UHCI", 1);
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);
@ -130,13 +130,6 @@ 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;
// register handler for correct device connect handling after runtime config
SIM->register_runtime_config_handler(BX_UHCI_THIS_PTR, runtime_config_handler);
BX_UHCI_THIS hub.device_change = 0;
@ -849,15 +842,11 @@ bx_bool bx_usb_uhci_c::DoTransfer(Bit32u address, Bit32u queue_num, struct TD *t
maxlen &= 0x7FF;
/* set status bar conditions for device */
if (maxlen > 0) {
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);
if ((maxlen > 0) && (BX_UHCI_THIS hub.statusbar_id >= 0)) {
if (pid == USB_TOKEN_IN)
bx_gui->statusbar_setitem(BX_UHCI_THIS hub.statusbar_id, 1); // read
else
bx_gui->statusbar_setitem(BX_UHCI_THIS hub.statusbar_id, 1, 1); // write
}
BX_UHCI_THIS usb_packet.pid = pid;
@ -934,22 +923,6 @@ 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);
}
}
void bx_usb_uhci_c::runtime_config_handler(void *this_ptr)
{
bx_usb_uhci_c *class_ptr = (bx_usb_uhci_c *) this_ptr;

View File

@ -157,8 +157,6 @@ typedef struct {
Bit8u devfunc;
int statusbar_id; // ID of the status LEDs
int iolight_counter;
int iolight_timer_index;
Bit8u device_change;
} bx_usb_uhci_t;
@ -223,9 +221,6 @@ private:
void write(Bit32u address, Bit32u value, unsigned io_len);
#endif
static void iolight_timer_handler(void *);
void iolight_timer(void);
static void runtime_config_handler(void *);
void runtime_config(void);
};

View File

@ -84,7 +84,7 @@ bx_usb_xhci_c::bx_usb_xhci_c()
put("XHCI");
memset((void*)&hub, 0, sizeof(bx_usb_xhci_t));
device_buffer = NULL;
hub.iolight_timer_index = BX_NULL_TIMER_HANDLE;
//hub.frame_timer_index = BX_NULL_TIMER_HANDLE;
}
bx_usb_xhci_c::~bx_usb_xhci_c()
@ -115,7 +115,7 @@ void bx_usb_xhci_c::init(void)
// TODO: Use this to decrement the Interrupter:count down value
// Call our frame timer routine every 1mS (1,000uS)
// Continuous and active
// BX_XHCI_THIS hub.frame_index =
// BX_XHCI_THIS hub.frame_timer_index =
// bx_pc_system.register_timer(this, usb_frame_handler, 1000, 1,1, "xhci.frame_timer");
BX_XHCI_THIS hub.devfunc = 0x00;
@ -128,7 +128,7 @@ void bx_usb_xhci_c::init(void)
BX_XHCI_THIS pci_base_address[0] = 0x0;
//FIXME: for now, we want a status bar // hub zero, port zero
BX_XHCI_THIS hub.statusbar_id = bx_gui->register_statusitem("xHCI");
BX_XHCI_THIS hub.statusbar_id = bx_gui->register_statusitem("xHCI", 1);
bx_list_c *usb_rt = (bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB);
bx_list_c *xhci = (bx_list_c*)SIM->get_param(BXPN_USB_XHCI);
@ -153,13 +153,6 @@ void bx_usb_xhci_c::init(void)
BX_XHCI_THIS hub.usb_port[i].portsc.csc = 0;
}
// register timer for i/o light
if (BX_XHCI_THIS hub.iolight_timer_index == BX_NULL_TIMER_HANDLE) {
BX_XHCI_THIS hub.iolight_timer_index =
DEV_register_timer(this, iolight_timer_handler, 5000, 0,0, "xHCI i/o light");
}
BX_XHCI_THIS hub.iolight_counter = 0;
// register handler for correct device connect handling after runtime config
SIM->register_runtime_config_handler(BX_XHCI_THIS_PTR, runtime_config_handler);
BX_XHCI_THIS hub.device_change = 0;
@ -1613,13 +1606,11 @@ void bx_usb_xhci_c::process_transfer_ring(const int slot, const int ep)
// is there a transfer to be done?
if (is_transfer_trb) {
// set status bar conditions for device
if (transfer_length > 0) {
if ((cur_direction == USB_TOKEN_OUT) || (cur_direction == USB_TOKEN_SETUP))
bx_gui->statusbar_setitem(BX_XHCI_THIS hub.statusbar_id, 1, 1); // write
else
if ((transfer_length > 0) && (BX_XHCI_THIS hub.statusbar_id >= 0)) {
if (cur_direction == USB_TOKEN_IN)
bx_gui->statusbar_setitem(BX_XHCI_THIS hub.statusbar_id, 1); // read
BX_XHCI_THIS hub.iolight_counter = 5;
bx_pc_system.activate_timer(BX_XHCI_THIS hub.iolight_timer_index, 5000, 0);
else
bx_gui->statusbar_setitem(BX_XHCI_THIS hub.statusbar_id, 1, 1); // write
}
comp_code = TRB_SUCCESS; // assume good trans event
@ -2449,22 +2440,6 @@ void bx_usb_xhci_c::usb_frame_timer(void)
}
*/
void bx_usb_xhci_c::iolight_timer_handler(void *this_ptr)
{
bx_usb_xhci_c *class_ptr = (bx_usb_xhci_c *) this_ptr;
class_ptr->iolight_timer();
}
void bx_usb_xhci_c::iolight_timer()
{
if (BX_XHCI_THIS hub.iolight_counter > 0) {
if (--BX_XHCI_THIS hub.iolight_counter)
bx_pc_system.activate_timer(BX_XHCI_THIS hub.iolight_timer_index, 5000, 0);
else
bx_gui->statusbar_setitem(BX_XHCI_THIS hub.statusbar_id, 0);
}
}
void bx_usb_xhci_c::runtime_config_handler(void *this_ptr)
{
bx_usb_xhci_c *class_ptr = (bx_usb_xhci_c *) this_ptr;

View File

@ -473,8 +473,6 @@ typedef struct {
Bit8u devfunc;
int statusbar_id; // ID of the status LEDs
int iolight_counter;
int iolight_timer_index;
Bit8u device_change;
} bx_usb_xhci_t;
@ -542,9 +540,6 @@ private:
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);
static void runtime_config_handler(void *);
void runtime_config(void);
};