diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-17 23:53:44 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-17 23:53:44 +0000 |
commit | 31a5581021afca8240e6aa7eebed28ef7a55e561 (patch) | |
tree | 2fd44a81e2d57d07e5947847899188bfe4129249 /nuttx/configs/nutiny-nuc120 | |
parent | 0377c66608387053b0fb62db0236294f0b70f959 (diff) | |
download | px4-nuttx-31a5581021afca8240e6aa7eebed28ef7a55e561.tar.gz px4-nuttx-31a5581021afca8240e6aa7eebed28ef7a55e561.tar.bz2 px4-nuttx-31a5581021afca8240e6aa7eebed28ef7a55e561.zip |
LPC1788 updates from Rommel Marcelo; NUC120 updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5658 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/nutiny-nuc120')
-rw-r--r-- | nuttx/configs/nutiny-nuc120/include/Makefile | 0 | ||||
-rw-r--r-- | nuttx/configs/nutiny-nuc120/include/board.h | 40 | ||||
-rw-r--r-- | nuttx/configs/nutiny-nuc120/src/Makefile | 116 | ||||
-rw-r--r-- | nuttx/configs/nutiny-nuc120/src/nuc_boardinitialize.c | 102 | ||||
-rw-r--r-- | nuttx/configs/nutiny-nuc120/src/nuc_led.c | 132 | ||||
-rw-r--r-- | nuttx/configs/nutiny-nuc120/src/nutiny-nuc120.h | 116 |
6 files changed, 475 insertions, 31 deletions
diff --git a/nuttx/configs/nutiny-nuc120/include/Makefile b/nuttx/configs/nutiny-nuc120/include/Makefile deleted file mode 100644 index e69de29bb..000000000 --- a/nuttx/configs/nutiny-nuc120/include/Makefile +++ /dev/null diff --git a/nuttx/configs/nutiny-nuc120/include/board.h b/nuttx/configs/nutiny-nuc120/include/board.h index dab279878..276ce5d04 100644 --- a/nuttx/configs/nutiny-nuc120/include/board.h +++ b/nuttx/configs/nutiny-nuc120/include/board.h @@ -34,8 +34,8 @@ * ************************************************************************************/ -#ifndef _BITNO -#define _BITNO +#ifndef __CONFIGS_NUTINY_NUC12_INCLUDE_BOARD_H +#define __CONFIGS_NUTINY_NUC12_INCLUDE_BOARD_H /************************************************************************************ * Included Files @@ -54,18 +54,11 @@ /* LED definitions ******************************************************************/ /* The NuTiny has a single green LED that can be controlled from sofware. This LED - * is connected to PIN17. + * is connected to PIN17. It is pulled high so a low value will illuminate the LED. */ -/* LED index values for use with nuc_setled() */ - -#define BOARD_LED 0 /* Green LED */ #define BOARD_NLEDS 1 -/* LED bits for use with nuc_setleds() */ - -#define BOARD_LED_BIT (1 << BOARD_LED) - /* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board the * NuTiny. The following definitions describe how NuttX controls the LEDs: * @@ -80,7 +73,7 @@ * LED_SIGNAL In a signal handler LED might glow * LED_ASSERTION An assertion failed LED ON while handling the assertion * LED_PANIC The system has crashed LED Blinking at 2Hz - * LED_IDLE STM32 is is sleep mode (Optional, not used) + * LED_IDLE NUC1XX is is sleep mode (Optional, not used) */ #define LED_STARTED 0 @@ -106,7 +99,8 @@ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -118,29 +112,13 @@ extern "C" { * Name: nuc_boardinitialize * * Description: - * All STM32 architectures must provide the following entry point. This entry point + * All NUC1XX 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. * ************************************************************************************/ -EXTERN void nuc_boardinitialize(void); - -/************************************************************************************ - * Name: nuc_ledinit, nuc_setled, and nuc_setleds - * - * Description: - * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LEDs. If - * CONFIG_ARCH_LEDS is not defined, then the following interfacesare available to - * control the LEDs from user applications. - * - ************************************************************************************/ - -#ifndef CONFIG_ARCH_LEDS -EXTERN void nuc_ledinit(void); -EXTERN void nuc_setled(int led, bool ledon); -EXTERN void nuc_setleds(uint8_t ledset); -#endif +void nuc_boardinitialize(void); #undef EXTERN #if defined(__cplusplus) @@ -148,4 +126,4 @@ EXTERN void nuc_setleds(uint8_t ledset); #endif #endif /* __ASSEMBLY__ */ -#endif /* _BITNO */ +#endif /* __CONFIGS_NUTINY_NUC12_INCLUDE_BOARD_H */ diff --git a/nuttx/configs/nutiny-nuc120/src/Makefile b/nuttx/configs/nutiny-nuc120/src/Makefile new file mode 100644 index 000000000..7f05612d8 --- /dev/null +++ b/nuttx/configs/nutiny-nuc120/src/Makefile @@ -0,0 +1,116 @@ +############################################################################ +# configs/nutiny-nuc120/src/Makefile +# +# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt <gnutt@nuttx.org> +# +# 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 = nuc_boardinitialize.c + +ifeq ($(CONFIG_HAVE_CXX),y) +CSRCS += nuc_cxxinitialize.c +endif + +ifeq ($(CONFIG_ARCH_LEDS),y) +CSRCS += nuc_led.c +endif + +ifeq ($(CONFIG_NUC1XX_USBD),y) +CSRCS += nuc_usbd.c +endif + +ifeq ($(CONFIG_PWM),y) +CSRCS += nuc_pwm.c +endif + +ifeq ($(CONFIG_QENCODER),y) +CSRCS += nuc_qencoder.c +endif + +ifeq ($(CONFIG_WATCHDOG),y) +CSRCS += nuc_watchdog.c +endif + +ifeq ($(CONFIG_NSH_ARCHINIT),y) +CSRCS += nuc_nsh.c +endif + +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + CFLAGS += -I$(ARCH_SRCDIR)\chip -I$(ARCH_SRCDIR)\common -I$(ARCH_SRCDIR)\armv7-m +else +ifeq ($(WINTOOL),y) + CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \ + -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \ + -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}" +else + CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m +endif +endif + +all: libboard$(LIBEXT) + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +libboard$(LIBEXT): $(OBJS) + $(call ARCHIVE, $@, $(OBJS)) + +.depend: Makefile $(SRCS) + $(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + $(Q) touch $@ + +depend: .depend + +clean: + $(call DELFILE, libboard$(LIBEXT)) + $(call CLEAN) + +distclean: clean + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + +-include Make.dep diff --git a/nuttx/configs/nutiny-nuc120/src/nuc_boardinitialize.c b/nuttx/configs/nutiny-nuc120/src/nuc_boardinitialize.c new file mode 100644 index 000000000..490413d3b --- /dev/null +++ b/nuttx/configs/nutiny-nuc120/src/nuc_boardinitialize.c @@ -0,0 +1,102 @@ +/************************************************************************************ + * configs/nutiny-nuc120/src/up_boot.c + * arch/arm/src/board/up_boot.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 "nutiny-nuc120.h" + +/************************************************************************************ + * Definitions + ************************************************************************************/ + +/************************************************************************************ + * Private Functions + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: nuc_boardinitialize + * + * Description: + * All NUC1XX 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 nuc_boardinitialize(void) +{ + /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function + * nuc_spiinitialize() has been brought into the link. + */ + +#if defined(CONFIG_NUC1XX_SPI1) || defined(CONFIG_NUC1XX_SPI2) || defined(CONFIG_NUC1XX_SPI3) + if (nuc_spiinitialize) + { + nuc_spiinitialize(); + } +#endif + + /* Initialize USB if the 1) USB device controller is in the configuration and 2) + * disabled, and 3) the weak function nuc_usbinitialize() has been brought + * into the build. Presumeably either CONFIG_USBDEV is also selected. + */ + +#ifdef CONFIG_NUC1XX_USB + if (nuc_usbinitialize) + { + nuc_usbinitialize(); + } +#endif + + /* Configure on-board LED if LED support has been selected. */ + +#ifdef CONFIG_ARCH_LEDS + nuc_ledinit(); +#endif +} diff --git a/nuttx/configs/nutiny-nuc120/src/nuc_led.c b/nuttx/configs/nutiny-nuc120/src/nuc_led.c new file mode 100644 index 000000000..873a116e3 --- /dev/null +++ b/nuttx/configs/nutiny-nuc120/src/nuc_led.c @@ -0,0 +1,132 @@ +/**************************************************************************** + * configs/nutiny-nuc120/src/up_autoleds.c + * arch/arm/src/board/up_autoleds.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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. + * + ****************************************************************************/ +/* The NuTiny has a single green LED that can be controlled from sofware. + * This LED is connected to PIN17. It is pulled high so a low value will + * illuminate the LED. + * + * If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board the + * NuTiny. The following definitions describe how NuttX controls the LEDs: + * + * SYMBOL Meaning LED state + * Initially all LED is OFF + * ------------------- ----------------------- ------------- ------------ + * LED_STARTED NuttX has been started LED ON + * LED_HEAPALLOCATE Heap has been allocated LED ON + * LED_IRQSENABLED Interrupts enabled LED ON + * LED_STACKCREATED Idle stack created LED ON + * LED_INIRQ In an interrupt LED should glow + * LED_SIGNAL In a signal handler LED might glow + * LED_ASSERTION An assertion failed LED ON while handling the assertion + * LED_PANIC The system has crashed LED Blinking at 2Hz + * LED_IDLE NUC1XX is is sleep mode (Optional, not used) + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdint.h> +#include <stdbool.h> +#include <debug.h> + +#include <arch/board/board.h> + +#include "chip.h" +#include "nuc_gpio.h" +#include "nutiny-nuc120.h" + +#ifdef CONFIG_ARCH_LEDS + +/**************************************************************************** + * 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 + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_ledinit + ****************************************************************************/ + +void up_ledinit(void) +{ + nuc_configgpio(GPIO_LED); +} + +/**************************************************************************** + * Name: up_ledon + ****************************************************************************/ + +void up_ledon(int led) +{ + nuc_gpiowrite(GPIO_LED, false); +} + +/**************************************************************************** + * Name: up_ledoff + ****************************************************************************/ + +void up_ledoff(int led) +{ + nuc_gpiowrite(GPIO_LED, true); +} + +#endif /* CONFIG_ARCH_LEDS */ diff --git a/nuttx/configs/nutiny-nuc120/src/nutiny-nuc120.h b/nuttx/configs/nutiny-nuc120/src/nutiny-nuc120.h new file mode 100644 index 000000000..f7f3184bc --- /dev/null +++ b/nuttx/configs/nutiny-nuc120/src/nutiny-nuc120.h @@ -0,0 +1,116 @@ +/**************************************************************************************************** + * configs/nutiny-nuc120/src/nutiny-nuc120.h + * arch/arm/src/board/nutiny-nuc120.n + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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_NUTINY_NUC120_SRC_NUTINY_NUC120_H +#define __CONFIGS_NUTINY_NUC120_SRC_NUTINY_NUC120_H + +/**************************************************************************************************** + * Included Files + ****************************************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/compiler.h> +#include <stdint.h> + +/**************************************************************************************************** + * Definitions + ****************************************************************************************************/ +/* Configuration ************************************************************************************/ + +/* NuTiny-EVB-120 GPIOs *****************************************************************************/ +/* The NuTiny has a single green LED that can be controlled from sofware. This LED + * is connected to PIN17. It is pulled high so a low value will illuminate the LED. + * + * If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board the + * NuTiny. The following definitions describe how NuttX controls the LEDs: + * + * SYMBOL Meaning LED state + * Initially all LED is OFF + * ------------------- ----------------------- ------------- ------------ + * LED_STARTED NuttX has been started LED ON + * LED_HEAPALLOCATE Heap has been allocated LED ON + * LED_IRQSENABLED Interrupts enabled LED ON + * LED_STACKCREATED Idle stack created LED ON + * LED_INIRQ In an interrupt LED should glow + * LED_SIGNAL In a signal handler LED might glow + * LED_ASSERTION An assertion failed LED ON while handling the assertion + * LED_PANIC The system has crashed LED Blinking at 2Hz + * LED_IDLE NUC1XX is is sleep mode (Optional, not used) + */ + +/* Button definitions ***************************************************************/ +/* The NuTiny has no buttons */ + +/**************************************************************************************************** + * Public Types + ****************************************************************************************************/ + +/**************************************************************************************************** + * Public data + ****************************************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************************************** + * Public Functions + ****************************************************************************************************/ + +/**************************************************************************************************** + * Name: nuc_spiinitialize + * + * Description: + * Called to configure SPI chip select GPIO pins for the NuTiny-EVB-120 board. + * + ****************************************************************************************************/ + +void weak_function nuc_spiinitialize(void); + +/**************************************************************************************************** + * Name: nuc_usbinitialize + * + * Description: + * Called from nuc_usbinitialize very early in inialization to setup USB-related + * GPIO pins for the NuTiny-EVB-120 board. + * + ****************************************************************************************************/ + +#ifdef CONFIG_STM32_USB +void weak_function nuc_usbinitialize(void); +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __CONFIGS_NUTINY_NUC120_SRC_NUTINY_NUC120_H */ + |