mc146818var.h revision 146417
1130331Sanholt/*- 2145132Sanholt * Copyright (c) 2003 Izumi Tsutsui. All rights reserved. 3145132Sanholt * 4145132Sanholt * Redistribution and use in source and binary forms, with or without 5130331Sanholt * modification, are permitted provided that the following conditions 6130331Sanholt * are met: 7130331Sanholt * 1. Redistributions of source code must retain the above copyright 8130331Sanholt * notice, this list of conditions and the following disclaimer. 9182080Srnoland * 2. Redistributions in binary form must reproduce the above copyright 10182080Srnoland * notice, this list of conditions and the following disclaimer in the 11182080Srnoland * documentation and/or other materials provided with the distribution. 12182080Srnoland * 3. The name of the author may not be used to endorse or promote products 13182080Srnoland * derived from this software without specific prior written permission. 14182080Srnoland * 15182080Srnoland * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16157617Sanholt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17145132Sanholt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18157617Sanholt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19157617Sanholt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20157617Sanholt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21157617Sanholt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22157617Sanholt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23157617Sanholt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24145132Sanholt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25157617Sanholt * 26157617Sanholt * from: NetBSD: mc146818var.h,v 1.3 2003/11/24 06:20:40 tsutsui Exp 27157617Sanholt * 28145132Sanholt * $FreeBSD: head/sys/dev/mc146818/mc146818var.h 146417 2005-05-19 21:20:42Z marius $ 29157617Sanholt */ 30157617Sanholt 31182080Srnolandstruct mc146818_softc { 32145132Sanholt bus_space_tag_t sc_bst; /* bus space tag */ 33145132Sanholt bus_space_handle_t sc_bsh; /* bus space handle */ 34182080Srnoland 35182080Srnoland struct mtx sc_mtx; /* hardware mutex */ 36182080Srnoland 37157617Sanholt u_char sc_rega; /* register A */ 38157617Sanholt u_char sc_regb; /* register B */ 39182080Srnoland 40182080Srnoland u_int sc_year0; /* year counter offset */ 41182080Srnoland u_int sc_flag; /* MD flags */ 42182080Srnoland#define MC146818_NO_CENT_ADJUST 0x0001 /* don't adjust century */ 43182080Srnoland#define MC146818_BCD 0x0002 /* use BCD mode */ 44182080Srnoland#define MC146818_12HR 0x0004 /* use AM/PM mode */ 45182080Srnoland 46182080Srnoland /* MD chip register read/write functions */ 47182080Srnoland u_int (*sc_mcread)(device_t, u_int); 48182080Srnoland void (*sc_mcwrite)(device_t, u_int, u_int); 49182080Srnoland /* MD century get/set functions */ 50182080Srnoland u_int (*sc_getcent)(device_t); 51182080Srnoland void (*sc_setcent)(device_t, u_int); 52182080Srnoland}; 53182080Srnoland 54182080Srnoland/* Chip attach function */ 55182080Srnolandint mc146818_attach(device_t); 56182080Srnoland 57182080Srnoland/* Methods for the clock interface */ 58157617Sanholt#ifdef notyet 59182080Srnolandint mc146818_getsecs(device_t, int *); 60148211Sanholt#endif 61157617Sanholtint mc146818_gettime(device_t, struct timespec *); 62157617Sanholtint mc146818_settime(device_t, struct timespec *); 63148211Sanholt