1 /**
2  * @file xmc4_rtc.h
3  * @date 2015-05-20
4  *
5  * @cond
6  *********************************************************************************************************************
7  * XMClib v2.1.24 - XMC Peripheral Driver Library
8  *
9  * Copyright (c) 2015-2019, Infineon Technologies AG
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the
13  * following conditions are met:
14  *
15  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
16  * disclaimer.
17  *
18  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
19  * disclaimer in the documentation and/or other materials provided with the distribution.
20  *
21  * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
22  * products derived from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE  FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with
33  * Infineon Technologies AG dave@infineon.com).
34  *********************************************************************************************************************
35  *
36  * Change History
37  * --------------
38  *
39  * 2015-02-20:
40  *     - Initial
41  *
42  * 2015-05-20:
43  *     - Documentation updates <br>
44  *
45  * @endcond
46  *
47  */
48 
49 #ifndef XMC4_RTC_H
50 #define XMC4_RTC_H
51 
52 /**
53  * @addtogroup XMClib XMC Peripheral Library
54  * @{
55  */
56 
57 /**
58  * @addtogroup RTC
59  * @{
60  */
61 
62 /*********************************************************************************************************************
63  * ENUMS
64  *********************************************************************************************************************/
65 
66 /**
67  * Wakeup events for RTC from hibernate domain
68  */
69 typedef enum XMC_RTC_WAKEUP_EVENT
70 {
71   XMC_RTC_WAKEUP_EVENT_ON_ALARM   = RTC_CTR_TAE_Msk,  /**< Wakeup from alarm event */
72   XMC_RTC_WAKEUP_EVENT_ON_SECONDS = RTC_CTR_ESEC_Msk, /**< Wakeup from seconds event */
73   XMC_RTC_WAKEUP_EVENT_ON_MINUTES = RTC_CTR_EMIC_Msk, /**< Wakeup from minutes event */
74   XMC_RTC_WAKEUP_EVENT_ON_HOURS   = RTC_CTR_EHOC_Msk, /**< Wakeup from hours event */
75   XMC_RTC_WAKEUP_EVENT_ON_DAYS    = RTC_CTR_EDAC_Msk, /**< Wakeup from days event */
76   XMC_RTC_WAKEUP_EVENT_ON_MONTHS  = RTC_CTR_EMOC_Msk, /**< Wakeup from months event */
77   XMC_RTC_WAKEUP_EVENT_ON_YEARS   = RTC_CTR_EYEC_Msk  /**< Wakeup from years event */
78 } XMC_RTC_WAKEUP_EVENT_t;
79 
80 /*********************************************************************************************************************
81  * API PROTOTYPES
82  *********************************************************************************************************************/
83 
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87 
88 /**
89  * @param event A valid RTC Wakeup event (::XMC_RTC_WAKEUP_EVENT_t) or a valid combination of
90  *              logically OR'd events
91  * @return None
92  *
93  * \par<b>Description: </b><br>
94  * Enable Wakeup from hibernate mode <br>
95  *
96  * \par
97  * The function sets the bitfields of CTR register to enable wakeup from hibernate mode.
98  * Setting the masking value for the RTC wakeup events containing in the ::XMC_RTC_WAKEUP_EVENT_t
99  * leads to a wakeup from hibernate mode.
100  *
101  * \par<b>Related APIs:</b><br>
102  * XMC_RTC_DisableHibernationWakeUp()
103  */
104 void XMC_RTC_EnableHibernationWakeUp(const uint32_t event);
105 
106 /**
107  * @param event A valid RTC Wakeup event (::XMC_RTC_WAKEUP_EVENT_t) or a valid combination of
108  *              logically OR'd events
109  * @return None
110  *
111  * \par<b>Description: </b><br>
112  * Disable Wakeup from hibernate mode <br>
113  *
114  * \par
115  * The function resets the bitfields of CTR register to disable wakeup from hibernate mode.
116  * Resetting the masking value for the RTC wakeup events containing in the ::XMC_RTC_WAKEUP_EVENT_t
117  * disables wakeup from hibernate mode.
118  *
119  * \par<b>Related APIs:</b><br>
120  * XMC_RTC_EnableHibernationWakeUp()
121  */
122 void XMC_RTC_DisableHibernationWakeUp(const uint32_t event);
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 /**
129  * @}
130  */
131 
132 /**
133  * @}
134  */
135 
136 #endif /* XMC4_RTC_H */
137