Home | History | Annotate | Line # | Download | only in ic
      1 /*	$NetBSD: mm58167var.h,v 1.6 2008/07/06 13:29:50 tsutsui Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Matthew Fredette.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 #ifndef	_MM58167VAR_H
     33 #define	_MM58167VAR_H
     34 
     35 /*
     36  * Driver support for the National Semiconductor MM58167
     37  * time-of-day chip.  See
     38  * http://www.national.com/ds/MM/MM58167B.pdf for data sheets.
     39  */
     40 
     41 struct mm58167_softc {
     42 	device_t	mm58167_dev;
     43 
     44 	/* Pointers to bus_space */
     45 	bus_space_tag_t 	mm58167_regt;
     46 	bus_space_handle_t 	mm58167_regh;
     47 
     48 	/*
     49 	 * Pointers to MM58167 registers.  All of these values are in
     50          * BCD.
     51 	 */
     52 
     53 	/*
     54 	 * The most significant digit of this first value is the
     55 	 * milliseconds unit; least significant digit is undefined:
     56 	 */
     57 	bus_size_t	mm58167_msec_xxx;
     58 	/* both digits of this value make up centiseconds: */
     59 	bus_size_t	mm58167_csec;
     60 	bus_size_t	mm58167_sec;
     61 	bus_size_t	mm58167_min;
     62 	bus_size_t	mm58167_hour;
     63 	bus_size_t	mm58167_wday;
     64 	bus_size_t	mm58167_day;
     65 	bus_size_t	mm58167_mon;
     66 
     67 	/*
     68 	 * The MM58167 has compare latches that line up with the
     69 	 * above, interrupt registers, etc., but we don't use them, so
     70 	 * we don't mention them here.
     71 	 */
     72 	bus_size_t	mm58167_status;		/* bad counter read status */
     73 	bus_size_t	mm58167_go;		/* GO - start at integral seconds */
     74 
     75 	/*
     76 	 * We keep a TODR handle in the softc to save
     77 	 * us from having to allocate it ourselves.
     78 	 * However, only mm58167.c should know this.
     79 	 */
     80 	struct todr_chip_handle _mm58167_todr_handle;
     81 };
     82 
     83 todr_chip_handle_t mm58167_attach(struct mm58167_softc *);
     84 
     85 #endif	/* _MM58167VAR_H */
     86