xref: /netbsd/share/man/man4/mk48txx.4 (revision bf9ec67e)
1.\"	$NetBSD: mk48txx.4,v 1.8 2002/02/25 23:21:15 kleink Exp $
2.\"
3.\" Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Paul Kranenburg.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"        This product includes software developed by the NetBSD
20.\"        Foundation, Inc. and its contributors.
21.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22.\"    contributors may be used to endorse or promote products derived
23.\"    from this software without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.Dd February 25, 2002
38.Dt MK48TXX 4
39.Os
40.Sh NAME
41.Nm mk48txx
42.Nd
43.Tn Mostek time-of-day clock driver
44.Sh SYNOPSIS
45.Fd #include \*[Lt]dev/ic/mk48txxreg.h\*[Gt]
46.Cd "define mk48txx"
47.Cd "file   dev/ic/mk48txx.c    mk48txx"
48.Sh DESCRIPTION
49The
50.Nm
51driver provides access to several models of
52.Tn Mostek
53time-of-day clock chips. Access methods to retrieve and set date and time
54are provided through the
55.Em TODR
56interface defined in
57.Xr todr 9 .
58.Pp
59To tie in instance of this device to the system, use
60.Bd -literal
61typedef uint8_t (*mk48txx_nvrd_t)(bus_space_tag_t bus_tag,
62    bus_space_handle_t bus_handle, int off);
63typedef void (*mk48txx_nvwr_t)(bus_space_tag_t bus_tag,
64    bus_space_handle_t bus_handle, int off, uint8_t datum);
65.Ed
66.nr nS 1
67.Ft "todr_chip_handle_t"
68.Fn mk48txx_attach "bus_space_tag_t bus_tag" "bus_space_handle_t bus_handle" \
69"const char *model" "int year0" \
70"mk48txx_nvrd_t nvread" "mk48txx_nvwr_t nvwrite"
71.Pp
72.Bl -tag -width Dv -offset indent
73.It Fa bus_tag
74.It Fa bus_handle
75Specify bus space access to the chip's non-volatile memory
76.Pq including the clock registers .
77.It Fa model
78The chip model which this instance should serve. Must be one of
79.Dq mk48t02 ,
80.Dq mk48t08 ,
81.Dq mk48t18
82or
83.Dq mk48t59 .
84.It Fa year0
85The actual year represented by the clock's
86.Sq year
87counter. This is generally dependent on the system configuration in which
88the clock device is mounted. For instance, on Sun Microsystems machines
89the convention is to have clock's two-digit year represent the year 1968.
90.It Fa nvread
91.It Fa nvwrite
92Specify alternate access methods for reading resp. writing clock
93device registers.  The default, when
94.Dv NULL
95is passed as an access method, is to access the chip memory
96.Pq and clock registers
97as if they were direct-mapped with using the specified bus space.
98.Pp
99Otherwise, the driver will call the respective function to perform the
100access, passing it the specified bus space and the offset
101.Va off
102of the chip memory
103.Pq or clock register
104location to be read from or written to, respectively.
105.El
106.Pp
107Note that if the resulting date retrieved with the todr_gettime() method
108is earlier that January 1, 1970, the driver will assume that the chip's
109year counter actually represents a year in the 21st century. This
110behaviour can be overridden by setting the global variable
111.Va mk48txx_auto_century_adjust
112to zero.
113.Sh HARDWARE
114The following models are supported:
115.Pp
116.Bl -tag -width indent -offset indent -compact
117.It Tn Mostek MK48T02
118.It Tn Mostek MK48T08
119.It Tn Mostek MK48T18
120.It Tn Mostek MK48T59
121.El
122.Sh SEE ALSO
123.Xr intro 4 ,
124.Xr todr 9
125.Sh HISTORY
126The
127.Nm mk48txx
128driver first appeared in
129.Nx 1.5 .
130.Sh AUTHORS
131The
132.Nm
133driver was written by
134.An Paul Kranenburg
135.Aq pk@netbsd.org .
136