/* The AICA RTC has an Epoch of 1/1/1950, so we must subtract 20 years (in seconds) to get the standard Unix Epoch when getting the time, and add
20 years when setting the time. */ #define TWENTY_YEARS ((20 * 365LU + 5) * 86400)
/* The AICA RTC is represented by a 32-bit seconds counter stored in 2 16-bit
registers.*/ #define AICA_RTC_SECS_H 0xa0710000 #define AICA_RTC_SECS_L 0xa0710004
/** * aica_rtc_gettimeofday - Get the time from the AICA RTC * @dev: the RTC device (ignored) * @tm: pointer to resulting RTC time structure * * Grabs the current RTC seconds counter and adjusts it to the Unix Epoch.
*/ staticint aica_rtc_gettimeofday(struct device *dev, struct rtc_time *tm)
{ unsignedlong val1, val2;
time64_t t;
/* normalize to 1970..2106 time range */
t = (u32)(val1 - TWENTY_YEARS);
rtc_time64_to_tm(t, tm);
return 0;
}
/** * aica_rtc_settimeofday - Set the AICA RTC to the current time * @dev: the RTC device (ignored) * @tm: pointer to new RTC time structure * * Adjusts the given @tv to the AICA Epoch and sets the RTC seconds counter.
*/ staticint aica_rtc_settimeofday(struct device *dev, struct rtc_time *tm)
{ unsignedlong val1, val2;
time64_t secs = rtc_tm_to_time64(tm);
u32 adj = secs + TWENTY_YEARS;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.