blob: 2ef06845df7a8e3351d153a1b3249bf51f8df662 [file] [log] [blame]
Kévin Redon69b92d92019-01-24 16:39:20 +01001/**
2 * \file
3 *
4 * \brief SAM HMATRIXB
5 *
6 * Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.
7 *
8 * \asf_license_start
9 *
10 * \page License
11 *
12 * Subject to your compliance with these terms, you may use Microchip
13 * software and any derivatives exclusively with Microchip products.
14 * It is your responsibility to comply with third party license terms applicable
15 * to your use of third party software (including open source software) that
16 * may accompany Microchip software.
17 *
18 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
19 * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
20 * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
21 * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
22 * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
23 * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
24 * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
25 * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
26 * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
27 * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
28 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
29 *
30 * \asf_license_stop
31 *
32 */
33
34#ifdef _SAME54_HMATRIXB_COMPONENT_
35#ifndef _HRI_HMATRIXB_E54_H_INCLUDED_
36#define _HRI_HMATRIXB_E54_H_INCLUDED_
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42#include <stdbool.h>
43#include <hal_atomic.h>
44
45#if defined(ENABLE_HMATRIXB_CRITICAL_SECTIONS)
46#define HMATRIXB_CRITICAL_SECTION_ENTER() CRITICAL_SECTION_ENTER()
47#define HMATRIXB_CRITICAL_SECTION_LEAVE() CRITICAL_SECTION_LEAVE()
48#else
49#define HMATRIXB_CRITICAL_SECTION_ENTER()
50#define HMATRIXB_CRITICAL_SECTION_LEAVE()
51#endif
52
53typedef uint32_t hri_hmatrixb_pras_reg_t;
54typedef uint32_t hri_hmatrixb_prbs_reg_t;
55typedef uint32_t hri_hmatrixbprs_pras_reg_t;
56typedef uint32_t hri_hmatrixbprs_prbs_reg_t;
57
58static inline void hri_hmatrixbprs_set_PRAS_reg(const void *const hw, hri_hmatrixb_pras_reg_t mask)
59{
60 HMATRIXB_CRITICAL_SECTION_ENTER();
61 ((HmatrixbPrs *)hw)->PRAS.reg |= mask;
62 HMATRIXB_CRITICAL_SECTION_LEAVE();
63}
64
65static inline hri_hmatrixb_pras_reg_t hri_hmatrixbprs_get_PRAS_reg(const void *const hw, hri_hmatrixb_pras_reg_t mask)
66{
67 uint32_t tmp;
68 tmp = ((HmatrixbPrs *)hw)->PRAS.reg;
69 tmp &= mask;
70 return tmp;
71}
72
73static inline void hri_hmatrixbprs_write_PRAS_reg(const void *const hw, hri_hmatrixb_pras_reg_t data)
74{
75 HMATRIXB_CRITICAL_SECTION_ENTER();
76 ((HmatrixbPrs *)hw)->PRAS.reg = data;
77 HMATRIXB_CRITICAL_SECTION_LEAVE();
78}
79
80static inline void hri_hmatrixbprs_clear_PRAS_reg(const void *const hw, hri_hmatrixb_pras_reg_t mask)
81{
82 HMATRIXB_CRITICAL_SECTION_ENTER();
83 ((HmatrixbPrs *)hw)->PRAS.reg &= ~mask;
84 HMATRIXB_CRITICAL_SECTION_LEAVE();
85}
86
87static inline void hri_hmatrixbprs_toggle_PRAS_reg(const void *const hw, hri_hmatrixb_pras_reg_t mask)
88{
89 HMATRIXB_CRITICAL_SECTION_ENTER();
90 ((HmatrixbPrs *)hw)->PRAS.reg ^= mask;
91 HMATRIXB_CRITICAL_SECTION_LEAVE();
92}
93
94static inline hri_hmatrixb_pras_reg_t hri_hmatrixbprs_read_PRAS_reg(const void *const hw)
95{
96 return ((HmatrixbPrs *)hw)->PRAS.reg;
97}
98
99static inline void hri_hmatrixbprs_set_PRBS_reg(const void *const hw, hri_hmatrixb_prbs_reg_t mask)
100{
101 HMATRIXB_CRITICAL_SECTION_ENTER();
102 ((HmatrixbPrs *)hw)->PRBS.reg |= mask;
103 HMATRIXB_CRITICAL_SECTION_LEAVE();
104}
105
106static inline hri_hmatrixb_prbs_reg_t hri_hmatrixbprs_get_PRBS_reg(const void *const hw, hri_hmatrixb_prbs_reg_t mask)
107{
108 uint32_t tmp;
109 tmp = ((HmatrixbPrs *)hw)->PRBS.reg;
110 tmp &= mask;
111 return tmp;
112}
113
114static inline void hri_hmatrixbprs_write_PRBS_reg(const void *const hw, hri_hmatrixb_prbs_reg_t data)
115{
116 HMATRIXB_CRITICAL_SECTION_ENTER();
117 ((HmatrixbPrs *)hw)->PRBS.reg = data;
118 HMATRIXB_CRITICAL_SECTION_LEAVE();
119}
120
121static inline void hri_hmatrixbprs_clear_PRBS_reg(const void *const hw, hri_hmatrixb_prbs_reg_t mask)
122{
123 HMATRIXB_CRITICAL_SECTION_ENTER();
124 ((HmatrixbPrs *)hw)->PRBS.reg &= ~mask;
125 HMATRIXB_CRITICAL_SECTION_LEAVE();
126}
127
128static inline void hri_hmatrixbprs_toggle_PRBS_reg(const void *const hw, hri_hmatrixb_prbs_reg_t mask)
129{
130 HMATRIXB_CRITICAL_SECTION_ENTER();
131 ((HmatrixbPrs *)hw)->PRBS.reg ^= mask;
132 HMATRIXB_CRITICAL_SECTION_LEAVE();
133}
134
135static inline hri_hmatrixb_prbs_reg_t hri_hmatrixbprs_read_PRBS_reg(const void *const hw)
136{
137 return ((HmatrixbPrs *)hw)->PRBS.reg;
138}
139
140static inline void hri_hmatrixb_set_PRAS_reg(const void *const hw, uint8_t submodule_index,
141 hri_hmatrixb_pras_reg_t mask)
142{
143 HMATRIXB_CRITICAL_SECTION_ENTER();
144 ((Hmatrixb *)hw)->Prs[submodule_index].PRAS.reg |= mask;
145 HMATRIXB_CRITICAL_SECTION_LEAVE();
146}
147
148static inline hri_hmatrixb_pras_reg_t hri_hmatrixb_get_PRAS_reg(const void *const hw, uint8_t submodule_index,
149 hri_hmatrixb_pras_reg_t mask)
150{
151 uint32_t tmp;
152 tmp = ((Hmatrixb *)hw)->Prs[submodule_index].PRAS.reg;
153 tmp &= mask;
154 return tmp;
155}
156
157static inline void hri_hmatrixb_write_PRAS_reg(const void *const hw, uint8_t submodule_index,
158 hri_hmatrixb_pras_reg_t data)
159{
160 HMATRIXB_CRITICAL_SECTION_ENTER();
161 ((Hmatrixb *)hw)->Prs[submodule_index].PRAS.reg = data;
162 HMATRIXB_CRITICAL_SECTION_LEAVE();
163}
164
165static inline void hri_hmatrixb_clear_PRAS_reg(const void *const hw, uint8_t submodule_index,
166 hri_hmatrixb_pras_reg_t mask)
167{
168 HMATRIXB_CRITICAL_SECTION_ENTER();
169 ((Hmatrixb *)hw)->Prs[submodule_index].PRAS.reg &= ~mask;
170 HMATRIXB_CRITICAL_SECTION_LEAVE();
171}
172
173static inline void hri_hmatrixb_toggle_PRAS_reg(const void *const hw, uint8_t submodule_index,
174 hri_hmatrixb_pras_reg_t mask)
175{
176 HMATRIXB_CRITICAL_SECTION_ENTER();
177 ((Hmatrixb *)hw)->Prs[submodule_index].PRAS.reg ^= mask;
178 HMATRIXB_CRITICAL_SECTION_LEAVE();
179}
180
181static inline hri_hmatrixb_pras_reg_t hri_hmatrixb_read_PRAS_reg(const void *const hw, uint8_t submodule_index)
182{
183 return ((Hmatrixb *)hw)->Prs[submodule_index].PRAS.reg;
184}
185
186static inline void hri_hmatrixb_set_PRBS_reg(const void *const hw, uint8_t submodule_index,
187 hri_hmatrixb_prbs_reg_t mask)
188{
189 HMATRIXB_CRITICAL_SECTION_ENTER();
190 ((Hmatrixb *)hw)->Prs[submodule_index].PRBS.reg |= mask;
191 HMATRIXB_CRITICAL_SECTION_LEAVE();
192}
193
194static inline hri_hmatrixb_prbs_reg_t hri_hmatrixb_get_PRBS_reg(const void *const hw, uint8_t submodule_index,
195 hri_hmatrixb_prbs_reg_t mask)
196{
197 uint32_t tmp;
198 tmp = ((Hmatrixb *)hw)->Prs[submodule_index].PRBS.reg;
199 tmp &= mask;
200 return tmp;
201}
202
203static inline void hri_hmatrixb_write_PRBS_reg(const void *const hw, uint8_t submodule_index,
204 hri_hmatrixb_prbs_reg_t data)
205{
206 HMATRIXB_CRITICAL_SECTION_ENTER();
207 ((Hmatrixb *)hw)->Prs[submodule_index].PRBS.reg = data;
208 HMATRIXB_CRITICAL_SECTION_LEAVE();
209}
210
211static inline void hri_hmatrixb_clear_PRBS_reg(const void *const hw, uint8_t submodule_index,
212 hri_hmatrixb_prbs_reg_t mask)
213{
214 HMATRIXB_CRITICAL_SECTION_ENTER();
215 ((Hmatrixb *)hw)->Prs[submodule_index].PRBS.reg &= ~mask;
216 HMATRIXB_CRITICAL_SECTION_LEAVE();
217}
218
219static inline void hri_hmatrixb_toggle_PRBS_reg(const void *const hw, uint8_t submodule_index,
220 hri_hmatrixb_prbs_reg_t mask)
221{
222 HMATRIXB_CRITICAL_SECTION_ENTER();
223 ((Hmatrixb *)hw)->Prs[submodule_index].PRBS.reg ^= mask;
224 HMATRIXB_CRITICAL_SECTION_LEAVE();
225}
226
227static inline hri_hmatrixb_prbs_reg_t hri_hmatrixb_read_PRBS_reg(const void *const hw, uint8_t submodule_index)
228{
229 return ((Hmatrixb *)hw)->Prs[submodule_index].PRBS.reg;
230}
231
232#ifdef __cplusplus
233}
234#endif
235
236#endif /* _HRI_HMATRIXB_E54_H_INCLUDED */
237#endif /* _SAME54_HMATRIXB_COMPONENT_ */