mk48txxvar.h revision 1.6.22.1 1 1.6.22.1 rmind /* $NetBSD: mk48txxvar.h,v 1.6.22.1 2011/03/05 20:53:18 rmind Exp $ */
2 1.1 tsutsui /*-
3 1.1 tsutsui * Copyright (c) 2000 The NetBSD Foundation, Inc.
4 1.1 tsutsui * All rights reserved.
5 1.1 tsutsui *
6 1.1 tsutsui * This code is derived from software contributed to The NetBSD Foundation
7 1.1 tsutsui * by Paul Kranenburg.
8 1.1 tsutsui *
9 1.1 tsutsui * Redistribution and use in source and binary forms, with or without
10 1.1 tsutsui * modification, are permitted provided that the following conditions
11 1.1 tsutsui * are met:
12 1.1 tsutsui * 1. Redistributions of source code must retain the above copyright
13 1.1 tsutsui * notice, this list of conditions and the following disclaimer.
14 1.1 tsutsui * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 tsutsui * notice, this list of conditions and the following disclaimer in the
16 1.1 tsutsui * documentation and/or other materials provided with the distribution.
17 1.1 tsutsui *
18 1.1 tsutsui * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 1.1 tsutsui * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 1.1 tsutsui * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 1.1 tsutsui * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 1.1 tsutsui * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 1.1 tsutsui * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 1.1 tsutsui * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 1.1 tsutsui * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 1.1 tsutsui * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 1.1 tsutsui * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 1.1 tsutsui * POSSIBILITY OF SUCH DAMAGE.
29 1.1 tsutsui */
30 1.1 tsutsui
31 1.1 tsutsui struct mk48txx_softc;
32 1.1 tsutsui
33 1.3 tsutsui typedef uint8_t (*mk48txx_nvrd_t)(struct mk48txx_softc *, int);
34 1.3 tsutsui typedef void (*mk48txx_nvwr_t)(struct mk48txx_softc *, int, uint8_t);
35 1.1 tsutsui
36 1.1 tsutsui struct mk48txx_softc {
37 1.5 tsutsui device_t sc_dev;
38 1.1 tsutsui
39 1.1 tsutsui bus_space_tag_t sc_bst; /* bus tag & handle */
40 1.1 tsutsui bus_space_handle_t sc_bsh; /* */
41 1.1 tsutsui
42 1.1 tsutsui struct todr_chip_handle sc_handle; /* TODR handle */
43 1.1 tsutsui const char *sc_model; /* chip model name */
44 1.1 tsutsui bus_size_t sc_nvramsz; /* Size of NVRAM on the chip */
45 1.1 tsutsui bus_size_t sc_clkoffset; /* Offset in NVRAM to clock bits */
46 1.1 tsutsui u_int sc_year0; /* What year is represented on
47 1.1 tsutsui the system by the chip's year
48 1.1 tsutsui counter at 0 */
49 1.1 tsutsui u_int sc_flag;
50 1.1 tsutsui #define MK48TXX_NO_CENT_ADJUST 0x0001
51 1.6.22.1 rmind #define MK48TXX_HAVE_CENT_REG 0x0002
52 1.1 tsutsui
53 1.1 tsutsui mk48txx_nvrd_t sc_nvrd; /* NVRAM/RTC read function */
54 1.1 tsutsui mk48txx_nvwr_t sc_nvwr; /* NVRAM/RTC write function */
55 1.1 tsutsui };
56 1.1 tsutsui
57 1.1 tsutsui /* Chip attach function */
58 1.1 tsutsui void mk48txx_attach(struct mk48txx_softc *);
59 1.1 tsutsui
60 1.1 tsutsui /* Retrieve size of the on-chip NVRAM area */
61 1.1 tsutsui int mk48txx_get_nvram_size(todr_chip_handle_t, bus_size_t *);
62