x1226reg.h revision 1.2 1 1.2 shige /* $NetBSD: x1226reg.h,v 1.2 2004/02/04 12:03:07 shige Exp $ */
2 1.1 shige
3 1.1 shige /*
4 1.1 shige * Copyright (c) 2003 Shigeyuki Fukushima.
5 1.1 shige * All rights reserved.
6 1.1 shige *
7 1.1 shige * Written by Shigeyuki Fukushima for the NetBSD project.
8 1.1 shige *
9 1.1 shige * Redistribution and use in source and binary forms, with or without
10 1.1 shige * modification, are permitted provided that the following conditions
11 1.1 shige * are met:
12 1.1 shige * 1. Redistributions of source code must retain the above copyright
13 1.1 shige * notice, this list of conditions and the following disclaimer.
14 1.1 shige * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 shige * notice, this list of conditions and the following disclaimer in the
16 1.1 shige * documentation and/or other materials provided with the distribution.
17 1.1 shige * 3. All advertising materials mentioning features or use of this software
18 1.1 shige * must display the following acknowledgement:
19 1.1 shige * This product includes software developed for the NetBSD Project by
20 1.1 shige * Shigeyuki Fukushima.
21 1.1 shige * 4. The name of Shigeyuki Fukushima may not be used to endorse
22 1.1 shige * or promote products derived from this software without specific prior
23 1.1 shige * written permission.
24 1.1 shige *
25 1.1 shige * THIS SOFTWARE IS PROVIDED BY SHIGEYUKI FUKUSHIMA ``AS IS'' AND
26 1.1 shige * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 1.1 shige * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 1.1 shige * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SHIGEYUKI FUKUSHIMA
29 1.1 shige * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 1.1 shige * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 1.1 shige * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 1.1 shige * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 1.1 shige * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 1.1 shige * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 1.1 shige * POSSIBILITY OF SUCH DAMAGE.
36 1.1 shige */
37 1.1 shige
38 1.1 shige /*
39 1.1 shige * Xicor X1226 RTC registers
40 1.1 shige */
41 1.1 shige
42 1.1 shige #ifndef _DEV_I2C_X1226REG_H_
43 1.1 shige #define _DEV_I2C_X1226REG_H_
44 1.1 shige
45 1.1 shige /*
46 1.1 shige * Xicor X1226 RTC I2C Address:
47 1.1 shige *
48 1.1 shige * 110 1111
49 1.1 shige */
50 1.1 shige #define X1226_ADDRMASK 0x7f
51 1.1 shige #define X1226_ADDR 0x6f
52 1.1 shige
53 1.1 shige /* XICOR X1226 Device Identifier */
54 1.1 shige #define X1226_DEVID_CCR 0x6f
55 1.1 shige #define X1226_DEVID_EEPROM 0x57
56 1.1 shige
57 1.1 shige /* Watchdog RTC registers */
58 1.1 shige #define X1226_REG_Y2K 0x37 /* bcd century (19/20) */
59 1.1 shige #define X1226_REG_DW 0x36 /* bcd ay of week (0-6) */
60 1.1 shige #define X1226_REG_YR 0x35 /* bcd year (0-99) */
61 1.1 shige #define X1226_REG_MO 0x34 /* bcd onth (1-12) */
62 1.1 shige #define X1226_REG_DT 0x33 /* bcd ay (1-31) */
63 1.1 shige #define X1226_REG_HR 0x32 /* bcd our (0-23) */
64 1.1 shige #define X1226_REG_MN 0x31 /* bcd inute (0-59) */
65 1.1 shige #define X1226_REG_SC 0x30 /* bcd econd (0-59) */
66 1.1 shige #define X1226_REG_RTC_BASE 0x30
67 1.2 shige #define X1226_REG_RTC_SIZE ((X1226_REG_Y2K - X1226_REG_RTC_BASE) + 1)
68 1.1 shige /* Watchdog RTC registers mask */
69 1.1 shige #define X1226_REG_Y2K_MASK 0x39
70 1.1 shige #define X1226_REG_DW_MASK 0x07
71 1.1 shige #define X1226_REG_YR_MASK 0xff
72 1.1 shige #define X1226_REG_MO_MASK 0x1f
73 1.1 shige #define X1226_REG_DT_MASK 0x3f
74 1.1 shige #define X1226_REG_HR12_MASK 0x1f
75 1.1 shige #define X1226_REG_HR24_MASK 0x3f
76 1.1 shige #define X1226_REG_MN_MASK 0x7f
77 1.1 shige #define X1226_REG_SC_MASK 0x7f
78 1.1 shige
79 1.1 shige #define X1226_REG_SR 0x3f
80 1.1 shige #define X1226_CTRL_DTR 0x13
81 1.1 shige #define X1226_CTRL_ATR 0x12
82 1.1 shige #define X1226_CTRL_INT 0x11
83 1.1 shige #define X1226_CTRL_BL 0x10
84 1.1 shige
85 1.1 shige /* NVRAM size (512 x 8 bit) */
86 1.1 shige #define X1226_NVRAM_START 0x0040
87 1.1 shige #define X1226_NVRAM_END 0x00FF
88 1.1 shige #define X1226_NVRAM_SIZE ((X1226_NVRAM_END - X1226_NVRAM_START) + 1)
89 1.1 shige
90 1.1 shige /* XICOR X1226 RTC flags */
91 1.1 shige #define X1226_FLAG_SR_RTCF 0x01
92 1.1 shige #define X1226_FLAG_SR_WEL 0x02
93 1.1 shige #define X1226_FLAG_SR_RWEL 0x04
94 1.1 shige #define X1226_FLAG_SR_AL0 0x20
95 1.1 shige #define X1226_FLAG_SR_AL1 0x40
96 1.1 shige #define X1226_FLAG_SR_BAT 0x80
97 1.1 shige #define X1226_FLAG_HR_12HPM 0x20
98 1.1 shige #define X1226_FLAG_HR_24H 0x80
99 1.1 shige
100 1.1 shige
101 1.1 shige #endif /* _DEV_I2C_X1226REG_H_ */
102