1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 // 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 #ifndef _SOC_RTC_IO_STRUCT_H_ 15 #define _SOC_RTC_IO_STRUCT_H_ 16 17 #include <stdint.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 typedef volatile struct rtc_io_dev_s { 24 union { 25 struct { 26 uint32_t reserved0: 14; 27 uint32_t data:18; /*GPIO0~17 output value*/ 28 }; 29 uint32_t val; 30 } out; 31 union { 32 struct { 33 uint32_t reserved0: 14; 34 uint32_t w1ts:18; /*GPIO0~17 output value write 1 to set*/ 35 }; 36 uint32_t val; 37 } out_w1ts; 38 union { 39 struct { 40 uint32_t reserved0: 14; 41 uint32_t w1tc:18; /*GPIO0~17 output value write 1 to clear*/ 42 }; 43 uint32_t val; 44 } out_w1tc; 45 union { 46 struct { 47 uint32_t reserved0: 14; 48 uint32_t enable:18; /*GPIO0~17 output enable*/ 49 }; 50 uint32_t val; 51 } enable; 52 union { 53 struct { 54 uint32_t reserved0: 14; 55 uint32_t w1ts:18; /*GPIO0~17 output enable write 1 to set*/ 56 }; 57 uint32_t val; 58 } enable_w1ts; 59 union { 60 struct { 61 uint32_t reserved0: 14; 62 uint32_t w1tc:18; /*GPIO0~17 output enable write 1 to clear*/ 63 }; 64 uint32_t val; 65 } enable_w1tc; 66 union { 67 struct { 68 uint32_t reserved0: 14; 69 uint32_t status:18; /*GPIO0~17 interrupt status*/ 70 }; 71 uint32_t val; 72 } status; 73 union { 74 struct { 75 uint32_t reserved0: 14; 76 uint32_t w1ts:18; /*GPIO0~17 interrupt status write 1 to set*/ 77 }; 78 uint32_t val; 79 } status_w1ts; 80 union { 81 struct { 82 uint32_t reserved0: 14; 83 uint32_t w1tc:18; /*GPIO0~17 interrupt status write 1 to clear*/ 84 }; 85 uint32_t val; 86 } status_w1tc; 87 union { 88 struct { 89 uint32_t reserved0: 14; 90 uint32_t in:18; /*GPIO0~17 input value*/ 91 }; 92 uint32_t val; 93 } in_val; 94 union { 95 struct { 96 uint32_t reserved0: 2; 97 uint32_t pad_driver: 1; /*if set to 0: normal output if set to 1: open drain*/ 98 uint32_t reserved3: 4; 99 uint32_t int_type: 3; /*if set to 0: GPIO interrupt disable if set to 1: rising edge trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ 100 uint32_t wakeup_enable: 1; /*GPIO wake up enable only available in light sleep*/ 101 uint32_t reserved11: 21; 102 }; 103 uint32_t val; 104 } pin[18]; 105 union { 106 struct { 107 uint32_t sel0: 5; 108 uint32_t sel1: 5; 109 uint32_t sel2: 5; 110 uint32_t sel3: 5; 111 uint32_t sel4: 5; 112 uint32_t no_gating_12m: 1; 113 uint32_t reserved26: 6; 114 }; 115 uint32_t val; 116 } debug_sel; 117 uint32_t dig_pad_hold; /*select the digital pad hold value.*/ 118 union { 119 struct { 120 uint32_t reserved0: 30; 121 uint32_t hall_phase: 1; /*Reverse phase of hall sensor*/ 122 uint32_t xpd_hall: 1; /*Power on hall sensor and connect to VP and VN*/ 123 }; 124 uint32_t val; 125 } hall_sens; 126 union { 127 struct { 128 uint32_t reserved0: 4; 129 uint32_t sense4_fun_ie: 1; /*the input enable of the pad*/ 130 uint32_t sense4_slp_ie: 1; /*the input enable of the pad in sleep status*/ 131 uint32_t sense4_slp_sel: 1; /*the sleep status selection signal of the pad*/ 132 uint32_t sense4_fun_sel: 2; /*the functional selection signal of the pad*/ 133 uint32_t sense3_fun_ie: 1; /*the input enable of the pad*/ 134 uint32_t sense3_slp_ie: 1; /*the input enable of the pad in sleep status*/ 135 uint32_t sense3_slp_sel: 1; /*the sleep status selection signal of the pad*/ 136 uint32_t sense3_fun_sel: 2; /*the functional selection signal of the pad*/ 137 uint32_t sense2_fun_ie: 1; /*the input enable of the pad*/ 138 uint32_t sense2_slp_ie: 1; /*the input enable of the pad in sleep status*/ 139 uint32_t sense2_slp_sel: 1; /*the sleep status selection signal of the pad*/ 140 uint32_t sense2_fun_sel: 2; /*the functional selection signal of the pad*/ 141 uint32_t sense1_fun_ie: 1; /*the input enable of the pad*/ 142 uint32_t sense1_slp_ie: 1; /*the input enable of the pad in sleep status*/ 143 uint32_t sense1_slp_sel: 1; /*the sleep status selection signal of the pad*/ 144 uint32_t sense1_fun_sel: 2; /*the functional selection signal of the pad*/ 145 uint32_t sense4_mux_sel: 1; /*�1� select the digital function �0�slection the rtc function*/ 146 uint32_t sense3_mux_sel: 1; /*�1� select the digital function �0�slection the rtc function*/ 147 uint32_t sense2_mux_sel: 1; /*�1� select the digital function �0�slection the rtc function*/ 148 uint32_t sense1_mux_sel: 1; /*�1� select the digital function �0�slection the rtc function*/ 149 uint32_t sense4_hold: 1; /*hold the current value of the output when setting the hold to �1�*/ 150 uint32_t sense3_hold: 1; /*hold the current value of the output when setting the hold to �1�*/ 151 uint32_t sense2_hold: 1; /*hold the current value of the output when setting the hold to �1�*/ 152 uint32_t sense1_hold: 1; /*hold the current value of the output when setting the hold to �1�*/ 153 }; 154 uint32_t val; 155 } sensor_pads; 156 union { 157 struct { 158 uint32_t reserved0: 18; 159 uint32_t adc2_fun_ie: 1; /*the input enable of the pad*/ 160 uint32_t adc2_slp_ie: 1; /*the input enable of the pad in sleep status*/ 161 uint32_t adc2_slp_sel: 1; /*the sleep status selection signal of the pad*/ 162 uint32_t adc2_fun_sel: 2; /*the functional selection signal of the pad*/ 163 uint32_t adc1_fun_ie: 1; /*the input enable of the pad*/ 164 uint32_t adc1_slp_ie: 1; /*the input enable of the pad in sleep status*/ 165 uint32_t adc1_slp_sel: 1; /*the sleep status selection signal of the pad*/ 166 uint32_t adc1_fun_sel: 2; /*the functional selection signal of the pad*/ 167 uint32_t adc2_mux_sel: 1; /*�1� select the digital function �0�slection the rtc function*/ 168 uint32_t adc1_mux_sel: 1; /*�1� select the digital function �0�slection the rtc function*/ 169 uint32_t adc2_hold: 1; /*hold the current value of the output when setting the hold to �1�*/ 170 uint32_t adc1_hold: 1; /*hold the current value of the output when setting the hold to �1�*/ 171 }; 172 uint32_t val; 173 } adc_pad; 174 union { 175 struct { 176 uint32_t reserved0: 10; 177 uint32_t dac_xpd_force: 1; /*Power on DAC1. Usually we need to tristate PDAC1 if we power on the DAC i.e. IE=0 OE=0 RDE=0 RUE=0*/ 178 uint32_t fun_ie: 1; /*the input enable of the pad*/ 179 uint32_t slp_oe: 1; /*the output enable of the pad in sleep status*/ 180 uint32_t slp_ie: 1; /*the input enable of the pad in sleep status*/ 181 uint32_t slp_sel: 1; /*the sleep status selection signal of the pad*/ 182 uint32_t fun_sel: 2; /*the functional selection signal of the pad*/ 183 uint32_t mux_sel: 1; /*�1� select the digital function �0�slection the rtc function*/ 184 uint32_t xpd_dac: 1; /*Power on DAC1. Usually we need to tristate PDAC1 if we power on the DAC i.e. IE=0 OE=0 RDE=0 RUE=0*/ 185 uint32_t dac: 8; /*PAD DAC1 control code.*/ 186 uint32_t rue: 1; /*the pull up enable of the pad*/ 187 uint32_t rde: 1; /*the pull down enable of the pad*/ 188 uint32_t hold: 1; /*hold the current value of the output when setting the hold to �1�*/ 189 uint32_t drv: 2; /*the driver strength of the pad*/ 190 }; 191 uint32_t val; 192 } pad_dac[2]; 193 union { 194 struct { 195 uint32_t reserved0: 1; 196 uint32_t dbias_xtal_32k: 2; /*32K XTAL self-bias reference control.*/ 197 uint32_t dres_xtal_32k: 2; /*32K XTAL resistor bias control.*/ 198 uint32_t x32p_fun_ie: 1; /*the input enable of the pad*/ 199 uint32_t x32p_slp_oe: 1; /*the output enable of the pad in sleep status*/ 200 uint32_t x32p_slp_ie: 1; /*the input enable of the pad in sleep status*/ 201 uint32_t x32p_slp_sel: 1; /*the sleep status selection signal of the pad*/ 202 uint32_t x32p_fun_sel: 2; /*the functional selection signal of the pad*/ 203 uint32_t x32n_fun_ie: 1; /*the input enable of the pad*/ 204 uint32_t x32n_slp_oe: 1; /*the output enable of the pad in sleep status*/ 205 uint32_t x32n_slp_ie: 1; /*the input enable of the pad in sleep status*/ 206 uint32_t x32n_slp_sel: 1; /*the sleep status selection signal of the pad*/ 207 uint32_t x32n_fun_sel: 2; /*the functional selection signal of the pad*/ 208 uint32_t x32p_mux_sel: 1; /*�1� select the digital function �0�slection the rtc function*/ 209 uint32_t x32n_mux_sel: 1; /*�1� select the digital function �0�slection the rtc function*/ 210 uint32_t xpd_xtal_32k: 1; /*Power up 32kHz crystal oscillator*/ 211 uint32_t dac_xtal_32k: 2; /*32K XTAL bias current DAC.*/ 212 uint32_t x32p_rue: 1; /*the pull up enable of the pad*/ 213 uint32_t x32p_rde: 1; /*the pull down enable of the pad*/ 214 uint32_t x32p_hold: 1; /*hold the current value of the output when setting the hold to �1�*/ 215 uint32_t x32p_drv: 2; /*the driver strength of the pad*/ 216 uint32_t x32n_rue: 1; /*the pull up enable of the pad*/ 217 uint32_t x32n_rde: 1; /*the pull down enable of the pad*/ 218 uint32_t x32n_hold: 1; /*hold the current value of the output when setting the hold to �1�*/ 219 uint32_t x32n_drv: 2; /*the driver strength of the pad*/ 220 }; 221 uint32_t val; 222 } xtal_32k_pad; 223 union { 224 struct { 225 uint32_t reserved0: 23; 226 uint32_t dcur: 2; /*touch sensor bias current. Should have option to tie with BIAS_SLEEP(When BIAS_SLEEP this setting is available*/ 227 uint32_t drange: 2; /*touch sensor saw wave voltage range.*/ 228 uint32_t drefl: 2; /*touch sensor saw wave bottom voltage.*/ 229 uint32_t drefh: 2; /*touch sensor saw wave top voltage.*/ 230 uint32_t xpd_bias: 1; /*touch sensor bias power on.*/ 231 }; 232 uint32_t val; 233 } touch_cfg; 234 union { 235 struct { 236 uint32_t reserved0: 12; 237 uint32_t to_gpio: 1; /*connect the rtc pad input to digital pad input �0� is availbale GPIO4*/ 238 uint32_t fun_ie: 1; /*the input enable of the pad*/ 239 uint32_t slp_oe: 1; /*the output enable of the pad in sleep status*/ 240 uint32_t slp_ie: 1; /*the input enable of the pad in sleep status*/ 241 uint32_t slp_sel: 1; /*the sleep status selection signal of the pad*/ 242 uint32_t fun_sel: 2; /*the functional selection signal of the pad*/ 243 uint32_t mux_sel: 1; /*�1� select the digital function �0�slection the rtc function*/ 244 uint32_t xpd: 1; /*touch sensor power on.*/ 245 uint32_t tie_opt: 1; /*default touch sensor tie option. 0: tie low 1: tie high.*/ 246 uint32_t start: 1; /*start touch sensor.*/ 247 uint32_t dac: 3; /*touch sensor slope control. 3-bit for each touch panel default 100.*/ 248 uint32_t reserved26: 1; 249 uint32_t rue: 1; /*the pull up enable of the pad*/ 250 uint32_t rde: 1; /*the pull down enable of the pad*/ 251 uint32_t drv: 2; /*the driver strength of the pad*/ 252 uint32_t hold: 1; /*hold the current value of the output when setting the hold to �1�*/ 253 }; 254 uint32_t val; 255 } touch_pad[10]; 256 union { 257 struct { 258 uint32_t reserved0: 27; 259 uint32_t sel: 5; /*select the wakeup source �0� select GPIO0 �1� select GPIO2 ...�17� select GPIO17*/ 260 }; 261 uint32_t val; 262 } ext_wakeup0; 263 union { 264 struct { 265 uint32_t reserved0: 27; 266 uint32_t sel: 5; /*select the external xtl power source �0� select GPIO0 �1� select GPIO2 ...�17� select GPIO17*/ 267 }; 268 uint32_t val; 269 } xtl_ext_ctr; 270 union { 271 struct { 272 uint32_t reserved0: 23; 273 uint32_t debug_bit_sel: 5; 274 uint32_t scl_sel: 2; /*�0� using TOUCH_PAD[0] as i2c clk �1� using TOUCH_PAD[2] as i2c clk*/ 275 uint32_t sda_sel: 2; /*�0� using TOUCH_PAD[1] as i2c sda �1� using TOUCH_PAD[3] as i2c sda*/ 276 }; 277 uint32_t val; 278 } sar_i2c_io; 279 union { 280 struct { 281 uint32_t date: 28; /*date*/ 282 uint32_t reserved28: 4; 283 }; 284 uint32_t val; 285 } date; 286 } rtc_io_dev_t; 287 extern rtc_io_dev_t RTCIO; 288 289 #ifdef __cplusplus 290 } 291 #endif 292 293 #endif /* _SOC_RTC_IO_STRUCT_H_ */ 294