62 lines
1.8 KiB
C
62 lines
1.8 KiB
C
#include "boot.h"
|
|
#include "system/memory.h"
|
|
#include "hw/boards.h"
|
|
#include "hw/sysbus.h"
|
|
#include "qapi/error.h"
|
|
#include "qemu/units.h"
|
|
#include "qom/object.h"
|
|
#include "sc14461.h"
|
|
|
|
typedef struct DE410MachineState {
|
|
MachineState parent_obj;
|
|
SC14461McuState mcu;
|
|
|
|
MemoryRegion firmware;
|
|
} DE410MachineState;
|
|
|
|
typedef struct DE410MachineClass {
|
|
MachineClass parent_class;
|
|
} DE410MachineClass;
|
|
|
|
#define TYPE_DE410_MACHINE MACHINE_TYPE_NAME("de410")
|
|
|
|
DECLARE_OBJ_CHECKERS(DE410MachineState, DE410MachineClass, DE410_MACHINE, TYPE_DE410_MACHINE)
|
|
|
|
static void de410_init(MachineState* machine)
|
|
{
|
|
DE410MachineState* m_state = DE410_MACHINE(machine);
|
|
|
|
object_initialize_child(OBJECT(machine), "mcu", &m_state->mcu, TYPE_SC14461_MCU);
|
|
sysbus_realize(SYS_BUS_DEVICE(&m_state->mcu), &error_abort);
|
|
|
|
// Provide an option to load a small program until the peripherals are implemented
|
|
if (machine->firmware) {
|
|
memory_region_init_ram(&m_state->firmware, NULL, "firmware", (0xA000-0x8080)*KiB, &error_fatal);
|
|
memory_region_add_subregion(&m_state->mcu.non_shared_ram_or_dcache, 0x80, &m_state->firmware);
|
|
cr16c_load_firmware(&m_state->mcu.cpu, &m_state->firmware, machine->firmware);
|
|
}
|
|
}
|
|
|
|
static void de410_class_init(ObjectClass* oc, const void* data)
|
|
{
|
|
MachineClass* mc = MACHINE_CLASS(oc);
|
|
mc->desc = "DE410 VoIP desk telephone by Gigaset";
|
|
mc->init = de410_init;
|
|
mc->default_cpus = 1;
|
|
mc->min_cpus = 1;
|
|
mc->max_cpus = 1;
|
|
mc->no_floppy = 1;
|
|
mc->no_cdrom = 1;
|
|
mc->no_parallel = 1;
|
|
}
|
|
|
|
static const TypeInfo de410_machine_types[] = {
|
|
{
|
|
.name = TYPE_DE410_MACHINE,
|
|
.parent = TYPE_MACHINE,
|
|
.instance_size = sizeof(DE410MachineState),
|
|
.class_size = sizeof(DE410MachineClass),
|
|
.class_init = de410_class_init,
|
|
}
|
|
};
|
|
DEFINE_TYPES(de410_machine_types);
|