diff options
Diffstat (limited to 'man4/rtc.4')
-rw-r--r-- | man4/rtc.4 | 66 |
1 files changed, 43 insertions, 23 deletions
@@ -8,30 +8,30 @@ .\" 2006-02-08 Various additions by mtk .\" 2006-11-26 cleanup, cover the generic rtc framework; David Brownell .\" -.TH rtc 4 2023-02-05 "Linux man-pages 6.05.01" +.TH rtc 4 2023-10-31 "Linux man-pages 6.7" .SH NAME rtc \- real-time clock .SH SYNOPSIS .nf #include <linux/rtc.h> -.PP +.P .BI "int ioctl(" fd ", RTC_" request ", " param ");" .fi .SH DESCRIPTION This is the interface to drivers for real-time clocks (RTCs). -.PP +.P Most computers have one or more hardware clocks which record the current "wall clock" time. These are called "Real Time Clocks" (RTCs). One of these usually has battery backup power so that it tracks the time even while the computer is turned off. RTCs often provide alarms and other interrupts. -.PP +.P All i386 PCs, and ACPI-based systems, have an RTC that is compatible with the Motorola MC146818 chip on the original PC/AT. Today such an RTC is usually integrated into the mainboard's chipset (south bridge), and uses a replaceable coin-sized backup battery. -.PP +.P Non-PC systems, such as embedded systems built around system-on-chip processors, use other implementations. They usually won't offer the same functionality as the RTC from a PC/AT. @@ -47,7 +47,7 @@ defined to be the POSIX Epoch: 1970-01-01 00:00:00 +0000 (UTC). (One common implementation counts timer interrupts, once per "jiffy", at a frequency of 100, 250, or 1000 Hz.) That is, it is supposed to report wall clock time, which RTCs also do. -.PP +.P A key difference between an RTC and the system clock is that RTCs run even when the system is in a low power state (including "off"), and the system clock can't. @@ -63,7 +63,7 @@ RTCs can be read and written with or directly with the .BR ioctl (2) requests listed below. -.PP +.P Besides tracking the date and time, many RTCs can also generate interrupts .IP \[bu] 3 @@ -73,7 +73,7 @@ at periodic intervals with a frequency that can be set to any power-of-2 multiple in the range 2 Hz to 8192 Hz; .IP \[bu] on reaching a previously specified alarm time. -.PP +.P Each of those interrupt sources can be enabled or disabled separately. On many systems, the alarm interrupt can be configured as a system wakeup event, which can resume the system from a low power state such as @@ -82,7 +82,7 @@ Hibernation (called S4 in ACPI systems), or even "off" (called S5 in ACPI systems). On some systems, the battery backed RTC can't issue interrupts, but another one can. -.PP +.P The .I /dev/rtc (or @@ -145,7 +145,9 @@ RTC's time the process must be privileged (i.e., have the .B CAP_SYS_TIME capability). .TP -.BR RTC_ALM_READ ", " RTC_ALM_SET +.B RTC_ALM_READ +.TQ +.B RTC_ALM_SET Read and set the alarm time, for RTCs that support alarms. The alarm interrupt must be separately enabled or disabled using the .BR RTC_AIE_ON ", " RTC_AIE_OFF @@ -162,7 +164,9 @@ and .I tm_hour fields of this structure are used. .TP -.BR RTC_IRQP_READ ", " RTC_IRQP_SET +.B RTC_IRQP_READ +.TQ +.B RTC_IRQP_SET Read and set the frequency for periodic interrupts, for RTCs that support periodic interrupts. The periodic interrupt must be separately enabled or disabled using the @@ -184,20 +188,26 @@ capability) can set frequencies above the value specified in .IR /proc/sys/dev/rtc/max\-user\-freq . (This file contains the value 64 by default.) .TP -.BR RTC_AIE_ON ", " RTC_AIE_OFF +.B RTC_AIE_ON +.TQ +.B RTC_AIE_OFF Enable or disable the alarm interrupt, for RTCs that support alarms. The third .BR ioctl (2) argument is ignored. .TP -.BR RTC_UIE_ON ", " RTC_UIE_OFF +.B RTC_UIE_ON +.TQ +.B RTC_UIE_OFF Enable or disable the interrupt on every clock update, for RTCs that support this once-per-second interrupt. The third .BR ioctl (2) argument is ignored. .TP -.BR RTC_PIE_ON ", " RTC_PIE_OFF +.B RTC_PIE_ON +.TQ +.B RTC_PIE_OFF Enable or disable the periodic interrupt, for RTCs that support these periodic interrupts. The third @@ -209,7 +219,9 @@ capability) can enable the periodic interrupt if the frequency is currently set above the value specified in .IR /proc/sys/dev/rtc/max\-user\-freq . .TP -.BR RTC_EPOCH_READ ", " RTC_EPOCH_SET +.B RTC_EPOCH_READ +.TQ +.B RTC_EPOCH_SET Many RTCs encode the year in an 8-bit register which is either interpreted as an 8-bit binary number or as a BCD number. In both cases, @@ -232,10 +244,12 @@ To set the RTC's Epoch the process must be privileged (i.e., have the .B CAP_SYS_TIME capability). .TP -.BR RTC_WKALM_RD ", " RTC_WKALM_SET +.B RTC_WKALM_RD +.TQ +.B RTC_WKALM_SET Some RTCs support a more powerful alarm interface, using these ioctls to read or write the RTC's alarm time (respectively) with this structure: -.PP +.P .RS .in +4n .EX @@ -278,7 +292,13 @@ A pointer to this structure should be passed as the third argument. .SH FILES .TP -.IR /dev/rtc ", " /dev/rtc0 ", " /dev/rtc1 ", etc." +.I /dev/rtc +.TQ +.I /dev/rtc0 +.TQ +.I /dev/rtc1 +.TQ +\&.\|.\|. RTC special character device files. .TP .I /proc/driver/rtc @@ -290,21 +310,21 @@ reference using it will update a designated RTC periodically every 11 minutes. To do so, the kernel has to briefly turn off periodic interrupts; this might affect programs using that RTC. -.PP +.P An RTC's Epoch has nothing to do with the POSIX Epoch which is used only for the system clock. -.PP +.P If the year according to the RTC's Epoch and the year register is less than 1970 it is assumed to be 100 years later, that is, between 2000 and 2069. -.PP +.P Some RTCs support "wildcard" values in alarm fields, to support scenarios like periodic alarms at fifteen minutes after every hour, or on the first day of each month. Such usage is nonportable; portable user-space code expects only a single alarm interrupt, and will either disable or reinitialize the alarm after receiving it. -.PP +.P Some RTCs support periodic interrupts with periods that are multiples of a second rather than fractions of a second; multiple alarms; @@ -322,6 +342,6 @@ capabilities that are not currently exposed by this API. .BR gmtime (3), .BR time (7), .BR hwclock (8) -.PP +.P .I Documentation/rtc.txt in the Linux kernel source tree |