diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-07-07 15:54:37 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-07-07 15:54:37 -0600 |
commit | 6c6c41ff791f5ab36108c84eb10aca162e48cc0e (patch) | |
tree | 7995212d68c1e06d3272138af169ad5866dba023 /nuttx/configs/sama5d3x-ek/src | |
parent | 3b9fcb97ed990bcdfc36df0414828ce4e0ce8100 (diff) | |
download | px4-nuttx-6c6c41ff791f5ab36108c84eb10aca162e48cc0e.tar.gz px4-nuttx-6c6c41ff791f5ab36108c84eb10aca162e48cc0e.tar.bz2 px4-nuttx-6c6c41ff791f5ab36108c84eb10aca162e48cc0e.zip |
Fix some cloned errors in SAM GPIO interrupt setup
Diffstat (limited to 'nuttx/configs/sama5d3x-ek/src')
-rw-r--r-- | nuttx/configs/sama5d3x-ek/src/sam_buttons.c | 37 | ||||
-rw-r--r-- | nuttx/configs/sama5d3x-ek/src/sam_ethernet.c | 5 | ||||
-rw-r--r-- | nuttx/configs/sama5d3x-ek/src/sam_usb.c | 4 |
3 files changed, 31 insertions, 15 deletions
diff --git a/nuttx/configs/sama5d3x-ek/src/sam_buttons.c b/nuttx/configs/sama5d3x-ek/src/sam_buttons.c index 9d8afcfba..a76696847 100644 --- a/nuttx/configs/sama5d3x-ek/src/sam_buttons.c +++ b/nuttx/configs/sama5d3x-ek/src/sam_buttons.c @@ -91,10 +91,10 @@ static xcpt_t g_irquser1; * Name: board_button_initialize * * Description: - * board_button_initialize() must be called to initialize button resources. After - * that, board_buttons() may be called to collect the current state of all - * buttons or board_button_irq() may be called to register button interrupt - * handlers. + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state + * of all buttons or board_button_irq() may be called to register button + * interrupt handlers. * ****************************************************************************/ @@ -107,10 +107,10 @@ void board_button_initialize(void) * Name: board_buttons * * Description: - * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON* definitions - * above for the meaning of each bit in the returned value. + * After board_button_initialize() has been called, board_buttons() may be + * called to collect the state of all buttons. board_buttons() returns an + * 8-bit bit set with each bit associated with a button. See the BUTTON* + * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ @@ -155,11 +155,24 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) oldhandler = g_irquser1; g_irquser1 = irqhandler; - /* Configure the interrupt */ + /* Are we attaching or detaching? */ + + if (irqhandler != NULL) + { + /* Configure the interrupt */ + + sam_pioirq(PIO_USER1); + (void)irq_attach(IRQ_USER1, irqhandler); + sam_pioirqenable(IRQ_USER1); + } + else + { + /* Disable and detach the interrupt */ + + sam_pioirqdisable(IRQ_USER1); + (void)irq_detach(IRQ_USER1); + } - sam_pioirq(IRQ_USER1); - (void)irq_attach(IRQ_USER1, irqhandler); - sam_pioirqenable(IRQ_USER1); irqrestore(flags); } diff --git a/nuttx/configs/sama5d3x-ek/src/sam_ethernet.c b/nuttx/configs/sama5d3x-ek/src/sam_ethernet.c index 4e5927d5d..813ef3b28 100644 --- a/nuttx/configs/sama5d3x-ek/src/sam_ethernet.c +++ b/nuttx/configs/sama5d3x-ek/src/sam_ethernet.c @@ -136,12 +136,14 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler) irqstate_t flags; xcpt_t *handler; xcpt_t oldhandler; + pio_pinset_t pinset; int irq; #ifdef CONFIG_SAMA5_EMACA if (intf == EMAC_INTF) { handler = &g_emac_handler; + pinset = PIO_INT_ETH1; irq = IRQ_INT_ETH1; } else @@ -150,6 +152,7 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler) if (intf == GMAC_INTF) { handler = &g_gmac_handler; + pinset = PIO_INT_ETH0; irq = IRQ_INT_ETH0; } else @@ -172,7 +175,7 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler) /* Configure the interrupt */ - sam_pioirq(irq); + sam_pioirq(pinset); (void)irq_attach(irq, irqhandler); sam_pioirqenable(irq); diff --git a/nuttx/configs/sama5d3x-ek/src/sam_usb.c b/nuttx/configs/sama5d3x-ek/src/sam_usb.c index 556ee2cf1..1c7a86e85 100644 --- a/nuttx/configs/sama5d3x-ek/src/sam_usb.c +++ b/nuttx/configs/sama5d3x-ek/src/sam_usb.c @@ -463,7 +463,7 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) * REVISIT: Since this is a common signal, we will need to come up with some way * to inform both EHCI and OHCI drivers when this error occurs. * - * Input paramter: + * Input Parameter: * handler - New overcurrent interrupt handler * * Returned value: @@ -493,7 +493,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler) /* Configure the interrupt */ - sam_pioirq(IRQ_USBBC_VBUS_OVERCURRENT); + sam_pioirq(PIO_USBBC_VBUS_OVERCURRENT); (void)irq_attach(IRQ_USBBC_VBUS_OVERCURRENT, handler); sam_pioirqenable(IRQ_USBBC_VBUS_OVERCURRENT); |