You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/08/26 09:21:56 UTC
[incubator-nuttx] branch master updated: arch: cxd56xx: Use
spinlock API in cxd56_rtc.c
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new c770dc9 arch: cxd56xx: Use spinlock API in cxd56_rtc.c
c770dc9 is described below
commit c770dc91349d03c8374b299715cf5b4c391b71ec
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Wed Aug 26 16:46:59 2020 +0900
arch: cxd56xx: Use spinlock API in cxd56_rtc.c
Summary:
- This commit improves cxd56_rtc performance in SMP mode.
Impact:
- This commit affects SMP mode only.
Testing:
- Tested with spresense:smp
Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
arch/arm/src/cxd56xx/cxd56_rtc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/arm/src/cxd56xx/cxd56_rtc.c b/arch/arm/src/cxd56xx/cxd56_rtc.c
index 7315122..636d74b 100644
--- a/arch/arm/src/cxd56xx/cxd56_rtc.c
+++ b/arch/arm/src/cxd56xx/cxd56_rtc.c
@@ -446,7 +446,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
irqstate_t flags;
uint64_t count;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
#ifdef RTC_DIRECT_CONTROL
/* wait until previous write request is completed */
@@ -469,7 +469,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
g_rtc_save->offset = (int64_t)count - (int64_t)cxd56_rtc_count();
#endif
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
rtc_dumptime(tp, "Setting time");
@@ -497,12 +497,12 @@ uint64_t cxd56_rtc_count(void)
* 1st post -> 2nd pre, and should be operated in atomic.
*/
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
val = (uint64_t)getreg32(CXD56_RTC0_RTPOSTCNT) << 15;
val |= getreg32(CXD56_RTC0_RTPRECNT);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
return val;
}
@@ -524,12 +524,12 @@ uint64_t cxd56_rtc_almcount(void)
uint64_t val;
irqstate_t flags;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
val = (uint64_t)getreg32(CXD56_RTC0_SETALMPOSTCNT(0)) << 15;
val |= (getreg32(CXD56_RTC0_SETALMPRECNT(0)) & 0x7fff);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
return val;
}
@@ -570,7 +570,7 @@ int cxd56_rtc_setalarm(FAR struct alm_setalarm_s *alminfo)
{
/* The set the alarm */
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
cbinfo->ac_cb = alminfo->as_cb;
cbinfo->ac_arg = alminfo->as_arg;
@@ -594,7 +594,7 @@ int cxd56_rtc_setalarm(FAR struct alm_setalarm_s *alminfo)
while (RTCREG_ALM_BUSY_MASK & getreg32(CXD56_RTC0_ALMOUTEN(id)));
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
rtc_dumptime(&alminfo->as_time, "New Alarm time");
ret = OK;
@@ -635,7 +635,7 @@ int cxd56_rtc_cancelalarm(enum alm_id_e alarmid)
{
/* Unset the alarm */
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
cbinfo->ac_cb = NULL;
@@ -643,7 +643,7 @@ int cxd56_rtc_cancelalarm(enum alm_id_e alarmid)
putreg32(0, CXD56_RTC0_ALMOUTEN(alarmid));
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
ret = OK;
}