diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-26 16:31:47 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-26 16:31:47 -0600 |
commit | 5e00cc7c21585cac912d9443ddfea0175776fd13 (patch) | |
tree | 1964fc1c956410e2decd5c3a72b8d7772f878f64 | |
parent | cefe78f6a5595a77dbf1ccc0ecc63dcc559f6e54 (diff) | |
download | nuttx-5e00cc7c21585cac912d9443ddfea0175776fd13.tar.gz nuttx-5e00cc7c21585cac912d9443ddfea0175776fd13.tar.bz2 nuttx-5e00cc7c21585cac912d9443ddfea0175776fd13.zip |
CC3200 Launchpad updates
-rw-r--r-- | nuttx/arch/arm/src/tiva/Kconfig | 4 | ||||
-rw-r--r-- | nuttx/arch/arm/src/tiva/tiva_start.c | 7 | ||||
-rw-r--r-- | nuttx/arch/arm/src/tiva/tiva_start.h | 76 | ||||
-rw-r--r-- | nuttx/configs/Kconfig | 1 | ||||
-rw-r--r-- | nuttx/configs/cc3200-launchpad/include/cc3200_utils.h | 4 | ||||
-rw-r--r-- | nuttx/configs/cc3200-launchpad/src/cc3200_autoleds.c | 2 | ||||
-rw-r--r-- | nuttx/configs/cc3200-launchpad/src/cc3200_boot.c | 31 | ||||
-rw-r--r-- | nuttx/configs/cc3200-launchpad/src/cc3200_launchpad.h | 68 | ||||
-rw-r--r-- | nuttx/configs/cc3200-launchpad/src/cc3200_serial.c | 26 | ||||
-rw-r--r-- | nuttx/configs/cc3200-launchpad/src/cc3200_utils.c | 40 |
10 files changed, 231 insertions, 28 deletions
diff --git a/nuttx/arch/arm/src/tiva/Kconfig b/nuttx/arch/arm/src/tiva/Kconfig index d346ad2c5..6a469c922 100644 --- a/nuttx/arch/arm/src/tiva/Kconfig +++ b/nuttx/arch/arm/src/tiva/Kconfig @@ -91,6 +91,10 @@ config LM_REVA2 Some early silicon returned an increase LDO voltage or 2.75V to work around a PLL bug +config TIVA_BOARD_EARLYINIT + bool + default n + menu "Tiva/Stellaris Peripheral Support" config TIVA_UART0 diff --git a/nuttx/arch/arm/src/tiva/tiva_start.c b/nuttx/arch/arm/src/tiva/tiva_start.c index ff0e7a10e..f0c66f6d2 100644 --- a/nuttx/arch/arm/src/tiva/tiva_start.c +++ b/nuttx/arch/arm/src/tiva/tiva_start.c @@ -52,6 +52,7 @@ #include "tiva_lowputc.h" #include "tiva_syscontrol.h" #include "tiva_userspace.h" +#include "tiva_start.h" /**************************************************************************** * Pre-processor Definitions @@ -102,10 +103,10 @@ void __start(void) #endif uint32_t *dest; - /* Configure the uart so that we can get debug output as soon as possible */ + /* Configure the UART so that we can get debug output as soon as possible */ -#ifdef CONFIG_ARCH_BOARD_CC3200_LAUNCHPAD - up_earlyconsoleinit(); +#ifdef CONFIG_TIVA_BOARD_EARLYINIT + board_earlyinit(); #else up_clockconfig(); up_lowsetup(); diff --git a/nuttx/arch/arm/src/tiva/tiva_start.h b/nuttx/arch/arm/src/tiva/tiva_start.h new file mode 100644 index 000000000..ab4a2cd92 --- /dev/null +++ b/nuttx/arch/arm/src/tiva/tiva_start.h @@ -0,0 +1,76 @@ +/**************************************************************************** + * arch/arm/src/tiva/tiva_start.h + * + * Copyright (C) 2014 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 __ARCH_ARM_SRC_TIVA_TIVA_START_H +#define __ARCH_ARM_SRC_TIVA_TIVA_START_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_earlyinit + * + * Description: + * If CONFIG_TIVA_BOARD_EARLYINIT, then board-specific logic must provide + * the function board_earlyinit() to provide very customized lower-level + * board bringup. board_earlyinit() will be called by the start-up logic + * instead of up_clockconfig() and up_lowsetup(). + * + ****************************************************************************/ + +#ifdef CONFIG_TIVA_BOARD_EARLYINIT +void board_earlyinit(void); +#endif + +#endif /* __ARCH_ARM_SRC_TIVA_TIVA_START_H */ diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig index 9b95faf84..248401376 100644 --- a/nuttx/configs/Kconfig +++ b/nuttx/configs/Kconfig @@ -814,6 +814,7 @@ config ARCH_BOARD_CC3200_LAUNCHPAD select ARCH_HAVE_LEDS select ARCH_HAVE_BUTTONS select ARCH_HAVE_IRQBUTTONS + select TIVA_BOARD_EARLYINIT ---help--- Tiva CC3200 Launchpad. diff --git a/nuttx/configs/cc3200-launchpad/include/cc3200_utils.h b/nuttx/configs/cc3200-launchpad/include/cc3200_utils.h index 400891c16..18b8ac51c 100644 --- a/nuttx/configs/cc3200-launchpad/include/cc3200_utils.h +++ b/nuttx/configs/cc3200-launchpad/include/cc3200_utils.h @@ -32,7 +32,7 @@ * ************************************************************************************/ -#ifdef __CONFIGS_CC3200_INCLUDE_UTILS_H +#ifndef __CONFIGS_CC3200_INCLUDE_UTILS_H #define __CONFIGS_CC3200_INCLUDE_UTILS_H 1 /************************************************************************************ @@ -143,7 +143,5 @@ void cc3200_print(char* str); void cc3200_pin_config_set(uint32_t pin, uint32_t pin_strength, uint32_t pin_type); void cc3200_pin_mode_set(uint32_t pin, uint32_t pin_mode); void cc3200_pin_type_uart(uint32_t pin, uint32_t pin_mode); -void cc3200_init(void); -void cc3200_uart_init(void); #endif /* __CONFIGS_CC3200_INCLUDE_UTILS_H */ diff --git a/nuttx/configs/cc3200-launchpad/src/cc3200_autoleds.c b/nuttx/configs/cc3200-launchpad/src/cc3200_autoleds.c index adb7b8ebd..820618971 100644 --- a/nuttx/configs/cc3200-launchpad/src/cc3200_autoleds.c +++ b/nuttx/configs/cc3200-launchpad/src/cc3200_autoleds.c @@ -40,6 +40,8 @@ #include <nuttx/config.h> +#include "cc3200_launchpad.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/nuttx/configs/cc3200-launchpad/src/cc3200_boot.c b/nuttx/configs/cc3200-launchpad/src/cc3200_boot.c index 3c2b85776..76d6e8811 100644 --- a/nuttx/configs/cc3200-launchpad/src/cc3200_boot.c +++ b/nuttx/configs/cc3200-launchpad/src/cc3200_boot.c @@ -1,6 +1,5 @@ -/************************************************************************************ +/**************************************************************************** * configs/cc3200-launchpad/src/cc3200_boot.c - * arch/arm/src/board/cc3200_boot.c * * Copyright (C) 2014 Droidifi LLC. All rights reserved. * Author: Jim Ewing <jim@droidifi.com> @@ -34,11 +33,11 @@ * 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 <nuttx/kmalloc.h> @@ -50,21 +49,23 @@ #include <arch/board/cc3200_utils.h> #include <apps/nsh.h> -/************************************************************************************ +#include "cc3200_launchpad.h" + +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Name: nsh_archinitialize * @@ -85,7 +86,7 @@ int nsh_archinitialize(void) return OK; } -/************************************************************************************ +/**************************************************************************** * Name: tiva_boardinitialize * * Description: @@ -93,7 +94,7 @@ int nsh_archinitialize(void) * point is called early in the initialization -- after all memory has been * configured and mapped but before any devices have been initialized. * - ************************************************************************************/ + ****************************************************************************/ void tiva_boardinitialize(void) { diff --git a/nuttx/configs/cc3200-launchpad/src/cc3200_launchpad.h b/nuttx/configs/cc3200-launchpad/src/cc3200_launchpad.h new file mode 100644 index 000000000..2378023ad --- /dev/null +++ b/nuttx/configs/cc3200-launchpad/src/cc3200_launchpad.h @@ -0,0 +1,68 @@ +/**************************************************************************** + * configs/cc3200-launchpad/src/cc3200_launchpad.h + * + * Copyright (C) 2014 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. + * + * 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_CC3200_LAUNCHPAD_SRC_CC3200_LAUNCHPAD_H +#define __CONFIGS_CC3200_LAUNCHPAD_SRC_CC3200_LAUNCHPAD_H 1 + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdint.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: cc3200_init + ****************************************************************************/ + +void cc3200_init(void); + +/************************************************************************************ + * Name: cc3200_uart_init + ************************************************************************************/ + +void cc3200_uart_init(void); + +#endif /* __CONFIGS_CC3200_LAUNCHPAD_SRC_CC3200_LAUNCHPAD_H */ diff --git a/nuttx/configs/cc3200-launchpad/src/cc3200_serial.c b/nuttx/configs/cc3200-launchpad/src/cc3200_serial.c index 20a43daa7..4d7715ab2 100644 --- a/nuttx/configs/cc3200-launchpad/src/cc3200_serial.c +++ b/nuttx/configs/cc3200-launchpad/src/cc3200_serial.c @@ -46,18 +46,30 @@ #include <arch/board/cc3200_utils.h> #include "chip/cc3200_memorymap.h" +#include "tiva_start.h" #include "up_internal.h" +#include "cc3200_launchpad.h" + #if !defined(HAVE_SERIALCONSOLE) /************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +#ifndef CONFIG_TIVA_BOARD_EARLYINIT +# error CONFIG_TIVA_BOARD_EARLYINIT is required +#endif + +/************************************************************************************ * Private Data ************************************************************************************/ /************************************************************************************ * Private Functions ************************************************************************************/ -void cc3200_uart0_init(void) + +static void cc3200_uart0_init(void) { HWREG(0x44025048) |= 0x01; @@ -84,7 +96,7 @@ void cc3200_uart0_init(void) ************************************************************************************/ /************************************************************************************ - * Name: up_earlyconsoleinit + * Name: board_earlyinit * * Description: * Performs the low level UART initialization early in debug so that the serial @@ -93,20 +105,18 @@ void cc3200_uart0_init(void) * ************************************************************************************/ -#ifdef USE_EARLYSERIALINIT -void up_earlyconsoleinit(void) +void board_earlyinit(void) { cc3200_init(); cc3200_uart0_init(); } -#endif /************************************************************************************ * Name: up_consoleinit * * Description: * Register serial console and serial ports. This assumes that - * up_earlyconsoleinit was called previously. + * board_earlyinit was called previously. * ************************************************************************************/ @@ -119,6 +129,10 @@ void up_consoleinit(void) } #endif +/************************************************************************************ + * Name: cc3200_uart_init + ************************************************************************************/ + void cc3200_uart_init(void) { cc3200_uart0_init(); diff --git a/nuttx/configs/cc3200-launchpad/src/cc3200_utils.c b/nuttx/configs/cc3200-launchpad/src/cc3200_utils.c index f763085fa..88f7c692a 100644 --- a/nuttx/configs/cc3200-launchpad/src/cc3200_utils.c +++ b/nuttx/configs/cc3200-launchpad/src/cc3200_utils.c @@ -32,8 +32,22 @@ * ************************************************************************************/ +/************************************************************************************ + * Included Files + ************************************************************************************/ + #include <sys/types.h> -#include <cc3200_utils.h> +#include <arch/board/cc3200_utils.h> + +#include "cc3200_launchpad.h" + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: cc3200_putc + ************************************************************************************/ void cc3200_putc(char c) { @@ -43,6 +57,10 @@ void cc3200_putc(char c) HWREG(0x4000C000) = c; } +/************************************************************************************ + * Name: cc3200_getc + ************************************************************************************/ + char cc3200_getc(void) { if (!(HWREG(0x4000C000 + 0x00000018) & 0x00000010)) @@ -55,6 +73,10 @@ char cc3200_getc(void) } } +/************************************************************************************ + * Name: cc3200_print + ************************************************************************************/ + void cc3200_print(char* str) { while (str && *str != '\0') @@ -63,6 +85,10 @@ void cc3200_print(char* str) } } +/************************************************************************************ + * Name: cc3200_pin_config_set + ************************************************************************************/ + void cc3200_pin_config_set(uint32_t pin, uint32_t pin_strength, uint32_t pin_type) { uint32_t pad; @@ -85,6 +111,10 @@ void cc3200_pin_config_set(uint32_t pin, uint32_t pin_strength, uint32_t pin_typ } } +/************************************************************************************ + * Name: cc3200_pin_mode_set + ************************************************************************************/ + void cc3200_pin_mode_set(uint32_t pin, uint32_t pin_mode) { uint32_t pad; @@ -94,12 +124,20 @@ void cc3200_pin_mode_set(uint32_t pin, uint32_t pin_mode) HWREG(pad) = (((HWREG(pad) & ~PAD_MODE_MASK) | pin_mode) & ~(3<<10)); } +/************************************************************************************ + * Name: cc3200_pin_type_uart + ************************************************************************************/ + void cc3200_pin_type_uart(uint32_t pin, uint32_t pin_mode) { cc3200_pin_mode_set(pin, pin_mode); cc3200_pin_config_set(pin, PIN_STRENGTH_2MA, PIN_TYPE_STD); } +/************************************************************************************ + * Name: cc3200_init + ************************************************************************************/ + void cc3200_init(void) { HWREG(0x4402F064) |= 0x800000; |