1 /*
2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 /**
16 * @file reg_wcnaon.h
17 * @brief Definitions of the WCNAON HW block registers and register access functions.
18 *
19 * @defgroup REG_WCNAON REG_WCNAON
20 * @ingroup REG
21 * @{
22 *
23 * @brief Definitions of the WCNAON HW block registers and register access functions.
24 */
25 #ifndef _REG_WCNAON_H_
26 #define _REG_WCNAON_H_
27
28 #include "compiler.h"
29 #include "arch.h"
30 #include "reg_access_wrapper.h"
31
32 /** @brief Number of registers in the REG_WCNAON peripheral.
33 */
34 #define REG_WCNAON_COUNT 73
35
36 /** @brief Decoding mask of the REG_WCNAON peripheral registers from the CPU point of view.
37 */
38 #define REG_WCNAON_DECODING_MASK 0x000001FF
39
40 /**
41 * @name BT_MEM_CFG1 register definitions
42 * <table>
43 * <caption id="BT_MEM_CFG1_BF">BT_MEM_CFG1 bitfields</caption>
44 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
45 * <tr><td>20:17 <td> bt_cfg <td>R <td>R/W <td>0x1
46 * <tr><td>16 <td> btfw_lp_mode <td>R <td>R/W <td>0
47 * <tr><td>15:00 <td> bt_mem_cfg <td>R <td>R/W <td>0x220
48 * </table>
49 *
50 * @{
51 */
52
53 /// Address of the BT_MEM_CFG1 register
54 #define WCNAON_BT_MEM_CFG1_ADDR 0x40580000
55 /// Offset of the BT_MEM_CFG1 register from the base address
56 #define WCNAON_BT_MEM_CFG1_OFFSET 0x00000000
57 /// Index of the BT_MEM_CFG1 register
58 #define WCNAON_BT_MEM_CFG1_INDEX 0x00000000
59 /// Reset value of the BT_MEM_CFG1 register
60 #define WCNAON_BT_MEM_CFG1_RESET 0x00020220
61
62 /**
63 * @brief Returns the current value of the BT_MEM_CFG1 register.
64 * The BT_MEM_CFG1 register will be read and its value returned.
65 * @return The current value of the BT_MEM_CFG1 register.
66 */
wcnaon_bt_mem_cfg1_get(void)67 static inline uint32_t wcnaon_bt_mem_cfg1_get(void)
68 {
69 return PLATFORM_REG_READ(WCNAON_BT_MEM_CFG1_ADDR);
70 }
71
72 /**
73 * @brief Sets the BT_MEM_CFG1 register to a value.
74 * The BT_MEM_CFG1 register will be written.
75 * @param value - The value to write.
76 */
wcnaon_bt_mem_cfg1_set(uint32_t value)77 static inline void wcnaon_bt_mem_cfg1_set(uint32_t value)
78 {
79 PLATFORM_REG_WRITE(WCNAON_BT_MEM_CFG1_ADDR, value);
80 }
81
82 // field definitions
83 /// BT_CFG field mask
84 #define WCNAON_BT_CFG_MASK ((uint32_t)0x001E0000)
85 /// BT_CFG field LSB position
86 #define WCNAON_BT_CFG_LSB 17
87 /// BT_CFG field width
88 #define WCNAON_BT_CFG_WIDTH ((uint32_t)0x00000004)
89 /// BTFW_LP_MODE field bit
90 #define WCNAON_BTFW_LP_MODE_BIT ((uint32_t)0x00010000)
91 /// BTFW_LP_MODE field position
92 #define WCNAON_BTFW_LP_MODE_POS 16
93 /// BT_MEM_CFG field mask
94 #define WCNAON_BT_MEM_CFG_MASK ((uint32_t)0x0000FFFF)
95 /// BT_MEM_CFG field LSB position
96 #define WCNAON_BT_MEM_CFG_LSB 0
97 /// BT_MEM_CFG field width
98 #define WCNAON_BT_MEM_CFG_WIDTH ((uint32_t)0x00000010)
99
100 /// BT_CFG field reset value
101 #define WCNAON_BT_CFG_RST 0x1
102 /// BTFW_LP_MODE field reset value
103 #define WCNAON_BTFW_LP_MODE_RST 0x0
104 /// BT_MEM_CFG field reset value
105 #define WCNAON_BT_MEM_CFG_RST 0x220
106
107 /**
108 * @brief Constructs a value for the BT_MEM_CFG1 register given values for its fields
109 * and writes the value to the register.
110 *
111 * @param[in] btcfg - The value to use for the bt_cfg field.
112 * @param[in] btfwlpmode - The value to use for the btfw_lp_mode field.
113 * @param[in] btmemcfg - The value to use for the bt_mem_cfg field.
114 */
wcnaon_bt_mem_cfg1_pack(uint8_t btcfg,uint8_t btfwlpmode,uint16_t btmemcfg)115 static inline void wcnaon_bt_mem_cfg1_pack(uint8_t btcfg, uint8_t btfwlpmode, uint16_t btmemcfg)
116 {
117 PLATFORM_REG_WRITE(WCNAON_BT_MEM_CFG1_ADDR, ((uint32_t)btcfg << 17) | ((uint32_t)btfwlpmode << 16) | ((uint32_t)btmemcfg << 0));
118 }
119
120 /**
121 * @brief Unpacks BT_MEM_CFG1's fields from current value of the BT_MEM_CFG1 register.
122 *
123 * Reads the BT_MEM_CFG1 register and populates all the _field variables with the corresponding
124 * values from the register.
125 *
126 * @param[out] btcfg - Will be populated with the current value of this field from the register.
127 * @param[out] btfwlpmode - Will be populated with the current value of this field from the register.
128 * @param[out] btmemcfg - Will be populated with the current value of this field from the register.
129 */
wcnaon_bt_mem_cfg1_unpack(uint8_t * btcfg,uint8_t * btfwlpmode,uint16_t * btmemcfg)130 static inline void wcnaon_bt_mem_cfg1_unpack(uint8_t* btcfg, uint8_t* btfwlpmode, uint16_t* btmemcfg)
131 {
132 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_MEM_CFG1_ADDR);
133
134 *btcfg = (localVal & ((uint32_t)0x001E0000)) >> 17;
135 *btfwlpmode = (localVal & ((uint32_t)0x00010000)) >> 16;
136 *btmemcfg = (localVal & ((uint32_t)0x0000FFFF)) >> 0;
137 }
138
139 /**
140 * @brief Returns the current value of the bt_cfg field in the BT_MEM_CFG1 register.
141 *
142 * The BT_MEM_CFG1 register will be read and the bt_cfg field's value will be returned.
143 *
144 * @return The current value of the bt_cfg field in the BT_MEM_CFG1 register.
145 */
wcnaon_bt_cfg_getf(void)146 static inline uint8_t wcnaon_bt_cfg_getf(void)
147 {
148 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_MEM_CFG1_ADDR);
149 return ((localVal & ((uint32_t)0x001E0000)) >> 17);
150 }
151
152 /**
153 * @brief Sets the bt_cfg field of the BT_MEM_CFG1 register.
154 *
155 * The BT_MEM_CFG1 register will be read, modified to contain the new field value, and written.
156 *
157 * @param[in] btcfg - The value to set the field to.
158 */
wcnaon_bt_cfg_setf(uint8_t btcfg)159 static inline void wcnaon_bt_cfg_setf(uint8_t btcfg)
160 {
161 PLATFORM_REG_WRITE(WCNAON_BT_MEM_CFG1_ADDR, (PLATFORM_REG_READ(WCNAON_BT_MEM_CFG1_ADDR) & ~((uint32_t)0x001E0000)) | ((uint32_t)btcfg << 17));
162 }
163
164 /**
165 * @brief Returns the current value of the btfw_lp_mode field in the BT_MEM_CFG1 register.
166 *
167 * The BT_MEM_CFG1 register will be read and the btfw_lp_mode field's value will be returned.
168 *
169 * @return The current value of the btfw_lp_mode field in the BT_MEM_CFG1 register.
170 */
wcnaon_btfw_lp_mode_getf(void)171 static inline uint8_t wcnaon_btfw_lp_mode_getf(void)
172 {
173 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_MEM_CFG1_ADDR);
174 return ((localVal & ((uint32_t)0x00010000)) >> 16);
175 }
176
177 /**
178 * @brief Sets the btfw_lp_mode field of the BT_MEM_CFG1 register.
179 *
180 * The BT_MEM_CFG1 register will be read, modified to contain the new field value, and written.
181 *
182 * @param[in] btfwlpmode - The value to set the field to.
183 */
wcnaon_btfw_lp_mode_setf(uint8_t btfwlpmode)184 static inline void wcnaon_btfw_lp_mode_setf(uint8_t btfwlpmode)
185 {
186 PLATFORM_REG_WRITE(WCNAON_BT_MEM_CFG1_ADDR, (PLATFORM_REG_READ(WCNAON_BT_MEM_CFG1_ADDR) & ~((uint32_t)0x00010000)) | ((uint32_t)btfwlpmode << 16));
187 }
188
189 /**
190 * @brief Returns the current value of the bt_mem_cfg field in the BT_MEM_CFG1 register.
191 *
192 * The BT_MEM_CFG1 register will be read and the bt_mem_cfg field's value will be returned.
193 *
194 * @return The current value of the bt_mem_cfg field in the BT_MEM_CFG1 register.
195 */
wcnaon_bt_mem_cfg_getf(void)196 static inline uint16_t wcnaon_bt_mem_cfg_getf(void)
197 {
198 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_MEM_CFG1_ADDR);
199 return ((localVal & ((uint32_t)0x0000FFFF)) >> 0);
200 }
201
202 /**
203 * @brief Sets the bt_mem_cfg field of the BT_MEM_CFG1 register.
204 *
205 * The BT_MEM_CFG1 register will be read, modified to contain the new field value, and written.
206 *
207 * @param[in] btmemcfg - The value to set the field to.
208 */
wcnaon_bt_mem_cfg_setf(uint16_t btmemcfg)209 static inline void wcnaon_bt_mem_cfg_setf(uint16_t btmemcfg)
210 {
211 PLATFORM_REG_WRITE(WCNAON_BT_MEM_CFG1_ADDR, (PLATFORM_REG_READ(WCNAON_BT_MEM_CFG1_ADDR) & ~((uint32_t)0x0000FFFF)) | ((uint32_t)btmemcfg << 0));
212 }
213
214 /// @}
215
216 /**
217 * @name WIFI_MEM_CFG register definitions
218 * <table>
219 * <caption id="WIFI_MEM_CFG_BF">WIFI_MEM_CFG bitfields</caption>
220 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
221 * <tr><td>15:00 <td> wifi_mem_cfg <td>R <td>R/W <td>0x220
222 * </table>
223 *
224 * @{
225 */
226
227 /// Address of the WIFI_MEM_CFG register
228 #define WCNAON_WIFI_MEM_CFG_ADDR 0x40580004
229 /// Offset of the WIFI_MEM_CFG register from the base address
230 #define WCNAON_WIFI_MEM_CFG_OFFSET 0x00000004
231 /// Index of the WIFI_MEM_CFG register
232 #define WCNAON_WIFI_MEM_CFG_INDEX 0x00000001
233 /// Reset value of the WIFI_MEM_CFG register
234 #define WCNAON_WIFI_MEM_CFG_RESET 0x00000220
235
236 /**
237 * @brief Returns the current value of the WIFI_MEM_CFG register.
238 * The WIFI_MEM_CFG register will be read and its value returned.
239 * @return The current value of the WIFI_MEM_CFG register.
240 */
wcnaon_wifi_mem_cfg_get(void)241 static inline uint32_t wcnaon_wifi_mem_cfg_get(void)
242 {
243 return PLATFORM_REG_READ(WCNAON_WIFI_MEM_CFG_ADDR);
244 }
245
246 /**
247 * @brief Sets the WIFI_MEM_CFG register to a value.
248 * The WIFI_MEM_CFG register will be written.
249 * @param value - The value to write.
250 */
wcnaon_wifi_mem_cfg_set(uint32_t value)251 static inline void wcnaon_wifi_mem_cfg_set(uint32_t value)
252 {
253 PLATFORM_REG_WRITE(WCNAON_WIFI_MEM_CFG_ADDR, value);
254 }
255
256 // field definitions
257 /// WIFI_MEM_CFG field mask
258 #define WCNAON_WIFI_MEM_CFG_MASK ((uint32_t)0x0000FFFF)
259 /// WIFI_MEM_CFG field LSB position
260 #define WCNAON_WIFI_MEM_CFG_LSB 0
261 /// WIFI_MEM_CFG field width
262 #define WCNAON_WIFI_MEM_CFG_WIDTH ((uint32_t)0x00000010)
263
264 /// WIFI_MEM_CFG field reset value
265 #define WCNAON_WIFI_MEM_CFG_RST 0x220
266
267 /**
268 * @brief Returns the current value of the wifi_mem_cfg field in the WIFI_MEM_CFG register.
269 *
270 * The WIFI_MEM_CFG register will be read and the wifi_mem_cfg field's value will be returned.
271 *
272 * @return The current value of the wifi_mem_cfg field in the WIFI_MEM_CFG register.
273 */
wcnaon_wifi_mem_cfg_getf(void)274 static inline uint16_t wcnaon_wifi_mem_cfg_getf(void)
275 {
276 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_MEM_CFG_ADDR);
277 return (localVal >> 0);
278 }
279
280 /**
281 * @brief Sets the wifi_mem_cfg field of the WIFI_MEM_CFG register.
282 *
283 * The WIFI_MEM_CFG register will be read, modified to contain the new field value, and written.
284 *
285 * @param[in] wifimemcfg - The value to set the field to.
286 */
wcnaon_wifi_mem_cfg_setf(uint16_t wifimemcfg)287 static inline void wcnaon_wifi_mem_cfg_setf(uint16_t wifimemcfg)
288 {
289 PLATFORM_REG_WRITE(WCNAON_WIFI_MEM_CFG_ADDR, (uint32_t)wifimemcfg << 0);
290 }
291
292 /// @}
293
294 /**
295 * @name BT_CLK_CFG0 register definitions
296 * <table>
297 * <caption id="BT_CLK_CFG0_BF">BT_CLK_CFG0 bitfields</caption>
298 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
299 * <tr><td>31 <td> bt_div_num_ld <td>R <td>R/W <td>0
300 * <tr><td>24:16 <td> bt_div_M <td>R <td>R/W <td>0x1
301 * <tr><td>15:00 <td> bt_div_N <td>R <td>R/W <td>0x2
302 * </table>
303 *
304 * @{
305 */
306
307 /// Address of the BT_CLK_CFG0 register
308 #define WCNAON_BT_CLK_CFG0_ADDR 0x40580008
309 /// Offset of the BT_CLK_CFG0 register from the base address
310 #define WCNAON_BT_CLK_CFG0_OFFSET 0x00000008
311 /// Index of the BT_CLK_CFG0 register
312 #define WCNAON_BT_CLK_CFG0_INDEX 0x00000002
313 /// Reset value of the BT_CLK_CFG0 register
314 #define WCNAON_BT_CLK_CFG0_RESET 0x00010002
315
316 /**
317 * @brief Returns the current value of the BT_CLK_CFG0 register.
318 * The BT_CLK_CFG0 register will be read and its value returned.
319 * @return The current value of the BT_CLK_CFG0 register.
320 */
wcnaon_bt_clk_cfg0_get(void)321 static inline uint32_t wcnaon_bt_clk_cfg0_get(void)
322 {
323 return PLATFORM_REG_READ(WCNAON_BT_CLK_CFG0_ADDR);
324 }
325
326 /**
327 * @brief Sets the BT_CLK_CFG0 register to a value.
328 * The BT_CLK_CFG0 register will be written.
329 * @param value - The value to write.
330 */
wcnaon_bt_clk_cfg0_set(uint32_t value)331 static inline void wcnaon_bt_clk_cfg0_set(uint32_t value)
332 {
333 PLATFORM_REG_WRITE(WCNAON_BT_CLK_CFG0_ADDR, value);
334 }
335
336 // field definitions
337 /// BT_DIV_NUM_LD field bit
338 #define WCNAON_BT_DIV_NUM_LD_BIT ((uint32_t)0x80000000)
339 /// BT_DIV_NUM_LD field position
340 #define WCNAON_BT_DIV_NUM_LD_POS 31
341 /// BT_DIV_M field mask
342 #define WCNAON_BT_DIV_M_MASK ((uint32_t)0x01FF0000)
343 /// BT_DIV_M field LSB position
344 #define WCNAON_BT_DIV_M_LSB 16
345 /// BT_DIV_M field width
346 #define WCNAON_BT_DIV_M_WIDTH ((uint32_t)0x00000009)
347 /// BT_DIV_N field mask
348 #define WCNAON_BT_DIV_N_MASK ((uint32_t)0x0000FFFF)
349 /// BT_DIV_N field LSB position
350 #define WCNAON_BT_DIV_N_LSB 0
351 /// BT_DIV_N field width
352 #define WCNAON_BT_DIV_N_WIDTH ((uint32_t)0x00000010)
353
354 /// BT_DIV_NUM_LD field reset value
355 #define WCNAON_BT_DIV_NUM_LD_RST 0x0
356 /// BT_DIV_M field reset value
357 #define WCNAON_BT_DIV_M_RST 0x1
358 /// BT_DIV_N field reset value
359 #define WCNAON_BT_DIV_N_RST 0x2
360
361 /**
362 * @brief Constructs a value for the BT_CLK_CFG0 register given values for its fields
363 * and writes the value to the register.
364 *
365 * @param[in] btdivnumld - The value to use for the bt_div_num_ld field.
366 * @param[in] btdivm - The value to use for the bt_div_M field.
367 * @param[in] btdivn - The value to use for the bt_div_N field.
368 */
wcnaon_bt_clk_cfg0_pack(uint8_t btdivnumld,uint16_t btdivm,uint16_t btdivn)369 static inline void wcnaon_bt_clk_cfg0_pack(uint8_t btdivnumld, uint16_t btdivm, uint16_t btdivn)
370 {
371 PLATFORM_REG_WRITE(WCNAON_BT_CLK_CFG0_ADDR, ((uint32_t)btdivnumld << 31) | ((uint32_t)btdivm << 16) | ((uint32_t)btdivn << 0));
372 }
373
374 /**
375 * @brief Unpacks BT_CLK_CFG0's fields from current value of the BT_CLK_CFG0 register.
376 *
377 * Reads the BT_CLK_CFG0 register and populates all the _field variables with the corresponding
378 * values from the register.
379 *
380 * @param[out] btdivnumld - Will be populated with the current value of this field from the register.
381 * @param[out] btdivm - Will be populated with the current value of this field from the register.
382 * @param[out] btdivn - Will be populated with the current value of this field from the register.
383 */
wcnaon_bt_clk_cfg0_unpack(uint8_t * btdivnumld,uint16_t * btdivm,uint16_t * btdivn)384 static inline void wcnaon_bt_clk_cfg0_unpack(uint8_t* btdivnumld, uint16_t* btdivm, uint16_t* btdivn)
385 {
386 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_CLK_CFG0_ADDR);
387
388 *btdivnumld = (localVal & ((uint32_t)0x80000000)) >> 31;
389 *btdivm = (localVal & ((uint32_t)0x01FF0000)) >> 16;
390 *btdivn = (localVal & ((uint32_t)0x0000FFFF)) >> 0;
391 }
392
393 /**
394 * @brief Returns the current value of the bt_div_num_ld field in the BT_CLK_CFG0 register.
395 *
396 * The BT_CLK_CFG0 register will be read and the bt_div_num_ld field's value will be returned.
397 *
398 * @return The current value of the bt_div_num_ld field in the BT_CLK_CFG0 register.
399 */
wcnaon_bt_div_num_ld_getf(void)400 static inline uint8_t wcnaon_bt_div_num_ld_getf(void)
401 {
402 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_CLK_CFG0_ADDR);
403 return ((localVal & ((uint32_t)0x80000000)) >> 31);
404 }
405
406 /**
407 * @brief Sets the bt_div_num_ld field of the BT_CLK_CFG0 register.
408 *
409 * The BT_CLK_CFG0 register will be read, modified to contain the new field value, and written.
410 *
411 * @param[in] btdivnumld - The value to set the field to.
412 */
wcnaon_bt_div_num_ld_setf(uint8_t btdivnumld)413 static inline void wcnaon_bt_div_num_ld_setf(uint8_t btdivnumld)
414 {
415 PLATFORM_REG_WRITE(WCNAON_BT_CLK_CFG0_ADDR, (PLATFORM_REG_READ(WCNAON_BT_CLK_CFG0_ADDR) & ~((uint32_t)0x80000000)) | ((uint32_t)btdivnumld << 31));
416 }
417
418 /**
419 * @brief Returns the current value of the bt_div_M field in the BT_CLK_CFG0 register.
420 *
421 * The BT_CLK_CFG0 register will be read and the bt_div_M field's value will be returned.
422 *
423 * @return The current value of the bt_div_M field in the BT_CLK_CFG0 register.
424 */
wcnaon_bt_div_m_getf(void)425 static inline uint16_t wcnaon_bt_div_m_getf(void)
426 {
427 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_CLK_CFG0_ADDR);
428 return ((localVal & ((uint32_t)0x01FF0000)) >> 16);
429 }
430
431 /**
432 * @brief Sets the bt_div_M field of the BT_CLK_CFG0 register.
433 *
434 * The BT_CLK_CFG0 register will be read, modified to contain the new field value, and written.
435 *
436 * @param[in] btdivm - The value to set the field to.
437 */
wcnaon_bt_div_m_setf(uint16_t btdivm)438 static inline void wcnaon_bt_div_m_setf(uint16_t btdivm)
439 {
440 PLATFORM_REG_WRITE(WCNAON_BT_CLK_CFG0_ADDR, (PLATFORM_REG_READ(WCNAON_BT_CLK_CFG0_ADDR) & ~((uint32_t)0x01FF0000)) | ((uint32_t)btdivm << 16));
441 }
442
443 /**
444 * @brief Returns the current value of the bt_div_N field in the BT_CLK_CFG0 register.
445 *
446 * The BT_CLK_CFG0 register will be read and the bt_div_N field's value will be returned.
447 *
448 * @return The current value of the bt_div_N field in the BT_CLK_CFG0 register.
449 */
wcnaon_bt_div_n_getf(void)450 static inline uint16_t wcnaon_bt_div_n_getf(void)
451 {
452 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_CLK_CFG0_ADDR);
453 return ((localVal & ((uint32_t)0x0000FFFF)) >> 0);
454 }
455
456 /**
457 * @brief Sets the bt_div_N field of the BT_CLK_CFG0 register.
458 *
459 * The BT_CLK_CFG0 register will be read, modified to contain the new field value, and written.
460 *
461 * @param[in] btdivn - The value to set the field to.
462 */
wcnaon_bt_div_n_setf(uint16_t btdivn)463 static inline void wcnaon_bt_div_n_setf(uint16_t btdivn)
464 {
465 PLATFORM_REG_WRITE(WCNAON_BT_CLK_CFG0_ADDR, (PLATFORM_REG_READ(WCNAON_BT_CLK_CFG0_ADDR) & ~((uint32_t)0x0000FFFF)) | ((uint32_t)btdivn << 0));
466 }
467
468 /// @}
469
470 /**
471 * @name BT_CLK_CFG1 register definitions
472 * <table>
473 * <caption id="BT_CLK_CFG1_BF">BT_CLK_CFG1 bitfields</caption>
474 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
475 * <tr><td>29:24 <td> bt_cfg_rfsel <td>R <td>R/W <td>0x0
476 * <tr><td>22:16 <td> bt_clkg_cfg <td>R <td>R/W <td>0x0
477 * <tr><td>05:00 <td> bt_clksel <td>R <td>R/W <td>0x0
478 * </table>
479 *
480 * @{
481 */
482
483 /// Address of the BT_CLK_CFG1 register
484 #define WCNAON_BT_CLK_CFG1_ADDR 0x4058000C
485 /// Offset of the BT_CLK_CFG1 register from the base address
486 #define WCNAON_BT_CLK_CFG1_OFFSET 0x0000000C
487 /// Index of the BT_CLK_CFG1 register
488 #define WCNAON_BT_CLK_CFG1_INDEX 0x00000003
489 /// Reset value of the BT_CLK_CFG1 register
490 #define WCNAON_BT_CLK_CFG1_RESET 0x00000000
491
492 /**
493 * @brief Returns the current value of the BT_CLK_CFG1 register.
494 * The BT_CLK_CFG1 register will be read and its value returned.
495 * @return The current value of the BT_CLK_CFG1 register.
496 */
wcnaon_bt_clk_cfg1_get(void)497 static inline uint32_t wcnaon_bt_clk_cfg1_get(void)
498 {
499 return PLATFORM_REG_READ(WCNAON_BT_CLK_CFG1_ADDR);
500 }
501
502 /**
503 * @brief Sets the BT_CLK_CFG1 register to a value.
504 * The BT_CLK_CFG1 register will be written.
505 * @param value - The value to write.
506 */
wcnaon_bt_clk_cfg1_set(uint32_t value)507 static inline void wcnaon_bt_clk_cfg1_set(uint32_t value)
508 {
509 PLATFORM_REG_WRITE(WCNAON_BT_CLK_CFG1_ADDR, value);
510 }
511
512 // field definitions
513 /// BT_CFG_RFSEL field mask
514 #define WCNAON_BT_CFG_RFSEL_MASK ((uint32_t)0x3F000000)
515 /// BT_CFG_RFSEL field LSB position
516 #define WCNAON_BT_CFG_RFSEL_LSB 24
517 /// BT_CFG_RFSEL field width
518 #define WCNAON_BT_CFG_RFSEL_WIDTH ((uint32_t)0x00000006)
519 /// BT_CLKG_CFG field mask
520 #define WCNAON_BT_CLKG_CFG_MASK ((uint32_t)0x007F0000)
521 /// BT_CLKG_CFG field LSB position
522 #define WCNAON_BT_CLKG_CFG_LSB 16
523 /// BT_CLKG_CFG field width
524 #define WCNAON_BT_CLKG_CFG_WIDTH ((uint32_t)0x00000007)
525 /// BT_CLKSEL field mask
526 #define WCNAON_BT_CLKSEL_MASK ((uint32_t)0x0000003F)
527 /// BT_CLKSEL field LSB position
528 #define WCNAON_BT_CLKSEL_LSB 0
529 /// BT_CLKSEL field width
530 #define WCNAON_BT_CLKSEL_WIDTH ((uint32_t)0x00000006)
531
532 /// BT_CFG_RFSEL field reset value
533 #define WCNAON_BT_CFG_RFSEL_RST 0x0
534 /// BT_CLKG_CFG field reset value
535 #define WCNAON_BT_CLKG_CFG_RST 0x0
536 /// BT_CLKSEL field reset value
537 #define WCNAON_BT_CLKSEL_RST 0x0
538
539 /**
540 * @brief Constructs a value for the BT_CLK_CFG1 register given values for its fields
541 * and writes the value to the register.
542 *
543 * @param[in] btcfgrfsel - The value to use for the bt_cfg_rfsel field.
544 * @param[in] btclkgcfg - The value to use for the bt_clkg_cfg field.
545 * @param[in] btclksel - The value to use for the bt_clksel field.
546 */
wcnaon_bt_clk_cfg1_pack(uint8_t btcfgrfsel,uint8_t btclkgcfg,uint8_t btclksel)547 static inline void wcnaon_bt_clk_cfg1_pack(uint8_t btcfgrfsel, uint8_t btclkgcfg, uint8_t btclksel)
548 {
549 PLATFORM_REG_WRITE(WCNAON_BT_CLK_CFG1_ADDR, ((uint32_t)btcfgrfsel << 24) | ((uint32_t)btclkgcfg << 16) | ((uint32_t)btclksel << 0));
550 }
551
552 /**
553 * @brief Unpacks BT_CLK_CFG1's fields from current value of the BT_CLK_CFG1 register.
554 *
555 * Reads the BT_CLK_CFG1 register and populates all the _field variables with the corresponding
556 * values from the register.
557 *
558 * @param[out] btcfgrfsel - Will be populated with the current value of this field from the register.
559 * @param[out] btclkgcfg - Will be populated with the current value of this field from the register.
560 * @param[out] btclksel - Will be populated with the current value of this field from the register.
561 */
wcnaon_bt_clk_cfg1_unpack(uint8_t * btcfgrfsel,uint8_t * btclkgcfg,uint8_t * btclksel)562 static inline void wcnaon_bt_clk_cfg1_unpack(uint8_t* btcfgrfsel, uint8_t* btclkgcfg, uint8_t* btclksel)
563 {
564 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_CLK_CFG1_ADDR);
565
566 *btcfgrfsel = (localVal & ((uint32_t)0x3F000000)) >> 24;
567 *btclkgcfg = (localVal & ((uint32_t)0x007F0000)) >> 16;
568 *btclksel = (localVal & ((uint32_t)0x0000003F)) >> 0;
569 }
570
571 /**
572 * @brief Returns the current value of the bt_cfg_rfsel field in the BT_CLK_CFG1 register.
573 *
574 * The BT_CLK_CFG1 register will be read and the bt_cfg_rfsel field's value will be returned.
575 *
576 * @return The current value of the bt_cfg_rfsel field in the BT_CLK_CFG1 register.
577 */
wcnaon_bt_cfg_rfsel_getf(void)578 static inline uint8_t wcnaon_bt_cfg_rfsel_getf(void)
579 {
580 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_CLK_CFG1_ADDR);
581 return ((localVal & ((uint32_t)0x3F000000)) >> 24);
582 }
583
584 /**
585 * @brief Sets the bt_cfg_rfsel field of the BT_CLK_CFG1 register.
586 *
587 * The BT_CLK_CFG1 register will be read, modified to contain the new field value, and written.
588 *
589 * @param[in] btcfgrfsel - The value to set the field to.
590 */
wcnaon_bt_cfg_rfsel_setf(uint8_t btcfgrfsel)591 static inline void wcnaon_bt_cfg_rfsel_setf(uint8_t btcfgrfsel)
592 {
593 PLATFORM_REG_WRITE(WCNAON_BT_CLK_CFG1_ADDR, (PLATFORM_REG_READ(WCNAON_BT_CLK_CFG1_ADDR) & ~((uint32_t)0x3F000000)) | ((uint32_t)btcfgrfsel << 24));
594 }
595
596 /**
597 * @brief Returns the current value of the bt_clkg_cfg field in the BT_CLK_CFG1 register.
598 *
599 * The BT_CLK_CFG1 register will be read and the bt_clkg_cfg field's value will be returned.
600 *
601 * @return The current value of the bt_clkg_cfg field in the BT_CLK_CFG1 register.
602 */
wcnaon_bt_clkg_cfg_getf(void)603 static inline uint8_t wcnaon_bt_clkg_cfg_getf(void)
604 {
605 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_CLK_CFG1_ADDR);
606 return ((localVal & ((uint32_t)0x007F0000)) >> 16);
607 }
608
609 /**
610 * @brief Sets the bt_clkg_cfg field of the BT_CLK_CFG1 register.
611 *
612 * The BT_CLK_CFG1 register will be read, modified to contain the new field value, and written.
613 *
614 * @param[in] btclkgcfg - The value to set the field to.
615 */
wcnaon_bt_clkg_cfg_setf(uint8_t btclkgcfg)616 static inline void wcnaon_bt_clkg_cfg_setf(uint8_t btclkgcfg)
617 {
618 PLATFORM_REG_WRITE(WCNAON_BT_CLK_CFG1_ADDR, (PLATFORM_REG_READ(WCNAON_BT_CLK_CFG1_ADDR) & ~((uint32_t)0x007F0000)) | ((uint32_t)btclkgcfg << 16));
619 }
620
621 /**
622 * @brief Returns the current value of the bt_clksel field in the BT_CLK_CFG1 register.
623 *
624 * The BT_CLK_CFG1 register will be read and the bt_clksel field's value will be returned.
625 *
626 * @return The current value of the bt_clksel field in the BT_CLK_CFG1 register.
627 */
wcnaon_bt_clksel_getf(void)628 static inline uint8_t wcnaon_bt_clksel_getf(void)
629 {
630 uint32_t localVal = PLATFORM_REG_READ(WCNAON_BT_CLK_CFG1_ADDR);
631 return ((localVal & ((uint32_t)0x0000003F)) >> 0);
632 }
633
634 /**
635 * @brief Sets the bt_clksel field of the BT_CLK_CFG1 register.
636 *
637 * The BT_CLK_CFG1 register will be read, modified to contain the new field value, and written.
638 *
639 * @param[in] btclksel - The value to set the field to.
640 */
wcnaon_bt_clksel_setf(uint8_t btclksel)641 static inline void wcnaon_bt_clksel_setf(uint8_t btclksel)
642 {
643 PLATFORM_REG_WRITE(WCNAON_BT_CLK_CFG1_ADDR, (PLATFORM_REG_READ(WCNAON_BT_CLK_CFG1_ADDR) & ~((uint32_t)0x0000003F)) | ((uint32_t)btclksel << 0));
644 }
645
646 /// @}
647
648 /**
649 * @name WIFI_SOFT_WAKEUP_REQ register definitions
650 * <table>
651 * <caption id="WIFI_SOFT_WAKEUP_REQ_BF">WIFI_SOFT_WAKEUP_REQ bitfields</caption>
652 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
653 * <tr><td>11 <td> bt_wakeup_lp_sel <td>R <td>R/W <td>0
654 * <tr><td>10 <td>wlan_wakeup_lp_sel <td>R <td>R/W <td>0
655 * <tr><td>09 <td> bt_cfg_power_en <td>R <td>R/W <td>0
656 * <tr><td>08 <td> bt_cfg_cpu_en <td>R <td>R/W <td>1
657 * <tr><td>06:05 <td> mon_sel <td>R <td>R/W <td>0x0
658 * <tr><td>04 <td>wlan_radio_cg_sleep_en <td>R <td>R/W <td>0
659 * <tr><td>03 <td>wlan_cpu_wakeup_en <td>R <td>R/W <td>0
660 * <tr><td>02 <td>wlan_radio_sleep_en <td>R <td>R/W <td>0
661 * <tr><td>01 <td>wlan_power_sleep_en <td>R <td>R/W <td>0
662 * <tr><td>00 <td>wlan_soft_wakeup_req <td>R <td>R/W <td>0
663 * </table>
664 *
665 * @{
666 */
667
668 /// Address of the WIFI_SOFT_WAKEUP_REQ register
669 #define WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR 0x40580010
670 /// Offset of the WIFI_SOFT_WAKEUP_REQ register from the base address
671 #define WCNAON_WIFI_SOFT_WAKEUP_REQ_OFFSET 0x00000010
672 /// Index of the WIFI_SOFT_WAKEUP_REQ register
673 #define WCNAON_WIFI_SOFT_WAKEUP_REQ_INDEX 0x00000004
674 /// Reset value of the WIFI_SOFT_WAKEUP_REQ register
675 #define WCNAON_WIFI_SOFT_WAKEUP_REQ_RESET 0x00000100
676
677 /**
678 * @brief Returns the current value of the WIFI_SOFT_WAKEUP_REQ register.
679 * The WIFI_SOFT_WAKEUP_REQ register will be read and its value returned.
680 * @return The current value of the WIFI_SOFT_WAKEUP_REQ register.
681 */
wcnaon_wifi_soft_wakeup_req_get(void)682 static inline uint32_t wcnaon_wifi_soft_wakeup_req_get(void)
683 {
684 return PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
685 }
686
687 /**
688 * @brief Sets the WIFI_SOFT_WAKEUP_REQ register to a value.
689 * The WIFI_SOFT_WAKEUP_REQ register will be written.
690 * @param value - The value to write.
691 */
wcnaon_wifi_soft_wakeup_req_set(uint32_t value)692 static inline void wcnaon_wifi_soft_wakeup_req_set(uint32_t value)
693 {
694 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, value);
695 }
696
697 // field definitions
698 /// BT_WAKEUP_LP_SEL field bit
699 #define WCNAON_BT_WAKEUP_LP_SEL_BIT ((uint32_t)0x00000800)
700 /// BT_WAKEUP_LP_SEL field position
701 #define WCNAON_BT_WAKEUP_LP_SEL_POS 11
702 /// WLAN_WAKEUP_LP_SEL field bit
703 #define WCNAON_WLAN_WAKEUP_LP_SEL_BIT ((uint32_t)0x00000400)
704 /// WLAN_WAKEUP_LP_SEL field position
705 #define WCNAON_WLAN_WAKEUP_LP_SEL_POS 10
706 /// BT_CFG_POWER_EN field bit
707 #define WCNAON_BT_CFG_POWER_EN_BIT ((uint32_t)0x00000200)
708 /// BT_CFG_POWER_EN field position
709 #define WCNAON_BT_CFG_POWER_EN_POS 9
710 /// BT_CFG_CPU_EN field bit
711 #define WCNAON_BT_CFG_CPU_EN_BIT ((uint32_t)0x00000100)
712 /// BT_CFG_CPU_EN field position
713 #define WCNAON_BT_CFG_CPU_EN_POS 8
714 /// MON_SEL field mask
715 #define WCNAON_MON_SEL_MASK ((uint32_t)0x00000060)
716 /// MON_SEL field LSB position
717 #define WCNAON_MON_SEL_LSB 5
718 /// MON_SEL field width
719 #define WCNAON_MON_SEL_WIDTH ((uint32_t)0x00000002)
720 /// WLAN_RADIO_CG_SLEEP_EN field bit
721 #define WCNAON_WLAN_RADIO_CG_SLEEP_EN_BIT ((uint32_t)0x00000010)
722 /// WLAN_RADIO_CG_SLEEP_EN field position
723 #define WCNAON_WLAN_RADIO_CG_SLEEP_EN_POS 4
724 /// WLAN_CPU_WAKEUP_EN field bit
725 #define WCNAON_WLAN_CPU_WAKEUP_EN_BIT ((uint32_t)0x00000008)
726 /// WLAN_CPU_WAKEUP_EN field position
727 #define WCNAON_WLAN_CPU_WAKEUP_EN_POS 3
728 /// WLAN_RADIO_SLEEP_EN field bit
729 #define WCNAON_WLAN_RADIO_SLEEP_EN_BIT ((uint32_t)0x00000004)
730 /// WLAN_RADIO_SLEEP_EN field position
731 #define WCNAON_WLAN_RADIO_SLEEP_EN_POS 2
732 /// WLAN_POWER_SLEEP_EN field bit
733 #define WCNAON_WLAN_POWER_SLEEP_EN_BIT ((uint32_t)0x00000002)
734 /// WLAN_POWER_SLEEP_EN field position
735 #define WCNAON_WLAN_POWER_SLEEP_EN_POS 1
736 /// WLAN_SOFT_WAKEUP_REQ field bit
737 #define WCNAON_WLAN_SOFT_WAKEUP_REQ_BIT ((uint32_t)0x00000001)
738 /// WLAN_SOFT_WAKEUP_REQ field position
739 #define WCNAON_WLAN_SOFT_WAKEUP_REQ_POS 0
740
741 /// BT_WAKEUP_LP_SEL field reset value
742 #define WCNAON_BT_WAKEUP_LP_SEL_RST 0x0
743 /// WLAN_WAKEUP_LP_SEL field reset value
744 #define WCNAON_WLAN_WAKEUP_LP_SEL_RST 0x0
745 /// BT_CFG_POWER_EN field reset value
746 #define WCNAON_BT_CFG_POWER_EN_RST 0x0
747 /// BT_CFG_CPU_EN field reset value
748 #define WCNAON_BT_CFG_CPU_EN_RST 0x1
749 /// MON_SEL field reset value
750 #define WCNAON_MON_SEL_RST 0x0
751 /// WLAN_RADIO_CG_SLEEP_EN field reset value
752 #define WCNAON_WLAN_RADIO_CG_SLEEP_EN_RST 0x0
753 /// WLAN_CPU_WAKEUP_EN field reset value
754 #define WCNAON_WLAN_CPU_WAKEUP_EN_RST 0x0
755 /// WLAN_RADIO_SLEEP_EN field reset value
756 #define WCNAON_WLAN_RADIO_SLEEP_EN_RST 0x0
757 /// WLAN_POWER_SLEEP_EN field reset value
758 #define WCNAON_WLAN_POWER_SLEEP_EN_RST 0x0
759 /// WLAN_SOFT_WAKEUP_REQ field reset value
760 #define WCNAON_WLAN_SOFT_WAKEUP_REQ_RST 0x0
761
762 /**
763 * @brief Constructs a value for the WIFI_SOFT_WAKEUP_REQ register given values for its fields
764 * and writes the value to the register.
765 *
766 * @param[in] btwakeuplpsel - The value to use for the bt_wakeup_lp_sel field.
767 * @param[in] wlanwakeuplpsel - The value to use for the wlan_wakeup_lp_sel field.
768 * @param[in] btcfgpoweren - The value to use for the bt_cfg_power_en field.
769 * @param[in] btcfgcpuen - The value to use for the bt_cfg_cpu_en field.
770 * @param[in] monsel - The value to use for the mon_sel field.
771 * @param[in] wlanradiocgsleepen - The value to use for the wlan_radio_cg_sleep_en field.
772 * @param[in] wlancpuwakeupen - The value to use for the wlan_cpu_wakeup_en field.
773 * @param[in] wlanradiosleepen - The value to use for the wlan_radio_sleep_en field.
774 * @param[in] wlanpowersleepen - The value to use for the wlan_power_sleep_en field.
775 * @param[in] wlansoftwakeupreq - The value to use for the wlan_soft_wakeup_req field.
776 */
wcnaon_wifi_soft_wakeup_req_pack(uint8_t btwakeuplpsel,uint8_t wlanwakeuplpsel,uint8_t btcfgpoweren,uint8_t btcfgcpuen,uint8_t monsel,uint8_t wlanradiocgsleepen,uint8_t wlancpuwakeupen,uint8_t wlanradiosleepen,uint8_t wlanpowersleepen,uint8_t wlansoftwakeupreq)777 static inline void wcnaon_wifi_soft_wakeup_req_pack(uint8_t btwakeuplpsel, uint8_t wlanwakeuplpsel, uint8_t btcfgpoweren, uint8_t btcfgcpuen, uint8_t monsel, uint8_t wlanradiocgsleepen, uint8_t wlancpuwakeupen, uint8_t wlanradiosleepen, uint8_t wlanpowersleepen, uint8_t wlansoftwakeupreq)
778 {
779 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, ((uint32_t)btwakeuplpsel << 11) | ((uint32_t)wlanwakeuplpsel << 10) | ((uint32_t)btcfgpoweren << 9) | ((uint32_t)btcfgcpuen << 8) | ((uint32_t)monsel << 5) | ((uint32_t)wlanradiocgsleepen << 4) | ((uint32_t)wlancpuwakeupen << 3) | ((uint32_t)wlanradiosleepen << 2) | ((uint32_t)wlanpowersleepen << 1) | ((uint32_t)wlansoftwakeupreq << 0));
780 }
781
782 /**
783 * @brief Unpacks WIFI_SOFT_WAKEUP_REQ's fields from current value of the WIFI_SOFT_WAKEUP_REQ register.
784 *
785 * Reads the WIFI_SOFT_WAKEUP_REQ register and populates all the _field variables with the corresponding
786 * values from the register.
787 *
788 * @param[out] btwakeuplpsel - Will be populated with the current value of this field from the register.
789 * @param[out] wlanwakeuplpsel - Will be populated with the current value of this field from the register.
790 * @param[out] btcfgpoweren - Will be populated with the current value of this field from the register.
791 * @param[out] btcfgcpuen - Will be populated with the current value of this field from the register.
792 * @param[out] monsel - Will be populated with the current value of this field from the register.
793 * @param[out] wlanradiocgsleepen - Will be populated with the current value of this field from the register.
794 * @param[out] wlancpuwakeupen - Will be populated with the current value of this field from the register.
795 * @param[out] wlanradiosleepen - Will be populated with the current value of this field from the register.
796 * @param[out] wlanpowersleepen - Will be populated with the current value of this field from the register.
797 * @param[out] wlansoftwakeupreq - Will be populated with the current value of this field from the register.
798 */
wcnaon_wifi_soft_wakeup_req_unpack(uint8_t * btwakeuplpsel,uint8_t * wlanwakeuplpsel,uint8_t * btcfgpoweren,uint8_t * btcfgcpuen,uint8_t * monsel,uint8_t * wlanradiocgsleepen,uint8_t * wlancpuwakeupen,uint8_t * wlanradiosleepen,uint8_t * wlanpowersleepen,uint8_t * wlansoftwakeupreq)799 static inline void wcnaon_wifi_soft_wakeup_req_unpack(uint8_t* btwakeuplpsel, uint8_t* wlanwakeuplpsel, uint8_t* btcfgpoweren, uint8_t* btcfgcpuen, uint8_t* monsel, uint8_t* wlanradiocgsleepen, uint8_t* wlancpuwakeupen, uint8_t* wlanradiosleepen, uint8_t* wlanpowersleepen, uint8_t* wlansoftwakeupreq)
800 {
801 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
802
803 *btwakeuplpsel = (localVal & ((uint32_t)0x00000800)) >> 11;
804 *wlanwakeuplpsel = (localVal & ((uint32_t)0x00000400)) >> 10;
805 *btcfgpoweren = (localVal & ((uint32_t)0x00000200)) >> 9;
806 *btcfgcpuen = (localVal & ((uint32_t)0x00000100)) >> 8;
807 *monsel = (localVal & ((uint32_t)0x00000060)) >> 5;
808 *wlanradiocgsleepen = (localVal & ((uint32_t)0x00000010)) >> 4;
809 *wlancpuwakeupen = (localVal & ((uint32_t)0x00000008)) >> 3;
810 *wlanradiosleepen = (localVal & ((uint32_t)0x00000004)) >> 2;
811 *wlanpowersleepen = (localVal & ((uint32_t)0x00000002)) >> 1;
812 *wlansoftwakeupreq = (localVal & ((uint32_t)0x00000001)) >> 0;
813 }
814
815 /**
816 * @brief Returns the current value of the bt_wakeup_lp_sel field in the WIFI_SOFT_WAKEUP_REQ register.
817 *
818 * The WIFI_SOFT_WAKEUP_REQ register will be read and the bt_wakeup_lp_sel field's value will be returned.
819 *
820 * @return The current value of the bt_wakeup_lp_sel field in the WIFI_SOFT_WAKEUP_REQ register.
821 */
wcnaon_bt_wakeup_lp_sel_getf(void)822 static inline uint8_t wcnaon_bt_wakeup_lp_sel_getf(void)
823 {
824 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
825 return ((localVal & ((uint32_t)0x00000800)) >> 11);
826 }
827
828 /**
829 * @brief Sets the bt_wakeup_lp_sel field of the WIFI_SOFT_WAKEUP_REQ register.
830 *
831 * The WIFI_SOFT_WAKEUP_REQ register will be read, modified to contain the new field value, and written.
832 *
833 * @param[in] btwakeuplpsel - The value to set the field to.
834 */
wcnaon_bt_wakeup_lp_sel_setf(uint8_t btwakeuplpsel)835 static inline void wcnaon_bt_wakeup_lp_sel_setf(uint8_t btwakeuplpsel)
836 {
837 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR) & ~((uint32_t)0x00000800)) | ((uint32_t)btwakeuplpsel << 11));
838 }
839
840 /**
841 * @brief Returns the current value of the wlan_wakeup_lp_sel field in the WIFI_SOFT_WAKEUP_REQ register.
842 *
843 * The WIFI_SOFT_WAKEUP_REQ register will be read and the wlan_wakeup_lp_sel field's value will be returned.
844 *
845 * @return The current value of the wlan_wakeup_lp_sel field in the WIFI_SOFT_WAKEUP_REQ register.
846 */
wcnaon_wlan_wakeup_lp_sel_getf(void)847 static inline uint8_t wcnaon_wlan_wakeup_lp_sel_getf(void)
848 {
849 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
850 return ((localVal & ((uint32_t)0x00000400)) >> 10);
851 }
852
853 /**
854 * @brief Sets the wlan_wakeup_lp_sel field of the WIFI_SOFT_WAKEUP_REQ register.
855 *
856 * The WIFI_SOFT_WAKEUP_REQ register will be read, modified to contain the new field value, and written.
857 *
858 * @param[in] wlanwakeuplpsel - The value to set the field to.
859 */
wcnaon_wlan_wakeup_lp_sel_setf(uint8_t wlanwakeuplpsel)860 static inline void wcnaon_wlan_wakeup_lp_sel_setf(uint8_t wlanwakeuplpsel)
861 {
862 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR) & ~((uint32_t)0x00000400)) | ((uint32_t)wlanwakeuplpsel << 10));
863 }
864
865 /**
866 * @brief Returns the current value of the bt_cfg_power_en field in the WIFI_SOFT_WAKEUP_REQ register.
867 *
868 * The WIFI_SOFT_WAKEUP_REQ register will be read and the bt_cfg_power_en field's value will be returned.
869 *
870 * @return The current value of the bt_cfg_power_en field in the WIFI_SOFT_WAKEUP_REQ register.
871 */
wcnaon_bt_cfg_power_en_getf(void)872 static inline uint8_t wcnaon_bt_cfg_power_en_getf(void)
873 {
874 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
875 return ((localVal & ((uint32_t)0x00000200)) >> 9);
876 }
877
878 /**
879 * @brief Sets the bt_cfg_power_en field of the WIFI_SOFT_WAKEUP_REQ register.
880 *
881 * The WIFI_SOFT_WAKEUP_REQ register will be read, modified to contain the new field value, and written.
882 *
883 * @param[in] btcfgpoweren - The value to set the field to.
884 */
wcnaon_bt_cfg_power_en_setf(uint8_t btcfgpoweren)885 static inline void wcnaon_bt_cfg_power_en_setf(uint8_t btcfgpoweren)
886 {
887 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR) & ~((uint32_t)0x00000200)) | ((uint32_t)btcfgpoweren << 9));
888 }
889
890 /**
891 * @brief Returns the current value of the bt_cfg_cpu_en field in the WIFI_SOFT_WAKEUP_REQ register.
892 *
893 * The WIFI_SOFT_WAKEUP_REQ register will be read and the bt_cfg_cpu_en field's value will be returned.
894 *
895 * @return The current value of the bt_cfg_cpu_en field in the WIFI_SOFT_WAKEUP_REQ register.
896 */
wcnaon_bt_cfg_cpu_en_getf(void)897 static inline uint8_t wcnaon_bt_cfg_cpu_en_getf(void)
898 {
899 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
900 return ((localVal & ((uint32_t)0x00000100)) >> 8);
901 }
902
903 /**
904 * @brief Sets the bt_cfg_cpu_en field of the WIFI_SOFT_WAKEUP_REQ register.
905 *
906 * The WIFI_SOFT_WAKEUP_REQ register will be read, modified to contain the new field value, and written.
907 *
908 * @param[in] btcfgcpuen - The value to set the field to.
909 */
wcnaon_bt_cfg_cpu_en_setf(uint8_t btcfgcpuen)910 static inline void wcnaon_bt_cfg_cpu_en_setf(uint8_t btcfgcpuen)
911 {
912 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR) & ~((uint32_t)0x00000100)) | ((uint32_t)btcfgcpuen << 8));
913 }
914
915 /**
916 * @brief Returns the current value of the mon_sel field in the WIFI_SOFT_WAKEUP_REQ register.
917 *
918 * The WIFI_SOFT_WAKEUP_REQ register will be read and the mon_sel field's value will be returned.
919 *
920 * @return The current value of the mon_sel field in the WIFI_SOFT_WAKEUP_REQ register.
921 */
wcnaon_mon_sel_getf(void)922 static inline uint8_t wcnaon_mon_sel_getf(void)
923 {
924 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
925 return ((localVal & ((uint32_t)0x00000060)) >> 5);
926 }
927
928 /**
929 * @brief Sets the mon_sel field of the WIFI_SOFT_WAKEUP_REQ register.
930 *
931 * The WIFI_SOFT_WAKEUP_REQ register will be read, modified to contain the new field value, and written.
932 *
933 * @param[in] monsel - The value to set the field to.
934 */
wcnaon_mon_sel_setf(uint8_t monsel)935 static inline void wcnaon_mon_sel_setf(uint8_t monsel)
936 {
937 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR) & ~((uint32_t)0x00000060)) | ((uint32_t)monsel << 5));
938 }
939
940 /**
941 * @brief Returns the current value of the wlan_radio_cg_sleep_en field in the WIFI_SOFT_WAKEUP_REQ register.
942 *
943 * The WIFI_SOFT_WAKEUP_REQ register will be read and the wlan_radio_cg_sleep_en field's value will be returned.
944 *
945 * @return The current value of the wlan_radio_cg_sleep_en field in the WIFI_SOFT_WAKEUP_REQ register.
946 */
wcnaon_wlan_radio_cg_sleep_en_getf(void)947 static inline uint8_t wcnaon_wlan_radio_cg_sleep_en_getf(void)
948 {
949 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
950 return ((localVal & ((uint32_t)0x00000010)) >> 4);
951 }
952
953 /**
954 * @brief Sets the wlan_radio_cg_sleep_en field of the WIFI_SOFT_WAKEUP_REQ register.
955 *
956 * The WIFI_SOFT_WAKEUP_REQ register will be read, modified to contain the new field value, and written.
957 *
958 * @param[in] wlanradiocgsleepen - The value to set the field to.
959 */
wcnaon_wlan_radio_cg_sleep_en_setf(uint8_t wlanradiocgsleepen)960 static inline void wcnaon_wlan_radio_cg_sleep_en_setf(uint8_t wlanradiocgsleepen)
961 {
962 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR) & ~((uint32_t)0x00000010)) | ((uint32_t)wlanradiocgsleepen << 4));
963 }
964
965 /**
966 * @brief Returns the current value of the wlan_cpu_wakeup_en field in the WIFI_SOFT_WAKEUP_REQ register.
967 *
968 * The WIFI_SOFT_WAKEUP_REQ register will be read and the wlan_cpu_wakeup_en field's value will be returned.
969 *
970 * @return The current value of the wlan_cpu_wakeup_en field in the WIFI_SOFT_WAKEUP_REQ register.
971 */
wcnaon_wlan_cpu_wakeup_en_getf(void)972 static inline uint8_t wcnaon_wlan_cpu_wakeup_en_getf(void)
973 {
974 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
975 return ((localVal & ((uint32_t)0x00000008)) >> 3);
976 }
977
978 /**
979 * @brief Sets the wlan_cpu_wakeup_en field of the WIFI_SOFT_WAKEUP_REQ register.
980 *
981 * The WIFI_SOFT_WAKEUP_REQ register will be read, modified to contain the new field value, and written.
982 *
983 * @param[in] wlancpuwakeupen - The value to set the field to.
984 */
wcnaon_wlan_cpu_wakeup_en_setf(uint8_t wlancpuwakeupen)985 static inline void wcnaon_wlan_cpu_wakeup_en_setf(uint8_t wlancpuwakeupen)
986 {
987 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR) & ~((uint32_t)0x00000008)) | ((uint32_t)wlancpuwakeupen << 3));
988 }
989
990 /**
991 * @brief Returns the current value of the wlan_radio_sleep_en field in the WIFI_SOFT_WAKEUP_REQ register.
992 *
993 * The WIFI_SOFT_WAKEUP_REQ register will be read and the wlan_radio_sleep_en field's value will be returned.
994 *
995 * @return The current value of the wlan_radio_sleep_en field in the WIFI_SOFT_WAKEUP_REQ register.
996 */
wcnaon_wlan_radio_sleep_en_getf(void)997 static inline uint8_t wcnaon_wlan_radio_sleep_en_getf(void)
998 {
999 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
1000 return ((localVal & ((uint32_t)0x00000004)) >> 2);
1001 }
1002
1003 /**
1004 * @brief Sets the wlan_radio_sleep_en field of the WIFI_SOFT_WAKEUP_REQ register.
1005 *
1006 * The WIFI_SOFT_WAKEUP_REQ register will be read, modified to contain the new field value, and written.
1007 *
1008 * @param[in] wlanradiosleepen - The value to set the field to.
1009 */
wcnaon_wlan_radio_sleep_en_setf(uint8_t wlanradiosleepen)1010 static inline void wcnaon_wlan_radio_sleep_en_setf(uint8_t wlanradiosleepen)
1011 {
1012 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR) & ~((uint32_t)0x00000004)) | ((uint32_t)wlanradiosleepen << 2));
1013 }
1014
1015 /**
1016 * @brief Returns the current value of the wlan_power_sleep_en field in the WIFI_SOFT_WAKEUP_REQ register.
1017 *
1018 * The WIFI_SOFT_WAKEUP_REQ register will be read and the wlan_power_sleep_en field's value will be returned.
1019 *
1020 * @return The current value of the wlan_power_sleep_en field in the WIFI_SOFT_WAKEUP_REQ register.
1021 */
wcnaon_wlan_power_sleep_en_getf(void)1022 static inline uint8_t wcnaon_wlan_power_sleep_en_getf(void)
1023 {
1024 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
1025 return ((localVal & ((uint32_t)0x00000002)) >> 1);
1026 }
1027
1028 /**
1029 * @brief Sets the wlan_power_sleep_en field of the WIFI_SOFT_WAKEUP_REQ register.
1030 *
1031 * The WIFI_SOFT_WAKEUP_REQ register will be read, modified to contain the new field value, and written.
1032 *
1033 * @param[in] wlanpowersleepen - The value to set the field to.
1034 */
wcnaon_wlan_power_sleep_en_setf(uint8_t wlanpowersleepen)1035 static inline void wcnaon_wlan_power_sleep_en_setf(uint8_t wlanpowersleepen)
1036 {
1037 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR) & ~((uint32_t)0x00000002)) | ((uint32_t)wlanpowersleepen << 1));
1038 }
1039
1040 /**
1041 * @brief Returns the current value of the wlan_soft_wakeup_req field in the WIFI_SOFT_WAKEUP_REQ register.
1042 *
1043 * The WIFI_SOFT_WAKEUP_REQ register will be read and the wlan_soft_wakeup_req field's value will be returned.
1044 *
1045 * @return The current value of the wlan_soft_wakeup_req field in the WIFI_SOFT_WAKEUP_REQ register.
1046 */
wcnaon_wlan_soft_wakeup_req_getf(void)1047 static inline uint8_t wcnaon_wlan_soft_wakeup_req_getf(void)
1048 {
1049 uint32_t localVal = PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR);
1050 return ((localVal & ((uint32_t)0x00000001)) >> 0);
1051 }
1052
1053 /**
1054 * @brief Sets the wlan_soft_wakeup_req field of the WIFI_SOFT_WAKEUP_REQ register.
1055 *
1056 * The WIFI_SOFT_WAKEUP_REQ register will be read, modified to contain the new field value, and written.
1057 *
1058 * @param[in] wlansoftwakeupreq - The value to set the field to.
1059 */
wcnaon_wlan_soft_wakeup_req_setf(uint8_t wlansoftwakeupreq)1060 static inline void wcnaon_wlan_soft_wakeup_req_setf(uint8_t wlansoftwakeupreq)
1061 {
1062 PLATFORM_REG_WRITE(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_SOFT_WAKEUP_REQ_ADDR) & ~((uint32_t)0x00000001)) | ((uint32_t)wlansoftwakeupreq << 0));
1063 }
1064
1065 /// @}
1066
1067 /**
1068 * @name WIFI_WAKEUP_DELAY_TIMER register definitions
1069 * <table>
1070 * <caption id="WIFI_WAKEUP_DELAY_TIMER_BF">WIFI_WAKEUP_DELAY_TIMER bitfields</caption>
1071 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
1072 * <tr><td>31:22 <td> wlan_twrm <td>R <td>W <td>0x0
1073 * <tr><td>21:11 <td> wlan_twpwr <td>R <td>W <td>0x0
1074 * <tr><td>10:00 <td> wlan_twext <td>R <td>W <td>0x0
1075 * </table>
1076 *
1077 * @{
1078 */
1079
1080 /// Address of the WIFI_WAKEUP_DELAY_TIMER register
1081 #define WCNAON_WIFI_WAKEUP_DELAY_TIMER_ADDR 0x40580014
1082 /// Offset of the WIFI_WAKEUP_DELAY_TIMER register from the base address
1083 #define WCNAON_WIFI_WAKEUP_DELAY_TIMER_OFFSET 0x00000014
1084 /// Index of the WIFI_WAKEUP_DELAY_TIMER register
1085 #define WCNAON_WIFI_WAKEUP_DELAY_TIMER_INDEX 0x00000005
1086 /// Reset value of the WIFI_WAKEUP_DELAY_TIMER register
1087 #define WCNAON_WIFI_WAKEUP_DELAY_TIMER_RESET 0x00000000
1088
1089 /**
1090 * @brief Sets the WIFI_WAKEUP_DELAY_TIMER register to a value.
1091 * The WIFI_WAKEUP_DELAY_TIMER register will be written.
1092 * @param value - The value to write.
1093 */
wcnaon_wifi_wakeup_delay_timer_set(uint32_t value)1094 static inline void wcnaon_wifi_wakeup_delay_timer_set(uint32_t value)
1095 {
1096 PLATFORM_REG_WRITE(WCNAON_WIFI_WAKEUP_DELAY_TIMER_ADDR, value);
1097 }
1098
1099 // field definitions
1100 /// WLAN_TWRM field mask
1101 #define WCNAON_WLAN_TWRM_MASK ((uint32_t)0xFFC00000)
1102 /// WLAN_TWRM field LSB position
1103 #define WCNAON_WLAN_TWRM_LSB 22
1104 /// WLAN_TWRM field width
1105 #define WCNAON_WLAN_TWRM_WIDTH ((uint32_t)0x0000000A)
1106 /// WLAN_TWPWR field mask
1107 #define WCNAON_WLAN_TWPWR_MASK ((uint32_t)0x003FF800)
1108 /// WLAN_TWPWR field LSB position
1109 #define WCNAON_WLAN_TWPWR_LSB 11
1110 /// WLAN_TWPWR field width
1111 #define WCNAON_WLAN_TWPWR_WIDTH ((uint32_t)0x0000000B)
1112 /// WLAN_TWEXT field mask
1113 #define WCNAON_WLAN_TWEXT_MASK ((uint32_t)0x000007FF)
1114 /// WLAN_TWEXT field LSB position
1115 #define WCNAON_WLAN_TWEXT_LSB 0
1116 /// WLAN_TWEXT field width
1117 #define WCNAON_WLAN_TWEXT_WIDTH ((uint32_t)0x0000000B)
1118
1119 /// WLAN_TWRM field reset value
1120 #define WCNAON_WLAN_TWRM_RST 0x0
1121 /// WLAN_TWPWR field reset value
1122 #define WCNAON_WLAN_TWPWR_RST 0x0
1123 /// WLAN_TWEXT field reset value
1124 #define WCNAON_WLAN_TWEXT_RST 0x0
1125
1126 /**
1127 * @brief Constructs a value for the WIFI_WAKEUP_DELAY_TIMER register given values for its fields
1128 * and writes the value to the register.
1129 *
1130 * @param[in] wlantwrm - The value to use for the wlan_twrm field.
1131 * @param[in] wlantwpwr - The value to use for the wlan_twpwr field.
1132 * @param[in] wlantwext - The value to use for the wlan_twext field.
1133 */
wcnaon_wifi_wakeup_delay_timer_pack(uint16_t wlantwrm,uint16_t wlantwpwr,uint16_t wlantwext)1134 static inline void wcnaon_wifi_wakeup_delay_timer_pack(uint16_t wlantwrm, uint16_t wlantwpwr, uint16_t wlantwext)
1135 {
1136 PLATFORM_REG_WRITE(WCNAON_WIFI_WAKEUP_DELAY_TIMER_ADDR, ((uint32_t)wlantwrm << 22) | ((uint32_t)wlantwpwr << 11) | ((uint32_t)wlantwext << 0));
1137 }
1138
1139 /**
1140 * @brief Sets the wlan_twrm field of the WIFI_WAKEUP_DELAY_TIMER register.
1141 *
1142 * The WIFI_WAKEUP_DELAY_TIMER register will be read, modified to contain the new field value, and written.
1143 *
1144 * @param[in] wlantwrm - The value to set the field to.
1145 */
wcnaon_wlan_twrm_setf(uint16_t wlantwrm)1146 static inline void wcnaon_wlan_twrm_setf(uint16_t wlantwrm)
1147 {
1148 PLATFORM_REG_WRITE(WCNAON_WIFI_WAKEUP_DELAY_TIMER_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_WAKEUP_DELAY_TIMER_ADDR) & ~((uint32_t)0xFFC00000)) | ((uint32_t)wlantwrm << 22));
1149 }
1150
1151 /**
1152 * @brief Sets the wlan_twpwr field of the WIFI_WAKEUP_DELAY_TIMER register.
1153 *
1154 * The WIFI_WAKEUP_DELAY_TIMER register will be read, modified to contain the new field value, and written.
1155 *
1156 * @param[in] wlantwpwr - The value to set the field to.
1157 */
wcnaon_wlan_twpwr_setf(uint16_t wlantwpwr)1158 static inline void wcnaon_wlan_twpwr_setf(uint16_t wlantwpwr)
1159 {
1160 PLATFORM_REG_WRITE(WCNAON_WIFI_WAKEUP_DELAY_TIMER_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_WAKEUP_DELAY_TIMER_ADDR) & ~((uint32_t)0x003FF800)) | ((uint32_t)wlantwpwr << 11));
1161 }
1162
1163 /**
1164 * @brief Sets the wlan_twext field of the WIFI_WAKEUP_DELAY_TIMER register.
1165 *
1166 * The WIFI_WAKEUP_DELAY_TIMER register will be read, modified to contain the new field value, and written.
1167 *
1168 * @param[in] wlantwext - The value to set the field to.
1169 */
wcnaon_wlan_twext_setf(uint16_t wlantwext)1170 static inline void wcnaon_wlan_twext_setf(uint16_t wlantwext)
1171 {
1172 PLATFORM_REG_WRITE(WCNAON_WIFI_WAKEUP_DELAY_TIMER_ADDR, (PLATFORM_REG_READ(WCNAON_WIFI_WAKEUP_DELAY_TIMER_ADDR) & ~((uint32_t)0x000007FF)) | ((uint32_t)wlantwext << 0));
1173 }
1174
1175 /// @}
1176
1177 /**
1178 * @name WFBT_RFEN_CTRL register definitions
1179 * <table>
1180 * <caption id="WFBT_RFEN_CTRL_BF">WFBT_RFEN_CTRL bitfields</caption>
1181 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
1182 * <tr><td>03 <td> bt_rfen_dr <td>R <td>W <td>0
1183 * <tr><td>02 <td> bt_rfen_reg <td>R <td>W <td>0
1184 * <tr><td>01 <td> wf_rfen_dr <td>R <td>W <td>0
1185 * <tr><td>00 <td> wf_rf_en_reg <td>R <td>W <td>0
1186 * </table>
1187 *
1188 * @{
1189 */
1190
1191 /// Address of the WFBT_RFEN_CTRL register
1192 #define WCNAON_WFBT_RFEN_CTRL_ADDR 0x40580018
1193 /// Offset of the WFBT_RFEN_CTRL register from the base address
1194 #define WCNAON_WFBT_RFEN_CTRL_OFFSET 0x00000018
1195 /// Index of the WFBT_RFEN_CTRL register
1196 #define WCNAON_WFBT_RFEN_CTRL_INDEX 0x00000006
1197 /// Reset value of the WFBT_RFEN_CTRL register
1198 #define WCNAON_WFBT_RFEN_CTRL_RESET 0x00000000
1199
1200 /**
1201 * @brief Sets the WFBT_RFEN_CTRL register to a value.
1202 * The WFBT_RFEN_CTRL register will be written.
1203 * @param value - The value to write.
1204 */
wcnaon_wfbt_rfen_ctrl_set(uint32_t value)1205 static inline void wcnaon_wfbt_rfen_ctrl_set(uint32_t value)
1206 {
1207 PLATFORM_REG_WRITE(WCNAON_WFBT_RFEN_CTRL_ADDR, value);
1208 }
1209
1210 // field definitions
1211 /// BT_RFEN_DR field bit
1212 #define WCNAON_BT_RFEN_DR_BIT ((uint32_t)0x00000008)
1213 /// BT_RFEN_DR field position
1214 #define WCNAON_BT_RFEN_DR_POS 3
1215 /// BT_RFEN_REG field bit
1216 #define WCNAON_BT_RFEN_REG_BIT ((uint32_t)0x00000004)
1217 /// BT_RFEN_REG field position
1218 #define WCNAON_BT_RFEN_REG_POS 2
1219 /// WF_RFEN_DR field bit
1220 #define WCNAON_WF_RFEN_DR_BIT ((uint32_t)0x00000002)
1221 /// WF_RFEN_DR field position
1222 #define WCNAON_WF_RFEN_DR_POS 1
1223 /// WF_RF_EN_REG field bit
1224 #define WCNAON_WF_RF_EN_REG_BIT ((uint32_t)0x00000001)
1225 /// WF_RF_EN_REG field position
1226 #define WCNAON_WF_RF_EN_REG_POS 0
1227
1228 /// BT_RFEN_DR field reset value
1229 #define WCNAON_BT_RFEN_DR_RST 0x0
1230 /// BT_RFEN_REG field reset value
1231 #define WCNAON_BT_RFEN_REG_RST 0x0
1232 /// WF_RFEN_DR field reset value
1233 #define WCNAON_WF_RFEN_DR_RST 0x0
1234 /// WF_RF_EN_REG field reset value
1235 #define WCNAON_WF_RF_EN_REG_RST 0x0
1236
1237 /**
1238 * @brief Constructs a value for the WFBT_RFEN_CTRL register given values for its fields
1239 * and writes the value to the register.
1240 *
1241 * @param[in] btrfendr - The value to use for the bt_rfen_dr field.
1242 * @param[in] btrfenreg - The value to use for the bt_rfen_reg field.
1243 * @param[in] wfrfendr - The value to use for the wf_rfen_dr field.
1244 * @param[in] wfrfenreg - The value to use for the wf_rf_en_reg field.
1245 */
wcnaon_wfbt_rfen_ctrl_pack(uint8_t btrfendr,uint8_t btrfenreg,uint8_t wfrfendr,uint8_t wfrfenreg)1246 static inline void wcnaon_wfbt_rfen_ctrl_pack(uint8_t btrfendr, uint8_t btrfenreg, uint8_t wfrfendr, uint8_t wfrfenreg)
1247 {
1248 PLATFORM_REG_WRITE(WCNAON_WFBT_RFEN_CTRL_ADDR, ((uint32_t)btrfendr << 3) | ((uint32_t)btrfenreg << 2) | ((uint32_t)wfrfendr << 1) | ((uint32_t)wfrfenreg << 0));
1249 }
1250
1251 /**
1252 * @brief Sets the bt_rfen_dr field of the WFBT_RFEN_CTRL register.
1253 *
1254 * The WFBT_RFEN_CTRL register will be read, modified to contain the new field value, and written.
1255 *
1256 * @param[in] btrfendr - The value to set the field to.
1257 */
wcnaon_bt_rfen_dr_setf(uint8_t btrfendr)1258 static inline void wcnaon_bt_rfen_dr_setf(uint8_t btrfendr)
1259 {
1260 PLATFORM_REG_WRITE(WCNAON_WFBT_RFEN_CTRL_ADDR, (PLATFORM_REG_READ(WCNAON_WFBT_RFEN_CTRL_ADDR) & ~((uint32_t)0x00000008)) | ((uint32_t)btrfendr << 3));
1261 }
1262
1263 /**
1264 * @brief Sets the bt_rfen_reg field of the WFBT_RFEN_CTRL register.
1265 *
1266 * The WFBT_RFEN_CTRL register will be read, modified to contain the new field value, and written.
1267 *
1268 * @param[in] btrfenreg - The value to set the field to.
1269 */
wcnaon_bt_rfen_reg_setf(uint8_t btrfenreg)1270 static inline void wcnaon_bt_rfen_reg_setf(uint8_t btrfenreg)
1271 {
1272 PLATFORM_REG_WRITE(WCNAON_WFBT_RFEN_CTRL_ADDR, (PLATFORM_REG_READ(WCNAON_WFBT_RFEN_CTRL_ADDR) & ~((uint32_t)0x00000004)) | ((uint32_t)btrfenreg << 2));
1273 }
1274
1275 /**
1276 * @brief Sets the wf_rfen_dr field of the WFBT_RFEN_CTRL register.
1277 *
1278 * The WFBT_RFEN_CTRL register will be read, modified to contain the new field value, and written.
1279 *
1280 * @param[in] wfrfendr - The value to set the field to.
1281 */
wcnaon_wf_rfen_dr_setf(uint8_t wfrfendr)1282 static inline void wcnaon_wf_rfen_dr_setf(uint8_t wfrfendr)
1283 {
1284 PLATFORM_REG_WRITE(WCNAON_WFBT_RFEN_CTRL_ADDR, (PLATFORM_REG_READ(WCNAON_WFBT_RFEN_CTRL_ADDR) & ~((uint32_t)0x00000002)) | ((uint32_t)wfrfendr << 1));
1285 }
1286
1287 /**
1288 * @brief Sets the wf_rf_en_reg field of the WFBT_RFEN_CTRL register.
1289 *
1290 * The WFBT_RFEN_CTRL register will be read, modified to contain the new field value, and written.
1291 *
1292 * @param[in] wfrfenreg - The value to set the field to.
1293 */
wcnaon_wf_rf_en_reg_setf(uint8_t wfrfenreg)1294 static inline void wcnaon_wf_rf_en_reg_setf(uint8_t wfrfenreg)
1295 {
1296 PLATFORM_REG_WRITE(WCNAON_WFBT_RFEN_CTRL_ADDR, (PLATFORM_REG_READ(WCNAON_WFBT_RFEN_CTRL_ADDR) & ~((uint32_t)0x00000001)) | ((uint32_t)wfrfenreg << 0));
1297 }
1298
1299 /// @}
1300
1301 /**
1302 * @name DEEPSLEEP_WAKEUP_IND register definitions
1303 * <table>
1304 * <caption id="DEEPSLEEP_WAKEUP_IND_BF">DEEPSLEEP_WAKEUP_IND bitfields</caption>
1305 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
1306 * <tr><td>31:04 <td> hw_eco <td>R <td>R/W <td>0x0
1307 * <tr><td>03:00 <td>deepsleep_wakeup_ind <td>R <td>R/W <td>0x0
1308 * </table>
1309 *
1310 * @{
1311 */
1312
1313 /// Address of the DEEPSLEEP_WAKEUP_IND register
1314 #define WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR 0x4058001C
1315 /// Offset of the DEEPSLEEP_WAKEUP_IND register from the base address
1316 #define WCNAON_DEEPSLEEP_WAKEUP_IND_OFFSET 0x0000001C
1317 /// Index of the DEEPSLEEP_WAKEUP_IND register
1318 #define WCNAON_DEEPSLEEP_WAKEUP_IND_INDEX 0x00000007
1319 /// Reset value of the DEEPSLEEP_WAKEUP_IND register
1320 #define WCNAON_DEEPSLEEP_WAKEUP_IND_RESET 0x00000000
1321
1322 /**
1323 * @brief Returns the current value of the DEEPSLEEP_WAKEUP_IND register.
1324 * The DEEPSLEEP_WAKEUP_IND register will be read and its value returned.
1325 * @return The current value of the DEEPSLEEP_WAKEUP_IND register.
1326 */
wcnaon_deepsleep_wakeup_ind_get(void)1327 static inline uint32_t wcnaon_deepsleep_wakeup_ind_get(void)
1328 {
1329 return PLATFORM_REG_READ(WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR);
1330 }
1331
1332 /**
1333 * @brief Sets the DEEPSLEEP_WAKEUP_IND register to a value.
1334 * The DEEPSLEEP_WAKEUP_IND register will be written.
1335 * @param value - The value to write.
1336 */
wcnaon_deepsleep_wakeup_ind_set(uint32_t value)1337 static inline void wcnaon_deepsleep_wakeup_ind_set(uint32_t value)
1338 {
1339 PLATFORM_REG_WRITE(WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR, value);
1340 }
1341
1342 // field definitions
1343 /// HW_ECO field mask
1344 #define WCNAON_HW_ECO_MASK ((uint32_t)0xFFFFFFF0)
1345 /// HW_ECO field LSB position
1346 #define WCNAON_HW_ECO_LSB 4
1347 /// HW_ECO field width
1348 #define WCNAON_HW_ECO_WIDTH ((uint32_t)0x0000001C)
1349 /// DEEPSLEEP_WAKEUP_IND field mask
1350 #define WCNAON_DEEPSLEEP_WAKEUP_IND_MASK ((uint32_t)0x0000000F)
1351 /// DEEPSLEEP_WAKEUP_IND field LSB position
1352 #define WCNAON_DEEPSLEEP_WAKEUP_IND_LSB 0
1353 /// DEEPSLEEP_WAKEUP_IND field width
1354 #define WCNAON_DEEPSLEEP_WAKEUP_IND_WIDTH ((uint32_t)0x00000004)
1355
1356 /// HW_ECO field reset value
1357 #define WCNAON_HW_ECO_RST 0x0
1358 /// DEEPSLEEP_WAKEUP_IND field reset value
1359 #define WCNAON_DEEPSLEEP_WAKEUP_IND_RST 0x0
1360
1361 /**
1362 * @brief Constructs a value for the DEEPSLEEP_WAKEUP_IND register given values for its fields
1363 * and writes the value to the register.
1364 *
1365 * @param[in] hweco - The value to use for the hw_eco field.
1366 * @param[in] deepsleepwakeupind - The value to use for the deepsleep_wakeup_ind field.
1367 */
wcnaon_deepsleep_wakeup_ind_pack(uint32_t hweco,uint8_t deepsleepwakeupind)1368 static inline void wcnaon_deepsleep_wakeup_ind_pack(uint32_t hweco, uint8_t deepsleepwakeupind)
1369 {
1370 PLATFORM_REG_WRITE(WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR, ((uint32_t)hweco << 4) | ((uint32_t)deepsleepwakeupind << 0));
1371 }
1372
1373 /**
1374 * @brief Unpacks DEEPSLEEP_WAKEUP_IND's fields from current value of the DEEPSLEEP_WAKEUP_IND register.
1375 *
1376 * Reads the DEEPSLEEP_WAKEUP_IND register and populates all the _field variables with the corresponding
1377 * values from the register.
1378 *
1379 * @param[out] hweco - Will be populated with the current value of this field from the register.
1380 * @param[out] deepsleepwakeupind - Will be populated with the current value of this field from the register.
1381 */
wcnaon_deepsleep_wakeup_ind_unpack(uint32_t * hweco,uint8_t * deepsleepwakeupind)1382 static inline void wcnaon_deepsleep_wakeup_ind_unpack(uint32_t* hweco, uint8_t* deepsleepwakeupind)
1383 {
1384 uint32_t localVal = PLATFORM_REG_READ(WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR);
1385
1386 *hweco = (localVal & ((uint32_t)0xFFFFFFF0)) >> 4;
1387 *deepsleepwakeupind = (localVal & ((uint32_t)0x0000000F)) >> 0;
1388 }
1389
1390 /**
1391 * @brief Returns the current value of the hw_eco field in the DEEPSLEEP_WAKEUP_IND register.
1392 *
1393 * The DEEPSLEEP_WAKEUP_IND register will be read and the hw_eco field's value will be returned.
1394 *
1395 * @return The current value of the hw_eco field in the DEEPSLEEP_WAKEUP_IND register.
1396 */
wcnaon_hw_eco_getf(void)1397 static inline uint32_t wcnaon_hw_eco_getf(void)
1398 {
1399 uint32_t localVal = PLATFORM_REG_READ(WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR);
1400 return ((localVal & ((uint32_t)0xFFFFFFF0)) >> 4);
1401 }
1402
1403 /**
1404 * @brief Sets the hw_eco field of the DEEPSLEEP_WAKEUP_IND register.
1405 *
1406 * The DEEPSLEEP_WAKEUP_IND register will be read, modified to contain the new field value, and written.
1407 *
1408 * @param[in] hweco - The value to set the field to.
1409 */
wcnaon_hw_eco_setf(uint32_t hweco)1410 static inline void wcnaon_hw_eco_setf(uint32_t hweco)
1411 {
1412 PLATFORM_REG_WRITE(WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR, (PLATFORM_REG_READ(WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR) & ~((uint32_t)0xFFFFFFF0)) | ((uint32_t)hweco << 4));
1413 }
1414
1415 /**
1416 * @brief Returns the current value of the deepsleep_wakeup_ind field in the DEEPSLEEP_WAKEUP_IND register.
1417 *
1418 * The DEEPSLEEP_WAKEUP_IND register will be read and the deepsleep_wakeup_ind field's value will be returned.
1419 *
1420 * @return The current value of the deepsleep_wakeup_ind field in the DEEPSLEEP_WAKEUP_IND register.
1421 */
wcnaon_deepsleep_wakeup_ind_getf(void)1422 static inline uint8_t wcnaon_deepsleep_wakeup_ind_getf(void)
1423 {
1424 uint32_t localVal = PLATFORM_REG_READ(WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR);
1425 return ((localVal & ((uint32_t)0x0000000F)) >> 0);
1426 }
1427
1428 /**
1429 * @brief Sets the deepsleep_wakeup_ind field of the DEEPSLEEP_WAKEUP_IND register.
1430 *
1431 * The DEEPSLEEP_WAKEUP_IND register will be read, modified to contain the new field value, and written.
1432 *
1433 * @param[in] deepsleepwakeupind - The value to set the field to.
1434 */
wcnaon_deepsleep_wakeup_ind_setf(uint8_t deepsleepwakeupind)1435 static inline void wcnaon_deepsleep_wakeup_ind_setf(uint8_t deepsleepwakeupind)
1436 {
1437 PLATFORM_REG_WRITE(WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR, (PLATFORM_REG_READ(WCNAON_DEEPSLEEP_WAKEUP_IND_ADDR) & ~((uint32_t)0x0000000F)) | ((uint32_t)deepsleepwakeupind << 0));
1438 }
1439
1440 /// @}
1441
1442 /**
1443 * @name MAXIM_SPI register definitions
1444 * <table>
1445 * <caption id="MAXIM_SPI_BF">MAXIM_SPI bitfields</caption>
1446 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
1447 * <tr><td>31 <td> START_DONE <td>C <td>S <td>0
1448 * <tr><td>24 <td> CS <td>R/W <td>R/W <td>0
1449 * <tr><td>23:20 <td> PRESCALER <td>R <td>R/W <td>0x0
1450 * <tr><td>19:16 <td> ADDRESS <td>R/W <td>R/W <td>0x0
1451 * <tr><td>13:00 <td> DATA <td>R/W <td>R/W <td>0x0
1452 * </table>
1453 *
1454 * @{
1455 */
1456
1457 /// Address of the MAXIM_SPI register
1458 #define WCNAON_MAXIM_SPI_ADDR 0x40580020
1459 /// Offset of the MAXIM_SPI register from the base address
1460 #define WCNAON_MAXIM_SPI_OFFSET 0x00000020
1461 /// Index of the MAXIM_SPI register
1462 #define WCNAON_MAXIM_SPI_INDEX 0x00000008
1463 /// Reset value of the MAXIM_SPI register
1464 #define WCNAON_MAXIM_SPI_RESET 0x00000000
1465
1466 /**
1467 * @brief Returns the current value of the MAXIM_SPI register.
1468 * The MAXIM_SPI register will be read and its value returned.
1469 * @return The current value of the MAXIM_SPI register.
1470 */
wcnaon_maxim_spi_get(void)1471 static inline uint32_t wcnaon_maxim_spi_get(void)
1472 {
1473 return PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR);
1474 }
1475
1476 /**
1477 * @brief Sets the MAXIM_SPI register to a value.
1478 * The MAXIM_SPI register will be written.
1479 * @param value - The value to write.
1480 */
wcnaon_maxim_spi_set(uint32_t value)1481 static inline void wcnaon_maxim_spi_set(uint32_t value)
1482 {
1483 PLATFORM_REG_WRITE(WCNAON_MAXIM_SPI_ADDR, value);
1484 }
1485
1486 // field definitions
1487 /// START_DONE field bit
1488 #define WCNAON_START_DONE_BIT ((uint32_t)0x80000000)
1489 /// START_DONE field position
1490 #define WCNAON_START_DONE_POS 31
1491 /// CS field bit
1492 #define WCNAON_CS_BIT ((uint32_t)0x01000000)
1493 /// CS field position
1494 #define WCNAON_CS_POS 24
1495 /// PRESCALER field mask
1496 #define WCNAON_PRESCALER_MASK ((uint32_t)0x00F00000)
1497 /// PRESCALER field LSB position
1498 #define WCNAON_PRESCALER_LSB 20
1499 /// PRESCALER field width
1500 #define WCNAON_PRESCALER_WIDTH ((uint32_t)0x00000004)
1501 /// ADDRESS field mask
1502 #define WCNAON_ADDRESS_MASK ((uint32_t)0x000F0000)
1503 /// ADDRESS field LSB position
1504 #define WCNAON_ADDRESS_LSB 16
1505 /// ADDRESS field width
1506 #define WCNAON_ADDRESS_WIDTH ((uint32_t)0x00000004)
1507 /// DATA field mask
1508 #define WCNAON_DATA_MASK ((uint32_t)0x00003FFF)
1509 /// DATA field LSB position
1510 #define WCNAON_DATA_LSB 0
1511 /// DATA field width
1512 #define WCNAON_DATA_WIDTH ((uint32_t)0x0000000E)
1513
1514 /// START_DONE field reset value
1515 #define WCNAON_START_DONE_RST 0x0
1516 /// CS field reset value
1517 #define WCNAON_CS_RST 0x0
1518 /// PRESCALER field reset value
1519 #define WCNAON_PRESCALER_RST 0x0
1520 /// ADDRESS field reset value
1521 #define WCNAON_ADDRESS_RST 0x0
1522 /// DATA field reset value
1523 #define WCNAON_DATA_RST 0x0
1524
1525 /**
1526 * @brief Constructs a value for the MAXIM_SPI register given values for its fields
1527 * and writes the value to the register.
1528 *
1529 * @param[in] startdone - The value to use for the START_DONE field.
1530 * @param[in] cs - The value to use for the CS field.
1531 * @param[in] prescaler - The value to use for the PRESCALER field.
1532 * @param[in] address - The value to use for the ADDRESS field.
1533 * @param[in] data - The value to use for the DATA field.
1534 */
wcnaon_maxim_spi_pack(uint8_t startdone,uint8_t cs,uint8_t prescaler,uint8_t address,uint16_t data)1535 static inline void wcnaon_maxim_spi_pack(uint8_t startdone, uint8_t cs, uint8_t prescaler, uint8_t address, uint16_t data)
1536 {
1537 PLATFORM_REG_WRITE(WCNAON_MAXIM_SPI_ADDR, ((uint32_t)startdone << 31) | ((uint32_t)cs << 24) | ((uint32_t)prescaler << 20) | ((uint32_t)address << 16) | ((uint32_t)data << 0));
1538 }
1539
1540 /**
1541 * @brief Unpacks MAXIM_SPI's fields from current value of the MAXIM_SPI register.
1542 *
1543 * Reads the MAXIM_SPI register and populates all the _field variables with the corresponding
1544 * values from the register.
1545 *
1546 * @param[out] startdone - Will be populated with the current value of this field from the register.
1547 * @param[out] cs - Will be populated with the current value of this field from the register.
1548 * @param[out] prescaler - Will be populated with the current value of this field from the register.
1549 * @param[out] address - Will be populated with the current value of this field from the register.
1550 * @param[out] data - Will be populated with the current value of this field from the register.
1551 */
wcnaon_maxim_spi_unpack(uint8_t * startdone,uint8_t * cs,uint8_t * prescaler,uint8_t * address,uint16_t * data)1552 static inline void wcnaon_maxim_spi_unpack(uint8_t* startdone, uint8_t* cs, uint8_t* prescaler, uint8_t* address, uint16_t* data)
1553 {
1554 uint32_t localVal = PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR);
1555
1556 *startdone = (localVal & ((uint32_t)0x80000000)) >> 31;
1557 *cs = (localVal & ((uint32_t)0x01000000)) >> 24;
1558 *prescaler = (localVal & ((uint32_t)0x00F00000)) >> 20;
1559 *address = (localVal & ((uint32_t)0x000F0000)) >> 16;
1560 *data = (localVal & ((uint32_t)0x00003FFF)) >> 0;
1561 }
1562
1563 /**
1564 * @brief Returns the current value of the START_DONE field in the MAXIM_SPI register.
1565 *
1566 * The MAXIM_SPI register will be read and the START_DONE field's value will be returned.
1567 *
1568 * @return The current value of the START_DONE field in the MAXIM_SPI register.
1569 */
wcnaon_start_done_getf(void)1570 static inline uint8_t wcnaon_start_done_getf(void)
1571 {
1572 uint32_t localVal = PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR);
1573 return ((localVal & ((uint32_t)0x80000000)) >> 31);
1574 }
1575
1576 /**
1577 * @brief Sets the START_DONE field of the MAXIM_SPI register.
1578 *
1579 * The MAXIM_SPI register will be read, modified to contain the new field value, and written.
1580 *
1581 * @param[in] startdone - The value to set the field to.
1582 */
wcnaon_start_done_setf(uint8_t startdone)1583 static inline void wcnaon_start_done_setf(uint8_t startdone)
1584 {
1585 PLATFORM_REG_WRITE(WCNAON_MAXIM_SPI_ADDR, (PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR) & ~((uint32_t)0x80000000)) | ((uint32_t)startdone << 31));
1586 }
1587
1588 /**
1589 * @brief Returns the current value of the CS field in the MAXIM_SPI register.
1590 *
1591 * The MAXIM_SPI register will be read and the CS field's value will be returned.
1592 *
1593 * @return The current value of the CS field in the MAXIM_SPI register.
1594 */
wcnaon_cs_getf(void)1595 static inline uint8_t wcnaon_cs_getf(void)
1596 {
1597 uint32_t localVal = PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR);
1598 return ((localVal & ((uint32_t)0x01000000)) >> 24);
1599 }
1600
1601 /**
1602 * @brief Sets the CS field of the MAXIM_SPI register.
1603 *
1604 * The MAXIM_SPI register will be read, modified to contain the new field value, and written.
1605 *
1606 * @param[in] cs - The value to set the field to.
1607 */
wcnaon_cs_setf(uint8_t cs)1608 static inline void wcnaon_cs_setf(uint8_t cs)
1609 {
1610 PLATFORM_REG_WRITE(WCNAON_MAXIM_SPI_ADDR, (PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR) & ~((uint32_t)0x01000000)) | ((uint32_t)cs << 24));
1611 }
1612
1613 /**
1614 * @brief Returns the current value of the PRESCALER field in the MAXIM_SPI register.
1615 *
1616 * The MAXIM_SPI register will be read and the PRESCALER field's value will be returned.
1617 *
1618 * @return The current value of the PRESCALER field in the MAXIM_SPI register.
1619 */
wcnaon_prescaler_getf(void)1620 static inline uint8_t wcnaon_prescaler_getf(void)
1621 {
1622 uint32_t localVal = PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR);
1623 return ((localVal & ((uint32_t)0x00F00000)) >> 20);
1624 }
1625
1626 /**
1627 * @brief Sets the PRESCALER field of the MAXIM_SPI register.
1628 *
1629 * The MAXIM_SPI register will be read, modified to contain the new field value, and written.
1630 *
1631 * @param[in] prescaler - The value to set the field to.
1632 */
wcnaon_prescaler_setf(uint8_t prescaler)1633 static inline void wcnaon_prescaler_setf(uint8_t prescaler)
1634 {
1635 PLATFORM_REG_WRITE(WCNAON_MAXIM_SPI_ADDR, (PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR) & ~((uint32_t)0x00F00000)) | ((uint32_t)prescaler << 20));
1636 }
1637
1638 /**
1639 * @brief Returns the current value of the ADDRESS field in the MAXIM_SPI register.
1640 *
1641 * The MAXIM_SPI register will be read and the ADDRESS field's value will be returned.
1642 *
1643 * @return The current value of the ADDRESS field in the MAXIM_SPI register.
1644 */
wcnaon_address_getf(void)1645 static inline uint8_t wcnaon_address_getf(void)
1646 {
1647 uint32_t localVal = PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR);
1648 return ((localVal & ((uint32_t)0x000F0000)) >> 16);
1649 }
1650
1651 /**
1652 * @brief Sets the ADDRESS field of the MAXIM_SPI register.
1653 *
1654 * The MAXIM_SPI register will be read, modified to contain the new field value, and written.
1655 *
1656 * @param[in] address - The value to set the field to.
1657 */
wcnaon_address_setf(uint8_t address)1658 static inline void wcnaon_address_setf(uint8_t address)
1659 {
1660 PLATFORM_REG_WRITE(WCNAON_MAXIM_SPI_ADDR, (PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR) & ~((uint32_t)0x000F0000)) | ((uint32_t)address << 16));
1661 }
1662
1663 /**
1664 * @brief Returns the current value of the DATA field in the MAXIM_SPI register.
1665 *
1666 * The MAXIM_SPI register will be read and the DATA field's value will be returned.
1667 *
1668 * @return The current value of the DATA field in the MAXIM_SPI register.
1669 */
wcnaon_data_getf(void)1670 static inline uint16_t wcnaon_data_getf(void)
1671 {
1672 uint32_t localVal = PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR);
1673 return ((localVal & ((uint32_t)0x00003FFF)) >> 0);
1674 }
1675
1676 /**
1677 * @brief Sets the DATA field of the MAXIM_SPI register.
1678 *
1679 * The MAXIM_SPI register will be read, modified to contain the new field value, and written.
1680 *
1681 * @param[in] data - The value to set the field to.
1682 */
wcnaon_data_setf(uint16_t data)1683 static inline void wcnaon_data_setf(uint16_t data)
1684 {
1685 PLATFORM_REG_WRITE(WCNAON_MAXIM_SPI_ADDR, (PLATFORM_REG_READ(WCNAON_MAXIM_SPI_ADDR) & ~((uint32_t)0x00003FFF)) | ((uint32_t)data << 0));
1686 }
1687
1688 /// @}
1689
1690 /**
1691 * @name CM_PU_CTRL register definitions
1692 * <table>
1693 * <caption id="CM_PU_CTRL_BF">CM_PU_CTRL bitfields</caption>
1694 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
1695 * <tr><td>11 <td> cm_pu_bbpll_dr <td>R <td>R/W <td>0
1696 * <tr><td>10 <td> cm_pu_bbpll_reg <td>R <td>R/W <td>0
1697 * </table>
1698 *
1699 * @{
1700 */
1701
1702 /// Address of the CM_PU_CTRL register
1703 #define WCNAON_CM_PU_CTRL_ADDR 0x40580100
1704 /// Offset of the CM_PU_CTRL register from the base address
1705 #define WCNAON_CM_PU_CTRL_OFFSET 0x00000100
1706 /// Index of the CM_PU_CTRL register
1707 #define WCNAON_CM_PU_CTRL_INDEX 0x00000040
1708 /// Reset value of the CM_PU_CTRL register
1709 #define WCNAON_CM_PU_CTRL_RESET 0x00000000
1710
1711 /**
1712 * @brief Returns the current value of the CM_PU_CTRL register.
1713 * The CM_PU_CTRL register will be read and its value returned.
1714 * @return The current value of the CM_PU_CTRL register.
1715 */
wcnaon_cm_pu_ctrl_get(void)1716 static inline uint32_t wcnaon_cm_pu_ctrl_get(void)
1717 {
1718 return PLATFORM_REG_READ(WCNAON_CM_PU_CTRL_ADDR);
1719 }
1720
1721 /**
1722 * @brief Sets the CM_PU_CTRL register to a value.
1723 * The CM_PU_CTRL register will be written.
1724 * @param value - The value to write.
1725 */
wcnaon_cm_pu_ctrl_set(uint32_t value)1726 static inline void wcnaon_cm_pu_ctrl_set(uint32_t value)
1727 {
1728 PLATFORM_REG_WRITE(WCNAON_CM_PU_CTRL_ADDR, value);
1729 }
1730
1731 // field definitions
1732 /// CM_PU_BBPLL_DR field bit
1733 #define WCNAON_CM_PU_BBPLL_DR_BIT ((uint32_t)0x00000800)
1734 /// CM_PU_BBPLL_DR field position
1735 #define WCNAON_CM_PU_BBPLL_DR_POS 11
1736 /// CM_PU_BBPLL_REG field bit
1737 #define WCNAON_CM_PU_BBPLL_REG_BIT ((uint32_t)0x00000400)
1738 /// CM_PU_BBPLL_REG field position
1739 #define WCNAON_CM_PU_BBPLL_REG_POS 10
1740
1741 /// CM_PU_BBPLL_DR field reset value
1742 #define WCNAON_CM_PU_BBPLL_DR_RST 0x0
1743 /// CM_PU_BBPLL_REG field reset value
1744 #define WCNAON_CM_PU_BBPLL_REG_RST 0x0
1745
1746 /**
1747 * @brief Constructs a value for the CM_PU_CTRL register given values for its fields
1748 * and writes the value to the register.
1749 *
1750 * @param[in] cmpubbplldr - The value to use for the cm_pu_bbpll_dr field.
1751 * @param[in] cmpubbpllreg - The value to use for the cm_pu_bbpll_reg field.
1752 */
wcnaon_cm_pu_ctrl_pack(uint8_t cmpubbplldr,uint8_t cmpubbpllreg)1753 static inline void wcnaon_cm_pu_ctrl_pack(uint8_t cmpubbplldr, uint8_t cmpubbpllreg)
1754 {
1755 PLATFORM_REG_WRITE(WCNAON_CM_PU_CTRL_ADDR, ((uint32_t)cmpubbplldr << 11) | ((uint32_t)cmpubbpllreg << 10));
1756 }
1757
1758 /**
1759 * @brief Unpacks CM_PU_CTRL's fields from current value of the CM_PU_CTRL register.
1760 *
1761 * Reads the CM_PU_CTRL register and populates all the _field variables with the corresponding
1762 * values from the register.
1763 *
1764 * @param[out] cmpubbplldr - Will be populated with the current value of this field from the register.
1765 * @param[out] cmpubbpllreg - Will be populated with the current value of this field from the register.
1766 */
wcnaon_cm_pu_ctrl_unpack(uint8_t * cmpubbplldr,uint8_t * cmpubbpllreg)1767 static inline void wcnaon_cm_pu_ctrl_unpack(uint8_t* cmpubbplldr, uint8_t* cmpubbpllreg)
1768 {
1769 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_PU_CTRL_ADDR);
1770
1771 *cmpubbplldr = (localVal & ((uint32_t)0x00000800)) >> 11;
1772 *cmpubbpllreg = (localVal & ((uint32_t)0x00000400)) >> 10;
1773 }
1774
1775 /**
1776 * @brief Returns the current value of the cm_pu_bbpll_dr field in the CM_PU_CTRL register.
1777 *
1778 * The CM_PU_CTRL register will be read and the cm_pu_bbpll_dr field's value will be returned.
1779 *
1780 * @return The current value of the cm_pu_bbpll_dr field in the CM_PU_CTRL register.
1781 */
wcnaon_cm_pu_bbpll_dr_getf(void)1782 static inline uint8_t wcnaon_cm_pu_bbpll_dr_getf(void)
1783 {
1784 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_PU_CTRL_ADDR);
1785 return ((localVal & ((uint32_t)0x00000800)) >> 11);
1786 }
1787
1788 /**
1789 * @brief Sets the cm_pu_bbpll_dr field of the CM_PU_CTRL register.
1790 *
1791 * The CM_PU_CTRL register will be read, modified to contain the new field value, and written.
1792 *
1793 * @param[in] cmpubbplldr - The value to set the field to.
1794 */
wcnaon_cm_pu_bbpll_dr_setf(uint8_t cmpubbplldr)1795 static inline void wcnaon_cm_pu_bbpll_dr_setf(uint8_t cmpubbplldr)
1796 {
1797 PLATFORM_REG_WRITE(WCNAON_CM_PU_CTRL_ADDR, (PLATFORM_REG_READ(WCNAON_CM_PU_CTRL_ADDR) & ~((uint32_t)0x00000800)) | ((uint32_t)cmpubbplldr << 11));
1798 }
1799
1800 /**
1801 * @brief Returns the current value of the cm_pu_bbpll_reg field in the CM_PU_CTRL register.
1802 *
1803 * The CM_PU_CTRL register will be read and the cm_pu_bbpll_reg field's value will be returned.
1804 *
1805 * @return The current value of the cm_pu_bbpll_reg field in the CM_PU_CTRL register.
1806 */
wcnaon_cm_pu_bbpll_reg_getf(void)1807 static inline uint8_t wcnaon_cm_pu_bbpll_reg_getf(void)
1808 {
1809 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_PU_CTRL_ADDR);
1810 return ((localVal & ((uint32_t)0x00000400)) >> 10);
1811 }
1812
1813 /**
1814 * @brief Sets the cm_pu_bbpll_reg field of the CM_PU_CTRL register.
1815 *
1816 * The CM_PU_CTRL register will be read, modified to contain the new field value, and written.
1817 *
1818 * @param[in] cmpubbpllreg - The value to set the field to.
1819 */
wcnaon_cm_pu_bbpll_reg_setf(uint8_t cmpubbpllreg)1820 static inline void wcnaon_cm_pu_bbpll_reg_setf(uint8_t cmpubbpllreg)
1821 {
1822 PLATFORM_REG_WRITE(WCNAON_CM_PU_CTRL_ADDR, (PLATFORM_REG_READ(WCNAON_CM_PU_CTRL_ADDR) & ~((uint32_t)0x00000400)) | ((uint32_t)cmpubbpllreg << 10));
1823 }
1824
1825 /// @}
1826
1827 /**
1828 * @name CM_MDLL_REG register definitions
1829 * <table>
1830 * <caption id="CM_MDLL_REG_BF">CM_MDLL_REG bitfields</caption>
1831 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
1832 * <tr><td>16 <td> cm_mdll_band_sel <td>R <td>R/W <td>0
1833 * <tr><td>15:13 <td> cm_mdll_band_bit <td>R <td>R/W <td>0x0
1834 * </table>
1835 *
1836 * @{
1837 */
1838
1839 /// Address of the CM_MDLL_REG register
1840 #define WCNAON_CM_MDLL_REG_ADDR 0x40580104
1841 /// Offset of the CM_MDLL_REG register from the base address
1842 #define WCNAON_CM_MDLL_REG_OFFSET 0x00000104
1843 /// Index of the CM_MDLL_REG register
1844 #define WCNAON_CM_MDLL_REG_INDEX 0x00000041
1845 /// Reset value of the CM_MDLL_REG register
1846 #define WCNAON_CM_MDLL_REG_RESET 0x00000000
1847
1848 /**
1849 * @brief Returns the current value of the CM_MDLL_REG register.
1850 * The CM_MDLL_REG register will be read and its value returned.
1851 * @return The current value of the CM_MDLL_REG register.
1852 */
wcnaon_cm_mdll_reg_get(void)1853 static inline uint32_t wcnaon_cm_mdll_reg_get(void)
1854 {
1855 return PLATFORM_REG_READ(WCNAON_CM_MDLL_REG_ADDR);
1856 }
1857
1858 /**
1859 * @brief Sets the CM_MDLL_REG register to a value.
1860 * The CM_MDLL_REG register will be written.
1861 * @param value - The value to write.
1862 */
wcnaon_cm_mdll_reg_set(uint32_t value)1863 static inline void wcnaon_cm_mdll_reg_set(uint32_t value)
1864 {
1865 PLATFORM_REG_WRITE(WCNAON_CM_MDLL_REG_ADDR, value);
1866 }
1867
1868 // field definitions
1869 /// CM_MDLL_BAND_SEL field bit
1870 #define WCNAON_CM_MDLL_BAND_SEL_BIT ((uint32_t)0x00010000)
1871 /// CM_MDLL_BAND_SEL field position
1872 #define WCNAON_CM_MDLL_BAND_SEL_POS 16
1873 /// CM_MDLL_BAND_BIT field mask
1874 #define WCNAON_CM_MDLL_BAND_BIT_MASK ((uint32_t)0x0000E000)
1875 /// CM_MDLL_BAND_BIT field LSB position
1876 #define WCNAON_CM_MDLL_BAND_BIT_LSB 13
1877 /// CM_MDLL_BAND_BIT field width
1878 #define WCNAON_CM_MDLL_BAND_BIT_WIDTH ((uint32_t)0x00000003)
1879
1880 /// CM_MDLL_BAND_SEL field reset value
1881 #define WCNAON_CM_MDLL_BAND_SEL_RST 0x0
1882 /// CM_MDLL_BAND_BIT field reset value
1883 #define WCNAON_CM_MDLL_BAND_BIT_RST 0x0
1884
1885 /**
1886 * @brief Constructs a value for the CM_MDLL_REG register given values for its fields
1887 * and writes the value to the register.
1888 *
1889 * @param[in] cmmdllbandsel - The value to use for the cm_mdll_band_sel field.
1890 * @param[in] cmmdllbandbit - The value to use for the cm_mdll_band_bit field.
1891 */
wcnaon_cm_mdll_reg_pack(uint8_t cmmdllbandsel,uint8_t cmmdllbandbit)1892 static inline void wcnaon_cm_mdll_reg_pack(uint8_t cmmdllbandsel, uint8_t cmmdllbandbit)
1893 {
1894 PLATFORM_REG_WRITE(WCNAON_CM_MDLL_REG_ADDR, ((uint32_t)cmmdllbandsel << 16) | ((uint32_t)cmmdllbandbit << 13));
1895 }
1896
1897 /**
1898 * @brief Unpacks CM_MDLL_REG's fields from current value of the CM_MDLL_REG register.
1899 *
1900 * Reads the CM_MDLL_REG register and populates all the _field variables with the corresponding
1901 * values from the register.
1902 *
1903 * @param[out] cmmdllbandsel - Will be populated with the current value of this field from the register.
1904 * @param[out] cmmdllbandbit - Will be populated with the current value of this field from the register.
1905 */
wcnaon_cm_mdll_reg_unpack(uint8_t * cmmdllbandsel,uint8_t * cmmdllbandbit)1906 static inline void wcnaon_cm_mdll_reg_unpack(uint8_t* cmmdllbandsel, uint8_t* cmmdllbandbit)
1907 {
1908 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_MDLL_REG_ADDR);
1909
1910 *cmmdllbandsel = (localVal & ((uint32_t)0x00010000)) >> 16;
1911 *cmmdllbandbit = (localVal & ((uint32_t)0x0000E000)) >> 13;
1912 }
1913
1914 /**
1915 * @brief Returns the current value of the cm_mdll_band_sel field in the CM_MDLL_REG register.
1916 *
1917 * The CM_MDLL_REG register will be read and the cm_mdll_band_sel field's value will be returned.
1918 *
1919 * @return The current value of the cm_mdll_band_sel field in the CM_MDLL_REG register.
1920 */
wcnaon_cm_mdll_band_sel_getf(void)1921 static inline uint8_t wcnaon_cm_mdll_band_sel_getf(void)
1922 {
1923 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_MDLL_REG_ADDR);
1924 return ((localVal & ((uint32_t)0x00010000)) >> 16);
1925 }
1926
1927 /**
1928 * @brief Sets the cm_mdll_band_sel field of the CM_MDLL_REG register.
1929 *
1930 * The CM_MDLL_REG register will be read, modified to contain the new field value, and written.
1931 *
1932 * @param[in] cmmdllbandsel - The value to set the field to.
1933 */
wcnaon_cm_mdll_band_sel_setf(uint8_t cmmdllbandsel)1934 static inline void wcnaon_cm_mdll_band_sel_setf(uint8_t cmmdllbandsel)
1935 {
1936 PLATFORM_REG_WRITE(WCNAON_CM_MDLL_REG_ADDR, (PLATFORM_REG_READ(WCNAON_CM_MDLL_REG_ADDR) & ~((uint32_t)0x00010000)) | ((uint32_t)cmmdllbandsel << 16));
1937 }
1938
1939 /**
1940 * @brief Returns the current value of the cm_mdll_band_bit field in the CM_MDLL_REG register.
1941 *
1942 * The CM_MDLL_REG register will be read and the cm_mdll_band_bit field's value will be returned.
1943 *
1944 * @return The current value of the cm_mdll_band_bit field in the CM_MDLL_REG register.
1945 */
wcnaon_cm_mdll_band_bit_getf(void)1946 static inline uint8_t wcnaon_cm_mdll_band_bit_getf(void)
1947 {
1948 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_MDLL_REG_ADDR);
1949 return ((localVal & ((uint32_t)0x0000E000)) >> 13);
1950 }
1951
1952 /**
1953 * @brief Sets the cm_mdll_band_bit field of the CM_MDLL_REG register.
1954 *
1955 * The CM_MDLL_REG register will be read, modified to contain the new field value, and written.
1956 *
1957 * @param[in] cmmdllbandbit - The value to set the field to.
1958 */
wcnaon_cm_mdll_band_bit_setf(uint8_t cmmdllbandbit)1959 static inline void wcnaon_cm_mdll_band_bit_setf(uint8_t cmmdllbandbit)
1960 {
1961 PLATFORM_REG_WRITE(WCNAON_CM_MDLL_REG_ADDR, (PLATFORM_REG_READ(WCNAON_CM_MDLL_REG_ADDR) & ~((uint32_t)0x0000E000)) | ((uint32_t)cmmdllbandbit << 13));
1962 }
1963
1964 /// @}
1965
1966 /**
1967 * @name CM_XTAL_REG register definitions
1968 * <table>
1969 * <caption id="CM_XTAL_REG_BF">CM_XTAL_REG bitfields</caption>
1970 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
1971 * <tr><td>12 <td>cm_xtal_buf_avdd_sel <td>R <td>R/W <td>0
1972 * <tr><td>03 <td> cm_xtal_out_en3 <td>R <td>R/W <td>0
1973 * <tr><td>01 <td> cm_xtal_out_en1 <td>R <td>R/W <td>0
1974 * <tr><td>00 <td> cm_xtal_out_en0 <td>R <td>R/W <td>0
1975 * </table>
1976 *
1977 * @{
1978 */
1979
1980 /// Address of the CM_XTAL_REG register
1981 #define WCNAON_CM_XTAL_REG_ADDR 0x40580108
1982 /// Offset of the CM_XTAL_REG register from the base address
1983 #define WCNAON_CM_XTAL_REG_OFFSET 0x00000108
1984 /// Index of the CM_XTAL_REG register
1985 #define WCNAON_CM_XTAL_REG_INDEX 0x00000042
1986 /// Reset value of the CM_XTAL_REG register
1987 #define WCNAON_CM_XTAL_REG_RESET 0x00000000
1988
1989 /**
1990 * @brief Returns the current value of the CM_XTAL_REG register.
1991 * The CM_XTAL_REG register will be read and its value returned.
1992 * @return The current value of the CM_XTAL_REG register.
1993 */
wcnaon_cm_xtal_reg_get(void)1994 static inline uint32_t wcnaon_cm_xtal_reg_get(void)
1995 {
1996 return PLATFORM_REG_READ(WCNAON_CM_XTAL_REG_ADDR);
1997 }
1998
1999 /**
2000 * @brief Sets the CM_XTAL_REG register to a value.
2001 * The CM_XTAL_REG register will be written.
2002 * @param value - The value to write.
2003 */
wcnaon_cm_xtal_reg_set(uint32_t value)2004 static inline void wcnaon_cm_xtal_reg_set(uint32_t value)
2005 {
2006 PLATFORM_REG_WRITE(WCNAON_CM_XTAL_REG_ADDR, value);
2007 }
2008
2009 // field definitions
2010 /// CM_XTAL_BUF_AVDD_SEL field bit
2011 #define WCNAON_CM_XTAL_BUF_AVDD_SEL_BIT ((uint32_t)0x00001000)
2012 /// CM_XTAL_BUF_AVDD_SEL field position
2013 #define WCNAON_CM_XTAL_BUF_AVDD_SEL_POS 12
2014 /// CM_XTAL_OUT_EN_3 field bit
2015 #define WCNAON_CM_XTAL_OUT_EN_3_BIT ((uint32_t)0x00000008)
2016 /// CM_XTAL_OUT_EN_3 field position
2017 #define WCNAON_CM_XTAL_OUT_EN_3_POS 3
2018 /// CM_XTAL_OUT_EN_1 field bit
2019 #define WCNAON_CM_XTAL_OUT_EN_1_BIT ((uint32_t)0x00000002)
2020 /// CM_XTAL_OUT_EN_1 field position
2021 #define WCNAON_CM_XTAL_OUT_EN_1_POS 1
2022 /// CM_XTAL_OUT_EN_0 field bit
2023 #define WCNAON_CM_XTAL_OUT_EN_0_BIT ((uint32_t)0x00000001)
2024 /// CM_XTAL_OUT_EN_0 field position
2025 #define WCNAON_CM_XTAL_OUT_EN_0_POS 0
2026
2027 /// CM_XTAL_BUF_AVDD_SEL field reset value
2028 #define WCNAON_CM_XTAL_BUF_AVDD_SEL_RST 0x0
2029 /// CM_XTAL_OUT_EN_3 field reset value
2030 #define WCNAON_CM_XTAL_OUT_EN_3_RST 0x0
2031 /// CM_XTAL_OUT_EN_1 field reset value
2032 #define WCNAON_CM_XTAL_OUT_EN_1_RST 0x0
2033 /// CM_XTAL_OUT_EN_0 field reset value
2034 #define WCNAON_CM_XTAL_OUT_EN_0_RST 0x0
2035
2036 /**
2037 * @brief Constructs a value for the CM_XTAL_REG register given values for its fields
2038 * and writes the value to the register.
2039 *
2040 * @param[in] cmxtalbufavddsel - The value to use for the cm_xtal_buf_avdd_sel field.
2041 * @param[in] cmxtalouten3 - The value to use for the cm_xtal_out_en3 field.
2042 * @param[in] cmxtalouten1 - The value to use for the cm_xtal_out_en1 field.
2043 * @param[in] cmxtalouten0 - The value to use for the cm_xtal_out_en0 field.
2044 */
wcnaon_cm_xtal_reg_pack(uint8_t cmxtalbufavddsel,uint8_t cmxtalouten3,uint8_t cmxtalouten1,uint8_t cmxtalouten0)2045 static inline void wcnaon_cm_xtal_reg_pack(uint8_t cmxtalbufavddsel, uint8_t cmxtalouten3, uint8_t cmxtalouten1, uint8_t cmxtalouten0)
2046 {
2047 PLATFORM_REG_WRITE(WCNAON_CM_XTAL_REG_ADDR, ((uint32_t)cmxtalbufavddsel << 12) | ((uint32_t)cmxtalouten3 << 3) | ((uint32_t)cmxtalouten1 << 1) | ((uint32_t)cmxtalouten0 << 0));
2048 }
2049
2050 /**
2051 * @brief Unpacks CM_XTAL_REG's fields from current value of the CM_XTAL_REG register.
2052 *
2053 * Reads the CM_XTAL_REG register and populates all the _field variables with the corresponding
2054 * values from the register.
2055 *
2056 * @param[out] cmxtalbufavddsel - Will be populated with the current value of this field from the register.
2057 * @param[out] cmxtalouten3 - Will be populated with the current value of this field from the register.
2058 * @param[out] cmxtalouten1 - Will be populated with the current value of this field from the register.
2059 * @param[out] cmxtalouten0 - Will be populated with the current value of this field from the register.
2060 */
wcnaon_cm_xtal_reg_unpack(uint8_t * cmxtalbufavddsel,uint8_t * cmxtalouten3,uint8_t * cmxtalouten1,uint8_t * cmxtalouten0)2061 static inline void wcnaon_cm_xtal_reg_unpack(uint8_t* cmxtalbufavddsel, uint8_t* cmxtalouten3, uint8_t* cmxtalouten1, uint8_t* cmxtalouten0)
2062 {
2063 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_XTAL_REG_ADDR);
2064
2065 *cmxtalbufavddsel = (localVal & ((uint32_t)0x00001000)) >> 12;
2066 *cmxtalouten3 = (localVal & ((uint32_t)0x00000008)) >> 3;
2067 *cmxtalouten1 = (localVal & ((uint32_t)0x00000002)) >> 1;
2068 *cmxtalouten0 = (localVal & ((uint32_t)0x00000001)) >> 0;
2069 }
2070
2071 /**
2072 * @brief Returns the current value of the cm_xtal_buf_avdd_sel field in the CM_XTAL_REG register.
2073 *
2074 * The CM_XTAL_REG register will be read and the cm_xtal_buf_avdd_sel field's value will be returned.
2075 *
2076 * @return The current value of the cm_xtal_buf_avdd_sel field in the CM_XTAL_REG register.
2077 */
wcnaon_cm_xtal_buf_avdd_sel_getf(void)2078 static inline uint8_t wcnaon_cm_xtal_buf_avdd_sel_getf(void)
2079 {
2080 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_XTAL_REG_ADDR);
2081 return ((localVal & ((uint32_t)0x00001000)) >> 12);
2082 }
2083
2084 /**
2085 * @brief Sets the cm_xtal_buf_avdd_sel field of the CM_XTAL_REG register.
2086 *
2087 * The CM_XTAL_REG register will be read, modified to contain the new field value, and written.
2088 *
2089 * @param[in] cmxtalbufavddsel - The value to set the field to.
2090 */
wcnaon_cm_xtal_buf_avdd_sel_setf(uint8_t cmxtalbufavddsel)2091 static inline void wcnaon_cm_xtal_buf_avdd_sel_setf(uint8_t cmxtalbufavddsel)
2092 {
2093 PLATFORM_REG_WRITE(WCNAON_CM_XTAL_REG_ADDR, (PLATFORM_REG_READ(WCNAON_CM_XTAL_REG_ADDR) & ~((uint32_t)0x00001000)) | ((uint32_t)cmxtalbufavddsel << 12));
2094 }
2095
2096 /**
2097 * @brief Returns the current value of the cm_xtal_out_en3 field in the CM_XTAL_REG register.
2098 *
2099 * The CM_XTAL_REG register will be read and the cm_xtal_out_en3 field's value will be returned.
2100 *
2101 * @return The current value of the cm_xtal_out_en3 field in the CM_XTAL_REG register.
2102 */
wcnaon_cm_xtal_out_en_3_getf(void)2103 static inline uint8_t wcnaon_cm_xtal_out_en_3_getf(void)
2104 {
2105 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_XTAL_REG_ADDR);
2106 return ((localVal & ((uint32_t)0x00000008)) >> 3);
2107 }
2108
2109 /**
2110 * @brief Sets the cm_xtal_out_en3 field of the CM_XTAL_REG register.
2111 *
2112 * The CM_XTAL_REG register will be read, modified to contain the new field value, and written.
2113 *
2114 * @param[in] cmxtalouten3 - The value to set the field to.
2115 */
wcnaon_cm_xtal_out_en_3_setf(uint8_t cmxtalouten3)2116 static inline void wcnaon_cm_xtal_out_en_3_setf(uint8_t cmxtalouten3)
2117 {
2118 PLATFORM_REG_WRITE(WCNAON_CM_XTAL_REG_ADDR, (PLATFORM_REG_READ(WCNAON_CM_XTAL_REG_ADDR) & ~((uint32_t)0x00000008)) | ((uint32_t)cmxtalouten3 << 3));
2119 }
2120
2121 /**
2122 * @brief Returns the current value of the cm_xtal_out_en1 field in the CM_XTAL_REG register.
2123 *
2124 * The CM_XTAL_REG register will be read and the cm_xtal_out_en1 field's value will be returned.
2125 *
2126 * @return The current value of the cm_xtal_out_en1 field in the CM_XTAL_REG register.
2127 */
wcnaon_cm_xtal_out_en_1_getf(void)2128 static inline uint8_t wcnaon_cm_xtal_out_en_1_getf(void)
2129 {
2130 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_XTAL_REG_ADDR);
2131 return ((localVal & ((uint32_t)0x00000002)) >> 1);
2132 }
2133
2134 /**
2135 * @brief Sets the cm_xtal_out_en1 field of the CM_XTAL_REG register.
2136 *
2137 * The CM_XTAL_REG register will be read, modified to contain the new field value, and written.
2138 *
2139 * @param[in] cmxtalouten1 - The value to set the field to.
2140 */
wcnaon_cm_xtal_out_en_1_setf(uint8_t cmxtalouten1)2141 static inline void wcnaon_cm_xtal_out_en_1_setf(uint8_t cmxtalouten1)
2142 {
2143 PLATFORM_REG_WRITE(WCNAON_CM_XTAL_REG_ADDR, (PLATFORM_REG_READ(WCNAON_CM_XTAL_REG_ADDR) & ~((uint32_t)0x00000002)) | ((uint32_t)cmxtalouten1 << 1));
2144 }
2145
2146 /**
2147 * @brief Returns the current value of the cm_xtal_out_en0 field in the CM_XTAL_REG register.
2148 *
2149 * The CM_XTAL_REG register will be read and the cm_xtal_out_en0 field's value will be returned.
2150 *
2151 * @return The current value of the cm_xtal_out_en0 field in the CM_XTAL_REG register.
2152 */
wcnaon_cm_xtal_out_en_0_getf(void)2153 static inline uint8_t wcnaon_cm_xtal_out_en_0_getf(void)
2154 {
2155 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_XTAL_REG_ADDR);
2156 return ((localVal & ((uint32_t)0x00000001)) >> 0);
2157 }
2158
2159 /**
2160 * @brief Sets the cm_xtal_out_en0 field of the CM_XTAL_REG register.
2161 *
2162 * The CM_XTAL_REG register will be read, modified to contain the new field value, and written.
2163 *
2164 * @param[in] cmxtalouten0 - The value to set the field to.
2165 */
wcnaon_cm_xtal_out_en_0_setf(uint8_t cmxtalouten0)2166 static inline void wcnaon_cm_xtal_out_en_0_setf(uint8_t cmxtalouten0)
2167 {
2168 PLATFORM_REG_WRITE(WCNAON_CM_XTAL_REG_ADDR, (PLATFORM_REG_READ(WCNAON_CM_XTAL_REG_ADDR) & ~((uint32_t)0x00000001)) | ((uint32_t)cmxtalouten0 << 0));
2169 }
2170
2171 /// @}
2172
2173 /**
2174 * @name CM_BBPLL_REG2 register definitions
2175 * <table>
2176 * <caption id="CM_BBPLL_REG2_BF">CM_BBPLL_REG2 bitfields</caption>
2177 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
2178 * <tr><td>20:19 <td> clk_vco_en <td>R <td>R/W <td>0x0
2179 * <tr><td>18:17 <td> clk_80m_en <td>R <td>R/W <td>0x0
2180 * <tr><td>02 <td> divlp5_en <td>R <td>R/W <td>0
2181 * <tr><td>01:00 <td> clk_divlp5_en <td>R <td>R/W <td>0x0
2182 * </table>
2183 *
2184 * @{
2185 */
2186
2187 /// Address of the CM_BBPLL_REG2 register
2188 #define WCNAON_CM_BBPLL_REG2_ADDR 0x40580110
2189 /// Offset of the CM_BBPLL_REG2 register from the base address
2190 #define WCNAON_CM_BBPLL_REG2_OFFSET 0x00000110
2191 /// Index of the CM_BBPLL_REG2 register
2192 #define WCNAON_CM_BBPLL_REG2_INDEX 0x00000044
2193 /// Reset value of the CM_BBPLL_REG2 register
2194 #define WCNAON_CM_BBPLL_REG2_RESET 0x00000000
2195
2196 /**
2197 * @brief Returns the current value of the CM_BBPLL_REG2 register.
2198 * The CM_BBPLL_REG2 register will be read and its value returned.
2199 * @return The current value of the CM_BBPLL_REG2 register.
2200 */
wcnaon_cm_bbpll_reg2_get(void)2201 static inline uint32_t wcnaon_cm_bbpll_reg2_get(void)
2202 {
2203 return PLATFORM_REG_READ(WCNAON_CM_BBPLL_REG2_ADDR);
2204 }
2205
2206 /**
2207 * @brief Sets the CM_BBPLL_REG2 register to a value.
2208 * The CM_BBPLL_REG2 register will be written.
2209 * @param value - The value to write.
2210 */
wcnaon_cm_bbpll_reg2_set(uint32_t value)2211 static inline void wcnaon_cm_bbpll_reg2_set(uint32_t value)
2212 {
2213 PLATFORM_REG_WRITE(WCNAON_CM_BBPLL_REG2_ADDR, value);
2214 }
2215
2216 // field definitions
2217 /// CLK_VCO_EN field mask
2218 #define WCNAON_CLK_VCO_EN_MASK ((uint32_t)0x00180000)
2219 /// CLK_VCO_EN field LSB position
2220 #define WCNAON_CLK_VCO_EN_LSB 19
2221 /// CLK_VCO_EN field width
2222 #define WCNAON_CLK_VCO_EN_WIDTH ((uint32_t)0x00000002)
2223 /// CLK__80M_EN field mask
2224 #define WCNAON_CLK__80M_EN_MASK ((uint32_t)0x00060000)
2225 /// CLK__80M_EN field LSB position
2226 #define WCNAON_CLK__80M_EN_LSB 17
2227 /// CLK__80M_EN field width
2228 #define WCNAON_CLK__80M_EN_WIDTH ((uint32_t)0x00000002)
2229 /// DIVLP_5_EN field bit
2230 #define WCNAON_DIVLP_5_EN_BIT ((uint32_t)0x00000004)
2231 /// DIVLP_5_EN field position
2232 #define WCNAON_DIVLP_5_EN_POS 2
2233 /// CLK_DIVLP_5_EN field mask
2234 #define WCNAON_CLK_DIVLP_5_EN_MASK ((uint32_t)0x00000003)
2235 /// CLK_DIVLP_5_EN field LSB position
2236 #define WCNAON_CLK_DIVLP_5_EN_LSB 0
2237 /// CLK_DIVLP_5_EN field width
2238 #define WCNAON_CLK_DIVLP_5_EN_WIDTH ((uint32_t)0x00000002)
2239
2240 /// CLK_VCO_EN field reset value
2241 #define WCNAON_CLK_VCO_EN_RST 0x0
2242 /// CLK__80M_EN field reset value
2243 #define WCNAON_CLK__80M_EN_RST 0x0
2244 /// DIVLP_5_EN field reset value
2245 #define WCNAON_DIVLP_5_EN_RST 0x0
2246 /// CLK_DIVLP_5_EN field reset value
2247 #define WCNAON_CLK_DIVLP_5_EN_RST 0x0
2248
2249 /**
2250 * @brief Constructs a value for the CM_BBPLL_REG2 register given values for its fields
2251 * and writes the value to the register.
2252 *
2253 * @param[in] clkvcoen - The value to use for the clk_vco_en field.
2254 * @param[in] clk80men - The value to use for the clk_80m_en field.
2255 * @param[in] divlp5en - The value to use for the divlp5_en field.
2256 * @param[in] clkdivlp5en - The value to use for the clk_divlp5_en field.
2257 */
wcnaon_cm_bbpll_reg2_pack(uint8_t clkvcoen,uint8_t clk80men,uint8_t divlp5en,uint8_t clkdivlp5en)2258 static inline void wcnaon_cm_bbpll_reg2_pack(uint8_t clkvcoen, uint8_t clk80men, uint8_t divlp5en, uint8_t clkdivlp5en)
2259 {
2260 PLATFORM_REG_WRITE(WCNAON_CM_BBPLL_REG2_ADDR, ((uint32_t)clkvcoen << 19) | ((uint32_t)clk80men << 17) | ((uint32_t)divlp5en << 2) | ((uint32_t)clkdivlp5en << 0));
2261 }
2262
2263 /**
2264 * @brief Unpacks CM_BBPLL_REG2's fields from current value of the CM_BBPLL_REG2 register.
2265 *
2266 * Reads the CM_BBPLL_REG2 register and populates all the _field variables with the corresponding
2267 * values from the register.
2268 *
2269 * @param[out] clkvcoen - Will be populated with the current value of this field from the register.
2270 * @param[out] clk80men - Will be populated with the current value of this field from the register.
2271 * @param[out] divlp5en - Will be populated with the current value of this field from the register.
2272 * @param[out] clkdivlp5en - Will be populated with the current value of this field from the register.
2273 */
wcnaon_cm_bbpll_reg2_unpack(uint8_t * clkvcoen,uint8_t * clk80men,uint8_t * divlp5en,uint8_t * clkdivlp5en)2274 static inline void wcnaon_cm_bbpll_reg2_unpack(uint8_t* clkvcoen, uint8_t* clk80men, uint8_t* divlp5en, uint8_t* clkdivlp5en)
2275 {
2276 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_BBPLL_REG2_ADDR);
2277
2278 *clkvcoen = (localVal & ((uint32_t)0x00180000)) >> 19;
2279 *clk80men = (localVal & ((uint32_t)0x00060000)) >> 17;
2280 *divlp5en = (localVal & ((uint32_t)0x00000004)) >> 2;
2281 *clkdivlp5en = (localVal & ((uint32_t)0x00000003)) >> 0;
2282 }
2283
2284 /**
2285 * @brief Returns the current value of the clk_vco_en field in the CM_BBPLL_REG2 register.
2286 *
2287 * The CM_BBPLL_REG2 register will be read and the clk_vco_en field's value will be returned.
2288 *
2289 * @return The current value of the clk_vco_en field in the CM_BBPLL_REG2 register.
2290 */
wcnaon_clk_vco_en_getf(void)2291 static inline uint8_t wcnaon_clk_vco_en_getf(void)
2292 {
2293 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_BBPLL_REG2_ADDR);
2294 return ((localVal & ((uint32_t)0x00180000)) >> 19);
2295 }
2296
2297 /**
2298 * @brief Sets the clk_vco_en field of the CM_BBPLL_REG2 register.
2299 *
2300 * The CM_BBPLL_REG2 register will be read, modified to contain the new field value, and written.
2301 *
2302 * @param[in] clkvcoen - The value to set the field to.
2303 */
wcnaon_clk_vco_en_setf(uint8_t clkvcoen)2304 static inline void wcnaon_clk_vco_en_setf(uint8_t clkvcoen)
2305 {
2306 PLATFORM_REG_WRITE(WCNAON_CM_BBPLL_REG2_ADDR, (PLATFORM_REG_READ(WCNAON_CM_BBPLL_REG2_ADDR) & ~((uint32_t)0x00180000)) | ((uint32_t)clkvcoen << 19));
2307 }
2308
2309 /**
2310 * @brief Returns the current value of the clk_80m_en field in the CM_BBPLL_REG2 register.
2311 *
2312 * The CM_BBPLL_REG2 register will be read and the clk_80m_en field's value will be returned.
2313 *
2314 * @return The current value of the clk_80m_en field in the CM_BBPLL_REG2 register.
2315 */
wcnaon_clk__80m_en_getf(void)2316 static inline uint8_t wcnaon_clk__80m_en_getf(void)
2317 {
2318 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_BBPLL_REG2_ADDR);
2319 return ((localVal & ((uint32_t)0x00060000)) >> 17);
2320 }
2321
2322 /**
2323 * @brief Sets the clk_80m_en field of the CM_BBPLL_REG2 register.
2324 *
2325 * The CM_BBPLL_REG2 register will be read, modified to contain the new field value, and written.
2326 *
2327 * @param[in] clk80men - The value to set the field to.
2328 */
wcnaon_clk__80m_en_setf(uint8_t clk80men)2329 static inline void wcnaon_clk__80m_en_setf(uint8_t clk80men)
2330 {
2331 PLATFORM_REG_WRITE(WCNAON_CM_BBPLL_REG2_ADDR, (PLATFORM_REG_READ(WCNAON_CM_BBPLL_REG2_ADDR) & ~((uint32_t)0x00060000)) | ((uint32_t)clk80men << 17));
2332 }
2333
2334 /**
2335 * @brief Returns the current value of the divlp5_en field in the CM_BBPLL_REG2 register.
2336 *
2337 * The CM_BBPLL_REG2 register will be read and the divlp5_en field's value will be returned.
2338 *
2339 * @return The current value of the divlp5_en field in the CM_BBPLL_REG2 register.
2340 */
wcnaon_divlp_5_en_getf(void)2341 static inline uint8_t wcnaon_divlp_5_en_getf(void)
2342 {
2343 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_BBPLL_REG2_ADDR);
2344 return ((localVal & ((uint32_t)0x00000004)) >> 2);
2345 }
2346
2347 /**
2348 * @brief Sets the divlp5_en field of the CM_BBPLL_REG2 register.
2349 *
2350 * The CM_BBPLL_REG2 register will be read, modified to contain the new field value, and written.
2351 *
2352 * @param[in] divlp5en - The value to set the field to.
2353 */
wcnaon_divlp_5_en_setf(uint8_t divlp5en)2354 static inline void wcnaon_divlp_5_en_setf(uint8_t divlp5en)
2355 {
2356 PLATFORM_REG_WRITE(WCNAON_CM_BBPLL_REG2_ADDR, (PLATFORM_REG_READ(WCNAON_CM_BBPLL_REG2_ADDR) & ~((uint32_t)0x00000004)) | ((uint32_t)divlp5en << 2));
2357 }
2358
2359 /**
2360 * @brief Returns the current value of the clk_divlp5_en field in the CM_BBPLL_REG2 register.
2361 *
2362 * The CM_BBPLL_REG2 register will be read and the clk_divlp5_en field's value will be returned.
2363 *
2364 * @return The current value of the clk_divlp5_en field in the CM_BBPLL_REG2 register.
2365 */
wcnaon_clk_divlp_5_en_getf(void)2366 static inline uint8_t wcnaon_clk_divlp_5_en_getf(void)
2367 {
2368 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_BBPLL_REG2_ADDR);
2369 return ((localVal & ((uint32_t)0x00000003)) >> 0);
2370 }
2371
2372 /**
2373 * @brief Sets the clk_divlp5_en field of the CM_BBPLL_REG2 register.
2374 *
2375 * The CM_BBPLL_REG2 register will be read, modified to contain the new field value, and written.
2376 *
2377 * @param[in] clkdivlp5en - The value to set the field to.
2378 */
wcnaon_clk_divlp_5_en_setf(uint8_t clkdivlp5en)2379 static inline void wcnaon_clk_divlp_5_en_setf(uint8_t clkdivlp5en)
2380 {
2381 PLATFORM_REG_WRITE(WCNAON_CM_BBPLL_REG2_ADDR, (PLATFORM_REG_READ(WCNAON_CM_BBPLL_REG2_ADDR) & ~((uint32_t)0x00000003)) | ((uint32_t)clkdivlp5en << 0));
2382 }
2383
2384 /// @}
2385
2386 /**
2387 * @name CM_BBPLL_CTRL register definitions
2388 * <table>
2389 * <caption id="CM_BBPLL_CTRL_BF">CM_BBPLL_CTRL bitfields</caption>
2390 * <tr><th>Bits <th>Field Name <th>HW Access <th>SW Access <th>Reset Value
2391 * <tr><td>24 <td> cm_rf_alwayson <td>R <td>R/W <td>0
2392 * </table>
2393 *
2394 * @{
2395 */
2396
2397 /// Address of the CM_BBPLL_CTRL register
2398 #define WCNAON_CM_BBPLL_CTRL_ADDR 0x40580120
2399 /// Offset of the CM_BBPLL_CTRL register from the base address
2400 #define WCNAON_CM_BBPLL_CTRL_OFFSET 0x00000120
2401 /// Index of the CM_BBPLL_CTRL register
2402 #define WCNAON_CM_BBPLL_CTRL_INDEX 0x00000048
2403 /// Reset value of the CM_BBPLL_CTRL register
2404 #define WCNAON_CM_BBPLL_CTRL_RESET 0x00000000
2405
2406 /**
2407 * @brief Returns the current value of the CM_BBPLL_CTRL register.
2408 * The CM_BBPLL_CTRL register will be read and its value returned.
2409 * @return The current value of the CM_BBPLL_CTRL register.
2410 */
wcnaon_cm_bbpll_ctrl_get(void)2411 static inline uint32_t wcnaon_cm_bbpll_ctrl_get(void)
2412 {
2413 return PLATFORM_REG_READ(WCNAON_CM_BBPLL_CTRL_ADDR);
2414 }
2415
2416 /**
2417 * @brief Sets the CM_BBPLL_CTRL register to a value.
2418 * The CM_BBPLL_CTRL register will be written.
2419 * @param value - The value to write.
2420 */
wcnaon_cm_bbpll_ctrl_set(uint32_t value)2421 static inline void wcnaon_cm_bbpll_ctrl_set(uint32_t value)
2422 {
2423 PLATFORM_REG_WRITE(WCNAON_CM_BBPLL_CTRL_ADDR, value);
2424 }
2425
2426 // field definitions
2427 /// CM_RF_ALWAYSON field bit
2428 #define WCNAON_CM_RF_ALWAYSON_BIT ((uint32_t)0x01000000)
2429 /// CM_RF_ALWAYSON field position
2430 #define WCNAON_CM_RF_ALWAYSON_POS 24
2431
2432 /// CM_RF_ALWAYSON field reset value
2433 #define WCNAON_CM_RF_ALWAYSON_RST 0x0
2434
2435 /**
2436 * @brief Returns the current value of the cm_rf_alwayson field in the CM_BBPLL_CTRL register.
2437 *
2438 * The CM_BBPLL_CTRL register will be read and the cm_rf_alwayson field's value will be returned.
2439 *
2440 * @return The current value of the cm_rf_alwayson field in the CM_BBPLL_CTRL register.
2441 */
wcnaon_cm_rf_alwayson_getf(void)2442 static inline uint8_t wcnaon_cm_rf_alwayson_getf(void)
2443 {
2444 uint32_t localVal = PLATFORM_REG_READ(WCNAON_CM_BBPLL_CTRL_ADDR);
2445 return (localVal >> 24);
2446 }
2447
2448 /**
2449 * @brief Sets the cm_rf_alwayson field of the CM_BBPLL_CTRL register.
2450 *
2451 * The CM_BBPLL_CTRL register will be read, modified to contain the new field value, and written.
2452 *
2453 * @param[in] cmrfalwayson - The value to set the field to.
2454 */
wcnaon_cm_rf_alwayson_setf(uint8_t cmrfalwayson)2455 static inline void wcnaon_cm_rf_alwayson_setf(uint8_t cmrfalwayson)
2456 {
2457 PLATFORM_REG_WRITE(WCNAON_CM_BBPLL_CTRL_ADDR, (uint32_t)cmrfalwayson << 24);
2458 }
2459
2460 /// @}
2461
2462
2463 #endif // _REG_WCNAON_H_
2464
2465 /// @}
2466
2467