From 326c945b55d6dd1cf153c6ca8715685a968b1384 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Wed, 21 Nov 2012 20:39:36 -0600 Subject: lm4f: Add lm4f support files copied from lm3s Create lm4f code infrastructure from the lm3s infrastructure. As far as the interrupt table is concerned, don't create an irq.yaml. Just include the LM3S nvic.h. The LM3S vector table seems to be compatible with the LM4F Signed-off-by: Alexandru Gagniuc --- include/libopencm3/lm4f/gpio.h | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 include/libopencm3/lm4f/gpio.h (limited to 'include/libopencm3/lm4f/gpio.h') diff --git a/include/libopencm3/lm4f/gpio.h b/include/libopencm3/lm4f/gpio.h new file mode 100644 index 0000000..5296b74 --- /dev/null +++ b/include/libopencm3/lm4f/gpio.h @@ -0,0 +1,79 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2011 Gareth McMullin + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +#ifndef LM3S_GPIO_H +#define LM3S_GPIO_H + +#include +#include + +/* --- Convenience macros -------------------------------------------------- */ + +/* GPIO port base addresses (for convenience) */ +#define GPIOA GPIOA_APB_BASE +#define GPIOB GPIOB_APB_BASE +#define GPIOC GPIOC_APB_BASE +#define GPIOD GPIOD_APB_BASE +#define GPIOE GPIOE_APB_BASE +#define GPIOF GPIOF_APB_BASE +#define GPIOG GPIOG_APB_BASE +#define GPIOH GPIOH_APB_BASE + +/* GPIO number definitions (for convenience) */ +#define GPIO0 (1 << 0) +#define GPIO1 (1 << 1) +#define GPIO2 (1 << 2) +#define GPIO3 (1 << 3) +#define GPIO4 (1 << 4) +#define GPIO5 (1 << 5) +#define GPIO6 (1 << 6) +#define GPIO7 (1 << 7) + +/* --- GPIO registers ------------------------------------------------------ */ + +#define GPIO_DATA(port) ((volatile u32 *)(port + 0x000)) +#define GPIO_DIR(port) MMIO32(port + 0x400) +#define GPIO_IS(port) MMIO32(port + 0x404) +#define GPIO_IBE(port) MMIO32(port + 0x408) +#define GPIO_IEV(port) MMIO32(port + 0x40c) +#define GPIO_IM(port) MMIO32(port + 0x410) +#define GPIO_RIS(port) MMIO32(port + 0x414) +#define GPIO_MIS(port) MMIO32(port + 0x418) +#define GPIO_ICR(port) MMIO32(port + 0x41c) +#define GPIO_AFSEL(port) MMIO32(port + 0x420) +#define GPIO_DR2R(port) MMIO32(port + 0x500) +#define GPIO_DR4R(port) MMIO32(port + 0x504) +#define GPIO_DR8R(port) MMIO32(port + 0x508) +#define GPIO_ODR(port) MMIO32(port + 0x50c) +#define GPIO_PUR(port) MMIO32(port + 0x510) +#define GPIO_PDR(port) MMIO32(port + 0x514) +#define GPIO_SLR(port) MMIO32(port + 0x518) +#define GPIO_DEN(port) MMIO32(port + 0x51c) +#define GPIO_LOCK(port) MMIO32(port + 0x520) +#define GPIO_CR(port) MMIO32(port + 0x524) +#define GPIO_AMSEL(port) MMIO32(port + 0x528) + +BEGIN_DECLS + +void gpio_set(u32 gpioport, u8 gpios); +void gpio_clear(u32 gpioport, u8 gpios); + +END_DECLS + +#endif -- cgit v1.2.3 From b2ac2ffc4b53262250f576cb1984508d6dd5a510 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Thu, 22 Nov 2012 16:04:32 -0600 Subject: lm4f: Remove erroneous references to lm3s Signed-off-by: Alexandru Gagniuc --- examples/lm4f/Makefile.include | 6 +++--- include/libopencm3/lm4f/doc-lm3s.h | 32 -------------------------------- include/libopencm3/lm4f/doc-lm4f.h | 32 ++++++++++++++++++++++++++++++++ include/libopencm3/lm4f/gpio.h | 6 +++--- include/libopencm3/lm4f/memorymap.h | 6 +++--- include/libopencm3/lm4f/systemcontrol.h | 4 ++-- lib/lm4f/gpio.c | 2 +- 7 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 include/libopencm3/lm4f/doc-lm3s.h create mode 100644 include/libopencm3/lm4f/doc-lm4f.h (limited to 'include/libopencm3/lm4f/gpio.h') diff --git a/examples/lm4f/Makefile.include b/examples/lm4f/Makefile.include index 332d24b..5244287 100644 --- a/examples/lm4f/Makefile.include +++ b/examples/lm4f/Makefile.include @@ -38,7 +38,7 @@ endif endif CFLAGS += -O0 -g3 -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \ - -mcpu=cortex-m3 -mthumb -MD -DLM3S + -mcpu=cortex-m3 -mthumb -MD -DLM4F LDSCRIPT ?= $(BINARY).ld LDFLAGS += -L$(TOOLCHAIN_DIR)/lib \ -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections @@ -85,9 +85,9 @@ flash: $(BINARY).flash @#printf " OBJDUMP $(*).list\n" $(Q)$(OBJDUMP) -S $(*).elf > $(*).list -%.elf: $(OBJS) $(LDSCRIPT) $(TOOLCHAIN_DIR)/lib/libopencm3_lm3s.a +%.elf: $(OBJS) $(LDSCRIPT) $(TOOLCHAIN_DIR)/lib/libopencm3_lm4f.a @#printf " LD $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(LD) $(LDFLAGS) -o $(*).elf $(OBJS) -lopencm3_lm3s + $(Q)$(LD) $(LDFLAGS) -o $(*).elf $(OBJS) -lopencm3_lm4f %.o: %.c Makefile @#printf " CC $(subst $(shell pwd)/,,$(@))\n" diff --git a/include/libopencm3/lm4f/doc-lm3s.h b/include/libopencm3/lm4f/doc-lm3s.h deleted file mode 100644 index 2503a7b..0000000 --- a/include/libopencm3/lm4f/doc-lm3s.h +++ /dev/null @@ -1,32 +0,0 @@ -/** @mainpage libopencm3 LM3S - -@version 1.0.0 - -@date 14 September 2012 - -API documentation for TI Stellaris LM3S Cortex M3 series. - -LGPL License Terms @ref lgpl_license -*/ - -/** @defgroup LM3S LM3S -Libraries for TI Stellaris LM3S series. - -@version 1.0.0 - -@date 7 September 2012 - -LGPL License Terms @ref lgpl_license -*/ - -/** @defgroup LM3S_defines LM3S Defines - -@brief Defined Constants and Types for the LM3S series - -@version 1.0.0 - -@date 14 September 2012 - -LGPL License Terms @ref lgpl_license -*/ - diff --git a/include/libopencm3/lm4f/doc-lm4f.h b/include/libopencm3/lm4f/doc-lm4f.h new file mode 100644 index 0000000..130da54 --- /dev/null +++ b/include/libopencm3/lm4f/doc-lm4f.h @@ -0,0 +1,32 @@ +/** @mainpage libopencm3 LM4F + +@version 1.0.0 + +@date 22 November 2012 + +API documentation for TI Stellaris LM4F Cortex M4F series. + +LGPL License Terms @ref lgpl_license +*/ + +/** @defgroup LM4F LM4F +Libraries for TI Stellaris LM4F series. + +@version 1.0.0 + +@date 22 November 2012 + +LGPL License Terms @ref lgpl_license +*/ + +/** @defgroup LM4F_defines LM4F Defines + +@brief Defined Constants and Types for the LM4F series + +@version 1.0.0 + +@date 22 November 2012 + +LGPL License Terms @ref lgpl_license +*/ + diff --git a/include/libopencm3/lm4f/gpio.h b/include/libopencm3/lm4f/gpio.h index 5296b74..19987c7 100644 --- a/include/libopencm3/lm4f/gpio.h +++ b/include/libopencm3/lm4f/gpio.h @@ -17,11 +17,11 @@ * along with this library. If not, see . */ -#ifndef LM3S_GPIO_H -#define LM3S_GPIO_H +#ifndef LM4F_GPIO_H +#define LM4F_GPIO_H #include -#include +#include /* --- Convenience macros -------------------------------------------------- */ diff --git a/include/libopencm3/lm4f/memorymap.h b/include/libopencm3/lm4f/memorymap.h index 55347bf..0e9b485 100644 --- a/include/libopencm3/lm4f/memorymap.h +++ b/include/libopencm3/lm4f/memorymap.h @@ -17,12 +17,12 @@ * along with this library. If not, see . */ -#ifndef LM3S_MEMORYMAP_H -#define LM3S_MEMORYMAP_H +#ifndef LM4F_MEMORYMAP_H +#define LM4F_MEMORYMAP_H #include -/* --- LM3S specific peripheral definitions ----------------------------- */ +/* --- LM4F specific peripheral definitions ----------------------------- */ #define GPIOA_APB_BASE (0x40004000) #define GPIOB_APB_BASE (0x40005000) diff --git a/include/libopencm3/lm4f/systemcontrol.h b/include/libopencm3/lm4f/systemcontrol.h index 32b0ba5..594c00c 100644 --- a/include/libopencm3/lm4f/systemcontrol.h +++ b/include/libopencm3/lm4f/systemcontrol.h @@ -17,8 +17,8 @@ * along with this library. If not, see . */ -#ifndef LM3S_SYSTEMCONTROL_H -#define LM3S_SYSTEMCONTROL_H +#ifndef LM4F_SYSTEMCONTROL_H +#define LM4F_SYSTEMCONTROL_H #include diff --git a/lib/lm4f/gpio.c b/lib/lm4f/gpio.c index a92c96e..2d50116 100644 --- a/lib/lm4f/gpio.c +++ b/lib/lm4f/gpio.c @@ -17,7 +17,7 @@ * along with this library. If not, see . */ -#include +#include void gpio_set(u32 gpioport, u8 gpios) { -- cgit v1.2.3