Home | History | Annotate | Line # | Download | only in i2c
rs5c372reg.h revision 1.1
      1 /*	$NetBSD: rs5c372reg.h,v 1.1 2005/08/16 11:09:12 nonaka Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2005 Kimihiro Nonaka
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  * POSSIBILITY OF SUCH DAMAGE.
     27  */
     28 
     29 #ifndef _DEV_I2C_RS5C372REG_H_
     30 #define _DEV_I2C_RS5C372REG_H_
     31 
     32 /*
     33  * RS5C372[AB] Real-Time Clock
     34  */
     35 
     36 #define	RS5C372_ADDR		0x32	/* Fixed I2C Slave Address */
     37 
     38 #define RS5C372_SECONDS		0
     39 #define RS5C372_MINUTES		1
     40 #define RS5C372_HOURS		2
     41 #define RS5C372_DAY		3
     42 #define RS5C372_DATE		4
     43 #define RS5C372_MONTH		5
     44 #define RS5C372_YEAR		6
     45 #define RS5C372_CLOCK_CORRECT	7
     46 #define RS5C372_ALARMA_MIN	8
     47 #define RS5C372_ALARMA_HOUR	9
     48 #define RS5C372_ALARMA_DATE	10
     49 #define RS5C372_ALARMB_MIN	11
     50 #define RS5C372_ALARMB_HOUR	12
     51 #define RS5C372_ALARMB_DATE	13
     52 #define RS5C372_CONTROL1	14
     53 #define RS5C372_CONTROL2	15
     54 #define	RS5C372_NREGS		16
     55 #define	RS5C372_NRTC_REGS	7
     56 
     57 /*
     58  * Bit definitions.
     59  */
     60 #define	RS5C372_SECONDS_MASK	0x7f
     61 #define	RS5C372_MINUTES_MASK	0x7f
     62 #define	RS5C372_HOURS_12HRS_PM	(1u << 5)	/* If 12 hr mode, set = PM */
     63 #define	RS5C372_HOURS_12MASK	0x1f
     64 #define	RS5C372_HOURS_24MASK	0x3f
     65 #define	RS5C372_DAY_MASK	0x07
     66 #define	RS5C372_DATE_MASK	0x3f
     67 #define	RS5C372_MONTH_MASK	0x1f
     68 #define	RS5C372_CONTROL2_24HRS	(1u << 5)
     69 #define	RS5C372_CONTROL2_XSTP	(1u << 4)	/* read */
     70 #define	RS5C372_CONTROL2_ADJ	(1u << 4)	/* write */
     71 #define	RS5C372_CONTROL2_NCLEN	(1u << 3)
     72 #define	RS5C372_CONTROL2_CTFG	(1u << 2)
     73 #define	RS5C372_CONTROL2_AAFG	(1u << 1)
     74 #define	RS5C372_CONTROL2_BAFG	(1u << 0)
     75 
     76 #endif /* _DEV_I2C_RS5C372REG_H_ */
     77