mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
Add argument to STM32 EXTI interrupt handlers.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/stm32/stm32_exti.h
|
||||
*
|
||||
* Copyright (C) 2009, 2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009, 2012, 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -77,6 +77,7 @@ extern "C"
|
||||
* - rising/falling edge: enables
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This value may,
|
||||
@@ -86,7 +87,7 @@ extern "C"
|
||||
************************************************************************************/
|
||||
|
||||
xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
bool event, xcpt_t func);
|
||||
bool event, xcpt_t func, void *arg);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_exti_alarm
|
||||
@@ -98,6 +99,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
* - rising/falling edge: enables interrupt on rising/falling edges
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This value may,
|
||||
@@ -107,7 +109,8 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func);
|
||||
xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func,
|
||||
void *arg);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
|
||||
@@ -59,7 +59,8 @@
|
||||
|
||||
/* Interrupt handlers attached to the ALARM EXTI */
|
||||
|
||||
static xcpt_t stm32_exti_callback;
|
||||
static xcpt_t g_alarm_callback;
|
||||
static void *g_callback_arg;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@@ -83,9 +84,9 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callback)
|
||||
if (g_alarm_callback)
|
||||
{
|
||||
ret = stm32_exti_callback(irq, context);
|
||||
ret = g_alarm_callback(irq, context, g_callback_arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -105,6 +106,7 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg)
|
||||
* - rising/falling edge: enables interrupt on rising/falling edget
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -114,14 +116,15 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg)
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
|
||||
xcpt_t func)
|
||||
xcpt_t func, void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
|
||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||
|
||||
oldhandler = stm32_exti_callback;
|
||||
stm32_exti_callback = func;
|
||||
oldhandler = g_alarm_callback;
|
||||
g_alarm_callback = func;
|
||||
g_callback_arg = arg;
|
||||
|
||||
/* Install external interrupt handlers (if not already attached) */
|
||||
|
||||
|
||||
@@ -55,13 +55,23 @@
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32_exti.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct gpio_callback_s
|
||||
{
|
||||
xcptr_t callback;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Interrupt handlers attached to each EXTI */
|
||||
|
||||
static xcpt_t stm32_exti_callbacks[16];
|
||||
static struct gpio_callback_s g_gpio_callbacks[16];
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@@ -81,9 +91,12 @@ static int stm32_exti0_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[0])
|
||||
if (g_gpio_callbacks[0].callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callbacks[0](irq, context, arg);
|
||||
xcpt_t callback = g_gpio_callbacks[0].callback;
|
||||
void *cbarg = g_gpio_callbacks[0].arg;
|
||||
|
||||
ret = callback(irq, context, cbarg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -99,9 +112,12 @@ static int stm32_exti1_isr(int irq, void *context, void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[1])
|
||||
if (g_gpio_callbacks[1].callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callbacks[1](irq, context, arg);
|
||||
xcpt_t callback = g_gpio_callbacks[1].callback;
|
||||
void *cbarg = g_gpio_callbacks[1].arg;
|
||||
|
||||
ret = callback(irq, context, cbarg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -117,9 +133,12 @@ static int stm32_exti2_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[2])
|
||||
if (g_gpio_callbacks[2].callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callbacks[2](irq, context, arg);
|
||||
xcpt_t callback = g_gpio_callbacks[2].callback;
|
||||
void *cbarg = g_gpio_callbacks[2].arg;
|
||||
|
||||
ret = callback(irq, context, cbarg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -135,9 +154,12 @@ static int stm32_exti3_isr(int irq, void *context, void * arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[3])
|
||||
if (g_gpio_callbacks[3].callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callbacks[3](irq, context, arg);
|
||||
xcpt_t callback = g_gpio_callbacks[3].callback;
|
||||
void *cbarg = g_gpio_callbacks[3].arg;
|
||||
|
||||
ret = callback(irq, context, cbarg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -153,9 +175,12 @@ static int stm32_exti4_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[4])
|
||||
if (g_gpio_callbacks[4].callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callbacks[4](irq, context, arg);
|
||||
xcpt_t callback = g_gpio_callbacks[4].callback;
|
||||
void *cbarg = g_gpio_callbacks[4].arg;
|
||||
|
||||
ret = callback(irq, context, cbarg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -186,10 +211,14 @@ static int stm32_exti_multiisr(int irq, void *context, FAR void *arg, int first,
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[pin])
|
||||
if (g_gpio_callbacks[pin].callback != NULL)
|
||||
{
|
||||
int tmp = stm32_exti_callbacks[pin](irq, context, arg);
|
||||
if (tmp != OK)
|
||||
xcpt_t callback = g_gpio_callbacks[pin].callback;
|
||||
void *cbarg = g_gpio_callbacks[pin].arg;
|
||||
int tmp;
|
||||
|
||||
tmp = callback(irq, context, cbarg);
|
||||
if (tmp < 0)
|
||||
{
|
||||
ret = tmp;
|
||||
}
|
||||
@@ -226,6 +255,7 @@ static int stm32_exti1510_isr(int irq, void *context, void *arg)
|
||||
* - fallingedge: Enables interrupt on falling edges
|
||||
* - event: Generate event when set
|
||||
* - func: When non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -235,15 +265,15 @@ static int stm32_exti1510_isr(int irq, void *context, void *arg)
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
bool event, xcpt_t func)
|
||||
bool event, xcpt_t func, void *arg)
|
||||
{
|
||||
FAR struct gpio_callback_s *shared_cbs;
|
||||
uint32_t pin = pinset & GPIO_PIN_MASK;
|
||||
uint32_t exti = STM32_EXTI_BIT(pin);
|
||||
int irq;
|
||||
xcpt_t handler;
|
||||
xcpt_t oldhandler = NULL;
|
||||
int nshared;
|
||||
xcpt_t *shared_cbs;
|
||||
int i;
|
||||
|
||||
/* Select the interrupt handler for this EXTI pin */
|
||||
@@ -252,7 +282,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
{
|
||||
irq = pin + STM32_IRQ_EXTI0;
|
||||
nshared = 1;
|
||||
shared_cbs = &stm32_exti_callbacks[pin];
|
||||
shared_cbs = &g_gpio_callbacks[pin];
|
||||
switch (pin)
|
||||
{
|
||||
case 0:
|
||||
@@ -280,21 +310,22 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
{
|
||||
irq = STM32_IRQ_EXTI95;
|
||||
handler = stm32_exti95_isr;
|
||||
shared_cbs = &stm32_exti_callbacks[5];
|
||||
shared_cbs = &g_gpio_callbacks[5];
|
||||
nshared = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
irq = STM32_IRQ_EXTI1510;
|
||||
handler = stm32_exti1510_isr;
|
||||
shared_cbs = &stm32_exti_callbacks[10];
|
||||
shared_cbs = &g_gpio_callbacks[10];
|
||||
nshared = 6;
|
||||
}
|
||||
|
||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||
|
||||
oldhandler = stm32_exti_callbacks[pin];
|
||||
stm32_exti_callbacks[pin] = func;
|
||||
oldhandler = g_gpio_callbacks[pin].callback;
|
||||
g_gpio_callbacks[pin].callback = func;
|
||||
g_gpio_callbacks[pin].arg = arg;
|
||||
|
||||
/* Install external interrupt handlers */
|
||||
|
||||
@@ -311,7 +342,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
|
||||
for (i = 0; i < nshared; i++)
|
||||
{
|
||||
if (shared_cbs[i] != NULL)
|
||||
if (shared_cbs[i].handler != NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -65,11 +65,8 @@
|
||||
|
||||
/* Interrupt handlers attached to the PVD EXTI */
|
||||
|
||||
static xcpt_t stm32_exti_pvd_callback;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
static xcpt_t g_pvd_callback;
|
||||
static void *g_callback_arg;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@@ -93,9 +90,9 @@ static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_pvd_callback)
|
||||
if (g_pvd_callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_pvd_callback(irq, context, arg);
|
||||
ret = g_pvd_callback(irq, context, g_callback_arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -115,6 +112,7 @@ static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg)
|
||||
* - rising/falling edge: enables interrupt on rising/falling edge
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -130,8 +128,9 @@ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event,
|
||||
|
||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||
|
||||
oldhandler = stm32_exti_pvd_callback;
|
||||
stm32_exti_pvd_callback = func;
|
||||
oldhandler = g_pvd_callback;
|
||||
g_pvd_callback = func;
|
||||
g_callback_arg = arg;
|
||||
|
||||
/* Install external interrupt handlers (if not already attached) */
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
* - rising/falling edge: enables interrupt on rising/falling edge
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -66,6 +67,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event,
|
||||
xcpt_t func);
|
||||
xcpt_t func, void *arg);
|
||||
|
||||
#endif /* STM32_EXTI_PWR_H_ */
|
||||
|
||||
@@ -78,6 +78,7 @@ extern "C"
|
||||
* - fallingedge: Enables interrupt on falling edges
|
||||
* - event: Generate event when set
|
||||
* - func: When non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -87,7 +88,7 @@ extern "C"
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
bool event, xcpt_t func);
|
||||
bool event, xcpt_t func, void *arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_exti_alarm
|
||||
@@ -100,6 +101,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
* - fallingedge: Enables interrupt on falling edges
|
||||
* - event: Generate event when set
|
||||
* - func: When non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -109,7 +111,8 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func);
|
||||
xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
|
||||
xcpt_t func, void *arg);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
|
||||
@@ -67,7 +67,8 @@
|
||||
|
||||
/* Interrupt handlers attached to the ALARM EXTI */
|
||||
|
||||
static xcpt_t stm32_exti_callback;
|
||||
static xcpt_t g_alarm_callback;
|
||||
static void *g_callback_arg;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
@@ -95,9 +96,9 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callback)
|
||||
if (g_alarm_callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callback(irq, context);
|
||||
ret = g_alarm_callback(irq, context, g_callback_arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -117,6 +118,7 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg)
|
||||
* - rising/falling edge: enables interrupt on rising/falling edget
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -126,14 +128,15 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg)
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
|
||||
xcpt_t func)
|
||||
xcpt_t func, void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
|
||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||
|
||||
oldhandler = stm32_exti_callback;
|
||||
stm32_exti_callback = func;
|
||||
oldhandler = g_alarm_callback;
|
||||
g_alarm_callback = func;
|
||||
g_callback_arg = arg;
|
||||
|
||||
/* Install external interrupt handlers (if not already attached) */
|
||||
|
||||
|
||||
@@ -68,13 +68,23 @@
|
||||
#if defined(CONFIG_STM32F7_STM32F74XX) || defined(CONFIG_STM32F7_STM32F75XX) \
|
||||
|| defined(CONFIG_STM32F7_STM32F76XX) || defined(CONFIG_STM32F7_STM32F77XX)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct gpio_callback_s
|
||||
{
|
||||
xcptr_t callback;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Interrupt handlers attached to each EXTI */
|
||||
|
||||
static xcpt_t stm32_exti_callbacks[16];
|
||||
static struct gpio_callback_s g_gpio_callbacks[16];
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@@ -94,9 +104,12 @@ static int stm32_exti0_isr(int irq, void *context)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[0])
|
||||
if (g_gpio_callbacks[0].callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callbacks[0](irq, context);
|
||||
xcptr_t callback = g_gpio_callbacks[0].callback;
|
||||
void *arg = g_gpio_callbacks[0].arg;
|
||||
|
||||
ret = callback(irq, context, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -112,9 +125,12 @@ static int stm32_exti1_isr(int irq, void *context)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[1])
|
||||
if (g_gpio_callbacks[1].callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callbacks[1](irq, context);
|
||||
xcptr_t callback = g_gpio_callbacks[1].callback;
|
||||
void *arg = g_gpio_callbacks[1].arg;
|
||||
|
||||
ret = callback(irq, context, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -130,9 +146,12 @@ static int stm32_exti2_isr(int irq, void *context)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[2])
|
||||
if (g_gpio_callbacks[2].callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callbacks[2](irq, context);
|
||||
xcptr_t callback = g_gpio_callbacks[2].callback;
|
||||
void *arg = g_gpio_callbacks[2].arg;
|
||||
|
||||
ret = callback(irq, context, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -148,9 +167,12 @@ static int stm32_exti3_isr(int irq, void *context)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[3])
|
||||
if (g_gpio_callbacks[3].callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callbacks[3](irq, context);
|
||||
xcptr_t callback = g_gpio_callbacks[3].callback;
|
||||
void *arg = g_gpio_callbacks[3].arg;
|
||||
|
||||
ret = callback(irq, context, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -166,9 +188,12 @@ static int stm32_exti4_isr(int irq, void *context)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[4])
|
||||
if (g_gpio_callbacks[4].callback != NULL)
|
||||
{
|
||||
ret = stm32_exti_callbacks[4](irq, context);
|
||||
xcptr_t callback = g_gpio_callbacks[4].callback;
|
||||
void *arg = g_gpio_callbacks[4].arg;
|
||||
|
||||
ret = callback(irq, context, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -199,10 +224,14 @@ static int stm32_exti_multiisr(int irq, void *context, int first, int last)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_callbacks[pin])
|
||||
if (g_gpio_callbacks[pin].callback != NULL)
|
||||
{
|
||||
int tmp = stm32_exti_callbacks[pin](irq, context);
|
||||
if (tmp != OK)
|
||||
xcptr_t callback = g_gpio_callbacks[pin].callback;
|
||||
void *arg = g_gpio_callbacks[pin].arg;
|
||||
int tmp;
|
||||
|
||||
tmp = callback(irq, context, arg);
|
||||
if (tmp < 0)
|
||||
{
|
||||
ret = tmp;
|
||||
}
|
||||
@@ -250,13 +279,13 @@ static int stm32_exti1510_isr(int irq, void *context)
|
||||
xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
bool event, xcpt_t func)
|
||||
{
|
||||
struct gpio_callback_s *shared_cbs;
|
||||
uint32_t pin = pinset & GPIO_PIN_MASK;
|
||||
uint32_t exti = STM32_EXTI_BIT(pin);
|
||||
int irq;
|
||||
xcpt_t handler;
|
||||
xcpt_t oldhandler = NULL;
|
||||
int nshared;
|
||||
xcpt_t *shared_cbs;
|
||||
int i;
|
||||
|
||||
/* Select the interrupt handler for this EXTI pin */
|
||||
@@ -265,7 +294,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
{
|
||||
irq = pin + STM32_IRQ_EXTI0;
|
||||
nshared = 1;
|
||||
shared_cbs = &stm32_exti_callbacks[pin];
|
||||
shared_cbs = &g_gpio_callbacks[pin];
|
||||
switch (pin)
|
||||
{
|
||||
case 0:
|
||||
@@ -293,21 +322,22 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
{
|
||||
irq = STM32_IRQ_EXTI95;
|
||||
handler = stm32_exti95_isr;
|
||||
shared_cbs = &stm32_exti_callbacks[5];
|
||||
shared_cbs = &g_gpio_callbacks[5];
|
||||
nshared = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
irq = STM32_IRQ_EXTI1510;
|
||||
handler = stm32_exti1510_isr;
|
||||
shared_cbs = &stm32_exti_callbacks[10];
|
||||
shared_cbs = &g_gpio_callbacks[10];
|
||||
nshared = 6;
|
||||
}
|
||||
|
||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||
|
||||
oldhandler = stm32_exti_callbacks[pin];
|
||||
stm32_exti_callbacks[pin] = func;
|
||||
oldhandler = g_gpio_callbacks[pin].callback;
|
||||
g_gpio_callbacks[pin].callback = func;
|
||||
g_gpio_callbacks[pin].arg = arg;
|
||||
|
||||
/* Install external interrupt handlers */
|
||||
|
||||
@@ -324,7 +354,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
|
||||
for (i = 0; i < nshared; i++)
|
||||
{
|
||||
if (shared_cbs[i] != NULL)
|
||||
if (shared_cbs[i].handler != NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,8 @@
|
||||
|
||||
/* Interrupt handlers attached to the PVD EXTI */
|
||||
|
||||
static xcpt_t stm32_exti_pvd_callback;
|
||||
static xcpt_t g_pvd_callback;
|
||||
static void *g_callback_arg;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
@@ -98,9 +99,9 @@ static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32_exti_pvd_callback)
|
||||
if (g_pvd_callback)
|
||||
{
|
||||
ret = stm32_exti_pvd_callback(irq, context);
|
||||
ret = g_pvd_callback(irq, context, g_callback_arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -135,8 +136,9 @@ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event,
|
||||
|
||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||
|
||||
oldhandler = stm32_exti_pvd_callback;
|
||||
stm32_exti_pvd_callback = func;
|
||||
oldhandler = g_pvd_callback;
|
||||
g_pvd_callback = func;
|
||||
g_callback_arg = arg;
|
||||
|
||||
/* Install external interrupt handlers (if not already attached) */
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
* - rising/falling edge: enables interrupt on rising/falling edge
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -67,6 +68,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event,
|
||||
xcpt_t func);
|
||||
xcpt_t func, void *arg);
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32F7_STM32_EXTI_PWR_H */
|
||||
|
||||
@@ -77,6 +77,7 @@ extern "C"
|
||||
* - rising/falling edge: enables
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This value may,
|
||||
@@ -86,9 +87,9 @@ extern "C"
|
||||
************************************************************************************/
|
||||
|
||||
xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
bool event, xcpt_t func);
|
||||
bool event, xcpt_t func, void *arg);
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: stm32l4_exti_alarm
|
||||
*
|
||||
* Description:
|
||||
@@ -98,16 +99,18 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
* - rising/falling edge: enables interrupt on rising/falling edges
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This value may,
|
||||
* for example, be used to restore the previous handler when multiple handlers are
|
||||
* used.
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
* value may, for example, be used to restore the previous handler when
|
||||
* multiple handlers are used.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func);
|
||||
xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event,
|
||||
xcpt_t func, void *arg);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@@ -121,6 +124,7 @@ xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t
|
||||
* - rising/falling edge: enables interrupt on rising/falling edget
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -131,7 +135,7 @@ xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t
|
||||
|
||||
#ifdef CONFIG_STM32L4_COMP
|
||||
xcpt_t stm32l4_exti_comp(int cmp, bool risingedge, bool fallingedge,
|
||||
bool event, xcpt_t func);
|
||||
bool event, xcpt_t func, void *arg);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
|
||||
/* Interrupt handlers attached to the ALARM EXTI */
|
||||
|
||||
static xcpt_t stm32l4_exti_callback;
|
||||
static xcpt_t g_alarm_callback;
|
||||
static void *g_callback_arg;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@@ -80,9 +81,9 @@ static int stm32l4_exti_alarm_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* Dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32l4_exti_callback)
|
||||
if (g_alarm_callback != NULL)
|
||||
{
|
||||
ret = stm32l4_exti_callback(irq, context, arg);
|
||||
ret = g_alarm_callback(irq, context, g_callback_arg);
|
||||
}
|
||||
|
||||
/* Clear the pending EXTI interrupt */
|
||||
@@ -115,14 +116,15 @@ static int stm32l4_exti_alarm_isr(int irq, void *context, FAR void *arg)
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event,
|
||||
xcpt_t func)
|
||||
xcpt_t func, void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
|
||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||
|
||||
oldhandler = stm32l4_exti_callback;
|
||||
stm32l4_exti_callback = func;
|
||||
oldhandler = g_alarm_callback;
|
||||
g_alarm_callback = func;
|
||||
g__callback_arg = arg;
|
||||
|
||||
/* Install external interrupt handlers (if not already attached) */
|
||||
|
||||
|
||||
@@ -47,17 +47,27 @@
|
||||
#include "stm32l4_exti.h"
|
||||
#include "chip/stm32l4_exti.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct comp_callback_s
|
||||
{
|
||||
xcptr_t callback;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Interrupt handlers attached to the COMP EXTI lines */
|
||||
|
||||
static xcpt_t stm32l4_exti_comp_handlers[STM32L4_COMP_NUM];
|
||||
static struct comp_callback_s g_comp_handlers[STM32L4_COMP_NUM];
|
||||
|
||||
/* Comparator EXTI lines */
|
||||
|
||||
static const uint32_t stm32l4_exti_comp_lines[STM32L4_COMP_NUM] =
|
||||
static const uint32_t g_comp_lines[STM32L4_COMP_NUM] =
|
||||
{
|
||||
#if defined(CONFIG_STM32L4_STM32L4X3) || defined (CONFIG_STM32L4_STM32L4X6)
|
||||
EXTI1_COMP1,
|
||||
@@ -83,15 +93,17 @@ static int stm32l4_exti_comp_isr(int irq, void *context)
|
||||
pr = getreg32(STM32L4_EXTI1_PR);
|
||||
for (i = 0; i < STM32L4_COMP_NUM; i++)
|
||||
{
|
||||
ln = stm32l4_exti_comp_lines[i];
|
||||
ln = g_comp_lines[i];
|
||||
if ((pr & ln) != 0)
|
||||
{
|
||||
/* Clear the pending interrupt */
|
||||
|
||||
putreg32(ln, STM32L4_EXTI1_PR);
|
||||
if (stm32l4_exti_comp_handlers[i])
|
||||
if (g_comp_handlers[i].callback != NULL)
|
||||
{
|
||||
ret = stm32l4_exti_comp_handlers[i](irq, context);
|
||||
xcpt_t callback = g_comp_handlers[i].callback;
|
||||
vid *arg = g_comp_handlers[i].arg;
|
||||
ret = callback(irq, context, arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,6 +126,7 @@ static int stm32l4_exti_comp_isr(int irq, void *context)
|
||||
* - rising/falling edge: enables interrupt on rising/falling edget
|
||||
* - event: generate event when set
|
||||
* - func: when non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -123,11 +136,11 @@ static int stm32l4_exti_comp_isr(int irq, void *context)
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t stm32l4_exti_comp(int cmp, bool risingedge, bool fallingedge,
|
||||
bool event, xcpt_t func)
|
||||
bool event, xcpt_t func, void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
irqstate_t flags;
|
||||
uint32_t ln = stm32l4_exti_comp_lines[cmp];
|
||||
uint32_t ln = g_comp_lines[cmp];
|
||||
|
||||
/* Perform the following within a critical section so that the handler gets
|
||||
* installed correctly before the next interrupt is received.
|
||||
@@ -159,8 +172,9 @@ xcpt_t stm32l4_exti_comp(int cmp, bool risingedge, bool fallingedge,
|
||||
|
||||
/* Get the previous IRQ handler and save the new IRQ handler. */
|
||||
|
||||
oldhandler = stm32l4_exti_comp_handlers[cmp];
|
||||
stm32l4_exti_comp_handlers[cmp] = func;
|
||||
oldhandler = g_comp_handlers[cmp].callback;
|
||||
g_comp_handlers[cmp].callback = func;
|
||||
g_comp_handlers[cmp].arg = arg;
|
||||
|
||||
/* Leave the critical section */
|
||||
|
||||
|
||||
@@ -55,13 +55,23 @@
|
||||
#include "stm32l4_gpio.h"
|
||||
#include "stm32l4_exti.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct gpio_callback_s
|
||||
{
|
||||
xcptr_t callback;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Interrupt handlers attached to each EXTI */
|
||||
|
||||
static xcpt_t stm32l4_exti_callbacks[16];
|
||||
static struct gpio_callback_s g_gpio_handlers[16];
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@@ -81,9 +91,12 @@ static int stm32l4_exti0_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32l4_exti_callbacks[0])
|
||||
if (g_gpio_handlers[0].callback != NULL)
|
||||
{
|
||||
ret = stm32l4_exti_callbacks[0](irq, context, arg);
|
||||
xcpt_t callback = g_gpio_handlers[0].callback;
|
||||
void *cbarg = g_gpio_handlers[0].arg;
|
||||
|
||||
ret = callback(irq, context, cbarg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -99,9 +112,12 @@ static int stm32l4_exti1_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32l4_exti_callbacks[1])
|
||||
if (g_gpio_handlers[1].callback != NULL)
|
||||
{
|
||||
ret = stm32l4_exti_callbacks[1](irq, context, arg);
|
||||
xcpt_t callback = g_gpio_handlers[1].callback;
|
||||
void *cbarg = g_gpio_handlers[1].arg;
|
||||
|
||||
ret = callback(irq, context, cbarg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -117,9 +133,12 @@ static int stm32l4_exti2_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32l4_exti_callbacks[2])
|
||||
if (g_gpio_handlers[2].callback != NULL)
|
||||
{
|
||||
ret = stm32l4_exti_callbacks[2](irq, context, arg);
|
||||
xcpt_t callback = g_gpio_handlers[2].callback;
|
||||
void *cbarg = g_gpio_handlers[2].arg;
|
||||
|
||||
ret = callback(irq, context, cbarg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -135,9 +154,12 @@ static int stm32l4_exti3_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32l4_exti_callbacks[3])
|
||||
if (g_gpio_handlers[3].callback != NULL)
|
||||
{
|
||||
ret = stm32l4_exti_callbacks[3](irq, context, arg);
|
||||
xcpt_t callback = g_gpio_handlers[3].callback;
|
||||
void *cbarg = g_gpio_handlers[3].arg;
|
||||
|
||||
ret = callback(irq, context, cbarg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -153,9 +175,12 @@ static int stm32l4_exti4_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32l4_exti_callbacks[4])
|
||||
if (g_gpio_handlers[4].callback != NULL)
|
||||
{
|
||||
ret = stm32l4_exti_callbacks[4](irq, context, arg);
|
||||
xcpt_t callback = g_gpio_handlers[4].callback;
|
||||
void *cbarg = g_gpio_handlers[4].arg;
|
||||
|
||||
ret = callback(irq, context, cbarg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -186,10 +211,14 @@ static int stm32l4_exti_multiisr(int irq, void *context, void *arg, int first, i
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32l4_exti_callbacks[pin])
|
||||
if (g_gpio_handlers[pin].callback != NULL)
|
||||
{
|
||||
int tmp = stm32l4_exti_callbacks[pin](irq, context, arg);
|
||||
if (tmp != OK)
|
||||
xcpt_t callback = g_gpio_handlers[pin].callback;
|
||||
void *cbarg = g_gpio_handlers[pin].arg;
|
||||
int tmp;
|
||||
|
||||
tmp = callback(irq, context, cbarg);
|
||||
if (tmp < 0)
|
||||
{
|
||||
ret = tmp;
|
||||
}
|
||||
@@ -226,6 +255,7 @@ static int stm32l4_exti1510_isr(int irq, void *context, FAR void *arg)
|
||||
* - fallingedge: Enables interrupt on falling edges
|
||||
* - event: Generate event when set
|
||||
* - func: When non-NULL, generate interrupt
|
||||
* - arg: Argument passed to the interrupt callback
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This
|
||||
@@ -235,15 +265,15 @@ static int stm32l4_exti1510_isr(int irq, void *context, FAR void *arg)
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
bool event, xcpt_t func)
|
||||
bool event, xcpt_t func, void *arg)
|
||||
{
|
||||
struct gpio_callback_s *shared_cbs;
|
||||
uint32_t pin = pinset & GPIO_PIN_MASK;
|
||||
uint32_t exti = STM32L4_EXTI1_BIT(pin);
|
||||
int irq;
|
||||
xcpt_t handler;
|
||||
xcpt_t oldhandler = NULL;
|
||||
int nshared;
|
||||
xcpt_t *shared_cbs;
|
||||
int i;
|
||||
|
||||
/* Select the interrupt handler for this EXTI pin */
|
||||
@@ -252,7 +282,7 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
{
|
||||
irq = pin + STM32L4_IRQ_EXTI0;
|
||||
nshared = 1;
|
||||
shared_cbs = &stm32l4_exti_callbacks[pin];
|
||||
shared_cbs = &g_gpio_handlers[pin];
|
||||
switch (pin)
|
||||
{
|
||||
case 0:
|
||||
@@ -280,21 +310,22 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
{
|
||||
irq = STM32L4_IRQ_EXTI95;
|
||||
handler = stm32l4_exti95_isr;
|
||||
shared_cbs = &stm32l4_exti_callbacks[5];
|
||||
shared_cbs = &g_gpio_handlers[5];
|
||||
nshared = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
irq = STM32L4_IRQ_EXTI1510;
|
||||
handler = stm32l4_exti1510_isr;
|
||||
shared_cbs = &stm32l4_exti_callbacks[10];
|
||||
shared_cbs = &g_gpio_handlers[10];
|
||||
nshared = 6;
|
||||
}
|
||||
|
||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||
|
||||
oldhandler = stm32l4_exti_callbacks[pin];
|
||||
stm32l4_exti_callbacks[pin] = func;
|
||||
oldhandler = g_gpio_handlers[pin].callback;
|
||||
g_gpio_handlers[pin].callback = func;
|
||||
g_gpio_handlers[pin].arg = arg;
|
||||
|
||||
/* Install external interrupt handlers */
|
||||
|
||||
@@ -311,7 +342,7 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||
|
||||
for (i = 0; i < nshared; i++)
|
||||
{
|
||||
if (shared_cbs[i] != NULL)
|
||||
if (shared_cbs[i].callback != NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@
|
||||
|
||||
/* Interrupt handlers attached to the PVD EXTI */
|
||||
|
||||
static xcpt_t stm32l4_exti_pvd_callback;
|
||||
static xcpt_t g_pvd_callback;
|
||||
static void *g_callback_arg
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
@@ -93,9 +94,9 @@ static int stm32l4_exti_pvd_isr(int irq, void *context, FAR void *arg)
|
||||
|
||||
/* And dispatch the interrupt to the handler */
|
||||
|
||||
if (stm32l4_exti_pvd_callback)
|
||||
if (g_pvd_callback != NULL)
|
||||
{
|
||||
ret = stm32l4_exti_pvd_callback(irq, context, arg);
|
||||
ret = g_pvd_callback(irq, context, g_callback_arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -124,14 +125,15 @@ static int stm32l4_exti_pvd_isr(int irq, void *context, FAR void *arg)
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t stm32l4_exti_pvd(bool risingedge, bool fallingedge, bool event,
|
||||
xcpt_t func)
|
||||
xcpt_t func, void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
|
||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||
|
||||
oldhandler = stm32l4_exti_pvd_callback;
|
||||
stm32l4_exti_pvd_callback = func;
|
||||
oldhandler = g_pvd_callback;
|
||||
g_pvd_callback = func;
|
||||
g_callback_arg = arg;
|
||||
|
||||
/* Install external interrupt handlers (if not already attached) */
|
||||
|
||||
|
||||
@@ -55,14 +55,6 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@@ -77,7 +69,7 @@
|
||||
|
||||
#if defined(CONFIG_AVR32_GPIOIRQ) && defined(CONFIG_ARCH_IRQBUTTONS) && \
|
||||
(defined(CONFIG_AVR32DEV_BUTTON1_IRQ) || defined(CONFIG_AVR32DEV_BUTTON2_IRQ))
|
||||
static xcpt_t board_button_irqx(int irq, xcpt_t irqhandler)
|
||||
static xcpt_t board_button_irqx(int irq, xcpt_t irqhandler, void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
|
||||
@@ -164,19 +156,19 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_AVR32_GPIOIRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
#ifdef CONFIG_AVR32DEV_BUTTON1_IRQ
|
||||
if (id == BUTTON1)
|
||||
{
|
||||
return board_button_irqx(GPIO_BUTTON1_IRQ, irqhandler);
|
||||
return board_button_irqx(GPIO_BUTTON1_IRQ, irqhandler, arg);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_AVR32DEV_BUTTON2_IRQ
|
||||
if (id == BUTTON2)
|
||||
{
|
||||
return board_button_irqx(GPIO_BUTTON2_IRQ, irqhandler);
|
||||
return board_button_irqx(GPIO_BUTTON2_IRQ, irqhandler, arg);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -172,7 +172,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC43_GPIO_IRQ)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
irqstate_t flags;
|
||||
|
||||
@@ -159,7 +159,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
@@ -167,8 +167,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
|
||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -150,7 +150,7 @@ uint8_t board_buttons(void)
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_TIVA_GPIOP_IRQS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
static xcpt_t handler = NULL;
|
||||
xcpt_t oldhandler = handler;
|
||||
|
||||
@@ -134,7 +134,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
uint16_t gpio;
|
||||
|
||||
@@ -151,7 +151,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return stm32_gpiosetevent(gpio, true, true, true, irqhandler);
|
||||
return stm32_gpiosetevent(gpio, true, true, true, irqhandler, arg);
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
||||
|
||||
@@ -159,7 +159,8 @@ static void up_enable(FAR const struct enc_lower_s *lower)
|
||||
FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower;
|
||||
|
||||
DEBUGASSERT(priv->handler);
|
||||
(void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, false, true, true, priv->handler);
|
||||
(void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, false, true, true,
|
||||
priv->handler, NULL);
|
||||
}
|
||||
|
||||
static void up_disable(FAR const struct enc_lower_s *lower)
|
||||
|
||||
@@ -133,7 +133,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
uint32_t pinset;
|
||||
|
||||
@@ -137,7 +137,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
uint32_t pinset;
|
||||
|
||||
@@ -182,7 +182,7 @@ int board_app_initialize(uintptr_t arg)
|
||||
|
||||
/* Register an interrupt handler for the card detect pin */
|
||||
|
||||
stm32_gpiosetevent(GPIO_SD_CD, true, true, true, nsh_cdinterrupt);
|
||||
stm32_gpiosetevent(GPIO_SD_CD, true, true, true, nsh_cdinterrupt, NULL);
|
||||
|
||||
/* Mount the SDIO-based MMC/SD block driver */
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
uint32_t pinset = GPIO_BTN_KEYA;
|
||||
@@ -139,8 +139,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
}
|
||||
if (id < 2)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(pinset, true, true, true, irqhandler);
|
||||
oldhandler = stm32_gpiosetevent(pinset, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -98,7 +98,7 @@ static int hymini_ts_irq_attach(FAR struct ads7843e_config_s *state, xcpt_t isr)
|
||||
iinfo("hymini_ts_irq_attach\n");
|
||||
|
||||
tc_isr = isr;
|
||||
stm32_gpiosetevent(GPIO_TS_IRQ, true, true, true, isr);
|
||||
stm32_gpiosetevent(GPIO_TS_IRQ, true, true, true, isr, NULL);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
/* The KwikStik-K40 board has no standard GPIO contact buttons */
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ static xcpt_t g_irq_button;
|
||||
|
||||
#ifdef HAVE_IRQBUTTONS
|
||||
static xcpt_t board_button_irqx(gio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, xcpt_t *store)
|
||||
xcpt_t irqhandler, xcpt_t *store, void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
irqstate_t flags;
|
||||
@@ -108,7 +108,7 @@ static xcpt_t board_button_irqx(gio_pinset_t pinset, int irq,
|
||||
/* Configure the interrupt */
|
||||
|
||||
tms570_gioirq(pinset);
|
||||
(void)irq_attach(irq, irqhandler, NULL);
|
||||
(void)irq_attach(irq, irqhandler, arg);
|
||||
tms570_gioirqenable(irq);
|
||||
}
|
||||
else
|
||||
@@ -183,12 +183,13 @@ uint8_t board_buttons(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
#ifdef HAVE_IRQBUTTONS
|
||||
if (id == BUTTON_GIOA7)
|
||||
{
|
||||
return board_button_irqx(GIO_BUTTON, IRQ_BUTTON, irqhandler, &g_irq_button);
|
||||
return board_button_irqx(GIO_BUTTON, IRQ_BUTTON, irqhandler,i
|
||||
&g_irq_button, arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC17_GPIOIRQ)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
irqstate_t flags;
|
||||
|
||||
@@ -178,7 +178,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC43_GPIO_IRQ)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
irqstate_t flags;
|
||||
|
||||
@@ -184,7 +184,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC43_GPIO_IRQ)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
#if 0 /* Not yet implemented */
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
@@ -282,7 +282,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
||||
#ifdef CONFIG_USBHOST
|
||||
xcpt_t stm32_setup_overcurrent(xcpt_t handler)
|
||||
{
|
||||
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler);
|
||||
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -138,12 +138,13 @@ static void up_enable(FAR const struct vs1053_lower_s *lower)
|
||||
FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower;
|
||||
|
||||
DEBUGASSERT(priv->handler);
|
||||
(void)stm32_gpiosetevent(GPIO_VS1053_DREQ, true, false, false, priv->handler);
|
||||
(void)stm32_gpiosetevent(GPIO_VS1053_DREQ, true, false, false,
|
||||
priv->handler, priv->arg);
|
||||
}
|
||||
|
||||
static void up_disable(FAR const struct vs1053_lower_s *lower)
|
||||
{
|
||||
(void)stm32_gpiosetevent(GPIO_VS1053_DREQ, false, false, false, NULL);
|
||||
(void)stm32_gpiosetevent(GPIO_VS1053_DREQ, false, false, false, NULL, NULL);
|
||||
}
|
||||
|
||||
static void up_reset(FAR const struct vs1053_lower_s *lower, bool state)
|
||||
|
||||
@@ -105,13 +105,14 @@ uint8_t board_buttons(void)
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler);
|
||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
|
||||
@@ -132,7 +132,8 @@ int stm32_sdio_initialize(void)
|
||||
|
||||
/* Register an interrupt handler for the card detect pin */
|
||||
|
||||
stm32_gpiosetevent(GPIO_SDMMC1_NCD, true, true, true, stm32_ncd_interrupt);
|
||||
stm32_gpiosetevent(GPIO_SDMMC1_NCD, true, true, true,
|
||||
stm32_ncd_interrupt, NULL);
|
||||
#endif
|
||||
|
||||
/* Mount the SDIO-based MMC/SD block driver */
|
||||
|
||||
@@ -304,7 +304,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
||||
#ifdef CONFIG_USBHOST
|
||||
xcpt_t stm32_setup_overcurrent(xcpt_t handler)
|
||||
{
|
||||
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler);
|
||||
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -126,14 +126,14 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
||||
irqhandler);
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
|
||||
@@ -377,7 +377,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower,
|
||||
i, rising, falling);
|
||||
|
||||
(void)stm32_gpiosetevent(g_joygpio[i], rising, falling,
|
||||
true, ajoy_interrupt);
|
||||
true, ajoy_interrupt, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -403,7 +403,7 @@ static void ajoy_disable(void)
|
||||
flags = enter_critical_section();
|
||||
for (i = 0; i < AJOY_NGPIOS; i++)
|
||||
{
|
||||
(void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL);
|
||||
(void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL, NULL);
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
||||
@@ -123,13 +123,14 @@ uint8_t board_buttons(void)
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler);
|
||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
|
||||
@@ -184,11 +184,13 @@ xcpt_t up_irqio(int id, xcpt_t irqhandler)
|
||||
|
||||
if (id == 0)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(GPIO_D14, true, true, true, irqhandler);
|
||||
oldhandler = stm32_gpiosetevent(GPIO_D14, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
else if (id == 1)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(GPIO_D15, true, true, true, irqhandler);
|
||||
oldhandler = stm32_gpiosetevent(GPIO_D15, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
|
||||
@@ -204,11 +204,13 @@ static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable)
|
||||
iinfo("enable:%d\n", enable);
|
||||
if (enable)
|
||||
{
|
||||
(void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false, priv->handler);
|
||||
(void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false,
|
||||
priv->handler, priv->arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false, NULL);
|
||||
(void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false,
|
||||
NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower,
|
||||
i, rising, falling);
|
||||
|
||||
(void)stm32_gpiosetevent(g_joygpio[i], rising, falling,
|
||||
true, ajoy_interrupt);
|
||||
true, ajoy_interrupt, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -402,7 +402,7 @@ static void ajoy_disable(void)
|
||||
flags = up_irq_save();
|
||||
for (i = 0; i < AJOY_NGPIOS; i++)
|
||||
{
|
||||
(void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL);
|
||||
(void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL, NULL);
|
||||
}
|
||||
|
||||
up_irq_restore(flags);
|
||||
|
||||
@@ -123,13 +123,14 @@ uint8_t board_buttons(void)
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler);
|
||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
|
||||
@@ -184,11 +184,13 @@ xcpt_t up_irqio(int id, xcpt_t irqhandler)
|
||||
|
||||
if (id == 0)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(GPIO_D14, true, true, true, irqhandler);
|
||||
oldhandler = stm32_gpiosetevent(GPIO_D14, true, true, true,
|
||||
irqhandler, NULL);
|
||||
}
|
||||
else if (id == 1)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(GPIO_D15, true, true, true, irqhandler);
|
||||
oldhandler = stm32_gpiosetevent(GPIO_D15, true, true, true,
|
||||
irqhandler, NULL);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
|
||||
@@ -204,11 +204,13 @@ static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable)
|
||||
iinfo("enable:%d\n", enable);
|
||||
if (enable)
|
||||
{
|
||||
(void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false, priv->handler);
|
||||
(void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false,
|
||||
priv->handler, priv->arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false, NULL);
|
||||
(void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false,
|
||||
NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_EFM32_GPIO_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC17_GPIOIRQ)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
irqstate_t flags;
|
||||
|
||||
@@ -133,7 +133,7 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
@@ -142,7 +142,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
oldhandler =
|
||||
stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
|
||||
stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
|
||||
@@ -311,7 +311,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
||||
#ifdef CONFIG_USBHOST
|
||||
xcpt_t stm32_setup_overcurrent(xcpt_t handler)
|
||||
{
|
||||
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler);
|
||||
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ uint8_t board_buttons(void)
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
@@ -149,7 +149,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
|
||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user