[rtems commit] bsp/atsam: Move interrupt setup to PIO_Configure()

Sebastian Huber sebh at rtems.org
Fri Dec 16 10:29:23 UTC 2016


Module:    rtems
Branch:    master
Commit:    a5c56afa35ab82353cab9fb9ad70ee957c558a96
Changeset: http://git.rtems.org/rtems/commit/?id=a5c56afa35ab82353cab9fb9ad70ee957c558a96

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Dec 15 15:03:56 2016 +0100

bsp/atsam: Move interrupt setup to PIO_Configure()

---

 .../arm/atsam/libraries/libchip/source/pio.c       | 21 ++++++++++++++++++
 .../arm/atsam/libraries/libchip/source/pio_it.c    | 25 ----------------------
 2 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio.c b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio.c
index 1e4a127..e39825d 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio.c
@@ -205,6 +205,27 @@ static void PIO_SetInput(
 			pio->PIO_IFSCER = mask;
 	}
 
+	/* Configure additional interrupt mode registers */
+	if (attribute & PIO_IT_AIME) {
+		// enable additional interrupt mode
+		pio->PIO_AIMER  = mask;
+
+		// if bit field of selected pin is 1, set as Rising Edge/High level detection event
+		if (attribute & PIO_IT_RE_OR_HL)
+			pio->PIO_REHLSR = mask;
+		else
+			pio->PIO_FELLSR = mask;
+
+		/* if bit field of selected pin is 1, set as edge detection source */
+		if (attribute & PIO_IT_EDGE)
+			pio->PIO_ESR = mask;
+		else
+			pio->PIO_LSR = mask;
+	} else {
+		/* disable additional interrupt mode */
+		pio->PIO_AIMDR = mask;
+	}
+
 	/* Configure pin as input */
 	pio->PIO_ODR = mask;
 	pio->PIO_PER = mask;
diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio_it.c b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio_it.c
index 7176288..ad78a9b 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio_it.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio_it.c
@@ -257,14 +257,11 @@ RTEMS_SYSINIT_ITEM(PIO_SysInitializeInterrupts, RTEMS_SYSINIT_BSP_START,
 void PIO_ConfigureIt(const Pin *pPin, void (*handler)(const Pin *, void *arg),
     void *arg)
 {
-	Pio *pio;
 	InterruptSource *pSource;
 	rtems_interrupt_level level;
 
 	TRACE_DEBUG("PIO_ConfigureIt()\n\r");
 
-	pio = pPin->pio;
-
 	rtems_interrupt_disable(level);
 
 	if (_dwNumSources == MAX_INTERRUPT_SOURCES) {
@@ -280,26 +277,4 @@ void PIO_ConfigureIt(const Pin *pPin, void (*handler)(const Pin *, void *arg),
 
 	/* Define new source */
 	TRACE_DEBUG("PIO_ConfigureIt: Defining new source #%d.\n\r", _dwNumSources);
-
-	/* PIO3 with additional interrupt support
-	 * Configure additional interrupt mode registers */
-	if (pPin->attribute & PIO_IT_AIME) {
-		// enable additional interrupt mode
-		pio->PIO_AIMER  = pPin->mask;
-
-		// if bit field of selected pin is 1, set as Rising Edge/High level detection event
-		if (pPin->attribute & PIO_IT_RE_OR_HL)
-			pio->PIO_REHLSR    = pPin->mask;
-		else
-			pio->PIO_FELLSR     = pPin->mask;
-
-		/* if bit field of selected pin is 1, set as edge detection source */
-		if (pPin->attribute & PIO_IT_EDGE)
-			pio->PIO_ESR     = pPin->mask;
-		else
-			pio->PIO_LSR     = pPin->mask;
-	} else {
-		/* disable additional interrupt mode */
-		pio->PIO_AIMDR       = pPin->mask;
-	}
 }




More information about the vc mailing list