Skip to content

Commit 306078a

Browse files
committed
rename init_xxx to base_xxx
1 parent 1b375cc commit 306078a

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

components/drivers/rtc/dev_soft_rtc.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ static struct rt_work rtc_sync_work;
4545
static struct rt_device soft_rtc_dev;
4646
static RT_DEFINE_SPINLOCK(_spinlock);
4747
/* RTC time baseline for calculation */
48-
static struct timespec init_ts = { 0 };
48+
static struct timespec base_ts = { 0 };
4949
#ifdef RT_USING_KTIME
50-
static struct timespec init_ktime_ts = { 0 };
50+
static struct timespec base_ktime_ts = { 0 };
5151
#else
52-
static rt_tick_t init_tick;
52+
static rt_tick_t base_tick;
5353
#endif
5454

5555
#ifdef RT_USING_ALARM
@@ -109,12 +109,12 @@ static void soft_rtc_alarm_update(struct rt_rtc_wkalarm *palarm)
109109
static void set_rtc_time(struct timespec *ts)
110110
{
111111
rt_base_t level = rt_spin_lock_irqsave(&_spinlock);
112-
init_ts.tv_sec = ts->tv_sec;
113-
init_ts.tv_nsec = ts->tv_nsec;
112+
base_ts.tv_sec = ts->tv_sec;
113+
base_ts.tv_nsec = ts->tv_nsec;
114114
#ifdef RT_USING_KTIME
115-
rt_ktime_boottime_get_ns(&init_ktime_ts);
115+
rt_ktime_boottime_get_ns(&base_ktime_ts);
116116
#else
117-
init_tick = rt_tick_get();
117+
base_tick = rt_tick_get();
118118
#endif
119119
rt_spin_unlock_irqrestore(&_spinlock, level);
120120
#ifdef RT_USING_ALARM
@@ -144,12 +144,12 @@ static void get_rtc_time(struct timespec *ts)
144144
struct timespec current_ts;
145145
rt_ktime_boottime_get_ns(&current_ts);
146146

147-
ts->tv_sec = init_ts.tv_sec + (current_ts.tv_sec - init_ktime_ts.tv_sec);
148-
ts->tv_nsec = init_ts.tv_nsec + (current_ts.tv_nsec - init_ktime_ts.tv_nsec);
147+
ts->tv_sec = base_ts.tv_sec + (current_ts.tv_sec - base_ktime_ts.tv_sec);
148+
ts->tv_nsec = base_ts.tv_nsec + (current_ts.tv_nsec - base_ktime_ts.tv_nsec);
149149
#else
150-
rt_tick_t tick = rt_tick_get_delta(init_tick);
151-
ts->tv_sec = init_ts.tv_sec + tick / RT_TICK_PER_SECOND;
152-
ts->tv_nsec = init_ts.tv_nsec + ((tick % RT_TICK_PER_SECOND) * 1000000000UL / RT_TICK_PER_SECOND);
150+
rt_tick_t tick = rt_tick_get_delta(base_tick);
151+
ts->tv_sec = base_ts.tv_sec + tick / RT_TICK_PER_SECOND;
152+
ts->tv_nsec = base_ts.tv_nsec + ((tick % RT_TICK_PER_SECOND) * (1000000000UL / RT_TICK_PER_SECOND));
153153
#endif
154154
/* Handle nanosecond overflow/underflow */
155155
if (ts->tv_nsec >= 1000000000L)
@@ -315,12 +315,12 @@ static int rt_soft_rtc_init(void)
315315
#endif
316316

317317
#ifdef RT_USING_KTIME
318-
rt_ktime_boottime_get_ns(&init_ktime_ts);
318+
rt_ktime_boottime_get_ns(&base_ktime_ts);
319319
#else
320-
init_tick = rt_tick_get();
320+
base_tick = rt_tick_get();
321321
#endif
322-
init_ts.tv_sec = timegm(&time_new);
323-
init_ts.tv_nsec = 0;
322+
base_ts.tv_sec = timegm(&time_new);
323+
base_ts.tv_nsec = 0;
324324

325325
soft_rtc_dev.type = RT_Device_Class_RTC;
326326

0 commit comments

Comments
 (0)