27 #ifndef LPC17XX_RTC_H_
28 #define LPC17XX_RTC_H_
52 #define RTC_ILR_BITMASK ((0x00000003))
54 #define RTC_IRL_RTCCIF ((1<<0))
56 #define RTC_IRL_RTCALF ((1<<1))
62 #define RTC_CCR_BITMASK ((0x00000013))
64 #define RTC_CCR_CLKEN ((1<<0))
66 #define RTC_CCR_CTCRST ((1<<1))
68 #define RTC_CCR_CCALEN ((1<<4))
74 #define RTC_CIIR_IMSEC ((1<<0))
76 #define RTC_CIIR_IMMIN ((1<<1))
78 #define RTC_CIIR_IMHOUR ((1<<2))
80 #define RTC_CIIR_IMDOM ((1<<3))
82 #define RTC_CIIR_IMDOW ((1<<4))
84 #define RTC_CIIR_IMDOY ((1<<5))
86 #define RTC_CIIR_IMMON ((1<<6))
88 #define RTC_CIIR_IMYEAR ((1<<7))
90 #define RTC_CIIR_BITMASK ((0xFF))
96 #define RTC_AMR_AMRSEC ((1<<0))
98 #define RTC_AMR_AMRMIN ((1<<1))
100 #define RTC_AMR_AMRHOUR ((1<<2))
102 #define RTC_AMR_AMRDOM ((1<<3))
104 #define RTC_AMR_AMRDOW ((1<<4))
106 #define RTC_AMR_AMRDOY ((1<<5))
108 #define RTC_AMR_AMRMON ((1<<6))
110 #define RTC_AMR_AMRYEAR ((1<<7))
112 #define RTC_AMR_BITMASK ((0xFF))
118 #define RTC_AUX_RTC_OSCF ((1<<4))
124 #define RTC_AUXEN_RTC_OSCFEN ((1<<4))
130 #define RTC_CTIME0_SECONDS_MASK ((0x3F))
131 #define RTC_CTIME0_MINUTES_MASK ((0x3F00))
132 #define RTC_CTIME0_HOURS_MASK ((0x1F0000))
133 #define RTC_CTIME0_DOW_MASK ((0x7000000))
138 #define RTC_CTIME1_DOM_MASK ((0x1F))
139 #define RTC_CTIME1_MONTH_MASK ((0xF00))
140 #define RTC_CTIME1_YEAR_MASK ((0xFFF0000))
145 #define RTC_CTIME2_DOY_MASK ((0xFFF))
151 #define RTC_SEC_MASK (0x0000003F)
153 #define RTC_MIN_MASK (0x0000003F)
155 #define RTC_HOUR_MASK (0x0000001F)
157 #define RTC_DOM_MASK (0x0000001F)
159 #define RTC_DOW_MASK (0x00000007)
161 #define RTC_DOY_MASK (0x000001FF)
163 #define RTC_MONTH_MASK (0x0000000F)
165 #define RTC_YEAR_MASK (0x00000FFF)
167 #define RTC_SECOND_MAX 59
168 #define RTC_MINUTE_MAX 59
169 #define RTC_HOUR_MAX 23
170 #define RTC_MONTH_MIN 1
171 #define RTC_MONTH_MAX 12
172 #define RTC_DAYOFMONTH_MIN 1
173 #define RTC_DAYOFMONTH_MAX 31
174 #define RTC_DAYOFWEEK_MAX 6
175 #define RTC_DAYOFYEAR_MIN 1
176 #define RTC_DAYOFYEAR_MAX 366
177 #define RTC_YEAR_MAX 4095
184 #define RTC_CALIBRATION_CALVAL_MASK ((0x1FFFF))
186 #define RTC_CALIBRATION_LIBDIR ((1<<17))
188 #define RTC_CALIBRATION_MAX ((0x20000))
190 #define RTC_CALIB_DIR_FORWARD ((uint8_t)(0))
191 #define RTC_CALIB_DIR_BACKWARD ((uint8_t)(1))
196 #define PARAM_RTCx(x) (((uint32_t *)x)==((uint32_t *)LPC_RTC))
199 #define PARAM_RTC_INT(n) ((n==RTC_INT_COUNTER_INCREASE) || (n==RTC_INT_ALARM))
202 #define PARAM_RTC_TIMETYPE(n) ((n==RTC_TIMETYPE_SECOND) || (n==RTC_TIMETYPE_MINUTE) \
203 || (n==RTC_TIMETYPE_HOUR) || (n==RTC_TIMETYPE_DAYOFWEEK) \
204 || (n==RTC_TIMETYPE_DAYOFMONTH) || (n==RTC_TIMETYPE_DAYOFYEAR) \
205 || (n==RTC_TIMETYPE_MONTH) || (n==RTC_TIMETYPE_YEAR))
208 #define PARAM_RTC_CALIB_DIR(n) ((n==RTC_CALIB_DIR_FORWARD) || (n==RTC_CALIB_DIR_BACKWARD))
211 #define PARAM_RTC_GPREG_CH(n) ((n>=0) && (n<=4))