diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-12-15 15:03:56 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-12-16 09:04:58 +0100 |
commit | a5c56afa35ab82353cab9fb9ad70ee957c558a96 (patch) | |
tree | 3172dbac0fef0089f019777ed0738fa684ff89a6 | |
parent | bsp/atsam: System initialization for PIO IRQs (diff) | |
download | rtems-a5c56afa35ab82353cab9fb9ad70ee957c558a96.tar.bz2 |
bsp/atsam: Move interrupt setup to PIO_Configure()
-rw-r--r-- | c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio.c | 21 | ||||
-rw-r--r-- | c/src/lib/libbsp/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; - } } |