1 /**
2  * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
3  *
4  *  SPDX-License-Identifier: Apache-2.0
5  */
6 #pragma once
7 
8 #include <stdint.h>
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 typedef union {
14     struct {
15         uint32_t clk_en:1;
16         uint32_t clk_debug_ena:1;
17         uint32_t reserved_2:30;
18     };
19     uint32_t val;
20 } modem_lpcon_test_conf_reg_t;
21 
22 typedef union {
23     struct {
24         uint32_t clk_lp_timer_sel_osc_slow:1;
25         uint32_t clk_lp_timer_sel_osc_fast:1;
26         uint32_t clk_lp_timer_sel_xtal:1;
27         uint32_t clk_lp_timer_sel_xtal32k:1;
28         uint32_t clk_lp_timer_div_num:12;
29         uint32_t reserved_16:16;
30     };
31     uint32_t val;
32 } modem_lpcon_lp_timer_conf_reg_t;
33 
34 typedef union {
35     struct {
36         uint32_t clk_coex_lp_sel_osc_slow:1;
37         uint32_t clk_coex_lp_sel_osc_fast:1;
38         uint32_t clk_coex_lp_sel_xtal:1;
39         uint32_t clk_coex_lp_sel_xtal32k:1;
40         uint32_t clk_coex_lp_div_num:12;
41         uint32_t reserved_16:16;
42     };
43     uint32_t val;
44 } modem_lpcon_coex_lp_clk_conf_reg_t;
45 
46 typedef union {
47     struct {
48         uint32_t clk_wifipwr_lp_sel_osc_slow:1;
49         uint32_t clk_wifipwr_lp_sel_osc_fast:1;
50         uint32_t clk_wifipwr_lp_sel_xtal:1;
51         uint32_t clk_wifipwr_lp_sel_xtal32k:1;
52         uint32_t clk_wifipwr_lp_div_num:12;
53         uint32_t reserved_16:16;
54     };
55     uint32_t val;
56 } modem_lpcon_wifi_lp_clk_conf_reg_t;
57 
58 typedef union {
59     struct {
60         uint32_t clk_i2c_mst_sel_160m:1;
61         uint32_t reserved_1:31;
62     };
63     uint32_t val;
64 } modem_lpcon_i2c_mst_clk_conf_reg_t;
65 
66 typedef union {
67     struct {
68         uint32_t clk_modem_32k_sel:2;
69         uint32_t reserved_2:30;
70     };
71     uint32_t val;
72 } modem_lpcon_modem_32k_clk_conf_reg_t;
73 
74 typedef union {
75     struct {
76         uint32_t clk_wifipwr_en:1;
77         uint32_t clk_coex_en:1;
78         uint32_t clk_i2c_mst_en:1;
79         uint32_t clk_lp_timer_en:1;
80         uint32_t reserved_4:28;
81     };
82     uint32_t val;
83 } modem_lpcon_clk_conf_reg_t;
84 
85 typedef union {
86     struct {
87         uint32_t clk_wifipwr_fo:1;
88         uint32_t clk_coex_fo:1;
89         uint32_t clk_i2c_mst_fo:1;
90         uint32_t clk_lp_timer_fo:1;
91         uint32_t clk_bcmem_fo:1;
92         uint32_t clk_i2c_mst_mem_fo:1;
93         uint32_t clk_chan_freq_mem_fo:1;
94         uint32_t clk_pbus_mem_fo:1;
95         uint32_t clk_agc_mem_fo:1;
96         uint32_t clk_dc_mem_fo:1;
97         uint32_t reserved_10:22;
98     };
99     uint32_t val;
100 } modem_lpcon_clk_conf_force_on_reg_t;
101 
102 typedef union {
103     struct {
104         uint32_t reserved_0:16;
105         uint32_t clk_wifipwr_st_map:4;
106         uint32_t clk_coex_st_map:4;
107         uint32_t clk_i2c_mst_st_map:4;
108         uint32_t clk_lp_apb_st_map:4;
109     };
110     uint32_t val;
111 } modem_lpcon_clk_conf_power_st_reg_t;
112 
113 typedef union {
114     struct {
115         uint32_t rst_wifipwr:1;
116         uint32_t rst_coex:1;
117         uint32_t rst_i2c_mst:1;
118         uint32_t rst_lp_timer:1;
119         uint32_t reserved_4:28;
120     };
121     uint32_t val;
122 } modem_lpcon_rst_conf_reg_t;
123 
124 typedef union {
125     struct {
126         uint32_t dc_mem_force_pu:1;
127         uint32_t dc_mem_force_pd:1;
128         uint32_t agc_mem_force_pu:1;
129         uint32_t agc_mem_force_pd:1;
130         uint32_t pbus_mem_force_pu:1;
131         uint32_t pbus_mem_force_pd:1;
132         uint32_t bc_mem_force_pu:1;
133         uint32_t bc_mem_force_pd:1;
134         uint32_t i2c_mst_mem_force_pu:1;
135         uint32_t i2c_mst_mem_force_pd:1;
136         uint32_t chan_freq_mem_force_pu:1;
137         uint32_t chan_freq_mem_force_pd:1;
138         uint32_t modem_pwr_mem_wp:3;
139         uint32_t modem_pwr_mem_wa:3;
140         uint32_t modem_pwr_mem_ra:2;
141         uint32_t reserved_20:12;
142     };
143     uint32_t val;
144 } modem_lpcon_mem_conf_reg_t;
145 
146 typedef union {
147     struct {
148         uint32_t date:28;
149         uint32_t reserved_28:4;
150     };
151     uint32_t val;
152 } modem_lpcon_date_reg_t;
153 
154 
155 typedef struct {
156     volatile modem_lpcon_test_conf_reg_t test_conf;
157     volatile modem_lpcon_lp_timer_conf_reg_t lp_timer_conf;
158     volatile modem_lpcon_coex_lp_clk_conf_reg_t coex_lp_clk_conf;
159     volatile modem_lpcon_wifi_lp_clk_conf_reg_t wifi_lp_clk_conf;
160     volatile modem_lpcon_i2c_mst_clk_conf_reg_t i2c_mst_clk_conf;
161     volatile modem_lpcon_modem_32k_clk_conf_reg_t modem_32k_clk_conf;
162     volatile modem_lpcon_clk_conf_reg_t clk_conf;
163     volatile modem_lpcon_clk_conf_force_on_reg_t clk_conf_force_on;
164     volatile modem_lpcon_clk_conf_power_st_reg_t clk_conf_power_st;
165     volatile modem_lpcon_rst_conf_reg_t rst_conf;
166     volatile modem_lpcon_mem_conf_reg_t mem_conf;
167     volatile modem_lpcon_date_reg_t date;
168 } modem_lpcon_dev_t;
169 
170 extern modem_lpcon_dev_t MODEM_LPCON;
171 
172 #ifndef __cplusplus
173 _Static_assert(sizeof(modem_lpcon_dev_t) == 0x30, "Invalid size of modem_lpcon_dev_t structure");
174 #endif
175 
176 #ifdef __cplusplus
177 }
178 #endif
179