/* * Reading the low address latches the high value * as well so there is no fear that we may read * inaccurate high value.
*/
time_low = readl(base + GOLDFISH_TIMER_LOW);
time_high = readl(base + GOLDFISH_TIMER_HIGH);
np = of_find_compatible_node(NULL, NULL, "google,goldfish-rtc"); if (!np)
panic("%s(): Failed to find 'google,goldfish-rtc' dt node!",
__func__);
rtc_base = of_iomap(np, 0);
of_node_put(np); if (!rtc_base)
panic("%s(): Failed to ioremap Goldfish RTC base!", __func__);
/* * Poll the nanosecond resolution RTC for one * second to calibrate the CPU frequency.
*/
rtc_start = read_rtc_time(rtc_base);
start = read_c0_count();
do {
rtc_current = read_rtc_time(rtc_base);
rtc_delta = rtc_current - rtc_start;
} while (rtc_delta < NSEC_PER_SEC);
count = read_c0_count() - start;
/* * Make sure the frequency will be a round number. * Without this correction, the returned value may vary * between subsequent emulation executions. * * TODO: Set this value using device tree.
*/
count += 5000;
count -= count % 10000;
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.