board_button_irq: Button IRQ logic no longer returns the xcpt_t oldhandler. There value is useless and dangerous after the recent changes to interrupt argument passing.
This commit is contained in:
parent
4c82827ab1
commit
0f46d714a9
@ -174,7 +174,7 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (irqhandler)
|
||||
{
|
||||
ret = irq_attach(IRQ_SW4, irqhandler, NULL);
|
||||
ret = irq_attach(IRQ_SW4, irqhandler, arg);
|
||||
if (ret == OK)
|
||||
{
|
||||
handler = irqhandler;
|
||||
|
@ -121,7 +121,7 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
/* Configure the interrupt */
|
||||
|
||||
a1x_pioirq(xxx);
|
||||
(void)irq_attach(xxx, irqhandler, NULL);
|
||||
(void)irq_attach(xxx, irqhandler, arg);
|
||||
a1x_pioirqenable(xxx);
|
||||
leave_critical_section(flags);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/sam3u-ek/src/up_leds.c
|
||||
*
|
||||
* Copyright (C) 2010, 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010, 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -53,19 +54,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irqbutton1;
|
||||
static xcpt_t g_irqbutton2;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@ -79,10 +67,9 @@ static xcpt_t g_irqbutton2;
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, xcpt_t *store, void *arg)
|
||||
static int board_button_irqx(gpio_pinset_t pinset, int irq, xcpt_t irqhandler,
|
||||
void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the following
|
||||
@ -91,11 +78,6 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = *store;
|
||||
*store = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -115,10 +97,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -182,21 +161,19 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
if (id == BUTTON1)
|
||||
{
|
||||
return board_button_irqx(GPIO_BUTTON1, IRQ_BUTTON1,
|
||||
irqhandler, &g_irqbutton1, arg);
|
||||
return board_button_irqx(GPIO_BUTTON1, IRQ_BUTTON1, irqhandler, arg);
|
||||
}
|
||||
else if (id == BUTTON2)
|
||||
{
|
||||
return board_button_irqx(GPIO_BUTTON2, IRQ_BUTTON2,
|
||||
irqhandler, &g_irqbutton2, arg);
|
||||
return board_button_irqx(GPIO_BUTTON2, IRQ_BUTTON2, irqhandler, arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/sam4e-ek/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -53,21 +54,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irq_scrollup;
|
||||
static xcpt_t g_irq_scrolldown;
|
||||
static xcpt_t g_irq_waku;
|
||||
static xcpt_t g_irq_tamp;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@ -81,10 +67,9 @@ static xcpt_t g_irq_tamp;
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, xcpt_t *store, void *arg)
|
||||
static int board_button_irqx(gpio_pinset_t pinset, int irq, xcpt_t irqhandler,
|
||||
void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the following
|
||||
@ -93,11 +78,6 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = *store;
|
||||
*store = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -117,10 +97,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -188,28 +165,24 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case BUTTON_SCROLLUP:
|
||||
return board_button_irqx(GPIO_SCROLLUP, IRQ_SCROLLUP,
|
||||
irqhandler, &g_irq_scrollup, arg);
|
||||
return board_button_irqx(GPIO_SCROLLUP, IRQ_SCROLLUP, irqhandler, arg);
|
||||
|
||||
case BUTTON_SCROLLDOWN:
|
||||
return board_button_irqx(GPIO_SCROLLDWN, IRQ_SCROLLDWN,
|
||||
irqhandler, &g_irq_scrolldown, arg);
|
||||
return board_button_irqx(GPIO_SCROLLDWN, IRQ_SCROLLDWN, irqhandler, arg);
|
||||
|
||||
case BUTTON_WAKU:
|
||||
return board_button_irqx(GPIO_WAKU, IRQ_WAKU,
|
||||
irqhandler, &g_irq_waku, arg);
|
||||
return board_button_irqx(GPIO_WAKU, IRQ_WAKU, irqhandler, arg);
|
||||
|
||||
case BUTTON_TAMP:
|
||||
return board_button_irqx(GPIO_TAMP, IRQ_TAMP,
|
||||
irqhandler, &g_irq_tamp, arg);
|
||||
return board_button_irqx(GPIO_TAMP, IRQ_TAMP, irqhandler, arg);
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/sam4l-xplained/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2013-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -53,18 +53,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irqsw0;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@ -123,9 +111,9 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_SW0)
|
||||
{
|
||||
@ -137,11 +125,6 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = *g_irqsw0;
|
||||
*g_irqsw0 = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -149,7 +132,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_gpioirq(GPIO_SW0);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler, NULL);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler, arg);
|
||||
sam_gpioirqenable(IRQ_SW0);
|
||||
}
|
||||
else
|
||||
@ -161,11 +144,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/sam4s-xplained-pro/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Bob Doiron
|
||||
*
|
||||
@ -41,6 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -54,20 +55,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static xcpt_t g_irqsw0;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -122,9 +109,9 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_SW0)
|
||||
{
|
||||
@ -136,11 +123,6 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = g_irqsw0;
|
||||
g_irqsw0 = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -148,7 +130,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_gpioirq(GPIO_SW0);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler, NULL);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler, arg);
|
||||
sam_gpioirqenable(IRQ_SW0);
|
||||
}
|
||||
else
|
||||
@ -160,11 +142,12 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -53,22 +54,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irqbp2;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -123,9 +108,9 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_BP2)
|
||||
{
|
||||
@ -137,11 +122,6 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = *g_irqbp2;
|
||||
*g_irqbp2 = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -149,7 +129,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_gpioirq(GPIO_BP2);
|
||||
(void)irq_attach(IRQ_BP2, irqhandler, NULL);
|
||||
(void)irq_attach(IRQ_BP2, irqhandler, arg);
|
||||
sam_gpioirqenable(IRQ_BP2);
|
||||
}
|
||||
else
|
||||
@ -161,11 +141,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -64,22 +65,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAMA5_PIOB_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irquser1;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -132,9 +117,9 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAMA5_PIOB_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
@ -146,11 +131,6 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = g_irquser1;
|
||||
g_irquser1 = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -158,7 +138,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_pioirq(PIO_BTN_USER);
|
||||
(void)irq_attach(IRQ_BTN_USER, irqhandler, NULL);
|
||||
(void)irq_attach(IRQ_BTN_USER, irqhandler, arg);
|
||||
sam_pioirqenable(IRQ_BTN_USER);
|
||||
}
|
||||
else
|
||||
@ -170,11 +150,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/sama5d3-xplained/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -55,6 +55,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -68,22 +69,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAMA5_PIOE_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irquser1;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -136,9 +121,9 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAMA5_PIOE_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
@ -150,11 +135,6 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = g_irquser1;
|
||||
g_irquser1 = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -162,7 +142,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_pioirq(PIO_USER);
|
||||
(void)irq_attach(IRQ_USER1, irqhandler, NULL);
|
||||
(void)irq_attach(IRQ_USER1, irqhandler, arg);
|
||||
sam_pioirqenable(IRQ_USER1);
|
||||
}
|
||||
else
|
||||
@ -172,14 +152,12 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
sam_pioirqdisable(IRQ_USER1);
|
||||
(void)irq_detach(IRQ_USER1);
|
||||
}
|
||||
/* Configure the interrupt */
|
||||
|
||||
leave_critical_section(flags);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/sama5d3x-ek/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013, 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -55,6 +55,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -68,22 +69,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAMA5_PIOE_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irquser1;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -136,9 +121,9 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAMA5_PIOE_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_USER1)
|
||||
{
|
||||
@ -150,11 +135,6 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = g_irquser1;
|
||||
g_irquser1 = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -162,7 +142,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_pioirq(PIO_USER1);
|
||||
(void)irq_attach(IRQ_USER1, irqhandler, NULL);
|
||||
(void)irq_attach(IRQ_USER1, irqhandler, arg);
|
||||
sam_pioirqenable(IRQ_USER1);
|
||||
}
|
||||
else
|
||||
@ -174,11 +154,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/sama5d4-ek/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -51,6 +51,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -64,22 +65,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAMA5_PIOE_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irquser1;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -132,9 +117,9 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAMA5_PIOE_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
@ -146,11 +131,6 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = g_irquser1;
|
||||
g_irquser1 = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -158,7 +138,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_pioirq(PIO_BTN_USER);
|
||||
(void)irq_attach(IRQ_BTN_USER, irqhandler, NULL);
|
||||
(void)irq_attach(IRQ_BTN_USER, irqhandler, arg);
|
||||
sam_pioirqenable(IRQ_BTN_USER);
|
||||
}
|
||||
else
|
||||
@ -170,11 +150,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -53,22 +54,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irqsw0;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -123,9 +108,9 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_SW0)
|
||||
{
|
||||
@ -137,20 +122,15 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = *g_irqsw0;
|
||||
*g_irqsw0 = irqhandler;
|
||||
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_portirq(IRQ_SW0);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler, NULL);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler, arg);
|
||||
sam_portirqenable(IRQ_SW0);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
leave_critical_section(flags);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/samd21-xplained/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -53,22 +54,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irqsw0;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -123,9 +108,9 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_SW0)
|
||||
{
|
||||
@ -137,22 +122,17 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = *g_irqsw0;
|
||||
*g_irqsw0 = irqhandler;
|
||||
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_portirq(IRQ_SW0);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler, NULL);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler, arg);
|
||||
sam_portirqenable(IRQ_SW0);
|
||||
|
||||
leave_critical_section(flags);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/sam4e-ek/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -59,20 +60,11 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
|
||||
#define HAVE_IRQBUTTONS 1
|
||||
#ifndef CONFIG_SAMV7_GPIOA_IRQ
|
||||
# undef HAVE_IRQBUTTONS
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMV7_GPIOA_IRQ
|
||||
static xcpt_t g_irq_sw0;
|
||||
#endif
|
||||
# define HAVE_IRQBUTTONS 1
|
||||
# ifndef CONFIG_SAMV7_GPIOA_IRQ
|
||||
# undef HAVE_IRQBUTTONS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -88,10 +80,9 @@ static xcpt_t g_irq_sw0;
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_IRQBUTTONS
|
||||
static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, xcpt_t *store, void *arg)
|
||||
static int board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the following
|
||||
@ -100,11 +91,6 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = *store;
|
||||
*store = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -124,10 +110,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -187,17 +170,16 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
#ifdef HAVE_IRQBUTTONS
|
||||
if (id == BUTTON_SW0)
|
||||
{
|
||||
return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0, arg);
|
||||
return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -145,7 +145,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_portirq(IRQ_SW0);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler, NULL);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler, arg);
|
||||
sam_portirqenable(IRQ_SW0);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/sam4e-ek/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@ -64,18 +65,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
|
||||
#define HAVE_IRQBUTTONS 1
|
||||
#if !defined(CONFIG_SAMV7_GPIOA_IRQ) && !defined(CONFIG_SAMV7_GPIOB_IRQ)
|
||||
# undef HAVE_IRQBUTTONS
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMV7_GPIOA_IRQ
|
||||
static xcpt_t g_irq_sw0;
|
||||
#endif
|
||||
#ifdef CONFIG_SAMV7_GPIOB_IRQ
|
||||
static xcpt_t g_irq_sw1;
|
||||
#endif
|
||||
# define HAVE_IRQBUTTONS 1
|
||||
# if !defined(CONFIG_SAMV7_GPIOA_IRQ) && !defined(CONFIG_SAMV7_GPIOB_IRQ)
|
||||
# undef HAVE_IRQBUTTONS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -92,9 +85,8 @@ static xcpt_t g_irq_sw1;
|
||||
|
||||
#ifdef HAVE_IRQBUTTONS
|
||||
static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, xcpt_t *store, void *arg)
|
||||
xcpt_t irqhandler, void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the following
|
||||
@ -103,11 +95,6 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = *store;
|
||||
*store = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@ -127,10 +114,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -207,7 +191,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
#ifdef HAVE_IRQBUTTONS
|
||||
|
||||
@ -215,21 +199,21 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
#ifdef CONFIG_SAMV7_GPIOA_IRQ
|
||||
case BUTTON_SW0:
|
||||
return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0, arg);
|
||||
return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, arg);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMV7_GPIOB_IRQ
|
||||
case BUTTON_SW1:
|
||||
return board_button_irqx(GPIO_SW1, IRQ_SW1, irqhandler, &g_irq_sw1, arg);
|
||||
return board_button_irqx(GPIO_SW1, IRQ_SW1, irqhandler, arg);
|
||||
#endif
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
return NULL;
|
||||
return -ENOSYS;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
/* Attach the new interrupt handler and enable the interrupt */
|
||||
|
||||
ret = irq_attach(ZKITARM_KEY5_IRQ, irqhandler, NULL);
|
||||
ret = irq_attach(ZKITARM_KEY5_IRQ, irqhandler, arg);
|
||||
if (ret == OK)
|
||||
{
|
||||
up_enable_irq(ZKITARM_KEY5_IRQ);
|
||||
|
Loading…
Reference in New Issue
Block a user