OpenMPTL - STM32F10X
C++ Microprocessor Template Library
rtc.hpp
Go to the documentation of this file.
1 /*
2  * OpenMPTL - C++ Microprocessor Template Library
3  *
4  * Copyright (C) 2012-2017 Axel Burri <axel@tty0.ch>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 /*
22  * This program contains derivative representations of CMSIS System
23  * View Description (SVD) files, and is subject to the "End User
24  * License Agreement for STMicroelectronics" (see "STM_License.html"
25  * in the containing directory).
26  */
27 
28 #ifndef ARCH_REG_RTC_HPP_INCLUDED
29 #define ARCH_REG_RTC_HPP_INCLUDED
30 
31 #include <register.hpp>
32 
33 namespace mptl {
34 
35 /**
36  * Real time clock
37  */
38 struct RTC
39 {
40  static constexpr reg_addr_t base_addr = 0x40002800;
41 
42  /**
43  * RTC Control register high
44  */
45  struct CRH
46  : public reg< std::uint_fast16_t, base_addr + 0x0, rw, 0x0000 >
47  {
48  using SECIE = regbits< type, 0, 1 >; /**< Second interrupt Enable */
49  using ALRIE = regbits< type, 1, 1 >; /**< Alarm interrupt Enable */
50  using OWIE = regbits< type, 2, 1 >; /**< Overflow interrupt Enable */
51  };
52 
53  /**
54  * RTC Control register low
55  */
56  struct CRL
57  : public reg< std::uint_fast16_t, base_addr + 0x4, rw, 0x0020 >
58  {
59  using SECF = regbits< type, 0, 1 >; /**< Second Flag */
60  using ALRF = regbits< type, 1, 1 >; /**< Alarm Flag */
61  using OWF = regbits< type, 2, 1 >; /**< Overflow Flag */
62  using RSF = regbits< type, 3, 1 >; /**< Registers Synchronized Flag */
63  using CNF = regbits< type, 4, 1 >; /**< Configuration Flag */
64  using RTOFF = regbits< type, 5, 1 >; /**< RTC operation OFF */
65  };
66 
67  /**
68  * RTC Prescaler load register high
69  */
70  struct PRLH
71  : public reg< std::uint_fast16_t, base_addr + 0x8, wo, 0x0000 >
72  {
73  using regbits_type = regbits< type, 0, 4 >; /**< RTC Prescaler Load Register High */
74  };
75 
76  /**
77  * RTC Prescaler load register low
78  */
79  struct PRLL
80  : public reg< std::uint_fast16_t, base_addr + 0xc, wo, 0x8000 >
81  {
82  using regbits_type = regbits< type, 0, 16 >; /**< RTC Prescaler Divider Register Low */
83  };
84 
85  /**
86  * RTC Prescaler divider register high
87  */
88  struct DIVH
89  : public reg< std::uint_fast16_t, base_addr + 0x10, ro, 0x0000 >
90  {
91  using regbits_type = regbits< type, 0, 4 >; /**< RTC prescaler divider register high */
92  };
93 
94  /**
95  * RTC Prescaler divider register low
96  */
97  struct DIVL
98  : public reg< std::uint_fast16_t, base_addr + 0x14, ro, 0x8000 >
99  {
100  using regbits_type = regbits< type, 0, 16 >; /**< RTC prescaler divider register Low */
101  };
102 
103  /**
104  * RTC Counter register high
105  */
106  struct CNTH
107  : public reg< std::uint_fast16_t, base_addr + 0x18, rw, 0x0000 >
108  {
109  using regbits_type = regbits< type, 0, 16 >; /**< RTC counter register high */
110  };
111 
112  /**
113  * RTC Counter register low
114  */
115  struct CNTL
116  : public reg< std::uint_fast16_t, base_addr + 0x1c, rw, 0x0000 >
117  {
118  using regbits_type = regbits< type, 0, 16 >; /**< RTC counter register Low */
119  };
120 
121  /**
122  * RTC Alarm register high
123  */
124  struct ALRH
125  : public reg< std::uint_fast16_t, base_addr + 0x20, wo, 0xFFFF >
126  {
127  using regbits_type = regbits< type, 0, 16 >; /**< RTC alarm register high */
128  };
129 
130  /**
131  * RTC Alarm register low
132  */
133  struct ALRL
134  : public reg< std::uint_fast16_t, base_addr + 0x24, wo, 0xFFFF >
135  {
136  using regbits_type = regbits< type, 0, 16 >; /**< RTC alarm register low */
137  };
138 };
139 
140 } // namespace mptl
141 
142 #endif // ARCH_REG_RTC_HPP_INCLUDED
RTC Prescaler divider register high.
Definition: rtc.hpp:88
RTC Prescaler load register low.
Definition: rtc.hpp:79
uintptr_t reg_addr_t
RTC Control register low.
Definition: rtc.hpp:56
static constexpr reg_addr_t base_addr
Definition: rtc.hpp:40
RTC Control register high.
Definition: rtc.hpp:45
RTC Alarm register high.
Definition: rtc.hpp:124
Real time clock.
Definition: rtc.hpp:38
RTC Counter register low.
Definition: rtc.hpp:115
RTC Prescaler load register high.
Definition: rtc.hpp:70
RTC Alarm register low.
Definition: rtc.hpp:133
RTC Prescaler divider register low.
Definition: rtc.hpp:97
RTC Counter register high.
Definition: rtc.hpp:106