mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 07:28:38 +08:00
rtc: There is no need to use sched_[un]lock
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
a4c9268a40
commit
ef8d8ee627
12 changed files with 79 additions and 56 deletions
|
@ -511,6 +511,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
struct tm time;
|
||||
time_t seconds;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -522,7 +523,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in broken out format */
|
||||
|
||||
|
@ -552,7 +553,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = at32_setalarm(lower, &setalarm);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -565,6 +566,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
#endif
|
||||
struct timespec ts;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0);
|
||||
priv = (struct at32_lowerhalf_s *)lower;
|
||||
|
@ -575,7 +577,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in seconds */
|
||||
|
||||
|
@ -585,7 +587,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = up_rtc_getdatetime(&time);
|
||||
if (ret < 0)
|
||||
{
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -598,7 +600,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = up_rtc_gettime(&ts);
|
||||
if (ret < 0)
|
||||
{
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
|
@ -629,7 +631,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
cbinfo->priv = NULL;
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -734,6 +736,7 @@ static int at32_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
{
|
||||
struct alm_rdalarm_s lowerinfo;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -744,14 +747,14 @@ static int at32_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
lowerinfo.ar_id = alarminfo->id;
|
||||
lowerinfo.ar_time = alarminfo->time;
|
||||
|
||||
ret = at32_rtc_rdalarm(&lowerinfo);
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -361,6 +361,7 @@ static int cxd56_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
struct timespec ts;
|
||||
time_t seconds;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL);
|
||||
DEBUGASSERT((RTC_ALARM0 <= alarminfo->id) &&
|
||||
|
@ -372,7 +373,7 @@ static int cxd56_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
#if defined(CONFIG_RTC_HIRES)
|
||||
/* Get the higher resolution time */
|
||||
|
@ -380,7 +381,7 @@ static int cxd56_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = up_rtc_gettime(&ts);
|
||||
if (ret < 0)
|
||||
{
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
|
@ -406,7 +407,7 @@ static int cxd56_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
|
||||
ret = cxd56_setalarm(lower, &setalarm);
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -363,6 +363,7 @@ kinetis_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
time_t seconds;
|
||||
struct timespec ts;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA);
|
||||
|
@ -374,7 +375,7 @@ kinetis_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
#if defined(CONFIG_RTC_DATETIME)
|
||||
/* Get the broken out time and convert to seconds */
|
||||
|
@ -382,7 +383,7 @@ kinetis_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = up_rtc_getdatetime(&time);
|
||||
if (ret < 0)
|
||||
{
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -394,7 +395,7 @@ kinetis_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = up_rtc_gettime(&ts);
|
||||
if (ret < 0)
|
||||
{
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
@ -421,7 +422,7 @@ kinetis_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
|
||||
ret = kinetis_setalarm(lower, &setalarm);
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -498,6 +499,7 @@ static int kinetis_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
{
|
||||
struct timespec ts;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA);
|
||||
|
@ -508,12 +510,12 @@ static int kinetis_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
ret = kinetis_rtc_rdalarm(&ts);
|
||||
|
||||
localtime_r((const time_t *)&ts.tv_sec,
|
||||
(struct tm *)alarminfo->time);
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -365,6 +365,7 @@ static int lpc54_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
struct lpc54_cbinfo_s *cbinfo;
|
||||
struct timespec ts;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0);
|
||||
priv = (struct lpc54_lowerhalf_s *)lower;
|
||||
|
@ -375,7 +376,7 @@ static int lpc54_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in seconds */
|
||||
|
||||
|
@ -403,7 +404,7 @@ static int lpc54_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
cbinfo->priv = NULL;
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -430,6 +430,7 @@ static int max326_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
#endif
|
||||
struct timespec ts;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0);
|
||||
priv = (struct max326_lowerhalf_s *)lower;
|
||||
|
@ -440,7 +441,7 @@ static int max326_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in seconds */
|
||||
|
||||
|
@ -450,7 +451,7 @@ static int max326_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = up_rtc_getdatetime(&time);
|
||||
if (ret < 0)
|
||||
{
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -463,7 +464,7 @@ static int max326_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = up_rtc_gettime(&ts);
|
||||
if (ret < 0)
|
||||
{
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
|
@ -494,7 +495,7 @@ static int max326_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
cbinfo->priv = NULL;
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -515,6 +515,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
struct tm time;
|
||||
time_t seconds;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -526,7 +527,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in broken out format */
|
||||
|
||||
|
@ -556,7 +557,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = stm32_setalarm(lower, &setalarm);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -569,6 +570,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
#endif
|
||||
struct timespec ts;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0);
|
||||
priv = (struct stm32_lowerhalf_s *)lower;
|
||||
|
@ -579,7 +581,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in seconds */
|
||||
|
||||
|
@ -589,7 +591,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = up_rtc_getdatetime(&time);
|
||||
if (ret < 0)
|
||||
{
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -602,7 +604,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = up_rtc_gettime(&ts);
|
||||
if (ret < 0)
|
||||
{
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
|
@ -633,7 +635,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
cbinfo->priv = NULL;
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -738,6 +740,7 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
{
|
||||
struct alm_rdalarm_s lowerinfo;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -748,14 +751,14 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
lowerinfo.ar_id = alarminfo->id;
|
||||
lowerinfo.ar_time = alarminfo->time;
|
||||
|
||||
ret = stm32_rtc_rdalarm(&lowerinfo);
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -433,6 +433,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
struct tm time;
|
||||
time_t seconds;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -444,7 +445,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in broken out format */
|
||||
|
||||
|
@ -474,7 +475,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = stm32_setalarm(lower, &setalarm);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -558,6 +559,7 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
{
|
||||
struct alm_rdalarm_s lowerinfo;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -568,14 +570,14 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
lowerinfo.ar_id = alarminfo->id;
|
||||
lowerinfo.ar_time = alarminfo->time;
|
||||
|
||||
ret = stm32_rtc_rdalarm(&lowerinfo);
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -434,6 +434,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
struct tm time;
|
||||
time_t seconds;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -445,7 +446,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in broken out format */
|
||||
|
||||
|
@ -475,7 +476,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = stm32_setalarm(lower, &setalarm);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -559,6 +560,7 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
{
|
||||
struct alm_rdalarm_s lowerinfo;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -569,14 +571,14 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
lowerinfo.ar_id = alarminfo->id;
|
||||
lowerinfo.ar_time = alarminfo->time;
|
||||
|
||||
ret = stm32_rtc_rdalarm(&lowerinfo);
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -399,6 +399,7 @@ stm32l4_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
struct tm time;
|
||||
time_t seconds;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -410,7 +411,7 @@ stm32l4_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in broken out format */
|
||||
|
||||
|
@ -440,7 +441,7 @@ stm32l4_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = stm32l4_setalarm(lower, &setalarm);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -525,6 +526,7 @@ static int stm32l4_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
{
|
||||
struct alm_rdalarm_s lowerinfo;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -535,14 +537,14 @@ static int stm32l4_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
lowerinfo.ar_id = alarminfo->id;
|
||||
lowerinfo.ar_time = alarminfo->time;
|
||||
|
||||
ret = stm32l4_rtc_rdalarm(&lowerinfo);
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -398,6 +398,7 @@ stm32wb_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
struct tm time;
|
||||
time_t seconds;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -409,7 +410,7 @@ stm32wb_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in broken out format */
|
||||
|
||||
|
@ -439,7 +440,7 @@ stm32wb_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = stm32wb_setalarm(lower, &setalarm);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -523,6 +524,7 @@ static int stm32wb_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
{
|
||||
struct alm_rdalarm_s lowerinfo;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL);
|
||||
DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB);
|
||||
|
@ -533,14 +535,14 @@ static int stm32wb_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
lowerinfo.ar_id = alarminfo->id;
|
||||
lowerinfo.ar_time = alarminfo->time;
|
||||
|
||||
ret = stm32wb_rtc_rdalarm(&lowerinfo);
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -416,6 +416,7 @@ static int rx65n_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
struct timespec rtc_time;
|
||||
time_t seconds;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL);
|
||||
|
||||
|
@ -425,7 +426,7 @@ static int rx65n_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
#if defined(CONFIG_RTC_DATETIME)
|
||||
/* Get the broken out time and convert to seconds */
|
||||
|
@ -434,7 +435,7 @@ static int rx65n_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
ret = up_rtc_getdatetime(&time);
|
||||
if (ret < 0)
|
||||
{
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -478,7 +479,7 @@ static int rx65n_setrelative(struct rtc_lowerhalf_s *lower,
|
|||
|
||||
/* Remember the callback information */
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -546,6 +547,7 @@ static int rx65n_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
{
|
||||
struct alm_rdalarm_s lowerinfo;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL);
|
||||
if (alarminfo->id >= 0)
|
||||
|
@ -554,14 +556,14 @@ static int rx65n_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
lowerinfo.ar_id = alarminfo->id;
|
||||
lowerinfo.ar_time = alarminfo->time;
|
||||
|
||||
ret = rx65n_rtc_rdalarm(&lowerinfo);
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -405,6 +405,7 @@ static int ez80_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
|||
struct tm time;
|
||||
time_t seconds;
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0);
|
||||
|
||||
|
@ -412,7 +413,7 @@ static int ez80_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the current time in broken out format */
|
||||
|
||||
|
@ -441,7 +442,7 @@ static int ez80_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
|||
ret = ez80_setalarm(lower, &setalarm);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
@ -516,6 +517,7 @@ static int ez80_rdalarm(FAR struct rtc_lowerhalf_s *lower,
|
|||
FAR struct lower_rdalarm_s *alarminfo)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(lower != NULL && alarminfo != NULL &&
|
||||
alarminfo->time != NULL && alarminfo->id == 0);
|
||||
|
@ -524,9 +526,9 @@ static int ez80_rdalarm(FAR struct rtc_lowerhalf_s *lower,
|
|||
* about being suspended and working on an old time.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
ret = ez80_rtc_rdalarm((FAR struct tm *)alarminfo->time);
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue