summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-06-13 18:53:14 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-06-13 18:53:14 -0600
commit619119787e7a5e1e04528f6bf4bf079fe4499ee7 (patch)
treeaf048106afd68c94926d8d90aee48bad75e9be6b
parentf89052fa018e2b4e3ae7aeea2f36aa3d08927956 (diff)
downloadnuttx-619119787e7a5e1e04528f6bf4bf079fe4499ee7.tar.gz
nuttx-619119787e7a5e1e04528f6bf4bf079fe4499ee7.tar.bz2
nuttx-619119787e7a5e1e04528f6bf4bf079fe4499ee7.zip
SAM3/4S GPIO interrupt changes
-rw-r--r--nuttx/arch/arm/src/sam34/sam3u_gpio.h25
-rw-r--r--nuttx/arch/arm/src/sam34/sam_gpioirq.c6
-rwxr-xr-xnuttx/configs/sam3u-ek/knsh/setenv.sh2
-rwxr-xr-xnuttx/configs/sam3u-ek/nsh/setenv.sh2
-rwxr-xr-xnuttx/configs/sam3u-ek/nx/setenv.sh2
-rwxr-xr-xnuttx/configs/sam3u-ek/ostest/setenv.sh2
-rw-r--r--nuttx/configs/sam3u-ek/src/sam3u-ek.h73
-rw-r--r--nuttx/configs/sam4s-xplained/src/sam4s-xplained.h2
8 files changed, 64 insertions, 50 deletions
diff --git a/nuttx/arch/arm/src/sam34/sam3u_gpio.h b/nuttx/arch/arm/src/sam34/sam3u_gpio.h
index 84f543056..74716bb3a 100644
--- a/nuttx/arch/arm/src/sam34/sam3u_gpio.h
+++ b/nuttx/arch/arm/src/sam34/sam3u_gpio.h
@@ -56,7 +56,7 @@
/* 16-bit Encoding:
*
- * MMCC CII. VPPB BBBB
+ * MMCC CIII VPPB BBBB
*/
/* Input/Output mode:
@@ -85,17 +85,22 @@
/* Additional interrupt modes:
*
- * .... .II. .... ....
+ * .... .III .... ....
*/
-#define GPIO_INT_SHIFT (9) /* Bits 9-10: GPIO interrupt bits */
-#define GPIO_INT_MASK (3 << GPIO_INT_SHIFT)
-# define GPIO_INT_LEVEL (1 << 10) /* Bit 10: Level detection interrupt */
-# define GPIO_INT_EDGE (0) /* (vs. Edge detection interrupt) */
-# define GPIO_INT_HIGHLEVEL (1 << 9) /* Bit 9: High level detection interrupt */
-# define GPIO_INT_LOWLEVEL (0) /* (vs. Low level detection interrupt) */
-# define GPIO_INT_RISING (1 << 9) /* Bit 9: Rising edge detection interrupt */
-# define GPIO_INT_FALLING (0) /* (vs. Falling edge detection interrupt) */
+#define GPIO_INT_SHIFT (8) /* Bits 8-10: GPIO interrupt bits */
+#define GPIO_INT_MASK (7 << GPIO_INT_SHIFT)
+# define _GIO_INT_AIM (1 << 10) /* Bit 10: Additional Interrupt modes */
+# define _GPIO_INT_LEVEL (1 << 9) /* Bit 9: Level detection interrupt */
+# define _GPIO_INT_EDGE (0) /* (vs. Edge detection interrupt) */
+# define _GPIO_INT_RH (1 << 8) /* Bit 9: Rising edge/High level detection interrupt */
+# define _GPIO_INT_FL (0) /* (vs. Falling edge/Low level detection interrupt) */
+
+# define GPIO_INT_HIGHLEVEL (_GIO_INT_AIM | _GPIO_INT_LEVEL | _GPIO_INT_RH)
+# define GPIO_INT_LOWLEVEL (_GIO_INT_AIM | _GPIO_INT_LEVEL | _GPIO_INT_FL)
+# define GPIO_INT_RISING (_GIO_INT_AIM | _GPIO_INT_EDGE | _GPIO_INT_RH)
+# define GPIO_INT_FALLING (_GIO_INT_AIM | _GPIO_INT_EDGE | _GPIO_INT_FL)
+# define GPIO_INT_BOTHEDGES (0)
/* If the pin is an GPIO output, then this identifies the initial output value:
*
diff --git a/nuttx/arch/arm/src/sam34/sam_gpioirq.c b/nuttx/arch/arm/src/sam34/sam_gpioirq.c
index b7c7ead27..11ea34aa6 100644
--- a/nuttx/arch/arm/src/sam34/sam_gpioirq.c
+++ b/nuttx/arch/arm/src/sam34/sam_gpioirq.c
@@ -280,7 +280,7 @@ void sam_gpioirq(uint16_t pinset)
/* Are any additional interrupt modes selected? */
- if ((pinset & GPIO_INT_MASK) != 0)
+ if ((pinset & _GIO_INT_AIM) != 0)
{
/* Yes.. Enable additional interrupt mode */
@@ -288,7 +288,7 @@ void sam_gpioirq(uint16_t pinset)
/* Level or edge detected interrupt? */
- if ((pinset & GPIO_INT_LEVEL) != 0)
+ if ((pinset & _GPIO_INT_LEVEL) != 0)
{
putreg32(pin, base + SAM_PIO_LSR_OFFSET); /* Level */
}
@@ -299,7 +299,7 @@ void sam_gpioirq(uint16_t pinset)
/* High level/rising edge or low level /falling edge? */
- if ((pinset & GPIO_INT_HIGHLEVEL) != 0)
+ if ((pinset & _GPIO_INT_RH) != 0)
{
putreg32(pin, base + SAM_PIO_REHLSR_OFFSET); /* High level/Rising edge */
}
diff --git a/nuttx/configs/sam3u-ek/knsh/setenv.sh b/nuttx/configs/sam3u-ek/knsh/setenv.sh
index 3e81f9ccb..9755bc285 100755
--- a/nuttx/configs/sam3u-ek/knsh/setenv.sh
+++ b/nuttx/configs/sam3u-ek/knsh/setenv.sh
@@ -55,7 +55,7 @@ fi
# This is the Cygwin path to the location where I installed the CodeSourcery
# toolchain under windows. You will also have to edit this if you install
# the CodeSourcery toolchain in any other location
-export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
# These are the Cygwin paths to the locations where I installed the Atollic
# toolchain under windows. You will also have to edit this if you install
diff --git a/nuttx/configs/sam3u-ek/nsh/setenv.sh b/nuttx/configs/sam3u-ek/nsh/setenv.sh
index e23957670..c867a5e55 100755
--- a/nuttx/configs/sam3u-ek/nsh/setenv.sh
+++ b/nuttx/configs/sam3u-ek/nsh/setenv.sh
@@ -55,7 +55,7 @@ fi
# This is the Cygwin path to the location where I installed the CodeSourcery
# toolchain under windows. You will also have to edit this if you install
# the CodeSourcery toolchain in any other location
-export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
# These are the Cygwin paths to the locations where I installed the Atollic
# toolchain under windows. You will also have to edit this if you install
diff --git a/nuttx/configs/sam3u-ek/nx/setenv.sh b/nuttx/configs/sam3u-ek/nx/setenv.sh
index d0a5dea3d..87a085b98 100755
--- a/nuttx/configs/sam3u-ek/nx/setenv.sh
+++ b/nuttx/configs/sam3u-ek/nx/setenv.sh
@@ -54,7 +54,7 @@ fi
# This is the Cygwin path to the location where I installed the CodeSourcery
# toolchain under windows. You will also have to edit this if you install
# the CodeSourcery toolchain in any other location
-export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
# These are the Cygwin paths to the locations where I installed the Atollic
# toolchain under windows. You will also have to edit this if you install
diff --git a/nuttx/configs/sam3u-ek/ostest/setenv.sh b/nuttx/configs/sam3u-ek/ostest/setenv.sh
index 195dccc5c..1c9e008e3 100755
--- a/nuttx/configs/sam3u-ek/ostest/setenv.sh
+++ b/nuttx/configs/sam3u-ek/ostest/setenv.sh
@@ -55,7 +55,7 @@ fi
# This is the Cygwin path to the location where I installed the CodeSourcery
# toolchain under windows. You will also have to edit this if you install
# the CodeSourcery toolchain in any other location
-export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
# These are the Cygwin paths to the locations where I installed the Atollic
# toolchain under windows. You will also have to edit this if you install
diff --git a/nuttx/configs/sam3u-ek/src/sam3u-ek.h b/nuttx/configs/sam3u-ek/src/sam3u-ek.h
index df53985cf..24d0d99e2 100644
--- a/nuttx/configs/sam3u-ek/src/sam3u-ek.h
+++ b/nuttx/configs/sam3u-ek/src/sam3u-ek.h
@@ -112,61 +112,70 @@
* 39 K Backlight ground N/A --- --- ---
*/
-#define GPIO_LCD_NCS2 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOC|GPIO_PIN16)
-#define GPIO_LCD_RS (GPIO_PERIPHB|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN8)
-#define GPIO_LCD_NWE (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN23)
-#define GPIO_LCD_NRD (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN19)
-
-#define GPIO_LCD_D0 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN9)
-#define GPIO_LCD_D1 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN10)
-#define GPIO_LCD_D2 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN11)
-#define GPIO_LCD_D3 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN12)
-#define GPIO_LCD_D4 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN13)
-#define GPIO_LCD_D5 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN14)
-#define GPIO_LCD_D6 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN15)
-#define GPIO_LCD_D7 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN16)
-#define GPIO_LCD_D8 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN25)
-#define GPIO_LCD_D9 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN26)
-#define GPIO_LCD_D10 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN27)
-#define GPIO_LCD_D11 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN28)
-#define GPIO_LCD_D12 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN29)
-#define GPIO_LCD_D13 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN30)
-#define GPIO_LCD_D14 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN31)
-#define GPIO_LCD_D15 (GPIO_PERIPHB|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN6)
+#define GPIO_LCD_NCS2 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOC | GPIO_PIN16)
+#define GPIO_LCD_RS (GPIO_PERIPHB | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN8)
+#define GPIO_LCD_NWE (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN23)
+#define GPIO_LCD_NRD (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN19)
+
+#define GPIO_LCD_D0 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN9)
+#define GPIO_LCD_D1 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN10)
+#define GPIO_LCD_D2 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN11)
+#define GPIO_LCD_D3 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN12)
+#define GPIO_LCD_D4 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN13)
+#define GPIO_LCD_D5 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN14)
+#define GPIO_LCD_D6 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN15)
+#define GPIO_LCD_D7 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN16)
+#define GPIO_LCD_D8 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN25)
+#define GPIO_LCD_D9 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN26)
+#define GPIO_LCD_D10 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN27)
+#define GPIO_LCD_D11 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN28)
+#define GPIO_LCD_D12 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN29)
+#define GPIO_LCD_D13 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN30)
+#define GPIO_LCD_D14 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN31)
+#define GPIO_LCD_D15 (GPIO_PERIPHB | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN6)
/* LCD Backlight pin definition. */
-#define GPIO_LCD_BKL (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_OUTPUT_CLEAR|GPIO_PORT_PIOC|GPIO_PIN19)
+#define GPIO_LCD_BKL (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
+ GPIO_PORT_PIOC | GPIO_PIN19)
/* Touchscreen controller (TSC)
*
+ * The IRQ is active low and pulled up.
+ *
* BUSY is high impedance when CS is high (not selected). When CS is
* is low, BUSY is active high. Since the pin is pulled up, it will appear
* busy if CS is not selected.
*/
-#define GPIO_TCS_IRQ (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN24)
-#define GPIO_TCS_BUSY (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN2)
+#define GPIO_TCS_IRQ (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_INT_BOTHEDGES | \
+ GPIO_PORT_PIOA | GPIO_PIN24)
+#define GPIO_TCS_BUSY (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_PORT_PIOA | GPIO_PIN2)
#define SAM_TCS_IRQ SAM_IRQ_PA24
/* LEDs */
-#define GPIO_LED0 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_CLEAR|GPIO_PIN0)
-#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_SET|GPIO_PIN1)
-#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_SET|GPIO_PIN2)
+#define GPIO_LED0 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_PORT_PIOB | \
+ GPIO_OUTPUT_CLEAR | GPIO_PIN0)
+#define GPIO_LED1 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_PORT_PIOB | \
+ GPIO_OUTPUT_SET | GPIO_PIN1)
+#define GPIO_LED2 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_PORT_PIOB | \
+ GPIO_OUTPUT_SET | GPIO_PIN2)
/* BUTTONS */
-#define GPIO_BUTTON1 (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_CFG_DEGLITCH|GPIO_PORT_PIOA|GPIO_PIN18)
-#define GPIO_BUTTON2 (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_CFG_DEGLITCH|GPIO_PORT_PIOA|GPIO_PIN19)
+#define GPIO_BUTTON1 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | GPIO_INT_BOTHEDGES | \
+ GPIO_PORT_PIOA | GPIO_PIN18)
+#define GPIO_BUTTON2 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | GPIO_INT_BOTHEDGES | \
+ GPIO_PORT_PIOA | GPIO_PIN19)
#define IRQ_BUTTON1 SAM_IRQ_PA18
#define IRQ_BUTTON2 SAM_IRQ_PA19
/* SD Card Detect */
-#define GPIO_MCI_CD (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN25)
+#define GPIO_MCI_CD (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_PORT_PIOA | GPIO_PIN25)
/* SPI Chip Selects */
@@ -179,8 +188,8 @@
* it low throughout the SPI transfer.
*/
-#define GPIO_TSC_NPCS2 (GPIO_OUTPUT|GPIO_CFG_PULLUP|GPIO_OUTPUT_SET|\
- GPIO_PORT_PIOC|GPIO_PIN14)
+#define GPIO_TSC_NPCS2 (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
+ GPIO_PORT_PIOC | GPIO_PIN14)
/************************************************************************************
* Public Types
diff --git a/nuttx/configs/sam4s-xplained/src/sam4s-xplained.h b/nuttx/configs/sam4s-xplained/src/sam4s-xplained.h
index f9ea61858..1d6877d33 100644
--- a/nuttx/configs/sam4s-xplained/src/sam4s-xplained.h
+++ b/nuttx/configs/sam4s-xplained/src/sam4s-xplained.h
@@ -102,7 +102,7 @@
*/
#define GPIO_BP2 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
- GPIO_PORT_PIOA | GPIO_PIN5)
+ GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN5)
#define IRQ_BP2 SAM_IRQ_PA5
/************************************************************************************