LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rtc_17xx_40xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC17xx/40xx RTC driver
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __RTC_17XX_40XX_H_
33 #define __RTC_17XX_40XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
44 #if RTC_EV_SUPPORT
45 
46 typedef IP_RTC_EV_CHANNEL_T RTC_EV_CHANNEL_T;
48 typedef IP_RTC_EV_MODE_T RTC_EV_MODE_T;
50 typedef IP_RTC_EV_TIMESTAMP_T RTC_EV_TIMESTAMP_T;
51 #endif /*RTC_EV_SUPPORT*/
52 
59 {
61 }
62 
72 {
73  IP_RTC_Enable(pRTC, NewState);
74 }
75 
84 {
85  IP_RTC_CntIncrIntConfig(pRTC, cntrMask, NewState);
86 }
87 
96 {
97  IP_RTC_AlarmIntConfig(pRTC, alarmMask, NewState);
98 }
99 
108 {
109  IP_RTC_SetTime(pRTC, Timetype, TimeValue);
110 }
111 
119 {
120  return IP_RTC_GetTime(pRTC, Timetype);
121 }
122 
130 {
131  IP_RTC_SetFullTime(pRTC, pFullTime);
132 }
133 
141 {
142  IP_RTC_GetFullTime(pRTC, pFullTime);
143 }
144 
153 {
154  IP_RTC_SetAlarmTime(pRTC, Timetype, ALValue);
155 }
156 
164 {
165  return IP_RTC_GetAlarmTime(pRTC, Timetype);
166 }
167 
175 {
176  IP_RTC_SetFullAlarmTime(pRTC, pFullTime);
177 }
178 
186 {
187  IP_RTC_GetFullAlarmTime(pRTC, pFullTime);
188 }
189 
201 STATIC INLINE void Chip_REGFILE_Write(LPC_REGFILE_T *pRegFile, uint8_t index, uint32_t Value)
202 {
203  IP_REGFILE_Write(pRegFile, index, Value);
204 }
205 
217 {
218  return IP_REGFILE_Read(pRegFile, index);
219 }
220 
230 {
231  IP_RTC_CalibCounterCmd(pRTC, NewState);
232 }
233 
243 STATIC INLINE void Chip_RTC_CalibConfig(LPC_RTC_T *pRTC, uint32_t CalibValue, uint8_t CalibDir)
244 {
245  IP_RTC_CalibConfig(pRTC, CalibValue, CalibDir);
246 }
247 
257 {
258  IP_RTC_ClearIntPending(pRTC, IntType);
259 }
260 
270 {
271  return IP_RTC_GetIntPending(pRTC, IntType);
272 }
273 
274 #if RTC_EV_SUPPORT
275 
285 STATIC INLINE void Chip_RTC_EV_Config(LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch, uint32_t flag)
286 {
287  IP_RTC_EV_Config(pRTC, ch, flag);
288 }
289 
296 STATIC INLINE void Chip_RTC_EV_SetMode(LPC_RTC_T *pRTC, RTC_EV_MODE_T mode)
297 {
298  IP_RTC_EV_SetMode(pRTC, mode);
299 }
300 
306 STATIC INLINE uint8_t Chip_RTC_EV_GetStatus(LPC_RTC_T *pRTC)
307 {
308  return IP_RTC_EV_GetStatus(pRTC);
309 }
310 
317 STATIC INLINE void Chip_RTC_EV_ClearStatus(LPC_RTC_T *pRTC, uint32_t flag)
318 {
319  IP_RTC_EV_ClearStatus(pRTC, flag);
320 }
321 
328 STATIC INLINE FlagStatus Chip_RTC_EV_GetChannelStatus(LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch)
329 {
330  return IP_RTC_EV_GetChannelStatus(pRTC, ch);
331 }
332 
339 STATIC INLINE void Chip_RTC_EV_ClearChannelStatus(LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch)
340 {
341  IP_RTC_EV_ClearChannelStatus(pRTC, ch);
342 }
343 
350 STATIC INLINE uint8_t Chip_RTC_EV_GetCounter(LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch)
351 {
352  return IP_RTC_EV_GetCounter(pRTC, ch);
353 }
354 
362 STATIC INLINE void Chip_RTC_EV_GetFirstTimeStamp(LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch, RTC_EV_TIMESTAMP_T *pTimeStamp)
363 {
364  IP_RTC_EV_GetFirstTimeStamp(pRTC, ch, pTimeStamp);
365 }
366 
374 STATIC INLINE void Chip_RTC_EV_GetLastTimeStamp(LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch, RTC_EV_TIMESTAMP_T *pTimeStamp)
375 {
376  IP_RTC_EV_GetLastTimeStamp(pRTC, ch, pTimeStamp);
377 }
378 
379 #endif /*RTC_EV_SUPPORT*/
380 
386 void Chip_RTC_Init(LPC_RTC_T *pRTC);
387 
393 void Chip_RTC_DeInit(LPC_RTC_T *pRTC);
394 
399 #ifdef __cplusplus
400 }
401 #endif
402 
403 #endif /* __RTC_17XX_40XX_H_ */