- pit: added debug_dump()
- pit82c54: modified print_counter() for debugger usage
This commit is contained in:
parent
1f150d4399
commit
378f8a04a6
@ -138,6 +138,11 @@ void bx_pit_c::init(void)
|
||||
BX_DEBUG(("s.timer_id=%d",BX_PIT_THIS s.timer_handle[0]));
|
||||
BX_DEBUG(("s.timer.get_next_event_time=%d", BX_PIT_THIS s.timer.get_next_event_time()));
|
||||
BX_DEBUG(("s.last_next_event_time=%d", BX_PIT_THIS s.last_next_event_time));
|
||||
|
||||
#if BX_DEBUGGER
|
||||
// register device for the 'info device' command (calls debug_dump())
|
||||
bx_dbg_register_debug_info("pit", this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void bx_pit_c::reset(unsigned type)
|
||||
@ -363,6 +368,46 @@ void bx_pit_c::irq_handler(bx_bool value)
|
||||
}
|
||||
}
|
||||
|
||||
Bit16u bx_pit_c::get_timer(int Timer) {
|
||||
Bit16u bx_pit_c::get_timer(int Timer)
|
||||
{
|
||||
return BX_PIT_THIS s.timer.get_inlatch(Timer);
|
||||
}
|
||||
|
||||
#if BX_DEBUGGER
|
||||
void bx_pit_c::debug_dump(int argc, char **argv)
|
||||
{
|
||||
Bit32u value;
|
||||
int counter = -1;
|
||||
|
||||
dbg_printf("82C54 PIT\n\n");
|
||||
dbg_printf("GATE #2 = %d\n", BX_PIT_THIS s.timer.read_GATE(2));
|
||||
dbg_printf("Speaker = %d\n\n", BX_PIT_THIS s.speaker_data_on);
|
||||
if (argc == 0) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
value = BX_PIT_THIS get_timer(i);
|
||||
if (value == 0) value = 0x10000;
|
||||
dbg_printf("counter #%d: freq=%.3f, OUT=%d\n", i, (float)(1193180.0 / value),
|
||||
BX_PIT_THIS s.timer.read_OUT(i));
|
||||
}
|
||||
dbg_printf("\nSupported options:\n");
|
||||
dbg_printf("info device 'pit' 'counter=N' - show status of counter N\n");
|
||||
} else {
|
||||
for (int arg = 0; arg < argc; arg++) {
|
||||
if (!strncmp(argv[arg], "counter=", 8) && isdigit(argv[arg][8])) {
|
||||
counter = atoi(&argv[arg][8]);
|
||||
} else {
|
||||
dbg_printf("\nUnknown option: '%s'\n", argv[arg]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((counter >= 0) && (counter < 3)) {
|
||||
value = BX_PIT_THIS get_timer(counter);
|
||||
if (value == 0) value = 0x10000;
|
||||
dbg_printf("counter #%d: freq=%.3f\n", counter, (float)(1193180.0 / value));
|
||||
BX_PIT_THIS s.timer.print_cnum(counter);
|
||||
} else {
|
||||
dbg_printf("\nInvalid PIT counter number: %d\n", counter);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -39,6 +39,9 @@ public:
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void register_state(void);
|
||||
#if BX_DEBUGGER
|
||||
virtual void debug_dump(int argc, char **argv);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
|
||||
|
@ -54,13 +54,13 @@
|
||||
|
||||
void pit_82C54::print_counter(counter_type &thisctr)
|
||||
{
|
||||
BX_INFO(("Printing Counter"));
|
||||
BX_INFO(("count: %d",thisctr.count));
|
||||
BX_INFO(("count_binary: %x",thisctr.count_binary));
|
||||
BX_INFO(("counter gate: %x",thisctr.GATE));
|
||||
BX_INFO(("counter OUT: %x",thisctr.OUTpin));
|
||||
BX_INFO(("next_change_time: %d",thisctr.next_change_time));
|
||||
BX_INFO(("End Counter Printout"));
|
||||
#if BX_DEBUGGER
|
||||
dbg_printf("count: %d\n", thisctr.count);
|
||||
dbg_printf("count_binary: 0x%04x\n", thisctr.count_binary);
|
||||
dbg_printf("counter GATE: %x\n", thisctr.GATE);
|
||||
dbg_printf("counter OUT: %x\n", thisctr.OUTpin);
|
||||
dbg_printf("next_change_time: %d\n", thisctr.next_change_time);
|
||||
#endif
|
||||
}
|
||||
|
||||
void pit_82C54::print_cnum(Bit8u cnum)
|
||||
@ -329,9 +329,6 @@ void pit_82C54::clock_multiple(Bit8u cnum, Bit32u cycles)
|
||||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
print_counter(thisctr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user