qapi: Require descriptions and tagged sections to be indented
[qemu/armbru.git] / hw / tricore / tricore_testdevice.c
blob9028d970b00fba614dc1daf1f8de6baacdca3497
1 /*
2 * Copyright (c) 2018-2021 Bastian Koppelmann Paderborn University
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 #include "qemu/osdep.h"
19 #include "qemu/log.h"
20 #include "hw/sysbus.h"
21 #include "hw/qdev-properties.h"
22 #include "hw/tricore/tricore_testdevice.h"
24 static void tricore_testdevice_write(void *opaque, hwaddr offset,
25 uint64_t value, unsigned size)
27 if (value != 0) {
28 qemu_log_mask(LOG_GUEST_ERROR, "Test %" PRIu64 " failed!\n", value);
30 exit(value);
33 static uint64_t tricore_testdevice_read(void *opaque, hwaddr offset,
34 unsigned size)
36 return 0xdeadbeef;
39 static void tricore_testdevice_reset(DeviceState *dev)
43 static const MemoryRegionOps tricore_testdevice_ops = {
44 .read = tricore_testdevice_read,
45 .write = tricore_testdevice_write,
46 .valid = {
47 .min_access_size = 4,
48 .max_access_size = 4,
50 .endianness = DEVICE_NATIVE_ENDIAN,
53 static void tricore_testdevice_init(Object *obj)
55 TriCoreTestDeviceState *s = TRICORE_TESTDEVICE(obj);
56 /* map memory */
57 memory_region_init_io(&s->iomem, OBJECT(s), &tricore_testdevice_ops, s,
58 "tricore_testdevice", 0x4);
61 static Property tricore_testdevice_properties[] = {
62 DEFINE_PROP_END_OF_LIST()
65 static void tricore_testdevice_class_init(ObjectClass *klass, void *data)
67 DeviceClass *dc = DEVICE_CLASS(klass);
69 device_class_set_props(dc, tricore_testdevice_properties);
70 dc->reset = tricore_testdevice_reset;
73 static const TypeInfo tricore_testdevice_info = {
74 .name = TYPE_TRICORE_TESTDEVICE,
75 .parent = TYPE_SYS_BUS_DEVICE,
76 .instance_size = sizeof(TriCoreTestDeviceState),
77 .instance_init = tricore_testdevice_init,
78 .class_init = tricore_testdevice_class_init,
81 static void tricore_testdevice_register_types(void)
83 type_register_static(&tricore_testdevice_info);
86 type_init(tricore_testdevice_register_types)