summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/sam34/sam_gpioirq.c
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-07-02 13:52:09 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-07-02 13:52:09 -0600
commit839fa173a58af540fe9b8232ded8559661d3826c (patch)
treebe54613e8a52887b1ca52b81032edf5e35f4e61f /nuttx/arch/arm/src/sam34/sam_gpioirq.c
parentcae1325e2b7a87ca6fb94b96ef01d524aebb3e0f (diff)
downloadpx4-nuttx-839fa173a58af540fe9b8232ded8559661d3826c.tar.gz
px4-nuttx-839fa173a58af540fe9b8232ded8559661d3826c.tar.bz2
px4-nuttx-839fa173a58af540fe9b8232ded8559661d3826c.zip
Several fixes to get a clean compile of the Arduino touch screen
Diffstat (limited to 'nuttx/arch/arm/src/sam34/sam_gpioirq.c')
-rw-r--r--nuttx/arch/arm/src/sam34/sam_gpioirq.c83
1 files changed, 79 insertions, 4 deletions
diff --git a/nuttx/arch/arm/src/sam34/sam_gpioirq.c b/nuttx/arch/arm/src/sam34/sam_gpioirq.c
index 11ea34aa6..854644bfb 100644
--- a/nuttx/arch/arm/src/sam34/sam_gpioirq.c
+++ b/nuttx/arch/arm/src/sam34/sam_gpioirq.c
@@ -84,7 +84,7 @@
*
****************************************************************************/
-static inline uint32_t sam_gpiobase(uint16_t pinset)
+static inline uint32_t sam_gpiobase(gpio_pinset_t pinset)
{
int port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
return SAM_PION_BASE(port >> GPIO_PORT_SHIFT);
@@ -98,7 +98,7 @@ static inline uint32_t sam_gpiobase(uint16_t pinset)
*
****************************************************************************/
-static inline int sam_gpiopin(uint16_t pinset)
+static inline int sam_gpiopin(gpio_pinset_t pinset)
{
return 1 << ((pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT);
}
@@ -195,6 +195,27 @@ static int up_gpiocinterrupt(int irq, void *context)
}
#endif
+#ifdef CONFIG_GPIOD_IRQ
+static int up_gpiodinterrupt(int irq, void *context)
+{
+ return up_gpiointerrupt(SAM_PIOD_BASE, SAM_IRQ_PD0, context);
+}
+#endif
+
+#ifdef CONFIG_GPIOE_IRQ
+static int up_gpioeinterrupt(int irq, void *context)
+{
+ return up_gpiointerrupt(SAM_PIOE_BASE, SAM_IRQ_PE0, context);
+}
+#endif
+
+#ifdef CONFIG_GPIOF_IRQ
+static int up_gpiofinterrupt(int irq, void *context)
+{
+ return up_gpiointerrupt(SAM_PIOF_BASE, SAM_IRQ_PF0, context);
+}
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -260,9 +281,63 @@ void sam_gpioirqinitialize(void)
/* Attach and enable the GPIOC IRQ */
- (void)irq_attach(SAM_IRQ_PIOC, up_gpioainterrupt);
+ (void)irq_attach(SAM_IRQ_PIOC, up_gpiocinterrupt);
up_enable_irq(SAM_IRQ_PIOC);
#endif
+
+ /* Configure GPIOD interrupts */
+
+#ifdef CONFIG_GPIOD_IRQ
+ /* Enable GPIOD clocking */
+
+ sam_piod_enableclk();
+
+ /* Clear and disable all GPIOD interrupts */
+
+ (void)getreg32(SAM_PIOD_ISR);
+ putreg32(0xffffffff, SAM_PIOD_IDR);
+
+ /* Attach and enable the GPIOC IRQ */
+
+ (void)irq_attach(SAM_IRQ_PIOD, up_gpiodinterrupt);
+ up_enable_irq(SAM_IRQ_PIOD);
+#endif
+
+ /* Configure GPIOE interrupts */
+
+#ifdef CONFIG_GPIOE_IRQ
+ /* Enable GPIOE clocking */
+
+ sam_pioe_enableclk();
+
+ /* Clear and disable all GPIOE interrupts */
+
+ (void)getreg32(SAM_PIOE_ISR);
+ putreg32(0xffffffff, SAM_PIOE_IDR);
+
+ /* Attach and enable the GPIOE IRQ */
+
+ (void)irq_attach(SAM_IRQ_PIOE, up_gpioeinterrupt);
+ up_enable_irq(SAM_IRQ_PIOE);
+#endif
+
+ /* Configure GPIOF interrupts */
+
+#ifdef CONFIG_GPIOF_IRQ
+ /* Enable GPIOF clocking */
+
+ sam_piof_enableclk();
+
+ /* Clear and disable all GPIOF interrupts */
+
+ (void)getreg32(SAM_PIOF_ISR);
+ putreg32(0xffffffff, SAM_PIOF_IDR);
+
+ /* Attach and enable the GPIOF IRQ */
+
+ (void)irq_attach(SAM_IRQ_PIOF, up_gpiofinterrupt);
+ up_enable_irq(SAM_IRQ_PIOF);
+#endif
}
/************************************************************************************
@@ -273,7 +348,7 @@ void sam_gpioirqinitialize(void)
*
************************************************************************************/
-void sam_gpioirq(uint16_t pinset)
+void sam_gpioirq(gpio_pinset_t pinset)
{
uint32_t base = sam_gpiobase(pinset);
int pin = sam_gpiopin(pinset);