RTC lower half was missing call to F4 alarm cancel function
This commit is contained in:
parent
531b9f6626
commit
1ea7b48677
@ -617,13 +617,30 @@ static int stm32_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
|||||||
static int stm32_cancelalarm(FAR struct rtc_lowerhalf_s *lower, int alarmid)
|
static int stm32_cancelalarm(FAR struct rtc_lowerhalf_s *lower, int alarmid)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_STM32_STM32F40XX
|
#ifdef CONFIG_STM32_STM32F40XX
|
||||||
/* ID0-> Alarm A; ID1 -> Alarm B */
|
FAR struct stm32_lowerhalf_s *priv;
|
||||||
|
FAR struct stm32_cbinfo_s *cbinfo;
|
||||||
|
int ret = -EINVAL;
|
||||||
|
|
||||||
DEBUGASSERT(lower != NULL);
|
DEBUGASSERT(lower != NULL);
|
||||||
DEBUGASSERT(alarmid == RTC_ALARMA || alarmid == RTC_ALARMB);
|
DEBUGASSERT(alarmid == RTC_ALARMA || alarmid == RTC_ALARMB);
|
||||||
|
priv = (FAR struct stm32_lowerhalf_s *)lower;
|
||||||
|
|
||||||
# warning Missing logic
|
/* ID0-> Alarm A; ID1 -> Alarm B */
|
||||||
return -ENOSYS;
|
|
||||||
|
if (alarmid == RTC_ALARMA || alarmid == RTC_ALARMB)
|
||||||
|
{
|
||||||
|
/* Nullify callback information to reduce window for race conditions */
|
||||||
|
|
||||||
|
cbinfo = &priv->cbinfo[alarmid];
|
||||||
|
cbinfo->cb = NULL;
|
||||||
|
cbinfo->priv = NULL;
|
||||||
|
|
||||||
|
/* Then cancel the alarm */
|
||||||
|
|
||||||
|
ret = stm32_rtc_cancelalarm((enum alm_id_e)alarmid);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
FAR struct stm32_lowerhalf_s *priv;
|
FAR struct stm32_lowerhalf_s *priv;
|
||||||
@ -639,6 +656,8 @@ static int stm32_cancelalarm(FAR struct rtc_lowerhalf_s *lower, int alarmid)
|
|||||||
cbinfo->cb = NULL;
|
cbinfo->cb = NULL;
|
||||||
cbinfo->priv = NULL;
|
cbinfo->priv = NULL;
|
||||||
|
|
||||||
|
/* Then cancel the alarm */
|
||||||
|
|
||||||
return stm32_rtc_cancelalarm();
|
return stm32_rtc_cancelalarm();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -93,5 +93,21 @@ struct alm_setalarm_s
|
|||||||
|
|
||||||
int stm32_rtc_setalarm(FAR struct alm_setalarm_s *alminfo);
|
int stm32_rtc_setalarm(FAR struct alm_setalarm_s *alminfo);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_rtc_cancelalarm
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Cancel an alaram.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* alarmid - Identifies the alarm to be cancelled
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) on success; a negated errno on failure
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int stm32_rtc_cancelalarm(enum alm_id_e alarmid);
|
||||||
|
|
||||||
#endif /* CONFIG_RTC_ALARM */
|
#endif /* CONFIG_RTC_ALARM */
|
||||||
#endif /* __ARCH_ARM_SRC_STM32_STM32F40XXX_ALARM_H */
|
#endif /* __ARCH_ARM_SRC_STM32_STM32F40XXX_ALARM_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user