summaryrefslogtreecommitdiff
path: root/uart.c
diff options
context:
space:
mode:
authorTobias Klauser <klto@zhaw.ch>2010-11-16 14:51:59 +0100
committerTobias Klauser <klto@zhaw.ch>2010-11-16 14:52:20 +0100
commitfc6515ef027d94412228875095708b949b801496 (patch)
tree2640edc09346a4d97cf09bb39d2ea8b21feceb86 /uart.c
parent6f8db3bda1c2644adfc25b83b73285df9a80585d (diff)
Add basic device handling infrastructure
Diffstat (limited to 'uart.c')
-rw-r--r--uart.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/uart.c b/uart.c
new file mode 100644
index 0000000..f49c1cb
--- /dev/null
+++ b/uart.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
+ * Copyright (C) 2010 chysun2000@gmail.com
+ *
+ * This file is part of nios2sim-ng.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include "nios2sim-ng.h"
+#include "device.h"
+#include "uart.h"
+
+static int uart_init(struct device *dev)
+{
+ return 0;
+}
+
+static bool uart_is_dev_addr(struct device *dev, uint32_t addr)
+{
+ if (addr >= dev->base && addr < dev->base + dev->size)
+ return true;
+
+ return false;
+}
+
+static void uart_simulate(struct device *dev)
+{
+}
+
+struct device uart_core = {
+ .name = "UART Core",
+ .base = UART_BASE,
+ .size = UART_SIZE,
+
+ .init = uart_init,
+ .is_dev_addr = uart_is_dev_addr,
+ .simulate = uart_simulate,
+};