CC3200 Launchpad updates

This commit is contained in:
Gregory Nutt 2014-08-26 16:31:47 -06:00
parent f65b319037
commit c3a498264e
10 changed files with 231 additions and 28 deletions

View File

@ -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

View File

@ -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();

View File

@ -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 */

View File

@ -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.

View File

@ -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 */

View File

@ -40,6 +40,8 @@
#include <nuttx/config.h>
#include "cc3200_launchpad.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

View File

@ -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)
{

View File

@ -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 */

View File

@ -46,10 +46,21 @@
#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
************************************************************************************/
@ -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();

View File

@ -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;