summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-31 23:09:33 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-31 23:09:33 +0000
commit03db221a3d9a6678cd8fef66ca6a35b988503b57 (patch)
treec4cac22df765ed4c2ffed18c996c902a7b7b8098 /nuttx/arch/arm
parent42a49c694196d1e6ace7bf509b1f24fbb3f8ae21 (diff)
downloadpx4-nuttx-03db221a3d9a6678cd8fef66ca6a35b988503b57.tar.gz
px4-nuttx-03db221a3d9a6678cd8fef66ca6a35b988503b57.tar.bz2
px4-nuttx-03db221a3d9a6678cd8fef66ca6a35b988503b57.zip
Fix some LPC17xx GPIO/button interrupt logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4246 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm')
-rwxr-xr-xnuttx/arch/arm/src/lpc17xx/lpc17_gpio.c17
-rwxr-xr-xnuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c12
-rwxr-xr-xnuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c4
-rwxr-xr-xnuttx/arch/arm/src/lpc17xx/lpc17_irq.c6
4 files changed, 25 insertions, 14 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c
index 8a894d31c..9dd594c31 100755
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c
@@ -2,7 +2,7 @@
* arch/arm/src/lpc17xx/lpc17_gpio.c
*
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * 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
@@ -278,7 +278,8 @@ static int lpc17_pullup(uint16_t cfgset, unsigned int port, unsigned int pin)
****************************************************************************/
#ifdef CONFIG_GPIO_IRQ
-static void lpc17_setintedge(unsigned int port, unsigned int pin, unsigned int value)
+static void lpc17_setintedge(unsigned int port, unsigned int pin,
+ unsigned int value)
{
uint64_t *intedge;
unsigned int shift;
@@ -415,7 +416,9 @@ static inline int lpc17_configinput(uint16_t cfgset, unsigned int port, unsigned
* Configure a GPIO interrupt pin based on bit-encoded description of the pin.
*
****************************************************************************/
-static inline int lpc17_configinterrupt(uint16_t cfgset, unsigned int port, unsigned int pin)
+
+static inline int lpc17_configinterrupt(uint16_t cfgset, unsigned int port,
+ unsigned int pin)
{
/* First, configure the port as a generic input so that we have a known
* starting point and consistent behavior during the re-configuration.
@@ -439,7 +442,9 @@ static inline int lpc17_configinterrupt(uint16_t cfgset, unsigned int port, unsi
* Configure a GPIO output pin based on bit-encoded description of the pin.
*
****************************************************************************/
-static inline int lpc17_configoutput(uint16_t cfgset, unsigned int port, unsigned int pin)
+
+static inline int lpc17_configoutput(uint16_t cfgset, unsigned int port,
+ unsigned int pin)
{
uint32_t fiobase;
uint32_t regval;
@@ -486,7 +491,9 @@ static inline int lpc17_configoutput(uint16_t cfgset, unsigned int port, unsigne
* of the pin.
*
****************************************************************************/
-static int lpc17_configalternate(uint16_t cfgset, unsigned int port, unsigned int pin, uint32_t alt)
+
+static int lpc17_configalternate(uint16_t cfgset, unsigned int port,
+ unsigned int pin, uint32_t alt)
{
/* First, configure the port as an input so that we have a known
* starting point and consistent behavior during the re-configuration.
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c
index 6fe777de1..dc4dac33a 100755
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c
@@ -1,8 +1,8 @@
/****************************************************************************
* arch/arm/src/lpc17xx/lpc17_gpiodbg.c
*
- * Copyright (C) 2010 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2010-2011 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
@@ -49,12 +49,16 @@
#include "lpc17_gpio.h"
#include "lpc17_internal.h"
-#ifdef CONFIG_DEBUG_GPIO
-
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_GPIO
+#endif
+
+#ifdef CONFIG_DEBUG_GPIO
+
/****************************************************************************
* Private Types
****************************************************************************/
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c
index cdc0e27b5..66988b0b9 100755
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c
@@ -2,7 +2,7 @@
* arch/arm/src/lpc17xx/lpc17_gpioint.c
*
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * 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
@@ -172,7 +172,7 @@ static int lpc17_irq2port(int irq)
/* Set 3: 14 interrupts p2.0-p2.13 */
- else if (irq >= LPC17_VALID_NIRQS2 && irq < (LPC17_VALID_FIRST2+LPC17_VALID_NIRQS2))
+ else if (irq >= LPC17_VALID_FIRST2 && irq < (LPC17_VALID_FIRST2+LPC17_VALID_NIRQS2))
{
return 2;
}
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c
index 577ec6747..1588142a2 100755
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c
@@ -3,7 +3,7 @@
* arch/arm/src/chip/lpc17_irq.c
*
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * 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
@@ -374,7 +374,7 @@ void up_disable_irq(int irq)
putreg32(regval, regaddr);
}
#ifdef CONFIG_GPIO_IRQ
- else
+ else if (irq >= LPC17_VALID_FIRST0L)
{
/* Maybe it is a (derived) GPIO IRQ */
@@ -407,7 +407,7 @@ void up_enable_irq(int irq)
putreg32(regval, regaddr);
}
#ifdef CONFIG_GPIO_IRQ
- else
+ else if (irq >= LPC17_VALID_FIRST0L)
{
/* Maybe it is a (derived) GPIO IRQ */