Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/man/man9 Add man page for a new time-of-day clock driv...
details: https://anonhg.NetBSD.org/src/rev/e2fa6353c90e
branches: trunk
changeset: 495293:e2fa6353c90e
user: pk <pk%NetBSD.org@localhost>
date: Tue Jul 25 21:12:45 2000 +0000
description:
Add man page for a new time-of-day clock driver interface. Also documents the
already existing clock_secs_to_ymdhms() & clock_ymdhms_to_secs().
diffstat:
share/man/man9/Makefile | 9 ++-
share/man/man9/todr.9 | 137 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+), 3 deletions(-)
diffs (171 lines):
diff -r 1471ab947f49 -r e2fa6353c90e share/man/man9/Makefile
--- a/share/man/man9/Makefile Tue Jul 25 21:02:54 2000 +0000
+++ b/share/man/man9/Makefile Tue Jul 25 21:12:45 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.66 2000/07/14 08:49:41 gmcgarry Exp $
+# $NetBSD: Makefile,v 1.67 2000/07/25 21:12:46 pk Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
@@ -9,8 +9,8 @@
lock.9 log.9 malloc.9 mbuf.9 microtime.9 panic.9 pfil.9 physio.9 \
pool.9 powerhook_establish.9 psignal.9 ratecheck.9 resettodr.9 \
rnd.9 rt_timer.9 shutdownhook_establish.9 \
- sleep.9 softintr.9 spl.9 store.9 time.9 uiomove.9 ucom.9 usbdi.9 uvm.9 \
- wdc.9
+ sleep.9 softintr.9 spl.9 store.9 time.9 todr.9 uiomove.9 ucom.9 \
+ usbdi.9 uvm.9 wdc.9
MLINKS+=arp.9 arp_ifinit.9 arp.9 arpresolve.9 arp.9 arpintr.9
MLINKS+=access.9 kernacc.9 access.9 useracc.9
MLINKS+=bus_space.9 bus_space_alloc.9 bus_space.9 bus_space_barrier.9 \
@@ -137,6 +137,9 @@
uvm.9 uvm_kernacc.9 uvm.9 uvm_useracc.9 uvm.9 uvm_vslock.9 \
uvm.9 uvm_vsunlock.9 uvm.9 uvm_meter.9 uvm.9 uvm_sysctl.9 \
uvm.9 uvm_fork.9 uvm.9 uvm_grow.9 uvm.9 uvm_coredump.9
+MLINKS+=todr.9 todr_gettime.9 todr.9 todr_settime.9 \
+ todr.9 todr_getcal.9 todr.9 todr_setcal.9 \
+ todr.9 clock_ymdhms_to_secs.9 todr.9 clock_secs_to_ymdhms.9
SUBDIR= man9.i386 man9.sun3
diff -r 1471ab947f49 -r e2fa6353c90e share/man/man9/todr.9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man9/todr.9 Tue Jul 25 21:12:45 2000 +0000
@@ -0,0 +1,137 @@
+.\" $NetBSD: todr.9,v 1.1 2000/07/25 21:12:45 pk Exp $
+.\"
+.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd July 22, 2000
+.Dt TODR 9
+.Os
+.Sh NAME
+.Nm todr_gettime
+.Nm todr_settime
+.Nm todr_getcal
+.Nm todr_setcal
+.Nm clock_ymdhms_to_secs
+.Nm clock_secs_to_ymdhms
+.Nd time-of-day clock support
+.Sh SYNOPSIS
+.Fd #include <dev/clock_subr.h>
+.Ft int
+.Fn todr_gettime "todr_chip_handle_t" "struct timeval *"
+.Ft int
+.Fn todr_settime "todr_chip_handle_t" "struct timeval *"
+.Ft int
+.Fn todr_getcal "todr_chip_handle_t" "int *"
+.Ft int
+.Fn todr_setcal "todr_chip_handle_t" "int"
+.Ft void
+.Fn clock_secs_to_ymdhms "int" "struct clock_ymdhms *"
+.Ft time_t
+.Fn clock_ymdhms_to_secs "struct clock_ymdhms *"
+.Sh DESCRIPTION
+The
+.Fn todr_*
+functions provide an interface to read, set and control
+.Qs time-of-day
+devices. The
+.Fa todr_chip_handle_t
+should be obtained from a driver for a particular hardware device that
+implements this interface. Examples of such drivers currently include
+.Xr mk48txx 4
+and
+.Xr intersil7170 4 .
+.Pp
+The
+.Fn todr_gettime
+retrieves the current data and time from the TODR device and returns it
+in the
+.Fa struct timeval
+storage provided by the caller.
+.Fn todr_settime
+sets the date and time in the TODR device represented by
+.Fa todr_chip_handle_t
+according to the
+.Fa struct timeval
+argument.
+.Pp
+.Fn todr_setcal
+specifies a calibration value in PPM units to be programmed in the TODR
+device. Positive values shall speed up the TODR clock, negative values
+shall slow it down. If the device in not capable of handling calibration,
+this function shall return
+.Va EOPNOTSUPP .
+The measurement and calculations necessary to utilize this method is
+expected to be provided by higher-level software modules.
+.Fn todr_getcal
+returns the current calibration (in PPM units) in effect on the TODR device.
+.Pp
+The utilities
+.Fn clock_secs_to_ymdhms
+and
+.Fn clock_ymdhms_to_secs
+are provided to convert a time value in seconds to and from a structure
+representing the date and time as a
+.Aq year,month,day,weekday,hour,minute,seconds
+tuple. This structure is defined as follows:
+.Bd -literal
+struct clock_ymdhms {
+ u_short dt_year; /* Year */
+ u_char dt_mon; /* Month (1-12) */
+ u_char dt_day; /* Day (0-365) */
+ u_char dt_wday; /* Day of week (0-6) */
+ u_char dt_hour; /* Hour (0-23) */
+ u_char dt_min; /* Minute (0-59) */
+ u_char dt_sec; /* Second (0-59) */
+};
+.Ed
+.Pp
+Note: leap years are recognised by these conversion routines.
+.Sh RETURN VALUES
+The
+.Fn todr_*
+functions return 0 if the requested operation was successful;
+otherwise an error code from
+.Aq Pa sys/errno.h
+shall be returned. However, behaviour is undefined if an invalid
+.Fa todr_chip_handle_t
+is passed to any of these functions.
+The
+.Fn clock_secs_to_ymdhms
+and
+.Fn clock_ymdhms_to_secs
+functions never fail.
+.Sh SEE ALSO
+.Xr inittodr 9 ,
+.Xr resettodr 9 ,
+.Xr time 9
Home |
Main Index |
Thread Index |
Old Index