• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Commit MetaInfo

Revision7857d3d9dbc1dab571cdf8cfb6ac6a45d55bb94b (tree)
Time2021-05-10 23:54:11
AuthorYoshinori Sato <ysato@user...>
CommiterYoshinori Sato

Log Message

hw/rx: Add CQ-FRK-RX62N target

It most popular RX target board in Japan.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>

frk-rx62n

Change Summary

Incremental Difference

--- a/default-configs/devices/rx-softmmu.mak
+++ b/default-configs/devices/rx-softmmu.mak
@@ -2,3 +2,4 @@
22
33 CONFIG_RX_GDBSIM=y
44 CONFIG_TKDN_RX62N=y
5+CONFIG_FRK_RX62N=y
--- a/hw/rx/Kconfig
+++ b/hw/rx/Kconfig
@@ -17,3 +17,6 @@ config TKDN_RX62N
1717 select RX62N_MCU
1818 select FITLOADER
1919
20+config FRK_RX62N
21+ bool
22+ select RX62N_MCU
--- /dev/null
+++ b/hw/rx/cq-frk-rx62n.c
@@ -0,0 +1,95 @@
1+/*
2+ * CQ publishing CQ-FRK-RX62N
3+ *
4+ * Copyright (c) 2020 Yoshinori Sato
5+ *
6+ * This program is free software; you can redistribute it and/or modify it
7+ * under the terms and conditions of the GNU General Public License,
8+ * version 2 or later, as published by the Free Software Foundation.
9+ *
10+ * This program is distributed in the hope it will be useful, but WITHOUT
11+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13+ * more details.
14+ *
15+ * You should have received a copy of the GNU General Public License along with
16+ * this program. If not, see <http://www.gnu.org/licenses/>.
17+ */
18+
19+#include "qemu/osdep.h"
20+#include "qemu/cutils.h"
21+#include "qapi/error.h"
22+#include "qemu-common.h"
23+#include "cpu.h"
24+#include "hw/hw.h"
25+#include "hw/sysbus.h"
26+#include "hw/loader.h"
27+#include "hw/rx/loader.h"
28+#include "hw/qdev-properties.h"
29+#include "hw/rx/rx62n.h"
30+#include "sysemu/sysemu.h"
31+#include "sysemu/qtest.h"
32+#include "sysemu/device_tree.h"
33+#include "hw/boards.h"
34+
35+typedef struct {
36+ /*< private >*/
37+ MachineState parent_obj;
38+ /*< public >*/
39+ RX62NState mcu;
40+} FRK_RX62NMachineState;
41+
42+#define TYPE_FRK_RX62N_MACHINE MACHINE_TYPE_NAME("cq-frk-rx62n")
43+
44+#define FRK_RX62N_MACHINE(obj) \
45+ OBJECT_CHECK(FRK_RX62NMachineState, (obj), TYPE_FRK_RX62N_MACHINE)
46+
47+static void frk_rx62n_init(MachineState *machine)
48+{
49+ FRK_RX62NMachineState *s = FRK_RX62N_MACHINE(machine);
50+ RX62NClass *rx62nc;
51+ MemoryRegion *sysmem = get_system_memory();
52+
53+ /* Initialize MCU */
54+ object_initialize_child(OBJECT(machine), "mcu",
55+ &s->mcu, TYPE_R5F562N7_MCU);
56+ rx62nc = RX62N_MCU_GET_CLASS(&s->mcu);
57+ object_property_set_link(OBJECT(&s->mcu), "main-bus", OBJECT(sysmem),
58+ &error_abort);
59+ object_property_set_uint(OBJECT(&s->mcu), "xtal-frequency-hz",
60+ 12 * 1000 * 1000, &error_abort);
61+ if (machine->firmware) {
62+ if (!load_rom(machine->firmware,
63+ rx62nc->rom_flash_size, &error_abort)) {
64+ exit(0);
65+ }
66+ } else if (!qtest_enabled()) {
67+ error_report("No bios specified");
68+ exit(1);
69+ }
70+ qdev_realize(DEVICE(&s->mcu), NULL, &error_abort);
71+}
72+
73+static void frk_rx62n_class_init(ObjectClass *oc, void *data)
74+{
75+ MachineClass *mc = MACHINE_CLASS(oc);
76+
77+ mc->desc = "CQ publishing CQ-FRK-RX62N";
78+ mc->init = frk_rx62n_init;
79+ mc->is_default = 0;
80+ mc->default_cpu_type = TYPE_RX62N_CPU;
81+}
82+
83+static const TypeInfo frk_rx62n_type = {
84+ .name = MACHINE_TYPE_NAME("cq-frk-rx62n"),
85+ .parent = TYPE_MACHINE,
86+ .instance_size = sizeof(FRK_RX62NMachineState),
87+ .class_init = frk_rx62n_class_init,
88+};
89+
90+static void frk_rx62n_machine_init(void)
91+{
92+ type_register_static(&frk_rx62n_type);
93+}
94+
95+type_init(frk_rx62n_machine_init)
--- a/hw/rx/meson.build
+++ b/hw/rx/meson.build
@@ -2,6 +2,7 @@ rx_ss = ss.source_set()
22 rx_ss.add(files('loader.c'))
33 rx_ss.add(when: 'CONFIG_RX_GDBSIM', if_true: files('rx-gdbsim.c'))
44 rx_ss.add(when: 'CONFIG_TKDN_RX62N', if_true: files('tkdn-rx62n.c'))
5+rx_ss.add(when: 'CONFIG_FRK_RX62N', if_true: files('cq-frk-rx62n.c'))
56 rx_ss.add(when: 'CONFIG_RX62N_MCU', if_true: files('rx62n.c', 'rx62n-cpg.c'))
67
78 hw_arch += {'rx': rx_ss}