File: rtc.4

package info (click to toggle)
manpages-ja 0.5.0.0.20080615-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 20,508 kB
  • ctags: 1
  • sloc: sh: 13,690; perl: 157; makefile: 114
file content (334 lines) | stat: -rw-r--r-- 10,461 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
.\" rtc.4
.\" Copyright 2002 Urs Thuermann (urs@isnogud.escape.de)
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, write to the Free
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
.\" USA.
.\"
.\" $Id: rtc.4,v 1.4 2005/12/05 17:19:49 urs Exp $
.\"
.\" 2006-02-08 Various additions by mtk
.\" 2006-11-26 cleanup, cover the generic rtc framework; David Brownell
.\"
.\" Japanese Version Copyright (c) 2006-2007 Yuichi SATO
.\"         all rights reserved.
.\" Translated 2006-07-12 by Yuichi SATO <ysato444@yahoo.co.jp>. LDP v2.29
.\" Updated & Modified 2007-01-08 by Yuichi SATO. LDP v2.43
.\"
.TH RTC 4 2006-11-26 "Linux" "Linux Programmer's Manual"
.SH ̾
rtc \- ꥢ륿९å
.SH 
#include <linux/rtc.h>
.sp
.BI "int ioctl(" fd ", RTC_" request ", " param ");"
.SH 
ϥꥢ륿९å (RTC) Υɥ饤ФΥ󥿥եǤ롣

¿Υԥ塼ϡߤΡɻס׻ ("wall clock" time) Ͽ롢
ϡɥå 1 İʾäƤ롣
ϡ֥ꥢ륿९å(RTC) ȸƤФ롣
λפΤ 1 Ĥϡ̾ӤǥХååפƶưΤǡ
ԥ塼ΥåڤäƤ⡢ݻǤ롣
¿ξ硢RTC ϥ顼䤽¾γߤεǽ󶡤롣

Ƥ i386 PC  ACPI ١Υƥˤ RTC 롣
 RTC ϡ PC/AT ¸ߤ
Motorola MC146818 åפȸߴ롣
Τ褦 RTC ϡǤϥޥܡɤ
åץå (֥å) ǼƤ뤳Ȥ¿
򴹲ǽʹŲߤ餤礭ΥХååӤȤäƤ롣

ƥ४å (system-on-chip) ץåȤäƺ줿
Ȥ߹ߥƥȤäPC ʳΥƥǤϡ̤ʼѤƤ롣
Τ褦ʥƥǤϡPC/AT  RTC Ʊǽ󶡤Ƥʤ礬¿

.SS RTC ȥƥ९åΰ㤤
RTC 򥷥ƥ९åȺƱ٤ǤϤʤ
ƥ९åϡͥ˴륽եȥåǤꡢ
եˤ륿ॹʤɤȤȤˡ
.BR gettimeofday (2)

.BR time (2)
Τ˻ѤƤ롣
ƥ९åϡPOSIX ˤ뵪 (Epoch):
Jan 1, 1970, 0:00 UTC 줿ϻäȥߥäɽ
1 ĤΰŪʼǤϥޡߤ"jiffy"  1 
100, 250, 1000 Hz ȤȿǥȤ롣

RTC ȥƥ९åνפʰ㤤ϡ
RTC ϥƥबϾ (֥աפξޤ) ǤưΤФ
ƥ९åưʤǤ롣
ƥ९åϡԤޤǤϡ
POSIX ǤϤʤƥΥ֡Ȼλ路֤ʤ
Τᡢ֡Ȼ䥷ƥϾ֤ (resume) ˤϡ
ƥ९å RTC ȤäƸߤɻ׻ꤵ礬¿
RTC ʤƥǤϡ
¾λפȤäƥƥ९åꤹɬפꡢ
ͥåȥ˥ꡢ() ǡưϤꤹ
.SS RTC εǽ
RTC 
.BR hwclock (8)
ޤϲ ioctl ꥯȤɤ߽񤭤Ǥ롣

դȻ֤򥫥ȤΤ˲äơ
¿ RTC ϰʲΤ褦˳ߤȯǤ롣
.IP * 3
åι (Ĥޤ 1 )
.IP *
2 Hz  8192 Hz ޤǤ 2 ξμȿǡŪʴֳ֡
.IP *
äƻꤷ顼ã
.PP
γ߸ϡ̤ͭˤ̵ˤǤ롣
¿ΥƥǤϡ顼ߤ򥷥ƥ
åץ٥ȤȤǤ롣
Υ٥ȤϡRAM ؤΥڥ (STR, ACPI ƥ S3 ȸƤФ) 
ϥС͡ (ACPI ƥ S4 ȸƤФ) ȤäϾ֤䡢
֥ա(ACPI ƥ S5 ȸƤФ) Ǥ⡢ƥǤ롣
ӤǥХååפ줿 RTC ߤȯǤ륷ƥȡ
Ǥʤƥब롣

.I /dev/rtc
.IR /dev/rtc0 ,
.I /dev/rtc1
ʤɤ)
ǥХ (ޤ) 1 󤷤ץ󤹤뤳ȤǤ
ɤ߹ѤǤ롣
.BR read (2)

.BR select (2)
ƤӽФץϡ
RTC γߤޤ (block) 롣
ߤθ塢ץ long ɤ߽ФȤǤ롣
κDz̥ХȤȯߤμ̤
ɲӥåȥޥǤꡢ
Ĥ 3 ХȤϺǸ
.BR read (2)
ʹߤȯߤβǤ롣
.SS ioctl(2) 󥿥ե
ʲ
.BR ioctl (2)
ꥯȤ RTC ǥХ³줿
եǥץФƤ:
.TP
.B RTC_RD_TIME
RTC λʲι¤Τ֤:
.IP
.in +4n
.nf
struct rtc_time {
    int tm_sec;
    int tm_min;
    int tm_hour;
    int tm_mday;
    int tm_mon;
    int tm_year;
    int tm_wday;     /* ̤ */
    int tm_yday;     /* ̤ */
    int tm_isdst;    /* ̤ */
};
.fi
.in
.IP
ι¤ΤΥեɤ
.BR gmtime (3)
Ƥ
.I tm
¤ΤΥեɤƱ̣ƱϰϤǤ롣
ι¤ΤؤΥݥ󥿤
.BR ioctl (2)
 3 ȤϤ
.TP
.B RTC_SET_TIME
.BR ioctl (2)
 3 ؤ
.I rtc_time
¤Τͤ RTC ꤹ롣
RTC ꤹ硢ץø
(Ĥޤ
.B CAP_SYS_TIME
ѥӥƥ) ʤФʤʤ
.TP
.BR RTC_ALM_READ ", " RTC_ALM_SET
顼बݡȤƤ RTC Фơ
顼ɤ߹ߤԤ
顼ߤϡ
.BR RTC_AIE_ON ", " RTC_AIE_OFF
ȤäơȤ̤ͭޤ̵ˤʤФʤʤ
\fBioctl\fP(2)  3 ϡ
.I rtc_time
¤ΤؤΥݥ󥿤ǤʤФʤʤ
ι¤Τ
.IR tm_sec ,
.IR tm_min ,
.I tm_hour
եɤΤߤѤ롣
.TP
.BR RTC_IRQP_READ ", " RTC_IRQP_SET
ŪʳߤݡȤƤ RTC Фơ
Ūʳߤμȿɤ߹ߤԤ
Ūʳߤϡ
.BR RTC_PIE_ON ", " RTC_PIE_OFF
ȤäơȤ̤ͭޤ̵ˤʤФʤʤ
\fBioctl\fP(2)  3 ϡ줾
.I "unsigned long\ *"

.I "unsigned long"
Ǥ롣
ͤ 1 γߤβǤ롣
ǽʼȿϡ2 ξ 2  8192 ϰϤǤ롣
øץ (Ĥޤ
.B CAP_SYS_RESOURCE
ѥӥƥĥץ) Τߤ
.I /proc/sys/dev/rtc/max-user-freq
˽񤫤줿嵭μȿǤ롣
(ΥեˤϥǥեȤ 64 Ȥͤ񤫤Ƥ)
.TP
.BR RTC_AIE_ON ", " RTC_AIE_OFF
顼बݡȤƤ RTC Фơ
顼ߤͭޤ̵ˤ롣
\fBioctl\fP(2)  3 ̵뤵롣
.TP
.BR RTC_UIE_ON ", " RTC_UIE_OFF
1 γߤݡȤƤ RTC Фơ
åγߤͭޤ̵ˤ롣
\fBioctl\fP(2)  3 ̵뤵롣
.TP
.BR RTC_PIE_ON ", " RTC_PIE_OFF
ŪʳߤݡȤƤ RTC Фơ
Ūʳߤͭޤ̵ˤ롣
\fBioctl\fP(2)  3 ̵뤵롣
øץ (Ĥޤ
.B CAP_SYS_RESOURCE
ѥӥƥĥץ) Τߤ
λ
.I /proc/sys/dev/rtc/max-user-freq
˼嵭ͤ˻ꤵƤˡ
ŪʳߤͭˤǤ롣
.TP
.BR RTC_EPOCH_READ ", " RTC_EPOCH_SET
¿ RTC ǯ 8 ӥåȤΥ쥸˥ɲ롣
ǯ 8 ӥåȤΥХʥޤ BCD Ѵ롣
ɤξǤ⡢οͤ RTC εͤѴ롣
¿ΥƥǤ RTC ε 1900 ˽뤬
Alpha  MIPS ǤϡRTC 쥸ǯͤ˱ơ
1952, 1980, 2000 β줫˽롣
Ǥ줾 RTC εɤ߹ߤ꤬ǽ RTC ⤢롣
\fBioctl\fP(2)  3 ϡ줾
.I "unsigned long\ *"

.I "unsigned long"
Ǥ롣
֤ (ޤϻꤵ) ϵǤ롣
RTC εꤹ硢ץø (Ĥޤ
.B CAP_SYS_TIME
ѥӥƥ) ʤФʤʤ
.TP
.BR RTC_WKALM_RD ", " RTC_WKALM_SET
RTC ˤϤ궯Ϥʥ顼।󥿥ե򥵥ݡȤΤ⤢ꡢ
 ioctl ȤȤǡʲΤ褦ʹ¤Τ
RTC Υ顼 (줾) ɤ߽񤭤Ǥ:
.PP
.RS
.in +4n
.nf
struct rtc_wkalrm {
    unsigned char enabled;
    unsigned char pending;
    struct rtc_time time;
};
.fi
.in
.RE
.IP
.I enabled
ե饰ϥ顼ߤͭޤ̵ꡢ
ߤξ֤ɤ߹Τ˻Ѥ롣
Υե饰Ȥ硢
.BR RTC_AIE_ON "  " RTC_AIE_OFF
ϻѤʤ
.I pending
ե饰
.B RTC_WKALM_RD
ǻѤ졢Ԥγߤɽ
(EFI ե०Ǵ RTC ̿Ȥʳ
Linux ǤϤۤȤΩʤ)
.I time
եɤ
.B RTC_ALM_READ

.B RTC_ALM_SET
ξƱ褦˻Ѥ뤬
.IR tm_mday ,
.IR tm_mon ,
.I tm_year
եɤͭǤȤۤʤ롣
ι¤ΤؤΥݥ󥿤
.BR ioctl (2)
 3 ȤϤʤФʤʤ
.SH ե
.IR /dev/rtc ", "
.IR /dev/rtc0 ", "
.I /dev/rtc1
ʤ:
RTC ü쥭饯ǥХե

.IR /proc/driver/rtc :
(1 ܤ) RTC ξ
.SH 
ͥΥƥ९å
.BR adjtimex (2)
ȤäƳȤƱ硢
.BR adjtimex (2)
ϻꤵ줿 RTC  11 ʬŪ˹롣
ԤᥫͥϼŪʳߤû̵ˤɬפ롣
 RTC Ȥץ˱ƶͿ롣

RTC εϡƥ९åǤΤ߻Ѥ
POSIX εȤϲδطʤ

RTC εǯΥ쥸˴Ťǯ 1970 ̤Ǥ硢
100 ǯ塢Ĥޤ 2000  2069 ǤȲꤵ롣

RTC ˤϥ顼եɤ
֥磻ɥɡפͤ򥵥ݡȤΤ⤢ꡢ
 15 ʬƷνʤɡŪʥ顼Ԥʥꥪ򥵥ݡȤ롣
Τ褦ʻȤϰܿʤ
ܿι⤤桼֥ɤǤϡñȤΥ顼ߤꤷ
ߤμ˥顼̵ޤϺƽ٤Ǥ롣

ʲεǽ򥵥ݡȤ RTC ⤢롣
1 äʬǤϤʤ1 äܿȤŪʳߡ
ʣΥ顼ࡣ
ץǽʽϥåʥ롣
Դȯ (non-volatile) ꡣ
 API Ǹ󶡤Ƥʤ¾Υϡɥǽ
.SH Ϣ
.BR hwclock (8),
.BR date (1),
.BR time (2),
.BR stime (2),
.BR gettimeofday (2),
.BR settimeofday (2),
.BR adjtimex (2),
.BR gmtime (3),
.BR time (7),
/usr/src/linux/Documentation/rtc.txt