mc146818var.h revision 139749
1139749Simp/*- 2137821Smarius * Copyright (c) 2003 Izumi Tsutsui. All rights reserved. 3137821Smarius * 4137821Smarius * Redistribution and use in source and binary forms, with or without 5137821Smarius * modification, are permitted provided that the following conditions 6137821Smarius * are met: 7137821Smarius * 1. Redistributions of source code must retain the above copyright 8137821Smarius * notice, this list of conditions and the following disclaimer. 9137821Smarius * 2. Redistributions in binary form must reproduce the above copyright 10137821Smarius * notice, this list of conditions and the following disclaimer in the 11137821Smarius * documentation and/or other materials provided with the distribution. 12137821Smarius * 3. The name of the author may not be used to endorse or promote products 13137821Smarius * derived from this software without specific prior written permission. 14137821Smarius * 15137821Smarius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16137821Smarius * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17137821Smarius * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18137821Smarius * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19137821Smarius * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20137821Smarius * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21137821Smarius * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22137821Smarius * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23137821Smarius * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24137821Smarius * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25137821Smarius * 26137821Smarius * from: NetBSD: mc146818var.h,v 1.3 2003/11/24 06:20:40 tsutsui Exp 27137821Smarius * 28137821Smarius * $FreeBSD: head/sys/dev/mc146818/mc146818var.h 139749 2005-01-06 01:43:34Z imp $ 29137821Smarius */ 30137821Smarius 31137821Smariusstruct mc146818_softc { 32137821Smarius bus_space_tag_t sc_bst; /* bus space tag */ 33137821Smarius bus_space_handle_t sc_bsh; /* bus space handle */ 34137821Smarius 35137821Smarius u_char sc_rega; /* register A */ 36137821Smarius u_char sc_regb; /* register B */ 37137821Smarius 38137821Smarius u_int sc_year0; /* year counter offset */ 39137821Smarius u_int sc_flag; /* MD flags */ 40137821Smarius#define MC146818_NO_CENT_ADJUST 0x0001 /* don't adjust century */ 41137821Smarius#define MC146818_BCD 0x0002 /* use BCD mode */ 42137821Smarius#define MC146818_12HR 0x0004 /* use AM/PM mode */ 43137821Smarius 44137821Smarius /* MD chip register read/write functions */ 45137821Smarius u_int (*sc_mcread)(device_t, u_int); 46137821Smarius void (*sc_mcwrite)(device_t, u_int, u_int); 47137821Smarius /* MD century get/set functions */ 48137821Smarius u_int (*sc_getcent)(device_t); 49137821Smarius void (*sc_setcent)(device_t, u_int); 50137821Smarius}; 51137821Smarius 52137821Smarius/* Chip attach function */ 53137821Smariusint mc146818_attach(device_t); 54137821Smarius 55137821Smarius/* Methods for the clock interface */ 56137821Smarius#ifdef notyet 57137821Smariusint mc146818_getsecs(device_t, int *); 58137821Smarius#endif 59137821Smariusint mc146818_gettime(device_t, struct timespec *); 60137821Smariusint mc146818_settime(device_t, struct timespec *); 61