diff --git a/configs/Kconfig b/configs/Kconfig index 9b95faf84a..2484013763 100644 --- a/configs/Kconfig +++ b/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/configs/cc3200-launchpad/include/cc3200_utils.h b/configs/cc3200-launchpad/include/cc3200_utils.h index 400891c167..18b8ac51c5 100644 --- a/configs/cc3200-launchpad/include/cc3200_utils.h +++ b/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/configs/cc3200-launchpad/src/cc3200_autoleds.c b/configs/cc3200-launchpad/src/cc3200_autoleds.c index adb7b8ebd3..820618971d 100644 --- a/configs/cc3200-launchpad/src/cc3200_autoleds.c +++ b/configs/cc3200-launchpad/src/cc3200_autoleds.c @@ -40,6 +40,8 @@ #include +#include "cc3200_launchpad.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/configs/cc3200-launchpad/src/cc3200_boot.c b/configs/cc3200-launchpad/src/cc3200_boot.c index 3c2b857761..76d6e88112 100644 --- a/configs/cc3200-launchpad/src/cc3200_boot.c +++ b/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 @@ -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 #include @@ -50,21 +49,23 @@ #include #include -/************************************************************************************ +#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/configs/cc3200-launchpad/src/cc3200_launchpad.h b/configs/cc3200-launchpad/src/cc3200_launchpad.h new file mode 100644 index 0000000000..2378023ad6 --- /dev/null +++ b/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 + * + * 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 + +#include + +/**************************************************************************** + * 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/configs/cc3200-launchpad/src/cc3200_serial.c b/configs/cc3200-launchpad/src/cc3200_serial.c index 20a43daa71..4d7715ab28 100644 --- a/configs/cc3200-launchpad/src/cc3200_serial.c +++ b/configs/cc3200-launchpad/src/cc3200_serial.c @@ -46,10 +46,21 @@ #include #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 ************************************************************************************/ @@ -57,7 +68,8 @@ /************************************************************************************ * 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/configs/cc3200-launchpad/src/cc3200_utils.c b/configs/cc3200-launchpad/src/cc3200_utils.c index f763085fad..88f7c692ad 100644 --- a/configs/cc3200-launchpad/src/cc3200_utils.c +++ b/configs/cc3200-launchpad/src/cc3200_utils.c @@ -32,8 +32,22 @@ * ************************************************************************************/ +/************************************************************************************ + * Included Files + ************************************************************************************/ + #include -#include +#include + +#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;