Adds support for TM4C123G timers; integrates with the TM4C123G Launchpad. From Calvin Maguranis

This commit is contained in:
Gregory Nutt 2015-02-05 13:51:32 -06:00
parent 357ee0a3f0
commit 31d4ab1902
5 changed files with 200 additions and 22 deletions

View File

@ -42,8 +42,9 @@ CONFIG_RAW_BINARY=y
# Debug Options # Debug Options
# #
# CONFIG_DEBUG is not set # CONFIG_DEBUG is not set
CONFIG_ARCH_HAVE_STACKCHECK=y
# CONFIG_ARCH_HAVE_HEAPCHECK is not set # CONFIG_ARCH_HAVE_HEAPCHECK is not set
CONFIG_ARCH_HAVE_STACKCHECK=y
# CONFIG_STACK_COLORATION is not set
# CONFIG_DEBUG_SYMBOLS is not set # CONFIG_DEBUG_SYMBOLS is not set
CONFIG_ARCH_HAVE_CUSTOMOPT=y CONFIG_ARCH_HAVE_CUSTOMOPT=y
# CONFIG_DEBUG_NOOPT is not set # CONFIG_DEBUG_NOOPT is not set
@ -121,21 +122,51 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y
# #
# CONFIG_ARCH_CHIP_TM4C123GH6ZRB is not set # CONFIG_ARCH_CHIP_TM4C123GH6ZRB is not set
CONFIG_ARCH_CHIP_TM4C123GH6PMI=y CONFIG_ARCH_CHIP_TM4C123GH6PMI=y
# CONFIG_ARCH_CHIP_TM4C1294NC is not set
# CONFIG_ARCH_CHIP_TM4C129XNC is not set
# CONFIG_ARCH_CHIP_CC3200 is not set # CONFIG_ARCH_CHIP_CC3200 is not set
CONFIG_ARCH_CHIP_TM4C=y
CONFIG_ARCH_CHIP_TM4C123=y CONFIG_ARCH_CHIP_TM4C123=y
CONFIG_ARCH_CHIP_TM4C=y
# CONFIG_TIVA_BOARD_EARLYINIT is not set # CONFIG_TIVA_BOARD_EARLYINIT is not set
# #
# Tiva/Stellaris Peripheral Support # Tiva/Stellaris Peripheral Support
# #
# CONFIG_TIVA_ADC is not set
CONFIG_TIVA_HAVE_ADC0=y
CONFIG_TIVA_HAVE_ADC1=y
# CONFIG_TIVA_I2C is not set
CONFIG_TIVA_HAVE_I2C1=y
CONFIG_TIVA_HAVE_I2C2=y CONFIG_TIVA_HAVE_I2C2=y
CONFIG_TIVA_HAVE_I2C3=y CONFIG_TIVA_HAVE_I2C3=y
# CONFIG_TIVA_HAVE_I2C4 is not set
# CONFIG_TIVA_HAVE_I2C5 is not set
# CONFIG_TIVA_HAVE_I2C6 is not set
# CONFIG_TIVA_HAVE_I2C7 is not set
# CONFIG_TIVA_HAVE_I2C8 is not set
# CONFIG_TIVA_HAVE_I2C9 is not set
CONFIG_TIVA_HAVE_UART3=y CONFIG_TIVA_HAVE_UART3=y
CONFIG_TIVA_HAVE_UART4=y CONFIG_TIVA_HAVE_UART4=y
CONFIG_TIVA_HAVE_UART5=y CONFIG_TIVA_HAVE_UART5=y
CONFIG_TIVA_HAVE_UART6=y CONFIG_TIVA_HAVE_UART6=y
CONFIG_TIVA_HAVE_UART7=y CONFIG_TIVA_HAVE_UART7=y
CONFIG_TIVA_HAVE_SSI0=y
CONFIG_TIVA_HAVE_SSI1=y
CONFIG_TIVA_HAVE_SSI2=y
CONFIG_TIVA_HAVE_SSI3=y
# CONFIG_TIVA_HAVE_ETHERNET is not set
CONFIG_TIVA_SSI=y
# CONFIG_TIVA_TIMER is not set
CONFIG_TIVA_HAVE_TIMER0=y
CONFIG_TIVA_HAVE_TIMER1=y
CONFIG_TIVA_HAVE_TIMER2=y
CONFIG_TIVA_HAVE_TIMER3=y
CONFIG_TIVA_HAVE_TIMER4=y
CONFIG_TIVA_HAVE_TIMER5=y
# CONFIG_TIVA_HAVE_TIMER6 is not set
# CONFIG_TIVA_HAVE_TIMER7 is not set
# CONFIG_TIVA_ADC0 is not set
# CONFIG_TIVA_ADC1 is not set
# CONFIG_TIVA_I2C0 is not set # CONFIG_TIVA_I2C0 is not set
# CONFIG_TIVA_I2C1 is not set # CONFIG_TIVA_I2C1 is not set
# CONFIG_TIVA_I2C2 is not set # CONFIG_TIVA_I2C2 is not set
@ -150,27 +181,46 @@ CONFIG_TIVA_UART0=y
# CONFIG_TIVA_UART7 is not set # CONFIG_TIVA_UART7 is not set
CONFIG_TIVA_SSI0=y CONFIG_TIVA_SSI0=y
# CONFIG_TIVA_SSI1 is not set # CONFIG_TIVA_SSI1 is not set
# CONFIG_TIVA_SSI2 is not set
# CONFIG_TIVA_SSI3 is not set
# CONFIG_TIVA_TIMER0 is not set
# CONFIG_TIVA_TIMER1 is not set
# CONFIG_TIVA_TIMER2 is not set
# CONFIG_TIVA_TIMER3 is not set
# CONFIG_TIVA_TIMER4 is not set
# CONFIG_TIVA_TIMER5 is not set
# CONFIG_TIVA_ETHERNET is not set # CONFIG_TIVA_ETHERNET is not set
# CONFIG_TIVA_FLASH is not set # CONFIG_TIVA_FLASH is not set
# #
# Disable GPIO Interrupts # Enable GPIO Interrupts
# #
CONFIG_TIVA_GPIO_IRQS=y
CONFIG_TIVA_HAVE_GPIOA_IRQS=y
CONFIG_TIVA_HAVE_GPIOB_IRQS=y
CONFIG_TIVA_HAVE_GPIOC_IRQS=y
CONFIG_TIVA_HAVE_GPIOD_IRQS=y
CONFIG_TIVA_HAVE_GPIOE_IRQS=y
CONFIG_TIVA_HAVE_GPIOF_IRQS=y
# CONFIG_TIVA_HAVE_GPIOG_IRQS is not set
# CONFIG_TIVA_HAVE_GPIOH_IRQS is not set
# CONFIG_TIVA_HAVE_GPIOJ_IRQS is not set
# CONFIG_TIVA_HAVE_GPIOK_IRQS is not set
# CONFIG_TIVA_HAVE_GPIOL_IRQS is not set
# CONFIG_TIVA_HAVE_GPIOM_IRQS is not set
# CONFIG_TIVA_HAVE_GPION_IRQS is not set
CONFIG_TIVA_HAVE_GPIOP_IRQS=y
# CONFIG_TIVA_HAVE_GPIOQ_IRQS is not set
# CONFIG_TIVA_HAVE_GPIOR_IRQS is not set
# CONFIG_TIVA_HAVE_GPIOS_IRQS is not set
# CONFIG_TIVA_HAVE_GPIOT_IRQS is not set
CONFIG_TIVA_GPIOA_IRQS=y CONFIG_TIVA_GPIOA_IRQS=y
CONFIG_TIVA_GPIOB_IRQS=y CONFIG_TIVA_GPIOB_IRQS=y
CONFIG_TIVA_GPIOC_IRQS=y CONFIG_TIVA_GPIOC_IRQS=y
CONFIG_TIVA_GPIOD_IRQS=y CONFIG_TIVA_GPIOD_IRQS=y
CONFIG_TIVA_GPIOE_IRQS=y CONFIG_TIVA_GPIOE_IRQS=y
CONFIG_TIVA_GPIOF_IRQS=y CONFIG_TIVA_GPIOF_IRQS=y
CONFIG_TIVA_GPIOG_IRQS=y
# CONFIG_TIVA_GPIOH_IRQS is not set
# CONFIG_TIVA_GPIOJ_IRQS is not set
CONFIG_TIVA_GPIOK_IRQS=y
CONFIG_TIVA_GPIOL_IRQS=y
CONFIG_TIVA_GPIOM_IRQS=y
CONFIG_TIVA_GPION_IRQS=y
CONFIG_TIVA_GPIOP_IRQS=y CONFIG_TIVA_GPIOP_IRQS=y
CONFIG_TIVA_GPIOQ_IRQS=y
# #
# Tiva/Stellaris SSI Configuration # Tiva/Stellaris SSI Configuration
@ -423,6 +473,8 @@ CONFIG_ARCH_HAVE_UART0=y
# #
CONFIG_MCU_SERIAL=y CONFIG_MCU_SERIAL=y
CONFIG_STANDARD_SERIAL=y CONFIG_STANDARD_SERIAL=y
# CONFIG_SERIAL_IFLOWCONTROL is not set
# CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_ARCH_HAVE_SERIAL_TERMIOS is not set # CONFIG_ARCH_HAVE_SERIAL_TERMIOS is not set
CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART0_SERIAL_CONSOLE=y
# CONFIG_OTHER_SERIAL_CONSOLE is not set # CONFIG_OTHER_SERIAL_CONSOLE is not set
@ -439,8 +491,6 @@ CONFIG_UART0_PARITY=0
CONFIG_UART0_2STOP=0 CONFIG_UART0_2STOP=0
# CONFIG_UART0_IFLOWCONTROL is not set # CONFIG_UART0_IFLOWCONTROL is not set
# CONFIG_UART0_OFLOWCONTROL is not set # CONFIG_UART0_OFLOWCONTROL is not set
# CONFIG_SERIAL_IFLOWCONTROL is not set
# CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_USBDEV is not set # CONFIG_USBDEV is not set
# CONFIG_USBHOST is not set # CONFIG_USBHOST is not set
# CONFIG_WIRELESS is not set # CONFIG_WIRELESS is not set
@ -624,7 +674,6 @@ CONFIG_EXAMPLES_NSH=y
# CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TIFF is not set
# CONFIG_EXAMPLES_TOUCHSCREEN is not set # CONFIG_EXAMPLES_TOUCHSCREEN is not set
# CONFIG_EXAMPLES_UDP is not set
# CONFIG_EXAMPLES_WEBSERVER is not set # CONFIG_EXAMPLES_WEBSERVER is not set
# CONFIG_EXAMPLES_USBSERIAL is not set # CONFIG_EXAMPLES_USBSERIAL is not set
# CONFIG_EXAMPLES_USBTERM is not set # CONFIG_EXAMPLES_USBTERM is not set
@ -634,12 +683,14 @@ CONFIG_EXAMPLES_NSH=y
# Graphics Support # Graphics Support
# #
# CONFIG_TIFF is not set # CONFIG_TIFF is not set
# CONFIG_GRAPHICS_TRAVELER is not set
# #
# Interpreters # Interpreters
# #
# CONFIG_INTERPRETERS_FICL is not set # CONFIG_INTERPRETERS_FICL is not set
# CONFIG_INTERPRETERS_PCODE is not set # CONFIG_INTERPRETERS_PCODE is not set
# CONFIG_INTERPRETERS_MICROPYTHON is not set
# #
# Network Utilities # Network Utilities
@ -649,7 +700,6 @@ CONFIG_EXAMPLES_NSH=y
# Networking Utilities # Networking Utilities
# #
# CONFIG_NETUTILS_CODECS is not set # CONFIG_NETUTILS_CODECS is not set
# CONFIG_NETUTILS_DHCPD is not set
# CONFIG_NETUTILS_FTPC is not set # CONFIG_NETUTILS_FTPC is not set
# CONFIG_NETUTILS_FTPD is not set # CONFIG_NETUTILS_FTPD is not set
# CONFIG_NETUTILS_JSON is not set # CONFIG_NETUTILS_JSON is not set
@ -747,7 +797,7 @@ CONFIG_NSH_FILEIOSIZE=512
# #
CONFIG_NSH_CONSOLE=y CONFIG_NSH_CONSOLE=y
# CONFIG_NSH_ALTCONDEV is not set # CONFIG_NSH_ALTCONDEV is not set
# CONFIG_NSH_ARCHINIT is not set CONFIG_NSH_ARCHINIT=y
# #
# NxWidgets/NxWM # NxWidgets/NxWM
@ -772,6 +822,11 @@ CONFIG_NSH_CONSOLE=y
# #
# CONFIG_SYSTEM_CLE is not set # CONFIG_SYSTEM_CLE is not set
#
# CU Minimal Terminal
#
# CONFIG_SYSTEM_CUTERM is not set
# #
# FLASH Program Installation # FLASH Program Installation
# #
@ -843,6 +898,10 @@ CONFIG_READLINE_ECHO=y
# #
# CONFIG_SYSTEM_SYSINFO is not set # CONFIG_SYSTEM_SYSINFO is not set
#
# Temperature
#
# #
# VI Work-Alike Editor # VI Work-Alike Editor
# #

View File

@ -49,6 +49,10 @@ ifeq ($(CONFIG_NSH_ARCHINIT),y)
CSRCS += tm4c_nsh.c CSRCS += tm4c_nsh.c
endif endif
ifeq ($(CONFIG_TIVA_TIMER),y)
CSRCS += tm4c_timer.c
endif
ifeq ($(CONFIG_MTD_AT24XX),y) ifeq ($(CONFIG_MTD_AT24XX),y)
ifeq ($(CONFIG_TIVA_I2C0),y) ifeq ($(CONFIG_TIVA_I2C0),y)
CSRCS += tm4c_at24.c CSRCS += tm4c_at24.c

View File

@ -223,6 +223,20 @@ int tm4c_bringup(void);
#ifdef HAVE_AT24 #ifdef HAVE_AT24
int tm4c_at24_automount(int minor); int tm4c_at24_automount(int minor);
#endif #endif
/****************************************************************************
* Name: tiva_timer_initialize
*
* Description:
* Configure the timer driver
*
****************************************************************************/
#ifdef CONFIG_TIVA_TIMER
int tiva_timer_initialize(void);
#endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_TM4C123G_LAUNCHPAD_TM4C123G_LAUNCHPAD_H */ #endif /* __CONFIGS_TM4C123G_LAUNCHPAD_TM4C123G_LAUNCHPAD_H */

View File

@ -47,7 +47,6 @@
* Pre-Processor Definitions * Pre-Processor Definitions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@ -62,19 +61,31 @@
int tm4c_bringup(void) int tm4c_bringup(void)
{ {
#ifdef HAVE_AT24 #if defined (HAVE_AT24) || defined (CONFIG_TIVA_TIMER)
int ret; int ret;
#endif /* defined (HAVE_AT24) || defined (CONFIG_TIVA_TIMER) */
#ifdef HAVE_AT24
/* Initialize the AT24 driver */ /* Initialize the AT24 driver */
ret = tm4c_at24_automount(AT24_MINOR); ret = tm4c_at24_automount(AT24_MINOR);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: tm4c_at24_automount failed: %d\n", ret); syslog(LOG_ERR, "ERROR: tm4c_at24_automount failed: %d\n", ret);
return ret;
} }
return ret;
#else
return OK;
#endif /* HAVE_AT24 */ #endif /* HAVE_AT24 */
#ifdef CONFIG_TIVA_TIMER
/* Initialize the timer driver */
ret = tiva_timer_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize timer driver: %d\n", ret);
return ret;
}
#endif /* CONFIG_TIVA_TIMER */
return OK;
} }

View File

@ -0,0 +1,90 @@
/****************************************************************************
* config/tm4c123g-launchpad/src/tm4c_timer.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* With modifications from Calvin Maguranis
*
* 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 "tiva_timer.h"
#include "tm4c123g-launchpad.h"
#ifdef CONFIG_TIVA_TIMER
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifndef CONFIG_TIVA_TIMER32_PERIODIC
# error CONFIG_TIVA_TIMER32_PERIODIC is not defined
#endif
#define GPTM 0
#define CONFIG_TM4C_TIMER_DEVNAME "/dev/timer0"
#define ALTCLK false
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: tiva_timer_initialize
*
* Description:
* Configure the timer driver
*
****************************************************************************/
int tiva_timer_initialize(void)
{
int ret;
timvdbg("Registering TIMER%d at %s\n", GPTM, CONFIG_TM4C_TIMER_DEVNAME);
ret = tiva_timer_register(CONFIG_TM4C_TIMER_DEVNAME, GPTM, ALTCLK);
if (ret < 0)
{
timdbg("ERROR: Failed to register timer driver: %d\n", ret);
}
return ret;
}
#endif /* CONFIG_TIVA_TIMER */