1 /* $NetBSD: mk48txxvar.h,v 1.5 2008/03/29 07:20:01 tsutsui Exp $ */
3 * Copyright (c) 2000 The NetBSD Foundation, Inc.
6 * This code is derived from software contributed to The NetBSD Foundation
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
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.
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
33 typedef uint8_t (*mk48txx_nvrd_t
)(struct mk48txx_softc
*, int);
34 typedef void (*mk48txx_nvwr_t
)(struct mk48txx_softc
*, int, uint8_t);
36 struct mk48txx_softc
{
39 bus_space_tag_t sc_bst
; /* bus tag & handle */
40 bus_space_handle_t sc_bsh
; /* */
42 struct todr_chip_handle sc_handle
; /* TODR handle */
43 const char *sc_model
; /* chip model name */
44 bus_size_t sc_nvramsz
; /* Size of NVRAM on the chip */
45 bus_size_t sc_clkoffset
; /* Offset in NVRAM to clock bits */
46 u_int sc_year0
; /* What year is represented on
47 the system by the chip's year
50 #define MK48TXX_NO_CENT_ADJUST 0x0001
52 mk48txx_nvrd_t sc_nvrd
; /* NVRAM/RTC read function */
53 mk48txx_nvwr_t sc_nvwr
; /* NVRAM/RTC write function */
56 /* Chip attach function */
57 void mk48txx_attach(struct mk48txx_softc
*);
59 /* Retrieve size of the on-chip NVRAM area */
60 int mk48txx_get_nvram_size(todr_chip_handle_t
, bus_size_t
*);