2 .\" Copyright 2002 Urs Thuermann (urs@isnogud.escape.de)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, write to the Free
21 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
24 .\" $Id: rtc.4,v 1.4 2005/12/05 17:19:49 urs Exp $
26 .\" 2006-02-08 Various additions by mtk
27 .\" 2006-11-26 cleanup, cover the generic rtc framework; David Brownell
29 .\" Japanese Version Copyright (c) 2006-2007 Yuichi SATO
30 .\" all rights reserved.
31 .\" Translated 2006-07-12 by Yuichi SATO <ysato444@yahoo.co.jp>. LDP v2.29
32 .\" Updated & Modified 2007-01-08 by Yuichi SATO. LDP v2.43
34 .TH RTC 4 2010-02-25 "Linux" "Linux Programmer's Manual"
37 .\"O rtc \- real-time clock
38 rtc \- ¥ê¥¢¥ë¥¿¥¤¥à¥¯¥í¥Ã¥¯
41 #include <linux/rtc.h>
43 .BI "int ioctl(" fd ", RTC_" request ", " param ");"
46 .\"O This is the interface to drivers for real-time clocks (RTCs).
47 ¤³¤ì¤Ï¥ê¥¢¥ë¥¿¥¤¥à¥¯¥í¥Ã¥¯ (RTC) ¤Î¥É¥é¥¤¥Ð¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ç¤¢¤ë¡£
49 .\"O Most computers have one or more hardware clocks which record the
50 .\"O current "wall clock" time.
51 .\"O These are called "Real Time Clocks" (RTCs).
52 .\"O One of these usually has battery backup power so that it tracks the time
53 .\"O even while the computer is turned off.
54 .\"O RTCs often provide alarms and other interrupts.
55 ¿¤¯¤Î¥³¥ó¥Ô¥å¡¼¥¿¤Ï¡¢¸½ºß¤Î¡ÖÊÉ»þ·×¡×»þ¹ï ("wall clock" time) ¤òµÏ¿¤¹¤ë¡¢
56 ¥Ï¡¼¥É¥¦¥§¥¢¥¯¥í¥Ã¥¯¤ò 1 ¸Ä°Ê¾å»ý¤Ã¤Æ¤¤¤ë¡£
57 ¤³¤ì¤é¤Ï¡Ö¥ê¥¢¥ë¥¿¥¤¥à¥¯¥í¥Ã¥¯¡×(RTC) ¤È¸Æ¤Ð¤ì¤ë¡£
58 ¤³¤ì¤é¤Î»þ·×¤Î¤¦¤Á 1 ¤Ä¤Ï¡¢Ä̾ï¤ÏÅÅÃӤǥХ寥¢¥Ã¥×¤·¤Æ¶îÆ°¤µ¤ì¤ë¤Î¤Ç¡¢
59 ¥³¥ó¥Ô¥å¡¼¥¿¤Î¥¹¥¤¥Ã¥Á¤òÀڤäƤ⡢»þ¹ï¤òÊÝ»ý¤Ç¤¤ë¡£
60 ¿¤¯¤Î¾ì¹ç¡¢RTC ¤Ï¥¢¥é¡¼¥à¤ä¤½¤Î¾¤Î³ä¤ê¹þ¤ß¤Îµ¡Ç½¤òÄ󶡤¹¤ë¡£
62 .\"O All i386 PCs, and ACPI-based systems, have an RTC that is compatible with
63 .\"O the Motorola MC146818 chip on the original PC/AT.
64 .\"O Today such an RTC is usually integrated into the mainboard's chipset
65 .\"O (south bridge), and uses a replaceable coin-sized backup battery.
66 Á´¤Æ¤Î i386 PC ¤È ACPI ¥Ù¡¼¥¹¤Î¥·¥¹¥Æ¥à¤Ë¤Ï RTC ¤¬¤¢¤ë¡£
67 ¤³¤Î RTC ¤Ï¡¢¸µ¡¹¤Î PC/AT ¤Ë¸ºß¤·¤¿
68 Motorola MC146818 ¥Á¥Ã¥×¤È¸ß´¹À¤¬¤¢¤ë¡£
69 ¤³¤Î¤è¤¦¤Ê RTC ¤Ï¡¢º£Æü¤Ç¤Ï¥Þ¥¶¡¼¥Ü¡¼¥É¤Î
70 ¥Á¥Ã¥×¥»¥Ã¥È (¥µ¥¦¥¹¥Ö¥ê¥Ã¥¸) Æâ¤Ç¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤³¤È¤¬Â¿¤¯¡¢
71 ¸ò´¹²Äǽ¤Ê¹Å²ß¤¯¤é¤¤¤ÎÂ礤µ¤Î¥Ð¥Ã¥¯¥¢¥Ã¥×ÅÅÃÓ¤ò»È¤Ã¤Æ¤¤¤ë¡£
73 .\"O Non-PC systems, such as embedded systems built around system-on-chip
74 .\"O processors, use other implementations.
75 .\"O They usually won't offer the same functionality as the RTC from a PC/AT.
76 ¥·¥¹¥Æ¥à¥ª¥ó¥Á¥Ã¥× (system-on-chip) ¥×¥í¥»¥Ã¥µ¤ò»È¤Ã¤Æºî¤é¤ì¤¿
77 ÁȤ߹þ¤ß¥·¥¹¥Æ¥à¤È¤¤¤Ã¤¿¡¢PC °Ê³°¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¡¢Ê̤ʼÂÁõ¤òÍѤ¤¤Æ¤¤¤ë¡£
78 ¤³¤Î¤è¤¦¤Ê¥·¥¹¥Æ¥à¤Ç¤Ï¡¢PC/AT ¤Î RTC ¤ÈƱ¤¸µ¡Ç½¤òÄ󶡤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤¬Â¿¤¤¡£
80 .\"O .SS RTC vs System Clock
81 .SS RTC ¤È¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤Î°ã¤¤
82 .\"O RTCs should not be confused with the system clock, which is
83 .\"O a software clock maintained by the kernel and used to implement
84 .\"O .BR gettimeofday (2)
87 .\"O as well as setting timestamps on files, etc.
88 RTC ¤ò¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤Èº®Æ±¤¹¤Ù¤¤Ç¤Ï¤Ê¤¤¡£
89 ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤Ï¡¢¥«¡¼¥Í¥ë¤Ë´ÉÍý¤µ¤ì¤ë¥½¥Õ¥È¥¦¥§¥¢¥¯¥í¥Ã¥¯¤Ç¤¢¤ê¡¢
90 ¥Õ¥¡¥¤¥ë¤Ë¤è¤ë¥¿¥¤¥à¥¹¥¿¥ó¥×ÀßÄê¤Ê¤É¤È¤È¤â¤Ë¡¢
94 ¤ò¼ÂÁõ¤¹¤ë¤Î¤Ë»ÈÍѤµ¤ì¤Æ¤¤¤ë¡£
95 .\"O The system clock reports seconds and microseconds since a start point,
96 .\"O defined to be the POSIX Epoch: 1970-01-01 00:00:00 +0000 (UTC).
97 ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤Ï¡¢POSIX ¤Ë¤ª¤±¤ëµª¸µ
98 (Epoch; 1970-01-01 00:00:00 +0000 (UTC)) ¤«¤é¤ÎÉäȥߥêÉäòɽ¤¹¡£
99 .\"O (One common implementation counts timer interrupts, once
100 .\"O per "jiffy", at a frequency of 100, 250, or 1000 Hz.)
101 .\"O That is, it is supposed to report wall clock time, which RTCs also do.
102 1 ¤Ä¤Î°ìÈÌŪ¤Ê¼ÂÁõ¤Ç¤Ï¥¿¥¤¥Þ¡¼³ä¤ê¹þ¤ß¤ò¡¢"jiffy" Ëè¤Ë 1 ²ó¡¢
103 100, 250, 1000 Hz ¤È¤¤¤¦¼þÇÈ¿ô¤Ç¥«¥¦¥ó¥È¤¹¤ë¡£
105 .\"O A key difference between an RTC and the system clock is that RTCs
106 .\"O run even when the system is in a low power state (including "off"),
107 .\"O and the system clock can't.
108 RTC ¤È¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤Î½ÅÍפʰ㤤¤Ï¡¢
109 RTC ¤Ï¥·¥¹¥Æ¥à¤¬ÄãÅÅÎϾõÂÖ (¡Ö¥ª¥Õ¡×¤Î¾ì¹ç¤â´Þ¤à) ¤Ç¤âÆ°ºî¤¹¤ë¤Î¤ËÂФ·¡¢
110 ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ÏÆ°ºî¤·¤Ê¤¤ÅÀ¤Ç¤¢¤ë¡£
111 .\"O Until it is initialized, the system clock can only report time since
112 .\"O system boot ... not since the POSIX Epoch.
113 ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤Ï¡¢½é´ü²½¤¬¹Ô¤ï¤ì¤ë¤Þ¤Ç¤Ï¡¢
114 POSIX µª¸µ¤«¤é¤Ç¤Ï¤Ê¤¯¥·¥¹¥Æ¥à¤Î¥Ö¡¼¥È»þ¤«¤é¤Î»þ¹ï¤·¤«ÊÖ¤»¤Ê¤¤¡£
115 .\"O So at boot time, and after resuming from a system low power state, the
116 .\"O system clock will often be set to the current wall clock time using an RTC.
117 ¤½¤Î¤¿¤á¡¢¥Ö¡¼¥È»þ¤ä¥·¥¹¥Æ¥à¤ÎÄãÅÅÎϾõÂÖ¤«¤é¤ÎÉüµ¢ (resume) ¸å¤Ë¤Ï¡¢
118 ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤Ï RTC ¤ò»È¤Ã¤Æ¸½ºß¤ÎÊÉ»þ·×»þ¹ï¤ËÀßÄꤵ¤ì¤ë¾ì¹ç¤¬Â¿¤¤¡£
119 .\"O Systems without an RTC need to set the system clock using another clock,
120 .\"O maybe across the network or by entering that data manually.
121 RTC ¤ò»ý¤¿¤Ê¤¤¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
122 ¾¤Î»þ·×¤ò»È¤Ã¤Æ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤òÀßÄꤹ¤ëɬÍפ¬¤¢¤ê¡¢
123 ¥Í¥Ã¥È¥ï¡¼¥¯¤Ë¥¢¥¯¥»¥¹¤·¤¿¤ê¡¢(»þ¹ï) ¥Ç¡¼¥¿¤ò¼êÆ°¤ÇÆþÎϤ·¤¿¤ê¤¹¤ë¤À¤í¤¦¡£
124 .\"O .SS RTC functionality
126 .\"O RTCs can be read and written with
127 .\"O .BR hwclock (8),
128 .\"O or directly with the ioctl requests listed below.
131 ¤Þ¤¿¤Ï²¼µ¤Î ioctl ¥ê¥¯¥¨¥¹¥È¤ÇÆɤ߽ñ¤¤¬¤Ç¤¤ë¡£
133 .\"O Besides tracking the date and time, many RTCs can also generate
135 ÆüÉդȻþ´Ö¤ò¥«¥¦¥ó¥È¤¹¤ë¤Î¤Ë²Ã¤¨¤Æ¡¢
136 ¿¤¯¤Î RTC ¤Ï°Ê²¼¤Î¤è¤¦¤Ë³ä¤ê¹þ¤ß¤òȯÀ¸¤Ç¤¤ë¡£
138 .\"O on every clock update (i.e., once per second);
139 ¥¯¥í¥Ã¥¯¤Î¹¹¿·Ëè (¤Ä¤Þ¤ê 1 ÉÃËè)¡£
141 .\"O at periodic intervals with a frequency that can be set to
142 .\"O any power-of-2 multiple in the range 2 Hz to 8192 Hz;
143 2 Hz ¤«¤é 8192 Hz ¤Þ¤Ç¤Î 2 ¤Î¾è¿ô¤Î¼þÇÈ¿ô¤Ç¡¢Äê´üŪ¤Ê´Ö³Ö¡£
145 .\"O on reaching a previously specified alarm time.
146 Á°¤â¤Ã¤Æ»ØÄꤷ¤¿¥¢¥é¡¼¥à»þ¹ï¤Ë㤷¤¿»þ¡£
148 .\"O Each of those interrupt sources can be enabled or disabled separately.
149 ¤³¤ì¤é¤Î³ä¤ê¹þ¤ß¸µ¤Ï¡¢¸ÄÊ̤Ë͸ú¤Ë¤·¤¿¤ê̵¸ú¤Ë¤·¤¿¤ê¤Ç¤¤ë¡£
150 .\"O On many systems, the alarm interrupt can be configured as a system wakeup
151 .\"O event, which can resume the system from a low power state such as
152 .\"O Suspend-to-RAM (STR, called S3 in ACPI systems),
153 .\"O Hibernation (called S4 in ACPI systems),
154 .\"O or even "off" (called S5 in ACPI systems).
155 ¿¤¯¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¡¢¥¢¥é¡¼¥à³ä¤ê¹þ¤ß¤ò¥·¥¹¥Æ¥à¤Î
156 ¥¦¥§¥¤¥¯¥¢¥Ã¥×¥¤¥Ù¥ó¥È¤È¤·¤ÆÀßÄê¤Ç¤¤ë¡£
157 ¤³¤Î¥¤¥Ù¥ó¥È¤Ï¡¢RAM ¤Ø¤Î¥µ¥¹¥Ú¥ó¥É (STR, ACPI ¥·¥¹¥Æ¥à¤Ç S3 ¤È¸Æ¤Ð¤ì¤ë) ¤ä
158 ¥Ï¥¤¥Ð¡¼¥Í¡¼¥·¥ç¥ó (ACPI ¥·¥¹¥Æ¥à¤Ç S4 ¤È¸Æ¤Ð¤ì¤ë) ¤È¤¤¤Ã¤¿ÄãÅÅÎϾõÂ֤䡢
159 ¡Ö¥ª¥Õ¡×(ACPI ¥·¥¹¥Æ¥à¤Ç S5 ¤È¸Æ¤Ð¤ì¤ë) ¤«¤é¤Ç¤â¡¢¥·¥¹¥Æ¥à¤òÉüµ¢¤Ç¤¤ë¡£
160 .\"O On some systems, the battery backed RTC can't issue
161 .\"O interrupts, but another one can.
162 ÅÅÃӤǥХ寥¢¥Ã¥×¤µ¤ì¤¿ RTC ¤¬³ä¤ê¹þ¤ß¤òȯÀ¸¤Ç¤¤ë¥·¥¹¥Æ¥à¤È¡¢
163 ¤Ç¤¤Ê¤¤¥·¥¹¥Æ¥à¤¬¤¢¤ë¡£
171 .\"O device can be opened only once (until it is closed) and it is read-only.
177 ¥Ç¥Ð¥¤¥¹¤Ï (¥¯¥í¡¼¥º¤µ¤ì¤ë¤Þ¤Ç) 1 ²ó¤·¤«¥ª¡¼¥×¥ó¤¹¤ë¤³¤È¤¬¤Ç¤¤º¡¢
183 .\"O the calling process is blocked until the next interrupt from that RTC
188 ¤ò¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Ï¡¢
189 RTC ¤«¤é¤Î³ä¤ê¹þ¤ß¤ò¼õ¤±¼è¤ë¤Þ¤ÇÄä»ß (block) ¤µ¤ì¤ë¡£
190 .\"O Following the interrupt, the process can read a long integer, of which
191 .\"O the least significant byte contains a bit mask encoding
192 .\"O the types of interrupt that occurred,
193 .\"O while the remaining 3 bytes contain the number of interrupts since the
196 ³ä¤ê¹þ¤ß¤Î¸å¡¢¥×¥í¥»¥¹¤Ï long ·¿À°¿ô¤òÆɤ߽Ф¹¤³¤È¤¬¤Ç¤¤ë¡£
197 ¤³¤ÎÀ°¿ô¤ÎºÇ²¼°Ì¥Ð¥¤¥È¤ÏȯÀ¸¤·¤¿³ä¤ê¹þ¤ß¤Î¼ïÊ̤ò
198 ¥³¡¼¥É²½¤·¤¿¥Ó¥Ã¥È¥Þ¥¹¥¯¤Ç¤¢¤ê¡¢
199 »Ä¤ê¤Î 3 ¥Ð¥¤¥È¤ÏºÇ¸å¤Î
201 °Ê¹ß¤ËȯÀ¸¤·¤¿³ä¤ê¹þ¤ß¤Î²ó¿ô¤Ç¤¢¤ë¡£
202 .\"O .SS ioctl(2) interface
203 .SS ioctl(2) ¥¤¥ó¥¿¥Õ¥§¡¼¥¹
206 .\"O requests are defined on file descriptors connected to RTC devices:
209 ¥ê¥¯¥¨¥¹¥È¤¬ RTC ¥Ç¥Ð¥¤¥¹¤ÎÀܳ¤µ¤ì¤¿
210 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÂФ·¤ÆÄêµÁ¤µ¤ì¤Æ¤¤¤ë:
213 .\"O Returns this RTC's time in the following structure:
214 RTC ¤Î»þ¹ï¤ò°Ê²¼¤Î¹½Â¤ÂΤÇÊÖ¤¹:
225 .\"O int tm_wday; /* unused */
226 int tm_wday; /* ̤»ÈÍÑ */
227 .\"O int tm_yday; /* unused */
228 int tm_yday; /* ̤»ÈÍÑ */
229 .\"O int tm_isdst; /* unused */
230 int tm_isdst; /* ̤»ÈÍÑ */
235 .\"O The fields in this structure have the same meaning and ranges as for the
237 .\"O structure described in
239 ¤³¤Î¹½Â¤ÂΤΥե£¡¼¥ë¥É¤Ï
243 ¹½Â¤ÂΤΥե£¡¼¥ë¥É¤ÈƱ¤¸°ÕÌ£¤ÇƱ¤¸ÈϰϤǤ¢¤ë¡£
244 .\"O A pointer to this structure should be passed as the third
247 ¤³¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤ò
249 ¤ÎÂè 3 °ú¤¿ô¤È¤·¤ÆÅϤ¹¡£
252 .\"O Sets this RTC's time to the time specified by the
254 .\"O structure pointed to by the third
260 ¹½Â¤ÂΤÎÃͤò RTC »þ¹ï¤ËÀßÄꤹ¤ë¡£
262 .\"O RTC's time the process must be privileged (i.e., have the
265 RTC »þ¹ï¤ÎÀßÄꤹ¤ë¾ì¹ç¡¢¥×¥í¥»¥¹¤ÏÆø¢
268 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£) ¤ò»ý¤¿¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
270 .BR RTC_ALM_READ ", " RTC_ALM_SET
271 .\"O Read and set the alarm time, for RTCs that support alarms.
272 ¥¢¥é¡¼¥à¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë RTC ¤ËÂФ·¤Æ¡¢
273 ¥¢¥é¡¼¥à»þ¹ï¤ÎÆɤ߹þ¤ß¤ÈÀßÄê¤ò¹Ô¤¦¡£
274 .\"O The alarm interrupt must be separately enabled or disabled using the
275 .\"O .BR RTC_AIE_ON ", " RTC_AIE_OFF
278 .BR RTC_AIE_ON ", " RTC_AIE_OFF
279 ¤ò»È¤Ã¤Æ¡¢¤³¤ì¤È¤ÏÊ̤Ë͸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
282 .\"O argument is a pointer to an
285 \fBioctl\fP(2) ¤ÎÂè 3 °ú¤¿ô¤Ï¡¢
287 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
293 .\"O fields of this structure are used.
298 ¥Õ¥£¡¼¥ë¥É¤Î¤ß¤¬»ÈÍѤµ¤ì¤ë¡£
300 .BR RTC_IRQP_READ ", " RTC_IRQP_SET
301 .\"O Read and set the frequency for periodic interrupts,
302 .\"O for RTCs that support periodic interrupts.
303 ¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë RTC ¤ËÂФ·¤Æ¡¢
304 ¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¤Î¼þÇÈ¿ô¤ÎÆɤ߹þ¤ß¤ÈÀßÄê¤ò¹Ô¤¦¡£
305 .\"O The periodic interrupt must be separately enabled or disabled using the
306 .\"O .BR RTC_PIE_ON ", " RTC_PIE_OFF
309 .BR RTC_PIE_ON ", " RTC_PIE_OFF
310 ¤ò»È¤Ã¤Æ¡¢¤³¤ì¤È¤ÏÊ̤Ë͸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
314 .\"O .I "unsigned long\ *"
316 .\"O .IR "unsigned long" ,
318 \fBioctl\fP(2) ¤ÎÂè 3 °ú¤¿ô¤Ï¡¢¤½¤ì¤¾¤ì
319 .I "unsigned long\ *"
323 .\"O The value is the frequency in interrupts per second.
324 .\"O The set of allowable frequencies is the multiples of two
325 .\"O in the range 2 to 8192.
326 ¤³¤ÎÃÍ¤Ï 1 ÉÃÅö¤¿¤ê¤Î³ä¤ê¹þ¤ß¤Î²ó¿ô¤Ç¤¢¤ë¡£
327 »ØÄê²Äǽ¤Ê¼þÇÈ¿ô¤Ï¡¢2 ¤Î¾è¿ô¤Ç 2 ¤«¤é 8192 ¤ÎÈϰϤǤ¢¤ë¡£
328 .\"O Only a privileged process (i.e., one having the
329 .\"O .B CAP_SYS_RESOURCE
330 .\"O capability) can set frequencies above the value specified in
331 .\"O .IR /proc/sys/dev/rtc/max-user-freq .
334 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹) ¤Î¤ß¤¬¡¢
335 .I /proc/sys/dev/rtc/max-user-freq
336 ¤Ë½ñ¤«¤ì¤¿¾åµ¤Î¼þÇÈ¿ô¤òÀßÄê¤Ç¤¤ë¡£
337 .\"O (This file contains the value 64 by default.)
338 (¤³¤Î¥Õ¥¡¥¤¥ë¤Ë¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç 64 ¤È¤¤¤¦Ãͤ¬½ñ¤«¤ì¤Æ¤¤¤ë)¡£
340 .BR RTC_AIE_ON ", " RTC_AIE_OFF
341 .\"O Enable or disable the alarm interrupt, for RTCs that support alarms.
344 .\"O argument is ignored.
345 ¥¢¥é¡¼¥à¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë RTC ¤ËÂФ·¤Æ¡¢
346 ¥¢¥é¡¼¥à³ä¤ê¹þ¤ß¤ò͸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤¹¤ë¡£
347 \fBioctl\fP(2) ¤ÎÂè 3 °ú¤¿ô¤Ï̵»ë¤µ¤ì¤ë¡£
349 .BR RTC_UIE_ON ", " RTC_UIE_OFF
350 .\"O Enable or disable the interrupt on every clock update,
351 .\"O for RTCs that support this once-per-second interrupt.
354 .\"O argument is ignored.
355 1 ÉÃËè¤Î³ä¤ê¹þ¤ß¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë RTC ¤ËÂФ·¤Æ¡¢
356 ¥¯¥í¥Ã¥¯¹¹¿·Ëè¤Î³ä¤ê¹þ¤ß¤ò͸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤¹¤ë¡£
357 \fBioctl\fP(2) ¤ÎÂè 3 °ú¤¿ô¤Ï̵»ë¤µ¤ì¤ë¡£
359 .BR RTC_PIE_ON ", " RTC_PIE_OFF
360 .\"O Enable or disable the periodic interrupt,
361 .\"O for RTCs that support these periodic interrupts.
364 .\"O argument is ignored.
365 ¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë RTC ¤ËÂФ·¤Æ¡¢
366 ¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¤ò͸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤¹¤ë¡£
367 \fBioctl\fP(2) ¤ÎÂè 3 °ú¤¿ô¤Ï̵»ë¤µ¤ì¤ë¡£
368 .\"O Only a privileged process (i.e., one having the
369 .\"O .B CAP_SYS_RESOURCE
370 .\"O capability) can enable the periodic interrupt if the frequency is
371 .\"O currently set above the value specified in
372 .\"O .IR /proc/sys/dev/rtc/max-user-freq .
375 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹) ¤Î¤ß¤¬¡¢
377 .I /proc/sys/dev/rtc/max-user-freq
378 ¤Ë¼þ´ü¤¬¾åµ¤ÎÃͤ˻ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¡¢
379 ¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¤ò͸ú¤Ë¤Ç¤¤ë¡£
381 .BR RTC_EPOCH_READ ", " RTC_EPOCH_SET
382 .\"O Many RTCs encode the year in an 8-bit register which is either
383 .\"O interpreted as an 8-bit binary number or as a BCD number.
385 .\"O the number is interpreted relative to this RTC's Epoch.
386 ¿¤¯¤Î RTC ¤Ïǯ¤ò 8 ¥Ó¥Ã¥È¤Î¥ì¥¸¥¹¥¿¤Ë¥³¡¼¥É²½¤¹¤ë¡£
387 ǯ¤Ï 8 ¥Ó¥Ã¥È¤Î¥Ð¥¤¥Ê¥ê¿ô¤Þ¤¿¤Ï BCD ¿ô¤ËÊÑ´¹¤µ¤ì¤ë¡£
388 ¤É¤Á¤é¤Î¾ì¹ç¤Ç¤â¡¢¤½¤Î¿ôÃÍ¤Ï RTC ¤Îµª¸µ¤«¤éÁêÂÐÃͤËÊÑ´¹¤µ¤ì¤ë¡£
389 .\"O The RTC's Epoch is
390 .\"O initialized to 1900 on most systems but on Alpha and MIPS it might
391 .\"O also be initialized to 1952, 1980, or 2000, depending on the value of
392 .\"O an RTC register for the year.
393 ¿¤¯¤Î¥·¥¹¥Æ¥à¤Ç¤Ï RTC ¤Îµª¸µ¤Ï 1900 ¤Ë½é´ü²½¤µ¤ì¤ë¤¬¡¢
394 Alpha ¤È MIPS ¤Ç¤Ï¡¢RTC ¥ì¥¸¥¹¥¿¤Îǯ¤ÎÃͤ˱þ¤¸¤Æ¡¢
395 1952, 1980, 2000 ¤Î²¿¤ì¤«¤Ë½é´ü²½¤µ¤ì¤ë¡£
397 .\"O these operations can be used to read or to set the RTC's Epoch,
399 ¤³¤ì¤é¤ÎÁàºî¤Ç¤½¤ì¤¾¤ì RTC ¤Îµª¸µ¤ÎÆɤ߹þ¤ß¤ÈÀßÄ꤬²Äǽ¤Ê RTC ¤â¤¢¤ë¡£
403 .\"O .I "unsigned long\ *"
405 .\"O .IR "unsigned long" ,
406 .\"O respectively, and the value returned (or assigned) is the Epoch.
407 \fBioctl\fP(2) ¤ÎÂè 3 °ú¤¿ô¤Ï¡¢¤½¤ì¤¾¤ì
408 .I "unsigned long\ *"
412 ÊÖ¤µ¤ì¤ëÃÍ (¤Þ¤¿¤Ï»ØÄꤵ¤ì¤ëÃÍ) ¤Ïµª¸µ¤Ç¤¢¤ë¡£
413 .\"O To set the RTC's Epoch the process must be privileged (i.e., have the
416 RTC ¤Îµª¸µ¤òÀßÄꤹ¤ë¾ì¹ç¡¢¥×¥í¥»¥¹¤ÏÆø¢ (¤Ä¤Þ¤ê
418 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£) ¤ò»ý¤¿¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
420 .BR RTC_WKALM_RD ", " RTC_WKALM_SET
421 .\"O Some RTCs support a more powerful alarm interface, using these ioctls
422 .\"O to read or write the RTC's alarm time (respectively) with this structure:
423 RTC ¤ÎÃæ¤Ë¤Ï¤è¤ê¶¯ÎϤʥ¢¥é¡¼¥à¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò¥µ¥Ý¡¼¥È¤¹¤ë¤â¤Î¤â¤¢¤ê¡¢
424 ¤³¤ì¤é¤Î ioctl ¤ò»È¤¦¤³¤È¤Ç¡¢°Ê²¼¤Î¤è¤¦¤Ê¹½Â¤ÂΤÇ
425 RTC ¤Î¥¢¥é¡¼¥à»þ¹ï¤ò (¤½¤ì¤¾¤ì) Æɤ߽ñ¤¤Ç¤¤ë:
431 unsigned char enabled;
432 unsigned char pending;
433 struct rtc_time time;
441 .\"O flag is used to enable or disable the alarm interrupt,
442 .\"O or to read its current status; when using these calls,
443 .\"O .BR RTC_AIE_ON " and " RTC_AIE_OFF
449 .\"O to report a pending interrupt
450 .\"O (so it's mostly useless on Linux, except when talking
451 .\"O to the RTC managed by EFI firmware).
453 ¥Õ¥é¥°¤Ï¥¢¥é¡¼¥à³ä¤ê¹þ¤ß¤ò͸ú¤Þ¤¿¤Ï̵¸ú¤·¤¿¤ê¡¢
454 ¸½ºß¤Î¾õÂÖ¤òÆɤ߹þ¤à¤Î¤Ë»ÈÍѤµ¤ì¤ë¡£
455 ¤³¤ì¤é¤Î¥Õ¥é¥°¤ò»È¤¦¾ì¹ç¡¢
456 .BR RTC_AIE_ON " ¤È " RTC_AIE_OFF
461 ¤Ç»ÈÍѤµ¤ì¡¢½èÍýÂÔ¤Á¤Î³ä¤ê¹þ¤ß¤òɽ¼¨¤¹¤ë
462 (EFI ¥Õ¥¡¡¼¥à¥¦¥§¥¢¤Ç´ÉÍý¤µ¤ì¤ë RTC ¤ÈÄÌ¿®¤¹¤ë¤È¤°Ê³°¡¢
463 Linux ¤Ç¤Ï¤Û¤È¤ó¤ÉÌò¤ËΩ¤¿¤Ê¤¤)¡£
466 .\"O field is as used with
475 .\"O fields are also valid.
481 ¤Î¾ì¹ç¤ÈƱ¤¸¤è¤¦¤Ë»ÈÍѤµ¤ì¤ë¤¬¡¢
485 ¥Õ¥£¡¼¥ë¥É¤â͸ú¤Ç¤¢¤ë¤È¤¤¤¦ÅÀ¤¬°Û¤Ê¤ë¡£
486 .\"O A pointer to this structure should be passed as the third
489 ¤³¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤ò
491 ¤ÎÂè 3 °ú¤¿ô¤È¤·¤ÆÅϤµ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
496 .\"O .IR /dev/rtc1 ", "
498 .\"O etc: RTC special character device files.
500 RTC Æü쥥ã¥é¥¯¥¿¡¼¥Ç¥Ð¥¤¥¹¥Õ¥¡¥¤¥ë
502 .IR /proc/driver/rtc :
503 .\"O status of the (first) RTC.
504 (1 ¤ÄÌܤÎ) RTC ¤Î¾õÂÖ
507 .\"O When the kernel's system time is synchronized with an external
509 .\"O .BR adjtimex (2)
510 .\"O it will update a designated RTC periodically every 11 minutes.
511 .\"O To do so, the kernel has to briefly turn off periodic interrupts;
512 .\"O this might affect programs using that RTC.
513 ¥«¡¼¥Í¥ë¤Î¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ò
515 ¤ò»È¤Ã¤Æ³°Éô»²¾È¤ÇƱ´ü¤µ¤»¤ë¾ì¹ç¡¢
517 ¤Ï»ØÄꤵ¤ì¤¿ RTC ¤ò 11 ʬËè¤ËÄê´üŪ¤Ë¹¹¿·¤¹¤ë¡£
518 ¤³¤ì¤ò¹Ô¤¦¤¿¤á¥«¡¼¥Í¥ë¤Ï¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¤òû´ü´Ö̵¸ú¤Ë¤¹¤ëɬÍפ¬¤¢¤ë¡£
519 ¤³¤ì¤Ï RTC ¤ò»È¤¦¥×¥í¥°¥é¥à¤Ë±Æ¶Á¤òÍ¿¤¨¤ë¡£
521 .\"O An RTC's Epoch has nothing to do with the POSIX Epoch which is only
522 .\"O used for the system clock.
523 RTC ¤Îµª¸µ¤Ï¡¢¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤Ç¤Î¤ß»ÈÍѤµ¤ì¤ë
524 POSIX ¤Îµª¸µ¤È¤Ï²¿¤Î´Ø·¸¤â¤Ê¤¤¡£
526 .\"O If the year according to the RTC's Epoch and the year register is
527 .\"O less than 1970 it is assumed to be 100 years later, that is, between 2000
529 RTC ¤Îµª¸µ¤Èǯ¤Î¥ì¥¸¥¹¥¿¤Ë´ð¤Å¤¯Ç¯¤¬ 1970 ̤Ëþ¤Ç¤¢¤ë¾ì¹ç¡¢
530 100 ǯ¸å¡¢¤Ä¤Þ¤ê 2000 ¤«¤é 2069 ¤Ç¤¢¤ë¤È²¾Äꤵ¤ì¤ë¡£
532 .\"O Some RTCs support "wildcard" values in alarm fields, to support
533 .\"O scenarios like periodic alarms at fifteen minutes after every hour,
534 .\"O or on the first day of each month.
535 .\"O Such usage is nonportable;
536 .\"O portable user space code only expects a single alarm interrupt, and
537 .\"O will either disable or reinitialize the alarm after receiving it.
538 RTC ¤ÎÃæ¤Ë¤Ï¥¢¥é¡¼¥à¥Õ¥£¡¼¥ë¥É¤Ë
539 ¡Ö¥ï¥¤¥ë¥É¥«¡¼¥É¡×¤ÎÃͤò¥µ¥Ý¡¼¥È¤¹¤ë¤â¤Î¤â¤¢¤ê¡¢
540 Ëè»þ 15 ʬ¤ä³Æ·î¤Î½éÆü¤Ê¤É¡¢Äê´üŪ¤Ê¥¢¥é¡¼¥à¤ò¹Ô¤¦¥·¥Ê¥ê¥ª¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£
541 ¤³¤Î¤è¤¦¤Ê»È¤¤Êý¤Ï°Ü¿¢À¤¬¤Ê¤¤¡£
542 °Ü¿¢À¤Î¹â¤¤¥æ¡¼¥¶¶õ´Ö¥³¡¼¥É¤Ç¤Ï¡¢Ã±ÆȤΥ¢¥é¡¼¥à³ä¤ê¹þ¤ß¤À¤±¤òÁÛÄꤷ¡¢
543 ³ä¤ê¹þ¤ß¤Î¼õ¿®¸å¤Ë¥¢¥é¡¼¥à¤ò̵¸ú¤Þ¤¿¤ÏºÆ½é´ü²½¤¹¤Ù¤¤Ç¤¢¤ë¡£
545 .\"O Some RTCs support periodic interrupts with periods that are multiples
546 .\"O of a second rather than fractions of a second;
547 .\"O multiple alarms;
548 .\"O programmable output clock signals;
549 .\"O nonvolatile memory;
550 .\"O and other hardware
551 .\"O capabilities that are not currently exposed by this API.
552 °Ê²¼¤Îµ¡Ç½¤ò¥µ¥Ý¡¼¥È¤¹¤ë RTC ¤â¤¢¤ë¡£
553 1 ÉäÎʬ¿ô¤Ç¤Ï¤Ê¤¯¡¢1 ÉäÎÇÜ¿ô¤ò¼þ´ü¤È¤¹¤ë¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¡£
555 ¥×¥í¥°¥é¥à²Äǽ¤Ê½ÐÎÏ¥¯¥í¥Ã¥¯¥·¥°¥Ê¥ë¡£
556 ÉÔ´øȯÀ (nonvolatile) ¥á¥â¥ê¡£
557 ¤³¤Î API ¤Ç¸½ºßÄ󶡤·¤Æ¤¤¤Ê¤¤¡¢¤½¤Î¾¤Î¥Ï¡¼¥É¥¦¥§¥¢µ¡Ç½¡£
562 .BR gettimeofday (2),
563 .BR settimeofday (2),
569 /usr/src/linux/Documentation/rtc.txt