1 /**
2 * \file
3 *
4 * \brief SAM ADC
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_ADC_COMPONENT_
44 #ifndef _HRI_ADC_L21_H_INCLUDED_
45 #define _HRI_ADC_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_ADC_CRITICAL_SECTIONS)
55 #define ADC_CRITICAL_SECTION_ENTER() CRITICAL_SECTION_ENTER()
56 #define ADC_CRITICAL_SECTION_LEAVE() CRITICAL_SECTION_LEAVE()
57 #else
58 #define ADC_CRITICAL_SECTION_ENTER()
59 #define ADC_CRITICAL_SECTION_LEAVE()
60 #endif
61
62 typedef uint16_t hri_adc_calib_reg_t;
63 typedef uint16_t hri_adc_ctrlc_reg_t;
64 typedef uint16_t hri_adc_gaincorr_reg_t;
65 typedef uint16_t hri_adc_inputctrl_reg_t;
66 typedef uint16_t hri_adc_offsetcorr_reg_t;
67 typedef uint16_t hri_adc_result_reg_t;
68 typedef uint16_t hri_adc_syncbusy_reg_t;
69 typedef uint16_t hri_adc_winlt_reg_t;
70 typedef uint16_t hri_adc_winut_reg_t;
71 typedef uint32_t hri_adc_seqctrl_reg_t;
72 typedef uint8_t hri_adc_avgctrl_reg_t;
73 typedef uint8_t hri_adc_ctrla_reg_t;
74 typedef uint8_t hri_adc_ctrlb_reg_t;
75 typedef uint8_t hri_adc_dbgctrl_reg_t;
76 typedef uint8_t hri_adc_evctrl_reg_t;
77 typedef uint8_t hri_adc_intenset_reg_t;
78 typedef uint8_t hri_adc_intflag_reg_t;
79 typedef uint8_t hri_adc_refctrl_reg_t;
80 typedef uint8_t hri_adc_sampctrl_reg_t;
81 typedef uint8_t hri_adc_seqstatus_reg_t;
82 typedef uint8_t hri_adc_swtrig_reg_t;
83
hri_adc_wait_for_sync(const void * const hw,hri_adc_syncbusy_reg_t reg)84 static inline void hri_adc_wait_for_sync(const void *const hw, hri_adc_syncbusy_reg_t reg)
85 {
86 while (((Adc *)hw)->SYNCBUSY.reg & reg) {
87 };
88 }
89
hri_adc_is_syncing(const void * const hw,hri_adc_syncbusy_reg_t reg)90 static inline bool hri_adc_is_syncing(const void *const hw, hri_adc_syncbusy_reg_t reg)
91 {
92 return ((Adc *)hw)->SYNCBUSY.reg & reg;
93 }
94
hri_adc_set_INTEN_RESRDY_bit(const void * const hw)95 static inline void hri_adc_set_INTEN_RESRDY_bit(const void *const hw)
96 {
97 ((Adc *)hw)->INTENSET.reg = ADC_INTENSET_RESRDY;
98 }
99
hri_adc_get_INTEN_RESRDY_bit(const void * const hw)100 static inline bool hri_adc_get_INTEN_RESRDY_bit(const void *const hw)
101 {
102 return (((Adc *)hw)->INTENSET.reg & ADC_INTENSET_RESRDY) >> ADC_INTENSET_RESRDY_Pos;
103 }
104
hri_adc_write_INTEN_RESRDY_bit(const void * const hw,bool value)105 static inline void hri_adc_write_INTEN_RESRDY_bit(const void *const hw, bool value)
106 {
107 if (value == 0x0) {
108 ((Adc *)hw)->INTENCLR.reg = ADC_INTENSET_RESRDY;
109 } else {
110 ((Adc *)hw)->INTENSET.reg = ADC_INTENSET_RESRDY;
111 }
112 }
113
hri_adc_clear_INTEN_RESRDY_bit(const void * const hw)114 static inline void hri_adc_clear_INTEN_RESRDY_bit(const void *const hw)
115 {
116 ((Adc *)hw)->INTENCLR.reg = ADC_INTENSET_RESRDY;
117 }
118
hri_adc_set_INTEN_OVERRUN_bit(const void * const hw)119 static inline void hri_adc_set_INTEN_OVERRUN_bit(const void *const hw)
120 {
121 ((Adc *)hw)->INTENSET.reg = ADC_INTENSET_OVERRUN;
122 }
123
hri_adc_get_INTEN_OVERRUN_bit(const void * const hw)124 static inline bool hri_adc_get_INTEN_OVERRUN_bit(const void *const hw)
125 {
126 return (((Adc *)hw)->INTENSET.reg & ADC_INTENSET_OVERRUN) >> ADC_INTENSET_OVERRUN_Pos;
127 }
128
hri_adc_write_INTEN_OVERRUN_bit(const void * const hw,bool value)129 static inline void hri_adc_write_INTEN_OVERRUN_bit(const void *const hw, bool value)
130 {
131 if (value == 0x0) {
132 ((Adc *)hw)->INTENCLR.reg = ADC_INTENSET_OVERRUN;
133 } else {
134 ((Adc *)hw)->INTENSET.reg = ADC_INTENSET_OVERRUN;
135 }
136 }
137
hri_adc_clear_INTEN_OVERRUN_bit(const void * const hw)138 static inline void hri_adc_clear_INTEN_OVERRUN_bit(const void *const hw)
139 {
140 ((Adc *)hw)->INTENCLR.reg = ADC_INTENSET_OVERRUN;
141 }
142
hri_adc_set_INTEN_WINMON_bit(const void * const hw)143 static inline void hri_adc_set_INTEN_WINMON_bit(const void *const hw)
144 {
145 ((Adc *)hw)->INTENSET.reg = ADC_INTENSET_WINMON;
146 }
147
hri_adc_get_INTEN_WINMON_bit(const void * const hw)148 static inline bool hri_adc_get_INTEN_WINMON_bit(const void *const hw)
149 {
150 return (((Adc *)hw)->INTENSET.reg & ADC_INTENSET_WINMON) >> ADC_INTENSET_WINMON_Pos;
151 }
152
hri_adc_write_INTEN_WINMON_bit(const void * const hw,bool value)153 static inline void hri_adc_write_INTEN_WINMON_bit(const void *const hw, bool value)
154 {
155 if (value == 0x0) {
156 ((Adc *)hw)->INTENCLR.reg = ADC_INTENSET_WINMON;
157 } else {
158 ((Adc *)hw)->INTENSET.reg = ADC_INTENSET_WINMON;
159 }
160 }
161
hri_adc_clear_INTEN_WINMON_bit(const void * const hw)162 static inline void hri_adc_clear_INTEN_WINMON_bit(const void *const hw)
163 {
164 ((Adc *)hw)->INTENCLR.reg = ADC_INTENSET_WINMON;
165 }
166
hri_adc_set_INTEN_reg(const void * const hw,hri_adc_intenset_reg_t mask)167 static inline void hri_adc_set_INTEN_reg(const void *const hw, hri_adc_intenset_reg_t mask)
168 {
169 ((Adc *)hw)->INTENSET.reg = mask;
170 }
171
hri_adc_get_INTEN_reg(const void * const hw,hri_adc_intenset_reg_t mask)172 static inline hri_adc_intenset_reg_t hri_adc_get_INTEN_reg(const void *const hw, hri_adc_intenset_reg_t mask)
173 {
174 uint8_t tmp;
175 tmp = ((Adc *)hw)->INTENSET.reg;
176 tmp &= mask;
177 return tmp;
178 }
179
hri_adc_read_INTEN_reg(const void * const hw)180 static inline hri_adc_intenset_reg_t hri_adc_read_INTEN_reg(const void *const hw)
181 {
182 return ((Adc *)hw)->INTENSET.reg;
183 }
184
hri_adc_write_INTEN_reg(const void * const hw,hri_adc_intenset_reg_t data)185 static inline void hri_adc_write_INTEN_reg(const void *const hw, hri_adc_intenset_reg_t data)
186 {
187 ((Adc *)hw)->INTENSET.reg = data;
188 ((Adc *)hw)->INTENCLR.reg = ~data;
189 }
190
hri_adc_clear_INTEN_reg(const void * const hw,hri_adc_intenset_reg_t mask)191 static inline void hri_adc_clear_INTEN_reg(const void *const hw, hri_adc_intenset_reg_t mask)
192 {
193 ((Adc *)hw)->INTENCLR.reg = mask;
194 }
195
hri_adc_get_INTFLAG_RESRDY_bit(const void * const hw)196 static inline bool hri_adc_get_INTFLAG_RESRDY_bit(const void *const hw)
197 {
198 return (((Adc *)hw)->INTFLAG.reg & ADC_INTFLAG_RESRDY) >> ADC_INTFLAG_RESRDY_Pos;
199 }
200
hri_adc_clear_INTFLAG_RESRDY_bit(const void * const hw)201 static inline void hri_adc_clear_INTFLAG_RESRDY_bit(const void *const hw)
202 {
203 ((Adc *)hw)->INTFLAG.reg = ADC_INTFLAG_RESRDY;
204 }
205
hri_adc_get_INTFLAG_OVERRUN_bit(const void * const hw)206 static inline bool hri_adc_get_INTFLAG_OVERRUN_bit(const void *const hw)
207 {
208 return (((Adc *)hw)->INTFLAG.reg & ADC_INTFLAG_OVERRUN) >> ADC_INTFLAG_OVERRUN_Pos;
209 }
210
hri_adc_clear_INTFLAG_OVERRUN_bit(const void * const hw)211 static inline void hri_adc_clear_INTFLAG_OVERRUN_bit(const void *const hw)
212 {
213 ((Adc *)hw)->INTFLAG.reg = ADC_INTFLAG_OVERRUN;
214 }
215
hri_adc_get_INTFLAG_WINMON_bit(const void * const hw)216 static inline bool hri_adc_get_INTFLAG_WINMON_bit(const void *const hw)
217 {
218 return (((Adc *)hw)->INTFLAG.reg & ADC_INTFLAG_WINMON) >> ADC_INTFLAG_WINMON_Pos;
219 }
220
hri_adc_clear_INTFLAG_WINMON_bit(const void * const hw)221 static inline void hri_adc_clear_INTFLAG_WINMON_bit(const void *const hw)
222 {
223 ((Adc *)hw)->INTFLAG.reg = ADC_INTFLAG_WINMON;
224 }
225
hri_adc_get_interrupt_RESRDY_bit(const void * const hw)226 static inline bool hri_adc_get_interrupt_RESRDY_bit(const void *const hw)
227 {
228 return (((Adc *)hw)->INTFLAG.reg & ADC_INTFLAG_RESRDY) >> ADC_INTFLAG_RESRDY_Pos;
229 }
230
hri_adc_clear_interrupt_RESRDY_bit(const void * const hw)231 static inline void hri_adc_clear_interrupt_RESRDY_bit(const void *const hw)
232 {
233 ((Adc *)hw)->INTFLAG.reg = ADC_INTFLAG_RESRDY;
234 }
235
hri_adc_get_interrupt_OVERRUN_bit(const void * const hw)236 static inline bool hri_adc_get_interrupt_OVERRUN_bit(const void *const hw)
237 {
238 return (((Adc *)hw)->INTFLAG.reg & ADC_INTFLAG_OVERRUN) >> ADC_INTFLAG_OVERRUN_Pos;
239 }
240
hri_adc_clear_interrupt_OVERRUN_bit(const void * const hw)241 static inline void hri_adc_clear_interrupt_OVERRUN_bit(const void *const hw)
242 {
243 ((Adc *)hw)->INTFLAG.reg = ADC_INTFLAG_OVERRUN;
244 }
245
hri_adc_get_interrupt_WINMON_bit(const void * const hw)246 static inline bool hri_adc_get_interrupt_WINMON_bit(const void *const hw)
247 {
248 return (((Adc *)hw)->INTFLAG.reg & ADC_INTFLAG_WINMON) >> ADC_INTFLAG_WINMON_Pos;
249 }
250
hri_adc_clear_interrupt_WINMON_bit(const void * const hw)251 static inline void hri_adc_clear_interrupt_WINMON_bit(const void *const hw)
252 {
253 ((Adc *)hw)->INTFLAG.reg = ADC_INTFLAG_WINMON;
254 }
255
hri_adc_get_INTFLAG_reg(const void * const hw,hri_adc_intflag_reg_t mask)256 static inline hri_adc_intflag_reg_t hri_adc_get_INTFLAG_reg(const void *const hw, hri_adc_intflag_reg_t mask)
257 {
258 uint8_t tmp;
259 tmp = ((Adc *)hw)->INTFLAG.reg;
260 tmp &= mask;
261 return tmp;
262 }
263
hri_adc_read_INTFLAG_reg(const void * const hw)264 static inline hri_adc_intflag_reg_t hri_adc_read_INTFLAG_reg(const void *const hw)
265 {
266 return ((Adc *)hw)->INTFLAG.reg;
267 }
268
hri_adc_clear_INTFLAG_reg(const void * const hw,hri_adc_intflag_reg_t mask)269 static inline void hri_adc_clear_INTFLAG_reg(const void *const hw, hri_adc_intflag_reg_t mask)
270 {
271 ((Adc *)hw)->INTFLAG.reg = mask;
272 }
273
hri_adc_set_CTRLA_SWRST_bit(const void * const hw)274 static inline void hri_adc_set_CTRLA_SWRST_bit(const void *const hw)
275 {
276 ADC_CRITICAL_SECTION_ENTER();
277 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_SWRST);
278 ((Adc *)hw)->CTRLA.reg |= ADC_CTRLA_SWRST;
279 ADC_CRITICAL_SECTION_LEAVE();
280 }
281
hri_adc_get_CTRLA_SWRST_bit(const void * const hw)282 static inline bool hri_adc_get_CTRLA_SWRST_bit(const void *const hw)
283 {
284 uint8_t tmp;
285 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_SWRST);
286 tmp = ((Adc *)hw)->CTRLA.reg;
287 tmp = (tmp & ADC_CTRLA_SWRST) >> ADC_CTRLA_SWRST_Pos;
288 return (bool)tmp;
289 }
290
hri_adc_set_CTRLA_ENABLE_bit(const void * const hw)291 static inline void hri_adc_set_CTRLA_ENABLE_bit(const void *const hw)
292 {
293 ADC_CRITICAL_SECTION_ENTER();
294 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_SWRST | ADC_SYNCBUSY_ENABLE);
295 ((Adc *)hw)->CTRLA.reg |= ADC_CTRLA_ENABLE;
296 ADC_CRITICAL_SECTION_LEAVE();
297 }
298
hri_adc_get_CTRLA_ENABLE_bit(const void * const hw)299 static inline bool hri_adc_get_CTRLA_ENABLE_bit(const void *const hw)
300 {
301 uint8_t tmp;
302 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_SWRST | ADC_SYNCBUSY_ENABLE);
303 tmp = ((Adc *)hw)->CTRLA.reg;
304 tmp = (tmp & ADC_CTRLA_ENABLE) >> ADC_CTRLA_ENABLE_Pos;
305 return (bool)tmp;
306 }
307
hri_adc_write_CTRLA_ENABLE_bit(const void * const hw,bool value)308 static inline void hri_adc_write_CTRLA_ENABLE_bit(const void *const hw, bool value)
309 {
310 uint8_t tmp;
311 ADC_CRITICAL_SECTION_ENTER();
312 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_SWRST | ADC_SYNCBUSY_ENABLE);
313 tmp = ((Adc *)hw)->CTRLA.reg;
314 tmp &= ~ADC_CTRLA_ENABLE;
315 tmp |= value << ADC_CTRLA_ENABLE_Pos;
316 ((Adc *)hw)->CTRLA.reg = tmp;
317 ADC_CRITICAL_SECTION_LEAVE();
318 }
319
hri_adc_clear_CTRLA_ENABLE_bit(const void * const hw)320 static inline void hri_adc_clear_CTRLA_ENABLE_bit(const void *const hw)
321 {
322 ADC_CRITICAL_SECTION_ENTER();
323 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_SWRST | ADC_SYNCBUSY_ENABLE);
324 ((Adc *)hw)->CTRLA.reg &= ~ADC_CTRLA_ENABLE;
325 ADC_CRITICAL_SECTION_LEAVE();
326 }
327
hri_adc_toggle_CTRLA_ENABLE_bit(const void * const hw)328 static inline void hri_adc_toggle_CTRLA_ENABLE_bit(const void *const hw)
329 {
330 ADC_CRITICAL_SECTION_ENTER();
331 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_SWRST | ADC_SYNCBUSY_ENABLE);
332 ((Adc *)hw)->CTRLA.reg ^= ADC_CTRLA_ENABLE;
333 ADC_CRITICAL_SECTION_LEAVE();
334 }
335
hri_adc_set_CTRLA_RUNSTDBY_bit(const void * const hw)336 static inline void hri_adc_set_CTRLA_RUNSTDBY_bit(const void *const hw)
337 {
338 ADC_CRITICAL_SECTION_ENTER();
339 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
340 ((Adc *)hw)->CTRLA.reg |= ADC_CTRLA_RUNSTDBY;
341 ADC_CRITICAL_SECTION_LEAVE();
342 }
343
hri_adc_get_CTRLA_RUNSTDBY_bit(const void * const hw)344 static inline bool hri_adc_get_CTRLA_RUNSTDBY_bit(const void *const hw)
345 {
346 uint8_t tmp;
347 tmp = ((Adc *)hw)->CTRLA.reg;
348 tmp = (tmp & ADC_CTRLA_RUNSTDBY) >> ADC_CTRLA_RUNSTDBY_Pos;
349 return (bool)tmp;
350 }
351
hri_adc_write_CTRLA_RUNSTDBY_bit(const void * const hw,bool value)352 static inline void hri_adc_write_CTRLA_RUNSTDBY_bit(const void *const hw, bool value)
353 {
354 uint8_t tmp;
355 ADC_CRITICAL_SECTION_ENTER();
356 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
357 tmp = ((Adc *)hw)->CTRLA.reg;
358 tmp &= ~ADC_CTRLA_RUNSTDBY;
359 tmp |= value << ADC_CTRLA_RUNSTDBY_Pos;
360 ((Adc *)hw)->CTRLA.reg = tmp;
361 ADC_CRITICAL_SECTION_LEAVE();
362 }
363
hri_adc_clear_CTRLA_RUNSTDBY_bit(const void * const hw)364 static inline void hri_adc_clear_CTRLA_RUNSTDBY_bit(const void *const hw)
365 {
366 ADC_CRITICAL_SECTION_ENTER();
367 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
368 ((Adc *)hw)->CTRLA.reg &= ~ADC_CTRLA_RUNSTDBY;
369 ADC_CRITICAL_SECTION_LEAVE();
370 }
371
hri_adc_toggle_CTRLA_RUNSTDBY_bit(const void * const hw)372 static inline void hri_adc_toggle_CTRLA_RUNSTDBY_bit(const void *const hw)
373 {
374 ADC_CRITICAL_SECTION_ENTER();
375 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
376 ((Adc *)hw)->CTRLA.reg ^= ADC_CTRLA_RUNSTDBY;
377 ADC_CRITICAL_SECTION_LEAVE();
378 }
379
hri_adc_set_CTRLA_ONDEMAND_bit(const void * const hw)380 static inline void hri_adc_set_CTRLA_ONDEMAND_bit(const void *const hw)
381 {
382 ADC_CRITICAL_SECTION_ENTER();
383 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
384 ((Adc *)hw)->CTRLA.reg |= ADC_CTRLA_ONDEMAND;
385 ADC_CRITICAL_SECTION_LEAVE();
386 }
387
hri_adc_get_CTRLA_ONDEMAND_bit(const void * const hw)388 static inline bool hri_adc_get_CTRLA_ONDEMAND_bit(const void *const hw)
389 {
390 uint8_t tmp;
391 tmp = ((Adc *)hw)->CTRLA.reg;
392 tmp = (tmp & ADC_CTRLA_ONDEMAND) >> ADC_CTRLA_ONDEMAND_Pos;
393 return (bool)tmp;
394 }
395
hri_adc_write_CTRLA_ONDEMAND_bit(const void * const hw,bool value)396 static inline void hri_adc_write_CTRLA_ONDEMAND_bit(const void *const hw, bool value)
397 {
398 uint8_t tmp;
399 ADC_CRITICAL_SECTION_ENTER();
400 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
401 tmp = ((Adc *)hw)->CTRLA.reg;
402 tmp &= ~ADC_CTRLA_ONDEMAND;
403 tmp |= value << ADC_CTRLA_ONDEMAND_Pos;
404 ((Adc *)hw)->CTRLA.reg = tmp;
405 ADC_CRITICAL_SECTION_LEAVE();
406 }
407
hri_adc_clear_CTRLA_ONDEMAND_bit(const void * const hw)408 static inline void hri_adc_clear_CTRLA_ONDEMAND_bit(const void *const hw)
409 {
410 ADC_CRITICAL_SECTION_ENTER();
411 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
412 ((Adc *)hw)->CTRLA.reg &= ~ADC_CTRLA_ONDEMAND;
413 ADC_CRITICAL_SECTION_LEAVE();
414 }
415
hri_adc_toggle_CTRLA_ONDEMAND_bit(const void * const hw)416 static inline void hri_adc_toggle_CTRLA_ONDEMAND_bit(const void *const hw)
417 {
418 ADC_CRITICAL_SECTION_ENTER();
419 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
420 ((Adc *)hw)->CTRLA.reg ^= ADC_CTRLA_ONDEMAND;
421 ADC_CRITICAL_SECTION_LEAVE();
422 }
423
hri_adc_set_CTRLA_reg(const void * const hw,hri_adc_ctrla_reg_t mask)424 static inline void hri_adc_set_CTRLA_reg(const void *const hw, hri_adc_ctrla_reg_t mask)
425 {
426 ADC_CRITICAL_SECTION_ENTER();
427 ((Adc *)hw)->CTRLA.reg |= mask;
428 ADC_CRITICAL_SECTION_LEAVE();
429 }
430
hri_adc_get_CTRLA_reg(const void * const hw,hri_adc_ctrla_reg_t mask)431 static inline hri_adc_ctrla_reg_t hri_adc_get_CTRLA_reg(const void *const hw, hri_adc_ctrla_reg_t mask)
432 {
433 uint8_t tmp;
434 tmp = ((Adc *)hw)->CTRLA.reg;
435 tmp &= mask;
436 return tmp;
437 }
438
hri_adc_write_CTRLA_reg(const void * const hw,hri_adc_ctrla_reg_t data)439 static inline void hri_adc_write_CTRLA_reg(const void *const hw, hri_adc_ctrla_reg_t data)
440 {
441 ADC_CRITICAL_SECTION_ENTER();
442 ((Adc *)hw)->CTRLA.reg = data;
443 ADC_CRITICAL_SECTION_LEAVE();
444 }
445
hri_adc_clear_CTRLA_reg(const void * const hw,hri_adc_ctrla_reg_t mask)446 static inline void hri_adc_clear_CTRLA_reg(const void *const hw, hri_adc_ctrla_reg_t mask)
447 {
448 ADC_CRITICAL_SECTION_ENTER();
449 ((Adc *)hw)->CTRLA.reg &= ~mask;
450 ADC_CRITICAL_SECTION_LEAVE();
451 }
452
hri_adc_toggle_CTRLA_reg(const void * const hw,hri_adc_ctrla_reg_t mask)453 static inline void hri_adc_toggle_CTRLA_reg(const void *const hw, hri_adc_ctrla_reg_t mask)
454 {
455 ADC_CRITICAL_SECTION_ENTER();
456 ((Adc *)hw)->CTRLA.reg ^= mask;
457 ADC_CRITICAL_SECTION_LEAVE();
458 }
459
hri_adc_read_CTRLA_reg(const void * const hw)460 static inline hri_adc_ctrla_reg_t hri_adc_read_CTRLA_reg(const void *const hw)
461 {
462 return ((Adc *)hw)->CTRLA.reg;
463 }
464
hri_adc_set_CTRLB_PRESCALER_bf(const void * const hw,hri_adc_ctrlb_reg_t mask)465 static inline void hri_adc_set_CTRLB_PRESCALER_bf(const void *const hw, hri_adc_ctrlb_reg_t mask)
466 {
467 ADC_CRITICAL_SECTION_ENTER();
468 ((Adc *)hw)->CTRLB.reg |= ADC_CTRLB_PRESCALER(mask);
469 ADC_CRITICAL_SECTION_LEAVE();
470 }
471
hri_adc_get_CTRLB_PRESCALER_bf(const void * const hw,hri_adc_ctrlb_reg_t mask)472 static inline hri_adc_ctrlb_reg_t hri_adc_get_CTRLB_PRESCALER_bf(const void *const hw, hri_adc_ctrlb_reg_t mask)
473 {
474 uint8_t tmp;
475 tmp = ((Adc *)hw)->CTRLB.reg;
476 tmp = (tmp & ADC_CTRLB_PRESCALER(mask)) >> ADC_CTRLB_PRESCALER_Pos;
477 return tmp;
478 }
479
hri_adc_write_CTRLB_PRESCALER_bf(const void * const hw,hri_adc_ctrlb_reg_t data)480 static inline void hri_adc_write_CTRLB_PRESCALER_bf(const void *const hw, hri_adc_ctrlb_reg_t data)
481 {
482 uint8_t tmp;
483 ADC_CRITICAL_SECTION_ENTER();
484 tmp = ((Adc *)hw)->CTRLB.reg;
485 tmp &= ~ADC_CTRLB_PRESCALER_Msk;
486 tmp |= ADC_CTRLB_PRESCALER(data);
487 ((Adc *)hw)->CTRLB.reg = tmp;
488 ADC_CRITICAL_SECTION_LEAVE();
489 }
490
hri_adc_clear_CTRLB_PRESCALER_bf(const void * const hw,hri_adc_ctrlb_reg_t mask)491 static inline void hri_adc_clear_CTRLB_PRESCALER_bf(const void *const hw, hri_adc_ctrlb_reg_t mask)
492 {
493 ADC_CRITICAL_SECTION_ENTER();
494 ((Adc *)hw)->CTRLB.reg &= ~ADC_CTRLB_PRESCALER(mask);
495 ADC_CRITICAL_SECTION_LEAVE();
496 }
497
hri_adc_toggle_CTRLB_PRESCALER_bf(const void * const hw,hri_adc_ctrlb_reg_t mask)498 static inline void hri_adc_toggle_CTRLB_PRESCALER_bf(const void *const hw, hri_adc_ctrlb_reg_t mask)
499 {
500 ADC_CRITICAL_SECTION_ENTER();
501 ((Adc *)hw)->CTRLB.reg ^= ADC_CTRLB_PRESCALER(mask);
502 ADC_CRITICAL_SECTION_LEAVE();
503 }
504
hri_adc_read_CTRLB_PRESCALER_bf(const void * const hw)505 static inline hri_adc_ctrlb_reg_t hri_adc_read_CTRLB_PRESCALER_bf(const void *const hw)
506 {
507 uint8_t tmp;
508 tmp = ((Adc *)hw)->CTRLB.reg;
509 tmp = (tmp & ADC_CTRLB_PRESCALER_Msk) >> ADC_CTRLB_PRESCALER_Pos;
510 return tmp;
511 }
512
hri_adc_set_CTRLB_reg(const void * const hw,hri_adc_ctrlb_reg_t mask)513 static inline void hri_adc_set_CTRLB_reg(const void *const hw, hri_adc_ctrlb_reg_t mask)
514 {
515 ADC_CRITICAL_SECTION_ENTER();
516 ((Adc *)hw)->CTRLB.reg |= mask;
517 ADC_CRITICAL_SECTION_LEAVE();
518 }
519
hri_adc_get_CTRLB_reg(const void * const hw,hri_adc_ctrlb_reg_t mask)520 static inline hri_adc_ctrlb_reg_t hri_adc_get_CTRLB_reg(const void *const hw, hri_adc_ctrlb_reg_t mask)
521 {
522 uint8_t tmp;
523 tmp = ((Adc *)hw)->CTRLB.reg;
524 tmp &= mask;
525 return tmp;
526 }
527
hri_adc_write_CTRLB_reg(const void * const hw,hri_adc_ctrlb_reg_t data)528 static inline void hri_adc_write_CTRLB_reg(const void *const hw, hri_adc_ctrlb_reg_t data)
529 {
530 ADC_CRITICAL_SECTION_ENTER();
531 ((Adc *)hw)->CTRLB.reg = data;
532 ADC_CRITICAL_SECTION_LEAVE();
533 }
534
hri_adc_clear_CTRLB_reg(const void * const hw,hri_adc_ctrlb_reg_t mask)535 static inline void hri_adc_clear_CTRLB_reg(const void *const hw, hri_adc_ctrlb_reg_t mask)
536 {
537 ADC_CRITICAL_SECTION_ENTER();
538 ((Adc *)hw)->CTRLB.reg &= ~mask;
539 ADC_CRITICAL_SECTION_LEAVE();
540 }
541
hri_adc_toggle_CTRLB_reg(const void * const hw,hri_adc_ctrlb_reg_t mask)542 static inline void hri_adc_toggle_CTRLB_reg(const void *const hw, hri_adc_ctrlb_reg_t mask)
543 {
544 ADC_CRITICAL_SECTION_ENTER();
545 ((Adc *)hw)->CTRLB.reg ^= mask;
546 ADC_CRITICAL_SECTION_LEAVE();
547 }
548
hri_adc_read_CTRLB_reg(const void * const hw)549 static inline hri_adc_ctrlb_reg_t hri_adc_read_CTRLB_reg(const void *const hw)
550 {
551 return ((Adc *)hw)->CTRLB.reg;
552 }
553
hri_adc_set_REFCTRL_REFCOMP_bit(const void * const hw)554 static inline void hri_adc_set_REFCTRL_REFCOMP_bit(const void *const hw)
555 {
556 ADC_CRITICAL_SECTION_ENTER();
557 ((Adc *)hw)->REFCTRL.reg |= ADC_REFCTRL_REFCOMP;
558 ADC_CRITICAL_SECTION_LEAVE();
559 }
560
hri_adc_get_REFCTRL_REFCOMP_bit(const void * const hw)561 static inline bool hri_adc_get_REFCTRL_REFCOMP_bit(const void *const hw)
562 {
563 uint8_t tmp;
564 tmp = ((Adc *)hw)->REFCTRL.reg;
565 tmp = (tmp & ADC_REFCTRL_REFCOMP) >> ADC_REFCTRL_REFCOMP_Pos;
566 return (bool)tmp;
567 }
568
hri_adc_write_REFCTRL_REFCOMP_bit(const void * const hw,bool value)569 static inline void hri_adc_write_REFCTRL_REFCOMP_bit(const void *const hw, bool value)
570 {
571 uint8_t tmp;
572 ADC_CRITICAL_SECTION_ENTER();
573 tmp = ((Adc *)hw)->REFCTRL.reg;
574 tmp &= ~ADC_REFCTRL_REFCOMP;
575 tmp |= value << ADC_REFCTRL_REFCOMP_Pos;
576 ((Adc *)hw)->REFCTRL.reg = tmp;
577 ADC_CRITICAL_SECTION_LEAVE();
578 }
579
hri_adc_clear_REFCTRL_REFCOMP_bit(const void * const hw)580 static inline void hri_adc_clear_REFCTRL_REFCOMP_bit(const void *const hw)
581 {
582 ADC_CRITICAL_SECTION_ENTER();
583 ((Adc *)hw)->REFCTRL.reg &= ~ADC_REFCTRL_REFCOMP;
584 ADC_CRITICAL_SECTION_LEAVE();
585 }
586
hri_adc_toggle_REFCTRL_REFCOMP_bit(const void * const hw)587 static inline void hri_adc_toggle_REFCTRL_REFCOMP_bit(const void *const hw)
588 {
589 ADC_CRITICAL_SECTION_ENTER();
590 ((Adc *)hw)->REFCTRL.reg ^= ADC_REFCTRL_REFCOMP;
591 ADC_CRITICAL_SECTION_LEAVE();
592 }
593
hri_adc_set_REFCTRL_REFSEL_bf(const void * const hw,hri_adc_refctrl_reg_t mask)594 static inline void hri_adc_set_REFCTRL_REFSEL_bf(const void *const hw, hri_adc_refctrl_reg_t mask)
595 {
596 ADC_CRITICAL_SECTION_ENTER();
597 ((Adc *)hw)->REFCTRL.reg |= ADC_REFCTRL_REFSEL(mask);
598 ADC_CRITICAL_SECTION_LEAVE();
599 }
600
hri_adc_get_REFCTRL_REFSEL_bf(const void * const hw,hri_adc_refctrl_reg_t mask)601 static inline hri_adc_refctrl_reg_t hri_adc_get_REFCTRL_REFSEL_bf(const void *const hw, hri_adc_refctrl_reg_t mask)
602 {
603 uint8_t tmp;
604 tmp = ((Adc *)hw)->REFCTRL.reg;
605 tmp = (tmp & ADC_REFCTRL_REFSEL(mask)) >> ADC_REFCTRL_REFSEL_Pos;
606 return tmp;
607 }
608
hri_adc_write_REFCTRL_REFSEL_bf(const void * const hw,hri_adc_refctrl_reg_t data)609 static inline void hri_adc_write_REFCTRL_REFSEL_bf(const void *const hw, hri_adc_refctrl_reg_t data)
610 {
611 uint8_t tmp;
612 ADC_CRITICAL_SECTION_ENTER();
613 tmp = ((Adc *)hw)->REFCTRL.reg;
614 tmp &= ~ADC_REFCTRL_REFSEL_Msk;
615 tmp |= ADC_REFCTRL_REFSEL(data);
616 ((Adc *)hw)->REFCTRL.reg = tmp;
617 ADC_CRITICAL_SECTION_LEAVE();
618 }
619
hri_adc_clear_REFCTRL_REFSEL_bf(const void * const hw,hri_adc_refctrl_reg_t mask)620 static inline void hri_adc_clear_REFCTRL_REFSEL_bf(const void *const hw, hri_adc_refctrl_reg_t mask)
621 {
622 ADC_CRITICAL_SECTION_ENTER();
623 ((Adc *)hw)->REFCTRL.reg &= ~ADC_REFCTRL_REFSEL(mask);
624 ADC_CRITICAL_SECTION_LEAVE();
625 }
626
hri_adc_toggle_REFCTRL_REFSEL_bf(const void * const hw,hri_adc_refctrl_reg_t mask)627 static inline void hri_adc_toggle_REFCTRL_REFSEL_bf(const void *const hw, hri_adc_refctrl_reg_t mask)
628 {
629 ADC_CRITICAL_SECTION_ENTER();
630 ((Adc *)hw)->REFCTRL.reg ^= ADC_REFCTRL_REFSEL(mask);
631 ADC_CRITICAL_SECTION_LEAVE();
632 }
633
hri_adc_read_REFCTRL_REFSEL_bf(const void * const hw)634 static inline hri_adc_refctrl_reg_t hri_adc_read_REFCTRL_REFSEL_bf(const void *const hw)
635 {
636 uint8_t tmp;
637 tmp = ((Adc *)hw)->REFCTRL.reg;
638 tmp = (tmp & ADC_REFCTRL_REFSEL_Msk) >> ADC_REFCTRL_REFSEL_Pos;
639 return tmp;
640 }
641
hri_adc_set_REFCTRL_reg(const void * const hw,hri_adc_refctrl_reg_t mask)642 static inline void hri_adc_set_REFCTRL_reg(const void *const hw, hri_adc_refctrl_reg_t mask)
643 {
644 ADC_CRITICAL_SECTION_ENTER();
645 ((Adc *)hw)->REFCTRL.reg |= mask;
646 ADC_CRITICAL_SECTION_LEAVE();
647 }
648
hri_adc_get_REFCTRL_reg(const void * const hw,hri_adc_refctrl_reg_t mask)649 static inline hri_adc_refctrl_reg_t hri_adc_get_REFCTRL_reg(const void *const hw, hri_adc_refctrl_reg_t mask)
650 {
651 uint8_t tmp;
652 tmp = ((Adc *)hw)->REFCTRL.reg;
653 tmp &= mask;
654 return tmp;
655 }
656
hri_adc_write_REFCTRL_reg(const void * const hw,hri_adc_refctrl_reg_t data)657 static inline void hri_adc_write_REFCTRL_reg(const void *const hw, hri_adc_refctrl_reg_t data)
658 {
659 ADC_CRITICAL_SECTION_ENTER();
660 ((Adc *)hw)->REFCTRL.reg = data;
661 ADC_CRITICAL_SECTION_LEAVE();
662 }
663
hri_adc_clear_REFCTRL_reg(const void * const hw,hri_adc_refctrl_reg_t mask)664 static inline void hri_adc_clear_REFCTRL_reg(const void *const hw, hri_adc_refctrl_reg_t mask)
665 {
666 ADC_CRITICAL_SECTION_ENTER();
667 ((Adc *)hw)->REFCTRL.reg &= ~mask;
668 ADC_CRITICAL_SECTION_LEAVE();
669 }
670
hri_adc_toggle_REFCTRL_reg(const void * const hw,hri_adc_refctrl_reg_t mask)671 static inline void hri_adc_toggle_REFCTRL_reg(const void *const hw, hri_adc_refctrl_reg_t mask)
672 {
673 ADC_CRITICAL_SECTION_ENTER();
674 ((Adc *)hw)->REFCTRL.reg ^= mask;
675 ADC_CRITICAL_SECTION_LEAVE();
676 }
677
hri_adc_read_REFCTRL_reg(const void * const hw)678 static inline hri_adc_refctrl_reg_t hri_adc_read_REFCTRL_reg(const void *const hw)
679 {
680 return ((Adc *)hw)->REFCTRL.reg;
681 }
682
hri_adc_set_EVCTRL_FLUSHEI_bit(const void * const hw)683 static inline void hri_adc_set_EVCTRL_FLUSHEI_bit(const void *const hw)
684 {
685 ADC_CRITICAL_SECTION_ENTER();
686 ((Adc *)hw)->EVCTRL.reg |= ADC_EVCTRL_FLUSHEI;
687 ADC_CRITICAL_SECTION_LEAVE();
688 }
689
hri_adc_get_EVCTRL_FLUSHEI_bit(const void * const hw)690 static inline bool hri_adc_get_EVCTRL_FLUSHEI_bit(const void *const hw)
691 {
692 uint8_t tmp;
693 tmp = ((Adc *)hw)->EVCTRL.reg;
694 tmp = (tmp & ADC_EVCTRL_FLUSHEI) >> ADC_EVCTRL_FLUSHEI_Pos;
695 return (bool)tmp;
696 }
697
hri_adc_write_EVCTRL_FLUSHEI_bit(const void * const hw,bool value)698 static inline void hri_adc_write_EVCTRL_FLUSHEI_bit(const void *const hw, bool value)
699 {
700 uint8_t tmp;
701 ADC_CRITICAL_SECTION_ENTER();
702 tmp = ((Adc *)hw)->EVCTRL.reg;
703 tmp &= ~ADC_EVCTRL_FLUSHEI;
704 tmp |= value << ADC_EVCTRL_FLUSHEI_Pos;
705 ((Adc *)hw)->EVCTRL.reg = tmp;
706 ADC_CRITICAL_SECTION_LEAVE();
707 }
708
hri_adc_clear_EVCTRL_FLUSHEI_bit(const void * const hw)709 static inline void hri_adc_clear_EVCTRL_FLUSHEI_bit(const void *const hw)
710 {
711 ADC_CRITICAL_SECTION_ENTER();
712 ((Adc *)hw)->EVCTRL.reg &= ~ADC_EVCTRL_FLUSHEI;
713 ADC_CRITICAL_SECTION_LEAVE();
714 }
715
hri_adc_toggle_EVCTRL_FLUSHEI_bit(const void * const hw)716 static inline void hri_adc_toggle_EVCTRL_FLUSHEI_bit(const void *const hw)
717 {
718 ADC_CRITICAL_SECTION_ENTER();
719 ((Adc *)hw)->EVCTRL.reg ^= ADC_EVCTRL_FLUSHEI;
720 ADC_CRITICAL_SECTION_LEAVE();
721 }
722
hri_adc_set_EVCTRL_STARTEI_bit(const void * const hw)723 static inline void hri_adc_set_EVCTRL_STARTEI_bit(const void *const hw)
724 {
725 ADC_CRITICAL_SECTION_ENTER();
726 ((Adc *)hw)->EVCTRL.reg |= ADC_EVCTRL_STARTEI;
727 ADC_CRITICAL_SECTION_LEAVE();
728 }
729
hri_adc_get_EVCTRL_STARTEI_bit(const void * const hw)730 static inline bool hri_adc_get_EVCTRL_STARTEI_bit(const void *const hw)
731 {
732 uint8_t tmp;
733 tmp = ((Adc *)hw)->EVCTRL.reg;
734 tmp = (tmp & ADC_EVCTRL_STARTEI) >> ADC_EVCTRL_STARTEI_Pos;
735 return (bool)tmp;
736 }
737
hri_adc_write_EVCTRL_STARTEI_bit(const void * const hw,bool value)738 static inline void hri_adc_write_EVCTRL_STARTEI_bit(const void *const hw, bool value)
739 {
740 uint8_t tmp;
741 ADC_CRITICAL_SECTION_ENTER();
742 tmp = ((Adc *)hw)->EVCTRL.reg;
743 tmp &= ~ADC_EVCTRL_STARTEI;
744 tmp |= value << ADC_EVCTRL_STARTEI_Pos;
745 ((Adc *)hw)->EVCTRL.reg = tmp;
746 ADC_CRITICAL_SECTION_LEAVE();
747 }
748
hri_adc_clear_EVCTRL_STARTEI_bit(const void * const hw)749 static inline void hri_adc_clear_EVCTRL_STARTEI_bit(const void *const hw)
750 {
751 ADC_CRITICAL_SECTION_ENTER();
752 ((Adc *)hw)->EVCTRL.reg &= ~ADC_EVCTRL_STARTEI;
753 ADC_CRITICAL_SECTION_LEAVE();
754 }
755
hri_adc_toggle_EVCTRL_STARTEI_bit(const void * const hw)756 static inline void hri_adc_toggle_EVCTRL_STARTEI_bit(const void *const hw)
757 {
758 ADC_CRITICAL_SECTION_ENTER();
759 ((Adc *)hw)->EVCTRL.reg ^= ADC_EVCTRL_STARTEI;
760 ADC_CRITICAL_SECTION_LEAVE();
761 }
762
hri_adc_set_EVCTRL_FLUSHINV_bit(const void * const hw)763 static inline void hri_adc_set_EVCTRL_FLUSHINV_bit(const void *const hw)
764 {
765 ADC_CRITICAL_SECTION_ENTER();
766 ((Adc *)hw)->EVCTRL.reg |= ADC_EVCTRL_FLUSHINV;
767 ADC_CRITICAL_SECTION_LEAVE();
768 }
769
hri_adc_get_EVCTRL_FLUSHINV_bit(const void * const hw)770 static inline bool hri_adc_get_EVCTRL_FLUSHINV_bit(const void *const hw)
771 {
772 uint8_t tmp;
773 tmp = ((Adc *)hw)->EVCTRL.reg;
774 tmp = (tmp & ADC_EVCTRL_FLUSHINV) >> ADC_EVCTRL_FLUSHINV_Pos;
775 return (bool)tmp;
776 }
777
hri_adc_write_EVCTRL_FLUSHINV_bit(const void * const hw,bool value)778 static inline void hri_adc_write_EVCTRL_FLUSHINV_bit(const void *const hw, bool value)
779 {
780 uint8_t tmp;
781 ADC_CRITICAL_SECTION_ENTER();
782 tmp = ((Adc *)hw)->EVCTRL.reg;
783 tmp &= ~ADC_EVCTRL_FLUSHINV;
784 tmp |= value << ADC_EVCTRL_FLUSHINV_Pos;
785 ((Adc *)hw)->EVCTRL.reg = tmp;
786 ADC_CRITICAL_SECTION_LEAVE();
787 }
788
hri_adc_clear_EVCTRL_FLUSHINV_bit(const void * const hw)789 static inline void hri_adc_clear_EVCTRL_FLUSHINV_bit(const void *const hw)
790 {
791 ADC_CRITICAL_SECTION_ENTER();
792 ((Adc *)hw)->EVCTRL.reg &= ~ADC_EVCTRL_FLUSHINV;
793 ADC_CRITICAL_SECTION_LEAVE();
794 }
795
hri_adc_toggle_EVCTRL_FLUSHINV_bit(const void * const hw)796 static inline void hri_adc_toggle_EVCTRL_FLUSHINV_bit(const void *const hw)
797 {
798 ADC_CRITICAL_SECTION_ENTER();
799 ((Adc *)hw)->EVCTRL.reg ^= ADC_EVCTRL_FLUSHINV;
800 ADC_CRITICAL_SECTION_LEAVE();
801 }
802
hri_adc_set_EVCTRL_STARTINV_bit(const void * const hw)803 static inline void hri_adc_set_EVCTRL_STARTINV_bit(const void *const hw)
804 {
805 ADC_CRITICAL_SECTION_ENTER();
806 ((Adc *)hw)->EVCTRL.reg |= ADC_EVCTRL_STARTINV;
807 ADC_CRITICAL_SECTION_LEAVE();
808 }
809
hri_adc_get_EVCTRL_STARTINV_bit(const void * const hw)810 static inline bool hri_adc_get_EVCTRL_STARTINV_bit(const void *const hw)
811 {
812 uint8_t tmp;
813 tmp = ((Adc *)hw)->EVCTRL.reg;
814 tmp = (tmp & ADC_EVCTRL_STARTINV) >> ADC_EVCTRL_STARTINV_Pos;
815 return (bool)tmp;
816 }
817
hri_adc_write_EVCTRL_STARTINV_bit(const void * const hw,bool value)818 static inline void hri_adc_write_EVCTRL_STARTINV_bit(const void *const hw, bool value)
819 {
820 uint8_t tmp;
821 ADC_CRITICAL_SECTION_ENTER();
822 tmp = ((Adc *)hw)->EVCTRL.reg;
823 tmp &= ~ADC_EVCTRL_STARTINV;
824 tmp |= value << ADC_EVCTRL_STARTINV_Pos;
825 ((Adc *)hw)->EVCTRL.reg = tmp;
826 ADC_CRITICAL_SECTION_LEAVE();
827 }
828
hri_adc_clear_EVCTRL_STARTINV_bit(const void * const hw)829 static inline void hri_adc_clear_EVCTRL_STARTINV_bit(const void *const hw)
830 {
831 ADC_CRITICAL_SECTION_ENTER();
832 ((Adc *)hw)->EVCTRL.reg &= ~ADC_EVCTRL_STARTINV;
833 ADC_CRITICAL_SECTION_LEAVE();
834 }
835
hri_adc_toggle_EVCTRL_STARTINV_bit(const void * const hw)836 static inline void hri_adc_toggle_EVCTRL_STARTINV_bit(const void *const hw)
837 {
838 ADC_CRITICAL_SECTION_ENTER();
839 ((Adc *)hw)->EVCTRL.reg ^= ADC_EVCTRL_STARTINV;
840 ADC_CRITICAL_SECTION_LEAVE();
841 }
842
hri_adc_set_EVCTRL_RESRDYEO_bit(const void * const hw)843 static inline void hri_adc_set_EVCTRL_RESRDYEO_bit(const void *const hw)
844 {
845 ADC_CRITICAL_SECTION_ENTER();
846 ((Adc *)hw)->EVCTRL.reg |= ADC_EVCTRL_RESRDYEO;
847 ADC_CRITICAL_SECTION_LEAVE();
848 }
849
hri_adc_get_EVCTRL_RESRDYEO_bit(const void * const hw)850 static inline bool hri_adc_get_EVCTRL_RESRDYEO_bit(const void *const hw)
851 {
852 uint8_t tmp;
853 tmp = ((Adc *)hw)->EVCTRL.reg;
854 tmp = (tmp & ADC_EVCTRL_RESRDYEO) >> ADC_EVCTRL_RESRDYEO_Pos;
855 return (bool)tmp;
856 }
857
hri_adc_write_EVCTRL_RESRDYEO_bit(const void * const hw,bool value)858 static inline void hri_adc_write_EVCTRL_RESRDYEO_bit(const void *const hw, bool value)
859 {
860 uint8_t tmp;
861 ADC_CRITICAL_SECTION_ENTER();
862 tmp = ((Adc *)hw)->EVCTRL.reg;
863 tmp &= ~ADC_EVCTRL_RESRDYEO;
864 tmp |= value << ADC_EVCTRL_RESRDYEO_Pos;
865 ((Adc *)hw)->EVCTRL.reg = tmp;
866 ADC_CRITICAL_SECTION_LEAVE();
867 }
868
hri_adc_clear_EVCTRL_RESRDYEO_bit(const void * const hw)869 static inline void hri_adc_clear_EVCTRL_RESRDYEO_bit(const void *const hw)
870 {
871 ADC_CRITICAL_SECTION_ENTER();
872 ((Adc *)hw)->EVCTRL.reg &= ~ADC_EVCTRL_RESRDYEO;
873 ADC_CRITICAL_SECTION_LEAVE();
874 }
875
hri_adc_toggle_EVCTRL_RESRDYEO_bit(const void * const hw)876 static inline void hri_adc_toggle_EVCTRL_RESRDYEO_bit(const void *const hw)
877 {
878 ADC_CRITICAL_SECTION_ENTER();
879 ((Adc *)hw)->EVCTRL.reg ^= ADC_EVCTRL_RESRDYEO;
880 ADC_CRITICAL_SECTION_LEAVE();
881 }
882
hri_adc_set_EVCTRL_WINMONEO_bit(const void * const hw)883 static inline void hri_adc_set_EVCTRL_WINMONEO_bit(const void *const hw)
884 {
885 ADC_CRITICAL_SECTION_ENTER();
886 ((Adc *)hw)->EVCTRL.reg |= ADC_EVCTRL_WINMONEO;
887 ADC_CRITICAL_SECTION_LEAVE();
888 }
889
hri_adc_get_EVCTRL_WINMONEO_bit(const void * const hw)890 static inline bool hri_adc_get_EVCTRL_WINMONEO_bit(const void *const hw)
891 {
892 uint8_t tmp;
893 tmp = ((Adc *)hw)->EVCTRL.reg;
894 tmp = (tmp & ADC_EVCTRL_WINMONEO) >> ADC_EVCTRL_WINMONEO_Pos;
895 return (bool)tmp;
896 }
897
hri_adc_write_EVCTRL_WINMONEO_bit(const void * const hw,bool value)898 static inline void hri_adc_write_EVCTRL_WINMONEO_bit(const void *const hw, bool value)
899 {
900 uint8_t tmp;
901 ADC_CRITICAL_SECTION_ENTER();
902 tmp = ((Adc *)hw)->EVCTRL.reg;
903 tmp &= ~ADC_EVCTRL_WINMONEO;
904 tmp |= value << ADC_EVCTRL_WINMONEO_Pos;
905 ((Adc *)hw)->EVCTRL.reg = tmp;
906 ADC_CRITICAL_SECTION_LEAVE();
907 }
908
hri_adc_clear_EVCTRL_WINMONEO_bit(const void * const hw)909 static inline void hri_adc_clear_EVCTRL_WINMONEO_bit(const void *const hw)
910 {
911 ADC_CRITICAL_SECTION_ENTER();
912 ((Adc *)hw)->EVCTRL.reg &= ~ADC_EVCTRL_WINMONEO;
913 ADC_CRITICAL_SECTION_LEAVE();
914 }
915
hri_adc_toggle_EVCTRL_WINMONEO_bit(const void * const hw)916 static inline void hri_adc_toggle_EVCTRL_WINMONEO_bit(const void *const hw)
917 {
918 ADC_CRITICAL_SECTION_ENTER();
919 ((Adc *)hw)->EVCTRL.reg ^= ADC_EVCTRL_WINMONEO;
920 ADC_CRITICAL_SECTION_LEAVE();
921 }
922
hri_adc_set_EVCTRL_reg(const void * const hw,hri_adc_evctrl_reg_t mask)923 static inline void hri_adc_set_EVCTRL_reg(const void *const hw, hri_adc_evctrl_reg_t mask)
924 {
925 ADC_CRITICAL_SECTION_ENTER();
926 ((Adc *)hw)->EVCTRL.reg |= mask;
927 ADC_CRITICAL_SECTION_LEAVE();
928 }
929
hri_adc_get_EVCTRL_reg(const void * const hw,hri_adc_evctrl_reg_t mask)930 static inline hri_adc_evctrl_reg_t hri_adc_get_EVCTRL_reg(const void *const hw, hri_adc_evctrl_reg_t mask)
931 {
932 uint8_t tmp;
933 tmp = ((Adc *)hw)->EVCTRL.reg;
934 tmp &= mask;
935 return tmp;
936 }
937
hri_adc_write_EVCTRL_reg(const void * const hw,hri_adc_evctrl_reg_t data)938 static inline void hri_adc_write_EVCTRL_reg(const void *const hw, hri_adc_evctrl_reg_t data)
939 {
940 ADC_CRITICAL_SECTION_ENTER();
941 ((Adc *)hw)->EVCTRL.reg = data;
942 ADC_CRITICAL_SECTION_LEAVE();
943 }
944
hri_adc_clear_EVCTRL_reg(const void * const hw,hri_adc_evctrl_reg_t mask)945 static inline void hri_adc_clear_EVCTRL_reg(const void *const hw, hri_adc_evctrl_reg_t mask)
946 {
947 ADC_CRITICAL_SECTION_ENTER();
948 ((Adc *)hw)->EVCTRL.reg &= ~mask;
949 ADC_CRITICAL_SECTION_LEAVE();
950 }
951
hri_adc_toggle_EVCTRL_reg(const void * const hw,hri_adc_evctrl_reg_t mask)952 static inline void hri_adc_toggle_EVCTRL_reg(const void *const hw, hri_adc_evctrl_reg_t mask)
953 {
954 ADC_CRITICAL_SECTION_ENTER();
955 ((Adc *)hw)->EVCTRL.reg ^= mask;
956 ADC_CRITICAL_SECTION_LEAVE();
957 }
958
hri_adc_read_EVCTRL_reg(const void * const hw)959 static inline hri_adc_evctrl_reg_t hri_adc_read_EVCTRL_reg(const void *const hw)
960 {
961 return ((Adc *)hw)->EVCTRL.reg;
962 }
963
hri_adc_set_INPUTCTRL_MUXPOS_bf(const void * const hw,hri_adc_inputctrl_reg_t mask)964 static inline void hri_adc_set_INPUTCTRL_MUXPOS_bf(const void *const hw, hri_adc_inputctrl_reg_t mask)
965 {
966 ADC_CRITICAL_SECTION_ENTER();
967 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
968 ((Adc *)hw)->INPUTCTRL.reg |= ADC_INPUTCTRL_MUXPOS(mask);
969 ADC_CRITICAL_SECTION_LEAVE();
970 }
971
hri_adc_get_INPUTCTRL_MUXPOS_bf(const void * const hw,hri_adc_inputctrl_reg_t mask)972 static inline hri_adc_inputctrl_reg_t hri_adc_get_INPUTCTRL_MUXPOS_bf(const void *const hw,
973 hri_adc_inputctrl_reg_t mask)
974 {
975 uint16_t tmp;
976 tmp = ((Adc *)hw)->INPUTCTRL.reg;
977 tmp = (tmp & ADC_INPUTCTRL_MUXPOS(mask)) >> ADC_INPUTCTRL_MUXPOS_Pos;
978 return tmp;
979 }
980
hri_adc_write_INPUTCTRL_MUXPOS_bf(const void * const hw,hri_adc_inputctrl_reg_t data)981 static inline void hri_adc_write_INPUTCTRL_MUXPOS_bf(const void *const hw, hri_adc_inputctrl_reg_t data)
982 {
983 uint16_t tmp;
984 ADC_CRITICAL_SECTION_ENTER();
985 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
986 tmp = ((Adc *)hw)->INPUTCTRL.reg;
987 tmp &= ~ADC_INPUTCTRL_MUXPOS_Msk;
988 tmp |= ADC_INPUTCTRL_MUXPOS(data);
989 ((Adc *)hw)->INPUTCTRL.reg = tmp;
990 ADC_CRITICAL_SECTION_LEAVE();
991 }
992
hri_adc_clear_INPUTCTRL_MUXPOS_bf(const void * const hw,hri_adc_inputctrl_reg_t mask)993 static inline void hri_adc_clear_INPUTCTRL_MUXPOS_bf(const void *const hw, hri_adc_inputctrl_reg_t mask)
994 {
995 ADC_CRITICAL_SECTION_ENTER();
996 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
997 ((Adc *)hw)->INPUTCTRL.reg &= ~ADC_INPUTCTRL_MUXPOS(mask);
998 ADC_CRITICAL_SECTION_LEAVE();
999 }
1000
hri_adc_toggle_INPUTCTRL_MUXPOS_bf(const void * const hw,hri_adc_inputctrl_reg_t mask)1001 static inline void hri_adc_toggle_INPUTCTRL_MUXPOS_bf(const void *const hw, hri_adc_inputctrl_reg_t mask)
1002 {
1003 ADC_CRITICAL_SECTION_ENTER();
1004 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1005 ((Adc *)hw)->INPUTCTRL.reg ^= ADC_INPUTCTRL_MUXPOS(mask);
1006 ADC_CRITICAL_SECTION_LEAVE();
1007 }
1008
hri_adc_read_INPUTCTRL_MUXPOS_bf(const void * const hw)1009 static inline hri_adc_inputctrl_reg_t hri_adc_read_INPUTCTRL_MUXPOS_bf(const void *const hw)
1010 {
1011 uint16_t tmp;
1012 tmp = ((Adc *)hw)->INPUTCTRL.reg;
1013 tmp = (tmp & ADC_INPUTCTRL_MUXPOS_Msk) >> ADC_INPUTCTRL_MUXPOS_Pos;
1014 return tmp;
1015 }
1016
hri_adc_set_INPUTCTRL_MUXNEG_bf(const void * const hw,hri_adc_inputctrl_reg_t mask)1017 static inline void hri_adc_set_INPUTCTRL_MUXNEG_bf(const void *const hw, hri_adc_inputctrl_reg_t mask)
1018 {
1019 ADC_CRITICAL_SECTION_ENTER();
1020 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1021 ((Adc *)hw)->INPUTCTRL.reg |= ADC_INPUTCTRL_MUXNEG(mask);
1022 ADC_CRITICAL_SECTION_LEAVE();
1023 }
1024
hri_adc_get_INPUTCTRL_MUXNEG_bf(const void * const hw,hri_adc_inputctrl_reg_t mask)1025 static inline hri_adc_inputctrl_reg_t hri_adc_get_INPUTCTRL_MUXNEG_bf(const void *const hw,
1026 hri_adc_inputctrl_reg_t mask)
1027 {
1028 uint16_t tmp;
1029 tmp = ((Adc *)hw)->INPUTCTRL.reg;
1030 tmp = (tmp & ADC_INPUTCTRL_MUXNEG(mask)) >> ADC_INPUTCTRL_MUXNEG_Pos;
1031 return tmp;
1032 }
1033
hri_adc_write_INPUTCTRL_MUXNEG_bf(const void * const hw,hri_adc_inputctrl_reg_t data)1034 static inline void hri_adc_write_INPUTCTRL_MUXNEG_bf(const void *const hw, hri_adc_inputctrl_reg_t data)
1035 {
1036 uint16_t tmp;
1037 ADC_CRITICAL_SECTION_ENTER();
1038 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1039 tmp = ((Adc *)hw)->INPUTCTRL.reg;
1040 tmp &= ~ADC_INPUTCTRL_MUXNEG_Msk;
1041 tmp |= ADC_INPUTCTRL_MUXNEG(data);
1042 ((Adc *)hw)->INPUTCTRL.reg = tmp;
1043 ADC_CRITICAL_SECTION_LEAVE();
1044 }
1045
hri_adc_clear_INPUTCTRL_MUXNEG_bf(const void * const hw,hri_adc_inputctrl_reg_t mask)1046 static inline void hri_adc_clear_INPUTCTRL_MUXNEG_bf(const void *const hw, hri_adc_inputctrl_reg_t mask)
1047 {
1048 ADC_CRITICAL_SECTION_ENTER();
1049 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1050 ((Adc *)hw)->INPUTCTRL.reg &= ~ADC_INPUTCTRL_MUXNEG(mask);
1051 ADC_CRITICAL_SECTION_LEAVE();
1052 }
1053
hri_adc_toggle_INPUTCTRL_MUXNEG_bf(const void * const hw,hri_adc_inputctrl_reg_t mask)1054 static inline void hri_adc_toggle_INPUTCTRL_MUXNEG_bf(const void *const hw, hri_adc_inputctrl_reg_t mask)
1055 {
1056 ADC_CRITICAL_SECTION_ENTER();
1057 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1058 ((Adc *)hw)->INPUTCTRL.reg ^= ADC_INPUTCTRL_MUXNEG(mask);
1059 ADC_CRITICAL_SECTION_LEAVE();
1060 }
1061
hri_adc_read_INPUTCTRL_MUXNEG_bf(const void * const hw)1062 static inline hri_adc_inputctrl_reg_t hri_adc_read_INPUTCTRL_MUXNEG_bf(const void *const hw)
1063 {
1064 uint16_t tmp;
1065 tmp = ((Adc *)hw)->INPUTCTRL.reg;
1066 tmp = (tmp & ADC_INPUTCTRL_MUXNEG_Msk) >> ADC_INPUTCTRL_MUXNEG_Pos;
1067 return tmp;
1068 }
1069
hri_adc_set_INPUTCTRL_reg(const void * const hw,hri_adc_inputctrl_reg_t mask)1070 static inline void hri_adc_set_INPUTCTRL_reg(const void *const hw, hri_adc_inputctrl_reg_t mask)
1071 {
1072 ADC_CRITICAL_SECTION_ENTER();
1073 ((Adc *)hw)->INPUTCTRL.reg |= mask;
1074 ADC_CRITICAL_SECTION_LEAVE();
1075 }
1076
hri_adc_get_INPUTCTRL_reg(const void * const hw,hri_adc_inputctrl_reg_t mask)1077 static inline hri_adc_inputctrl_reg_t hri_adc_get_INPUTCTRL_reg(const void *const hw, hri_adc_inputctrl_reg_t mask)
1078 {
1079 uint16_t tmp;
1080 tmp = ((Adc *)hw)->INPUTCTRL.reg;
1081 tmp &= mask;
1082 return tmp;
1083 }
1084
hri_adc_write_INPUTCTRL_reg(const void * const hw,hri_adc_inputctrl_reg_t data)1085 static inline void hri_adc_write_INPUTCTRL_reg(const void *const hw, hri_adc_inputctrl_reg_t data)
1086 {
1087 ADC_CRITICAL_SECTION_ENTER();
1088 ((Adc *)hw)->INPUTCTRL.reg = data;
1089 ADC_CRITICAL_SECTION_LEAVE();
1090 }
1091
hri_adc_clear_INPUTCTRL_reg(const void * const hw,hri_adc_inputctrl_reg_t mask)1092 static inline void hri_adc_clear_INPUTCTRL_reg(const void *const hw, hri_adc_inputctrl_reg_t mask)
1093 {
1094 ADC_CRITICAL_SECTION_ENTER();
1095 ((Adc *)hw)->INPUTCTRL.reg &= ~mask;
1096 ADC_CRITICAL_SECTION_LEAVE();
1097 }
1098
hri_adc_toggle_INPUTCTRL_reg(const void * const hw,hri_adc_inputctrl_reg_t mask)1099 static inline void hri_adc_toggle_INPUTCTRL_reg(const void *const hw, hri_adc_inputctrl_reg_t mask)
1100 {
1101 ADC_CRITICAL_SECTION_ENTER();
1102 ((Adc *)hw)->INPUTCTRL.reg ^= mask;
1103 ADC_CRITICAL_SECTION_LEAVE();
1104 }
1105
hri_adc_read_INPUTCTRL_reg(const void * const hw)1106 static inline hri_adc_inputctrl_reg_t hri_adc_read_INPUTCTRL_reg(const void *const hw)
1107 {
1108 return ((Adc *)hw)->INPUTCTRL.reg;
1109 }
1110
hri_adc_set_CTRLC_DIFFMODE_bit(const void * const hw)1111 static inline void hri_adc_set_CTRLC_DIFFMODE_bit(const void *const hw)
1112 {
1113 ADC_CRITICAL_SECTION_ENTER();
1114 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1115 ((Adc *)hw)->CTRLC.reg |= ADC_CTRLC_DIFFMODE;
1116 ADC_CRITICAL_SECTION_LEAVE();
1117 }
1118
hri_adc_get_CTRLC_DIFFMODE_bit(const void * const hw)1119 static inline bool hri_adc_get_CTRLC_DIFFMODE_bit(const void *const hw)
1120 {
1121 uint16_t tmp;
1122 tmp = ((Adc *)hw)->CTRLC.reg;
1123 tmp = (tmp & ADC_CTRLC_DIFFMODE) >> ADC_CTRLC_DIFFMODE_Pos;
1124 return (bool)tmp;
1125 }
1126
hri_adc_write_CTRLC_DIFFMODE_bit(const void * const hw,bool value)1127 static inline void hri_adc_write_CTRLC_DIFFMODE_bit(const void *const hw, bool value)
1128 {
1129 uint16_t tmp;
1130 ADC_CRITICAL_SECTION_ENTER();
1131 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1132 tmp = ((Adc *)hw)->CTRLC.reg;
1133 tmp &= ~ADC_CTRLC_DIFFMODE;
1134 tmp |= value << ADC_CTRLC_DIFFMODE_Pos;
1135 ((Adc *)hw)->CTRLC.reg = tmp;
1136 ADC_CRITICAL_SECTION_LEAVE();
1137 }
1138
hri_adc_clear_CTRLC_DIFFMODE_bit(const void * const hw)1139 static inline void hri_adc_clear_CTRLC_DIFFMODE_bit(const void *const hw)
1140 {
1141 ADC_CRITICAL_SECTION_ENTER();
1142 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1143 ((Adc *)hw)->CTRLC.reg &= ~ADC_CTRLC_DIFFMODE;
1144 ADC_CRITICAL_SECTION_LEAVE();
1145 }
1146
hri_adc_toggle_CTRLC_DIFFMODE_bit(const void * const hw)1147 static inline void hri_adc_toggle_CTRLC_DIFFMODE_bit(const void *const hw)
1148 {
1149 ADC_CRITICAL_SECTION_ENTER();
1150 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1151 ((Adc *)hw)->CTRLC.reg ^= ADC_CTRLC_DIFFMODE;
1152 ADC_CRITICAL_SECTION_LEAVE();
1153 }
1154
hri_adc_set_CTRLC_LEFTADJ_bit(const void * const hw)1155 static inline void hri_adc_set_CTRLC_LEFTADJ_bit(const void *const hw)
1156 {
1157 ADC_CRITICAL_SECTION_ENTER();
1158 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1159 ((Adc *)hw)->CTRLC.reg |= ADC_CTRLC_LEFTADJ;
1160 ADC_CRITICAL_SECTION_LEAVE();
1161 }
1162
hri_adc_get_CTRLC_LEFTADJ_bit(const void * const hw)1163 static inline bool hri_adc_get_CTRLC_LEFTADJ_bit(const void *const hw)
1164 {
1165 uint16_t tmp;
1166 tmp = ((Adc *)hw)->CTRLC.reg;
1167 tmp = (tmp & ADC_CTRLC_LEFTADJ) >> ADC_CTRLC_LEFTADJ_Pos;
1168 return (bool)tmp;
1169 }
1170
hri_adc_write_CTRLC_LEFTADJ_bit(const void * const hw,bool value)1171 static inline void hri_adc_write_CTRLC_LEFTADJ_bit(const void *const hw, bool value)
1172 {
1173 uint16_t tmp;
1174 ADC_CRITICAL_SECTION_ENTER();
1175 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1176 tmp = ((Adc *)hw)->CTRLC.reg;
1177 tmp &= ~ADC_CTRLC_LEFTADJ;
1178 tmp |= value << ADC_CTRLC_LEFTADJ_Pos;
1179 ((Adc *)hw)->CTRLC.reg = tmp;
1180 ADC_CRITICAL_SECTION_LEAVE();
1181 }
1182
hri_adc_clear_CTRLC_LEFTADJ_bit(const void * const hw)1183 static inline void hri_adc_clear_CTRLC_LEFTADJ_bit(const void *const hw)
1184 {
1185 ADC_CRITICAL_SECTION_ENTER();
1186 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1187 ((Adc *)hw)->CTRLC.reg &= ~ADC_CTRLC_LEFTADJ;
1188 ADC_CRITICAL_SECTION_LEAVE();
1189 }
1190
hri_adc_toggle_CTRLC_LEFTADJ_bit(const void * const hw)1191 static inline void hri_adc_toggle_CTRLC_LEFTADJ_bit(const void *const hw)
1192 {
1193 ADC_CRITICAL_SECTION_ENTER();
1194 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1195 ((Adc *)hw)->CTRLC.reg ^= ADC_CTRLC_LEFTADJ;
1196 ADC_CRITICAL_SECTION_LEAVE();
1197 }
1198
hri_adc_set_CTRLC_FREERUN_bit(const void * const hw)1199 static inline void hri_adc_set_CTRLC_FREERUN_bit(const void *const hw)
1200 {
1201 ADC_CRITICAL_SECTION_ENTER();
1202 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1203 ((Adc *)hw)->CTRLC.reg |= ADC_CTRLC_FREERUN;
1204 ADC_CRITICAL_SECTION_LEAVE();
1205 }
1206
hri_adc_get_CTRLC_FREERUN_bit(const void * const hw)1207 static inline bool hri_adc_get_CTRLC_FREERUN_bit(const void *const hw)
1208 {
1209 uint16_t tmp;
1210 tmp = ((Adc *)hw)->CTRLC.reg;
1211 tmp = (tmp & ADC_CTRLC_FREERUN) >> ADC_CTRLC_FREERUN_Pos;
1212 return (bool)tmp;
1213 }
1214
hri_adc_write_CTRLC_FREERUN_bit(const void * const hw,bool value)1215 static inline void hri_adc_write_CTRLC_FREERUN_bit(const void *const hw, bool value)
1216 {
1217 uint16_t tmp;
1218 ADC_CRITICAL_SECTION_ENTER();
1219 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1220 tmp = ((Adc *)hw)->CTRLC.reg;
1221 tmp &= ~ADC_CTRLC_FREERUN;
1222 tmp |= value << ADC_CTRLC_FREERUN_Pos;
1223 ((Adc *)hw)->CTRLC.reg = tmp;
1224 ADC_CRITICAL_SECTION_LEAVE();
1225 }
1226
hri_adc_clear_CTRLC_FREERUN_bit(const void * const hw)1227 static inline void hri_adc_clear_CTRLC_FREERUN_bit(const void *const hw)
1228 {
1229 ADC_CRITICAL_SECTION_ENTER();
1230 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1231 ((Adc *)hw)->CTRLC.reg &= ~ADC_CTRLC_FREERUN;
1232 ADC_CRITICAL_SECTION_LEAVE();
1233 }
1234
hri_adc_toggle_CTRLC_FREERUN_bit(const void * const hw)1235 static inline void hri_adc_toggle_CTRLC_FREERUN_bit(const void *const hw)
1236 {
1237 ADC_CRITICAL_SECTION_ENTER();
1238 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1239 ((Adc *)hw)->CTRLC.reg ^= ADC_CTRLC_FREERUN;
1240 ADC_CRITICAL_SECTION_LEAVE();
1241 }
1242
hri_adc_set_CTRLC_CORREN_bit(const void * const hw)1243 static inline void hri_adc_set_CTRLC_CORREN_bit(const void *const hw)
1244 {
1245 ADC_CRITICAL_SECTION_ENTER();
1246 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1247 ((Adc *)hw)->CTRLC.reg |= ADC_CTRLC_CORREN;
1248 ADC_CRITICAL_SECTION_LEAVE();
1249 }
1250
hri_adc_get_CTRLC_CORREN_bit(const void * const hw)1251 static inline bool hri_adc_get_CTRLC_CORREN_bit(const void *const hw)
1252 {
1253 uint16_t tmp;
1254 tmp = ((Adc *)hw)->CTRLC.reg;
1255 tmp = (tmp & ADC_CTRLC_CORREN) >> ADC_CTRLC_CORREN_Pos;
1256 return (bool)tmp;
1257 }
1258
hri_adc_write_CTRLC_CORREN_bit(const void * const hw,bool value)1259 static inline void hri_adc_write_CTRLC_CORREN_bit(const void *const hw, bool value)
1260 {
1261 uint16_t tmp;
1262 ADC_CRITICAL_SECTION_ENTER();
1263 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1264 tmp = ((Adc *)hw)->CTRLC.reg;
1265 tmp &= ~ADC_CTRLC_CORREN;
1266 tmp |= value << ADC_CTRLC_CORREN_Pos;
1267 ((Adc *)hw)->CTRLC.reg = tmp;
1268 ADC_CRITICAL_SECTION_LEAVE();
1269 }
1270
hri_adc_clear_CTRLC_CORREN_bit(const void * const hw)1271 static inline void hri_adc_clear_CTRLC_CORREN_bit(const void *const hw)
1272 {
1273 ADC_CRITICAL_SECTION_ENTER();
1274 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1275 ((Adc *)hw)->CTRLC.reg &= ~ADC_CTRLC_CORREN;
1276 ADC_CRITICAL_SECTION_LEAVE();
1277 }
1278
hri_adc_toggle_CTRLC_CORREN_bit(const void * const hw)1279 static inline void hri_adc_toggle_CTRLC_CORREN_bit(const void *const hw)
1280 {
1281 ADC_CRITICAL_SECTION_ENTER();
1282 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1283 ((Adc *)hw)->CTRLC.reg ^= ADC_CTRLC_CORREN;
1284 ADC_CRITICAL_SECTION_LEAVE();
1285 }
1286
hri_adc_set_CTRLC_RESSEL_bf(const void * const hw,hri_adc_ctrlc_reg_t mask)1287 static inline void hri_adc_set_CTRLC_RESSEL_bf(const void *const hw, hri_adc_ctrlc_reg_t mask)
1288 {
1289 ADC_CRITICAL_SECTION_ENTER();
1290 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1291 ((Adc *)hw)->CTRLC.reg |= ADC_CTRLC_RESSEL(mask);
1292 ADC_CRITICAL_SECTION_LEAVE();
1293 }
1294
hri_adc_get_CTRLC_RESSEL_bf(const void * const hw,hri_adc_ctrlc_reg_t mask)1295 static inline hri_adc_ctrlc_reg_t hri_adc_get_CTRLC_RESSEL_bf(const void *const hw, hri_adc_ctrlc_reg_t mask)
1296 {
1297 uint16_t tmp;
1298 tmp = ((Adc *)hw)->CTRLC.reg;
1299 tmp = (tmp & ADC_CTRLC_RESSEL(mask)) >> ADC_CTRLC_RESSEL_Pos;
1300 return tmp;
1301 }
1302
hri_adc_write_CTRLC_RESSEL_bf(const void * const hw,hri_adc_ctrlc_reg_t data)1303 static inline void hri_adc_write_CTRLC_RESSEL_bf(const void *const hw, hri_adc_ctrlc_reg_t data)
1304 {
1305 uint16_t tmp;
1306 ADC_CRITICAL_SECTION_ENTER();
1307 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1308 tmp = ((Adc *)hw)->CTRLC.reg;
1309 tmp &= ~ADC_CTRLC_RESSEL_Msk;
1310 tmp |= ADC_CTRLC_RESSEL(data);
1311 ((Adc *)hw)->CTRLC.reg = tmp;
1312 ADC_CRITICAL_SECTION_LEAVE();
1313 }
1314
hri_adc_clear_CTRLC_RESSEL_bf(const void * const hw,hri_adc_ctrlc_reg_t mask)1315 static inline void hri_adc_clear_CTRLC_RESSEL_bf(const void *const hw, hri_adc_ctrlc_reg_t mask)
1316 {
1317 ADC_CRITICAL_SECTION_ENTER();
1318 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1319 ((Adc *)hw)->CTRLC.reg &= ~ADC_CTRLC_RESSEL(mask);
1320 ADC_CRITICAL_SECTION_LEAVE();
1321 }
1322
hri_adc_toggle_CTRLC_RESSEL_bf(const void * const hw,hri_adc_ctrlc_reg_t mask)1323 static inline void hri_adc_toggle_CTRLC_RESSEL_bf(const void *const hw, hri_adc_ctrlc_reg_t mask)
1324 {
1325 ADC_CRITICAL_SECTION_ENTER();
1326 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1327 ((Adc *)hw)->CTRLC.reg ^= ADC_CTRLC_RESSEL(mask);
1328 ADC_CRITICAL_SECTION_LEAVE();
1329 }
1330
hri_adc_read_CTRLC_RESSEL_bf(const void * const hw)1331 static inline hri_adc_ctrlc_reg_t hri_adc_read_CTRLC_RESSEL_bf(const void *const hw)
1332 {
1333 uint16_t tmp;
1334 tmp = ((Adc *)hw)->CTRLC.reg;
1335 tmp = (tmp & ADC_CTRLC_RESSEL_Msk) >> ADC_CTRLC_RESSEL_Pos;
1336 return tmp;
1337 }
1338
hri_adc_set_CTRLC_WINMODE_bf(const void * const hw,hri_adc_ctrlc_reg_t mask)1339 static inline void hri_adc_set_CTRLC_WINMODE_bf(const void *const hw, hri_adc_ctrlc_reg_t mask)
1340 {
1341 ADC_CRITICAL_SECTION_ENTER();
1342 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1343 ((Adc *)hw)->CTRLC.reg |= ADC_CTRLC_WINMODE(mask);
1344 ADC_CRITICAL_SECTION_LEAVE();
1345 }
1346
hri_adc_get_CTRLC_WINMODE_bf(const void * const hw,hri_adc_ctrlc_reg_t mask)1347 static inline hri_adc_ctrlc_reg_t hri_adc_get_CTRLC_WINMODE_bf(const void *const hw, hri_adc_ctrlc_reg_t mask)
1348 {
1349 uint16_t tmp;
1350 tmp = ((Adc *)hw)->CTRLC.reg;
1351 tmp = (tmp & ADC_CTRLC_WINMODE(mask)) >> ADC_CTRLC_WINMODE_Pos;
1352 return tmp;
1353 }
1354
hri_adc_write_CTRLC_WINMODE_bf(const void * const hw,hri_adc_ctrlc_reg_t data)1355 static inline void hri_adc_write_CTRLC_WINMODE_bf(const void *const hw, hri_adc_ctrlc_reg_t data)
1356 {
1357 uint16_t tmp;
1358 ADC_CRITICAL_SECTION_ENTER();
1359 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1360 tmp = ((Adc *)hw)->CTRLC.reg;
1361 tmp &= ~ADC_CTRLC_WINMODE_Msk;
1362 tmp |= ADC_CTRLC_WINMODE(data);
1363 ((Adc *)hw)->CTRLC.reg = tmp;
1364 ADC_CRITICAL_SECTION_LEAVE();
1365 }
1366
hri_adc_clear_CTRLC_WINMODE_bf(const void * const hw,hri_adc_ctrlc_reg_t mask)1367 static inline void hri_adc_clear_CTRLC_WINMODE_bf(const void *const hw, hri_adc_ctrlc_reg_t mask)
1368 {
1369 ADC_CRITICAL_SECTION_ENTER();
1370 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1371 ((Adc *)hw)->CTRLC.reg &= ~ADC_CTRLC_WINMODE(mask);
1372 ADC_CRITICAL_SECTION_LEAVE();
1373 }
1374
hri_adc_toggle_CTRLC_WINMODE_bf(const void * const hw,hri_adc_ctrlc_reg_t mask)1375 static inline void hri_adc_toggle_CTRLC_WINMODE_bf(const void *const hw, hri_adc_ctrlc_reg_t mask)
1376 {
1377 ADC_CRITICAL_SECTION_ENTER();
1378 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1379 ((Adc *)hw)->CTRLC.reg ^= ADC_CTRLC_WINMODE(mask);
1380 ADC_CRITICAL_SECTION_LEAVE();
1381 }
1382
hri_adc_read_CTRLC_WINMODE_bf(const void * const hw)1383 static inline hri_adc_ctrlc_reg_t hri_adc_read_CTRLC_WINMODE_bf(const void *const hw)
1384 {
1385 uint16_t tmp;
1386 tmp = ((Adc *)hw)->CTRLC.reg;
1387 tmp = (tmp & ADC_CTRLC_WINMODE_Msk) >> ADC_CTRLC_WINMODE_Pos;
1388 return tmp;
1389 }
1390
hri_adc_set_CTRLC_reg(const void * const hw,hri_adc_ctrlc_reg_t mask)1391 static inline void hri_adc_set_CTRLC_reg(const void *const hw, hri_adc_ctrlc_reg_t mask)
1392 {
1393 ADC_CRITICAL_SECTION_ENTER();
1394 ((Adc *)hw)->CTRLC.reg |= mask;
1395 ADC_CRITICAL_SECTION_LEAVE();
1396 }
1397
hri_adc_get_CTRLC_reg(const void * const hw,hri_adc_ctrlc_reg_t mask)1398 static inline hri_adc_ctrlc_reg_t hri_adc_get_CTRLC_reg(const void *const hw, hri_adc_ctrlc_reg_t mask)
1399 {
1400 uint16_t tmp;
1401 tmp = ((Adc *)hw)->CTRLC.reg;
1402 tmp &= mask;
1403 return tmp;
1404 }
1405
hri_adc_write_CTRLC_reg(const void * const hw,hri_adc_ctrlc_reg_t data)1406 static inline void hri_adc_write_CTRLC_reg(const void *const hw, hri_adc_ctrlc_reg_t data)
1407 {
1408 ADC_CRITICAL_SECTION_ENTER();
1409 ((Adc *)hw)->CTRLC.reg = data;
1410 ADC_CRITICAL_SECTION_LEAVE();
1411 }
1412
hri_adc_clear_CTRLC_reg(const void * const hw,hri_adc_ctrlc_reg_t mask)1413 static inline void hri_adc_clear_CTRLC_reg(const void *const hw, hri_adc_ctrlc_reg_t mask)
1414 {
1415 ADC_CRITICAL_SECTION_ENTER();
1416 ((Adc *)hw)->CTRLC.reg &= ~mask;
1417 ADC_CRITICAL_SECTION_LEAVE();
1418 }
1419
hri_adc_toggle_CTRLC_reg(const void * const hw,hri_adc_ctrlc_reg_t mask)1420 static inline void hri_adc_toggle_CTRLC_reg(const void *const hw, hri_adc_ctrlc_reg_t mask)
1421 {
1422 ADC_CRITICAL_SECTION_ENTER();
1423 ((Adc *)hw)->CTRLC.reg ^= mask;
1424 ADC_CRITICAL_SECTION_LEAVE();
1425 }
1426
hri_adc_read_CTRLC_reg(const void * const hw)1427 static inline hri_adc_ctrlc_reg_t hri_adc_read_CTRLC_reg(const void *const hw)
1428 {
1429 return ((Adc *)hw)->CTRLC.reg;
1430 }
1431
hri_adc_set_AVGCTRL_SAMPLENUM_bf(const void * const hw,hri_adc_avgctrl_reg_t mask)1432 static inline void hri_adc_set_AVGCTRL_SAMPLENUM_bf(const void *const hw, hri_adc_avgctrl_reg_t mask)
1433 {
1434 ADC_CRITICAL_SECTION_ENTER();
1435 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1436 ((Adc *)hw)->AVGCTRL.reg |= ADC_AVGCTRL_SAMPLENUM(mask);
1437 ADC_CRITICAL_SECTION_LEAVE();
1438 }
1439
hri_adc_get_AVGCTRL_SAMPLENUM_bf(const void * const hw,hri_adc_avgctrl_reg_t mask)1440 static inline hri_adc_avgctrl_reg_t hri_adc_get_AVGCTRL_SAMPLENUM_bf(const void *const hw, hri_adc_avgctrl_reg_t mask)
1441 {
1442 uint8_t tmp;
1443 tmp = ((Adc *)hw)->AVGCTRL.reg;
1444 tmp = (tmp & ADC_AVGCTRL_SAMPLENUM(mask)) >> ADC_AVGCTRL_SAMPLENUM_Pos;
1445 return tmp;
1446 }
1447
hri_adc_write_AVGCTRL_SAMPLENUM_bf(const void * const hw,hri_adc_avgctrl_reg_t data)1448 static inline void hri_adc_write_AVGCTRL_SAMPLENUM_bf(const void *const hw, hri_adc_avgctrl_reg_t data)
1449 {
1450 uint8_t tmp;
1451 ADC_CRITICAL_SECTION_ENTER();
1452 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1453 tmp = ((Adc *)hw)->AVGCTRL.reg;
1454 tmp &= ~ADC_AVGCTRL_SAMPLENUM_Msk;
1455 tmp |= ADC_AVGCTRL_SAMPLENUM(data);
1456 ((Adc *)hw)->AVGCTRL.reg = tmp;
1457 ADC_CRITICAL_SECTION_LEAVE();
1458 }
1459
hri_adc_clear_AVGCTRL_SAMPLENUM_bf(const void * const hw,hri_adc_avgctrl_reg_t mask)1460 static inline void hri_adc_clear_AVGCTRL_SAMPLENUM_bf(const void *const hw, hri_adc_avgctrl_reg_t mask)
1461 {
1462 ADC_CRITICAL_SECTION_ENTER();
1463 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1464 ((Adc *)hw)->AVGCTRL.reg &= ~ADC_AVGCTRL_SAMPLENUM(mask);
1465 ADC_CRITICAL_SECTION_LEAVE();
1466 }
1467
hri_adc_toggle_AVGCTRL_SAMPLENUM_bf(const void * const hw,hri_adc_avgctrl_reg_t mask)1468 static inline void hri_adc_toggle_AVGCTRL_SAMPLENUM_bf(const void *const hw, hri_adc_avgctrl_reg_t mask)
1469 {
1470 ADC_CRITICAL_SECTION_ENTER();
1471 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1472 ((Adc *)hw)->AVGCTRL.reg ^= ADC_AVGCTRL_SAMPLENUM(mask);
1473 ADC_CRITICAL_SECTION_LEAVE();
1474 }
1475
hri_adc_read_AVGCTRL_SAMPLENUM_bf(const void * const hw)1476 static inline hri_adc_avgctrl_reg_t hri_adc_read_AVGCTRL_SAMPLENUM_bf(const void *const hw)
1477 {
1478 uint8_t tmp;
1479 tmp = ((Adc *)hw)->AVGCTRL.reg;
1480 tmp = (tmp & ADC_AVGCTRL_SAMPLENUM_Msk) >> ADC_AVGCTRL_SAMPLENUM_Pos;
1481 return tmp;
1482 }
1483
hri_adc_set_AVGCTRL_ADJRES_bf(const void * const hw,hri_adc_avgctrl_reg_t mask)1484 static inline void hri_adc_set_AVGCTRL_ADJRES_bf(const void *const hw, hri_adc_avgctrl_reg_t mask)
1485 {
1486 ADC_CRITICAL_SECTION_ENTER();
1487 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1488 ((Adc *)hw)->AVGCTRL.reg |= ADC_AVGCTRL_ADJRES(mask);
1489 ADC_CRITICAL_SECTION_LEAVE();
1490 }
1491
hri_adc_get_AVGCTRL_ADJRES_bf(const void * const hw,hri_adc_avgctrl_reg_t mask)1492 static inline hri_adc_avgctrl_reg_t hri_adc_get_AVGCTRL_ADJRES_bf(const void *const hw, hri_adc_avgctrl_reg_t mask)
1493 {
1494 uint8_t tmp;
1495 tmp = ((Adc *)hw)->AVGCTRL.reg;
1496 tmp = (tmp & ADC_AVGCTRL_ADJRES(mask)) >> ADC_AVGCTRL_ADJRES_Pos;
1497 return tmp;
1498 }
1499
hri_adc_write_AVGCTRL_ADJRES_bf(const void * const hw,hri_adc_avgctrl_reg_t data)1500 static inline void hri_adc_write_AVGCTRL_ADJRES_bf(const void *const hw, hri_adc_avgctrl_reg_t data)
1501 {
1502 uint8_t tmp;
1503 ADC_CRITICAL_SECTION_ENTER();
1504 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1505 tmp = ((Adc *)hw)->AVGCTRL.reg;
1506 tmp &= ~ADC_AVGCTRL_ADJRES_Msk;
1507 tmp |= ADC_AVGCTRL_ADJRES(data);
1508 ((Adc *)hw)->AVGCTRL.reg = tmp;
1509 ADC_CRITICAL_SECTION_LEAVE();
1510 }
1511
hri_adc_clear_AVGCTRL_ADJRES_bf(const void * const hw,hri_adc_avgctrl_reg_t mask)1512 static inline void hri_adc_clear_AVGCTRL_ADJRES_bf(const void *const hw, hri_adc_avgctrl_reg_t mask)
1513 {
1514 ADC_CRITICAL_SECTION_ENTER();
1515 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1516 ((Adc *)hw)->AVGCTRL.reg &= ~ADC_AVGCTRL_ADJRES(mask);
1517 ADC_CRITICAL_SECTION_LEAVE();
1518 }
1519
hri_adc_toggle_AVGCTRL_ADJRES_bf(const void * const hw,hri_adc_avgctrl_reg_t mask)1520 static inline void hri_adc_toggle_AVGCTRL_ADJRES_bf(const void *const hw, hri_adc_avgctrl_reg_t mask)
1521 {
1522 ADC_CRITICAL_SECTION_ENTER();
1523 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1524 ((Adc *)hw)->AVGCTRL.reg ^= ADC_AVGCTRL_ADJRES(mask);
1525 ADC_CRITICAL_SECTION_LEAVE();
1526 }
1527
hri_adc_read_AVGCTRL_ADJRES_bf(const void * const hw)1528 static inline hri_adc_avgctrl_reg_t hri_adc_read_AVGCTRL_ADJRES_bf(const void *const hw)
1529 {
1530 uint8_t tmp;
1531 tmp = ((Adc *)hw)->AVGCTRL.reg;
1532 tmp = (tmp & ADC_AVGCTRL_ADJRES_Msk) >> ADC_AVGCTRL_ADJRES_Pos;
1533 return tmp;
1534 }
1535
hri_adc_set_AVGCTRL_reg(const void * const hw,hri_adc_avgctrl_reg_t mask)1536 static inline void hri_adc_set_AVGCTRL_reg(const void *const hw, hri_adc_avgctrl_reg_t mask)
1537 {
1538 ADC_CRITICAL_SECTION_ENTER();
1539 ((Adc *)hw)->AVGCTRL.reg |= mask;
1540 ADC_CRITICAL_SECTION_LEAVE();
1541 }
1542
hri_adc_get_AVGCTRL_reg(const void * const hw,hri_adc_avgctrl_reg_t mask)1543 static inline hri_adc_avgctrl_reg_t hri_adc_get_AVGCTRL_reg(const void *const hw, hri_adc_avgctrl_reg_t mask)
1544 {
1545 uint8_t tmp;
1546 tmp = ((Adc *)hw)->AVGCTRL.reg;
1547 tmp &= mask;
1548 return tmp;
1549 }
1550
hri_adc_write_AVGCTRL_reg(const void * const hw,hri_adc_avgctrl_reg_t data)1551 static inline void hri_adc_write_AVGCTRL_reg(const void *const hw, hri_adc_avgctrl_reg_t data)
1552 {
1553 ADC_CRITICAL_SECTION_ENTER();
1554 ((Adc *)hw)->AVGCTRL.reg = data;
1555 ADC_CRITICAL_SECTION_LEAVE();
1556 }
1557
hri_adc_clear_AVGCTRL_reg(const void * const hw,hri_adc_avgctrl_reg_t mask)1558 static inline void hri_adc_clear_AVGCTRL_reg(const void *const hw, hri_adc_avgctrl_reg_t mask)
1559 {
1560 ADC_CRITICAL_SECTION_ENTER();
1561 ((Adc *)hw)->AVGCTRL.reg &= ~mask;
1562 ADC_CRITICAL_SECTION_LEAVE();
1563 }
1564
hri_adc_toggle_AVGCTRL_reg(const void * const hw,hri_adc_avgctrl_reg_t mask)1565 static inline void hri_adc_toggle_AVGCTRL_reg(const void *const hw, hri_adc_avgctrl_reg_t mask)
1566 {
1567 ADC_CRITICAL_SECTION_ENTER();
1568 ((Adc *)hw)->AVGCTRL.reg ^= mask;
1569 ADC_CRITICAL_SECTION_LEAVE();
1570 }
1571
hri_adc_read_AVGCTRL_reg(const void * const hw)1572 static inline hri_adc_avgctrl_reg_t hri_adc_read_AVGCTRL_reg(const void *const hw)
1573 {
1574 return ((Adc *)hw)->AVGCTRL.reg;
1575 }
1576
hri_adc_set_SAMPCTRL_OFFCOMP_bit(const void * const hw)1577 static inline void hri_adc_set_SAMPCTRL_OFFCOMP_bit(const void *const hw)
1578 {
1579 ADC_CRITICAL_SECTION_ENTER();
1580 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1581 ((Adc *)hw)->SAMPCTRL.reg |= ADC_SAMPCTRL_OFFCOMP;
1582 ADC_CRITICAL_SECTION_LEAVE();
1583 }
1584
hri_adc_get_SAMPCTRL_OFFCOMP_bit(const void * const hw)1585 static inline bool hri_adc_get_SAMPCTRL_OFFCOMP_bit(const void *const hw)
1586 {
1587 uint8_t tmp;
1588 tmp = ((Adc *)hw)->SAMPCTRL.reg;
1589 tmp = (tmp & ADC_SAMPCTRL_OFFCOMP) >> ADC_SAMPCTRL_OFFCOMP_Pos;
1590 return (bool)tmp;
1591 }
1592
hri_adc_write_SAMPCTRL_OFFCOMP_bit(const void * const hw,bool value)1593 static inline void hri_adc_write_SAMPCTRL_OFFCOMP_bit(const void *const hw, bool value)
1594 {
1595 uint8_t tmp;
1596 ADC_CRITICAL_SECTION_ENTER();
1597 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1598 tmp = ((Adc *)hw)->SAMPCTRL.reg;
1599 tmp &= ~ADC_SAMPCTRL_OFFCOMP;
1600 tmp |= value << ADC_SAMPCTRL_OFFCOMP_Pos;
1601 ((Adc *)hw)->SAMPCTRL.reg = tmp;
1602 ADC_CRITICAL_SECTION_LEAVE();
1603 }
1604
hri_adc_clear_SAMPCTRL_OFFCOMP_bit(const void * const hw)1605 static inline void hri_adc_clear_SAMPCTRL_OFFCOMP_bit(const void *const hw)
1606 {
1607 ADC_CRITICAL_SECTION_ENTER();
1608 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1609 ((Adc *)hw)->SAMPCTRL.reg &= ~ADC_SAMPCTRL_OFFCOMP;
1610 ADC_CRITICAL_SECTION_LEAVE();
1611 }
1612
hri_adc_toggle_SAMPCTRL_OFFCOMP_bit(const void * const hw)1613 static inline void hri_adc_toggle_SAMPCTRL_OFFCOMP_bit(const void *const hw)
1614 {
1615 ADC_CRITICAL_SECTION_ENTER();
1616 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1617 ((Adc *)hw)->SAMPCTRL.reg ^= ADC_SAMPCTRL_OFFCOMP;
1618 ADC_CRITICAL_SECTION_LEAVE();
1619 }
1620
hri_adc_set_SAMPCTRL_SAMPLEN_bf(const void * const hw,hri_adc_sampctrl_reg_t mask)1621 static inline void hri_adc_set_SAMPCTRL_SAMPLEN_bf(const void *const hw, hri_adc_sampctrl_reg_t mask)
1622 {
1623 ADC_CRITICAL_SECTION_ENTER();
1624 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1625 ((Adc *)hw)->SAMPCTRL.reg |= ADC_SAMPCTRL_SAMPLEN(mask);
1626 ADC_CRITICAL_SECTION_LEAVE();
1627 }
1628
hri_adc_get_SAMPCTRL_SAMPLEN_bf(const void * const hw,hri_adc_sampctrl_reg_t mask)1629 static inline hri_adc_sampctrl_reg_t hri_adc_get_SAMPCTRL_SAMPLEN_bf(const void *const hw, hri_adc_sampctrl_reg_t mask)
1630 {
1631 uint8_t tmp;
1632 tmp = ((Adc *)hw)->SAMPCTRL.reg;
1633 tmp = (tmp & ADC_SAMPCTRL_SAMPLEN(mask)) >> ADC_SAMPCTRL_SAMPLEN_Pos;
1634 return tmp;
1635 }
1636
hri_adc_write_SAMPCTRL_SAMPLEN_bf(const void * const hw,hri_adc_sampctrl_reg_t data)1637 static inline void hri_adc_write_SAMPCTRL_SAMPLEN_bf(const void *const hw, hri_adc_sampctrl_reg_t data)
1638 {
1639 uint8_t tmp;
1640 ADC_CRITICAL_SECTION_ENTER();
1641 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1642 tmp = ((Adc *)hw)->SAMPCTRL.reg;
1643 tmp &= ~ADC_SAMPCTRL_SAMPLEN_Msk;
1644 tmp |= ADC_SAMPCTRL_SAMPLEN(data);
1645 ((Adc *)hw)->SAMPCTRL.reg = tmp;
1646 ADC_CRITICAL_SECTION_LEAVE();
1647 }
1648
hri_adc_clear_SAMPCTRL_SAMPLEN_bf(const void * const hw,hri_adc_sampctrl_reg_t mask)1649 static inline void hri_adc_clear_SAMPCTRL_SAMPLEN_bf(const void *const hw, hri_adc_sampctrl_reg_t mask)
1650 {
1651 ADC_CRITICAL_SECTION_ENTER();
1652 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1653 ((Adc *)hw)->SAMPCTRL.reg &= ~ADC_SAMPCTRL_SAMPLEN(mask);
1654 ADC_CRITICAL_SECTION_LEAVE();
1655 }
1656
hri_adc_toggle_SAMPCTRL_SAMPLEN_bf(const void * const hw,hri_adc_sampctrl_reg_t mask)1657 static inline void hri_adc_toggle_SAMPCTRL_SAMPLEN_bf(const void *const hw, hri_adc_sampctrl_reg_t mask)
1658 {
1659 ADC_CRITICAL_SECTION_ENTER();
1660 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
1661 ((Adc *)hw)->SAMPCTRL.reg ^= ADC_SAMPCTRL_SAMPLEN(mask);
1662 ADC_CRITICAL_SECTION_LEAVE();
1663 }
1664
hri_adc_read_SAMPCTRL_SAMPLEN_bf(const void * const hw)1665 static inline hri_adc_sampctrl_reg_t hri_adc_read_SAMPCTRL_SAMPLEN_bf(const void *const hw)
1666 {
1667 uint8_t tmp;
1668 tmp = ((Adc *)hw)->SAMPCTRL.reg;
1669 tmp = (tmp & ADC_SAMPCTRL_SAMPLEN_Msk) >> ADC_SAMPCTRL_SAMPLEN_Pos;
1670 return tmp;
1671 }
1672
hri_adc_set_SAMPCTRL_reg(const void * const hw,hri_adc_sampctrl_reg_t mask)1673 static inline void hri_adc_set_SAMPCTRL_reg(const void *const hw, hri_adc_sampctrl_reg_t mask)
1674 {
1675 ADC_CRITICAL_SECTION_ENTER();
1676 ((Adc *)hw)->SAMPCTRL.reg |= mask;
1677 ADC_CRITICAL_SECTION_LEAVE();
1678 }
1679
hri_adc_get_SAMPCTRL_reg(const void * const hw,hri_adc_sampctrl_reg_t mask)1680 static inline hri_adc_sampctrl_reg_t hri_adc_get_SAMPCTRL_reg(const void *const hw, hri_adc_sampctrl_reg_t mask)
1681 {
1682 uint8_t tmp;
1683 tmp = ((Adc *)hw)->SAMPCTRL.reg;
1684 tmp &= mask;
1685 return tmp;
1686 }
1687
hri_adc_write_SAMPCTRL_reg(const void * const hw,hri_adc_sampctrl_reg_t data)1688 static inline void hri_adc_write_SAMPCTRL_reg(const void *const hw, hri_adc_sampctrl_reg_t data)
1689 {
1690 ADC_CRITICAL_SECTION_ENTER();
1691 ((Adc *)hw)->SAMPCTRL.reg = data;
1692 ADC_CRITICAL_SECTION_LEAVE();
1693 }
1694
hri_adc_clear_SAMPCTRL_reg(const void * const hw,hri_adc_sampctrl_reg_t mask)1695 static inline void hri_adc_clear_SAMPCTRL_reg(const void *const hw, hri_adc_sampctrl_reg_t mask)
1696 {
1697 ADC_CRITICAL_SECTION_ENTER();
1698 ((Adc *)hw)->SAMPCTRL.reg &= ~mask;
1699 ADC_CRITICAL_SECTION_LEAVE();
1700 }
1701
hri_adc_toggle_SAMPCTRL_reg(const void * const hw,hri_adc_sampctrl_reg_t mask)1702 static inline void hri_adc_toggle_SAMPCTRL_reg(const void *const hw, hri_adc_sampctrl_reg_t mask)
1703 {
1704 ADC_CRITICAL_SECTION_ENTER();
1705 ((Adc *)hw)->SAMPCTRL.reg ^= mask;
1706 ADC_CRITICAL_SECTION_LEAVE();
1707 }
1708
hri_adc_read_SAMPCTRL_reg(const void * const hw)1709 static inline hri_adc_sampctrl_reg_t hri_adc_read_SAMPCTRL_reg(const void *const hw)
1710 {
1711 return ((Adc *)hw)->SAMPCTRL.reg;
1712 }
1713
hri_adc_set_WINLT_WINLT_bf(const void * const hw,hri_adc_winlt_reg_t mask)1714 static inline void hri_adc_set_WINLT_WINLT_bf(const void *const hw, hri_adc_winlt_reg_t mask)
1715 {
1716 ADC_CRITICAL_SECTION_ENTER();
1717 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINLT);
1718 ((Adc *)hw)->WINLT.reg |= ADC_WINLT_WINLT(mask);
1719 ADC_CRITICAL_SECTION_LEAVE();
1720 }
1721
hri_adc_get_WINLT_WINLT_bf(const void * const hw,hri_adc_winlt_reg_t mask)1722 static inline hri_adc_winlt_reg_t hri_adc_get_WINLT_WINLT_bf(const void *const hw, hri_adc_winlt_reg_t mask)
1723 {
1724 uint16_t tmp;
1725 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINLT);
1726 tmp = ((Adc *)hw)->WINLT.reg;
1727 tmp = (tmp & ADC_WINLT_WINLT(mask)) >> ADC_WINLT_WINLT_Pos;
1728 return tmp;
1729 }
1730
hri_adc_write_WINLT_WINLT_bf(const void * const hw,hri_adc_winlt_reg_t data)1731 static inline void hri_adc_write_WINLT_WINLT_bf(const void *const hw, hri_adc_winlt_reg_t data)
1732 {
1733 uint16_t tmp;
1734 ADC_CRITICAL_SECTION_ENTER();
1735 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINLT);
1736 tmp = ((Adc *)hw)->WINLT.reg;
1737 tmp &= ~ADC_WINLT_WINLT_Msk;
1738 tmp |= ADC_WINLT_WINLT(data);
1739 ((Adc *)hw)->WINLT.reg = tmp;
1740 ADC_CRITICAL_SECTION_LEAVE();
1741 }
1742
hri_adc_clear_WINLT_WINLT_bf(const void * const hw,hri_adc_winlt_reg_t mask)1743 static inline void hri_adc_clear_WINLT_WINLT_bf(const void *const hw, hri_adc_winlt_reg_t mask)
1744 {
1745 ADC_CRITICAL_SECTION_ENTER();
1746 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINLT);
1747 ((Adc *)hw)->WINLT.reg &= ~ADC_WINLT_WINLT(mask);
1748 ADC_CRITICAL_SECTION_LEAVE();
1749 }
1750
hri_adc_toggle_WINLT_WINLT_bf(const void * const hw,hri_adc_winlt_reg_t mask)1751 static inline void hri_adc_toggle_WINLT_WINLT_bf(const void *const hw, hri_adc_winlt_reg_t mask)
1752 {
1753 ADC_CRITICAL_SECTION_ENTER();
1754 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINLT);
1755 ((Adc *)hw)->WINLT.reg ^= ADC_WINLT_WINLT(mask);
1756 ADC_CRITICAL_SECTION_LEAVE();
1757 }
1758
hri_adc_read_WINLT_WINLT_bf(const void * const hw)1759 static inline hri_adc_winlt_reg_t hri_adc_read_WINLT_WINLT_bf(const void *const hw)
1760 {
1761 uint16_t tmp;
1762 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINLT);
1763 tmp = ((Adc *)hw)->WINLT.reg;
1764 tmp = (tmp & ADC_WINLT_WINLT_Msk) >> ADC_WINLT_WINLT_Pos;
1765 return tmp;
1766 }
1767
hri_adc_set_WINLT_reg(const void * const hw,hri_adc_winlt_reg_t mask)1768 static inline void hri_adc_set_WINLT_reg(const void *const hw, hri_adc_winlt_reg_t mask)
1769 {
1770 ADC_CRITICAL_SECTION_ENTER();
1771 ((Adc *)hw)->WINLT.reg |= mask;
1772 ADC_CRITICAL_SECTION_LEAVE();
1773 }
1774
hri_adc_get_WINLT_reg(const void * const hw,hri_adc_winlt_reg_t mask)1775 static inline hri_adc_winlt_reg_t hri_adc_get_WINLT_reg(const void *const hw, hri_adc_winlt_reg_t mask)
1776 {
1777 uint16_t tmp;
1778 tmp = ((Adc *)hw)->WINLT.reg;
1779 tmp &= mask;
1780 return tmp;
1781 }
1782
hri_adc_write_WINLT_reg(const void * const hw,hri_adc_winlt_reg_t data)1783 static inline void hri_adc_write_WINLT_reg(const void *const hw, hri_adc_winlt_reg_t data)
1784 {
1785 ADC_CRITICAL_SECTION_ENTER();
1786 ((Adc *)hw)->WINLT.reg = data;
1787 ADC_CRITICAL_SECTION_LEAVE();
1788 }
1789
hri_adc_clear_WINLT_reg(const void * const hw,hri_adc_winlt_reg_t mask)1790 static inline void hri_adc_clear_WINLT_reg(const void *const hw, hri_adc_winlt_reg_t mask)
1791 {
1792 ADC_CRITICAL_SECTION_ENTER();
1793 ((Adc *)hw)->WINLT.reg &= ~mask;
1794 ADC_CRITICAL_SECTION_LEAVE();
1795 }
1796
hri_adc_toggle_WINLT_reg(const void * const hw,hri_adc_winlt_reg_t mask)1797 static inline void hri_adc_toggle_WINLT_reg(const void *const hw, hri_adc_winlt_reg_t mask)
1798 {
1799 ADC_CRITICAL_SECTION_ENTER();
1800 ((Adc *)hw)->WINLT.reg ^= mask;
1801 ADC_CRITICAL_SECTION_LEAVE();
1802 }
1803
hri_adc_read_WINLT_reg(const void * const hw)1804 static inline hri_adc_winlt_reg_t hri_adc_read_WINLT_reg(const void *const hw)
1805 {
1806 return ((Adc *)hw)->WINLT.reg;
1807 }
1808
hri_adc_set_WINUT_WINUT_bf(const void * const hw,hri_adc_winut_reg_t mask)1809 static inline void hri_adc_set_WINUT_WINUT_bf(const void *const hw, hri_adc_winut_reg_t mask)
1810 {
1811 ADC_CRITICAL_SECTION_ENTER();
1812 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINUT);
1813 ((Adc *)hw)->WINUT.reg |= ADC_WINUT_WINUT(mask);
1814 ADC_CRITICAL_SECTION_LEAVE();
1815 }
1816
hri_adc_get_WINUT_WINUT_bf(const void * const hw,hri_adc_winut_reg_t mask)1817 static inline hri_adc_winut_reg_t hri_adc_get_WINUT_WINUT_bf(const void *const hw, hri_adc_winut_reg_t mask)
1818 {
1819 uint16_t tmp;
1820 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINUT);
1821 tmp = ((Adc *)hw)->WINUT.reg;
1822 tmp = (tmp & ADC_WINUT_WINUT(mask)) >> ADC_WINUT_WINUT_Pos;
1823 return tmp;
1824 }
1825
hri_adc_write_WINUT_WINUT_bf(const void * const hw,hri_adc_winut_reg_t data)1826 static inline void hri_adc_write_WINUT_WINUT_bf(const void *const hw, hri_adc_winut_reg_t data)
1827 {
1828 uint16_t tmp;
1829 ADC_CRITICAL_SECTION_ENTER();
1830 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINUT);
1831 tmp = ((Adc *)hw)->WINUT.reg;
1832 tmp &= ~ADC_WINUT_WINUT_Msk;
1833 tmp |= ADC_WINUT_WINUT(data);
1834 ((Adc *)hw)->WINUT.reg = tmp;
1835 ADC_CRITICAL_SECTION_LEAVE();
1836 }
1837
hri_adc_clear_WINUT_WINUT_bf(const void * const hw,hri_adc_winut_reg_t mask)1838 static inline void hri_adc_clear_WINUT_WINUT_bf(const void *const hw, hri_adc_winut_reg_t mask)
1839 {
1840 ADC_CRITICAL_SECTION_ENTER();
1841 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINUT);
1842 ((Adc *)hw)->WINUT.reg &= ~ADC_WINUT_WINUT(mask);
1843 ADC_CRITICAL_SECTION_LEAVE();
1844 }
1845
hri_adc_toggle_WINUT_WINUT_bf(const void * const hw,hri_adc_winut_reg_t mask)1846 static inline void hri_adc_toggle_WINUT_WINUT_bf(const void *const hw, hri_adc_winut_reg_t mask)
1847 {
1848 ADC_CRITICAL_SECTION_ENTER();
1849 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINUT);
1850 ((Adc *)hw)->WINUT.reg ^= ADC_WINUT_WINUT(mask);
1851 ADC_CRITICAL_SECTION_LEAVE();
1852 }
1853
hri_adc_read_WINUT_WINUT_bf(const void * const hw)1854 static inline hri_adc_winut_reg_t hri_adc_read_WINUT_WINUT_bf(const void *const hw)
1855 {
1856 uint16_t tmp;
1857 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_WINUT);
1858 tmp = ((Adc *)hw)->WINUT.reg;
1859 tmp = (tmp & ADC_WINUT_WINUT_Msk) >> ADC_WINUT_WINUT_Pos;
1860 return tmp;
1861 }
1862
hri_adc_set_WINUT_reg(const void * const hw,hri_adc_winut_reg_t mask)1863 static inline void hri_adc_set_WINUT_reg(const void *const hw, hri_adc_winut_reg_t mask)
1864 {
1865 ADC_CRITICAL_SECTION_ENTER();
1866 ((Adc *)hw)->WINUT.reg |= mask;
1867 ADC_CRITICAL_SECTION_LEAVE();
1868 }
1869
hri_adc_get_WINUT_reg(const void * const hw,hri_adc_winut_reg_t mask)1870 static inline hri_adc_winut_reg_t hri_adc_get_WINUT_reg(const void *const hw, hri_adc_winut_reg_t mask)
1871 {
1872 uint16_t tmp;
1873 tmp = ((Adc *)hw)->WINUT.reg;
1874 tmp &= mask;
1875 return tmp;
1876 }
1877
hri_adc_write_WINUT_reg(const void * const hw,hri_adc_winut_reg_t data)1878 static inline void hri_adc_write_WINUT_reg(const void *const hw, hri_adc_winut_reg_t data)
1879 {
1880 ADC_CRITICAL_SECTION_ENTER();
1881 ((Adc *)hw)->WINUT.reg = data;
1882 ADC_CRITICAL_SECTION_LEAVE();
1883 }
1884
hri_adc_clear_WINUT_reg(const void * const hw,hri_adc_winut_reg_t mask)1885 static inline void hri_adc_clear_WINUT_reg(const void *const hw, hri_adc_winut_reg_t mask)
1886 {
1887 ADC_CRITICAL_SECTION_ENTER();
1888 ((Adc *)hw)->WINUT.reg &= ~mask;
1889 ADC_CRITICAL_SECTION_LEAVE();
1890 }
1891
hri_adc_toggle_WINUT_reg(const void * const hw,hri_adc_winut_reg_t mask)1892 static inline void hri_adc_toggle_WINUT_reg(const void *const hw, hri_adc_winut_reg_t mask)
1893 {
1894 ADC_CRITICAL_SECTION_ENTER();
1895 ((Adc *)hw)->WINUT.reg ^= mask;
1896 ADC_CRITICAL_SECTION_LEAVE();
1897 }
1898
hri_adc_read_WINUT_reg(const void * const hw)1899 static inline hri_adc_winut_reg_t hri_adc_read_WINUT_reg(const void *const hw)
1900 {
1901 return ((Adc *)hw)->WINUT.reg;
1902 }
1903
hri_adc_set_GAINCORR_GAINCORR_bf(const void * const hw,hri_adc_gaincorr_reg_t mask)1904 static inline void hri_adc_set_GAINCORR_GAINCORR_bf(const void *const hw, hri_adc_gaincorr_reg_t mask)
1905 {
1906 ADC_CRITICAL_SECTION_ENTER();
1907 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_GAINCORR);
1908 ((Adc *)hw)->GAINCORR.reg |= ADC_GAINCORR_GAINCORR(mask);
1909 ADC_CRITICAL_SECTION_LEAVE();
1910 }
1911
hri_adc_get_GAINCORR_GAINCORR_bf(const void * const hw,hri_adc_gaincorr_reg_t mask)1912 static inline hri_adc_gaincorr_reg_t hri_adc_get_GAINCORR_GAINCORR_bf(const void *const hw, hri_adc_gaincorr_reg_t mask)
1913 {
1914 uint16_t tmp;
1915 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_GAINCORR);
1916 tmp = ((Adc *)hw)->GAINCORR.reg;
1917 tmp = (tmp & ADC_GAINCORR_GAINCORR(mask)) >> ADC_GAINCORR_GAINCORR_Pos;
1918 return tmp;
1919 }
1920
hri_adc_write_GAINCORR_GAINCORR_bf(const void * const hw,hri_adc_gaincorr_reg_t data)1921 static inline void hri_adc_write_GAINCORR_GAINCORR_bf(const void *const hw, hri_adc_gaincorr_reg_t data)
1922 {
1923 uint16_t tmp;
1924 ADC_CRITICAL_SECTION_ENTER();
1925 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_GAINCORR);
1926 tmp = ((Adc *)hw)->GAINCORR.reg;
1927 tmp &= ~ADC_GAINCORR_GAINCORR_Msk;
1928 tmp |= ADC_GAINCORR_GAINCORR(data);
1929 ((Adc *)hw)->GAINCORR.reg = tmp;
1930 ADC_CRITICAL_SECTION_LEAVE();
1931 }
1932
hri_adc_clear_GAINCORR_GAINCORR_bf(const void * const hw,hri_adc_gaincorr_reg_t mask)1933 static inline void hri_adc_clear_GAINCORR_GAINCORR_bf(const void *const hw, hri_adc_gaincorr_reg_t mask)
1934 {
1935 ADC_CRITICAL_SECTION_ENTER();
1936 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_GAINCORR);
1937 ((Adc *)hw)->GAINCORR.reg &= ~ADC_GAINCORR_GAINCORR(mask);
1938 ADC_CRITICAL_SECTION_LEAVE();
1939 }
1940
hri_adc_toggle_GAINCORR_GAINCORR_bf(const void * const hw,hri_adc_gaincorr_reg_t mask)1941 static inline void hri_adc_toggle_GAINCORR_GAINCORR_bf(const void *const hw, hri_adc_gaincorr_reg_t mask)
1942 {
1943 ADC_CRITICAL_SECTION_ENTER();
1944 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_GAINCORR);
1945 ((Adc *)hw)->GAINCORR.reg ^= ADC_GAINCORR_GAINCORR(mask);
1946 ADC_CRITICAL_SECTION_LEAVE();
1947 }
1948
hri_adc_read_GAINCORR_GAINCORR_bf(const void * const hw)1949 static inline hri_adc_gaincorr_reg_t hri_adc_read_GAINCORR_GAINCORR_bf(const void *const hw)
1950 {
1951 uint16_t tmp;
1952 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_GAINCORR);
1953 tmp = ((Adc *)hw)->GAINCORR.reg;
1954 tmp = (tmp & ADC_GAINCORR_GAINCORR_Msk) >> ADC_GAINCORR_GAINCORR_Pos;
1955 return tmp;
1956 }
1957
hri_adc_set_GAINCORR_reg(const void * const hw,hri_adc_gaincorr_reg_t mask)1958 static inline void hri_adc_set_GAINCORR_reg(const void *const hw, hri_adc_gaincorr_reg_t mask)
1959 {
1960 ADC_CRITICAL_SECTION_ENTER();
1961 ((Adc *)hw)->GAINCORR.reg |= mask;
1962 ADC_CRITICAL_SECTION_LEAVE();
1963 }
1964
hri_adc_get_GAINCORR_reg(const void * const hw,hri_adc_gaincorr_reg_t mask)1965 static inline hri_adc_gaincorr_reg_t hri_adc_get_GAINCORR_reg(const void *const hw, hri_adc_gaincorr_reg_t mask)
1966 {
1967 uint16_t tmp;
1968 tmp = ((Adc *)hw)->GAINCORR.reg;
1969 tmp &= mask;
1970 return tmp;
1971 }
1972
hri_adc_write_GAINCORR_reg(const void * const hw,hri_adc_gaincorr_reg_t data)1973 static inline void hri_adc_write_GAINCORR_reg(const void *const hw, hri_adc_gaincorr_reg_t data)
1974 {
1975 ADC_CRITICAL_SECTION_ENTER();
1976 ((Adc *)hw)->GAINCORR.reg = data;
1977 ADC_CRITICAL_SECTION_LEAVE();
1978 }
1979
hri_adc_clear_GAINCORR_reg(const void * const hw,hri_adc_gaincorr_reg_t mask)1980 static inline void hri_adc_clear_GAINCORR_reg(const void *const hw, hri_adc_gaincorr_reg_t mask)
1981 {
1982 ADC_CRITICAL_SECTION_ENTER();
1983 ((Adc *)hw)->GAINCORR.reg &= ~mask;
1984 ADC_CRITICAL_SECTION_LEAVE();
1985 }
1986
hri_adc_toggle_GAINCORR_reg(const void * const hw,hri_adc_gaincorr_reg_t mask)1987 static inline void hri_adc_toggle_GAINCORR_reg(const void *const hw, hri_adc_gaincorr_reg_t mask)
1988 {
1989 ADC_CRITICAL_SECTION_ENTER();
1990 ((Adc *)hw)->GAINCORR.reg ^= mask;
1991 ADC_CRITICAL_SECTION_LEAVE();
1992 }
1993
hri_adc_read_GAINCORR_reg(const void * const hw)1994 static inline hri_adc_gaincorr_reg_t hri_adc_read_GAINCORR_reg(const void *const hw)
1995 {
1996 return ((Adc *)hw)->GAINCORR.reg;
1997 }
1998
hri_adc_set_OFFSETCORR_OFFSETCORR_bf(const void * const hw,hri_adc_offsetcorr_reg_t mask)1999 static inline void hri_adc_set_OFFSETCORR_OFFSETCORR_bf(const void *const hw, hri_adc_offsetcorr_reg_t mask)
2000 {
2001 ADC_CRITICAL_SECTION_ENTER();
2002 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_OFFSETCORR);
2003 ((Adc *)hw)->OFFSETCORR.reg |= ADC_OFFSETCORR_OFFSETCORR(mask);
2004 ADC_CRITICAL_SECTION_LEAVE();
2005 }
2006
hri_adc_get_OFFSETCORR_OFFSETCORR_bf(const void * const hw,hri_adc_offsetcorr_reg_t mask)2007 static inline hri_adc_offsetcorr_reg_t hri_adc_get_OFFSETCORR_OFFSETCORR_bf(const void *const hw,
2008 hri_adc_offsetcorr_reg_t mask)
2009 {
2010 uint16_t tmp;
2011 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_OFFSETCORR);
2012 tmp = ((Adc *)hw)->OFFSETCORR.reg;
2013 tmp = (tmp & ADC_OFFSETCORR_OFFSETCORR(mask)) >> ADC_OFFSETCORR_OFFSETCORR_Pos;
2014 return tmp;
2015 }
2016
hri_adc_write_OFFSETCORR_OFFSETCORR_bf(const void * const hw,hri_adc_offsetcorr_reg_t data)2017 static inline void hri_adc_write_OFFSETCORR_OFFSETCORR_bf(const void *const hw, hri_adc_offsetcorr_reg_t data)
2018 {
2019 uint16_t tmp;
2020 ADC_CRITICAL_SECTION_ENTER();
2021 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_OFFSETCORR);
2022 tmp = ((Adc *)hw)->OFFSETCORR.reg;
2023 tmp &= ~ADC_OFFSETCORR_OFFSETCORR_Msk;
2024 tmp |= ADC_OFFSETCORR_OFFSETCORR(data);
2025 ((Adc *)hw)->OFFSETCORR.reg = tmp;
2026 ADC_CRITICAL_SECTION_LEAVE();
2027 }
2028
hri_adc_clear_OFFSETCORR_OFFSETCORR_bf(const void * const hw,hri_adc_offsetcorr_reg_t mask)2029 static inline void hri_adc_clear_OFFSETCORR_OFFSETCORR_bf(const void *const hw, hri_adc_offsetcorr_reg_t mask)
2030 {
2031 ADC_CRITICAL_SECTION_ENTER();
2032 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_OFFSETCORR);
2033 ((Adc *)hw)->OFFSETCORR.reg &= ~ADC_OFFSETCORR_OFFSETCORR(mask);
2034 ADC_CRITICAL_SECTION_LEAVE();
2035 }
2036
hri_adc_toggle_OFFSETCORR_OFFSETCORR_bf(const void * const hw,hri_adc_offsetcorr_reg_t mask)2037 static inline void hri_adc_toggle_OFFSETCORR_OFFSETCORR_bf(const void *const hw, hri_adc_offsetcorr_reg_t mask)
2038 {
2039 ADC_CRITICAL_SECTION_ENTER();
2040 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_OFFSETCORR);
2041 ((Adc *)hw)->OFFSETCORR.reg ^= ADC_OFFSETCORR_OFFSETCORR(mask);
2042 ADC_CRITICAL_SECTION_LEAVE();
2043 }
2044
hri_adc_read_OFFSETCORR_OFFSETCORR_bf(const void * const hw)2045 static inline hri_adc_offsetcorr_reg_t hri_adc_read_OFFSETCORR_OFFSETCORR_bf(const void *const hw)
2046 {
2047 uint16_t tmp;
2048 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_OFFSETCORR);
2049 tmp = ((Adc *)hw)->OFFSETCORR.reg;
2050 tmp = (tmp & ADC_OFFSETCORR_OFFSETCORR_Msk) >> ADC_OFFSETCORR_OFFSETCORR_Pos;
2051 return tmp;
2052 }
2053
hri_adc_set_OFFSETCORR_reg(const void * const hw,hri_adc_offsetcorr_reg_t mask)2054 static inline void hri_adc_set_OFFSETCORR_reg(const void *const hw, hri_adc_offsetcorr_reg_t mask)
2055 {
2056 ADC_CRITICAL_SECTION_ENTER();
2057 ((Adc *)hw)->OFFSETCORR.reg |= mask;
2058 ADC_CRITICAL_SECTION_LEAVE();
2059 }
2060
hri_adc_get_OFFSETCORR_reg(const void * const hw,hri_adc_offsetcorr_reg_t mask)2061 static inline hri_adc_offsetcorr_reg_t hri_adc_get_OFFSETCORR_reg(const void *const hw, hri_adc_offsetcorr_reg_t mask)
2062 {
2063 uint16_t tmp;
2064 tmp = ((Adc *)hw)->OFFSETCORR.reg;
2065 tmp &= mask;
2066 return tmp;
2067 }
2068
hri_adc_write_OFFSETCORR_reg(const void * const hw,hri_adc_offsetcorr_reg_t data)2069 static inline void hri_adc_write_OFFSETCORR_reg(const void *const hw, hri_adc_offsetcorr_reg_t data)
2070 {
2071 ADC_CRITICAL_SECTION_ENTER();
2072 ((Adc *)hw)->OFFSETCORR.reg = data;
2073 ADC_CRITICAL_SECTION_LEAVE();
2074 }
2075
hri_adc_clear_OFFSETCORR_reg(const void * const hw,hri_adc_offsetcorr_reg_t mask)2076 static inline void hri_adc_clear_OFFSETCORR_reg(const void *const hw, hri_adc_offsetcorr_reg_t mask)
2077 {
2078 ADC_CRITICAL_SECTION_ENTER();
2079 ((Adc *)hw)->OFFSETCORR.reg &= ~mask;
2080 ADC_CRITICAL_SECTION_LEAVE();
2081 }
2082
hri_adc_toggle_OFFSETCORR_reg(const void * const hw,hri_adc_offsetcorr_reg_t mask)2083 static inline void hri_adc_toggle_OFFSETCORR_reg(const void *const hw, hri_adc_offsetcorr_reg_t mask)
2084 {
2085 ADC_CRITICAL_SECTION_ENTER();
2086 ((Adc *)hw)->OFFSETCORR.reg ^= mask;
2087 ADC_CRITICAL_SECTION_LEAVE();
2088 }
2089
hri_adc_read_OFFSETCORR_reg(const void * const hw)2090 static inline hri_adc_offsetcorr_reg_t hri_adc_read_OFFSETCORR_reg(const void *const hw)
2091 {
2092 return ((Adc *)hw)->OFFSETCORR.reg;
2093 }
2094
hri_adc_set_SWTRIG_FLUSH_bit(const void * const hw)2095 static inline void hri_adc_set_SWTRIG_FLUSH_bit(const void *const hw)
2096 {
2097 ADC_CRITICAL_SECTION_ENTER();
2098 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
2099 ((Adc *)hw)->SWTRIG.reg |= ADC_SWTRIG_FLUSH;
2100 ADC_CRITICAL_SECTION_LEAVE();
2101 }
2102
hri_adc_get_SWTRIG_FLUSH_bit(const void * const hw)2103 static inline bool hri_adc_get_SWTRIG_FLUSH_bit(const void *const hw)
2104 {
2105 uint8_t tmp;
2106 tmp = ((Adc *)hw)->SWTRIG.reg;
2107 tmp = (tmp & ADC_SWTRIG_FLUSH) >> ADC_SWTRIG_FLUSH_Pos;
2108 return (bool)tmp;
2109 }
2110
hri_adc_write_SWTRIG_FLUSH_bit(const void * const hw,bool value)2111 static inline void hri_adc_write_SWTRIG_FLUSH_bit(const void *const hw, bool value)
2112 {
2113 uint8_t tmp;
2114 ADC_CRITICAL_SECTION_ENTER();
2115 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
2116 tmp = ((Adc *)hw)->SWTRIG.reg;
2117 tmp &= ~ADC_SWTRIG_FLUSH;
2118 tmp |= value << ADC_SWTRIG_FLUSH_Pos;
2119 ((Adc *)hw)->SWTRIG.reg = tmp;
2120 ADC_CRITICAL_SECTION_LEAVE();
2121 }
2122
hri_adc_clear_SWTRIG_FLUSH_bit(const void * const hw)2123 static inline void hri_adc_clear_SWTRIG_FLUSH_bit(const void *const hw)
2124 {
2125 ADC_CRITICAL_SECTION_ENTER();
2126 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
2127 ((Adc *)hw)->SWTRIG.reg &= ~ADC_SWTRIG_FLUSH;
2128 ADC_CRITICAL_SECTION_LEAVE();
2129 }
2130
hri_adc_toggle_SWTRIG_FLUSH_bit(const void * const hw)2131 static inline void hri_adc_toggle_SWTRIG_FLUSH_bit(const void *const hw)
2132 {
2133 ADC_CRITICAL_SECTION_ENTER();
2134 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
2135 ((Adc *)hw)->SWTRIG.reg ^= ADC_SWTRIG_FLUSH;
2136 ADC_CRITICAL_SECTION_LEAVE();
2137 }
2138
hri_adc_set_SWTRIG_START_bit(const void * const hw)2139 static inline void hri_adc_set_SWTRIG_START_bit(const void *const hw)
2140 {
2141 ADC_CRITICAL_SECTION_ENTER();
2142 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
2143 ((Adc *)hw)->SWTRIG.reg |= ADC_SWTRIG_START;
2144 ADC_CRITICAL_SECTION_LEAVE();
2145 }
2146
hri_adc_get_SWTRIG_START_bit(const void * const hw)2147 static inline bool hri_adc_get_SWTRIG_START_bit(const void *const hw)
2148 {
2149 uint8_t tmp;
2150 tmp = ((Adc *)hw)->SWTRIG.reg;
2151 tmp = (tmp & ADC_SWTRIG_START) >> ADC_SWTRIG_START_Pos;
2152 return (bool)tmp;
2153 }
2154
hri_adc_write_SWTRIG_START_bit(const void * const hw,bool value)2155 static inline void hri_adc_write_SWTRIG_START_bit(const void *const hw, bool value)
2156 {
2157 uint8_t tmp;
2158 ADC_CRITICAL_SECTION_ENTER();
2159 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
2160 tmp = ((Adc *)hw)->SWTRIG.reg;
2161 tmp &= ~ADC_SWTRIG_START;
2162 tmp |= value << ADC_SWTRIG_START_Pos;
2163 ((Adc *)hw)->SWTRIG.reg = tmp;
2164 ADC_CRITICAL_SECTION_LEAVE();
2165 }
2166
hri_adc_clear_SWTRIG_START_bit(const void * const hw)2167 static inline void hri_adc_clear_SWTRIG_START_bit(const void *const hw)
2168 {
2169 ADC_CRITICAL_SECTION_ENTER();
2170 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
2171 ((Adc *)hw)->SWTRIG.reg &= ~ADC_SWTRIG_START;
2172 ADC_CRITICAL_SECTION_LEAVE();
2173 }
2174
hri_adc_toggle_SWTRIG_START_bit(const void * const hw)2175 static inline void hri_adc_toggle_SWTRIG_START_bit(const void *const hw)
2176 {
2177 ADC_CRITICAL_SECTION_ENTER();
2178 hri_adc_wait_for_sync(hw, ADC_SYNCBUSY_MASK);
2179 ((Adc *)hw)->SWTRIG.reg ^= ADC_SWTRIG_START;
2180 ADC_CRITICAL_SECTION_LEAVE();
2181 }
2182
hri_adc_set_SWTRIG_reg(const void * const hw,hri_adc_swtrig_reg_t mask)2183 static inline void hri_adc_set_SWTRIG_reg(const void *const hw, hri_adc_swtrig_reg_t mask)
2184 {
2185 ADC_CRITICAL_SECTION_ENTER();
2186 ((Adc *)hw)->SWTRIG.reg |= mask;
2187 ADC_CRITICAL_SECTION_LEAVE();
2188 }
2189
hri_adc_get_SWTRIG_reg(const void * const hw,hri_adc_swtrig_reg_t mask)2190 static inline hri_adc_swtrig_reg_t hri_adc_get_SWTRIG_reg(const void *const hw, hri_adc_swtrig_reg_t mask)
2191 {
2192 uint8_t tmp;
2193 tmp = ((Adc *)hw)->SWTRIG.reg;
2194 tmp &= mask;
2195 return tmp;
2196 }
2197
hri_adc_write_SWTRIG_reg(const void * const hw,hri_adc_swtrig_reg_t data)2198 static inline void hri_adc_write_SWTRIG_reg(const void *const hw, hri_adc_swtrig_reg_t data)
2199 {
2200 ADC_CRITICAL_SECTION_ENTER();
2201 ((Adc *)hw)->SWTRIG.reg = data;
2202 ADC_CRITICAL_SECTION_LEAVE();
2203 }
2204
hri_adc_clear_SWTRIG_reg(const void * const hw,hri_adc_swtrig_reg_t mask)2205 static inline void hri_adc_clear_SWTRIG_reg(const void *const hw, hri_adc_swtrig_reg_t mask)
2206 {
2207 ADC_CRITICAL_SECTION_ENTER();
2208 ((Adc *)hw)->SWTRIG.reg &= ~mask;
2209 ADC_CRITICAL_SECTION_LEAVE();
2210 }
2211
hri_adc_toggle_SWTRIG_reg(const void * const hw,hri_adc_swtrig_reg_t mask)2212 static inline void hri_adc_toggle_SWTRIG_reg(const void *const hw, hri_adc_swtrig_reg_t mask)
2213 {
2214 ADC_CRITICAL_SECTION_ENTER();
2215 ((Adc *)hw)->SWTRIG.reg ^= mask;
2216 ADC_CRITICAL_SECTION_LEAVE();
2217 }
2218
hri_adc_read_SWTRIG_reg(const void * const hw)2219 static inline hri_adc_swtrig_reg_t hri_adc_read_SWTRIG_reg(const void *const hw)
2220 {
2221 return ((Adc *)hw)->SWTRIG.reg;
2222 }
2223
hri_adc_set_DBGCTRL_DBGRUN_bit(const void * const hw)2224 static inline void hri_adc_set_DBGCTRL_DBGRUN_bit(const void *const hw)
2225 {
2226 ADC_CRITICAL_SECTION_ENTER();
2227 ((Adc *)hw)->DBGCTRL.reg |= ADC_DBGCTRL_DBGRUN;
2228 ADC_CRITICAL_SECTION_LEAVE();
2229 }
2230
hri_adc_get_DBGCTRL_DBGRUN_bit(const void * const hw)2231 static inline bool hri_adc_get_DBGCTRL_DBGRUN_bit(const void *const hw)
2232 {
2233 uint8_t tmp;
2234 tmp = ((Adc *)hw)->DBGCTRL.reg;
2235 tmp = (tmp & ADC_DBGCTRL_DBGRUN) >> ADC_DBGCTRL_DBGRUN_Pos;
2236 return (bool)tmp;
2237 }
2238
hri_adc_write_DBGCTRL_DBGRUN_bit(const void * const hw,bool value)2239 static inline void hri_adc_write_DBGCTRL_DBGRUN_bit(const void *const hw, bool value)
2240 {
2241 uint8_t tmp;
2242 ADC_CRITICAL_SECTION_ENTER();
2243 tmp = ((Adc *)hw)->DBGCTRL.reg;
2244 tmp &= ~ADC_DBGCTRL_DBGRUN;
2245 tmp |= value << ADC_DBGCTRL_DBGRUN_Pos;
2246 ((Adc *)hw)->DBGCTRL.reg = tmp;
2247 ADC_CRITICAL_SECTION_LEAVE();
2248 }
2249
hri_adc_clear_DBGCTRL_DBGRUN_bit(const void * const hw)2250 static inline void hri_adc_clear_DBGCTRL_DBGRUN_bit(const void *const hw)
2251 {
2252 ADC_CRITICAL_SECTION_ENTER();
2253 ((Adc *)hw)->DBGCTRL.reg &= ~ADC_DBGCTRL_DBGRUN;
2254 ADC_CRITICAL_SECTION_LEAVE();
2255 }
2256
hri_adc_toggle_DBGCTRL_DBGRUN_bit(const void * const hw)2257 static inline void hri_adc_toggle_DBGCTRL_DBGRUN_bit(const void *const hw)
2258 {
2259 ADC_CRITICAL_SECTION_ENTER();
2260 ((Adc *)hw)->DBGCTRL.reg ^= ADC_DBGCTRL_DBGRUN;
2261 ADC_CRITICAL_SECTION_LEAVE();
2262 }
2263
hri_adc_set_DBGCTRL_reg(const void * const hw,hri_adc_dbgctrl_reg_t mask)2264 static inline void hri_adc_set_DBGCTRL_reg(const void *const hw, hri_adc_dbgctrl_reg_t mask)
2265 {
2266 ADC_CRITICAL_SECTION_ENTER();
2267 ((Adc *)hw)->DBGCTRL.reg |= mask;
2268 ADC_CRITICAL_SECTION_LEAVE();
2269 }
2270
hri_adc_get_DBGCTRL_reg(const void * const hw,hri_adc_dbgctrl_reg_t mask)2271 static inline hri_adc_dbgctrl_reg_t hri_adc_get_DBGCTRL_reg(const void *const hw, hri_adc_dbgctrl_reg_t mask)
2272 {
2273 uint8_t tmp;
2274 tmp = ((Adc *)hw)->DBGCTRL.reg;
2275 tmp &= mask;
2276 return tmp;
2277 }
2278
hri_adc_write_DBGCTRL_reg(const void * const hw,hri_adc_dbgctrl_reg_t data)2279 static inline void hri_adc_write_DBGCTRL_reg(const void *const hw, hri_adc_dbgctrl_reg_t data)
2280 {
2281 ADC_CRITICAL_SECTION_ENTER();
2282 ((Adc *)hw)->DBGCTRL.reg = data;
2283 ADC_CRITICAL_SECTION_LEAVE();
2284 }
2285
hri_adc_clear_DBGCTRL_reg(const void * const hw,hri_adc_dbgctrl_reg_t mask)2286 static inline void hri_adc_clear_DBGCTRL_reg(const void *const hw, hri_adc_dbgctrl_reg_t mask)
2287 {
2288 ADC_CRITICAL_SECTION_ENTER();
2289 ((Adc *)hw)->DBGCTRL.reg &= ~mask;
2290 ADC_CRITICAL_SECTION_LEAVE();
2291 }
2292
hri_adc_toggle_DBGCTRL_reg(const void * const hw,hri_adc_dbgctrl_reg_t mask)2293 static inline void hri_adc_toggle_DBGCTRL_reg(const void *const hw, hri_adc_dbgctrl_reg_t mask)
2294 {
2295 ADC_CRITICAL_SECTION_ENTER();
2296 ((Adc *)hw)->DBGCTRL.reg ^= mask;
2297 ADC_CRITICAL_SECTION_LEAVE();
2298 }
2299
hri_adc_read_DBGCTRL_reg(const void * const hw)2300 static inline hri_adc_dbgctrl_reg_t hri_adc_read_DBGCTRL_reg(const void *const hw)
2301 {
2302 return ((Adc *)hw)->DBGCTRL.reg;
2303 }
2304
hri_adc_set_SEQCTRL_SEQEN_bf(const void * const hw,hri_adc_seqctrl_reg_t mask)2305 static inline void hri_adc_set_SEQCTRL_SEQEN_bf(const void *const hw, hri_adc_seqctrl_reg_t mask)
2306 {
2307 ADC_CRITICAL_SECTION_ENTER();
2308 ((Adc *)hw)->SEQCTRL.reg |= ADC_SEQCTRL_SEQEN(mask);
2309 ADC_CRITICAL_SECTION_LEAVE();
2310 }
2311
hri_adc_get_SEQCTRL_SEQEN_bf(const void * const hw,hri_adc_seqctrl_reg_t mask)2312 static inline hri_adc_seqctrl_reg_t hri_adc_get_SEQCTRL_SEQEN_bf(const void *const hw, hri_adc_seqctrl_reg_t mask)
2313 {
2314 uint32_t tmp;
2315 tmp = ((Adc *)hw)->SEQCTRL.reg;
2316 tmp = (tmp & ADC_SEQCTRL_SEQEN(mask)) >> ADC_SEQCTRL_SEQEN_Pos;
2317 return tmp;
2318 }
2319
hri_adc_write_SEQCTRL_SEQEN_bf(const void * const hw,hri_adc_seqctrl_reg_t data)2320 static inline void hri_adc_write_SEQCTRL_SEQEN_bf(const void *const hw, hri_adc_seqctrl_reg_t data)
2321 {
2322 uint32_t tmp;
2323 ADC_CRITICAL_SECTION_ENTER();
2324 tmp = ((Adc *)hw)->SEQCTRL.reg;
2325 tmp &= ~ADC_SEQCTRL_SEQEN_Msk;
2326 tmp |= ADC_SEQCTRL_SEQEN(data);
2327 ((Adc *)hw)->SEQCTRL.reg = tmp;
2328 ADC_CRITICAL_SECTION_LEAVE();
2329 }
2330
hri_adc_clear_SEQCTRL_SEQEN_bf(const void * const hw,hri_adc_seqctrl_reg_t mask)2331 static inline void hri_adc_clear_SEQCTRL_SEQEN_bf(const void *const hw, hri_adc_seqctrl_reg_t mask)
2332 {
2333 ADC_CRITICAL_SECTION_ENTER();
2334 ((Adc *)hw)->SEQCTRL.reg &= ~ADC_SEQCTRL_SEQEN(mask);
2335 ADC_CRITICAL_SECTION_LEAVE();
2336 }
2337
hri_adc_toggle_SEQCTRL_SEQEN_bf(const void * const hw,hri_adc_seqctrl_reg_t mask)2338 static inline void hri_adc_toggle_SEQCTRL_SEQEN_bf(const void *const hw, hri_adc_seqctrl_reg_t mask)
2339 {
2340 ADC_CRITICAL_SECTION_ENTER();
2341 ((Adc *)hw)->SEQCTRL.reg ^= ADC_SEQCTRL_SEQEN(mask);
2342 ADC_CRITICAL_SECTION_LEAVE();
2343 }
2344
hri_adc_read_SEQCTRL_SEQEN_bf(const void * const hw)2345 static inline hri_adc_seqctrl_reg_t hri_adc_read_SEQCTRL_SEQEN_bf(const void *const hw)
2346 {
2347 uint32_t tmp;
2348 tmp = ((Adc *)hw)->SEQCTRL.reg;
2349 tmp = (tmp & ADC_SEQCTRL_SEQEN_Msk) >> ADC_SEQCTRL_SEQEN_Pos;
2350 return tmp;
2351 }
2352
hri_adc_set_SEQCTRL_reg(const void * const hw,hri_adc_seqctrl_reg_t mask)2353 static inline void hri_adc_set_SEQCTRL_reg(const void *const hw, hri_adc_seqctrl_reg_t mask)
2354 {
2355 ADC_CRITICAL_SECTION_ENTER();
2356 ((Adc *)hw)->SEQCTRL.reg |= mask;
2357 ADC_CRITICAL_SECTION_LEAVE();
2358 }
2359
hri_adc_get_SEQCTRL_reg(const void * const hw,hri_adc_seqctrl_reg_t mask)2360 static inline hri_adc_seqctrl_reg_t hri_adc_get_SEQCTRL_reg(const void *const hw, hri_adc_seqctrl_reg_t mask)
2361 {
2362 uint32_t tmp;
2363 tmp = ((Adc *)hw)->SEQCTRL.reg;
2364 tmp &= mask;
2365 return tmp;
2366 }
2367
hri_adc_write_SEQCTRL_reg(const void * const hw,hri_adc_seqctrl_reg_t data)2368 static inline void hri_adc_write_SEQCTRL_reg(const void *const hw, hri_adc_seqctrl_reg_t data)
2369 {
2370 ADC_CRITICAL_SECTION_ENTER();
2371 ((Adc *)hw)->SEQCTRL.reg = data;
2372 ADC_CRITICAL_SECTION_LEAVE();
2373 }
2374
hri_adc_clear_SEQCTRL_reg(const void * const hw,hri_adc_seqctrl_reg_t mask)2375 static inline void hri_adc_clear_SEQCTRL_reg(const void *const hw, hri_adc_seqctrl_reg_t mask)
2376 {
2377 ADC_CRITICAL_SECTION_ENTER();
2378 ((Adc *)hw)->SEQCTRL.reg &= ~mask;
2379 ADC_CRITICAL_SECTION_LEAVE();
2380 }
2381
hri_adc_toggle_SEQCTRL_reg(const void * const hw,hri_adc_seqctrl_reg_t mask)2382 static inline void hri_adc_toggle_SEQCTRL_reg(const void *const hw, hri_adc_seqctrl_reg_t mask)
2383 {
2384 ADC_CRITICAL_SECTION_ENTER();
2385 ((Adc *)hw)->SEQCTRL.reg ^= mask;
2386 ADC_CRITICAL_SECTION_LEAVE();
2387 }
2388
hri_adc_read_SEQCTRL_reg(const void * const hw)2389 static inline hri_adc_seqctrl_reg_t hri_adc_read_SEQCTRL_reg(const void *const hw)
2390 {
2391 return ((Adc *)hw)->SEQCTRL.reg;
2392 }
2393
hri_adc_set_CALIB_BIASCOMP_bf(const void * const hw,hri_adc_calib_reg_t mask)2394 static inline void hri_adc_set_CALIB_BIASCOMP_bf(const void *const hw, hri_adc_calib_reg_t mask)
2395 {
2396 ADC_CRITICAL_SECTION_ENTER();
2397 ((Adc *)hw)->CALIB.reg |= ADC_CALIB_BIASCOMP(mask);
2398 ADC_CRITICAL_SECTION_LEAVE();
2399 }
2400
hri_adc_get_CALIB_BIASCOMP_bf(const void * const hw,hri_adc_calib_reg_t mask)2401 static inline hri_adc_calib_reg_t hri_adc_get_CALIB_BIASCOMP_bf(const void *const hw, hri_adc_calib_reg_t mask)
2402 {
2403 uint16_t tmp;
2404 tmp = ((Adc *)hw)->CALIB.reg;
2405 tmp = (tmp & ADC_CALIB_BIASCOMP(mask)) >> ADC_CALIB_BIASCOMP_Pos;
2406 return tmp;
2407 }
2408
hri_adc_write_CALIB_BIASCOMP_bf(const void * const hw,hri_adc_calib_reg_t data)2409 static inline void hri_adc_write_CALIB_BIASCOMP_bf(const void *const hw, hri_adc_calib_reg_t data)
2410 {
2411 uint16_t tmp;
2412 ADC_CRITICAL_SECTION_ENTER();
2413 tmp = ((Adc *)hw)->CALIB.reg;
2414 tmp &= ~ADC_CALIB_BIASCOMP_Msk;
2415 tmp |= ADC_CALIB_BIASCOMP(data);
2416 ((Adc *)hw)->CALIB.reg = tmp;
2417 ADC_CRITICAL_SECTION_LEAVE();
2418 }
2419
hri_adc_clear_CALIB_BIASCOMP_bf(const void * const hw,hri_adc_calib_reg_t mask)2420 static inline void hri_adc_clear_CALIB_BIASCOMP_bf(const void *const hw, hri_adc_calib_reg_t mask)
2421 {
2422 ADC_CRITICAL_SECTION_ENTER();
2423 ((Adc *)hw)->CALIB.reg &= ~ADC_CALIB_BIASCOMP(mask);
2424 ADC_CRITICAL_SECTION_LEAVE();
2425 }
2426
hri_adc_toggle_CALIB_BIASCOMP_bf(const void * const hw,hri_adc_calib_reg_t mask)2427 static inline void hri_adc_toggle_CALIB_BIASCOMP_bf(const void *const hw, hri_adc_calib_reg_t mask)
2428 {
2429 ADC_CRITICAL_SECTION_ENTER();
2430 ((Adc *)hw)->CALIB.reg ^= ADC_CALIB_BIASCOMP(mask);
2431 ADC_CRITICAL_SECTION_LEAVE();
2432 }
2433
hri_adc_read_CALIB_BIASCOMP_bf(const void * const hw)2434 static inline hri_adc_calib_reg_t hri_adc_read_CALIB_BIASCOMP_bf(const void *const hw)
2435 {
2436 uint16_t tmp;
2437 tmp = ((Adc *)hw)->CALIB.reg;
2438 tmp = (tmp & ADC_CALIB_BIASCOMP_Msk) >> ADC_CALIB_BIASCOMP_Pos;
2439 return tmp;
2440 }
2441
hri_adc_set_CALIB_BIASREFBUF_bf(const void * const hw,hri_adc_calib_reg_t mask)2442 static inline void hri_adc_set_CALIB_BIASREFBUF_bf(const void *const hw, hri_adc_calib_reg_t mask)
2443 {
2444 ADC_CRITICAL_SECTION_ENTER();
2445 ((Adc *)hw)->CALIB.reg |= ADC_CALIB_BIASREFBUF(mask);
2446 ADC_CRITICAL_SECTION_LEAVE();
2447 }
2448
hri_adc_get_CALIB_BIASREFBUF_bf(const void * const hw,hri_adc_calib_reg_t mask)2449 static inline hri_adc_calib_reg_t hri_adc_get_CALIB_BIASREFBUF_bf(const void *const hw, hri_adc_calib_reg_t mask)
2450 {
2451 uint16_t tmp;
2452 tmp = ((Adc *)hw)->CALIB.reg;
2453 tmp = (tmp & ADC_CALIB_BIASREFBUF(mask)) >> ADC_CALIB_BIASREFBUF_Pos;
2454 return tmp;
2455 }
2456
hri_adc_write_CALIB_BIASREFBUF_bf(const void * const hw,hri_adc_calib_reg_t data)2457 static inline void hri_adc_write_CALIB_BIASREFBUF_bf(const void *const hw, hri_adc_calib_reg_t data)
2458 {
2459 uint16_t tmp;
2460 ADC_CRITICAL_SECTION_ENTER();
2461 tmp = ((Adc *)hw)->CALIB.reg;
2462 tmp &= ~ADC_CALIB_BIASREFBUF_Msk;
2463 tmp |= ADC_CALIB_BIASREFBUF(data);
2464 ((Adc *)hw)->CALIB.reg = tmp;
2465 ADC_CRITICAL_SECTION_LEAVE();
2466 }
2467
hri_adc_clear_CALIB_BIASREFBUF_bf(const void * const hw,hri_adc_calib_reg_t mask)2468 static inline void hri_adc_clear_CALIB_BIASREFBUF_bf(const void *const hw, hri_adc_calib_reg_t mask)
2469 {
2470 ADC_CRITICAL_SECTION_ENTER();
2471 ((Adc *)hw)->CALIB.reg &= ~ADC_CALIB_BIASREFBUF(mask);
2472 ADC_CRITICAL_SECTION_LEAVE();
2473 }
2474
hri_adc_toggle_CALIB_BIASREFBUF_bf(const void * const hw,hri_adc_calib_reg_t mask)2475 static inline void hri_adc_toggle_CALIB_BIASREFBUF_bf(const void *const hw, hri_adc_calib_reg_t mask)
2476 {
2477 ADC_CRITICAL_SECTION_ENTER();
2478 ((Adc *)hw)->CALIB.reg ^= ADC_CALIB_BIASREFBUF(mask);
2479 ADC_CRITICAL_SECTION_LEAVE();
2480 }
2481
hri_adc_read_CALIB_BIASREFBUF_bf(const void * const hw)2482 static inline hri_adc_calib_reg_t hri_adc_read_CALIB_BIASREFBUF_bf(const void *const hw)
2483 {
2484 uint16_t tmp;
2485 tmp = ((Adc *)hw)->CALIB.reg;
2486 tmp = (tmp & ADC_CALIB_BIASREFBUF_Msk) >> ADC_CALIB_BIASREFBUF_Pos;
2487 return tmp;
2488 }
2489
hri_adc_set_CALIB_reg(const void * const hw,hri_adc_calib_reg_t mask)2490 static inline void hri_adc_set_CALIB_reg(const void *const hw, hri_adc_calib_reg_t mask)
2491 {
2492 ADC_CRITICAL_SECTION_ENTER();
2493 ((Adc *)hw)->CALIB.reg |= mask;
2494 ADC_CRITICAL_SECTION_LEAVE();
2495 }
2496
hri_adc_get_CALIB_reg(const void * const hw,hri_adc_calib_reg_t mask)2497 static inline hri_adc_calib_reg_t hri_adc_get_CALIB_reg(const void *const hw, hri_adc_calib_reg_t mask)
2498 {
2499 uint16_t tmp;
2500 tmp = ((Adc *)hw)->CALIB.reg;
2501 tmp &= mask;
2502 return tmp;
2503 }
2504
hri_adc_write_CALIB_reg(const void * const hw,hri_adc_calib_reg_t data)2505 static inline void hri_adc_write_CALIB_reg(const void *const hw, hri_adc_calib_reg_t data)
2506 {
2507 ADC_CRITICAL_SECTION_ENTER();
2508 ((Adc *)hw)->CALIB.reg = data;
2509 ADC_CRITICAL_SECTION_LEAVE();
2510 }
2511
hri_adc_clear_CALIB_reg(const void * const hw,hri_adc_calib_reg_t mask)2512 static inline void hri_adc_clear_CALIB_reg(const void *const hw, hri_adc_calib_reg_t mask)
2513 {
2514 ADC_CRITICAL_SECTION_ENTER();
2515 ((Adc *)hw)->CALIB.reg &= ~mask;
2516 ADC_CRITICAL_SECTION_LEAVE();
2517 }
2518
hri_adc_toggle_CALIB_reg(const void * const hw,hri_adc_calib_reg_t mask)2519 static inline void hri_adc_toggle_CALIB_reg(const void *const hw, hri_adc_calib_reg_t mask)
2520 {
2521 ADC_CRITICAL_SECTION_ENTER();
2522 ((Adc *)hw)->CALIB.reg ^= mask;
2523 ADC_CRITICAL_SECTION_LEAVE();
2524 }
2525
hri_adc_read_CALIB_reg(const void * const hw)2526 static inline hri_adc_calib_reg_t hri_adc_read_CALIB_reg(const void *const hw)
2527 {
2528 return ((Adc *)hw)->CALIB.reg;
2529 }
2530
hri_adc_get_SEQSTATUS_SEQBUSY_bit(const void * const hw)2531 static inline bool hri_adc_get_SEQSTATUS_SEQBUSY_bit(const void *const hw)
2532 {
2533 return (((Adc *)hw)->SEQSTATUS.reg & ADC_SEQSTATUS_SEQBUSY) >> ADC_SEQSTATUS_SEQBUSY_Pos;
2534 }
2535
hri_adc_get_SEQSTATUS_SEQSTATE_bf(const void * const hw,hri_adc_seqstatus_reg_t mask)2536 static inline hri_adc_seqstatus_reg_t hri_adc_get_SEQSTATUS_SEQSTATE_bf(const void *const hw,
2537 hri_adc_seqstatus_reg_t mask)
2538 {
2539 return (((Adc *)hw)->SEQSTATUS.reg & ADC_SEQSTATUS_SEQSTATE(mask)) >> ADC_SEQSTATUS_SEQSTATE_Pos;
2540 }
2541
hri_adc_read_SEQSTATUS_SEQSTATE_bf(const void * const hw)2542 static inline hri_adc_seqstatus_reg_t hri_adc_read_SEQSTATUS_SEQSTATE_bf(const void *const hw)
2543 {
2544 return (((Adc *)hw)->SEQSTATUS.reg & ADC_SEQSTATUS_SEQSTATE_Msk) >> ADC_SEQSTATUS_SEQSTATE_Pos;
2545 }
2546
hri_adc_get_SEQSTATUS_reg(const void * const hw,hri_adc_seqstatus_reg_t mask)2547 static inline hri_adc_seqstatus_reg_t hri_adc_get_SEQSTATUS_reg(const void *const hw, hri_adc_seqstatus_reg_t mask)
2548 {
2549 uint8_t tmp;
2550 tmp = ((Adc *)hw)->SEQSTATUS.reg;
2551 tmp &= mask;
2552 return tmp;
2553 }
2554
hri_adc_read_SEQSTATUS_reg(const void * const hw)2555 static inline hri_adc_seqstatus_reg_t hri_adc_read_SEQSTATUS_reg(const void *const hw)
2556 {
2557 return ((Adc *)hw)->SEQSTATUS.reg;
2558 }
2559
hri_adc_get_SYNCBUSY_SWRST_bit(const void * const hw)2560 static inline bool hri_adc_get_SYNCBUSY_SWRST_bit(const void *const hw)
2561 {
2562 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_SWRST) >> ADC_SYNCBUSY_SWRST_Pos;
2563 }
2564
hri_adc_get_SYNCBUSY_ENABLE_bit(const void * const hw)2565 static inline bool hri_adc_get_SYNCBUSY_ENABLE_bit(const void *const hw)
2566 {
2567 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_ENABLE) >> ADC_SYNCBUSY_ENABLE_Pos;
2568 }
2569
hri_adc_get_SYNCBUSY_INPUTCTRL_bit(const void * const hw)2570 static inline bool hri_adc_get_SYNCBUSY_INPUTCTRL_bit(const void *const hw)
2571 {
2572 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_INPUTCTRL) >> ADC_SYNCBUSY_INPUTCTRL_Pos;
2573 }
2574
hri_adc_get_SYNCBUSY_CTRLC_bit(const void * const hw)2575 static inline bool hri_adc_get_SYNCBUSY_CTRLC_bit(const void *const hw)
2576 {
2577 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_CTRLC) >> ADC_SYNCBUSY_CTRLC_Pos;
2578 }
2579
hri_adc_get_SYNCBUSY_AVGCTRL_bit(const void * const hw)2580 static inline bool hri_adc_get_SYNCBUSY_AVGCTRL_bit(const void *const hw)
2581 {
2582 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_AVGCTRL) >> ADC_SYNCBUSY_AVGCTRL_Pos;
2583 }
2584
hri_adc_get_SYNCBUSY_SAMPCTRL_bit(const void * const hw)2585 static inline bool hri_adc_get_SYNCBUSY_SAMPCTRL_bit(const void *const hw)
2586 {
2587 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_SAMPCTRL) >> ADC_SYNCBUSY_SAMPCTRL_Pos;
2588 }
2589
hri_adc_get_SYNCBUSY_WINLT_bit(const void * const hw)2590 static inline bool hri_adc_get_SYNCBUSY_WINLT_bit(const void *const hw)
2591 {
2592 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_WINLT) >> ADC_SYNCBUSY_WINLT_Pos;
2593 }
2594
hri_adc_get_SYNCBUSY_WINUT_bit(const void * const hw)2595 static inline bool hri_adc_get_SYNCBUSY_WINUT_bit(const void *const hw)
2596 {
2597 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_WINUT) >> ADC_SYNCBUSY_WINUT_Pos;
2598 }
2599
hri_adc_get_SYNCBUSY_GAINCORR_bit(const void * const hw)2600 static inline bool hri_adc_get_SYNCBUSY_GAINCORR_bit(const void *const hw)
2601 {
2602 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_GAINCORR) >> ADC_SYNCBUSY_GAINCORR_Pos;
2603 }
2604
hri_adc_get_SYNCBUSY_OFFSETCORR_bit(const void * const hw)2605 static inline bool hri_adc_get_SYNCBUSY_OFFSETCORR_bit(const void *const hw)
2606 {
2607 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_OFFSETCORR) >> ADC_SYNCBUSY_OFFSETCORR_Pos;
2608 }
2609
hri_adc_get_SYNCBUSY_SWTRIG_bit(const void * const hw)2610 static inline bool hri_adc_get_SYNCBUSY_SWTRIG_bit(const void *const hw)
2611 {
2612 return (((Adc *)hw)->SYNCBUSY.reg & ADC_SYNCBUSY_SWTRIG) >> ADC_SYNCBUSY_SWTRIG_Pos;
2613 }
2614
hri_adc_get_SYNCBUSY_reg(const void * const hw,hri_adc_syncbusy_reg_t mask)2615 static inline hri_adc_syncbusy_reg_t hri_adc_get_SYNCBUSY_reg(const void *const hw, hri_adc_syncbusy_reg_t mask)
2616 {
2617 uint16_t tmp;
2618 tmp = ((Adc *)hw)->SYNCBUSY.reg;
2619 tmp &= mask;
2620 return tmp;
2621 }
2622
hri_adc_read_SYNCBUSY_reg(const void * const hw)2623 static inline hri_adc_syncbusy_reg_t hri_adc_read_SYNCBUSY_reg(const void *const hw)
2624 {
2625 return ((Adc *)hw)->SYNCBUSY.reg;
2626 }
2627
hri_adc_get_RESULT_RESULT_bf(const void * const hw,hri_adc_result_reg_t mask)2628 static inline hri_adc_result_reg_t hri_adc_get_RESULT_RESULT_bf(const void *const hw, hri_adc_result_reg_t mask)
2629 {
2630 return (((Adc *)hw)->RESULT.reg & ADC_RESULT_RESULT(mask)) >> ADC_RESULT_RESULT_Pos;
2631 }
2632
hri_adc_read_RESULT_RESULT_bf(const void * const hw)2633 static inline hri_adc_result_reg_t hri_adc_read_RESULT_RESULT_bf(const void *const hw)
2634 {
2635 return (((Adc *)hw)->RESULT.reg & ADC_RESULT_RESULT_Msk) >> ADC_RESULT_RESULT_Pos;
2636 }
2637
hri_adc_get_RESULT_reg(const void * const hw,hri_adc_result_reg_t mask)2638 static inline hri_adc_result_reg_t hri_adc_get_RESULT_reg(const void *const hw, hri_adc_result_reg_t mask)
2639 {
2640 uint16_t tmp;
2641 tmp = ((Adc *)hw)->RESULT.reg;
2642 tmp &= mask;
2643 return tmp;
2644 }
2645
hri_adc_read_RESULT_reg(const void * const hw)2646 static inline hri_adc_result_reg_t hri_adc_read_RESULT_reg(const void *const hw)
2647 {
2648 return ((Adc *)hw)->RESULT.reg;
2649 }
2650
2651 #ifdef __cplusplus
2652 }
2653 #endif
2654
2655 #endif /* _HRI_ADC_L21_H_INCLUDED */
2656 #endif /* _SAML21_ADC_COMPONENT_ */
2657