diff target-utils/libcommon/uartsel.c @ 11:40f607bb0a2c

target-utils refactored
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Wed, 01 May 2013 07:39:35 +0000
parents
children a7b0b426f9ca
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/libcommon/uartsel.c	Wed May 01 07:39:35 2013 +0000
@@ -0,0 +1,31 @@
+/*
+ * uart_select_init() figures out which UART was used to load us
+ * through the boot ROM, and sets things up for us to use the same
+ * UART for our communication.
+ */
+
+#include "types.h"
+#include "romvars.h"
+#include "ns16550.h"
+#include "halt.h"
+
+extern struct boot_rom_vars rom_vars;
+
+struct ns16550_regs *uart_base;
+char *uart_name;
+
+uart_select_init()
+{
+	switch (rom_vars.uart_id) {
+	case 0:
+		uart_base = (struct ns16550_regs *) 0xFFFF5800;
+		uart_name = "MODEM";
+		break;
+	case 1:
+		uart_base = (struct ns16550_regs *) 0xFFFF5000;
+		uart_name = "IrDA";
+		break;
+	default:
+		_exit(HALTCODE_INVALIDUART);
+	}
+}