mirror of https://github.com/xqemu/xqemu.git
pckbd: improve debugging
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
956a3e6bb7
commit
c86d2c2387
28
hw/pckbd.c
28
hw/pckbd.c
|
@ -29,6 +29,12 @@
|
||||||
|
|
||||||
/* debug PC keyboard */
|
/* debug PC keyboard */
|
||||||
//#define DEBUG_KBD
|
//#define DEBUG_KBD
|
||||||
|
#ifdef DEBUG_KBD
|
||||||
|
#define DPRINTF(fmt, ...) \
|
||||||
|
do { printf("KBD: " fmt , ## __VA_ARGS__); } while (0)
|
||||||
|
#else
|
||||||
|
#define DPRINTF(fmt, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Keyboard Controller Commands */
|
/* Keyboard Controller Commands */
|
||||||
#define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */
|
#define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */
|
||||||
|
@ -191,9 +197,7 @@ static uint32_t kbd_read_status(void *opaque, uint32_t addr)
|
||||||
KBDState *s = opaque;
|
KBDState *s = opaque;
|
||||||
int val;
|
int val;
|
||||||
val = s->status;
|
val = s->status;
|
||||||
#if defined(DEBUG_KBD)
|
DPRINTF("kbd: read status=0x%02x\n", val);
|
||||||
printf("kbd: read status=0x%02x\n", val);
|
|
||||||
#endif
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,6 +213,7 @@ static void ioport92_write(void *opaque, uint32_t addr, uint32_t val)
|
||||||
{
|
{
|
||||||
KBDState *s = opaque;
|
KBDState *s = opaque;
|
||||||
|
|
||||||
|
DPRINTF("kbd: write outport=0x%02x\n", val);
|
||||||
s->outport = val;
|
s->outport = val;
|
||||||
if (s->a20_out) {
|
if (s->a20_out) {
|
||||||
qemu_set_irq(*s->a20_out, (val >> 1) & 1);
|
qemu_set_irq(*s->a20_out, (val >> 1) & 1);
|
||||||
|
@ -221,17 +226,18 @@ static void ioport92_write(void *opaque, uint32_t addr, uint32_t val)
|
||||||
static uint32_t ioport92_read(void *opaque, uint32_t addr)
|
static uint32_t ioport92_read(void *opaque, uint32_t addr)
|
||||||
{
|
{
|
||||||
KBDState *s = opaque;
|
KBDState *s = opaque;
|
||||||
|
uint32_t ret;
|
||||||
|
|
||||||
return s->outport;
|
ret = s->outport;
|
||||||
|
DPRINTF("kbd: read outport=0x%02x\n", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kbd_write_command(void *opaque, uint32_t addr, uint32_t val)
|
static void kbd_write_command(void *opaque, uint32_t addr, uint32_t val)
|
||||||
{
|
{
|
||||||
KBDState *s = opaque;
|
KBDState *s = opaque;
|
||||||
|
|
||||||
#ifdef DEBUG_KBD
|
DPRINTF("kbd: write cmd=0x%02x\n", val);
|
||||||
printf("kbd: write cmd=0x%02x\n", val);
|
|
||||||
#endif
|
|
||||||
switch(val) {
|
switch(val) {
|
||||||
case KBD_CCMD_READ_MODE:
|
case KBD_CCMD_READ_MODE:
|
||||||
kbd_queue(s, s->mode, 0);
|
kbd_queue(s, s->mode, 0);
|
||||||
|
@ -307,9 +313,7 @@ static uint32_t kbd_read_data(void *opaque, uint32_t addr)
|
||||||
else
|
else
|
||||||
val = ps2_read_data(s->kbd);
|
val = ps2_read_data(s->kbd);
|
||||||
|
|
||||||
#if defined(DEBUG_KBD)
|
DPRINTF("kbd: read data=0x%02x\n", val);
|
||||||
printf("kbd: read data=0x%02x\n", val);
|
|
||||||
#endif
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,9 +321,7 @@ static void kbd_write_data(void *opaque, uint32_t addr, uint32_t val)
|
||||||
{
|
{
|
||||||
KBDState *s = opaque;
|
KBDState *s = opaque;
|
||||||
|
|
||||||
#ifdef DEBUG_KBD
|
DPRINTF("kbd: write data=0x%02x\n", val);
|
||||||
printf("kbd: write data=0x%02x\n", val);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch(s->write_cmd) {
|
switch(s->write_cmd) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
Loading…
Reference in New Issue