2009-05-07 02:11:26 +08:00
|
|
|
/************************************************************************************
|
2014-03-09 02:31:06 +08:00
|
|
|
* arch/arm/include/tiva/irq.h
|
2009-05-07 02:11:26 +08:00
|
|
|
*
|
2011-04-06 09:51:07 +08:00
|
|
|
* Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
|
2012-09-14 02:32:24 +08:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
2009-05-07 02:11:26 +08:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
************************************************************************************/
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#ifndef __ARCH_ARM_INCLUDE_TIVA_IRQ_H
|
|
|
|
#define __ARCH_ARM_INCLUDE_TIVA_IRQ_H
|
2009-05-07 02:11:26 +08:00
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
* Included Files
|
|
|
|
************************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2009-05-15 04:50:43 +08:00
|
|
|
#include <nuttx/irq.h>
|
2014-03-09 02:31:06 +08:00
|
|
|
#include <arch/tiva/chip.h>
|
2009-05-07 02:11:26 +08:00
|
|
|
|
2013-01-22 09:25:40 +08:00
|
|
|
/************************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
************************************************************************************/
|
2013-03-02 08:11:43 +08:00
|
|
|
/* Mark GPIO interrupts as disabled for non-existent GPIO ports. */
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#if TIVA_NPORTS < 1 && !defined(CONFIG_TIVA_DISABLE_GPIOA_IRQS)
|
|
|
|
# define CONFIG_TIVA_DISABLE_GPIOA_IRQS
|
|
|
|
#elif TIVA_NPORTS < 2 && !defined(CONFIG_TIVA_DISABLE_GPIOB_IRQS)
|
|
|
|
# define CONFIG_TIVA_DISABLE_GPIOB_IRQS
|
|
|
|
#elif TIVA_NPORTS < 3 && !defined(CONFIG_TIVA_DISABLE_GPIOC_IRQS)
|
|
|
|
# define CONFIG_TIVA_DISABLE_GPIOC_IRQS
|
|
|
|
#elif TIVA_NPORTS < 4 && !defined(CONFIG_TIVA_DISABLE_GPIOD_IRQS)
|
|
|
|
# define CONFIG_TIVA_DISABLE_GPIOD_IRQS
|
|
|
|
#elif TIVA_NPORTS < 5 && !defined(CONFIG_TIVA_DISABLE_GPIOE_IRQS)
|
|
|
|
# define CONFIG_TIVA_DISABLE_GPIOE_IRQS
|
|
|
|
#elif TIVA_NPORTS < 6 && !defined(CONFIG_TIVA_DISABLE_GPIOF_IRQS)
|
|
|
|
# define CONFIG_TIVA_DISABLE_GPIOF_IRQS
|
|
|
|
#elif TIVA_NPORTS < 7 && !defined(CONFIG_TIVA_DISABLE_GPIOG_IRQS)
|
|
|
|
# define CONFIG_TIVA_DISABLE_GPIOG_IRQS
|
|
|
|
#elif TIVA_NPORTS < 8 && !defined(CONFIG_TIVA_DISABLE_GPIOH_IRQS)
|
|
|
|
# define CONFIG_TIVA_DISABLE_GPIOH_IRQS
|
|
|
|
#elif TIVA_NPORTS < 9 && !defined(CONFIG_TIVA_DISABLE_GPIOJ_IRQS)
|
|
|
|
# define CONFIG_TIVA_DISABLE_GPIOJ_IRQS
|
2013-03-02 08:11:43 +08:00
|
|
|
#endif
|
2013-01-22 09:25:40 +08:00
|
|
|
|
|
|
|
/* Processor Exceptions (vectors 0-15) */
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#define TIVA_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG) */
|
|
|
|
/* Vector 0: Reset stack pointer value */
|
|
|
|
/* Vector 1: Reset (not handler as an IRQ) */
|
|
|
|
#define TIVA_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */
|
|
|
|
#define TIVA_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */
|
|
|
|
#define TIVA_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */
|
|
|
|
#define TIVA_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */
|
|
|
|
#define TIVA_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */
|
|
|
|
#define TIVA_IRQ_SVCALL (11) /* Vector 11: SVC call */
|
|
|
|
#define TIVA_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */
|
|
|
|
/* Vector 13: Reserved */
|
|
|
|
#define TIVA_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */
|
|
|
|
#define TIVA_IRQ_SYSTICK (15) /* Vector 15: System tick */
|
2013-01-22 09:25:40 +08:00
|
|
|
|
2013-01-10 03:49:16 +08:00
|
|
|
#if defined(CONFIG_ARCH_CHIP_LM3S)
|
2014-03-09 02:31:06 +08:00
|
|
|
# include <arch/tiva/lm3s_irq.h>
|
2013-01-10 03:49:16 +08:00
|
|
|
#elif defined(CONFIG_ARCH_CHIP_LM4F)
|
2014-03-09 02:31:06 +08:00
|
|
|
# include <arch/tiva/lm4f_irq.h>
|
2009-05-07 02:11:26 +08:00
|
|
|
#else
|
2013-01-10 03:49:16 +08:00
|
|
|
# error "Unsupported Stellaris IRQ file"
|
2009-05-07 02:11:26 +08:00
|
|
|
#endif
|
|
|
|
|
2009-05-15 04:50:43 +08:00
|
|
|
/* GPIO IRQs -- Note that support for individual GPIO ports can
|
|
|
|
* be disabled in order to reduce the size of the implemenation.
|
|
|
|
*/
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#ifndef CONFIG_TIVA_DISABLE_GPIOA_IRQS
|
|
|
|
# define TIVA_IRQ_GPIOA_0 (NR_IRQS + 0)
|
|
|
|
# define TIVA_IRQ_GPIOA_1 (NR_IRQS + 1)
|
|
|
|
# define TIVA_IRQ_GPIOA_2 (NR_IRQS + 2)
|
|
|
|
# define TIVA_IRQ_GPIOA_3 (NR_IRQS + 3)
|
|
|
|
# define TIVA_IRQ_GPIOA_4 (NR_IRQS + 4)
|
|
|
|
# define TIVA_IRQ_GPIOA_5 (NR_IRQS + 5)
|
|
|
|
# define TIVA_IRQ_GPIOA_6 (NR_IRQS + 6)
|
|
|
|
# define TIVA_IRQ_GPIOA_7 (NR_IRQS + 7)
|
|
|
|
# define _NGPIOAIRQS (NR_IRQS + 8)
|
2009-05-15 04:50:43 +08:00
|
|
|
#else
|
2014-03-09 05:50:26 +08:00
|
|
|
# define _NGPIOAIRQS NR_IRQS
|
2009-05-15 04:50:43 +08:00
|
|
|
#endif
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#ifndef CONFIG_TIVA_DISABLE_GPIOB_IRQS
|
|
|
|
# define TIVA_IRQ_GPIOB_0 (_NGPIOAIRQS + 0)
|
|
|
|
# define TIVA_IRQ_GPIOB_1 (_NGPIOAIRQS + 1)
|
|
|
|
# define TIVA_IRQ_GPIOB_2 (_NGPIOAIRQS + 2)
|
|
|
|
# define TIVA_IRQ_GPIOB_3 (_NGPIOAIRQS + 3)
|
|
|
|
# define TIVA_IRQ_GPIOB_4 (_NGPIOAIRQS + 4)
|
|
|
|
# define TIVA_IRQ_GPIOB_5 (_NGPIOAIRQS + 5)
|
|
|
|
# define TIVA_IRQ_GPIOB_6 (_NGPIOAIRQS + 6)
|
|
|
|
# define TIVA_IRQ_GPIOB_7 (_NGPIOAIRQS + 7)
|
|
|
|
# define _NGPIOBIRQS (_NGPIOAIRQS + 8)
|
2009-05-15 04:50:43 +08:00
|
|
|
#else
|
2014-03-09 05:50:26 +08:00
|
|
|
# define _NGPIOBIRQS _NGPIOAIRQS
|
2009-05-15 04:50:43 +08:00
|
|
|
#endif
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#ifndef CONFIG_TIVA_DISABLE_GPIOC_IRQS
|
|
|
|
# define TIVA_IRQ_GPIOC_0 (_NGPIOBIRQS + 0)
|
|
|
|
# define TIVA_IRQ_GPIOC_1 (_NGPIOBIRQS + 1)
|
|
|
|
# define TIVA_IRQ_GPIOC_2 (_NGPIOBIRQS + 2)
|
|
|
|
# define TIVA_IRQ_GPIOC_3 (_NGPIOBIRQS + 3)
|
|
|
|
# define TIVA_IRQ_GPIOC_4 (_NGPIOBIRQS + 4)
|
|
|
|
# define TIVA_IRQ_GPIOC_5 (_NGPIOBIRQS + 5)
|
|
|
|
# define TIVA_IRQ_GPIOC_6 (_NGPIOBIRQS + 6)
|
|
|
|
# define TIVA_IRQ_GPIOC_7 (_NGPIOBIRQS + 7)
|
|
|
|
# define _NGPIOCIRQS (_NGPIOBIRQS + 8)
|
2009-05-15 04:50:43 +08:00
|
|
|
#else
|
2014-03-09 05:50:26 +08:00
|
|
|
# define _NGPIOCIRQS _NGPIOBIRQS
|
2009-05-15 04:50:43 +08:00
|
|
|
#endif
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#ifndef CONFIG_TIVA_DISABLE_GPIOD_IRQS
|
|
|
|
# define TIVA_IRQ_GPIOD_0 (_NGPIOCIRQS + 0)
|
|
|
|
# define TIVA_IRQ_GPIOD_1 (_NGPIOCIRQS + 1)
|
|
|
|
# define TIVA_IRQ_GPIOD_2 (_NGPIOCIRQS + 2)
|
|
|
|
# define TIVA_IRQ_GPIOD_3 (_NGPIOCIRQS + 3)
|
|
|
|
# define TIVA_IRQ_GPIOD_4 (_NGPIOCIRQS + 4)
|
|
|
|
# define TIVA_IRQ_GPIOD_5 (_NGPIOCIRQS + 5)
|
|
|
|
# define TIVA_IRQ_GPIOD_6 (_NGPIOCIRQS + 6)
|
|
|
|
# define TIVA_IRQ_GPIOD_7 (_NGPIOCIRQS + 7)
|
|
|
|
# define _NGPIODIRQS (_NGPIOCIRQS + 8)
|
2009-05-15 04:50:43 +08:00
|
|
|
#else
|
2014-03-09 05:50:26 +08:00
|
|
|
# define _NGPIODIRQS _NGPIOCIRQS
|
2009-05-15 04:50:43 +08:00
|
|
|
#endif
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#ifndef CONFIG_TIVA_DISABLE_GPIOE_IRQS
|
|
|
|
# define TIVA_IRQ_GPIOE_0 (_NGPIODIRQS + 0)
|
|
|
|
# define TIVA_IRQ_GPIOE_1 (_NGPIODIRQS + 1)
|
|
|
|
# define TIVA_IRQ_GPIOE_2 (_NGPIODIRQS + 2)
|
|
|
|
# define TIVA_IRQ_GPIOE_3 (_NGPIODIRQS + 3)
|
|
|
|
# define TIVA_IRQ_GPIOE_4 (_NGPIODIRQS + 4)
|
|
|
|
# define TIVA_IRQ_GPIOE_5 (_NGPIODIRQS + 5)
|
|
|
|
# define TIVA_IRQ_GPIOE_6 (_NGPIODIRQS + 6)
|
|
|
|
# define TIVA_IRQ_GPIOE_7 (_NGPIODIRQS + 7)
|
|
|
|
# define _NGPIOEIRQS (_NGPIODIRQS + 8)
|
2009-05-15 04:50:43 +08:00
|
|
|
#else
|
2014-03-09 05:50:26 +08:00
|
|
|
# define _NGPIOEIRQS _NGPIODIRQS
|
2009-05-15 04:50:43 +08:00
|
|
|
#endif
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#ifndef CONFIG_TIVA_DISABLE_GPIOF_IRQS
|
|
|
|
# define TIVA_IRQ_GPIOF_0 (_NGPIOEIRQS + 0)
|
|
|
|
# define TIVA_IRQ_GPIOF_1 (_NGPIOEIRQS + 1)
|
|
|
|
# define TIVA_IRQ_GPIOF_2 (_NGPIOEIRQS + 2)
|
|
|
|
# define TIVA_IRQ_GPIOF_3 (_NGPIOEIRQS + 3)
|
|
|
|
# define TIVA_IRQ_GPIOF_4 (_NGPIOEIRQS + 4)
|
|
|
|
# define TIVA_IRQ_GPIOF_5 (_NGPIOEIRQS + 5)
|
|
|
|
# define TIVA_IRQ_GPIOF_6 (_NGPIOEIRQS + 6)
|
|
|
|
# define TIVA_IRQ_GPIOF_7 (_NGPIOEIRQS + 7)
|
|
|
|
# define _NGPIOFIRQS (_NGPIOEIRQS + 8)
|
2009-05-15 04:50:43 +08:00
|
|
|
#else
|
2014-03-09 05:50:26 +08:00
|
|
|
# define _NGPIOFIRQS _NGPIOEIRQS
|
2009-05-15 04:50:43 +08:00
|
|
|
#endif
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#ifndef CONFIG_TIVA_DISABLE_GPIOG_IRQS
|
|
|
|
# define TIVA_IRQ_GPIOG_0 (_NGPIOFIRQS + 0)
|
|
|
|
# define TIVA_IRQ_GPIOG_1 (_NGPIOFIRQS + 1)
|
|
|
|
# define TIVA_IRQ_GPIOG_2 (_NGPIOFIRQS + 2)
|
|
|
|
# define TIVA_IRQ_GPIOG_3 (_NGPIOFIRQS + 3)
|
|
|
|
# define TIVA_IRQ_GPIOG_4 (_NGPIOFIRQS + 4)
|
|
|
|
# define TIVA_IRQ_GPIOG_5 (_NGPIOFIRQS + 5)
|
|
|
|
# define TIVA_IRQ_GPIOG_6 (_NGPIOFIRQS + 6)
|
|
|
|
# define TIVA_IRQ_GPIOG_7 (_NGPIOFIRQS + 7)
|
|
|
|
# define _NGPIOGIRQS (_NGPIOFIRQS + 8)
|
2009-05-15 04:50:43 +08:00
|
|
|
#else
|
2014-03-09 05:50:26 +08:00
|
|
|
# define _NGPIOGIRQS _NGPIOFIRQS
|
2009-05-15 04:50:43 +08:00
|
|
|
#endif
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#ifndef CONFIG_TIVA_DISABLE_GPIOH_IRQS
|
|
|
|
# define TIVA_IRQ_GPIOH_0 (_NGPIOGIRQS + 0)
|
|
|
|
# define TIVA_IRQ_GPIOH_1 (_NGPIOGIRQS + 1)
|
|
|
|
# define TIVA_IRQ_GPIOH_2 (_NGPIOGIRQS + 2)
|
|
|
|
# define TIVA_IRQ_GPIOH_3 (_NGPIOGIRQS + 3)
|
|
|
|
# define TIVA_IRQ_GPIOH_4 (_NGPIOGIRQS + 4)
|
|
|
|
# define TIVA_IRQ_GPIOH_5 (_NGPIOGIRQS + 5)
|
|
|
|
# define TIVA_IRQ_GPIOH_6 (_NGPIOGIRQS + 6)
|
|
|
|
# define TIVA_IRQ_GPIOH_7 (_NGPIOGIRQS + 7)
|
|
|
|
# define _NGPIOHIRQS (_NGPIOGIRQS + 8)
|
2009-05-15 04:50:43 +08:00
|
|
|
#else
|
2014-03-09 05:50:26 +08:00
|
|
|
# define _NGPIOHIRQS _NGPIOGIRQS
|
2009-05-15 04:50:43 +08:00
|
|
|
#endif
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#ifndef CONFIG_TIVA_DISABLE_GPIOJ_IRQS
|
|
|
|
# define TIVA_IRQ_GPIOJ_0 (_NGPIOHIRQS + 0)
|
|
|
|
# define TIVA_IRQ_GPIOJ_1 (_NGPIOHIRQS + 1)
|
|
|
|
# define TIVA_IRQ_GPIOJ_2 (_NGPIOHIRQS + 2)
|
|
|
|
# define TIVA_IRQ_GPIOJ_3 (_NGPIOHIRQS + 3)
|
|
|
|
# define TIVA_IRQ_GPIOJ_4 (_NGPIOHIRQS + 4)
|
|
|
|
# define TIVA_IRQ_GPIOJ_5 (_NGPIOHIRQS + 5)
|
|
|
|
# define TIVA_IRQ_GPIOJ_6 (_NGPIOHIRQS + 6)
|
|
|
|
# define TIVA_IRQ_GPIOJ_7 (_NGPIOHIRQS + 7)
|
|
|
|
# define _NGPIOJIRQS (_NGPIOHIRQS + 8)
|
2010-08-12 09:49:25 +08:00
|
|
|
#else
|
2014-03-09 05:50:26 +08:00
|
|
|
# define _NGPIOJIRQS _NGPIOHIRQS
|
2010-08-12 09:49:25 +08:00
|
|
|
#endif
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#define NR_GPIO_IRQS (_NGPIOJIRQS - NR_IRQS)
|
2009-05-15 04:50:43 +08:00
|
|
|
|
2009-05-07 02:11:26 +08:00
|
|
|
/************************************************************************************
|
|
|
|
* Public Types
|
|
|
|
************************************************************************************/
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
* Public Data
|
|
|
|
************************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#ifdef __cplusplus
|
2013-01-10 03:49:16 +08:00
|
|
|
extern "C"
|
|
|
|
{
|
2009-05-07 02:11:26 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
************************************************************************************/
|
|
|
|
|
2009-05-15 04:50:43 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: gpio_irqattach
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Attach the interrupt handler 'isr' to the GPIO IRQ 'irq'
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-01-10 03:49:16 +08:00
|
|
|
int gpio_irqattach(int irq, xcpt_t isr);
|
2009-05-15 04:50:43 +08:00
|
|
|
#define gpio_irqdetach(isr) gpio_irqattach(isr, NULL)
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: gpio_irqenable
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Enable the GPIO IRQ specified by 'irq'
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-01-10 03:49:16 +08:00
|
|
|
void gpio_irqenable(int irq);
|
2009-05-15 04:50:43 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: gpio_irqdisable
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Disable the GPIO IRQ specified by 'irq'
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-01-10 03:49:16 +08:00
|
|
|
void gpio_irqdisable(int irq);
|
2009-05-15 04:50:43 +08:00
|
|
|
|
2009-05-07 02:11:26 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2014-03-09 05:50:26 +08:00
|
|
|
#endif /* __ARCH_ARM_INCLUDE_TIVA_IRQ_H */
|