linux kernel은 CPU에 rtc 설비가 없어도 쓸 수 있다.
pxa27x에서 내장 RealTimeClock(이하 rtc)가 있다.
따라서, kernel은 pxa-rtc를 가지고, system time을 표시하지 않는다.
(즉, date로 시간을 설정하면 바로 rtc 설비에 시간을 update하는 것이 아니다.)
거꾸로 system time을 주기적으로 pxa-rtc에 update한다.
이에 대한 kernel 함수 추적.
pxa27x에서 내장 RealTimeClock(이하 rtc)가 있다.
따라서, kernel은 pxa-rtc를 가지고, system time을 표시하지 않는다.
(즉, date로 시간을 설정하면 바로 rtc 설비에 시간을 update하는 것이 아니다.)
거꾸로 system time을 주기적으로 pxa-rtc에 update한다.
이에 대한 kernel 함수 추적.
include/linux/time.h 에서 xtime. -> 이것이 system time. /* pxa27x에서 OS timer 0가 schedule timer */ arch/arm/mach-pxa27x/time.c:__pxa_timer_interrupt() do { timer_tick(); OSSR = OSSR_M0; /* Clear match on timer 0 */ next_match = (OSMR0 += LATCH); } while( (signed long)(next_match - OSCR) <= 8 ); arch/arm/kernel/time.c:timer_tick() do_set_rtc(); do_timer(1); -> system time update scheduling 계산할 것으로 추정. arch/arm/kernel/time.c:do_set_rtc() if (set_rtc()) ... arch/arm/kernel/time.c /* * hook for setting the RTC's idea of the current time. */ int (*set_rtc)(void); arch/arm/mach-pxa27x/time.c:pxa_timer_init() set_rtc = pxa_set_rtc; arch/arm/mach-pxa27x/time.c:pxa_set_rtc() unsigned long current_time = xtime.tv_sec; if (RTSR & RTSR_ALE) { /* make sure not to forward the clock over an alarm */ unsigned long alarm = RTAR; if (current_time >= alarm && alarm >= RCNR) return -ERESTARTSYS; } RCNR = current_time; return 0; 따라서, sleep/wakeup시 backup RTC 값을 읽어서 //tv.tv_sec = pxa_get_rtc_time(); do_settimeofday(&tv); 하면 됨.