summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLaurent Vivier2021-03-12 22:41:41 +0100
committerLaurent Vivier2021-03-15 21:02:03 +0100
commit8c6df16ff6080365642b0583514dd03d6a7729d6 (patch)
tree618d99f863c80a6c207369230ec71a06521d1247 /include
parentMerge remote-tracking branch 'remotes/philmd/tags/avr-20210315' into staging (diff)
downloadqemu-8c6df16ff6080365642b0583514dd03d6a7729d6.tar.gz
qemu-8c6df16ff6080365642b0583514dd03d6a7729d6.tar.xz
qemu-8c6df16ff6080365642b0583514dd03d6a7729d6.zip
hw/char: add goldfish-tty
Implement the goldfish tty device as defined in https://android.googlesource.com/platform/external/qemu/+/master/docs/GOLDFISH-VIRTUAL-HARDWARE.TXT and based on the kernel driver code: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/goldfish.c Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20210312214145.2936082-2-laurent@vivier.eu>
Diffstat (limited to 'include')
-rw-r--r--include/hw/char/goldfish_tty.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/hw/char/goldfish_tty.h b/include/hw/char/goldfish_tty.h
new file mode 100644
index 0000000000..b9dd67362a
--- /dev/null
+++ b/include/hw/char/goldfish_tty.h
@@ -0,0 +1,35 @@
+/*
+ * SPDX-License-Identifer: GPL-2.0-or-later
+ *
+ * Goldfish TTY
+ *
+ * (c) 2020 Laurent Vivier <laurent@vivier.eu>
+ *
+ */
+
+#ifndef HW_CHAR_GOLDFISH_TTY_H
+#define HW_CHAR_GOLDFISH_TTY_H
+
+#include "qemu/fifo8.h"
+#include "chardev/char-fe.h"
+
+#define TYPE_GOLDFISH_TTY "goldfish_tty"
+OBJECT_DECLARE_SIMPLE_TYPE(GoldfishTTYState, GOLDFISH_TTY)
+
+#define GOLFISH_TTY_BUFFER_SIZE 128
+
+struct GoldfishTTYState {
+ SysBusDevice parent_obj;
+
+ MemoryRegion iomem;
+ qemu_irq irq;
+ CharBackend chr;
+
+ uint32_t data_len;
+ uint64_t data_ptr;
+ bool int_enabled;
+
+ Fifo8 rx_fifo;
+};
+
+#endif