]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
Added mach-openmsp430 arch.
authorVladimir Burian <buriavl2@fel.cvut.cz>
Mon, 14 Mar 2011 21:24:28 +0000 (22:24 +0100)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Wed, 16 Mar 2011 16:24:24 +0000 (17:24 +0100)
arch/msp430/mach-openmsp430/Makefile [new file with mode: 0644]
arch/msp430/mach-openmsp430/Makefile.omk [new file with mode: 0644]
arch/msp430/mach-openmsp430/defines/Makefile [new file with mode: 0644]
arch/msp430/mach-openmsp430/defines/Makefile.omk [new file with mode: 0644]
arch/msp430/mach-openmsp430/defines/hardware.h [new file with mode: 0644]
arch/msp430/mach-openmsp430/libs/Makefile [new file with mode: 0644]
arch/msp430/mach-openmsp430/libs/Makefile.omk [new file with mode: 0644]
arch/msp430/mach-openmsp430/libs/uart.c [new file with mode: 0644]
arch/msp430/mach-openmsp430/libs/uart.h [new file with mode: 0644]

diff --git a/arch/msp430/mach-openmsp430/Makefile b/arch/msp430/mach-openmsp430/Makefile
new file mode 100644 (file)
index 0000000..76b56fd
--- /dev/null
@@ -0,0 +1,14 @@
+# Generic directory or leaf node makefile for OCERA make framework
+
+ifndef MAKERULES_DIR
+MAKERULES_DIR := $(shell ( old_pwd="" ;  while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" = `pwd`  ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) )
+endif
+
+ifeq ($(MAKERULES_DIR),)
+all : default
+.DEFAULT::
+       @echo -e "\nThe Makefile.rules has not been found in this or parent directory\n"
+else
+include $(MAKERULES_DIR)/Makefile.rules
+endif
+
diff --git a/arch/msp430/mach-openmsp430/Makefile.omk b/arch/msp430/mach-openmsp430/Makefile.omk
new file mode 100644 (file)
index 0000000..2ebd5c8
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = defines libs
diff --git a/arch/msp430/mach-openmsp430/defines/Makefile b/arch/msp430/mach-openmsp430/defines/Makefile
new file mode 100644 (file)
index 0000000..b22a357
--- /dev/null
@@ -0,0 +1,14 @@
+# Generic directory or leaf node makefile for OCERA make framework
+
+ifndef MAKERULES_DIR
+MAKERULES_DIR := $(shell ( old_pwd="" ;  while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" = `pwd`  ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) )
+endif
+
+ifeq ($(MAKERULES_DIR),)
+all : default
+.DEFAULT::
+       @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n"
+else
+include $(MAKERULES_DIR)/Makefile.rules
+endif
+
diff --git a/arch/msp430/mach-openmsp430/defines/Makefile.omk b/arch/msp430/mach-openmsp430/defines/Makefile.omk
new file mode 100644 (file)
index 0000000..9aa9efe
--- /dev/null
@@ -0,0 +1 @@
+include_HEADERS = $(notdir $(wildcard $(SOURCES_DIR)/*.h))
diff --git a/arch/msp430/mach-openmsp430/defines/hardware.h b/arch/msp430/mach-openmsp430/defines/hardware.h
new file mode 100644 (file)
index 0000000..3bd495f
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef HARDWARE_H
+#define HARDWARE_H
+
+#include <io.h>
+
+
+//HW UART registers
+#define UART_OFFSET        0x0100
+
+#define UBAUD_             UART_OFFSET + 00
+#define UTX_               UART_OFFSET + 02
+#define URX_               UART_OFFSET + 04
+#define USTAT_             UART_OFFSET + 06
+#define UIE_               UART_OFFSET + 07
+
+sfrw(UBAUD, UBAUD_);
+sfrb(UTX, UTX_);
+sfrb(URX, URX_);
+sfrb(USTAT, USTAT_);
+sfrb(UIE, UIE_);
+
+
+#endif
diff --git a/arch/msp430/mach-openmsp430/libs/Makefile b/arch/msp430/mach-openmsp430/libs/Makefile
new file mode 100644 (file)
index 0000000..b22a357
--- /dev/null
@@ -0,0 +1,14 @@
+# Generic directory or leaf node makefile for OCERA make framework
+
+ifndef MAKERULES_DIR
+MAKERULES_DIR := $(shell ( old_pwd="" ;  while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" = `pwd`  ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) )
+endif
+
+ifeq ($(MAKERULES_DIR),)
+all : default
+.DEFAULT::
+       @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n"
+else
+include $(MAKERULES_DIR)/Makefile.rules
+endif
+
diff --git a/arch/msp430/mach-openmsp430/libs/Makefile.omk b/arch/msp430/mach-openmsp430/libs/Makefile.omk
new file mode 100644 (file)
index 0000000..1edfc40
--- /dev/null
@@ -0,0 +1,5 @@
+# -*- makefile -*-
+
+include_HEADERS = uart.h
+
+lib_obj_SOURCES = uart.c
diff --git a/arch/msp430/mach-openmsp430/libs/uart.c b/arch/msp430/mach-openmsp430/libs/uart.c
new file mode 100644 (file)
index 0000000..87d7222
--- /dev/null
@@ -0,0 +1,17 @@
+#include "hardware.h"
+#include "uart.h"
+
+int putchar(int c) {
+  while (USTAT & 0x20) {}
+  UTX = c;
+  return 0;
+}
+
+int getchar() {
+  while (!(USTAT & 0x10)) {}
+  return URX;
+}
+
+int isRxEmpty() {
+  return (~USTAT) & 0x10;
+}
diff --git a/arch/msp430/mach-openmsp430/libs/uart.h b/arch/msp430/mach-openmsp430/libs/uart.h
new file mode 100644 (file)
index 0000000..c659568
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef UART_H
+#define UART_H
+
+int putchar(int c);
+
+int getchar();
+
+int isRxEmpty();
+
+#endif
+