1202839Sgonzo/*-
2202839Sgonzo * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3202839Sgonzo * All rights reserved.
4202839Sgonzo *
5202839Sgonzo * Redistribution and use in source and binary forms, with or without
6202839Sgonzo * modification, are permitted provided that the following conditions
7202839Sgonzo * are met:
8202839Sgonzo * 1. Redistributions of source code must retain the above copyright
9202839Sgonzo *    notice unmodified, this list of conditions, and the following
10202839Sgonzo *    disclaimer.
11202839Sgonzo * 2. Redistributions in binary form must reproduce the above copyright
12202839Sgonzo *    notice, this list of conditions and the following disclaimer in the
13202839Sgonzo *    documentation and/or other materials provided with the distribution.
14202839Sgonzo *
15202839Sgonzo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16202839Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17202839Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18202839Sgonzo * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19202839Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20202839Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21202839Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22202839Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23202839Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24202839Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25202839Sgonzo * SUCH DAMAGE.
26202839Sgonzo */
27202839Sgonzo
28202839Sgonzo/* $FreeBSD$ */
29202839Sgonzo
30202839Sgonzo#ifndef __PCF2123REG_H__
31202839Sgonzo#define	__PCF2123REG_H__
32202839Sgonzo
33202839Sgonzo/* Control and status */
34202839Sgonzo#define	PCF2123_REG_CTRL1		0x0
35202839Sgonzo#define	PCF2123_REG_CTRL2		0x1
36202839Sgonzo
37202839Sgonzo/* Time and date */
38202839Sgonzo#define	PCF2123_REG_SECONDS		0x2
39202839Sgonzo#define	PCF2123_REG_MINUTES		0x3
40202839Sgonzo#define	PCF2123_REG_HOURS		0x4
41202839Sgonzo#define	PCF2123_REG_DAYS		0x5
42202839Sgonzo#define	PCF2123_REG_WEEKDAYS		0x6
43202839Sgonzo#define	PCF2123_REG_MONTHS		0x7
44202839Sgonzo#define	PCF2123_REG_YEARS		0x8
45202839Sgonzo
46202839Sgonzo/* Alarm registers */
47202839Sgonzo#define	PCF2123_REG_MINUTE_ALARM	0x9
48202839Sgonzo#define	PCF2123_REG_HOUR_ALARM		0xA
49202839Sgonzo#define	PCF2123_REG_DAY_ALARM		0xB
50202839Sgonzo#define	PCF2123_REG_WEEKDAY_ALARM	0xC
51202839Sgonzo
52202839Sgonzo/* Offset */
53202839Sgonzo#define	PCF2123_REG_OFFSET		0xD
54202839Sgonzo
55202839Sgonzo/* Timer */
56202839Sgonzo#define	PCF2123_REG_TIMER_CLKOUT	0xE
57202839Sgonzo#define	PCF2123_REG_COUNTDOWN_TIMER	0xF
58202839Sgonzo
59202839Sgonzo/* Commands */
60202839Sgonzo#define	PCF2123_CMD_READ	(1 << 7)
61202839Sgonzo#define	PCF2123_CMD_WRITE	(0 << 7)
62202839Sgonzo
63202839Sgonzo#define	PCF2123_READ(reg)	(PCF2123_CMD_READ | (1 << 4) | (reg))
64202839Sgonzo#define	PCF2123_WRITE(reg)	(PCF2123_CMD_WRITE | (1 << 4) | (reg))
65202839Sgonzo
66202839Sgonzo#endif /* __PCF2123REG_H__ */
67202839Sgonzo
68