]>
Commit | Line | Data |
---|---|---|
c6f09eb4 AP |
1 | /* |
2 | * QEMU model of the Canon DIGIC SoC. | |
3 | * | |
4 | * Copyright (C) 2013 Antony Pavlov <[email protected]> | |
5 | * | |
6 | * This model is based on reverse engineering efforts | |
7 | * made by CHDK (http://chdk.wikia.com) and | |
8 | * Magic Lantern (http://www.magiclantern.fm) projects | |
9 | * contributors. | |
10 | * | |
11 | * This program is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License as published by | |
13 | * the Free Software Foundation; either version 2 of the License, or | |
14 | * (at your option) any later version. | |
15 | * | |
16 | * This program is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | * GNU General Public License for more details. | |
20 | * | |
21 | */ | |
22 | ||
23 | #include "hw/arm/digic.h" | |
24 | ||
25 | static void digic_init(Object *obj) | |
26 | { | |
27 | DigicState *s = DIGIC(obj); | |
28 | ||
29 | object_initialize(&s->cpu, sizeof(s->cpu), "arm946-" TYPE_ARM_CPU); | |
30 | object_property_add_child(obj, "cpu", OBJECT(&s->cpu), NULL); | |
31 | } | |
32 | ||
33 | static void digic_realize(DeviceState *dev, Error **errp) | |
34 | { | |
35 | DigicState *s = DIGIC(dev); | |
36 | Error *err = NULL; | |
37 | ||
38 | object_property_set_bool(OBJECT(&s->cpu), true, "reset-hivecs", &err); | |
39 | if (err != NULL) { | |
40 | error_propagate(errp, err); | |
41 | return; | |
42 | } | |
43 | ||
44 | object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err); | |
45 | if (err != NULL) { | |
46 | error_propagate(errp, err); | |
47 | return; | |
48 | } | |
49 | } | |
50 | ||
51 | static void digic_class_init(ObjectClass *oc, void *data) | |
52 | { | |
53 | DeviceClass *dc = DEVICE_CLASS(oc); | |
54 | ||
55 | dc->realize = digic_realize; | |
56 | } | |
57 | ||
58 | static const TypeInfo digic_type_info = { | |
59 | .name = TYPE_DIGIC, | |
60 | .parent = TYPE_DEVICE, | |
61 | .instance_size = sizeof(DigicState), | |
62 | .instance_init = digic_init, | |
63 | .class_init = digic_class_init, | |
64 | }; | |
65 | ||
66 | static void digic_register_types(void) | |
67 | { | |
68 | type_register_static(&digic_type_info); | |
69 | } | |
70 | ||
71 | type_init(digic_register_types) |