1 /**
2  * \file
3  *
4  * \brief SAM DAC
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_DAC_COMPONENT_
44 #ifndef _HRI_DAC_L21_H_INCLUDED_
45 #define _HRI_DAC_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_DAC_CRITICAL_SECTIONS)
55 #define DAC_CRITICAL_SECTION_ENTER() CRITICAL_SECTION_ENTER()
56 #define DAC_CRITICAL_SECTION_LEAVE() CRITICAL_SECTION_LEAVE()
57 #else
58 #define DAC_CRITICAL_SECTION_ENTER()
59 #define DAC_CRITICAL_SECTION_LEAVE()
60 #endif
61 
62 typedef uint16_t hri_dac_dacctrl_reg_t;
63 typedef uint16_t hri_dac_data_reg_t;
64 typedef uint16_t hri_dac_databuf_reg_t;
65 typedef uint32_t hri_dac_syncbusy_reg_t;
66 typedef uint8_t  hri_dac_ctrla_reg_t;
67 typedef uint8_t  hri_dac_ctrlb_reg_t;
68 typedef uint8_t  hri_dac_dbgctrl_reg_t;
69 typedef uint8_t  hri_dac_evctrl_reg_t;
70 typedef uint8_t  hri_dac_intenset_reg_t;
71 typedef uint8_t  hri_dac_intflag_reg_t;
72 typedef uint8_t  hri_dac_status_reg_t;
73 
hri_dac_wait_for_sync(const void * const hw,hri_dac_syncbusy_reg_t reg)74 static inline void hri_dac_wait_for_sync(const void *const hw, hri_dac_syncbusy_reg_t reg)
75 {
76 	while (((Dac *)hw)->SYNCBUSY.reg & reg) {
77 	};
78 }
79 
hri_dac_is_syncing(const void * const hw,hri_dac_syncbusy_reg_t reg)80 static inline bool hri_dac_is_syncing(const void *const hw, hri_dac_syncbusy_reg_t reg)
81 {
82 	return ((Dac *)hw)->SYNCBUSY.reg & reg;
83 }
84 
hri_dac_set_INTEN_UNDERRUN0_bit(const void * const hw)85 static inline void hri_dac_set_INTEN_UNDERRUN0_bit(const void *const hw)
86 {
87 	((Dac *)hw)->INTENSET.reg = DAC_INTENSET_UNDERRUN0;
88 }
89 
hri_dac_get_INTEN_UNDERRUN0_bit(const void * const hw)90 static inline bool hri_dac_get_INTEN_UNDERRUN0_bit(const void *const hw)
91 {
92 	return (((Dac *)hw)->INTENSET.reg & DAC_INTENSET_UNDERRUN0) >> DAC_INTENSET_UNDERRUN0_Pos;
93 }
94 
hri_dac_write_INTEN_UNDERRUN0_bit(const void * const hw,bool value)95 static inline void hri_dac_write_INTEN_UNDERRUN0_bit(const void *const hw, bool value)
96 {
97 	if (value == 0x0) {
98 		((Dac *)hw)->INTENCLR.reg = DAC_INTENSET_UNDERRUN0;
99 	} else {
100 		((Dac *)hw)->INTENSET.reg = DAC_INTENSET_UNDERRUN0;
101 	}
102 }
103 
hri_dac_clear_INTEN_UNDERRUN0_bit(const void * const hw)104 static inline void hri_dac_clear_INTEN_UNDERRUN0_bit(const void *const hw)
105 {
106 	((Dac *)hw)->INTENCLR.reg = DAC_INTENSET_UNDERRUN0;
107 }
108 
hri_dac_set_INTEN_UNDERRUN1_bit(const void * const hw)109 static inline void hri_dac_set_INTEN_UNDERRUN1_bit(const void *const hw)
110 {
111 	((Dac *)hw)->INTENSET.reg = DAC_INTENSET_UNDERRUN1;
112 }
113 
hri_dac_get_INTEN_UNDERRUN1_bit(const void * const hw)114 static inline bool hri_dac_get_INTEN_UNDERRUN1_bit(const void *const hw)
115 {
116 	return (((Dac *)hw)->INTENSET.reg & DAC_INTENSET_UNDERRUN1) >> DAC_INTENSET_UNDERRUN1_Pos;
117 }
118 
hri_dac_write_INTEN_UNDERRUN1_bit(const void * const hw,bool value)119 static inline void hri_dac_write_INTEN_UNDERRUN1_bit(const void *const hw, bool value)
120 {
121 	if (value == 0x0) {
122 		((Dac *)hw)->INTENCLR.reg = DAC_INTENSET_UNDERRUN1;
123 	} else {
124 		((Dac *)hw)->INTENSET.reg = DAC_INTENSET_UNDERRUN1;
125 	}
126 }
127 
hri_dac_clear_INTEN_UNDERRUN1_bit(const void * const hw)128 static inline void hri_dac_clear_INTEN_UNDERRUN1_bit(const void *const hw)
129 {
130 	((Dac *)hw)->INTENCLR.reg = DAC_INTENSET_UNDERRUN1;
131 }
132 
hri_dac_set_INTEN_EMPTY0_bit(const void * const hw)133 static inline void hri_dac_set_INTEN_EMPTY0_bit(const void *const hw)
134 {
135 	((Dac *)hw)->INTENSET.reg = DAC_INTENSET_EMPTY0;
136 }
137 
hri_dac_get_INTEN_EMPTY0_bit(const void * const hw)138 static inline bool hri_dac_get_INTEN_EMPTY0_bit(const void *const hw)
139 {
140 	return (((Dac *)hw)->INTENSET.reg & DAC_INTENSET_EMPTY0) >> DAC_INTENSET_EMPTY0_Pos;
141 }
142 
hri_dac_write_INTEN_EMPTY0_bit(const void * const hw,bool value)143 static inline void hri_dac_write_INTEN_EMPTY0_bit(const void *const hw, bool value)
144 {
145 	if (value == 0x0) {
146 		((Dac *)hw)->INTENCLR.reg = DAC_INTENSET_EMPTY0;
147 	} else {
148 		((Dac *)hw)->INTENSET.reg = DAC_INTENSET_EMPTY0;
149 	}
150 }
151 
hri_dac_clear_INTEN_EMPTY0_bit(const void * const hw)152 static inline void hri_dac_clear_INTEN_EMPTY0_bit(const void *const hw)
153 {
154 	((Dac *)hw)->INTENCLR.reg = DAC_INTENSET_EMPTY0;
155 }
156 
hri_dac_set_INTEN_EMPTY1_bit(const void * const hw)157 static inline void hri_dac_set_INTEN_EMPTY1_bit(const void *const hw)
158 {
159 	((Dac *)hw)->INTENSET.reg = DAC_INTENSET_EMPTY1;
160 }
161 
hri_dac_get_INTEN_EMPTY1_bit(const void * const hw)162 static inline bool hri_dac_get_INTEN_EMPTY1_bit(const void *const hw)
163 {
164 	return (((Dac *)hw)->INTENSET.reg & DAC_INTENSET_EMPTY1) >> DAC_INTENSET_EMPTY1_Pos;
165 }
166 
hri_dac_write_INTEN_EMPTY1_bit(const void * const hw,bool value)167 static inline void hri_dac_write_INTEN_EMPTY1_bit(const void *const hw, bool value)
168 {
169 	if (value == 0x0) {
170 		((Dac *)hw)->INTENCLR.reg = DAC_INTENSET_EMPTY1;
171 	} else {
172 		((Dac *)hw)->INTENSET.reg = DAC_INTENSET_EMPTY1;
173 	}
174 }
175 
hri_dac_clear_INTEN_EMPTY1_bit(const void * const hw)176 static inline void hri_dac_clear_INTEN_EMPTY1_bit(const void *const hw)
177 {
178 	((Dac *)hw)->INTENCLR.reg = DAC_INTENSET_EMPTY1;
179 }
180 
hri_dac_set_INTEN_reg(const void * const hw,hri_dac_intenset_reg_t mask)181 static inline void hri_dac_set_INTEN_reg(const void *const hw, hri_dac_intenset_reg_t mask)
182 {
183 	((Dac *)hw)->INTENSET.reg = mask;
184 }
185 
hri_dac_get_INTEN_reg(const void * const hw,hri_dac_intenset_reg_t mask)186 static inline hri_dac_intenset_reg_t hri_dac_get_INTEN_reg(const void *const hw, hri_dac_intenset_reg_t mask)
187 {
188 	uint8_t tmp;
189 	tmp = ((Dac *)hw)->INTENSET.reg;
190 	tmp &= mask;
191 	return tmp;
192 }
193 
hri_dac_read_INTEN_reg(const void * const hw)194 static inline hri_dac_intenset_reg_t hri_dac_read_INTEN_reg(const void *const hw)
195 {
196 	return ((Dac *)hw)->INTENSET.reg;
197 }
198 
hri_dac_write_INTEN_reg(const void * const hw,hri_dac_intenset_reg_t data)199 static inline void hri_dac_write_INTEN_reg(const void *const hw, hri_dac_intenset_reg_t data)
200 {
201 	((Dac *)hw)->INTENSET.reg = data;
202 	((Dac *)hw)->INTENCLR.reg = ~data;
203 }
204 
hri_dac_clear_INTEN_reg(const void * const hw,hri_dac_intenset_reg_t mask)205 static inline void hri_dac_clear_INTEN_reg(const void *const hw, hri_dac_intenset_reg_t mask)
206 {
207 	((Dac *)hw)->INTENCLR.reg = mask;
208 }
209 
hri_dac_get_INTFLAG_UNDERRUN0_bit(const void * const hw)210 static inline bool hri_dac_get_INTFLAG_UNDERRUN0_bit(const void *const hw)
211 {
212 	return (((Dac *)hw)->INTFLAG.reg & DAC_INTFLAG_UNDERRUN0) >> DAC_INTFLAG_UNDERRUN0_Pos;
213 }
214 
hri_dac_clear_INTFLAG_UNDERRUN0_bit(const void * const hw)215 static inline void hri_dac_clear_INTFLAG_UNDERRUN0_bit(const void *const hw)
216 {
217 	((Dac *)hw)->INTFLAG.reg = DAC_INTFLAG_UNDERRUN0;
218 }
219 
hri_dac_get_INTFLAG_UNDERRUN1_bit(const void * const hw)220 static inline bool hri_dac_get_INTFLAG_UNDERRUN1_bit(const void *const hw)
221 {
222 	return (((Dac *)hw)->INTFLAG.reg & DAC_INTFLAG_UNDERRUN1) >> DAC_INTFLAG_UNDERRUN1_Pos;
223 }
224 
hri_dac_clear_INTFLAG_UNDERRUN1_bit(const void * const hw)225 static inline void hri_dac_clear_INTFLAG_UNDERRUN1_bit(const void *const hw)
226 {
227 	((Dac *)hw)->INTFLAG.reg = DAC_INTFLAG_UNDERRUN1;
228 }
229 
hri_dac_get_INTFLAG_EMPTY0_bit(const void * const hw)230 static inline bool hri_dac_get_INTFLAG_EMPTY0_bit(const void *const hw)
231 {
232 	return (((Dac *)hw)->INTFLAG.reg & DAC_INTFLAG_EMPTY0) >> DAC_INTFLAG_EMPTY0_Pos;
233 }
234 
hri_dac_clear_INTFLAG_EMPTY0_bit(const void * const hw)235 static inline void hri_dac_clear_INTFLAG_EMPTY0_bit(const void *const hw)
236 {
237 	((Dac *)hw)->INTFLAG.reg = DAC_INTFLAG_EMPTY0;
238 }
239 
hri_dac_get_INTFLAG_EMPTY1_bit(const void * const hw)240 static inline bool hri_dac_get_INTFLAG_EMPTY1_bit(const void *const hw)
241 {
242 	return (((Dac *)hw)->INTFLAG.reg & DAC_INTFLAG_EMPTY1) >> DAC_INTFLAG_EMPTY1_Pos;
243 }
244 
hri_dac_clear_INTFLAG_EMPTY1_bit(const void * const hw)245 static inline void hri_dac_clear_INTFLAG_EMPTY1_bit(const void *const hw)
246 {
247 	((Dac *)hw)->INTFLAG.reg = DAC_INTFLAG_EMPTY1;
248 }
249 
hri_dac_get_interrupt_UNDERRUN0_bit(const void * const hw)250 static inline bool hri_dac_get_interrupt_UNDERRUN0_bit(const void *const hw)
251 {
252 	return (((Dac *)hw)->INTFLAG.reg & DAC_INTFLAG_UNDERRUN0) >> DAC_INTFLAG_UNDERRUN0_Pos;
253 }
254 
hri_dac_clear_interrupt_UNDERRUN0_bit(const void * const hw)255 static inline void hri_dac_clear_interrupt_UNDERRUN0_bit(const void *const hw)
256 {
257 	((Dac *)hw)->INTFLAG.reg = DAC_INTFLAG_UNDERRUN0;
258 }
259 
hri_dac_get_interrupt_UNDERRUN1_bit(const void * const hw)260 static inline bool hri_dac_get_interrupt_UNDERRUN1_bit(const void *const hw)
261 {
262 	return (((Dac *)hw)->INTFLAG.reg & DAC_INTFLAG_UNDERRUN1) >> DAC_INTFLAG_UNDERRUN1_Pos;
263 }
264 
hri_dac_clear_interrupt_UNDERRUN1_bit(const void * const hw)265 static inline void hri_dac_clear_interrupt_UNDERRUN1_bit(const void *const hw)
266 {
267 	((Dac *)hw)->INTFLAG.reg = DAC_INTFLAG_UNDERRUN1;
268 }
269 
hri_dac_get_interrupt_EMPTY0_bit(const void * const hw)270 static inline bool hri_dac_get_interrupt_EMPTY0_bit(const void *const hw)
271 {
272 	return (((Dac *)hw)->INTFLAG.reg & DAC_INTFLAG_EMPTY0) >> DAC_INTFLAG_EMPTY0_Pos;
273 }
274 
hri_dac_clear_interrupt_EMPTY0_bit(const void * const hw)275 static inline void hri_dac_clear_interrupt_EMPTY0_bit(const void *const hw)
276 {
277 	((Dac *)hw)->INTFLAG.reg = DAC_INTFLAG_EMPTY0;
278 }
279 
hri_dac_get_interrupt_EMPTY1_bit(const void * const hw)280 static inline bool hri_dac_get_interrupt_EMPTY1_bit(const void *const hw)
281 {
282 	return (((Dac *)hw)->INTFLAG.reg & DAC_INTFLAG_EMPTY1) >> DAC_INTFLAG_EMPTY1_Pos;
283 }
284 
hri_dac_clear_interrupt_EMPTY1_bit(const void * const hw)285 static inline void hri_dac_clear_interrupt_EMPTY1_bit(const void *const hw)
286 {
287 	((Dac *)hw)->INTFLAG.reg = DAC_INTFLAG_EMPTY1;
288 }
289 
hri_dac_get_INTFLAG_reg(const void * const hw,hri_dac_intflag_reg_t mask)290 static inline hri_dac_intflag_reg_t hri_dac_get_INTFLAG_reg(const void *const hw, hri_dac_intflag_reg_t mask)
291 {
292 	uint8_t tmp;
293 	tmp = ((Dac *)hw)->INTFLAG.reg;
294 	tmp &= mask;
295 	return tmp;
296 }
297 
hri_dac_read_INTFLAG_reg(const void * const hw)298 static inline hri_dac_intflag_reg_t hri_dac_read_INTFLAG_reg(const void *const hw)
299 {
300 	return ((Dac *)hw)->INTFLAG.reg;
301 }
302 
hri_dac_clear_INTFLAG_reg(const void * const hw,hri_dac_intflag_reg_t mask)303 static inline void hri_dac_clear_INTFLAG_reg(const void *const hw, hri_dac_intflag_reg_t mask)
304 {
305 	((Dac *)hw)->INTFLAG.reg = mask;
306 }
307 
hri_dac_write_DATA_reg(const void * const hw,uint8_t index,hri_dac_data_reg_t data)308 static inline void hri_dac_write_DATA_reg(const void *const hw, uint8_t index, hri_dac_data_reg_t data)
309 {
310 	DAC_CRITICAL_SECTION_ENTER();
311 	((Dac *)hw)->DATA[index].reg = data;
312 	DAC_CRITICAL_SECTION_LEAVE();
313 }
314 
hri_dac_write_DATABUF_reg(const void * const hw,uint8_t index,hri_dac_databuf_reg_t data)315 static inline void hri_dac_write_DATABUF_reg(const void *const hw, uint8_t index, hri_dac_databuf_reg_t data)
316 {
317 	DAC_CRITICAL_SECTION_ENTER();
318 	((Dac *)hw)->DATABUF[index].reg = data;
319 	DAC_CRITICAL_SECTION_LEAVE();
320 }
321 
hri_dac_set_CTRLA_SWRST_bit(const void * const hw)322 static inline void hri_dac_set_CTRLA_SWRST_bit(const void *const hw)
323 {
324 	DAC_CRITICAL_SECTION_ENTER();
325 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_SWRST);
326 	((Dac *)hw)->CTRLA.reg |= DAC_CTRLA_SWRST;
327 	DAC_CRITICAL_SECTION_LEAVE();
328 }
329 
hri_dac_get_CTRLA_SWRST_bit(const void * const hw)330 static inline bool hri_dac_get_CTRLA_SWRST_bit(const void *const hw)
331 {
332 	uint8_t tmp;
333 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_SWRST);
334 	tmp = ((Dac *)hw)->CTRLA.reg;
335 	tmp = (tmp & DAC_CTRLA_SWRST) >> DAC_CTRLA_SWRST_Pos;
336 	return (bool)tmp;
337 }
338 
hri_dac_set_CTRLA_ENABLE_bit(const void * const hw)339 static inline void hri_dac_set_CTRLA_ENABLE_bit(const void *const hw)
340 {
341 	DAC_CRITICAL_SECTION_ENTER();
342 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_SWRST | DAC_SYNCBUSY_ENABLE);
343 	((Dac *)hw)->CTRLA.reg |= DAC_CTRLA_ENABLE;
344 	DAC_CRITICAL_SECTION_LEAVE();
345 }
346 
hri_dac_get_CTRLA_ENABLE_bit(const void * const hw)347 static inline bool hri_dac_get_CTRLA_ENABLE_bit(const void *const hw)
348 {
349 	uint8_t tmp;
350 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_SWRST | DAC_SYNCBUSY_ENABLE);
351 	tmp = ((Dac *)hw)->CTRLA.reg;
352 	tmp = (tmp & DAC_CTRLA_ENABLE) >> DAC_CTRLA_ENABLE_Pos;
353 	return (bool)tmp;
354 }
355 
hri_dac_write_CTRLA_ENABLE_bit(const void * const hw,bool value)356 static inline void hri_dac_write_CTRLA_ENABLE_bit(const void *const hw, bool value)
357 {
358 	uint8_t tmp;
359 	DAC_CRITICAL_SECTION_ENTER();
360 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_SWRST | DAC_SYNCBUSY_ENABLE);
361 	tmp = ((Dac *)hw)->CTRLA.reg;
362 	tmp &= ~DAC_CTRLA_ENABLE;
363 	tmp |= value << DAC_CTRLA_ENABLE_Pos;
364 	((Dac *)hw)->CTRLA.reg = tmp;
365 	DAC_CRITICAL_SECTION_LEAVE();
366 }
367 
hri_dac_clear_CTRLA_ENABLE_bit(const void * const hw)368 static inline void hri_dac_clear_CTRLA_ENABLE_bit(const void *const hw)
369 {
370 	DAC_CRITICAL_SECTION_ENTER();
371 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_SWRST | DAC_SYNCBUSY_ENABLE);
372 	((Dac *)hw)->CTRLA.reg &= ~DAC_CTRLA_ENABLE;
373 	DAC_CRITICAL_SECTION_LEAVE();
374 }
375 
hri_dac_toggle_CTRLA_ENABLE_bit(const void * const hw)376 static inline void hri_dac_toggle_CTRLA_ENABLE_bit(const void *const hw)
377 {
378 	DAC_CRITICAL_SECTION_ENTER();
379 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_SWRST | DAC_SYNCBUSY_ENABLE);
380 	((Dac *)hw)->CTRLA.reg ^= DAC_CTRLA_ENABLE;
381 	DAC_CRITICAL_SECTION_LEAVE();
382 }
383 
hri_dac_set_CTRLA_reg(const void * const hw,hri_dac_ctrla_reg_t mask)384 static inline void hri_dac_set_CTRLA_reg(const void *const hw, hri_dac_ctrla_reg_t mask)
385 {
386 	DAC_CRITICAL_SECTION_ENTER();
387 	((Dac *)hw)->CTRLA.reg |= mask;
388 	DAC_CRITICAL_SECTION_LEAVE();
389 }
390 
hri_dac_get_CTRLA_reg(const void * const hw,hri_dac_ctrla_reg_t mask)391 static inline hri_dac_ctrla_reg_t hri_dac_get_CTRLA_reg(const void *const hw, hri_dac_ctrla_reg_t mask)
392 {
393 	uint8_t tmp;
394 	tmp = ((Dac *)hw)->CTRLA.reg;
395 	tmp &= mask;
396 	return tmp;
397 }
398 
hri_dac_write_CTRLA_reg(const void * const hw,hri_dac_ctrla_reg_t data)399 static inline void hri_dac_write_CTRLA_reg(const void *const hw, hri_dac_ctrla_reg_t data)
400 {
401 	DAC_CRITICAL_SECTION_ENTER();
402 	((Dac *)hw)->CTRLA.reg = data;
403 	DAC_CRITICAL_SECTION_LEAVE();
404 }
405 
hri_dac_clear_CTRLA_reg(const void * const hw,hri_dac_ctrla_reg_t mask)406 static inline void hri_dac_clear_CTRLA_reg(const void *const hw, hri_dac_ctrla_reg_t mask)
407 {
408 	DAC_CRITICAL_SECTION_ENTER();
409 	((Dac *)hw)->CTRLA.reg &= ~mask;
410 	DAC_CRITICAL_SECTION_LEAVE();
411 }
412 
hri_dac_toggle_CTRLA_reg(const void * const hw,hri_dac_ctrla_reg_t mask)413 static inline void hri_dac_toggle_CTRLA_reg(const void *const hw, hri_dac_ctrla_reg_t mask)
414 {
415 	DAC_CRITICAL_SECTION_ENTER();
416 	((Dac *)hw)->CTRLA.reg ^= mask;
417 	DAC_CRITICAL_SECTION_LEAVE();
418 }
419 
hri_dac_read_CTRLA_reg(const void * const hw)420 static inline hri_dac_ctrla_reg_t hri_dac_read_CTRLA_reg(const void *const hw)
421 {
422 	return ((Dac *)hw)->CTRLA.reg;
423 }
424 
hri_dac_set_CTRLB_DIFF_bit(const void * const hw)425 static inline void hri_dac_set_CTRLB_DIFF_bit(const void *const hw)
426 {
427 	DAC_CRITICAL_SECTION_ENTER();
428 	((Dac *)hw)->CTRLB.reg |= DAC_CTRLB_DIFF;
429 	DAC_CRITICAL_SECTION_LEAVE();
430 }
431 
hri_dac_get_CTRLB_DIFF_bit(const void * const hw)432 static inline bool hri_dac_get_CTRLB_DIFF_bit(const void *const hw)
433 {
434 	uint8_t tmp;
435 	tmp = ((Dac *)hw)->CTRLB.reg;
436 	tmp = (tmp & DAC_CTRLB_DIFF) >> DAC_CTRLB_DIFF_Pos;
437 	return (bool)tmp;
438 }
439 
hri_dac_write_CTRLB_DIFF_bit(const void * const hw,bool value)440 static inline void hri_dac_write_CTRLB_DIFF_bit(const void *const hw, bool value)
441 {
442 	uint8_t tmp;
443 	DAC_CRITICAL_SECTION_ENTER();
444 	tmp = ((Dac *)hw)->CTRLB.reg;
445 	tmp &= ~DAC_CTRLB_DIFF;
446 	tmp |= value << DAC_CTRLB_DIFF_Pos;
447 	((Dac *)hw)->CTRLB.reg = tmp;
448 	DAC_CRITICAL_SECTION_LEAVE();
449 }
450 
hri_dac_clear_CTRLB_DIFF_bit(const void * const hw)451 static inline void hri_dac_clear_CTRLB_DIFF_bit(const void *const hw)
452 {
453 	DAC_CRITICAL_SECTION_ENTER();
454 	((Dac *)hw)->CTRLB.reg &= ~DAC_CTRLB_DIFF;
455 	DAC_CRITICAL_SECTION_LEAVE();
456 }
457 
hri_dac_toggle_CTRLB_DIFF_bit(const void * const hw)458 static inline void hri_dac_toggle_CTRLB_DIFF_bit(const void *const hw)
459 {
460 	DAC_CRITICAL_SECTION_ENTER();
461 	((Dac *)hw)->CTRLB.reg ^= DAC_CTRLB_DIFF;
462 	DAC_CRITICAL_SECTION_LEAVE();
463 }
464 
hri_dac_set_CTRLB_REFSEL_bf(const void * const hw,hri_dac_ctrlb_reg_t mask)465 static inline void hri_dac_set_CTRLB_REFSEL_bf(const void *const hw, hri_dac_ctrlb_reg_t mask)
466 {
467 	DAC_CRITICAL_SECTION_ENTER();
468 	((Dac *)hw)->CTRLB.reg |= DAC_CTRLB_REFSEL(mask);
469 	DAC_CRITICAL_SECTION_LEAVE();
470 }
471 
hri_dac_get_CTRLB_REFSEL_bf(const void * const hw,hri_dac_ctrlb_reg_t mask)472 static inline hri_dac_ctrlb_reg_t hri_dac_get_CTRLB_REFSEL_bf(const void *const hw, hri_dac_ctrlb_reg_t mask)
473 {
474 	uint8_t tmp;
475 	tmp = ((Dac *)hw)->CTRLB.reg;
476 	tmp = (tmp & DAC_CTRLB_REFSEL(mask)) >> DAC_CTRLB_REFSEL_Pos;
477 	return tmp;
478 }
479 
hri_dac_write_CTRLB_REFSEL_bf(const void * const hw,hri_dac_ctrlb_reg_t data)480 static inline void hri_dac_write_CTRLB_REFSEL_bf(const void *const hw, hri_dac_ctrlb_reg_t data)
481 {
482 	uint8_t tmp;
483 	DAC_CRITICAL_SECTION_ENTER();
484 	tmp = ((Dac *)hw)->CTRLB.reg;
485 	tmp &= ~DAC_CTRLB_REFSEL_Msk;
486 	tmp |= DAC_CTRLB_REFSEL(data);
487 	((Dac *)hw)->CTRLB.reg = tmp;
488 	DAC_CRITICAL_SECTION_LEAVE();
489 }
490 
hri_dac_clear_CTRLB_REFSEL_bf(const void * const hw,hri_dac_ctrlb_reg_t mask)491 static inline void hri_dac_clear_CTRLB_REFSEL_bf(const void *const hw, hri_dac_ctrlb_reg_t mask)
492 {
493 	DAC_CRITICAL_SECTION_ENTER();
494 	((Dac *)hw)->CTRLB.reg &= ~DAC_CTRLB_REFSEL(mask);
495 	DAC_CRITICAL_SECTION_LEAVE();
496 }
497 
hri_dac_toggle_CTRLB_REFSEL_bf(const void * const hw,hri_dac_ctrlb_reg_t mask)498 static inline void hri_dac_toggle_CTRLB_REFSEL_bf(const void *const hw, hri_dac_ctrlb_reg_t mask)
499 {
500 	DAC_CRITICAL_SECTION_ENTER();
501 	((Dac *)hw)->CTRLB.reg ^= DAC_CTRLB_REFSEL(mask);
502 	DAC_CRITICAL_SECTION_LEAVE();
503 }
504 
hri_dac_read_CTRLB_REFSEL_bf(const void * const hw)505 static inline hri_dac_ctrlb_reg_t hri_dac_read_CTRLB_REFSEL_bf(const void *const hw)
506 {
507 	uint8_t tmp;
508 	tmp = ((Dac *)hw)->CTRLB.reg;
509 	tmp = (tmp & DAC_CTRLB_REFSEL_Msk) >> DAC_CTRLB_REFSEL_Pos;
510 	return tmp;
511 }
512 
hri_dac_set_CTRLB_reg(const void * const hw,hri_dac_ctrlb_reg_t mask)513 static inline void hri_dac_set_CTRLB_reg(const void *const hw, hri_dac_ctrlb_reg_t mask)
514 {
515 	DAC_CRITICAL_SECTION_ENTER();
516 	((Dac *)hw)->CTRLB.reg |= mask;
517 	DAC_CRITICAL_SECTION_LEAVE();
518 }
519 
hri_dac_get_CTRLB_reg(const void * const hw,hri_dac_ctrlb_reg_t mask)520 static inline hri_dac_ctrlb_reg_t hri_dac_get_CTRLB_reg(const void *const hw, hri_dac_ctrlb_reg_t mask)
521 {
522 	uint8_t tmp;
523 	tmp = ((Dac *)hw)->CTRLB.reg;
524 	tmp &= mask;
525 	return tmp;
526 }
527 
hri_dac_write_CTRLB_reg(const void * const hw,hri_dac_ctrlb_reg_t data)528 static inline void hri_dac_write_CTRLB_reg(const void *const hw, hri_dac_ctrlb_reg_t data)
529 {
530 	DAC_CRITICAL_SECTION_ENTER();
531 	((Dac *)hw)->CTRLB.reg = data;
532 	DAC_CRITICAL_SECTION_LEAVE();
533 }
534 
hri_dac_clear_CTRLB_reg(const void * const hw,hri_dac_ctrlb_reg_t mask)535 static inline void hri_dac_clear_CTRLB_reg(const void *const hw, hri_dac_ctrlb_reg_t mask)
536 {
537 	DAC_CRITICAL_SECTION_ENTER();
538 	((Dac *)hw)->CTRLB.reg &= ~mask;
539 	DAC_CRITICAL_SECTION_LEAVE();
540 }
541 
hri_dac_toggle_CTRLB_reg(const void * const hw,hri_dac_ctrlb_reg_t mask)542 static inline void hri_dac_toggle_CTRLB_reg(const void *const hw, hri_dac_ctrlb_reg_t mask)
543 {
544 	DAC_CRITICAL_SECTION_ENTER();
545 	((Dac *)hw)->CTRLB.reg ^= mask;
546 	DAC_CRITICAL_SECTION_LEAVE();
547 }
548 
hri_dac_read_CTRLB_reg(const void * const hw)549 static inline hri_dac_ctrlb_reg_t hri_dac_read_CTRLB_reg(const void *const hw)
550 {
551 	return ((Dac *)hw)->CTRLB.reg;
552 }
553 
hri_dac_set_EVCTRL_STARTEI0_bit(const void * const hw)554 static inline void hri_dac_set_EVCTRL_STARTEI0_bit(const void *const hw)
555 {
556 	DAC_CRITICAL_SECTION_ENTER();
557 	((Dac *)hw)->EVCTRL.reg |= DAC_EVCTRL_STARTEI0;
558 	DAC_CRITICAL_SECTION_LEAVE();
559 }
560 
hri_dac_get_EVCTRL_STARTEI0_bit(const void * const hw)561 static inline bool hri_dac_get_EVCTRL_STARTEI0_bit(const void *const hw)
562 {
563 	uint8_t tmp;
564 	tmp = ((Dac *)hw)->EVCTRL.reg;
565 	tmp = (tmp & DAC_EVCTRL_STARTEI0) >> DAC_EVCTRL_STARTEI0_Pos;
566 	return (bool)tmp;
567 }
568 
hri_dac_write_EVCTRL_STARTEI0_bit(const void * const hw,bool value)569 static inline void hri_dac_write_EVCTRL_STARTEI0_bit(const void *const hw, bool value)
570 {
571 	uint8_t tmp;
572 	DAC_CRITICAL_SECTION_ENTER();
573 	tmp = ((Dac *)hw)->EVCTRL.reg;
574 	tmp &= ~DAC_EVCTRL_STARTEI0;
575 	tmp |= value << DAC_EVCTRL_STARTEI0_Pos;
576 	((Dac *)hw)->EVCTRL.reg = tmp;
577 	DAC_CRITICAL_SECTION_LEAVE();
578 }
579 
hri_dac_clear_EVCTRL_STARTEI0_bit(const void * const hw)580 static inline void hri_dac_clear_EVCTRL_STARTEI0_bit(const void *const hw)
581 {
582 	DAC_CRITICAL_SECTION_ENTER();
583 	((Dac *)hw)->EVCTRL.reg &= ~DAC_EVCTRL_STARTEI0;
584 	DAC_CRITICAL_SECTION_LEAVE();
585 }
586 
hri_dac_toggle_EVCTRL_STARTEI0_bit(const void * const hw)587 static inline void hri_dac_toggle_EVCTRL_STARTEI0_bit(const void *const hw)
588 {
589 	DAC_CRITICAL_SECTION_ENTER();
590 	((Dac *)hw)->EVCTRL.reg ^= DAC_EVCTRL_STARTEI0;
591 	DAC_CRITICAL_SECTION_LEAVE();
592 }
593 
hri_dac_set_EVCTRL_STARTEI1_bit(const void * const hw)594 static inline void hri_dac_set_EVCTRL_STARTEI1_bit(const void *const hw)
595 {
596 	DAC_CRITICAL_SECTION_ENTER();
597 	((Dac *)hw)->EVCTRL.reg |= DAC_EVCTRL_STARTEI1;
598 	DAC_CRITICAL_SECTION_LEAVE();
599 }
600 
hri_dac_get_EVCTRL_STARTEI1_bit(const void * const hw)601 static inline bool hri_dac_get_EVCTRL_STARTEI1_bit(const void *const hw)
602 {
603 	uint8_t tmp;
604 	tmp = ((Dac *)hw)->EVCTRL.reg;
605 	tmp = (tmp & DAC_EVCTRL_STARTEI1) >> DAC_EVCTRL_STARTEI1_Pos;
606 	return (bool)tmp;
607 }
608 
hri_dac_write_EVCTRL_STARTEI1_bit(const void * const hw,bool value)609 static inline void hri_dac_write_EVCTRL_STARTEI1_bit(const void *const hw, bool value)
610 {
611 	uint8_t tmp;
612 	DAC_CRITICAL_SECTION_ENTER();
613 	tmp = ((Dac *)hw)->EVCTRL.reg;
614 	tmp &= ~DAC_EVCTRL_STARTEI1;
615 	tmp |= value << DAC_EVCTRL_STARTEI1_Pos;
616 	((Dac *)hw)->EVCTRL.reg = tmp;
617 	DAC_CRITICAL_SECTION_LEAVE();
618 }
619 
hri_dac_clear_EVCTRL_STARTEI1_bit(const void * const hw)620 static inline void hri_dac_clear_EVCTRL_STARTEI1_bit(const void *const hw)
621 {
622 	DAC_CRITICAL_SECTION_ENTER();
623 	((Dac *)hw)->EVCTRL.reg &= ~DAC_EVCTRL_STARTEI1;
624 	DAC_CRITICAL_SECTION_LEAVE();
625 }
626 
hri_dac_toggle_EVCTRL_STARTEI1_bit(const void * const hw)627 static inline void hri_dac_toggle_EVCTRL_STARTEI1_bit(const void *const hw)
628 {
629 	DAC_CRITICAL_SECTION_ENTER();
630 	((Dac *)hw)->EVCTRL.reg ^= DAC_EVCTRL_STARTEI1;
631 	DAC_CRITICAL_SECTION_LEAVE();
632 }
633 
hri_dac_set_EVCTRL_EMPTYEO0_bit(const void * const hw)634 static inline void hri_dac_set_EVCTRL_EMPTYEO0_bit(const void *const hw)
635 {
636 	DAC_CRITICAL_SECTION_ENTER();
637 	((Dac *)hw)->EVCTRL.reg |= DAC_EVCTRL_EMPTYEO0;
638 	DAC_CRITICAL_SECTION_LEAVE();
639 }
640 
hri_dac_get_EVCTRL_EMPTYEO0_bit(const void * const hw)641 static inline bool hri_dac_get_EVCTRL_EMPTYEO0_bit(const void *const hw)
642 {
643 	uint8_t tmp;
644 	tmp = ((Dac *)hw)->EVCTRL.reg;
645 	tmp = (tmp & DAC_EVCTRL_EMPTYEO0) >> DAC_EVCTRL_EMPTYEO0_Pos;
646 	return (bool)tmp;
647 }
648 
hri_dac_write_EVCTRL_EMPTYEO0_bit(const void * const hw,bool value)649 static inline void hri_dac_write_EVCTRL_EMPTYEO0_bit(const void *const hw, bool value)
650 {
651 	uint8_t tmp;
652 	DAC_CRITICAL_SECTION_ENTER();
653 	tmp = ((Dac *)hw)->EVCTRL.reg;
654 	tmp &= ~DAC_EVCTRL_EMPTYEO0;
655 	tmp |= value << DAC_EVCTRL_EMPTYEO0_Pos;
656 	((Dac *)hw)->EVCTRL.reg = tmp;
657 	DAC_CRITICAL_SECTION_LEAVE();
658 }
659 
hri_dac_clear_EVCTRL_EMPTYEO0_bit(const void * const hw)660 static inline void hri_dac_clear_EVCTRL_EMPTYEO0_bit(const void *const hw)
661 {
662 	DAC_CRITICAL_SECTION_ENTER();
663 	((Dac *)hw)->EVCTRL.reg &= ~DAC_EVCTRL_EMPTYEO0;
664 	DAC_CRITICAL_SECTION_LEAVE();
665 }
666 
hri_dac_toggle_EVCTRL_EMPTYEO0_bit(const void * const hw)667 static inline void hri_dac_toggle_EVCTRL_EMPTYEO0_bit(const void *const hw)
668 {
669 	DAC_CRITICAL_SECTION_ENTER();
670 	((Dac *)hw)->EVCTRL.reg ^= DAC_EVCTRL_EMPTYEO0;
671 	DAC_CRITICAL_SECTION_LEAVE();
672 }
673 
hri_dac_set_EVCTRL_EMPTYEO1_bit(const void * const hw)674 static inline void hri_dac_set_EVCTRL_EMPTYEO1_bit(const void *const hw)
675 {
676 	DAC_CRITICAL_SECTION_ENTER();
677 	((Dac *)hw)->EVCTRL.reg |= DAC_EVCTRL_EMPTYEO1;
678 	DAC_CRITICAL_SECTION_LEAVE();
679 }
680 
hri_dac_get_EVCTRL_EMPTYEO1_bit(const void * const hw)681 static inline bool hri_dac_get_EVCTRL_EMPTYEO1_bit(const void *const hw)
682 {
683 	uint8_t tmp;
684 	tmp = ((Dac *)hw)->EVCTRL.reg;
685 	tmp = (tmp & DAC_EVCTRL_EMPTYEO1) >> DAC_EVCTRL_EMPTYEO1_Pos;
686 	return (bool)tmp;
687 }
688 
hri_dac_write_EVCTRL_EMPTYEO1_bit(const void * const hw,bool value)689 static inline void hri_dac_write_EVCTRL_EMPTYEO1_bit(const void *const hw, bool value)
690 {
691 	uint8_t tmp;
692 	DAC_CRITICAL_SECTION_ENTER();
693 	tmp = ((Dac *)hw)->EVCTRL.reg;
694 	tmp &= ~DAC_EVCTRL_EMPTYEO1;
695 	tmp |= value << DAC_EVCTRL_EMPTYEO1_Pos;
696 	((Dac *)hw)->EVCTRL.reg = tmp;
697 	DAC_CRITICAL_SECTION_LEAVE();
698 }
699 
hri_dac_clear_EVCTRL_EMPTYEO1_bit(const void * const hw)700 static inline void hri_dac_clear_EVCTRL_EMPTYEO1_bit(const void *const hw)
701 {
702 	DAC_CRITICAL_SECTION_ENTER();
703 	((Dac *)hw)->EVCTRL.reg &= ~DAC_EVCTRL_EMPTYEO1;
704 	DAC_CRITICAL_SECTION_LEAVE();
705 }
706 
hri_dac_toggle_EVCTRL_EMPTYEO1_bit(const void * const hw)707 static inline void hri_dac_toggle_EVCTRL_EMPTYEO1_bit(const void *const hw)
708 {
709 	DAC_CRITICAL_SECTION_ENTER();
710 	((Dac *)hw)->EVCTRL.reg ^= DAC_EVCTRL_EMPTYEO1;
711 	DAC_CRITICAL_SECTION_LEAVE();
712 }
713 
hri_dac_set_EVCTRL_INVEI0_bit(const void * const hw)714 static inline void hri_dac_set_EVCTRL_INVEI0_bit(const void *const hw)
715 {
716 	DAC_CRITICAL_SECTION_ENTER();
717 	((Dac *)hw)->EVCTRL.reg |= DAC_EVCTRL_INVEI0;
718 	DAC_CRITICAL_SECTION_LEAVE();
719 }
720 
hri_dac_get_EVCTRL_INVEI0_bit(const void * const hw)721 static inline bool hri_dac_get_EVCTRL_INVEI0_bit(const void *const hw)
722 {
723 	uint8_t tmp;
724 	tmp = ((Dac *)hw)->EVCTRL.reg;
725 	tmp = (tmp & DAC_EVCTRL_INVEI0) >> DAC_EVCTRL_INVEI0_Pos;
726 	return (bool)tmp;
727 }
728 
hri_dac_write_EVCTRL_INVEI0_bit(const void * const hw,bool value)729 static inline void hri_dac_write_EVCTRL_INVEI0_bit(const void *const hw, bool value)
730 {
731 	uint8_t tmp;
732 	DAC_CRITICAL_SECTION_ENTER();
733 	tmp = ((Dac *)hw)->EVCTRL.reg;
734 	tmp &= ~DAC_EVCTRL_INVEI0;
735 	tmp |= value << DAC_EVCTRL_INVEI0_Pos;
736 	((Dac *)hw)->EVCTRL.reg = tmp;
737 	DAC_CRITICAL_SECTION_LEAVE();
738 }
739 
hri_dac_clear_EVCTRL_INVEI0_bit(const void * const hw)740 static inline void hri_dac_clear_EVCTRL_INVEI0_bit(const void *const hw)
741 {
742 	DAC_CRITICAL_SECTION_ENTER();
743 	((Dac *)hw)->EVCTRL.reg &= ~DAC_EVCTRL_INVEI0;
744 	DAC_CRITICAL_SECTION_LEAVE();
745 }
746 
hri_dac_toggle_EVCTRL_INVEI0_bit(const void * const hw)747 static inline void hri_dac_toggle_EVCTRL_INVEI0_bit(const void *const hw)
748 {
749 	DAC_CRITICAL_SECTION_ENTER();
750 	((Dac *)hw)->EVCTRL.reg ^= DAC_EVCTRL_INVEI0;
751 	DAC_CRITICAL_SECTION_LEAVE();
752 }
753 
hri_dac_set_EVCTRL_INVEI1_bit(const void * const hw)754 static inline void hri_dac_set_EVCTRL_INVEI1_bit(const void *const hw)
755 {
756 	DAC_CRITICAL_SECTION_ENTER();
757 	((Dac *)hw)->EVCTRL.reg |= DAC_EVCTRL_INVEI1;
758 	DAC_CRITICAL_SECTION_LEAVE();
759 }
760 
hri_dac_get_EVCTRL_INVEI1_bit(const void * const hw)761 static inline bool hri_dac_get_EVCTRL_INVEI1_bit(const void *const hw)
762 {
763 	uint8_t tmp;
764 	tmp = ((Dac *)hw)->EVCTRL.reg;
765 	tmp = (tmp & DAC_EVCTRL_INVEI1) >> DAC_EVCTRL_INVEI1_Pos;
766 	return (bool)tmp;
767 }
768 
hri_dac_write_EVCTRL_INVEI1_bit(const void * const hw,bool value)769 static inline void hri_dac_write_EVCTRL_INVEI1_bit(const void *const hw, bool value)
770 {
771 	uint8_t tmp;
772 	DAC_CRITICAL_SECTION_ENTER();
773 	tmp = ((Dac *)hw)->EVCTRL.reg;
774 	tmp &= ~DAC_EVCTRL_INVEI1;
775 	tmp |= value << DAC_EVCTRL_INVEI1_Pos;
776 	((Dac *)hw)->EVCTRL.reg = tmp;
777 	DAC_CRITICAL_SECTION_LEAVE();
778 }
779 
hri_dac_clear_EVCTRL_INVEI1_bit(const void * const hw)780 static inline void hri_dac_clear_EVCTRL_INVEI1_bit(const void *const hw)
781 {
782 	DAC_CRITICAL_SECTION_ENTER();
783 	((Dac *)hw)->EVCTRL.reg &= ~DAC_EVCTRL_INVEI1;
784 	DAC_CRITICAL_SECTION_LEAVE();
785 }
786 
hri_dac_toggle_EVCTRL_INVEI1_bit(const void * const hw)787 static inline void hri_dac_toggle_EVCTRL_INVEI1_bit(const void *const hw)
788 {
789 	DAC_CRITICAL_SECTION_ENTER();
790 	((Dac *)hw)->EVCTRL.reg ^= DAC_EVCTRL_INVEI1;
791 	DAC_CRITICAL_SECTION_LEAVE();
792 }
793 
hri_dac_set_EVCTRL_reg(const void * const hw,hri_dac_evctrl_reg_t mask)794 static inline void hri_dac_set_EVCTRL_reg(const void *const hw, hri_dac_evctrl_reg_t mask)
795 {
796 	DAC_CRITICAL_SECTION_ENTER();
797 	((Dac *)hw)->EVCTRL.reg |= mask;
798 	DAC_CRITICAL_SECTION_LEAVE();
799 }
800 
hri_dac_get_EVCTRL_reg(const void * const hw,hri_dac_evctrl_reg_t mask)801 static inline hri_dac_evctrl_reg_t hri_dac_get_EVCTRL_reg(const void *const hw, hri_dac_evctrl_reg_t mask)
802 {
803 	uint8_t tmp;
804 	tmp = ((Dac *)hw)->EVCTRL.reg;
805 	tmp &= mask;
806 	return tmp;
807 }
808 
hri_dac_write_EVCTRL_reg(const void * const hw,hri_dac_evctrl_reg_t data)809 static inline void hri_dac_write_EVCTRL_reg(const void *const hw, hri_dac_evctrl_reg_t data)
810 {
811 	DAC_CRITICAL_SECTION_ENTER();
812 	((Dac *)hw)->EVCTRL.reg = data;
813 	DAC_CRITICAL_SECTION_LEAVE();
814 }
815 
hri_dac_clear_EVCTRL_reg(const void * const hw,hri_dac_evctrl_reg_t mask)816 static inline void hri_dac_clear_EVCTRL_reg(const void *const hw, hri_dac_evctrl_reg_t mask)
817 {
818 	DAC_CRITICAL_SECTION_ENTER();
819 	((Dac *)hw)->EVCTRL.reg &= ~mask;
820 	DAC_CRITICAL_SECTION_LEAVE();
821 }
822 
hri_dac_toggle_EVCTRL_reg(const void * const hw,hri_dac_evctrl_reg_t mask)823 static inline void hri_dac_toggle_EVCTRL_reg(const void *const hw, hri_dac_evctrl_reg_t mask)
824 {
825 	DAC_CRITICAL_SECTION_ENTER();
826 	((Dac *)hw)->EVCTRL.reg ^= mask;
827 	DAC_CRITICAL_SECTION_LEAVE();
828 }
829 
hri_dac_read_EVCTRL_reg(const void * const hw)830 static inline hri_dac_evctrl_reg_t hri_dac_read_EVCTRL_reg(const void *const hw)
831 {
832 	return ((Dac *)hw)->EVCTRL.reg;
833 }
834 
hri_dac_set_DACCTRL_LEFTADJ_bit(const void * const hw,uint8_t index)835 static inline void hri_dac_set_DACCTRL_LEFTADJ_bit(const void *const hw, uint8_t index)
836 {
837 	DAC_CRITICAL_SECTION_ENTER();
838 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
839 	((Dac *)hw)->DACCTRL[index].reg |= DAC_DACCTRL_LEFTADJ;
840 	DAC_CRITICAL_SECTION_LEAVE();
841 }
842 
hri_dac_get_DACCTRL_LEFTADJ_bit(const void * const hw,uint8_t index)843 static inline bool hri_dac_get_DACCTRL_LEFTADJ_bit(const void *const hw, uint8_t index)
844 {
845 	uint16_t tmp;
846 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
847 	tmp = (tmp & DAC_DACCTRL_LEFTADJ) >> DAC_DACCTRL_LEFTADJ_Pos;
848 	return (bool)tmp;
849 }
850 
hri_dac_write_DACCTRL_LEFTADJ_bit(const void * const hw,uint8_t index,bool value)851 static inline void hri_dac_write_DACCTRL_LEFTADJ_bit(const void *const hw, uint8_t index, bool value)
852 {
853 	uint16_t tmp;
854 	DAC_CRITICAL_SECTION_ENTER();
855 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
856 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
857 	tmp &= ~DAC_DACCTRL_LEFTADJ;
858 	tmp |= value << DAC_DACCTRL_LEFTADJ_Pos;
859 	((Dac *)hw)->DACCTRL[index].reg = tmp;
860 	DAC_CRITICAL_SECTION_LEAVE();
861 }
862 
hri_dac_clear_DACCTRL_LEFTADJ_bit(const void * const hw,uint8_t index)863 static inline void hri_dac_clear_DACCTRL_LEFTADJ_bit(const void *const hw, uint8_t index)
864 {
865 	DAC_CRITICAL_SECTION_ENTER();
866 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
867 	((Dac *)hw)->DACCTRL[index].reg &= ~DAC_DACCTRL_LEFTADJ;
868 	DAC_CRITICAL_SECTION_LEAVE();
869 }
870 
hri_dac_toggle_DACCTRL_LEFTADJ_bit(const void * const hw,uint8_t index)871 static inline void hri_dac_toggle_DACCTRL_LEFTADJ_bit(const void *const hw, uint8_t index)
872 {
873 	DAC_CRITICAL_SECTION_ENTER();
874 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
875 	((Dac *)hw)->DACCTRL[index].reg ^= DAC_DACCTRL_LEFTADJ;
876 	DAC_CRITICAL_SECTION_LEAVE();
877 }
878 
hri_dac_set_DACCTRL_ENABLE_bit(const void * const hw,uint8_t index)879 static inline void hri_dac_set_DACCTRL_ENABLE_bit(const void *const hw, uint8_t index)
880 {
881 	DAC_CRITICAL_SECTION_ENTER();
882 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_ENABLE);
883 	((Dac *)hw)->DACCTRL[index].reg |= DAC_DACCTRL_ENABLE;
884 	DAC_CRITICAL_SECTION_LEAVE();
885 }
886 
hri_dac_get_DACCTRL_ENABLE_bit(const void * const hw,uint8_t index)887 static inline bool hri_dac_get_DACCTRL_ENABLE_bit(const void *const hw, uint8_t index)
888 {
889 	uint16_t tmp;
890 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_ENABLE);
891 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
892 	tmp = (tmp & DAC_DACCTRL_ENABLE) >> DAC_DACCTRL_ENABLE_Pos;
893 	return (bool)tmp;
894 }
895 
hri_dac_write_DACCTRL_ENABLE_bit(const void * const hw,uint8_t index,bool value)896 static inline void hri_dac_write_DACCTRL_ENABLE_bit(const void *const hw, uint8_t index, bool value)
897 {
898 	uint16_t tmp;
899 	DAC_CRITICAL_SECTION_ENTER();
900 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_ENABLE);
901 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
902 	tmp &= ~DAC_DACCTRL_ENABLE;
903 	tmp |= value << DAC_DACCTRL_ENABLE_Pos;
904 	((Dac *)hw)->DACCTRL[index].reg = tmp;
905 	DAC_CRITICAL_SECTION_LEAVE();
906 }
907 
hri_dac_clear_DACCTRL_ENABLE_bit(const void * const hw,uint8_t index)908 static inline void hri_dac_clear_DACCTRL_ENABLE_bit(const void *const hw, uint8_t index)
909 {
910 	DAC_CRITICAL_SECTION_ENTER();
911 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_ENABLE);
912 	((Dac *)hw)->DACCTRL[index].reg &= ~DAC_DACCTRL_ENABLE;
913 	DAC_CRITICAL_SECTION_LEAVE();
914 }
915 
hri_dac_toggle_DACCTRL_ENABLE_bit(const void * const hw,uint8_t index)916 static inline void hri_dac_toggle_DACCTRL_ENABLE_bit(const void *const hw, uint8_t index)
917 {
918 	DAC_CRITICAL_SECTION_ENTER();
919 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_ENABLE);
920 	((Dac *)hw)->DACCTRL[index].reg ^= DAC_DACCTRL_ENABLE;
921 	DAC_CRITICAL_SECTION_LEAVE();
922 }
923 
hri_dac_set_DACCTRL_RUNSTDBY_bit(const void * const hw,uint8_t index)924 static inline void hri_dac_set_DACCTRL_RUNSTDBY_bit(const void *const hw, uint8_t index)
925 {
926 	DAC_CRITICAL_SECTION_ENTER();
927 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
928 	((Dac *)hw)->DACCTRL[index].reg |= DAC_DACCTRL_RUNSTDBY;
929 	DAC_CRITICAL_SECTION_LEAVE();
930 }
931 
hri_dac_get_DACCTRL_RUNSTDBY_bit(const void * const hw,uint8_t index)932 static inline bool hri_dac_get_DACCTRL_RUNSTDBY_bit(const void *const hw, uint8_t index)
933 {
934 	uint16_t tmp;
935 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
936 	tmp = (tmp & DAC_DACCTRL_RUNSTDBY) >> DAC_DACCTRL_RUNSTDBY_Pos;
937 	return (bool)tmp;
938 }
939 
hri_dac_write_DACCTRL_RUNSTDBY_bit(const void * const hw,uint8_t index,bool value)940 static inline void hri_dac_write_DACCTRL_RUNSTDBY_bit(const void *const hw, uint8_t index, bool value)
941 {
942 	uint16_t tmp;
943 	DAC_CRITICAL_SECTION_ENTER();
944 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
945 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
946 	tmp &= ~DAC_DACCTRL_RUNSTDBY;
947 	tmp |= value << DAC_DACCTRL_RUNSTDBY_Pos;
948 	((Dac *)hw)->DACCTRL[index].reg = tmp;
949 	DAC_CRITICAL_SECTION_LEAVE();
950 }
951 
hri_dac_clear_DACCTRL_RUNSTDBY_bit(const void * const hw,uint8_t index)952 static inline void hri_dac_clear_DACCTRL_RUNSTDBY_bit(const void *const hw, uint8_t index)
953 {
954 	DAC_CRITICAL_SECTION_ENTER();
955 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
956 	((Dac *)hw)->DACCTRL[index].reg &= ~DAC_DACCTRL_RUNSTDBY;
957 	DAC_CRITICAL_SECTION_LEAVE();
958 }
959 
hri_dac_toggle_DACCTRL_RUNSTDBY_bit(const void * const hw,uint8_t index)960 static inline void hri_dac_toggle_DACCTRL_RUNSTDBY_bit(const void *const hw, uint8_t index)
961 {
962 	DAC_CRITICAL_SECTION_ENTER();
963 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
964 	((Dac *)hw)->DACCTRL[index].reg ^= DAC_DACCTRL_RUNSTDBY;
965 	DAC_CRITICAL_SECTION_LEAVE();
966 }
967 
hri_dac_set_DACCTRL_DITHER_bit(const void * const hw,uint8_t index)968 static inline void hri_dac_set_DACCTRL_DITHER_bit(const void *const hw, uint8_t index)
969 {
970 	DAC_CRITICAL_SECTION_ENTER();
971 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
972 	((Dac *)hw)->DACCTRL[index].reg |= DAC_DACCTRL_DITHER;
973 	DAC_CRITICAL_SECTION_LEAVE();
974 }
975 
hri_dac_get_DACCTRL_DITHER_bit(const void * const hw,uint8_t index)976 static inline bool hri_dac_get_DACCTRL_DITHER_bit(const void *const hw, uint8_t index)
977 {
978 	uint16_t tmp;
979 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
980 	tmp = (tmp & DAC_DACCTRL_DITHER) >> DAC_DACCTRL_DITHER_Pos;
981 	return (bool)tmp;
982 }
983 
hri_dac_write_DACCTRL_DITHER_bit(const void * const hw,uint8_t index,bool value)984 static inline void hri_dac_write_DACCTRL_DITHER_bit(const void *const hw, uint8_t index, bool value)
985 {
986 	uint16_t tmp;
987 	DAC_CRITICAL_SECTION_ENTER();
988 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
989 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
990 	tmp &= ~DAC_DACCTRL_DITHER;
991 	tmp |= value << DAC_DACCTRL_DITHER_Pos;
992 	((Dac *)hw)->DACCTRL[index].reg = tmp;
993 	DAC_CRITICAL_SECTION_LEAVE();
994 }
995 
hri_dac_clear_DACCTRL_DITHER_bit(const void * const hw,uint8_t index)996 static inline void hri_dac_clear_DACCTRL_DITHER_bit(const void *const hw, uint8_t index)
997 {
998 	DAC_CRITICAL_SECTION_ENTER();
999 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
1000 	((Dac *)hw)->DACCTRL[index].reg &= ~DAC_DACCTRL_DITHER;
1001 	DAC_CRITICAL_SECTION_LEAVE();
1002 }
1003 
hri_dac_toggle_DACCTRL_DITHER_bit(const void * const hw,uint8_t index)1004 static inline void hri_dac_toggle_DACCTRL_DITHER_bit(const void *const hw, uint8_t index)
1005 {
1006 	DAC_CRITICAL_SECTION_ENTER();
1007 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
1008 	((Dac *)hw)->DACCTRL[index].reg ^= DAC_DACCTRL_DITHER;
1009 	DAC_CRITICAL_SECTION_LEAVE();
1010 }
1011 
hri_dac_set_DACCTRL_CCTRL_bf(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1012 static inline void hri_dac_set_DACCTRL_CCTRL_bf(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t mask)
1013 {
1014 	DAC_CRITICAL_SECTION_ENTER();
1015 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
1016 	((Dac *)hw)->DACCTRL[index].reg |= DAC_DACCTRL_CCTRL(mask);
1017 	DAC_CRITICAL_SECTION_LEAVE();
1018 }
1019 
hri_dac_get_DACCTRL_CCTRL_bf(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1020 static inline hri_dac_dacctrl_reg_t hri_dac_get_DACCTRL_CCTRL_bf(const void *const hw, uint8_t index,
1021                                                                  hri_dac_dacctrl_reg_t mask)
1022 {
1023 	uint16_t tmp;
1024 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
1025 	tmp = (tmp & DAC_DACCTRL_CCTRL(mask)) >> DAC_DACCTRL_CCTRL_Pos;
1026 	return tmp;
1027 }
1028 
hri_dac_write_DACCTRL_CCTRL_bf(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t data)1029 static inline void hri_dac_write_DACCTRL_CCTRL_bf(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t data)
1030 {
1031 	uint16_t tmp;
1032 	DAC_CRITICAL_SECTION_ENTER();
1033 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
1034 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
1035 	tmp &= ~DAC_DACCTRL_CCTRL_Msk;
1036 	tmp |= DAC_DACCTRL_CCTRL(data);
1037 	((Dac *)hw)->DACCTRL[index].reg = tmp;
1038 	DAC_CRITICAL_SECTION_LEAVE();
1039 }
1040 
hri_dac_clear_DACCTRL_CCTRL_bf(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1041 static inline void hri_dac_clear_DACCTRL_CCTRL_bf(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t mask)
1042 {
1043 	DAC_CRITICAL_SECTION_ENTER();
1044 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
1045 	((Dac *)hw)->DACCTRL[index].reg &= ~DAC_DACCTRL_CCTRL(mask);
1046 	DAC_CRITICAL_SECTION_LEAVE();
1047 }
1048 
hri_dac_toggle_DACCTRL_CCTRL_bf(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1049 static inline void hri_dac_toggle_DACCTRL_CCTRL_bf(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t mask)
1050 {
1051 	DAC_CRITICAL_SECTION_ENTER();
1052 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
1053 	((Dac *)hw)->DACCTRL[index].reg ^= DAC_DACCTRL_CCTRL(mask);
1054 	DAC_CRITICAL_SECTION_LEAVE();
1055 }
1056 
hri_dac_read_DACCTRL_CCTRL_bf(const void * const hw,uint8_t index)1057 static inline hri_dac_dacctrl_reg_t hri_dac_read_DACCTRL_CCTRL_bf(const void *const hw, uint8_t index)
1058 {
1059 	uint16_t tmp;
1060 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
1061 	tmp = (tmp & DAC_DACCTRL_CCTRL_Msk) >> DAC_DACCTRL_CCTRL_Pos;
1062 	return tmp;
1063 }
1064 
hri_dac_set_DACCTRL_REFRESH_bf(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1065 static inline void hri_dac_set_DACCTRL_REFRESH_bf(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t mask)
1066 {
1067 	DAC_CRITICAL_SECTION_ENTER();
1068 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
1069 	((Dac *)hw)->DACCTRL[index].reg |= DAC_DACCTRL_REFRESH(mask);
1070 	DAC_CRITICAL_SECTION_LEAVE();
1071 }
1072 
hri_dac_get_DACCTRL_REFRESH_bf(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1073 static inline hri_dac_dacctrl_reg_t hri_dac_get_DACCTRL_REFRESH_bf(const void *const hw, uint8_t index,
1074                                                                    hri_dac_dacctrl_reg_t mask)
1075 {
1076 	uint16_t tmp;
1077 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
1078 	tmp = (tmp & DAC_DACCTRL_REFRESH(mask)) >> DAC_DACCTRL_REFRESH_Pos;
1079 	return tmp;
1080 }
1081 
hri_dac_write_DACCTRL_REFRESH_bf(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t data)1082 static inline void hri_dac_write_DACCTRL_REFRESH_bf(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t data)
1083 {
1084 	uint16_t tmp;
1085 	DAC_CRITICAL_SECTION_ENTER();
1086 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
1087 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
1088 	tmp &= ~DAC_DACCTRL_REFRESH_Msk;
1089 	tmp |= DAC_DACCTRL_REFRESH(data);
1090 	((Dac *)hw)->DACCTRL[index].reg = tmp;
1091 	DAC_CRITICAL_SECTION_LEAVE();
1092 }
1093 
hri_dac_clear_DACCTRL_REFRESH_bf(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1094 static inline void hri_dac_clear_DACCTRL_REFRESH_bf(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t mask)
1095 {
1096 	DAC_CRITICAL_SECTION_ENTER();
1097 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
1098 	((Dac *)hw)->DACCTRL[index].reg &= ~DAC_DACCTRL_REFRESH(mask);
1099 	DAC_CRITICAL_SECTION_LEAVE();
1100 }
1101 
hri_dac_toggle_DACCTRL_REFRESH_bf(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1102 static inline void hri_dac_toggle_DACCTRL_REFRESH_bf(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t mask)
1103 {
1104 	DAC_CRITICAL_SECTION_ENTER();
1105 	hri_dac_wait_for_sync(hw, DAC_SYNCBUSY_MASK);
1106 	((Dac *)hw)->DACCTRL[index].reg ^= DAC_DACCTRL_REFRESH(mask);
1107 	DAC_CRITICAL_SECTION_LEAVE();
1108 }
1109 
hri_dac_read_DACCTRL_REFRESH_bf(const void * const hw,uint8_t index)1110 static inline hri_dac_dacctrl_reg_t hri_dac_read_DACCTRL_REFRESH_bf(const void *const hw, uint8_t index)
1111 {
1112 	uint16_t tmp;
1113 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
1114 	tmp = (tmp & DAC_DACCTRL_REFRESH_Msk) >> DAC_DACCTRL_REFRESH_Pos;
1115 	return tmp;
1116 }
1117 
hri_dac_set_DACCTRL_reg(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1118 static inline void hri_dac_set_DACCTRL_reg(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t mask)
1119 {
1120 	DAC_CRITICAL_SECTION_ENTER();
1121 	((Dac *)hw)->DACCTRL[index].reg |= mask;
1122 	DAC_CRITICAL_SECTION_LEAVE();
1123 }
1124 
hri_dac_get_DACCTRL_reg(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1125 static inline hri_dac_dacctrl_reg_t hri_dac_get_DACCTRL_reg(const void *const hw, uint8_t index,
1126                                                             hri_dac_dacctrl_reg_t mask)
1127 {
1128 	uint16_t tmp;
1129 	tmp = ((Dac *)hw)->DACCTRL[index].reg;
1130 	tmp &= mask;
1131 	return tmp;
1132 }
1133 
hri_dac_write_DACCTRL_reg(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t data)1134 static inline void hri_dac_write_DACCTRL_reg(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t data)
1135 {
1136 	DAC_CRITICAL_SECTION_ENTER();
1137 	((Dac *)hw)->DACCTRL[index].reg = data;
1138 	DAC_CRITICAL_SECTION_LEAVE();
1139 }
1140 
hri_dac_clear_DACCTRL_reg(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1141 static inline void hri_dac_clear_DACCTRL_reg(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t mask)
1142 {
1143 	DAC_CRITICAL_SECTION_ENTER();
1144 	((Dac *)hw)->DACCTRL[index].reg &= ~mask;
1145 	DAC_CRITICAL_SECTION_LEAVE();
1146 }
1147 
hri_dac_toggle_DACCTRL_reg(const void * const hw,uint8_t index,hri_dac_dacctrl_reg_t mask)1148 static inline void hri_dac_toggle_DACCTRL_reg(const void *const hw, uint8_t index, hri_dac_dacctrl_reg_t mask)
1149 {
1150 	DAC_CRITICAL_SECTION_ENTER();
1151 	((Dac *)hw)->DACCTRL[index].reg ^= mask;
1152 	DAC_CRITICAL_SECTION_LEAVE();
1153 }
1154 
hri_dac_read_DACCTRL_reg(const void * const hw,uint8_t index)1155 static inline hri_dac_dacctrl_reg_t hri_dac_read_DACCTRL_reg(const void *const hw, uint8_t index)
1156 {
1157 	return ((Dac *)hw)->DACCTRL[index].reg;
1158 }
1159 
hri_dac_set_DBGCTRL_DBGRUN_bit(const void * const hw)1160 static inline void hri_dac_set_DBGCTRL_DBGRUN_bit(const void *const hw)
1161 {
1162 	DAC_CRITICAL_SECTION_ENTER();
1163 	((Dac *)hw)->DBGCTRL.reg |= DAC_DBGCTRL_DBGRUN;
1164 	DAC_CRITICAL_SECTION_LEAVE();
1165 }
1166 
hri_dac_get_DBGCTRL_DBGRUN_bit(const void * const hw)1167 static inline bool hri_dac_get_DBGCTRL_DBGRUN_bit(const void *const hw)
1168 {
1169 	uint8_t tmp;
1170 	tmp = ((Dac *)hw)->DBGCTRL.reg;
1171 	tmp = (tmp & DAC_DBGCTRL_DBGRUN) >> DAC_DBGCTRL_DBGRUN_Pos;
1172 	return (bool)tmp;
1173 }
1174 
hri_dac_write_DBGCTRL_DBGRUN_bit(const void * const hw,bool value)1175 static inline void hri_dac_write_DBGCTRL_DBGRUN_bit(const void *const hw, bool value)
1176 {
1177 	uint8_t tmp;
1178 	DAC_CRITICAL_SECTION_ENTER();
1179 	tmp = ((Dac *)hw)->DBGCTRL.reg;
1180 	tmp &= ~DAC_DBGCTRL_DBGRUN;
1181 	tmp |= value << DAC_DBGCTRL_DBGRUN_Pos;
1182 	((Dac *)hw)->DBGCTRL.reg = tmp;
1183 	DAC_CRITICAL_SECTION_LEAVE();
1184 }
1185 
hri_dac_clear_DBGCTRL_DBGRUN_bit(const void * const hw)1186 static inline void hri_dac_clear_DBGCTRL_DBGRUN_bit(const void *const hw)
1187 {
1188 	DAC_CRITICAL_SECTION_ENTER();
1189 	((Dac *)hw)->DBGCTRL.reg &= ~DAC_DBGCTRL_DBGRUN;
1190 	DAC_CRITICAL_SECTION_LEAVE();
1191 }
1192 
hri_dac_toggle_DBGCTRL_DBGRUN_bit(const void * const hw)1193 static inline void hri_dac_toggle_DBGCTRL_DBGRUN_bit(const void *const hw)
1194 {
1195 	DAC_CRITICAL_SECTION_ENTER();
1196 	((Dac *)hw)->DBGCTRL.reg ^= DAC_DBGCTRL_DBGRUN;
1197 	DAC_CRITICAL_SECTION_LEAVE();
1198 }
1199 
hri_dac_set_DBGCTRL_reg(const void * const hw,hri_dac_dbgctrl_reg_t mask)1200 static inline void hri_dac_set_DBGCTRL_reg(const void *const hw, hri_dac_dbgctrl_reg_t mask)
1201 {
1202 	DAC_CRITICAL_SECTION_ENTER();
1203 	((Dac *)hw)->DBGCTRL.reg |= mask;
1204 	DAC_CRITICAL_SECTION_LEAVE();
1205 }
1206 
hri_dac_get_DBGCTRL_reg(const void * const hw,hri_dac_dbgctrl_reg_t mask)1207 static inline hri_dac_dbgctrl_reg_t hri_dac_get_DBGCTRL_reg(const void *const hw, hri_dac_dbgctrl_reg_t mask)
1208 {
1209 	uint8_t tmp;
1210 	tmp = ((Dac *)hw)->DBGCTRL.reg;
1211 	tmp &= mask;
1212 	return tmp;
1213 }
1214 
hri_dac_write_DBGCTRL_reg(const void * const hw,hri_dac_dbgctrl_reg_t data)1215 static inline void hri_dac_write_DBGCTRL_reg(const void *const hw, hri_dac_dbgctrl_reg_t data)
1216 {
1217 	DAC_CRITICAL_SECTION_ENTER();
1218 	((Dac *)hw)->DBGCTRL.reg = data;
1219 	DAC_CRITICAL_SECTION_LEAVE();
1220 }
1221 
hri_dac_clear_DBGCTRL_reg(const void * const hw,hri_dac_dbgctrl_reg_t mask)1222 static inline void hri_dac_clear_DBGCTRL_reg(const void *const hw, hri_dac_dbgctrl_reg_t mask)
1223 {
1224 	DAC_CRITICAL_SECTION_ENTER();
1225 	((Dac *)hw)->DBGCTRL.reg &= ~mask;
1226 	DAC_CRITICAL_SECTION_LEAVE();
1227 }
1228 
hri_dac_toggle_DBGCTRL_reg(const void * const hw,hri_dac_dbgctrl_reg_t mask)1229 static inline void hri_dac_toggle_DBGCTRL_reg(const void *const hw, hri_dac_dbgctrl_reg_t mask)
1230 {
1231 	DAC_CRITICAL_SECTION_ENTER();
1232 	((Dac *)hw)->DBGCTRL.reg ^= mask;
1233 	DAC_CRITICAL_SECTION_LEAVE();
1234 }
1235 
hri_dac_read_DBGCTRL_reg(const void * const hw)1236 static inline hri_dac_dbgctrl_reg_t hri_dac_read_DBGCTRL_reg(const void *const hw)
1237 {
1238 	return ((Dac *)hw)->DBGCTRL.reg;
1239 }
1240 
hri_dac_get_STATUS_READY0_bit(const void * const hw)1241 static inline bool hri_dac_get_STATUS_READY0_bit(const void *const hw)
1242 {
1243 	return (((Dac *)hw)->STATUS.reg & DAC_STATUS_READY0) >> DAC_STATUS_READY0_Pos;
1244 }
1245 
hri_dac_get_STATUS_READY1_bit(const void * const hw)1246 static inline bool hri_dac_get_STATUS_READY1_bit(const void *const hw)
1247 {
1248 	return (((Dac *)hw)->STATUS.reg & DAC_STATUS_READY1) >> DAC_STATUS_READY1_Pos;
1249 }
1250 
hri_dac_get_STATUS_EOC0_bit(const void * const hw)1251 static inline bool hri_dac_get_STATUS_EOC0_bit(const void *const hw)
1252 {
1253 	return (((Dac *)hw)->STATUS.reg & DAC_STATUS_EOC0) >> DAC_STATUS_EOC0_Pos;
1254 }
1255 
hri_dac_get_STATUS_EOC1_bit(const void * const hw)1256 static inline bool hri_dac_get_STATUS_EOC1_bit(const void *const hw)
1257 {
1258 	return (((Dac *)hw)->STATUS.reg & DAC_STATUS_EOC1) >> DAC_STATUS_EOC1_Pos;
1259 }
1260 
hri_dac_get_STATUS_reg(const void * const hw,hri_dac_status_reg_t mask)1261 static inline hri_dac_status_reg_t hri_dac_get_STATUS_reg(const void *const hw, hri_dac_status_reg_t mask)
1262 {
1263 	uint8_t tmp;
1264 	tmp = ((Dac *)hw)->STATUS.reg;
1265 	tmp &= mask;
1266 	return tmp;
1267 }
1268 
hri_dac_read_STATUS_reg(const void * const hw)1269 static inline hri_dac_status_reg_t hri_dac_read_STATUS_reg(const void *const hw)
1270 {
1271 	return ((Dac *)hw)->STATUS.reg;
1272 }
1273 
hri_dac_get_SYNCBUSY_SWRST_bit(const void * const hw)1274 static inline bool hri_dac_get_SYNCBUSY_SWRST_bit(const void *const hw)
1275 {
1276 	return (((Dac *)hw)->SYNCBUSY.reg & DAC_SYNCBUSY_SWRST) >> DAC_SYNCBUSY_SWRST_Pos;
1277 }
1278 
hri_dac_get_SYNCBUSY_ENABLE_bit(const void * const hw)1279 static inline bool hri_dac_get_SYNCBUSY_ENABLE_bit(const void *const hw)
1280 {
1281 	return (((Dac *)hw)->SYNCBUSY.reg & DAC_SYNCBUSY_ENABLE) >> DAC_SYNCBUSY_ENABLE_Pos;
1282 }
1283 
hri_dac_get_SYNCBUSY_DATA0_bit(const void * const hw)1284 static inline bool hri_dac_get_SYNCBUSY_DATA0_bit(const void *const hw)
1285 {
1286 	return (((Dac *)hw)->SYNCBUSY.reg & DAC_SYNCBUSY_DATA0) >> DAC_SYNCBUSY_DATA0_Pos;
1287 }
1288 
hri_dac_get_SYNCBUSY_DATA1_bit(const void * const hw)1289 static inline bool hri_dac_get_SYNCBUSY_DATA1_bit(const void *const hw)
1290 {
1291 	return (((Dac *)hw)->SYNCBUSY.reg & DAC_SYNCBUSY_DATA1) >> DAC_SYNCBUSY_DATA1_Pos;
1292 }
1293 
hri_dac_get_SYNCBUSY_DATABUF0_bit(const void * const hw)1294 static inline bool hri_dac_get_SYNCBUSY_DATABUF0_bit(const void *const hw)
1295 {
1296 	return (((Dac *)hw)->SYNCBUSY.reg & DAC_SYNCBUSY_DATABUF0) >> DAC_SYNCBUSY_DATABUF0_Pos;
1297 }
1298 
hri_dac_get_SYNCBUSY_DATABUF1_bit(const void * const hw)1299 static inline bool hri_dac_get_SYNCBUSY_DATABUF1_bit(const void *const hw)
1300 {
1301 	return (((Dac *)hw)->SYNCBUSY.reg & DAC_SYNCBUSY_DATABUF1) >> DAC_SYNCBUSY_DATABUF1_Pos;
1302 }
1303 
hri_dac_get_SYNCBUSY_reg(const void * const hw,hri_dac_syncbusy_reg_t mask)1304 static inline hri_dac_syncbusy_reg_t hri_dac_get_SYNCBUSY_reg(const void *const hw, hri_dac_syncbusy_reg_t mask)
1305 {
1306 	uint32_t tmp;
1307 	tmp = ((Dac *)hw)->SYNCBUSY.reg;
1308 	tmp &= mask;
1309 	return tmp;
1310 }
1311 
hri_dac_read_SYNCBUSY_reg(const void * const hw)1312 static inline hri_dac_syncbusy_reg_t hri_dac_read_SYNCBUSY_reg(const void *const hw)
1313 {
1314 	return ((Dac *)hw)->SYNCBUSY.reg;
1315 }
1316 
1317 #ifdef __cplusplus
1318 }
1319 #endif
1320 
1321 #endif /* _HRI_DAC_L21_H_INCLUDED */
1322 #endif /* _SAML21_DAC_COMPONENT_ */
1323