summaryrefslogtreecommitdiffstats
path: root/hw/char/pl011.c
diff options
context:
space:
mode:
authorPeter Maydell2019-02-21 19:17:46 +0100
committerPeter Maydell2019-02-21 19:17:46 +0100
commit694cf209990f7b7a6f6f30b21010bab92c985175 (patch)
tree8eb7ffda034d5cd84b6854c430d67a550e8aab4d /hw/char/pl011.c
parenthw/timer/pl031: Convert to using trace events (diff)
downloadqemu-694cf209990f7b7a6f6f30b21010bab92c985175.tar.gz
qemu-694cf209990f7b7a6f6f30b21010bab92c985175.tar.xz
qemu-694cf209990f7b7a6f6f30b21010bab92c985175.zip
hw/char/pl011: Allow use as an embedded-struct device
Create a new include file for the pl011's device struct, type macros, etc, so that it can be instantiated using the "embedded struct" coding style. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'hw/char/pl011.c')
-rw-r--r--hw/char/pl011.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index 2aa277fc4f..0c4711e402 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -8,39 +8,12 @@
*/
#include "qemu/osdep.h"
+#include "hw/char/pl011.h"
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
#include "qemu/log.h"
#include "trace.h"
-#define TYPE_PL011 "pl011"
-#define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011)
-
-typedef struct PL011State {
- SysBusDevice parent_obj;
-
- MemoryRegion iomem;
- uint32_t readbuff;
- uint32_t flags;
- uint32_t lcr;
- uint32_t rsr;
- uint32_t cr;
- uint32_t dmacr;
- uint32_t int_enabled;
- uint32_t int_level;
- uint32_t read_fifo[16];
- uint32_t ilpr;
- uint32_t ibrd;
- uint32_t fbrd;
- uint32_t ifl;
- int read_pos;
- int read_count;
- int read_trigger;
- CharBackend chr;
- qemu_irq irq;
- const unsigned char *id;
-} PL011State;
-
#define PL011_INT_TX 0x20
#define PL011_INT_RX 0x10
@@ -357,7 +330,7 @@ static void pl011_luminary_init(Object *obj)
}
static const TypeInfo pl011_luminary_info = {
- .name = "pl011_luminary",
+ .name = TYPE_PL011_LUMINARY,
.parent = TYPE_PL011,
.instance_init = pl011_luminary_init,
};