OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man4 / rtc.4
1 .\" rtc.4
2 .\" Copyright 2002 Urs Thuermann (urs@isnogud.escape.de)
3 .\"
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.
8 .\"
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.
13 .\"
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.
18 .\"
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,
22 .\" USA.
23 .\"
24 .\" $Id: rtc.4,v 1.4 2005/12/05 17:19:49 urs Exp $
25 .\"
26 .\" 2006-02-08 Various additions by mtk
27 .\" 2006-11-26 cleanup, cover the generic rtc framework; David Brownell
28 .\"
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
33 .\"
34 .TH RTC 4 2010-02-25 "Linux" "Linux Programmer's Manual"
35 .\"O .SH NAME
36 .SH Ì¾Á°
37 .\"O rtc \- real-time clock
38 rtc \- ¥ê¥¢¥ë¥¿¥¤¥à¥¯¥í¥Ã¥¯
39 .\"O .SH SYNOPSIS
40 .SH ½ñ¼°
41 #include <linux/rtc.h>
42 .sp
43 .BI "int ioctl(" fd ", RTC_" request ", " param ");"
44 .\"O .SH DESCRIPTION
45 .SH ÀâÌÀ
46 .\"O This is the interface to drivers for real-time clocks (RTCs).
47 ¤³¤ì¤Ï¥ê¥¢¥ë¥¿¥¤¥à¥¯¥í¥Ã¥¯ (RTC) ¤Î¥É¥é¥¤¥Ð¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ç¤¢¤ë¡£
48
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 ¤Ï¥¢¥é¡¼¥à¤ä¤½¤Î¾¤Î³ä¤ê¹þ¤ß¤Îµ¡Ç½¤òÄ󶡤¹¤ë¡£
61
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 ¸ò´¹²Äǽ¤Ê¹Å²ß¤¯¤é¤¤¤ÎÂ礭¤µ¤Î¥Ð¥Ã¥¯¥¢¥Ã¥×ÅÅÃÓ¤ò»È¤Ã¤Æ¤¤¤ë¡£
72
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 ¤ÈƱ¤¸µ¡Ç½¤òÄ󶡤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤¬Â¿¤¤¡£
79
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)
85 .\"O and
86 .\"O .BR time (2),
87 .\"O as well as setting timestamps on files, etc.
88 RTC ¤ò¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤Èº®Æ±¤¹¤Ù¤­¤Ç¤Ï¤Ê¤¤¡£
89 ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤Ï¡¢¥«¡¼¥Í¥ë¤Ë´ÉÍý¤µ¤ì¤ë¥½¥Õ¥È¥¦¥§¥¢¥¯¥í¥Ã¥¯¤Ç¤¢¤ê¡¢
90 ¥Õ¥¡¥¤¥ë¤Ë¤è¤ë¥¿¥¤¥à¥¹¥¿¥ó¥×ÀßÄê¤Ê¤É¤È¤È¤â¤Ë¡¢
91 .BR gettimeofday (2)
92 ¤ä
93 .BR time (2)
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 ¤È¤¤¤¦¼þÇÈ¿ô¤Ç¥«¥¦¥ó¥È¤¹¤ë¡£
104
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
125 .SS RTC ¤Îµ¡Ç½
126 .\"O RTCs can be read and written with
127 .\"O .BR hwclock (8),
128 .\"O or directly with the ioctl requests listed below.
129 RTC ¤Ï
130 .BR hwclock (8)
131 ¤Þ¤¿¤Ï²¼µ­¤Î ioctl ¥ê¥¯¥¨¥¹¥È¤ÇÆɤ߽ñ¤­¤¬¤Ç¤­¤ë¡£
132
133 .\"O Besides tracking the date and time, many RTCs can also generate
134 .\"O interrupts
135 ÆüÉդȻþ´Ö¤ò¥«¥¦¥ó¥È¤¹¤ë¤Î¤Ë²Ã¤¨¤Æ¡¢
136 ¿¤¯¤Î RTC ¤Ï°Ê²¼¤Î¤è¤¦¤Ë³ä¤ê¹þ¤ß¤òȯÀ¸¤Ç¤­¤ë¡£
137 .IP * 3
138 .\"O on every clock update (i.e., once per second);
139 ¥¯¥í¥Ã¥¯¤Î¹¹¿·Ëè (¤Ä¤Þ¤ê 1 ÉÃËè)¡£
140 .IP *
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 ¤Î¾è¿ô¤Î¼þÇÈ¿ô¤Ç¡¢Äê´üŪ¤Ê´Ö³Ö¡£
144 .IP *
145 .\"O on reaching a previously specified alarm time.
146 Á°¤â¤Ã¤Æ»ØÄꤷ¤¿¥¢¥é¡¼¥à»þ¹ï¤Ë㤷¤¿»þ¡£
147 .PP
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 ¤Ç¤­¤Ê¤¤¥·¥¹¥Æ¥à¤¬¤¢¤ë¡£
164
165 .\"O The
166 .\"O .I /dev/rtc
167 .\"O (or
168 .\"O .IR /dev/rtc0 ,
169 .\"O .IR /dev/rtc1 ,
170 .\"O etc.)
171 .\"O device can be opened only once (until it is closed) and it is read-only.
172 .I /dev/rtc
173 (¤Þ¤¿¤Ï
174 .IR /dev/rtc0 ,
175 .I /dev/rtc1
176 ¤Ê¤É¤Î)
177 ¥Ç¥Ð¥¤¥¹¤Ï (¥¯¥í¡¼¥º¤µ¤ì¤ë¤Þ¤Ç) 1 ²ó¤·¤«¥ª¡¼¥×¥ó¤¹¤ë¤³¤È¤¬¤Ç¤­¤º¡¢
178 Æɤ߹þ¤ßÀìÍѤǤ¢¤ë¡£
179 .\"O On
180 .\"O .BR read (2)
181 .\"O and
182 .\"O .BR select (2)
183 .\"O the calling process is blocked until the next interrupt from that RTC
184 .\"O is received.
185 .BR read (2)
186 ¤È
187 .BR select (2)
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
194 .\"O last
195 .\"O .BR read (2).
196 ³ä¤ê¹þ¤ß¤Î¸å¡¢¥×¥í¥»¥¹¤Ï long ·¿À°¿ô¤òÆɤ߽Ф¹¤³¤È¤¬¤Ç¤­¤ë¡£
197 ¤³¤ÎÀ°¿ô¤ÎºÇ²¼°Ì¥Ð¥¤¥È¤ÏȯÀ¸¤·¤¿³ä¤ê¹þ¤ß¤Î¼ïÊ̤ò
198 ¥³¡¼¥É²½¤·¤¿¥Ó¥Ã¥È¥Þ¥¹¥¯¤Ç¤¢¤ê¡¢
199 »Ä¤ê¤Î 3 ¥Ð¥¤¥È¤ÏºÇ¸å¤Î
200 .BR read (2)
201 °Ê¹ß¤ËȯÀ¸¤·¤¿³ä¤ê¹þ¤ß¤Î²ó¿ô¤Ç¤¢¤ë¡£
202 .\"O .SS ioctl(2) interface
203 .SS ioctl(2) ¥¤¥ó¥¿¥Õ¥§¡¼¥¹
204 .\"O The following
205 .\"O .BR ioctl (2)
206 .\"O requests are defined on file descriptors connected to RTC devices:
207 °Ê²¼¤Î
208 .BR ioctl (2)
209 ¥ê¥¯¥¨¥¹¥È¤¬ RTC ¥Ç¥Ð¥¤¥¹¤ÎÀܳ¤µ¤ì¤¿
210 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÂФ·¤ÆÄêµÁ¤µ¤ì¤Æ¤¤¤ë:
211 .TP
212 .B RTC_RD_TIME
213 .\"O Returns this RTC's time in the following structure:
214 RTC ¤Î»þ¹ï¤ò°Ê²¼¤Î¹½Â¤ÂΤÇÊÖ¤¹:
215 .IP
216 .in +4n
217 .nf
218 struct rtc_time {
219     int tm_sec;
220     int tm_min;
221     int tm_hour;
222     int tm_mday;
223     int tm_mon;
224     int tm_year;
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;    /* Ì¤»ÈÍÑ */
231 };
232 .fi
233 .in
234 .IP
235 .\"O The fields in this structure have the same meaning and ranges as for the
236 .\"O .I tm
237 .\"O structure described in
238 .\"O .BR gmtime (3).
239 ¤³¤Î¹½Â¤ÂΤΥե£¡¼¥ë¥É¤Ï
240 .BR gmtime (3)
241 ¤ÇÀâÌÀ¤µ¤ì¤Æ¤¤¤ë
242 .I tm
243 ¹½Â¤ÂΤΥե£¡¼¥ë¥É¤ÈƱ¤¸°ÕÌ£¤ÇƱ¤¸ÈϰϤǤ¢¤ë¡£
244 .\"O A pointer to this structure should be passed as the third
245 .\"O .BR ioctl (2)
246 .\"O argument.
247 ¤³¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤ò
248 .BR ioctl (2)
249 ¤ÎÂè 3 °ú¤­¿ô¤È¤·¤ÆÅϤ¹¡£
250 .TP
251 .B RTC_SET_TIME
252 .\"O Sets this RTC's time to the time specified by the
253 .\"O .I rtc_time
254 .\"O structure pointed to by the third
255 .\"O .BR ioctl (2)
256 .\"O argument.
257 .BR ioctl (2)
258 ¤ÎÂè 3 °ú¤­¿ô¤¬»Ø¤¹
259 .I rtc_time
260 ¹½Â¤ÂΤÎÃͤò RTC »þ¹ï¤ËÀßÄꤹ¤ë¡£
261 .\"O To set the
262 .\"O RTC's time the process must be privileged (i.e., have the
263 .\"O .B CAP_SYS_TIME
264 .\"O capability).
265 RTC »þ¹ï¤ÎÀßÄꤹ¤ë¾ì¹ç¡¢¥×¥í¥»¥¹¤ÏÆø¢
266 (¤Ä¤Þ¤ê
267 .B CAP_SYS_TIME
268 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£) ¤ò»ý¤¿¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
269 .TP
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
276 .\"O requests.
277 ¥¢¥é¡¼¥à³ä¤ê¹þ¤ß¤Ï¡¢
278 .BR RTC_AIE_ON ", " RTC_AIE_OFF
279 ¤ò»È¤Ã¤Æ¡¢¤³¤ì¤È¤ÏÊ̤ËÍ­¸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
280 .\"O The third
281 .\"O .BR ioctl (2)
282 .\"O argument is a pointer to an
283 .\"O .I rtc_time
284 .\"O structure.
285 \fBioctl\fP(2) ¤ÎÂè 3 °ú¤­¿ô¤Ï¡¢
286 .I rtc_time
287 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
288 .\"O Only the
289 .\"O .IR tm_sec ,
290 .\"O .IR tm_min ,
291 .\"O and
292 .\"O .I tm_hour
293 .\"O fields of this structure are used.
294 ¤³¤Î¹½Â¤ÂΤÎ
295 .IR tm_sec ,
296 .IR tm_min ,
297 .I tm_hour
298 ¥Õ¥£¡¼¥ë¥É¤Î¤ß¤¬»ÈÍѤµ¤ì¤ë¡£
299 .TP
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
307 .\"O requests.
308 ¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¤Ï¡¢
309 .BR RTC_PIE_ON ", " RTC_PIE_OFF
310 ¤ò»È¤Ã¤Æ¡¢¤³¤ì¤È¤ÏÊ̤ËÍ­¸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
311 .\"O The third
312 .\"O .BR ioctl (2)
313 .\"O argument is an
314 .\"O .I "unsigned long\ *"
315 .\"O or an
316 .\"O .IR "unsigned long" ,
317 .\"O respectively.
318 \fBioctl\fP(2) ¤ÎÂè 3 °ú¤­¿ô¤Ï¡¢¤½¤ì¤¾¤ì
319 .I "unsigned long\ *"
320 ¤È
321 .I "unsigned long"
322 ¤Ç¤¢¤ë¡£
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 .
332 Æø¢¥×¥í¥»¥¹ (¤Ä¤Þ¤ê
333 .B CAP_SYS_RESOURCE
334 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹) ¤Î¤ß¤¬¡¢
335 .I /proc/sys/dev/rtc/max-user-freq
336 ¤Ë½ñ¤«¤ì¤¿¾åµ­¤Î¼þÇÈ¿ô¤òÀßÄê¤Ç¤­¤ë¡£
337 .\"O (This file contains the value 64 by default.)
338 (¤³¤Î¥Õ¥¡¥¤¥ë¤Ë¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç 64 ¤È¤¤¤¦Ãͤ¬½ñ¤«¤ì¤Æ¤¤¤ë)¡£
339 .TP
340 .BR RTC_AIE_ON ", " RTC_AIE_OFF
341 .\"O Enable or disable the alarm interrupt, for RTCs that support alarms.
342 .\"O The third
343 .\"O .BR ioctl (2)
344 .\"O argument is ignored.
345 ¥¢¥é¡¼¥à¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë RTC ¤ËÂФ·¤Æ¡¢
346 ¥¢¥é¡¼¥à³ä¤ê¹þ¤ß¤òÍ­¸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤¹¤ë¡£
347 \fBioctl\fP(2) ¤ÎÂè 3 °ú¤­¿ô¤Ï̵»ë¤µ¤ì¤ë¡£
348 .TP
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.
352 .\"O The third
353 .\"O .BR ioctl (2)
354 .\"O argument is ignored.
355 1 ÉÃËè¤Î³ä¤ê¹þ¤ß¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë RTC ¤ËÂФ·¤Æ¡¢
356 ¥¯¥í¥Ã¥¯¹¹¿·Ëè¤Î³ä¤ê¹þ¤ß¤òÍ­¸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤¹¤ë¡£
357 \fBioctl\fP(2) ¤ÎÂè 3 °ú¤­¿ô¤Ï̵»ë¤µ¤ì¤ë¡£
358 .TP
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.
362 .\"O The third
363 .\"O .BR ioctl (2)
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 .
373 Æø¢¥×¥í¥»¥¹ (¤Ä¤Þ¤ê
374 .B CAP_SYS_RESOURCE
375 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹) ¤Î¤ß¤¬¡¢
376 ¤½¤Î»þÅÀ¤Ç
377 .I /proc/sys/dev/rtc/max-user-freq
378 ¤Ë¼þ´ü¤¬¾åµ­¤ÎÃͤ˻ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¡¢
379 ¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¤òÍ­¸ú¤Ë¤Ç¤­¤ë¡£
380 .TP
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.
384 .\"O In both cases,
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 ¤Î²¿¤ì¤«¤Ë½é´ü²½¤µ¤ì¤ë¡£
396 .\"O With some RTCs,
397 .\"O these operations can be used to read or to set the RTC's Epoch,
398 .\"O respectively.
399 ¤³¤ì¤é¤ÎÁàºî¤Ç¤½¤ì¤¾¤ì RTC ¤Îµª¸µ¤ÎÆɤ߹þ¤ß¤ÈÀßÄ꤬²Äǽ¤Ê RTC ¤â¤¢¤ë¡£
400 .\"O The third
401 .\"O .BR ioctl (2)
402 .\"O argument is a
403 .\"O .I "unsigned long\ *"
404 .\"O or a
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\ *"
409 ¤È
410 .I "unsigned long"
411 ¤Ç¤¢¤ë¡£
412 ÊÖ¤µ¤ì¤ëÃÍ (¤Þ¤¿¤Ï»ØÄꤵ¤ì¤ëÃÍ) ¤Ïµª¸µ¤Ç¤¢¤ë¡£
413 .\"O To set the RTC's Epoch the process must be privileged (i.e., have the
414 .\"O .B CAP_SYS_TIME
415 .\"O capability).
416 RTC ¤Îµª¸µ¤òÀßÄꤹ¤ë¾ì¹ç¡¢¥×¥í¥»¥¹¤ÏÆø¢ (¤Ä¤Þ¤ê
417 .B CAP_SYS_TIME
418 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£) ¤ò»ý¤¿¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
419 .TP
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 ¤Î¥¢¥é¡¼¥à»þ¹ï¤ò (¤½¤ì¤¾¤ì) Æɤ߽ñ¤­¤Ç¤­¤ë:
426 .PP
427 .RS
428 .in +4n
429 .nf
430 struct rtc_wkalrm {
431     unsigned char enabled;
432     unsigned char pending;
433     struct rtc_time time;
434 };
435 .fi
436 .in
437 .RE
438 .IP
439 .\"O The
440 .\"O .I enabled
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
444 .\"O are not used.
445 .\"O The
446 .\"O .I pending
447 .\"O flag is used by
448 .\"O .B RTC_WKALM_RD
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).
452 .I enabled
453 ¥Õ¥é¥°¤Ï¥¢¥é¡¼¥à³ä¤ê¹þ¤ß¤òÍ­¸ú¤Þ¤¿¤Ï̵¸ú¤·¤¿¤ê¡¢
454 ¸½ºß¤Î¾õÂÖ¤òÆɤ߹þ¤à¤Î¤Ë»ÈÍѤµ¤ì¤ë¡£
455 ¤³¤ì¤é¤Î¥Õ¥é¥°¤ò»È¤¦¾ì¹ç¡¢
456 .BR RTC_AIE_ON " ¤È " RTC_AIE_OFF
457 ¤Ï»ÈÍѤµ¤ì¤Ê¤¤¡£
458 .I pending
459 ¥Õ¥é¥°¤Ï
460 .B RTC_WKALM_RD
461 ¤Ç»ÈÍѤµ¤ì¡¢½èÍýÂÔ¤Á¤Î³ä¤ê¹þ¤ß¤òɽ¼¨¤¹¤ë
462 (EFI ¥Õ¥¡¡¼¥à¥¦¥§¥¢¤Ç´ÉÍý¤µ¤ì¤ë RTC ¤ÈÄÌ¿®¤¹¤ë¤È¤­°Ê³°¡¢
463 Linux ¤Ç¤Ï¤Û¤È¤ó¤ÉÌò¤ËΩ¤¿¤Ê¤¤)¡£
464 .\"O The
465 .\"O .I time
466 .\"O field is as used with
467 .\"O .B RTC_ALM_READ
468 .\"O and
469 .\"O .B RTC_ALM_SET
470 .\"O except that the
471 .\"O .IR tm_mday ,
472 .\"O .IR tm_mon ,
473 .\"O and
474 .\"O .I tm_year
475 .\"O fields are also valid.
476 .I time
477 ¥Õ¥£¡¼¥ë¥É¤Ï
478 .B RTC_ALM_READ
479 ¤ä
480 .B RTC_ALM_SET
481 ¤Î¾ì¹ç¤ÈƱ¤¸¤è¤¦¤Ë»ÈÍѤµ¤ì¤ë¤¬¡¢
482 .IR tm_mday ,
483 .IR tm_mon ,
484 .I tm_year
485 ¥Õ¥£¡¼¥ë¥É¤âÍ­¸ú¤Ç¤¢¤ë¤È¤¤¤¦ÅÀ¤¬°Û¤Ê¤ë¡£
486 .\"O A pointer to this structure should be passed as the third
487 .\"O .BR ioctl (2)
488 .\"O argument.
489 ¤³¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤ò
490 .BR ioctl (2)
491 ¤ÎÂè 3 °ú¤­¿ô¤È¤·¤ÆÅϤµ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
492 .\"O .SH FILES
493 .SH ¥Õ¥¡¥¤¥ë
494 .IR /dev/rtc ", "
495 .IR /dev/rtc0 ", "
496 .\"O .IR /dev/rtc1 ", "
497 .I /dev/rtc1
498 .\"O etc: RTC special character device files.
499 ¤Ê¤É:
500 RTC Æü쥭¥ã¥é¥¯¥¿¡¼¥Ç¥Ð¥¤¥¹¥Õ¥¡¥¤¥ë
501
502 .IR /proc/driver/rtc :
503 .\"O status of the (first) RTC.
504 (1 ¤ÄÌܤÎ) RTC ¤Î¾õÂÖ
505 .\"O .SH NOTES
506 .SH Ãí°Õ
507 .\"O When the kernel's system time is synchronized with an external
508 .\"O reference using
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 ¥«¡¼¥Í¥ë¤Î¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ò
514 .BR adjtimex (2)
515 ¤ò»È¤Ã¤Æ³°Éô»²¾È¤ÇƱ´ü¤µ¤»¤ë¾ì¹ç¡¢
516 .BR adjtimex (2)
517 ¤Ï»ØÄꤵ¤ì¤¿ RTC ¤ò 11 Ê¬Ëè¤ËÄê´üŪ¤Ë¹¹¿·¤¹¤ë¡£
518 ¤³¤ì¤ò¹Ô¤¦¤¿¤á¥«¡¼¥Í¥ë¤Ï¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¤òû´ü´Ö̵¸ú¤Ë¤¹¤ëɬÍפ¬¤¢¤ë¡£
519 ¤³¤ì¤Ï RTC ¤ò»È¤¦¥×¥í¥°¥é¥à¤Ë±Æ¶Á¤òÍ¿¤¨¤ë¡£
520
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 ¤Îµª¸µ¤È¤Ï²¿¤Î´Ø·¸¤â¤Ê¤¤¡£
525
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
528 .\"O and 2069.
529 RTC ¤Îµª¸µ¤Èǯ¤Î¥ì¥¸¥¹¥¿¤Ë´ð¤Å¤¯Ç¯¤¬ 1970 Ì¤Ëþ¤Ç¤¢¤ë¾ì¹ç¡¢
530 100 Ç¯¸å¡¢¤Ä¤Þ¤ê 2000 ¤«¤é 2069 ¤Ç¤¢¤ë¤È²¾Äꤵ¤ì¤ë¡£
531
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 ³ä¤ê¹þ¤ß¤Î¼õ¿®¸å¤Ë¥¢¥é¡¼¥à¤ò̵¸ú¤Þ¤¿¤ÏºÆ½é´ü²½¤¹¤Ù¤­¤Ç¤¢¤ë¡£
544
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 ÉäÎÇÜ¿ô¤ò¼þ´ü¤È¤¹¤ë¼þ´üŪ¤Ê³ä¤ê¹þ¤ß¡£
554 Ê£¿ô¤Î¥¢¥é¡¼¥à¡£
555 ¥×¥í¥°¥é¥à²Äǽ¤Ê½ÐÎÏ¥¯¥í¥Ã¥¯¥·¥°¥Ê¥ë¡£
556 ÉÔ´øȯÀ­ (nonvolatile) ¥á¥â¥ê¡£
557 ¤³¤Î API ¤Ç¸½ºßÄ󶡤·¤Æ¤¤¤Ê¤¤¡¢¤½¤Î¾¤Î¥Ï¡¼¥É¥¦¥§¥¢µ¡Ç½¡£
558 .\"O .SH "SEE ALSO"
559 .SH ´ØÏ¢¹àÌÜ
560 .BR date (1),
561 .BR adjtimex (2),
562 .BR gettimeofday (2),
563 .BR settimeofday (2),
564 .BR stime (2),
565 .BR time (2),
566 .BR gmtime (3),
567 .BR time (7),
568 .BR hwclock (8),
569 /usr/src/linux/Documentation/rtc.txt