From: Vladimir Burian Date: Mon, 14 Mar 2011 21:24:28 +0000 (+0100) Subject: Added mach-openmsp430 arch. X-Git-Url: https://rtime.felk.cvut.cz/gitweb/sysless.git/commitdiff_plain/dd02953fedde5c218d047bbc4b608aaeaff8b14d Added mach-openmsp430 arch. --- diff --git a/arch/msp430/mach-openmsp430/Makefile b/arch/msp430/mach-openmsp430/Makefile new file mode 100644 index 0000000..76b56fd --- /dev/null +++ b/arch/msp430/mach-openmsp430/Makefile @@ -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 index 0000000..2ebd5c8 --- /dev/null +++ b/arch/msp430/mach-openmsp430/Makefile.omk @@ -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 index 0000000..b22a357 --- /dev/null +++ b/arch/msp430/mach-openmsp430/defines/Makefile @@ -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 index 0000000..9aa9efe --- /dev/null +++ b/arch/msp430/mach-openmsp430/defines/Makefile.omk @@ -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 index 0000000..3bd495f --- /dev/null +++ b/arch/msp430/mach-openmsp430/defines/hardware.h @@ -0,0 +1,23 @@ +#ifndef HARDWARE_H +#define HARDWARE_H + +#include + + +//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 index 0000000..b22a357 --- /dev/null +++ b/arch/msp430/mach-openmsp430/libs/Makefile @@ -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 index 0000000..1edfc40 --- /dev/null +++ b/arch/msp430/mach-openmsp430/libs/Makefile.omk @@ -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 index 0000000..87d7222 --- /dev/null +++ b/arch/msp430/mach-openmsp430/libs/uart.c @@ -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 index 0000000..c659568 --- /dev/null +++ b/arch/msp430/mach-openmsp430/libs/uart.h @@ -0,0 +1,11 @@ +#ifndef UART_H +#define UART_H + +int putchar(int c); + +int getchar(); + +int isRxEmpty(); + +#endif +