1 /*
2  * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 
10 #include "soc/soc.h"
11 //include soc related (generated) definitions
12 #include "soc/soc_caps.h"
13 
14 #if SOC_RTCIO_PIN_COUNT > 0
15 #include "soc/rtc_io_channel.h"
16 #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
17 #include "soc/rtc_io_reg.h"
18 #include "soc/rtc_io_struct.h"
19 #endif
20 #endif
21 
22 #if SOC_ADC_RTC_CTRL_SUPPORTED
23 #include "soc/sens_struct.h"
24 #endif
25 
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
31 #if SOC_RTCIO_PIN_COUNT > 0
32 #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
33 /**
34  * @brief Pin function information for a single RTCIO pad's.
35  *
36  * This is an internal function of the driver, and is not usually useful
37  * for external use.
38  */
39 typedef struct {
40     uint32_t reg;       /*!< Register of RTC pad, or 0 if not an RTC GPIO */
41     uint32_t mux;       /*!< Bit mask for selecting digital pad or RTC pad */
42     uint32_t func;      /*!< Shift of pad function (FUN_SEL) field */
43     uint32_t ie;        /*!< Mask of input enable */
44     uint32_t pullup;    /*!< Mask of pullup enable */
45     uint32_t pulldown;  /*!< Mask of pulldown enable */
46     uint32_t slpsel;    /*!< If slpsel bit is set, slpie will be used as pad input enabled signal in sleep mode */
47     uint32_t slpie;     /*!< Mask of input enable in sleep mode */
48     uint32_t slpoe;     /*!< Mask of output enable in sleep mode */
49     uint32_t hold;      /*!< Mask of hold enable */
50     uint32_t hold_force;/*!< Mask of hold_force bit for RTC IO in RTC_CNTL_HOLD_REG */
51     uint32_t drv_v;     /*!< Mask of drive capability */
52     uint32_t drv_s;     /*!< Offset of drive capability */
53     int rtc_num;        /*!< GPIO number (corresponds to RTC pad) */
54 } rtc_io_desc_t;
55 
56 /**
57  * @brief Provides access to a constant table of RTC I/O pin
58  * function information.
59  * The index of table is the index of rtcio.
60  *
61  * This is an internal function of the driver, and is not usually useful
62  * for external use.
63  */
64 extern const rtc_io_desc_t rtc_io_desc[SOC_RTCIO_PIN_COUNT];
65 #endif // SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
66 
67 /**
68  * @brief Provides a constant table to get rtc io number with gpio number
69  *
70  * This is an internal function of the driver, and is not usually useful
71  * for external use.
72  */
73 extern const int rtc_io_num_map[SOC_GPIO_PIN_COUNT];
74 #endif //SOC_RTCIO_PIN_COUNT > 0
75 
76 #ifdef __cplusplus
77 }
78 #endif
79