From a5c56afa35ab82353cab9fb9ad70ee957c558a96 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 15 Dec 2016 15:03:56 +0100 Subject: 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 1e4a1277e2..e39825dfa5 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 7176288992..ad78a9b0c1 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; - } } -- cgit v1.2.3