mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
register: QOMify
QOMify registers as a child of TYPE_DEVICE. This allows registers to define GPIOs. Define an init helper that will do QOM initialisation. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: KONRAD Frederic <fred.konrad@greensocs.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 2545f71db26bf5586ca0c08a3e3cf1b217450552.1467053537.git.alistair.francis@xilinx.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
684204593d
commit
49e14ddbce
2 changed files with 37 additions and 0 deletions
|
@ -159,6 +159,17 @@ void register_reset(RegisterInfo *reg)
|
|||
register_write_val(reg, reg->access->reset);
|
||||
}
|
||||
|
||||
void register_init(RegisterInfo *reg)
|
||||
{
|
||||
assert(reg);
|
||||
|
||||
if (!reg->data || !reg->access) {
|
||||
return;
|
||||
}
|
||||
|
||||
object_initialize((void *)reg, sizeof(*reg), TYPE_REGISTER);
|
||||
}
|
||||
|
||||
void register_write_memory(void *opaque, hwaddr addr,
|
||||
uint64_t value, unsigned size)
|
||||
{
|
||||
|
@ -217,3 +228,15 @@ uint64_t register_read_memory(void *opaque, hwaddr addr,
|
|||
|
||||
return extract64(read_val, 0, size * 8);
|
||||
}
|
||||
|
||||
static const TypeInfo register_info = {
|
||||
.name = TYPE_REGISTER,
|
||||
.parent = TYPE_DEVICE,
|
||||
};
|
||||
|
||||
static void register_register_types(void)
|
||||
{
|
||||
type_register_static(®ister_info);
|
||||
}
|
||||
|
||||
type_init(register_register_types)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue