1 /**
2 * \file
3 *
4 * \brief SAM RSTC
5 *
6 * Copyright (C) 2016 Atmel Corporation. All rights reserved.
7 *
8 * \asf_license_start
9 *
10 * \page License
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 *
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
21 *
22 * 3. The name of Atmel may not be used to endorse or promote products derived
23 * from this software without specific prior written permission.
24 *
25 * 4. This software may only be redistributed and used in connection with an
26 * Atmel microcontroller product.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
39 *
40 * \asf_license_stop
41 */
42
43 #ifdef _SAML21_RSTC_COMPONENT_
44 #ifndef _HRI_RSTC_L21_H_INCLUDED_
45 #define _HRI_RSTC_L21_H_INCLUDED_
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50
51 #include <stdbool.h>
52 #include <hal_atomic.h>
53
54 #if defined(ENABLE_RSTC_CRITICAL_SECTIONS)
55 #define RSTC_CRITICAL_SECTION_ENTER() CRITICAL_SECTION_ENTER()
56 #define RSTC_CRITICAL_SECTION_LEAVE() CRITICAL_SECTION_LEAVE()
57 #else
58 #define RSTC_CRITICAL_SECTION_ENTER()
59 #define RSTC_CRITICAL_SECTION_LEAVE()
60 #endif
61
62 typedef uint16_t hri_rstc_wkcause_reg_t;
63 typedef uint16_t hri_rstc_wken_reg_t;
64 typedef uint16_t hri_rstc_wkpol_reg_t;
65 typedef uint8_t hri_rstc_bkupexit_reg_t;
66 typedef uint8_t hri_rstc_rcause_reg_t;
67 typedef uint8_t hri_rstc_wkdbconf_reg_t;
68
hri_rstc_set_WKDBCONF_WKDBCNT_bf(const void * const hw,hri_rstc_wkdbconf_reg_t mask)69 static inline void hri_rstc_set_WKDBCONF_WKDBCNT_bf(const void *const hw, hri_rstc_wkdbconf_reg_t mask)
70 {
71 RSTC_CRITICAL_SECTION_ENTER();
72 ((Rstc *)hw)->WKDBCONF.reg |= RSTC_WKDBCONF_WKDBCNT(mask);
73 RSTC_CRITICAL_SECTION_LEAVE();
74 }
75
hri_rstc_get_WKDBCONF_WKDBCNT_bf(const void * const hw,hri_rstc_wkdbconf_reg_t mask)76 static inline hri_rstc_wkdbconf_reg_t hri_rstc_get_WKDBCONF_WKDBCNT_bf(const void *const hw,
77 hri_rstc_wkdbconf_reg_t mask)
78 {
79 uint8_t tmp;
80 tmp = ((Rstc *)hw)->WKDBCONF.reg;
81 tmp = (tmp & RSTC_WKDBCONF_WKDBCNT(mask)) >> RSTC_WKDBCONF_WKDBCNT_Pos;
82 return tmp;
83 }
84
hri_rstc_write_WKDBCONF_WKDBCNT_bf(const void * const hw,hri_rstc_wkdbconf_reg_t data)85 static inline void hri_rstc_write_WKDBCONF_WKDBCNT_bf(const void *const hw, hri_rstc_wkdbconf_reg_t data)
86 {
87 uint8_t tmp;
88 RSTC_CRITICAL_SECTION_ENTER();
89 tmp = ((Rstc *)hw)->WKDBCONF.reg;
90 tmp &= ~RSTC_WKDBCONF_WKDBCNT_Msk;
91 tmp |= RSTC_WKDBCONF_WKDBCNT(data);
92 ((Rstc *)hw)->WKDBCONF.reg = tmp;
93 RSTC_CRITICAL_SECTION_LEAVE();
94 }
95
hri_rstc_clear_WKDBCONF_WKDBCNT_bf(const void * const hw,hri_rstc_wkdbconf_reg_t mask)96 static inline void hri_rstc_clear_WKDBCONF_WKDBCNT_bf(const void *const hw, hri_rstc_wkdbconf_reg_t mask)
97 {
98 RSTC_CRITICAL_SECTION_ENTER();
99 ((Rstc *)hw)->WKDBCONF.reg &= ~RSTC_WKDBCONF_WKDBCNT(mask);
100 RSTC_CRITICAL_SECTION_LEAVE();
101 }
102
hri_rstc_toggle_WKDBCONF_WKDBCNT_bf(const void * const hw,hri_rstc_wkdbconf_reg_t mask)103 static inline void hri_rstc_toggle_WKDBCONF_WKDBCNT_bf(const void *const hw, hri_rstc_wkdbconf_reg_t mask)
104 {
105 RSTC_CRITICAL_SECTION_ENTER();
106 ((Rstc *)hw)->WKDBCONF.reg ^= RSTC_WKDBCONF_WKDBCNT(mask);
107 RSTC_CRITICAL_SECTION_LEAVE();
108 }
109
hri_rstc_read_WKDBCONF_WKDBCNT_bf(const void * const hw)110 static inline hri_rstc_wkdbconf_reg_t hri_rstc_read_WKDBCONF_WKDBCNT_bf(const void *const hw)
111 {
112 uint8_t tmp;
113 tmp = ((Rstc *)hw)->WKDBCONF.reg;
114 tmp = (tmp & RSTC_WKDBCONF_WKDBCNT_Msk) >> RSTC_WKDBCONF_WKDBCNT_Pos;
115 return tmp;
116 }
117
hri_rstc_set_WKDBCONF_reg(const void * const hw,hri_rstc_wkdbconf_reg_t mask)118 static inline void hri_rstc_set_WKDBCONF_reg(const void *const hw, hri_rstc_wkdbconf_reg_t mask)
119 {
120 RSTC_CRITICAL_SECTION_ENTER();
121 ((Rstc *)hw)->WKDBCONF.reg |= mask;
122 RSTC_CRITICAL_SECTION_LEAVE();
123 }
124
hri_rstc_get_WKDBCONF_reg(const void * const hw,hri_rstc_wkdbconf_reg_t mask)125 static inline hri_rstc_wkdbconf_reg_t hri_rstc_get_WKDBCONF_reg(const void *const hw, hri_rstc_wkdbconf_reg_t mask)
126 {
127 uint8_t tmp;
128 tmp = ((Rstc *)hw)->WKDBCONF.reg;
129 tmp &= mask;
130 return tmp;
131 }
132
hri_rstc_write_WKDBCONF_reg(const void * const hw,hri_rstc_wkdbconf_reg_t data)133 static inline void hri_rstc_write_WKDBCONF_reg(const void *const hw, hri_rstc_wkdbconf_reg_t data)
134 {
135 RSTC_CRITICAL_SECTION_ENTER();
136 ((Rstc *)hw)->WKDBCONF.reg = data;
137 RSTC_CRITICAL_SECTION_LEAVE();
138 }
139
hri_rstc_clear_WKDBCONF_reg(const void * const hw,hri_rstc_wkdbconf_reg_t mask)140 static inline void hri_rstc_clear_WKDBCONF_reg(const void *const hw, hri_rstc_wkdbconf_reg_t mask)
141 {
142 RSTC_CRITICAL_SECTION_ENTER();
143 ((Rstc *)hw)->WKDBCONF.reg &= ~mask;
144 RSTC_CRITICAL_SECTION_LEAVE();
145 }
146
hri_rstc_toggle_WKDBCONF_reg(const void * const hw,hri_rstc_wkdbconf_reg_t mask)147 static inline void hri_rstc_toggle_WKDBCONF_reg(const void *const hw, hri_rstc_wkdbconf_reg_t mask)
148 {
149 RSTC_CRITICAL_SECTION_ENTER();
150 ((Rstc *)hw)->WKDBCONF.reg ^= mask;
151 RSTC_CRITICAL_SECTION_LEAVE();
152 }
153
hri_rstc_read_WKDBCONF_reg(const void * const hw)154 static inline hri_rstc_wkdbconf_reg_t hri_rstc_read_WKDBCONF_reg(const void *const hw)
155 {
156 return ((Rstc *)hw)->WKDBCONF.reg;
157 }
158
hri_rstc_set_WKPOL_WKPOL_bf(const void * const hw,hri_rstc_wkpol_reg_t mask)159 static inline void hri_rstc_set_WKPOL_WKPOL_bf(const void *const hw, hri_rstc_wkpol_reg_t mask)
160 {
161 RSTC_CRITICAL_SECTION_ENTER();
162 ((Rstc *)hw)->WKPOL.reg |= RSTC_WKPOL_WKPOL(mask);
163 RSTC_CRITICAL_SECTION_LEAVE();
164 }
165
hri_rstc_get_WKPOL_WKPOL_bf(const void * const hw,hri_rstc_wkpol_reg_t mask)166 static inline hri_rstc_wkpol_reg_t hri_rstc_get_WKPOL_WKPOL_bf(const void *const hw, hri_rstc_wkpol_reg_t mask)
167 {
168 uint16_t tmp;
169 tmp = ((Rstc *)hw)->WKPOL.reg;
170 tmp = (tmp & RSTC_WKPOL_WKPOL(mask)) >> RSTC_WKPOL_WKPOL_Pos;
171 return tmp;
172 }
173
hri_rstc_write_WKPOL_WKPOL_bf(const void * const hw,hri_rstc_wkpol_reg_t data)174 static inline void hri_rstc_write_WKPOL_WKPOL_bf(const void *const hw, hri_rstc_wkpol_reg_t data)
175 {
176 uint16_t tmp;
177 RSTC_CRITICAL_SECTION_ENTER();
178 tmp = ((Rstc *)hw)->WKPOL.reg;
179 tmp &= ~RSTC_WKPOL_WKPOL_Msk;
180 tmp |= RSTC_WKPOL_WKPOL(data);
181 ((Rstc *)hw)->WKPOL.reg = tmp;
182 RSTC_CRITICAL_SECTION_LEAVE();
183 }
184
hri_rstc_clear_WKPOL_WKPOL_bf(const void * const hw,hri_rstc_wkpol_reg_t mask)185 static inline void hri_rstc_clear_WKPOL_WKPOL_bf(const void *const hw, hri_rstc_wkpol_reg_t mask)
186 {
187 RSTC_CRITICAL_SECTION_ENTER();
188 ((Rstc *)hw)->WKPOL.reg &= ~RSTC_WKPOL_WKPOL(mask);
189 RSTC_CRITICAL_SECTION_LEAVE();
190 }
191
hri_rstc_toggle_WKPOL_WKPOL_bf(const void * const hw,hri_rstc_wkpol_reg_t mask)192 static inline void hri_rstc_toggle_WKPOL_WKPOL_bf(const void *const hw, hri_rstc_wkpol_reg_t mask)
193 {
194 RSTC_CRITICAL_SECTION_ENTER();
195 ((Rstc *)hw)->WKPOL.reg ^= RSTC_WKPOL_WKPOL(mask);
196 RSTC_CRITICAL_SECTION_LEAVE();
197 }
198
hri_rstc_read_WKPOL_WKPOL_bf(const void * const hw)199 static inline hri_rstc_wkpol_reg_t hri_rstc_read_WKPOL_WKPOL_bf(const void *const hw)
200 {
201 uint16_t tmp;
202 tmp = ((Rstc *)hw)->WKPOL.reg;
203 tmp = (tmp & RSTC_WKPOL_WKPOL_Msk) >> RSTC_WKPOL_WKPOL_Pos;
204 return tmp;
205 }
206
hri_rstc_set_WKPOL_reg(const void * const hw,hri_rstc_wkpol_reg_t mask)207 static inline void hri_rstc_set_WKPOL_reg(const void *const hw, hri_rstc_wkpol_reg_t mask)
208 {
209 RSTC_CRITICAL_SECTION_ENTER();
210 ((Rstc *)hw)->WKPOL.reg |= mask;
211 RSTC_CRITICAL_SECTION_LEAVE();
212 }
213
hri_rstc_get_WKPOL_reg(const void * const hw,hri_rstc_wkpol_reg_t mask)214 static inline hri_rstc_wkpol_reg_t hri_rstc_get_WKPOL_reg(const void *const hw, hri_rstc_wkpol_reg_t mask)
215 {
216 uint16_t tmp;
217 tmp = ((Rstc *)hw)->WKPOL.reg;
218 tmp &= mask;
219 return tmp;
220 }
221
hri_rstc_write_WKPOL_reg(const void * const hw,hri_rstc_wkpol_reg_t data)222 static inline void hri_rstc_write_WKPOL_reg(const void *const hw, hri_rstc_wkpol_reg_t data)
223 {
224 RSTC_CRITICAL_SECTION_ENTER();
225 ((Rstc *)hw)->WKPOL.reg = data;
226 RSTC_CRITICAL_SECTION_LEAVE();
227 }
228
hri_rstc_clear_WKPOL_reg(const void * const hw,hri_rstc_wkpol_reg_t mask)229 static inline void hri_rstc_clear_WKPOL_reg(const void *const hw, hri_rstc_wkpol_reg_t mask)
230 {
231 RSTC_CRITICAL_SECTION_ENTER();
232 ((Rstc *)hw)->WKPOL.reg &= ~mask;
233 RSTC_CRITICAL_SECTION_LEAVE();
234 }
235
hri_rstc_toggle_WKPOL_reg(const void * const hw,hri_rstc_wkpol_reg_t mask)236 static inline void hri_rstc_toggle_WKPOL_reg(const void *const hw, hri_rstc_wkpol_reg_t mask)
237 {
238 RSTC_CRITICAL_SECTION_ENTER();
239 ((Rstc *)hw)->WKPOL.reg ^= mask;
240 RSTC_CRITICAL_SECTION_LEAVE();
241 }
242
hri_rstc_read_WKPOL_reg(const void * const hw)243 static inline hri_rstc_wkpol_reg_t hri_rstc_read_WKPOL_reg(const void *const hw)
244 {
245 return ((Rstc *)hw)->WKPOL.reg;
246 }
247
hri_rstc_set_WKEN_WKEN_bf(const void * const hw,hri_rstc_wken_reg_t mask)248 static inline void hri_rstc_set_WKEN_WKEN_bf(const void *const hw, hri_rstc_wken_reg_t mask)
249 {
250 RSTC_CRITICAL_SECTION_ENTER();
251 ((Rstc *)hw)->WKEN.reg |= RSTC_WKEN_WKEN(mask);
252 RSTC_CRITICAL_SECTION_LEAVE();
253 }
254
hri_rstc_get_WKEN_WKEN_bf(const void * const hw,hri_rstc_wken_reg_t mask)255 static inline hri_rstc_wken_reg_t hri_rstc_get_WKEN_WKEN_bf(const void *const hw, hri_rstc_wken_reg_t mask)
256 {
257 uint16_t tmp;
258 tmp = ((Rstc *)hw)->WKEN.reg;
259 tmp = (tmp & RSTC_WKEN_WKEN(mask)) >> RSTC_WKEN_WKEN_Pos;
260 return tmp;
261 }
262
hri_rstc_write_WKEN_WKEN_bf(const void * const hw,hri_rstc_wken_reg_t data)263 static inline void hri_rstc_write_WKEN_WKEN_bf(const void *const hw, hri_rstc_wken_reg_t data)
264 {
265 uint16_t tmp;
266 RSTC_CRITICAL_SECTION_ENTER();
267 tmp = ((Rstc *)hw)->WKEN.reg;
268 tmp &= ~RSTC_WKEN_WKEN_Msk;
269 tmp |= RSTC_WKEN_WKEN(data);
270 ((Rstc *)hw)->WKEN.reg = tmp;
271 RSTC_CRITICAL_SECTION_LEAVE();
272 }
273
hri_rstc_clear_WKEN_WKEN_bf(const void * const hw,hri_rstc_wken_reg_t mask)274 static inline void hri_rstc_clear_WKEN_WKEN_bf(const void *const hw, hri_rstc_wken_reg_t mask)
275 {
276 RSTC_CRITICAL_SECTION_ENTER();
277 ((Rstc *)hw)->WKEN.reg &= ~RSTC_WKEN_WKEN(mask);
278 RSTC_CRITICAL_SECTION_LEAVE();
279 }
280
hri_rstc_toggle_WKEN_WKEN_bf(const void * const hw,hri_rstc_wken_reg_t mask)281 static inline void hri_rstc_toggle_WKEN_WKEN_bf(const void *const hw, hri_rstc_wken_reg_t mask)
282 {
283 RSTC_CRITICAL_SECTION_ENTER();
284 ((Rstc *)hw)->WKEN.reg ^= RSTC_WKEN_WKEN(mask);
285 RSTC_CRITICAL_SECTION_LEAVE();
286 }
287
hri_rstc_read_WKEN_WKEN_bf(const void * const hw)288 static inline hri_rstc_wken_reg_t hri_rstc_read_WKEN_WKEN_bf(const void *const hw)
289 {
290 uint16_t tmp;
291 tmp = ((Rstc *)hw)->WKEN.reg;
292 tmp = (tmp & RSTC_WKEN_WKEN_Msk) >> RSTC_WKEN_WKEN_Pos;
293 return tmp;
294 }
295
hri_rstc_set_WKEN_reg(const void * const hw,hri_rstc_wken_reg_t mask)296 static inline void hri_rstc_set_WKEN_reg(const void *const hw, hri_rstc_wken_reg_t mask)
297 {
298 RSTC_CRITICAL_SECTION_ENTER();
299 ((Rstc *)hw)->WKEN.reg |= mask;
300 RSTC_CRITICAL_SECTION_LEAVE();
301 }
302
hri_rstc_get_WKEN_reg(const void * const hw,hri_rstc_wken_reg_t mask)303 static inline hri_rstc_wken_reg_t hri_rstc_get_WKEN_reg(const void *const hw, hri_rstc_wken_reg_t mask)
304 {
305 uint16_t tmp;
306 tmp = ((Rstc *)hw)->WKEN.reg;
307 tmp &= mask;
308 return tmp;
309 }
310
hri_rstc_write_WKEN_reg(const void * const hw,hri_rstc_wken_reg_t data)311 static inline void hri_rstc_write_WKEN_reg(const void *const hw, hri_rstc_wken_reg_t data)
312 {
313 RSTC_CRITICAL_SECTION_ENTER();
314 ((Rstc *)hw)->WKEN.reg = data;
315 RSTC_CRITICAL_SECTION_LEAVE();
316 }
317
hri_rstc_clear_WKEN_reg(const void * const hw,hri_rstc_wken_reg_t mask)318 static inline void hri_rstc_clear_WKEN_reg(const void *const hw, hri_rstc_wken_reg_t mask)
319 {
320 RSTC_CRITICAL_SECTION_ENTER();
321 ((Rstc *)hw)->WKEN.reg &= ~mask;
322 RSTC_CRITICAL_SECTION_LEAVE();
323 }
324
hri_rstc_toggle_WKEN_reg(const void * const hw,hri_rstc_wken_reg_t mask)325 static inline void hri_rstc_toggle_WKEN_reg(const void *const hw, hri_rstc_wken_reg_t mask)
326 {
327 RSTC_CRITICAL_SECTION_ENTER();
328 ((Rstc *)hw)->WKEN.reg ^= mask;
329 RSTC_CRITICAL_SECTION_LEAVE();
330 }
331
hri_rstc_read_WKEN_reg(const void * const hw)332 static inline hri_rstc_wken_reg_t hri_rstc_read_WKEN_reg(const void *const hw)
333 {
334 return ((Rstc *)hw)->WKEN.reg;
335 }
336
hri_rstc_set_WKCAUSE_WKCAUSE_bf(const void * const hw,hri_rstc_wkcause_reg_t mask)337 static inline void hri_rstc_set_WKCAUSE_WKCAUSE_bf(const void *const hw, hri_rstc_wkcause_reg_t mask)
338 {
339 RSTC_CRITICAL_SECTION_ENTER();
340 ((Rstc *)hw)->WKCAUSE.reg |= RSTC_WKCAUSE_WKCAUSE(mask);
341 RSTC_CRITICAL_SECTION_LEAVE();
342 }
343
hri_rstc_get_WKCAUSE_WKCAUSE_bf(const void * const hw,hri_rstc_wkcause_reg_t mask)344 static inline hri_rstc_wkcause_reg_t hri_rstc_get_WKCAUSE_WKCAUSE_bf(const void *const hw, hri_rstc_wkcause_reg_t mask)
345 {
346 uint16_t tmp;
347 tmp = ((Rstc *)hw)->WKCAUSE.reg;
348 tmp = (tmp & RSTC_WKCAUSE_WKCAUSE(mask)) >> RSTC_WKCAUSE_WKCAUSE_Pos;
349 return tmp;
350 }
351
hri_rstc_write_WKCAUSE_WKCAUSE_bf(const void * const hw,hri_rstc_wkcause_reg_t data)352 static inline void hri_rstc_write_WKCAUSE_WKCAUSE_bf(const void *const hw, hri_rstc_wkcause_reg_t data)
353 {
354 uint16_t tmp;
355 RSTC_CRITICAL_SECTION_ENTER();
356 tmp = ((Rstc *)hw)->WKCAUSE.reg;
357 tmp &= ~RSTC_WKCAUSE_WKCAUSE_Msk;
358 tmp |= RSTC_WKCAUSE_WKCAUSE(data);
359 ((Rstc *)hw)->WKCAUSE.reg = tmp;
360 RSTC_CRITICAL_SECTION_LEAVE();
361 }
362
hri_rstc_clear_WKCAUSE_WKCAUSE_bf(const void * const hw,hri_rstc_wkcause_reg_t mask)363 static inline void hri_rstc_clear_WKCAUSE_WKCAUSE_bf(const void *const hw, hri_rstc_wkcause_reg_t mask)
364 {
365 RSTC_CRITICAL_SECTION_ENTER();
366 ((Rstc *)hw)->WKCAUSE.reg &= ~RSTC_WKCAUSE_WKCAUSE(mask);
367 RSTC_CRITICAL_SECTION_LEAVE();
368 }
369
hri_rstc_toggle_WKCAUSE_WKCAUSE_bf(const void * const hw,hri_rstc_wkcause_reg_t mask)370 static inline void hri_rstc_toggle_WKCAUSE_WKCAUSE_bf(const void *const hw, hri_rstc_wkcause_reg_t mask)
371 {
372 RSTC_CRITICAL_SECTION_ENTER();
373 ((Rstc *)hw)->WKCAUSE.reg ^= RSTC_WKCAUSE_WKCAUSE(mask);
374 RSTC_CRITICAL_SECTION_LEAVE();
375 }
376
hri_rstc_read_WKCAUSE_WKCAUSE_bf(const void * const hw)377 static inline hri_rstc_wkcause_reg_t hri_rstc_read_WKCAUSE_WKCAUSE_bf(const void *const hw)
378 {
379 uint16_t tmp;
380 tmp = ((Rstc *)hw)->WKCAUSE.reg;
381 tmp = (tmp & RSTC_WKCAUSE_WKCAUSE_Msk) >> RSTC_WKCAUSE_WKCAUSE_Pos;
382 return tmp;
383 }
384
hri_rstc_set_WKCAUSE_reg(const void * const hw,hri_rstc_wkcause_reg_t mask)385 static inline void hri_rstc_set_WKCAUSE_reg(const void *const hw, hri_rstc_wkcause_reg_t mask)
386 {
387 RSTC_CRITICAL_SECTION_ENTER();
388 ((Rstc *)hw)->WKCAUSE.reg |= mask;
389 RSTC_CRITICAL_SECTION_LEAVE();
390 }
391
hri_rstc_get_WKCAUSE_reg(const void * const hw,hri_rstc_wkcause_reg_t mask)392 static inline hri_rstc_wkcause_reg_t hri_rstc_get_WKCAUSE_reg(const void *const hw, hri_rstc_wkcause_reg_t mask)
393 {
394 uint16_t tmp;
395 tmp = ((Rstc *)hw)->WKCAUSE.reg;
396 tmp &= mask;
397 return tmp;
398 }
399
hri_rstc_write_WKCAUSE_reg(const void * const hw,hri_rstc_wkcause_reg_t data)400 static inline void hri_rstc_write_WKCAUSE_reg(const void *const hw, hri_rstc_wkcause_reg_t data)
401 {
402 RSTC_CRITICAL_SECTION_ENTER();
403 ((Rstc *)hw)->WKCAUSE.reg = data;
404 RSTC_CRITICAL_SECTION_LEAVE();
405 }
406
hri_rstc_clear_WKCAUSE_reg(const void * const hw,hri_rstc_wkcause_reg_t mask)407 static inline void hri_rstc_clear_WKCAUSE_reg(const void *const hw, hri_rstc_wkcause_reg_t mask)
408 {
409 RSTC_CRITICAL_SECTION_ENTER();
410 ((Rstc *)hw)->WKCAUSE.reg &= ~mask;
411 RSTC_CRITICAL_SECTION_LEAVE();
412 }
413
hri_rstc_toggle_WKCAUSE_reg(const void * const hw,hri_rstc_wkcause_reg_t mask)414 static inline void hri_rstc_toggle_WKCAUSE_reg(const void *const hw, hri_rstc_wkcause_reg_t mask)
415 {
416 RSTC_CRITICAL_SECTION_ENTER();
417 ((Rstc *)hw)->WKCAUSE.reg ^= mask;
418 RSTC_CRITICAL_SECTION_LEAVE();
419 }
420
hri_rstc_read_WKCAUSE_reg(const void * const hw)421 static inline hri_rstc_wkcause_reg_t hri_rstc_read_WKCAUSE_reg(const void *const hw)
422 {
423 return ((Rstc *)hw)->WKCAUSE.reg;
424 }
425
hri_rstc_get_RCAUSE_POR_bit(const void * const hw)426 static inline bool hri_rstc_get_RCAUSE_POR_bit(const void *const hw)
427 {
428 return (((Rstc *)hw)->RCAUSE.reg & RSTC_RCAUSE_POR) >> RSTC_RCAUSE_POR_Pos;
429 }
430
hri_rstc_get_RCAUSE_BOD12_bit(const void * const hw)431 static inline bool hri_rstc_get_RCAUSE_BOD12_bit(const void *const hw)
432 {
433 return (((Rstc *)hw)->RCAUSE.reg & RSTC_RCAUSE_BOD12) >> RSTC_RCAUSE_BOD12_Pos;
434 }
435
hri_rstc_get_RCAUSE_BOD33_bit(const void * const hw)436 static inline bool hri_rstc_get_RCAUSE_BOD33_bit(const void *const hw)
437 {
438 return (((Rstc *)hw)->RCAUSE.reg & RSTC_RCAUSE_BOD33) >> RSTC_RCAUSE_BOD33_Pos;
439 }
440
hri_rstc_get_RCAUSE_EXT_bit(const void * const hw)441 static inline bool hri_rstc_get_RCAUSE_EXT_bit(const void *const hw)
442 {
443 return (((Rstc *)hw)->RCAUSE.reg & RSTC_RCAUSE_EXT) >> RSTC_RCAUSE_EXT_Pos;
444 }
445
hri_rstc_get_RCAUSE_WDT_bit(const void * const hw)446 static inline bool hri_rstc_get_RCAUSE_WDT_bit(const void *const hw)
447 {
448 return (((Rstc *)hw)->RCAUSE.reg & RSTC_RCAUSE_WDT) >> RSTC_RCAUSE_WDT_Pos;
449 }
450
hri_rstc_get_RCAUSE_SYST_bit(const void * const hw)451 static inline bool hri_rstc_get_RCAUSE_SYST_bit(const void *const hw)
452 {
453 return (((Rstc *)hw)->RCAUSE.reg & RSTC_RCAUSE_SYST) >> RSTC_RCAUSE_SYST_Pos;
454 }
455
hri_rstc_get_RCAUSE_BACKUP_bit(const void * const hw)456 static inline bool hri_rstc_get_RCAUSE_BACKUP_bit(const void *const hw)
457 {
458 return (((Rstc *)hw)->RCAUSE.reg & RSTC_RCAUSE_BACKUP) >> RSTC_RCAUSE_BACKUP_Pos;
459 }
460
hri_rstc_get_RCAUSE_reg(const void * const hw,hri_rstc_rcause_reg_t mask)461 static inline hri_rstc_rcause_reg_t hri_rstc_get_RCAUSE_reg(const void *const hw, hri_rstc_rcause_reg_t mask)
462 {
463 uint8_t tmp;
464 tmp = ((Rstc *)hw)->RCAUSE.reg;
465 tmp &= mask;
466 return tmp;
467 }
468
hri_rstc_read_RCAUSE_reg(const void * const hw)469 static inline hri_rstc_rcause_reg_t hri_rstc_read_RCAUSE_reg(const void *const hw)
470 {
471 return ((Rstc *)hw)->RCAUSE.reg;
472 }
473
hri_rstc_get_BKUPEXIT_EXTWAKE_bit(const void * const hw)474 static inline bool hri_rstc_get_BKUPEXIT_EXTWAKE_bit(const void *const hw)
475 {
476 return (((Rstc *)hw)->BKUPEXIT.reg & RSTC_BKUPEXIT_EXTWAKE) >> RSTC_BKUPEXIT_EXTWAKE_Pos;
477 }
478
hri_rstc_get_BKUPEXIT_RTC_bit(const void * const hw)479 static inline bool hri_rstc_get_BKUPEXIT_RTC_bit(const void *const hw)
480 {
481 return (((Rstc *)hw)->BKUPEXIT.reg & RSTC_BKUPEXIT_RTC) >> RSTC_BKUPEXIT_RTC_Pos;
482 }
483
hri_rstc_get_BKUPEXIT_BBPS_bit(const void * const hw)484 static inline bool hri_rstc_get_BKUPEXIT_BBPS_bit(const void *const hw)
485 {
486 return (((Rstc *)hw)->BKUPEXIT.reg & RSTC_BKUPEXIT_BBPS) >> RSTC_BKUPEXIT_BBPS_Pos;
487 }
488
hri_rstc_get_BKUPEXIT_reg(const void * const hw,hri_rstc_bkupexit_reg_t mask)489 static inline hri_rstc_bkupexit_reg_t hri_rstc_get_BKUPEXIT_reg(const void *const hw, hri_rstc_bkupexit_reg_t mask)
490 {
491 uint8_t tmp;
492 tmp = ((Rstc *)hw)->BKUPEXIT.reg;
493 tmp &= mask;
494 return tmp;
495 }
496
hri_rstc_read_BKUPEXIT_reg(const void * const hw)497 static inline hri_rstc_bkupexit_reg_t hri_rstc_read_BKUPEXIT_reg(const void *const hw)
498 {
499 return ((Rstc *)hw)->BKUPEXIT.reg;
500 }
501
502 #ifdef __cplusplus
503 }
504 #endif
505
506 #endif /* _HRI_RSTC_L21_H_INCLUDED */
507 #endif /* _SAML21_RSTC_COMPONENT_ */
508