sdl2: move sdl_update to new sdl2-2d.c
[qemu/cris-port.git] / hw / misc / debugexit.c
blob69a1b004cb5b5dc69bc77d36a081314fdeb6285b
1 /*
2 * debug exit port emulation
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 or
7 * (at your option) any later version.
8 */
10 #include "hw/hw.h"
11 #include "hw/isa/isa.h"
13 #define TYPE_ISA_DEBUG_EXIT_DEVICE "isa-debug-exit"
14 #define ISA_DEBUG_EXIT_DEVICE(obj) \
15 OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
17 typedef struct ISADebugExitState {
18 ISADevice parent_obj;
20 uint32_t iobase;
21 uint32_t iosize;
22 MemoryRegion io;
23 } ISADebugExitState;
25 static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
26 unsigned width)
28 exit((val << 1) | 1);
31 static const MemoryRegionOps debug_exit_ops = {
32 .write = debug_exit_write,
33 .valid.min_access_size = 1,
34 .valid.max_access_size = 4,
35 .endianness = DEVICE_LITTLE_ENDIAN,
38 static void debug_exit_realizefn(DeviceState *d, Error **errp)
40 ISADevice *dev = ISA_DEVICE(d);
41 ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(d);
43 memory_region_init_io(&isa->io, OBJECT(dev), &debug_exit_ops, isa,
44 TYPE_ISA_DEBUG_EXIT_DEVICE, isa->iosize);
45 memory_region_add_subregion(isa_address_space_io(dev),
46 isa->iobase, &isa->io);
49 static Property debug_exit_properties[] = {
50 DEFINE_PROP_UINT32("iobase", ISADebugExitState, iobase, 0x501),
51 DEFINE_PROP_UINT32("iosize", ISADebugExitState, iosize, 0x02),
52 DEFINE_PROP_END_OF_LIST(),
55 static void debug_exit_class_initfn(ObjectClass *klass, void *data)
57 DeviceClass *dc = DEVICE_CLASS(klass);
59 dc->realize = debug_exit_realizefn;
60 dc->props = debug_exit_properties;
61 set_bit(DEVICE_CATEGORY_MISC, dc->categories);
64 static const TypeInfo debug_exit_info = {
65 .name = TYPE_ISA_DEBUG_EXIT_DEVICE,
66 .parent = TYPE_ISA_DEVICE,
67 .instance_size = sizeof(ISADebugExitState),
68 .class_init = debug_exit_class_initfn,
71 static void debug_exit_register_types(void)
73 type_register_static(&debug_exit_info);
76 type_init(debug_exit_register_types)