STM32/F7/L4: EXTI ALARM function 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:
Gregory Nutt 2017-03-02 09:18:10 -06:00
parent d5e04a8c43
commit 28d3344ac2
9 changed files with 35 additions and 54 deletions

View File

@ -102,15 +102,14 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
* - 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.
* Zero (OK) on success; a negated errno value on failure indicating the
* nature of the failure.
*
************************************************************************************/
#ifdef CONFIG_RTC_ALARM
xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func,
void *arg);
int stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func,
void *arg);
#endif
#undef EXTERN

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32/stm32_exti_alarm.c
*
* Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2012, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Diego Sanchez <dsanchez@nx-engineering.com>
*
@ -109,20 +109,16 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg)
* - 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.
* Zero (OK) on success; a negated errno value on failure indicating the
* nature of the failure.
*
****************************************************************************/
xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
xcpt_t func, void *arg)
int stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
xcpt_t func, void *arg)
{
xcpt_t oldhandler;
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
oldhandler = g_alarm_callback;
g_alarm_callback = func;
g_callback_arg = arg;
@ -158,5 +154,5 @@ xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
/* Return the old IRQ handler */
return oldhandler;
return OK;
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32/stm32f40xxx_rtcc.c
*
* Copyright (C) 2012-2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Modified: Neil Hancock
*
@ -847,7 +847,7 @@ static inline void rtc_enable_alarm(void)
* 3. Configure the RTC to generate RTC alarms (Alarm A or Alarm B).
*/
stm32_exti_alarm(true, false, true, stm32_rtc_alarm_handler, NULL);
(void)stm32_exti_alarm(true, false, true, stm32_rtc_alarm_handler, NULL);
g_alarm_enabled = true;
}
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32f7/stm32_exti.h
*
* 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
@ -104,15 +104,14 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
* - 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.
* Zero (OK) on success; a negated errno value on failure indicating the
* nature of the failure.
*
****************************************************************************/
#ifdef CONFIG_RTC_ALARM
xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
xcpt_t func, void *arg);
int stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
xcpt_t func, void *arg);
#endif
#undef EXTERN

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32f7/stm32_exti_alarm.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* This file derives from similar logic for the STM32 F1:
@ -57,10 +57,6 @@
#include "stm32_gpio.h"
#include "stm32_exti.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
@ -121,20 +117,16 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg)
* - 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.
* Zero (OK) on success; a negated errno value on failure indicating the
* nature of the failure.
*
****************************************************************************/
xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
xcpt_t func, void *arg)
int stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
xcpt_t func, void *arg)
{
xcpt_t oldhandler;
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
oldhandler = g_alarm_callback;
g_alarm_callback = func;
g_callback_arg = arg;
@ -170,5 +162,5 @@ xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event,
/* Return the old IRQ handler */
return oldhandler;
return OK;
}

View File

@ -1037,7 +1037,7 @@ int up_rtc_initialize(void)
* 3. Configure the RTC to generate RTC alarms (Alarm A or Alarm B).
*/
stm32_exti_alarm(true, false, true, stm32_rtc_alarm_handler);
(void)stm32_exti_alarm(true, false, true, stm32_rtc_alarm_handler, NULL);
rtc_dumpregs("After InitExtiAlarm");
#else
rtc_dumpregs("After Initialization");

View File

@ -102,15 +102,14 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
* - 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.
* Zero (OK) on success; a negated errno value on failure indicating the
* nature of the failure.
*
****************************************************************************/
#ifdef CONFIG_RTC_ALARM
xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event,
xcpt_t func, void *arg);
int stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event,
xcpt_t func, void *arg);
#endif
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32l4/stm32l4_exti_alarm.c
*
* Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2012, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Diego Sanchez <dsanchez@nx-engineering.com>
* dev@ziggurat29.com (adaptation to stm32l4)
@ -109,20 +109,16 @@ static int stm32l4_exti_alarm_isr(int irq, void *context, FAR void *arg)
* - func: when non-NULL, generate interrupt
*
* 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.
* Zero (OK) on success; a negated errno value on failure indicating the
* nature of the failure.
*
****************************************************************************/
xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event,
xcpt_t func, void *arg)
int stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event,
xcpt_t func, void *arg)
{
xcpt_t oldhandler;
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
oldhandler = g_alarm_callback;
g_alarm_callback = func;
g_callback_arg = arg;
@ -158,5 +154,5 @@ xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event,
/* Return the old IRQ handler */
return oldhandler;
return OK;
}

View File

@ -801,7 +801,7 @@ static inline void rtc_enable_alarm(void)
* 3. Configure the RTC to generate RTC alarms (Alarm A or Alarm B).
*/
stm32l4_exti_alarm(true, false, true, stm32l4_rtc_alarm_handler, NULL);
(void)stm32l4_exti_alarm(true, false, true, stm32l4_rtc_alarm_handler, NULL);
g_alarm_enabled = true;
}
}