mirror of https://github.com/xemu-project/xemu.git
PL050 status register fixes.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2759 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
2a1d1880e5
commit
9e61ec3153
31
hw/pl050.c
31
hw/pl050.c
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Arm PrimeCell PL050 Keyboard / Mouse Interface
|
* Arm PrimeCell PL050 Keyboard / Mouse Interface
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 CodeSourcery.
|
* Copyright (c) 2006-2007 CodeSourcery.
|
||||||
* Written by Paul Brook
|
* Written by Paul Brook
|
||||||
*
|
*
|
||||||
* This code is licenced under the GPL.
|
* This code is licenced under the GPL.
|
||||||
|
@ -20,6 +20,14 @@ typedef struct {
|
||||||
int is_mouse;
|
int is_mouse;
|
||||||
} pl050_state;
|
} pl050_state;
|
||||||
|
|
||||||
|
#define PL050_TXEMPTY (1 << 6)
|
||||||
|
#define PL050_TXBUSY (1 << 5)
|
||||||
|
#define PL050_RXFULL (1 << 4)
|
||||||
|
#define PL050_RXBUSY (1 << 3)
|
||||||
|
#define PL050_RXPARITY (1 << 2)
|
||||||
|
#define PL050_KMIC (1 << 1)
|
||||||
|
#define PL050_KMID (1 << 0)
|
||||||
|
|
||||||
static const unsigned char pl050_id[] =
|
static const unsigned char pl050_id[] =
|
||||||
{ 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 };
|
{ 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 };
|
||||||
|
|
||||||
|
@ -45,11 +53,22 @@ static uint32_t pl050_read(void *opaque, target_phys_addr_t offset)
|
||||||
case 0: /* KMICR */
|
case 0: /* KMICR */
|
||||||
return s->cr;
|
return s->cr;
|
||||||
case 1: /* KMISTAT */
|
case 1: /* KMISTAT */
|
||||||
/* KMIC and KMID bits not implemented. */
|
{
|
||||||
if (s->pending) {
|
uint8_t val;
|
||||||
return 0x10;
|
uint32_t stat;
|
||||||
} else {
|
|
||||||
return 0;
|
val = s->last;
|
||||||
|
val = val ^ (val >> 4);
|
||||||
|
val = val ^ (val >> 2);
|
||||||
|
val = (val ^ (val >> 1)) & 1;
|
||||||
|
|
||||||
|
stat = PL050_TXEMPTY;
|
||||||
|
if (val)
|
||||||
|
stat |= PL050_RXPARITY;
|
||||||
|
if (s->pending)
|
||||||
|
stat |= PL050_RXFULL;
|
||||||
|
|
||||||
|
return stat;
|
||||||
}
|
}
|
||||||
case 2: /* KMIDATA */
|
case 2: /* KMIDATA */
|
||||||
if (s->pending)
|
if (s->pending)
|
||||||
|
|
Loading…
Reference in New Issue