summaryrefslogtreecommitdiff
path: root/nuttx/configs/lm3s8962-ek/src
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/configs/lm3s8962-ek/src')
-rwxr-xr-xnuttx/configs/lm3s8962-ek/src/Makefile90
-rwxr-xr-xnuttx/configs/lm3s8962-ek/src/README.txt1
-rwxr-xr-xnuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h136
-rwxr-xr-xnuttx/configs/lm3s8962-ek/src/up_boot.c92
-rwxr-xr-xnuttx/configs/lm3s8962-ek/src/up_ethernet.c98
-rwxr-xr-xnuttx/configs/lm3s8962-ek/src/up_leds.c167
-rwxr-xr-xnuttx/configs/lm3s8962-ek/src/up_nsh.c159
-rwxr-xr-xnuttx/configs/lm3s8962-ek/src/up_oled.c162
-rwxr-xr-xnuttx/configs/lm3s8962-ek/src/up_ssi.c164
9 files changed, 1069 insertions, 0 deletions
diff --git a/nuttx/configs/lm3s8962-ek/src/Makefile b/nuttx/configs/lm3s8962-ek/src/Makefile
new file mode 100755
index 000000000..8c5d10bc4
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/Makefile
@@ -0,0 +1,90 @@
+############################################################################
+# configs/lm3s8962-ek/src/Makefile
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_boot.c up_leds.c up_ethernet.c up_ssi.c
+ifeq ($(CONFIG_EXAMPLES_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+ifeq ($(CONFIG_NX_LCDDRIVER),y)
+CSRCS += up_oled.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/cortexm3}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/cortexm3
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/lm3s8962-ek/src/README.txt b/nuttx/configs/lm3s8962-ek/src/README.txt
new file mode 100755
index 000000000..a84733cc0
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the Stellaris LM3S8962 Evaluation Kit.
diff --git a/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h b/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h
new file mode 100755
index 000000000..0c21e5d4b
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * configs/lm3s8962-ek/src/lm3s8962ek_internal.h
+ * arch/arm/src/board/lm3s8962ek_internal.n
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_LM3S8962_EK_SRC_LM3S8962EK_INTERNAL_H
+#define __CONFIGS_LM3S8962_EK_SRC_LM3S8962EK_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SSI modules does this chip support? The LM3S8962 supports 1 SSI
+ * module (others may support more than 2 -- in such case, the following must be
+ * expanded).
+ */
+
+#if LM3S_NSSI == 0
+# undef CONFIG_SSI0_DISABLE
+# define CONFIG_SSI0_DISABLE 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#elif LM3S_NSSI == 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#endif
+
+/* LM3S8962 Eval Kit ***************************************************************/
+
+/* GPIO Usage
+ *
+ * PIN SIGNAL EVB Function
+ * --- ----------- ---------------------------------------
+ * 26 PA0/U0RX Virtual COM port receive
+ * 27 PA1/U0TX Virtual COM port transmit
+ * 10 PD0/IDX0 SD card chip select
+ * 11 PD1/PWM1 Sound
+ * 30 PA4/SSI0RX SD card data out
+ * 31 PA5/SSI0TX SD card and OLED display data in
+ * 28 PA2/SSI0CLK SD card and OLED display clock
+ * 22 PC7/PHB0 OLED display data/control select
+ * 29 PA3/SSI0FSS OLED display chip select
+ * 73 PE1/PWM5 Down switch
+ * 74 PE2/PHB1 Left switch
+ * 72 PE0/PWM4 Up switch
+ * 75 PE3/PHA1 Right switch
+ * 61 PF1/IDX1 Select switch
+ * 47 PF0/PWM0 User LED
+ * 23 PC6/CCP3 Enable +15 V
+ */
+
+/* GPIO for microSD card chip select:
+ * - PD0: SD card chip select (CARDCSn)
+ */
+
+#define SDCCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | \
+ GPIO_VALUE_ONE | GPIO_PORTD | 0)
+
+/* GPIO for single LED:
+ * - PF0: User LED
+ */
+
+#define LED_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTF | 0)
+
+/* GPIOs for OLED:
+ * - PC7: OLED display data/control select (D/Cn)
+ * - PA3: OLED display chip select (CSn)
+ * - PC6: Enable +15V needed by OLED (EN+15V)
+ */
+
+#define OLEDDC_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STD | GPIO_STRENGTH_8MA | \
+ GPIO_VALUE_ONE | GPIO_PORTC | 7)
+#define OLEDCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | \
+ GPIO_VALUE_ONE | GPIO_PORTA | 3)
+#define OLEDEN_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STD | GPIO_STRENGTH_8MA | \
+ GPIO_VALUE_ONE | GPIO_PORTC | 6)
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LM3S8962 Eval Kit.
+ *
+ ************************************************************************************/
+
+extern void weak_function lm3s_ssiinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_LM3S8962_EK_SRC_LM3S8962EK_INTERNAL_H */
+
diff --git a/nuttx/configs/lm3s8962-ek/src/up_boot.c b/nuttx/configs/lm3s8962-ek/src/up_boot.c
new file mode 100755
index 000000000..2992b00c1
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_boot.c
@@ -0,0 +1,92 @@
+/************************************************************************************
+ * configs/lm3s8962-ek/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lm3s8962ek_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ ************************************************************************************/
+
+void lm3s_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function
+ * lm3s_ssiinitialize() has been brought into the link.
+ */
+
+ /* The LM3S8962 Eval Kit microSD CS and OLED are on SSI0 (Duh! There is no SSI1) */
+
+#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
+ if (lm3s_ssiinitialize)
+ {
+ lm3s_ssiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/lm3s8962-ek/src/up_ethernet.c b/nuttx/configs/lm3s8962-ek/src/up_ethernet.c
new file mode 100755
index 000000000..457e56091
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_ethernet.c
@@ -0,0 +1,98 @@
+/************************************************************************************
+ * configs/lm3s8962-ek/src/up_ethernet.c
+ * arch/arm/src/board/up_ethernet.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+#include <assert.h>
+
+#include <arch/board/board.h>
+#include <net/ethernet.h>
+
+#include "up_arch.h"
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile
+ * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function
+ * will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+void lm3s_ethernetmac(struct ether_addr *ethaddr)
+{
+ uint32_t user0;
+ uint32_t user1;
+
+ /* Get the current value of the user registers */
+
+ user0 = getreg32(LM3S_FLASH_USERREG0);
+ user1 = getreg32(LM3S_FLASH_USERREG1);
+
+ nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff);
+ DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff);
+
+ /* Re-format that MAC address the way that uIP expects to see it */
+
+ ethaddr->ether_addr_octet[0] = ((user0 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[1] = ((user0 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[2] = ((user0 >> 16) & 0xff);
+ ethaddr->ether_addr_octet[3] = ((user1 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[4] = ((user1 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[5] = ((user1 >> 16) & 0xff);
+}
+#endif
diff --git a/nuttx/configs/lm3s8962-ek/src/up_leds.c b/nuttx/configs/lm3s8962-ek/src/up_leds.c
new file mode 100755
index 000000000..1592168d7
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_leds.c
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * configs/lm3s8962-ek/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lm3s_internal.h"
+#include "lm3s8962ek_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_DEBUG
+# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+static uint8_t g_nest;
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ leddbg("Initializing\n");
+
+ /* Configure Port E, Bit 1 as an output, initial value=OFF */
+
+ led_dumpgpio("up_ledinit before lm3s_configgpio()");
+ lm3s_configgpio(LED_GPIO);
+ led_dumpgpio("up_ledinit after lm3s_configgpio()");
+ g_nest = 0;
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ switch (led)
+ {
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ g_nest++;
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ led_dumpgpio("up_ledon: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED_GPIO, false);
+ led_dumpgpio("up_ledon: after lm3s_gpiowrite()");
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ switch (led)
+ {
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ if (--g_nest <= 0)
+ {
+ led_dumpgpio("up_ledoff: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED_GPIO, true);
+ led_dumpgpio("up_ledoff: after lm3s_gpiowrite()");
+ }
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/lm3s8962-ek/src/up_nsh.c b/nuttx/configs/lm3s8962-ek/src/up_nsh.c
new file mode 100755
index 000000000..999013b13
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_nsh.c
@@ -0,0 +1,159 @@
+/****************************************************************************
+ * config/lm3s8962-ek/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_LM3S8962EK
+# undef CONFIG_EXAMPLES_NSH_HAVEUSBDEV
+# define CONFIG_EXAMPLES_NSH_HAVEMMCSD 1
+# if !defined(CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO) || CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO != 0
+# error "The LM3S8962 Eval Kit MMC/SD is on SSI0"
+# undef CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO
+# define CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO 0
+# endif
+# if !defined(CONFIG_EXAMPLES_NSH_MMCSDSLOTNO) || CONFIG_EXAMPLES_NSH_MMCSDSLOTNO != 0
+# error "The LM3S8962 Eval Kit MMC/SD is on SSI0 slot 0"
+# undef CONFIG_EXAMPLES_NSH_MMCSDSLOTNO
+# define CONFIG_EXAMPLES_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new LM3s boards here */
+# error "Unrecognized lm3s board"
+# undef CONFIG_EXAMPLES_NSH_HAVEUSBDEV
+# undef CONFIG_EXAMPLES_NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef CONFIG_EXAMPLES_NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef CONFIG_EXAMPLES_NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_EXAMPLES_NSH_MMCSDMINOR
+# define CONFIG_EXAMPLES_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ message("nsh_archinitialize: Initializing SPI port %d\n",
+ CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port %d\n",
+ CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("nsh_archinitialize: Successfully initialized SPI port %d\n",
+ CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO, CONFIG_EXAMPLES_NSH_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_EXAMPLES_NSH_MMCSDMINOR, CONFIG_EXAMPLES_NSH_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO, CONFIG_EXAMPLES_NSH_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ CONFIG_EXAMPLES_NSH_MMCSDSPIPORTNO, CONFIG_EXAMPLES_NSH_MMCSDSLOTNO);
+ return OK;
+}
diff --git a/nuttx/configs/lm3s8962-ek/src/up_oled.c b/nuttx/configs/lm3s8962-ek/src/up_oled.c
new file mode 100755
index 000000000..1dd024356
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_oled.c
@@ -0,0 +1,162 @@
+/****************************************************************************
+ * config/lm3s8962-ek/src/up_oled.c
+ * arch/arm/src/board/up_oled.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/lcd.h>
+#include <nuttx/p14201.h>
+
+#include "lm3s_internal.h"
+#include "lm3s8962ek_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Define the CONFIG_LCD_RITDEBUG to enable detailed debug output (stuff you
+ * would never want to see unless you are debugging this file).
+ *
+ * Verbose debug must also be enabled
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_LCD_RITDEBUG
+#endif
+
+#ifdef CONFIG_LCD_RITDEBUG
+# define ritdbg(format, arg...) vdbg(format, ##arg)
+# define oleddc_dumpgpio(m) lm3s_dumpgpio(OLEDDC_GPIO, m)
+# define oledcs_dumpgpio(m) lm3s_dumpgpio(OLEDCS_GPIO, m)
+#else
+# define ritdbg(x...)
+# define oleddc_dumpgpio(m)
+# define oledcs_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_nxdrvinit
+ *
+ * Description:
+ * Called NX initialization logic to configure the OLED.
+ *
+ ****************************************************************************/
+
+FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
+{
+ FAR struct spi_dev_s *spi;
+ FAR struct lcd_dev_s *dev;
+
+ /* Configure the OLED GPIOs */
+
+ oledcs_dumpgpio("up_nxdrvinit: After OLEDCS setup");
+ oleddc_dumpgpio("up_nxdrvinit: On entry");
+
+ lm3s_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */
+ lm3s_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */
+
+ oleddc_dumpgpio("up_nxdrvinit: After OLEDDC/EN setup");
+
+ /* Get the SSI port (configure as a Freescale SPI port) */
+
+ spi = up_spiinitialize(0);
+ if (!spi)
+ {
+ glldbg("Failed to initialize SSI port 0\n");
+ }
+ else
+ {
+ /* Bind the SSI port to the OLED */
+
+ dev = rit_initialize(spi, devno);
+ if (!dev)
+ {
+ glldbg("Failed to bind SSI port 0 to OLED %d: %d\n", devno);
+ }
+ else
+ {
+ gllvdbg("Bound SSI port 0 to OLED %d\n", devno);
+
+ /* And turn the OLED on (CONFIG_LCD_MAXPOWER should be 1) */
+
+ (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER);
+ return dev;
+ }
+ }
+ return NULL;
+}
+
+/******************************************************************************
+ * Name: rit_seldata
+ *
+ * Description:
+ * Set or clear the SD1329 D/Cn bit to select data (true) or command
+ * (false). This function must be provided by platform-specific logic.
+ *
+ * Input Parameters:
+ *
+ * devno - A value in the range of 0 throuh CONFIG_P14201_NINTERFACES-1.
+ * This allows support for multiple OLED devices.
+ * data - true: select data; false: select command
+ *
+ * Returned Value:
+ * None
+ *
+ ******************************************************************************/
+
+void rit_seldata(unsigned int devno, bool data)
+{
+ /* Set GPIO to 1 for data, 0 for command */
+
+ lm3s_gpiowrite(OLEDDC_GPIO, data);
+}
diff --git a/nuttx/configs/lm3s8962-ek/src/up_ssi.c b/nuttx/configs/lm3s8962-ek/src/up_ssi.c
new file mode 100755
index 000000000..27899b5bf
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_ssi.c
@@ -0,0 +1,164 @@
+/************************************************************************************
+ * configs/lm3s8962-ek/src/up_ssi.c
+ * arch/arm/src/board/up_ssi.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lm3s_internal.h"
+#include "lm3s8962ek_internal.h"
+
+/* The LM3S8962 Eval Kit microSD CS is on SSI0 */
+
+#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SSI_DEBUG /* Define to enable debug */
+#undef SSI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SSI_DEBUG
+# define ssidbg lldbg
+# ifdef SSI_VERBOSE
+# define ssivdbg lldbg
+# else
+# define ssivdbg(x...)
+# endif
+#else
+# undef SSI_VERBOSE
+# define ssidbg(x...)
+# define ssivdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef SSI_VERBOSE
+# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m)
+#else
+# define ssi_dumpgpio(m)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LM3S8962 Eval Kit.
+ *
+ ************************************************************************************/
+
+void weak_function lm3s_ssiinitialize(void)
+{
+ /* Configure the SPI-based microSD CS GPIO */
+
+ ssi_dumpgpio("lm3s_ssiinitialize() Entry)");
+ lm3s_configgpio(SDCCS_GPIO);
+#ifdef CONFIG_NX_LCDDRIVER
+ lm3s_configgpio(OLEDCS_GPIO);
+#endif
+ ssi_dumpgpio("lm3s_ssiinitialize() Exit");
+}
+
+/****************************************************************************
+ * The external functions, lm3s_spiselect and lm3s_spistatus must be provided
+ * by board-specific logic. The are implementations of the select and status
+ * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h).
+ * All othermethods (including up_spiinitialize()) are provided by common
+ * logic. To use this common SPI logic on your board:
+ *
+ * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your
+ * board-specific logic. This function will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 2. Add a call to up_spiinitialize() in your low level initialization
+ * logic
+ * 3. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ ssi_dumpgpio("lm3s_spiselect() Entry");
+
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Assert the CS pin to the card */
+
+ lm3s_gpiowrite(SDCCS_GPIO, !selected);
+ }
+#ifdef CONFIG_NX_LCDDRIVER
+ else if (devid == SPIDEV_DISPLAY)
+ {
+ /* Assert the CS pin to the display */
+
+ lm3s_gpiowrite(OLEDCS_GPIO, !selected);
+ }
+#endif
+ ssi_dumpgpio("lm3s_spiselect() Exit");
+}
+
+uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ ssidbg("Returning SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+}
+
+#endif /* !CONFIG_SSI0_DISABLE || !CONFIG_SSI1_DISABLE */