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
This commit is contained in:
patacongo
2011-12-31 23:09:33 +00:00
parent fadea52279
commit 8eee445400
4 changed files with 25 additions and 14 deletions
+12 -5
View File
@@ -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.
+8 -4
View File
@@ -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
****************************************************************************/
+2 -2
View File
@@ -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;
}
+3 -3
View File
@@ -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 */