/* * linux/arch/m68k/atari/time.c * * Atari time and real time clock stuff * * Assembled of parts of former atari/config.c 97-12-18 by Roman Hodek * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details.
*/
local_irq_save(flags); /* Ensure that the count is monotonically decreasing, even though * the result may briefly stop changing after counter wrap-around.
*/
count = min(st_mfp.tim_dt_c, last_timer_count);
last_timer_count = count;
int atari_tt_hwclk( int op, struct rtc_time *t )
{ int sec=0, min=0, hour=0, day=0, mon=0, year=0, wday=0; unsignedlong flags; unsignedchar ctrl; int pm = 0;
ctrl = RTC_READ(RTC_CONTROL); /* control registers are
* independent from the UIP */
if (op) { /* write: prepare values */
sec = t->tm_sec;
min = t->tm_min;
hour = t->tm_hour;
day = t->tm_mday;
mon = t->tm_mon + 1;
year = t->tm_year - atari_rtc_year_offset;
wday = t->tm_wday + (t->tm_wday >= 0);
if (!(ctrl & RTC_24H)) { if (hour > 11) {
pm = 0x80; if (hour != 12)
hour -= 12;
} elseif (hour == 0)
hour = 12;
}
if (!(ctrl & RTC_DM_BINARY)) {
sec = bin2bcd(sec);
min = bin2bcd(min);
hour = bin2bcd(hour);
day = bin2bcd(day);
mon = bin2bcd(mon);
year = bin2bcd(year); if (wday >= 0)
wday = bin2bcd(wday);
}
}
/* Reading/writing the clock registers is a bit critical due to * the regular update cycle of the RTC. While an update is in * progress, registers 0..9 shouldn't be touched. * The problem is solved like that: If an update is currently in * progress (the UIP bit is set), the process sleeps for a while * (50ms). This really should be enough, since the update cycle * normally needs 2 ms. * If the UIP bit reads as 0, we have at least 244 usecs until the * update starts. This should be enough... But to be sure, * additionally the RTC_SET bit is set to prevent an update cycle.
*/
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.