mc146818var.h revision 139749
1158124Smarcel/*-
2158124Smarcel * Copyright (c) 2003 Izumi Tsutsui.  All rights reserved.
3158124Smarcel *
4158124Smarcel * Redistribution and use in source and binary forms, with or without
5158124Smarcel * modification, are permitted provided that the following conditions
6158124Smarcel * are met:
7158124Smarcel * 1. Redistributions of source code must retain the above copyright
8158124Smarcel *    notice, this list of conditions and the following disclaimer.
9158124Smarcel * 2. Redistributions in binary form must reproduce the above copyright
10158124Smarcel *    notice, this list of conditions and the following disclaimer in the
11158124Smarcel *    documentation and/or other materials provided with the distribution.
12158124Smarcel * 3. The name of the author may not be used to endorse or promote products
13158124Smarcel *    derived from this software without specific prior written permission.
14158124Smarcel *
15158124Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16158124Smarcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17158124Smarcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18158124Smarcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19158124Smarcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20158124Smarcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21158124Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22158124Smarcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23158124Smarcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24158124Smarcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25158124Smarcel *
26158124Smarcel *	from: NetBSD: mc146818var.h,v 1.3 2003/11/24 06:20:40 tsutsui Exp
27158124Smarcel *
28158124Smarcel * $FreeBSD: head/sys/dev/mc146818/mc146818var.h 139749 2005-01-06 01:43:34Z imp $
29158124Smarcel */
30158124Smarcel
31158124Smarcelstruct mc146818_softc {
32158124Smarcel	bus_space_tag_t	sc_bst;			/* bus space tag */
33158124Smarcel	bus_space_handle_t sc_bsh;		/* bus space handle */
34158124Smarcel
35158124Smarcel	u_char sc_rega;				/* register A */
36158124Smarcel	u_char sc_regb;				/* register B */
37158124Smarcel
38158124Smarcel	u_int sc_year0;				/* year counter offset */
39158124Smarcel	u_int sc_flag;				/* MD flags */
40158124Smarcel#define MC146818_NO_CENT_ADJUST	0x0001		/* don't adjust century */
41158124Smarcel#define MC146818_BCD		0x0002		/* use BCD mode */
42158124Smarcel#define MC146818_12HR		0x0004		/* use AM/PM mode */
43
44	/* MD chip register read/write functions */
45	u_int (*sc_mcread)(device_t, u_int);
46	void (*sc_mcwrite)(device_t, u_int, u_int);
47	/* MD century get/set functions */
48	u_int (*sc_getcent)(device_t);
49	void (*sc_setcent)(device_t, u_int);
50};
51
52/* Chip attach function */
53int mc146818_attach(device_t);
54
55/* Methods for the clock interface */
56#ifdef notyet
57int mc146818_getsecs(device_t, int *);
58#endif
59int mc146818_gettime(device_t, struct timespec *);
60int mc146818_settime(device_t, struct timespec *);
61