SAM3/4S GPIO interrupt changes

This commit is contained in:
Gregory Nutt 2013-06-13 18:53:14 -06:00
parent f7edd7a31c
commit c5169b092a
2 changed files with 18 additions and 13 deletions

View File

@ -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:
*

View File

@ -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 */
}