mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
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>
This commit is contained in:
parent
dd849ef2c9
commit
694cf20999
2 changed files with 36 additions and 29 deletions
|
@ -15,6 +15,40 @@
|
|||
#ifndef HW_PL011_H
|
||||
#define HW_PL011_H
|
||||
|
||||
#include "hw/sysbus.h"
|
||||
#include "chardev/char-fe.h"
|
||||
|
||||
#define TYPE_PL011 "pl011"
|
||||
#define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011)
|
||||
|
||||
/* This shares the same struct (and cast macro) as the base pl011 device */
|
||||
#define TYPE_PL011_LUMINARY "pl011_luminary"
|
||||
|
||||
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;
|
||||
|
||||
static inline DeviceState *pl011_create(hwaddr addr,
|
||||
qemu_irq irq,
|
||||
Chardev *chr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue