/* * arch/sh/boards/dreamcast/rtc.c * * Dreamcast AICA RTC routines. * * Copyright (c) 2001, 2002 M. R. Brown <mrbrown@0xd6.org> * Copyright (c) 2002 Paul Mundt <lethal@chaoticdreams.org> * * Released under the terms of the GNU GPL v2.0. * */ #include <linux/time.h> #include <asm/rtc.h> #include <asm/io.h> /* 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 * @ts: pointer to resulting timespec * * Grabs the current RTC seconds counter and adjusts it to the Unix Epoch. */
static void aica_rtc_gettimeofday(struct timespec *ts) { unsigned long val1, val2; do { val1 = ((__raw_readl(AICA_RTC_SECS_H) & 0xffff) << 16) | (__raw_readl(AICA_RTC_SECS_L) & 0xffff); val2 = ((__raw_readl(AICA_RTC_SECS_H) & 0xffff) << 16) | (__raw_readl(AICA_RTC_SECS_L) & 0xffff); } while (val1 != val2); ts->tv_sec = val1 - TWENTY_YEARS; /* Can't get nanoseconds with just a seconds counter. */ ts->tv_nsec = 0; }Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds | 79 | 87.78% | 1 | 25.00% |
Paul Mundt | 10 | 11.11% | 2 | 50.00% |
Adrian Bunk | 1 | 1.11% | 1 | 25.00% |
Total | 90 | 100.00% | 4 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds | 96 | 88.07% | 1 | 25.00% |
Paul Mundt | 12 | 11.01% | 2 | 50.00% |
Adrian Bunk | 1 | 0.92% | 1 | 25.00% |
Total | 109 | 100.00% | 4 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Paul Mundt | 15 | 100.00% | 2 | 100.00% |
Total | 15 | 100.00% | 2 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds | 193 | 80.42% | 1 | 14.29% |
Paul Mundt | 43 | 17.92% | 4 | 57.14% |
Andrew Morton | 2 | 0.83% | 1 | 14.29% |
Adrian Bunk | 2 | 0.83% | 1 | 14.29% |
Total | 240 | 100.00% | 7 | 100.00% |