1 /**
2 * \file
3 *
4 * \brief SAM OPAMP
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_OPAMP_COMPONENT_
44 #ifndef _HRI_OPAMP_L21_H_INCLUDED_
45 #define _HRI_OPAMP_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_OPAMP_CRITICAL_SECTIONS)
55 #define OPAMP_CRITICAL_SECTION_ENTER() CRITICAL_SECTION_ENTER()
56 #define OPAMP_CRITICAL_SECTION_LEAVE() CRITICAL_SECTION_LEAVE()
57 #else
58 #define OPAMP_CRITICAL_SECTION_ENTER()
59 #define OPAMP_CRITICAL_SECTION_LEAVE()
60 #endif
61
62 typedef uint32_t hri_opamp_opampctrl_reg_t;
63 typedef uint8_t hri_opamp_ctrla_reg_t;
64 typedef uint8_t hri_opamp_status_reg_t;
65
hri_opamp_set_CTRLA_SWRST_bit(const void * const hw)66 static inline void hri_opamp_set_CTRLA_SWRST_bit(const void *const hw)
67 {
68 OPAMP_CRITICAL_SECTION_ENTER();
69 ((Opamp *)hw)->CTRLA.reg |= OPAMP_CTRLA_SWRST;
70 OPAMP_CRITICAL_SECTION_LEAVE();
71 }
72
hri_opamp_get_CTRLA_SWRST_bit(const void * const hw)73 static inline bool hri_opamp_get_CTRLA_SWRST_bit(const void *const hw)
74 {
75 uint8_t tmp;
76 tmp = ((Opamp *)hw)->CTRLA.reg;
77 tmp = (tmp & OPAMP_CTRLA_SWRST) >> OPAMP_CTRLA_SWRST_Pos;
78 return (bool)tmp;
79 }
80
hri_opamp_set_CTRLA_ENABLE_bit(const void * const hw)81 static inline void hri_opamp_set_CTRLA_ENABLE_bit(const void *const hw)
82 {
83 OPAMP_CRITICAL_SECTION_ENTER();
84 ((Opamp *)hw)->CTRLA.reg |= OPAMP_CTRLA_ENABLE;
85 OPAMP_CRITICAL_SECTION_LEAVE();
86 }
87
hri_opamp_get_CTRLA_ENABLE_bit(const void * const hw)88 static inline bool hri_opamp_get_CTRLA_ENABLE_bit(const void *const hw)
89 {
90 uint8_t tmp;
91 tmp = ((Opamp *)hw)->CTRLA.reg;
92 tmp = (tmp & OPAMP_CTRLA_ENABLE) >> OPAMP_CTRLA_ENABLE_Pos;
93 return (bool)tmp;
94 }
95
hri_opamp_write_CTRLA_ENABLE_bit(const void * const hw,bool value)96 static inline void hri_opamp_write_CTRLA_ENABLE_bit(const void *const hw, bool value)
97 {
98 uint8_t tmp;
99 OPAMP_CRITICAL_SECTION_ENTER();
100 tmp = ((Opamp *)hw)->CTRLA.reg;
101 tmp &= ~OPAMP_CTRLA_ENABLE;
102 tmp |= value << OPAMP_CTRLA_ENABLE_Pos;
103 ((Opamp *)hw)->CTRLA.reg = tmp;
104 OPAMP_CRITICAL_SECTION_LEAVE();
105 }
106
hri_opamp_clear_CTRLA_ENABLE_bit(const void * const hw)107 static inline void hri_opamp_clear_CTRLA_ENABLE_bit(const void *const hw)
108 {
109 OPAMP_CRITICAL_SECTION_ENTER();
110 ((Opamp *)hw)->CTRLA.reg &= ~OPAMP_CTRLA_ENABLE;
111 OPAMP_CRITICAL_SECTION_LEAVE();
112 }
113
hri_opamp_toggle_CTRLA_ENABLE_bit(const void * const hw)114 static inline void hri_opamp_toggle_CTRLA_ENABLE_bit(const void *const hw)
115 {
116 OPAMP_CRITICAL_SECTION_ENTER();
117 ((Opamp *)hw)->CTRLA.reg ^= OPAMP_CTRLA_ENABLE;
118 OPAMP_CRITICAL_SECTION_LEAVE();
119 }
120
hri_opamp_set_CTRLA_LPMUX_bit(const void * const hw)121 static inline void hri_opamp_set_CTRLA_LPMUX_bit(const void *const hw)
122 {
123 OPAMP_CRITICAL_SECTION_ENTER();
124 ((Opamp *)hw)->CTRLA.reg |= OPAMP_CTRLA_LPMUX;
125 OPAMP_CRITICAL_SECTION_LEAVE();
126 }
127
hri_opamp_get_CTRLA_LPMUX_bit(const void * const hw)128 static inline bool hri_opamp_get_CTRLA_LPMUX_bit(const void *const hw)
129 {
130 uint8_t tmp;
131 tmp = ((Opamp *)hw)->CTRLA.reg;
132 tmp = (tmp & OPAMP_CTRLA_LPMUX) >> OPAMP_CTRLA_LPMUX_Pos;
133 return (bool)tmp;
134 }
135
hri_opamp_write_CTRLA_LPMUX_bit(const void * const hw,bool value)136 static inline void hri_opamp_write_CTRLA_LPMUX_bit(const void *const hw, bool value)
137 {
138 uint8_t tmp;
139 OPAMP_CRITICAL_SECTION_ENTER();
140 tmp = ((Opamp *)hw)->CTRLA.reg;
141 tmp &= ~OPAMP_CTRLA_LPMUX;
142 tmp |= value << OPAMP_CTRLA_LPMUX_Pos;
143 ((Opamp *)hw)->CTRLA.reg = tmp;
144 OPAMP_CRITICAL_SECTION_LEAVE();
145 }
146
hri_opamp_clear_CTRLA_LPMUX_bit(const void * const hw)147 static inline void hri_opamp_clear_CTRLA_LPMUX_bit(const void *const hw)
148 {
149 OPAMP_CRITICAL_SECTION_ENTER();
150 ((Opamp *)hw)->CTRLA.reg &= ~OPAMP_CTRLA_LPMUX;
151 OPAMP_CRITICAL_SECTION_LEAVE();
152 }
153
hri_opamp_toggle_CTRLA_LPMUX_bit(const void * const hw)154 static inline void hri_opamp_toggle_CTRLA_LPMUX_bit(const void *const hw)
155 {
156 OPAMP_CRITICAL_SECTION_ENTER();
157 ((Opamp *)hw)->CTRLA.reg ^= OPAMP_CTRLA_LPMUX;
158 OPAMP_CRITICAL_SECTION_LEAVE();
159 }
160
hri_opamp_set_CTRLA_reg(const void * const hw,hri_opamp_ctrla_reg_t mask)161 static inline void hri_opamp_set_CTRLA_reg(const void *const hw, hri_opamp_ctrla_reg_t mask)
162 {
163 OPAMP_CRITICAL_SECTION_ENTER();
164 ((Opamp *)hw)->CTRLA.reg |= mask;
165 OPAMP_CRITICAL_SECTION_LEAVE();
166 }
167
hri_opamp_get_CTRLA_reg(const void * const hw,hri_opamp_ctrla_reg_t mask)168 static inline hri_opamp_ctrla_reg_t hri_opamp_get_CTRLA_reg(const void *const hw, hri_opamp_ctrla_reg_t mask)
169 {
170 uint8_t tmp;
171 tmp = ((Opamp *)hw)->CTRLA.reg;
172 tmp &= mask;
173 return tmp;
174 }
175
hri_opamp_write_CTRLA_reg(const void * const hw,hri_opamp_ctrla_reg_t data)176 static inline void hri_opamp_write_CTRLA_reg(const void *const hw, hri_opamp_ctrla_reg_t data)
177 {
178 OPAMP_CRITICAL_SECTION_ENTER();
179 ((Opamp *)hw)->CTRLA.reg = data;
180 OPAMP_CRITICAL_SECTION_LEAVE();
181 }
182
hri_opamp_clear_CTRLA_reg(const void * const hw,hri_opamp_ctrla_reg_t mask)183 static inline void hri_opamp_clear_CTRLA_reg(const void *const hw, hri_opamp_ctrla_reg_t mask)
184 {
185 OPAMP_CRITICAL_SECTION_ENTER();
186 ((Opamp *)hw)->CTRLA.reg &= ~mask;
187 OPAMP_CRITICAL_SECTION_LEAVE();
188 }
189
hri_opamp_toggle_CTRLA_reg(const void * const hw,hri_opamp_ctrla_reg_t mask)190 static inline void hri_opamp_toggle_CTRLA_reg(const void *const hw, hri_opamp_ctrla_reg_t mask)
191 {
192 OPAMP_CRITICAL_SECTION_ENTER();
193 ((Opamp *)hw)->CTRLA.reg ^= mask;
194 OPAMP_CRITICAL_SECTION_LEAVE();
195 }
196
hri_opamp_read_CTRLA_reg(const void * const hw)197 static inline hri_opamp_ctrla_reg_t hri_opamp_read_CTRLA_reg(const void *const hw)
198 {
199 return ((Opamp *)hw)->CTRLA.reg;
200 }
201
hri_opamp_set_OPAMPCTRL_ENABLE_bit(const void * const hw,uint8_t index)202 static inline void hri_opamp_set_OPAMPCTRL_ENABLE_bit(const void *const hw, uint8_t index)
203 {
204 OPAMP_CRITICAL_SECTION_ENTER();
205 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_ENABLE;
206 OPAMP_CRITICAL_SECTION_LEAVE();
207 }
208
hri_opamp_get_OPAMPCTRL_ENABLE_bit(const void * const hw,uint8_t index)209 static inline bool hri_opamp_get_OPAMPCTRL_ENABLE_bit(const void *const hw, uint8_t index)
210 {
211 uint32_t tmp;
212 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
213 tmp = (tmp & OPAMP_OPAMPCTRL_ENABLE) >> OPAMP_OPAMPCTRL_ENABLE_Pos;
214 return (bool)tmp;
215 }
216
hri_opamp_write_OPAMPCTRL_ENABLE_bit(const void * const hw,uint8_t index,bool value)217 static inline void hri_opamp_write_OPAMPCTRL_ENABLE_bit(const void *const hw, uint8_t index, bool value)
218 {
219 uint32_t tmp;
220 OPAMP_CRITICAL_SECTION_ENTER();
221 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
222 tmp &= ~OPAMP_OPAMPCTRL_ENABLE;
223 tmp |= value << OPAMP_OPAMPCTRL_ENABLE_Pos;
224 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
225 OPAMP_CRITICAL_SECTION_LEAVE();
226 }
227
hri_opamp_clear_OPAMPCTRL_ENABLE_bit(const void * const hw,uint8_t index)228 static inline void hri_opamp_clear_OPAMPCTRL_ENABLE_bit(const void *const hw, uint8_t index)
229 {
230 OPAMP_CRITICAL_SECTION_ENTER();
231 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_ENABLE;
232 OPAMP_CRITICAL_SECTION_LEAVE();
233 }
234
hri_opamp_toggle_OPAMPCTRL_ENABLE_bit(const void * const hw,uint8_t index)235 static inline void hri_opamp_toggle_OPAMPCTRL_ENABLE_bit(const void *const hw, uint8_t index)
236 {
237 OPAMP_CRITICAL_SECTION_ENTER();
238 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_ENABLE;
239 OPAMP_CRITICAL_SECTION_LEAVE();
240 }
241
hri_opamp_set_OPAMPCTRL_ANAOUT_bit(const void * const hw,uint8_t index)242 static inline void hri_opamp_set_OPAMPCTRL_ANAOUT_bit(const void *const hw, uint8_t index)
243 {
244 OPAMP_CRITICAL_SECTION_ENTER();
245 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_ANAOUT;
246 OPAMP_CRITICAL_SECTION_LEAVE();
247 }
248
hri_opamp_get_OPAMPCTRL_ANAOUT_bit(const void * const hw,uint8_t index)249 static inline bool hri_opamp_get_OPAMPCTRL_ANAOUT_bit(const void *const hw, uint8_t index)
250 {
251 uint32_t tmp;
252 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
253 tmp = (tmp & OPAMP_OPAMPCTRL_ANAOUT) >> OPAMP_OPAMPCTRL_ANAOUT_Pos;
254 return (bool)tmp;
255 }
256
hri_opamp_write_OPAMPCTRL_ANAOUT_bit(const void * const hw,uint8_t index,bool value)257 static inline void hri_opamp_write_OPAMPCTRL_ANAOUT_bit(const void *const hw, uint8_t index, bool value)
258 {
259 uint32_t tmp;
260 OPAMP_CRITICAL_SECTION_ENTER();
261 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
262 tmp &= ~OPAMP_OPAMPCTRL_ANAOUT;
263 tmp |= value << OPAMP_OPAMPCTRL_ANAOUT_Pos;
264 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
265 OPAMP_CRITICAL_SECTION_LEAVE();
266 }
267
hri_opamp_clear_OPAMPCTRL_ANAOUT_bit(const void * const hw,uint8_t index)268 static inline void hri_opamp_clear_OPAMPCTRL_ANAOUT_bit(const void *const hw, uint8_t index)
269 {
270 OPAMP_CRITICAL_SECTION_ENTER();
271 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_ANAOUT;
272 OPAMP_CRITICAL_SECTION_LEAVE();
273 }
274
hri_opamp_toggle_OPAMPCTRL_ANAOUT_bit(const void * const hw,uint8_t index)275 static inline void hri_opamp_toggle_OPAMPCTRL_ANAOUT_bit(const void *const hw, uint8_t index)
276 {
277 OPAMP_CRITICAL_SECTION_ENTER();
278 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_ANAOUT;
279 OPAMP_CRITICAL_SECTION_LEAVE();
280 }
281
hri_opamp_set_OPAMPCTRL_RUNSTDBY_bit(const void * const hw,uint8_t index)282 static inline void hri_opamp_set_OPAMPCTRL_RUNSTDBY_bit(const void *const hw, uint8_t index)
283 {
284 OPAMP_CRITICAL_SECTION_ENTER();
285 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_RUNSTDBY;
286 OPAMP_CRITICAL_SECTION_LEAVE();
287 }
288
hri_opamp_get_OPAMPCTRL_RUNSTDBY_bit(const void * const hw,uint8_t index)289 static inline bool hri_opamp_get_OPAMPCTRL_RUNSTDBY_bit(const void *const hw, uint8_t index)
290 {
291 uint32_t tmp;
292 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
293 tmp = (tmp & OPAMP_OPAMPCTRL_RUNSTDBY) >> OPAMP_OPAMPCTRL_RUNSTDBY_Pos;
294 return (bool)tmp;
295 }
296
hri_opamp_write_OPAMPCTRL_RUNSTDBY_bit(const void * const hw,uint8_t index,bool value)297 static inline void hri_opamp_write_OPAMPCTRL_RUNSTDBY_bit(const void *const hw, uint8_t index, bool value)
298 {
299 uint32_t tmp;
300 OPAMP_CRITICAL_SECTION_ENTER();
301 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
302 tmp &= ~OPAMP_OPAMPCTRL_RUNSTDBY;
303 tmp |= value << OPAMP_OPAMPCTRL_RUNSTDBY_Pos;
304 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
305 OPAMP_CRITICAL_SECTION_LEAVE();
306 }
307
hri_opamp_clear_OPAMPCTRL_RUNSTDBY_bit(const void * const hw,uint8_t index)308 static inline void hri_opamp_clear_OPAMPCTRL_RUNSTDBY_bit(const void *const hw, uint8_t index)
309 {
310 OPAMP_CRITICAL_SECTION_ENTER();
311 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_RUNSTDBY;
312 OPAMP_CRITICAL_SECTION_LEAVE();
313 }
314
hri_opamp_toggle_OPAMPCTRL_RUNSTDBY_bit(const void * const hw,uint8_t index)315 static inline void hri_opamp_toggle_OPAMPCTRL_RUNSTDBY_bit(const void *const hw, uint8_t index)
316 {
317 OPAMP_CRITICAL_SECTION_ENTER();
318 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_RUNSTDBY;
319 OPAMP_CRITICAL_SECTION_LEAVE();
320 }
321
hri_opamp_set_OPAMPCTRL_ONDEMAND_bit(const void * const hw,uint8_t index)322 static inline void hri_opamp_set_OPAMPCTRL_ONDEMAND_bit(const void *const hw, uint8_t index)
323 {
324 OPAMP_CRITICAL_SECTION_ENTER();
325 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_ONDEMAND;
326 OPAMP_CRITICAL_SECTION_LEAVE();
327 }
328
hri_opamp_get_OPAMPCTRL_ONDEMAND_bit(const void * const hw,uint8_t index)329 static inline bool hri_opamp_get_OPAMPCTRL_ONDEMAND_bit(const void *const hw, uint8_t index)
330 {
331 uint32_t tmp;
332 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
333 tmp = (tmp & OPAMP_OPAMPCTRL_ONDEMAND) >> OPAMP_OPAMPCTRL_ONDEMAND_Pos;
334 return (bool)tmp;
335 }
336
hri_opamp_write_OPAMPCTRL_ONDEMAND_bit(const void * const hw,uint8_t index,bool value)337 static inline void hri_opamp_write_OPAMPCTRL_ONDEMAND_bit(const void *const hw, uint8_t index, bool value)
338 {
339 uint32_t tmp;
340 OPAMP_CRITICAL_SECTION_ENTER();
341 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
342 tmp &= ~OPAMP_OPAMPCTRL_ONDEMAND;
343 tmp |= value << OPAMP_OPAMPCTRL_ONDEMAND_Pos;
344 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
345 OPAMP_CRITICAL_SECTION_LEAVE();
346 }
347
hri_opamp_clear_OPAMPCTRL_ONDEMAND_bit(const void * const hw,uint8_t index)348 static inline void hri_opamp_clear_OPAMPCTRL_ONDEMAND_bit(const void *const hw, uint8_t index)
349 {
350 OPAMP_CRITICAL_SECTION_ENTER();
351 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_ONDEMAND;
352 OPAMP_CRITICAL_SECTION_LEAVE();
353 }
354
hri_opamp_toggle_OPAMPCTRL_ONDEMAND_bit(const void * const hw,uint8_t index)355 static inline void hri_opamp_toggle_OPAMPCTRL_ONDEMAND_bit(const void *const hw, uint8_t index)
356 {
357 OPAMP_CRITICAL_SECTION_ENTER();
358 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_ONDEMAND;
359 OPAMP_CRITICAL_SECTION_LEAVE();
360 }
361
hri_opamp_set_OPAMPCTRL_RES2OUT_bit(const void * const hw,uint8_t index)362 static inline void hri_opamp_set_OPAMPCTRL_RES2OUT_bit(const void *const hw, uint8_t index)
363 {
364 OPAMP_CRITICAL_SECTION_ENTER();
365 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_RES2OUT;
366 OPAMP_CRITICAL_SECTION_LEAVE();
367 }
368
hri_opamp_get_OPAMPCTRL_RES2OUT_bit(const void * const hw,uint8_t index)369 static inline bool hri_opamp_get_OPAMPCTRL_RES2OUT_bit(const void *const hw, uint8_t index)
370 {
371 uint32_t tmp;
372 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
373 tmp = (tmp & OPAMP_OPAMPCTRL_RES2OUT) >> OPAMP_OPAMPCTRL_RES2OUT_Pos;
374 return (bool)tmp;
375 }
376
hri_opamp_write_OPAMPCTRL_RES2OUT_bit(const void * const hw,uint8_t index,bool value)377 static inline void hri_opamp_write_OPAMPCTRL_RES2OUT_bit(const void *const hw, uint8_t index, bool value)
378 {
379 uint32_t tmp;
380 OPAMP_CRITICAL_SECTION_ENTER();
381 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
382 tmp &= ~OPAMP_OPAMPCTRL_RES2OUT;
383 tmp |= value << OPAMP_OPAMPCTRL_RES2OUT_Pos;
384 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
385 OPAMP_CRITICAL_SECTION_LEAVE();
386 }
387
hri_opamp_clear_OPAMPCTRL_RES2OUT_bit(const void * const hw,uint8_t index)388 static inline void hri_opamp_clear_OPAMPCTRL_RES2OUT_bit(const void *const hw, uint8_t index)
389 {
390 OPAMP_CRITICAL_SECTION_ENTER();
391 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_RES2OUT;
392 OPAMP_CRITICAL_SECTION_LEAVE();
393 }
394
hri_opamp_toggle_OPAMPCTRL_RES2OUT_bit(const void * const hw,uint8_t index)395 static inline void hri_opamp_toggle_OPAMPCTRL_RES2OUT_bit(const void *const hw, uint8_t index)
396 {
397 OPAMP_CRITICAL_SECTION_ENTER();
398 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_RES2OUT;
399 OPAMP_CRITICAL_SECTION_LEAVE();
400 }
401
hri_opamp_set_OPAMPCTRL_RES2VCC_bit(const void * const hw,uint8_t index)402 static inline void hri_opamp_set_OPAMPCTRL_RES2VCC_bit(const void *const hw, uint8_t index)
403 {
404 OPAMP_CRITICAL_SECTION_ENTER();
405 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_RES2VCC;
406 OPAMP_CRITICAL_SECTION_LEAVE();
407 }
408
hri_opamp_get_OPAMPCTRL_RES2VCC_bit(const void * const hw,uint8_t index)409 static inline bool hri_opamp_get_OPAMPCTRL_RES2VCC_bit(const void *const hw, uint8_t index)
410 {
411 uint32_t tmp;
412 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
413 tmp = (tmp & OPAMP_OPAMPCTRL_RES2VCC) >> OPAMP_OPAMPCTRL_RES2VCC_Pos;
414 return (bool)tmp;
415 }
416
hri_opamp_write_OPAMPCTRL_RES2VCC_bit(const void * const hw,uint8_t index,bool value)417 static inline void hri_opamp_write_OPAMPCTRL_RES2VCC_bit(const void *const hw, uint8_t index, bool value)
418 {
419 uint32_t tmp;
420 OPAMP_CRITICAL_SECTION_ENTER();
421 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
422 tmp &= ~OPAMP_OPAMPCTRL_RES2VCC;
423 tmp |= value << OPAMP_OPAMPCTRL_RES2VCC_Pos;
424 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
425 OPAMP_CRITICAL_SECTION_LEAVE();
426 }
427
hri_opamp_clear_OPAMPCTRL_RES2VCC_bit(const void * const hw,uint8_t index)428 static inline void hri_opamp_clear_OPAMPCTRL_RES2VCC_bit(const void *const hw, uint8_t index)
429 {
430 OPAMP_CRITICAL_SECTION_ENTER();
431 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_RES2VCC;
432 OPAMP_CRITICAL_SECTION_LEAVE();
433 }
434
hri_opamp_toggle_OPAMPCTRL_RES2VCC_bit(const void * const hw,uint8_t index)435 static inline void hri_opamp_toggle_OPAMPCTRL_RES2VCC_bit(const void *const hw, uint8_t index)
436 {
437 OPAMP_CRITICAL_SECTION_ENTER();
438 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_RES2VCC;
439 OPAMP_CRITICAL_SECTION_LEAVE();
440 }
441
hri_opamp_set_OPAMPCTRL_RES1EN_bit(const void * const hw,uint8_t index)442 static inline void hri_opamp_set_OPAMPCTRL_RES1EN_bit(const void *const hw, uint8_t index)
443 {
444 OPAMP_CRITICAL_SECTION_ENTER();
445 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_RES1EN;
446 OPAMP_CRITICAL_SECTION_LEAVE();
447 }
448
hri_opamp_get_OPAMPCTRL_RES1EN_bit(const void * const hw,uint8_t index)449 static inline bool hri_opamp_get_OPAMPCTRL_RES1EN_bit(const void *const hw, uint8_t index)
450 {
451 uint32_t tmp;
452 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
453 tmp = (tmp & OPAMP_OPAMPCTRL_RES1EN) >> OPAMP_OPAMPCTRL_RES1EN_Pos;
454 return (bool)tmp;
455 }
456
hri_opamp_write_OPAMPCTRL_RES1EN_bit(const void * const hw,uint8_t index,bool value)457 static inline void hri_opamp_write_OPAMPCTRL_RES1EN_bit(const void *const hw, uint8_t index, bool value)
458 {
459 uint32_t tmp;
460 OPAMP_CRITICAL_SECTION_ENTER();
461 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
462 tmp &= ~OPAMP_OPAMPCTRL_RES1EN;
463 tmp |= value << OPAMP_OPAMPCTRL_RES1EN_Pos;
464 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
465 OPAMP_CRITICAL_SECTION_LEAVE();
466 }
467
hri_opamp_clear_OPAMPCTRL_RES1EN_bit(const void * const hw,uint8_t index)468 static inline void hri_opamp_clear_OPAMPCTRL_RES1EN_bit(const void *const hw, uint8_t index)
469 {
470 OPAMP_CRITICAL_SECTION_ENTER();
471 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_RES1EN;
472 OPAMP_CRITICAL_SECTION_LEAVE();
473 }
474
hri_opamp_toggle_OPAMPCTRL_RES1EN_bit(const void * const hw,uint8_t index)475 static inline void hri_opamp_toggle_OPAMPCTRL_RES1EN_bit(const void *const hw, uint8_t index)
476 {
477 OPAMP_CRITICAL_SECTION_ENTER();
478 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_RES1EN;
479 OPAMP_CRITICAL_SECTION_LEAVE();
480 }
481
hri_opamp_set_OPAMPCTRL_BIAS_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)482 static inline void hri_opamp_set_OPAMPCTRL_BIAS_bf(const void *const hw, uint8_t index, hri_opamp_opampctrl_reg_t mask)
483 {
484 OPAMP_CRITICAL_SECTION_ENTER();
485 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_BIAS(mask);
486 OPAMP_CRITICAL_SECTION_LEAVE();
487 }
488
hri_opamp_get_OPAMPCTRL_BIAS_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)489 static inline hri_opamp_opampctrl_reg_t hri_opamp_get_OPAMPCTRL_BIAS_bf(const void *const hw, uint8_t index,
490 hri_opamp_opampctrl_reg_t mask)
491 {
492 uint32_t tmp;
493 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
494 tmp = (tmp & OPAMP_OPAMPCTRL_BIAS(mask)) >> OPAMP_OPAMPCTRL_BIAS_Pos;
495 return tmp;
496 }
497
hri_opamp_write_OPAMPCTRL_BIAS_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t data)498 static inline void hri_opamp_write_OPAMPCTRL_BIAS_bf(const void *const hw, uint8_t index,
499 hri_opamp_opampctrl_reg_t data)
500 {
501 uint32_t tmp;
502 OPAMP_CRITICAL_SECTION_ENTER();
503 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
504 tmp &= ~OPAMP_OPAMPCTRL_BIAS_Msk;
505 tmp |= OPAMP_OPAMPCTRL_BIAS(data);
506 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
507 OPAMP_CRITICAL_SECTION_LEAVE();
508 }
509
hri_opamp_clear_OPAMPCTRL_BIAS_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)510 static inline void hri_opamp_clear_OPAMPCTRL_BIAS_bf(const void *const hw, uint8_t index,
511 hri_opamp_opampctrl_reg_t mask)
512 {
513 OPAMP_CRITICAL_SECTION_ENTER();
514 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_BIAS(mask);
515 OPAMP_CRITICAL_SECTION_LEAVE();
516 }
517
hri_opamp_toggle_OPAMPCTRL_BIAS_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)518 static inline void hri_opamp_toggle_OPAMPCTRL_BIAS_bf(const void *const hw, uint8_t index,
519 hri_opamp_opampctrl_reg_t mask)
520 {
521 OPAMP_CRITICAL_SECTION_ENTER();
522 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_BIAS(mask);
523 OPAMP_CRITICAL_SECTION_LEAVE();
524 }
525
hri_opamp_read_OPAMPCTRL_BIAS_bf(const void * const hw,uint8_t index)526 static inline hri_opamp_opampctrl_reg_t hri_opamp_read_OPAMPCTRL_BIAS_bf(const void *const hw, uint8_t index)
527 {
528 uint32_t tmp;
529 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
530 tmp = (tmp & OPAMP_OPAMPCTRL_BIAS_Msk) >> OPAMP_OPAMPCTRL_BIAS_Pos;
531 return tmp;
532 }
533
hri_opamp_set_OPAMPCTRL_RES1MUX_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)534 static inline void hri_opamp_set_OPAMPCTRL_RES1MUX_bf(const void *const hw, uint8_t index,
535 hri_opamp_opampctrl_reg_t mask)
536 {
537 OPAMP_CRITICAL_SECTION_ENTER();
538 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_RES1MUX(mask);
539 OPAMP_CRITICAL_SECTION_LEAVE();
540 }
541
hri_opamp_get_OPAMPCTRL_RES1MUX_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)542 static inline hri_opamp_opampctrl_reg_t hri_opamp_get_OPAMPCTRL_RES1MUX_bf(const void *const hw, uint8_t index,
543 hri_opamp_opampctrl_reg_t mask)
544 {
545 uint32_t tmp;
546 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
547 tmp = (tmp & OPAMP_OPAMPCTRL_RES1MUX(mask)) >> OPAMP_OPAMPCTRL_RES1MUX_Pos;
548 return tmp;
549 }
550
hri_opamp_write_OPAMPCTRL_RES1MUX_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t data)551 static inline void hri_opamp_write_OPAMPCTRL_RES1MUX_bf(const void *const hw, uint8_t index,
552 hri_opamp_opampctrl_reg_t data)
553 {
554 uint32_t tmp;
555 OPAMP_CRITICAL_SECTION_ENTER();
556 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
557 tmp &= ~OPAMP_OPAMPCTRL_RES1MUX_Msk;
558 tmp |= OPAMP_OPAMPCTRL_RES1MUX(data);
559 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
560 OPAMP_CRITICAL_SECTION_LEAVE();
561 }
562
hri_opamp_clear_OPAMPCTRL_RES1MUX_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)563 static inline void hri_opamp_clear_OPAMPCTRL_RES1MUX_bf(const void *const hw, uint8_t index,
564 hri_opamp_opampctrl_reg_t mask)
565 {
566 OPAMP_CRITICAL_SECTION_ENTER();
567 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_RES1MUX(mask);
568 OPAMP_CRITICAL_SECTION_LEAVE();
569 }
570
hri_opamp_toggle_OPAMPCTRL_RES1MUX_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)571 static inline void hri_opamp_toggle_OPAMPCTRL_RES1MUX_bf(const void *const hw, uint8_t index,
572 hri_opamp_opampctrl_reg_t mask)
573 {
574 OPAMP_CRITICAL_SECTION_ENTER();
575 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_RES1MUX(mask);
576 OPAMP_CRITICAL_SECTION_LEAVE();
577 }
578
hri_opamp_read_OPAMPCTRL_RES1MUX_bf(const void * const hw,uint8_t index)579 static inline hri_opamp_opampctrl_reg_t hri_opamp_read_OPAMPCTRL_RES1MUX_bf(const void *const hw, uint8_t index)
580 {
581 uint32_t tmp;
582 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
583 tmp = (tmp & OPAMP_OPAMPCTRL_RES1MUX_Msk) >> OPAMP_OPAMPCTRL_RES1MUX_Pos;
584 return tmp;
585 }
586
hri_opamp_set_OPAMPCTRL_POTMUX_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)587 static inline void hri_opamp_set_OPAMPCTRL_POTMUX_bf(const void *const hw, uint8_t index,
588 hri_opamp_opampctrl_reg_t mask)
589 {
590 OPAMP_CRITICAL_SECTION_ENTER();
591 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_POTMUX(mask);
592 OPAMP_CRITICAL_SECTION_LEAVE();
593 }
594
hri_opamp_get_OPAMPCTRL_POTMUX_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)595 static inline hri_opamp_opampctrl_reg_t hri_opamp_get_OPAMPCTRL_POTMUX_bf(const void *const hw, uint8_t index,
596 hri_opamp_opampctrl_reg_t mask)
597 {
598 uint32_t tmp;
599 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
600 tmp = (tmp & OPAMP_OPAMPCTRL_POTMUX(mask)) >> OPAMP_OPAMPCTRL_POTMUX_Pos;
601 return tmp;
602 }
603
hri_opamp_write_OPAMPCTRL_POTMUX_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t data)604 static inline void hri_opamp_write_OPAMPCTRL_POTMUX_bf(const void *const hw, uint8_t index,
605 hri_opamp_opampctrl_reg_t data)
606 {
607 uint32_t tmp;
608 OPAMP_CRITICAL_SECTION_ENTER();
609 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
610 tmp &= ~OPAMP_OPAMPCTRL_POTMUX_Msk;
611 tmp |= OPAMP_OPAMPCTRL_POTMUX(data);
612 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
613 OPAMP_CRITICAL_SECTION_LEAVE();
614 }
615
hri_opamp_clear_OPAMPCTRL_POTMUX_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)616 static inline void hri_opamp_clear_OPAMPCTRL_POTMUX_bf(const void *const hw, uint8_t index,
617 hri_opamp_opampctrl_reg_t mask)
618 {
619 OPAMP_CRITICAL_SECTION_ENTER();
620 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_POTMUX(mask);
621 OPAMP_CRITICAL_SECTION_LEAVE();
622 }
623
hri_opamp_toggle_OPAMPCTRL_POTMUX_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)624 static inline void hri_opamp_toggle_OPAMPCTRL_POTMUX_bf(const void *const hw, uint8_t index,
625 hri_opamp_opampctrl_reg_t mask)
626 {
627 OPAMP_CRITICAL_SECTION_ENTER();
628 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_POTMUX(mask);
629 OPAMP_CRITICAL_SECTION_LEAVE();
630 }
631
hri_opamp_read_OPAMPCTRL_POTMUX_bf(const void * const hw,uint8_t index)632 static inline hri_opamp_opampctrl_reg_t hri_opamp_read_OPAMPCTRL_POTMUX_bf(const void *const hw, uint8_t index)
633 {
634 uint32_t tmp;
635 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
636 tmp = (tmp & OPAMP_OPAMPCTRL_POTMUX_Msk) >> OPAMP_OPAMPCTRL_POTMUX_Pos;
637 return tmp;
638 }
639
hri_opamp_set_OPAMPCTRL_MUXPOS_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)640 static inline void hri_opamp_set_OPAMPCTRL_MUXPOS_bf(const void *const hw, uint8_t index,
641 hri_opamp_opampctrl_reg_t mask)
642 {
643 OPAMP_CRITICAL_SECTION_ENTER();
644 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_MUXPOS(mask);
645 OPAMP_CRITICAL_SECTION_LEAVE();
646 }
647
hri_opamp_get_OPAMPCTRL_MUXPOS_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)648 static inline hri_opamp_opampctrl_reg_t hri_opamp_get_OPAMPCTRL_MUXPOS_bf(const void *const hw, uint8_t index,
649 hri_opamp_opampctrl_reg_t mask)
650 {
651 uint32_t tmp;
652 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
653 tmp = (tmp & OPAMP_OPAMPCTRL_MUXPOS(mask)) >> OPAMP_OPAMPCTRL_MUXPOS_Pos;
654 return tmp;
655 }
656
hri_opamp_write_OPAMPCTRL_MUXPOS_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t data)657 static inline void hri_opamp_write_OPAMPCTRL_MUXPOS_bf(const void *const hw, uint8_t index,
658 hri_opamp_opampctrl_reg_t data)
659 {
660 uint32_t tmp;
661 OPAMP_CRITICAL_SECTION_ENTER();
662 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
663 tmp &= ~OPAMP_OPAMPCTRL_MUXPOS_Msk;
664 tmp |= OPAMP_OPAMPCTRL_MUXPOS(data);
665 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
666 OPAMP_CRITICAL_SECTION_LEAVE();
667 }
668
hri_opamp_clear_OPAMPCTRL_MUXPOS_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)669 static inline void hri_opamp_clear_OPAMPCTRL_MUXPOS_bf(const void *const hw, uint8_t index,
670 hri_opamp_opampctrl_reg_t mask)
671 {
672 OPAMP_CRITICAL_SECTION_ENTER();
673 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_MUXPOS(mask);
674 OPAMP_CRITICAL_SECTION_LEAVE();
675 }
676
hri_opamp_toggle_OPAMPCTRL_MUXPOS_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)677 static inline void hri_opamp_toggle_OPAMPCTRL_MUXPOS_bf(const void *const hw, uint8_t index,
678 hri_opamp_opampctrl_reg_t mask)
679 {
680 OPAMP_CRITICAL_SECTION_ENTER();
681 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_MUXPOS(mask);
682 OPAMP_CRITICAL_SECTION_LEAVE();
683 }
684
hri_opamp_read_OPAMPCTRL_MUXPOS_bf(const void * const hw,uint8_t index)685 static inline hri_opamp_opampctrl_reg_t hri_opamp_read_OPAMPCTRL_MUXPOS_bf(const void *const hw, uint8_t index)
686 {
687 uint32_t tmp;
688 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
689 tmp = (tmp & OPAMP_OPAMPCTRL_MUXPOS_Msk) >> OPAMP_OPAMPCTRL_MUXPOS_Pos;
690 return tmp;
691 }
692
hri_opamp_set_OPAMPCTRL_MUXNEG_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)693 static inline void hri_opamp_set_OPAMPCTRL_MUXNEG_bf(const void *const hw, uint8_t index,
694 hri_opamp_opampctrl_reg_t mask)
695 {
696 OPAMP_CRITICAL_SECTION_ENTER();
697 ((Opamp *)hw)->OPAMPCTRL[index].reg |= OPAMP_OPAMPCTRL_MUXNEG(mask);
698 OPAMP_CRITICAL_SECTION_LEAVE();
699 }
700
hri_opamp_get_OPAMPCTRL_MUXNEG_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)701 static inline hri_opamp_opampctrl_reg_t hri_opamp_get_OPAMPCTRL_MUXNEG_bf(const void *const hw, uint8_t index,
702 hri_opamp_opampctrl_reg_t mask)
703 {
704 uint32_t tmp;
705 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
706 tmp = (tmp & OPAMP_OPAMPCTRL_MUXNEG(mask)) >> OPAMP_OPAMPCTRL_MUXNEG_Pos;
707 return tmp;
708 }
709
hri_opamp_write_OPAMPCTRL_MUXNEG_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t data)710 static inline void hri_opamp_write_OPAMPCTRL_MUXNEG_bf(const void *const hw, uint8_t index,
711 hri_opamp_opampctrl_reg_t data)
712 {
713 uint32_t tmp;
714 OPAMP_CRITICAL_SECTION_ENTER();
715 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
716 tmp &= ~OPAMP_OPAMPCTRL_MUXNEG_Msk;
717 tmp |= OPAMP_OPAMPCTRL_MUXNEG(data);
718 ((Opamp *)hw)->OPAMPCTRL[index].reg = tmp;
719 OPAMP_CRITICAL_SECTION_LEAVE();
720 }
721
hri_opamp_clear_OPAMPCTRL_MUXNEG_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)722 static inline void hri_opamp_clear_OPAMPCTRL_MUXNEG_bf(const void *const hw, uint8_t index,
723 hri_opamp_opampctrl_reg_t mask)
724 {
725 OPAMP_CRITICAL_SECTION_ENTER();
726 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~OPAMP_OPAMPCTRL_MUXNEG(mask);
727 OPAMP_CRITICAL_SECTION_LEAVE();
728 }
729
hri_opamp_toggle_OPAMPCTRL_MUXNEG_bf(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)730 static inline void hri_opamp_toggle_OPAMPCTRL_MUXNEG_bf(const void *const hw, uint8_t index,
731 hri_opamp_opampctrl_reg_t mask)
732 {
733 OPAMP_CRITICAL_SECTION_ENTER();
734 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= OPAMP_OPAMPCTRL_MUXNEG(mask);
735 OPAMP_CRITICAL_SECTION_LEAVE();
736 }
737
hri_opamp_read_OPAMPCTRL_MUXNEG_bf(const void * const hw,uint8_t index)738 static inline hri_opamp_opampctrl_reg_t hri_opamp_read_OPAMPCTRL_MUXNEG_bf(const void *const hw, uint8_t index)
739 {
740 uint32_t tmp;
741 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
742 tmp = (tmp & OPAMP_OPAMPCTRL_MUXNEG_Msk) >> OPAMP_OPAMPCTRL_MUXNEG_Pos;
743 return tmp;
744 }
745
hri_opamp_set_OPAMPCTRL_reg(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)746 static inline void hri_opamp_set_OPAMPCTRL_reg(const void *const hw, uint8_t index, hri_opamp_opampctrl_reg_t mask)
747 {
748 OPAMP_CRITICAL_SECTION_ENTER();
749 ((Opamp *)hw)->OPAMPCTRL[index].reg |= mask;
750 OPAMP_CRITICAL_SECTION_LEAVE();
751 }
752
hri_opamp_get_OPAMPCTRL_reg(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)753 static inline hri_opamp_opampctrl_reg_t hri_opamp_get_OPAMPCTRL_reg(const void *const hw, uint8_t index,
754 hri_opamp_opampctrl_reg_t mask)
755 {
756 uint32_t tmp;
757 tmp = ((Opamp *)hw)->OPAMPCTRL[index].reg;
758 tmp &= mask;
759 return tmp;
760 }
761
hri_opamp_write_OPAMPCTRL_reg(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t data)762 static inline void hri_opamp_write_OPAMPCTRL_reg(const void *const hw, uint8_t index, hri_opamp_opampctrl_reg_t data)
763 {
764 OPAMP_CRITICAL_SECTION_ENTER();
765 ((Opamp *)hw)->OPAMPCTRL[index].reg = data;
766 OPAMP_CRITICAL_SECTION_LEAVE();
767 }
768
hri_opamp_clear_OPAMPCTRL_reg(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)769 static inline void hri_opamp_clear_OPAMPCTRL_reg(const void *const hw, uint8_t index, hri_opamp_opampctrl_reg_t mask)
770 {
771 OPAMP_CRITICAL_SECTION_ENTER();
772 ((Opamp *)hw)->OPAMPCTRL[index].reg &= ~mask;
773 OPAMP_CRITICAL_SECTION_LEAVE();
774 }
775
hri_opamp_toggle_OPAMPCTRL_reg(const void * const hw,uint8_t index,hri_opamp_opampctrl_reg_t mask)776 static inline void hri_opamp_toggle_OPAMPCTRL_reg(const void *const hw, uint8_t index, hri_opamp_opampctrl_reg_t mask)
777 {
778 OPAMP_CRITICAL_SECTION_ENTER();
779 ((Opamp *)hw)->OPAMPCTRL[index].reg ^= mask;
780 OPAMP_CRITICAL_SECTION_LEAVE();
781 }
782
hri_opamp_read_OPAMPCTRL_reg(const void * const hw,uint8_t index)783 static inline hri_opamp_opampctrl_reg_t hri_opamp_read_OPAMPCTRL_reg(const void *const hw, uint8_t index)
784 {
785 return ((Opamp *)hw)->OPAMPCTRL[index].reg;
786 }
787
hri_opamp_get_STATUS_READY0_bit(const void * const hw)788 static inline bool hri_opamp_get_STATUS_READY0_bit(const void *const hw)
789 {
790 return (((Opamp *)hw)->STATUS.reg & OPAMP_STATUS_READY0) >> OPAMP_STATUS_READY0_Pos;
791 }
792
hri_opamp_get_STATUS_READY1_bit(const void * const hw)793 static inline bool hri_opamp_get_STATUS_READY1_bit(const void *const hw)
794 {
795 return (((Opamp *)hw)->STATUS.reg & OPAMP_STATUS_READY1) >> OPAMP_STATUS_READY1_Pos;
796 }
797
hri_opamp_get_STATUS_READY2_bit(const void * const hw)798 static inline bool hri_opamp_get_STATUS_READY2_bit(const void *const hw)
799 {
800 return (((Opamp *)hw)->STATUS.reg & OPAMP_STATUS_READY2) >> OPAMP_STATUS_READY2_Pos;
801 }
802
hri_opamp_get_STATUS_reg(const void * const hw,hri_opamp_status_reg_t mask)803 static inline hri_opamp_status_reg_t hri_opamp_get_STATUS_reg(const void *const hw, hri_opamp_status_reg_t mask)
804 {
805 uint8_t tmp;
806 tmp = ((Opamp *)hw)->STATUS.reg;
807 tmp &= mask;
808 return tmp;
809 }
810
hri_opamp_read_STATUS_reg(const void * const hw)811 static inline hri_opamp_status_reg_t hri_opamp_read_STATUS_reg(const void *const hw)
812 {
813 return ((Opamp *)hw)->STATUS.reg;
814 }
815
816 #ifdef __cplusplus
817 }
818 #endif
819
820 #endif /* _HRI_OPAMP_L21_H_INCLUDED */
821 #endif /* _SAML21_OPAMP_COMPONENT_ */
822