blob: d1e6c41dd71508f72fa0f8633e96a9494061102f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
/** @file
*
* Copyright (c) 2011, ARM Limited. All rights reserved.
* Copyright (c) 2015, Hisilicon Limited. All rights reserved.
* Copyright (c) 2015, Linaro Limited. All rights reserved.
*
* This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License
* which accompanies this distribution. The full text of the license may be found at
* http://opensource.org/licenses/bsd-license.php
*
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*
* Based on the files under ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
**/
#ifndef __DS3231_REAL_TIME_CLOCK_H__
#define __DS3231_REAL_TIME_CLOCK_H__
#define DS3231_REGADDR_SECONDS 0x00
#define DS3231_REGADDR_MIUTES 0x01
#define DS3231_REGADDR_HOURS 0x02
#define DS3231_REGADDR_DAY 0x03
#define DS3231_REGADDR_DATE 0x04
#define DS3231_REGADDR_MONTH 0x05
#define DS3231_REGADDR_YEAR 0x06
#define DS3231_REGADDR_ALARM1SEC 0x07
#define DS3231_REGADDR_ALARM1MIN 0x08
#define DS3231_REGADDR_ALARM1HOUR 0x09
#define DS3231_REGADDR_ALARM1DAY 0x0A
#define DS3231_REGADDR_ALARM2MIN 0x0B
#define DS3231_REGADDR_ALARM2HOUR 0x0C
#define DS3231_REGADDR_ALARM2DAY 0x0D
#define DS3231_REGADDR_CONTROL 0x0E
#define DS3231_REGADDR_STATUS 0x0F
#define DS3231_REGADDR_AGOFFSET 0x10
#define DS3231_REGADDR_TEMPMSB 0x11
#define DS3231_REGADDR_TEMPLSB 0x12
typedef union {
struct{
UINT8 A1IE:1;
UINT8 A2IE:1;
UINT8 INTCN:1;
UINT8 RSV:2;
UINT8 CONV:1;
UINT8 BBSQW:1;
UINT8 EOSC_N:1;
}bits;
UINT8 u8;
}RTC_DS3231_CONTROL;
typedef union {
struct{
UINT8 A1F:1;
UINT8 A2F:1;
UINT8 BSY:1;
UINT8 EN32KHZ:2;
UINT8 Rsv:3;
UINT8 OSF:1;
}bits;
UINT8 u8;
}RTC_DS3231_STATUS;
typedef union {
struct{
UINT8 Data:7;
UINT8 Sign:1;
}bits;
UINT8 u8;
}RTC_DS3231_AGOFFSET;
typedef union {
struct{
UINT8 Data:7;
UINT8 Sign:1;
}bits;
UINT8 u8;
}RTC_DS3231_TEMPMSB;
typedef union {
struct{
UINT8 Rsv:6;
UINT8 Data:2;
}bits;
UINT8 u8;
}RTC_DS3231_TEMPLSB;
typedef union {
struct{
UINT8 Seconds:4;
UINT8 Seconds10:3;
UINT8 Rsv:1;
}bits;
UINT8 u8;
}RTC_DS3231_SECONDS;
typedef union {
struct{
UINT8 Minutes:4;
UINT8 Minutes10:3;
UINT8 Rsv:1;
}bits;
UINT8 u8;
}RTC_DS3231_MINUTES;
typedef union {
struct{
UINT8 Hour:4;
UINT8 Hours10:1;
UINT8 PM_20Hours:1;
UINT8 Hour24_n:1;
UINT8 Rsv:1;
}bits;
UINT8 u8;
}RTC_DS3231_HOURS;
typedef union {
struct{
UINT8 Day:3;
UINT8 Rsv:5;
}bits;
UINT8 u8;
}RTC_DS3231_DAY;
typedef union {
struct{
UINT8 Month:4;
UINT8 Month10:1;
UINT8 Rsv:2;
UINT8 Century:1;
}bits;
UINT8 u8;
}RTC_DS3231_MONTH;
typedef union {
struct{
UINT8 Year:4;
UINT8 Year10:4;
}bits;
UINT8 u8;
}RTC_DS3231_YEAR;
typedef union {
struct{
UINT8 Seconds:4;
UINT8 Seconds10:3;
UINT8 A1M1:1;
}bits;
UINT8 u8;
}RTC_DS3231_ALARM1SEC;
typedef union {
struct{
UINT8 Minutes:4;
UINT8 Minutes10:3;
UINT8 A1M2:1;
}bits;
UINT8 u8;
}RTC_DS3231_ALARM1MIN;
typedef union {
struct{
UINT8 Hour:4;
UINT8 Hours10:1;
UINT8 PM_20Hours:1;
UINT8 Hours24:1;
UINT8 A1M3:1;
}bits;
UINT8 u8;
}RTC_DS3231_ALARM1HOUR;
#endif
|