Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/arch/x86/platform/olpc/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 1 kB image not shown  

Quelle  olpc-xo1-rtc.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Support for OLPC XO-1 Real Time Clock (RTC)
 *
 * Copyright (C) 2011 One Laptop per Child
 */


#include <linux/mc146818rtc.h>
#include <linux/platform_device.h>
#include <linux/rtc.h>
#include <linux/of.h>

#include <asm/msr.h>
#include <asm/olpc.h>
#include <asm/x86_init.h>

static void rtc_wake_on(struct device *dev)
{
 olpc_xo1_pm_wakeup_set(CS5536_PM_RTC);
}

static void rtc_wake_off(struct device *dev)
{
 olpc_xo1_pm_wakeup_clear(CS5536_PM_RTC);
}

static struct resource rtc_platform_resource[] = {
 [0] = {
  .start = RTC_PORT(0),
  .end = RTC_PORT(1),
  .flags = IORESOURCE_IO,
 },
 [1] = {
  .start = RTC_IRQ,
  .end = RTC_IRQ,
  .flags = IORESOURCE_IRQ,
 }
};

static struct cmos_rtc_board_info rtc_info = {
 .rtc_day_alarm = 0,
 .rtc_mon_alarm = 0,
 .rtc_century = 0,
 .wake_on = rtc_wake_on,
 .wake_off = rtc_wake_off,
};

static struct platform_device xo1_rtc_device = {
 .name = "rtc_cmos",
 .id = -1,
 .num_resources = ARRAY_SIZE(rtc_platform_resource),
 .dev.platform_data = &rtc_info,
 .resource = rtc_platform_resource,
};

static int __init xo1_rtc_init(void)
{
 int r;
 struct device_node *node;

 node = of_find_compatible_node(NULL, NULL, "olpc,xo1-rtc");
 if (!node)
  return 0;
 of_node_put(node);

 pr_info("olpc-xo1-rtc: Initializing OLPC XO-1 RTC\n");
 rdmsrq(MSR_RTC_DOMA_OFFSET, rtc_info.rtc_day_alarm);
 rdmsrq(MSR_RTC_MONA_OFFSET, rtc_info.rtc_mon_alarm);
 rdmsrq(MSR_RTC_CEN_OFFSET, rtc_info.rtc_century);

 r = platform_device_register(&xo1_rtc_device);
 if (r)
  return r;

 x86_platform.legacy.rtc = 0;

 device_init_wakeup(&xo1_rtc_device.dev, 1);
 return 0;
}
arch_initcall(xo1_rtc_init);

Messung V0.5
C=97 H=86 G=91

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.