1 // Copyright 2019 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 15 #pragma once 16 17 #include "soc/soc.h" 18 //include soc related (generated) definitions 19 #include "soc/soc_caps.h" 20 21 #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED 22 #include "soc/rtc_io_channel.h" 23 #include "soc/rtc_io_reg.h" 24 #include "soc/rtc_io_struct.h" 25 #endif 26 27 #include "soc/rtc_cntl_reg.h" 28 #include "soc/rtc_cntl_struct.h" 29 30 #if SOC_ADC_RTC_CTRL_SUPPORTED 31 #include "soc/sens_struct.h" 32 #endif 33 34 #ifdef __cplusplus 35 extern "C" 36 { 37 #endif 38 39 #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED 40 41 /** 42 * @brief Pin function information for a single RTCIO pad's. 43 * 44 * This is an internal function of the driver, and is not usually useful 45 * for external use. 46 */ 47 typedef struct { 48 uint32_t reg; /*!< Register of RTC pad, or 0 if not an RTC GPIO */ 49 uint32_t mux; /*!< Bit mask for selecting digital pad or RTC pad */ 50 uint32_t func; /*!< Shift of pad function (FUN_SEL) field */ 51 uint32_t ie; /*!< Mask of input enable */ 52 uint32_t pullup; /*!< Mask of pullup enable */ 53 uint32_t pulldown; /*!< Mask of pulldown enable */ 54 uint32_t slpsel; /*!< If slpsel bit is set, slpie will be used as pad input enabled signal in sleep mode */ 55 uint32_t slpie; /*!< Mask of input enable in sleep mode */ 56 uint32_t slpoe; /*!< Mask of output enable in sleep mode */ 57 uint32_t hold; /*!< Mask of hold enable */ 58 uint32_t hold_force;/*!< Mask of hold_force bit for RTC IO in RTC_CNTL_HOLD_REG */ 59 uint32_t drv_v; /*!< Mask of drive capability */ 60 uint32_t drv_s; /*!< Offset of drive capability */ 61 int rtc_num; /*!< GPIO number (corresponds to RTC pad) */ 62 } rtc_io_desc_t; 63 64 /** 65 * @brief Provides access to a constant table of RTC I/O pin 66 * function information. 67 * The index of table is the index of rtcio. 68 * 69 * This is an internal function of the driver, and is not usually useful 70 * for external use. 71 */ 72 extern const rtc_io_desc_t rtc_io_desc[SOC_RTCIO_PIN_COUNT]; 73 74 /** 75 * @brief Provides a constant table to get rtc io number with gpio number 76 * 77 * This is an internal function of the driver, and is not usually useful 78 * for external use. 79 */ 80 extern const int rtc_io_num_map[SOC_GPIO_PIN_COUNT]; 81 82 #ifdef CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC 83 /** 84 * @brief Pin function information for a single GPIO pad's RTC functions. 85 * 86 * This is an internal function of the driver, and is not usually useful 87 * for external use. 88 */ 89 typedef struct { 90 uint32_t reg; /*!< Register of RTC pad, or 0 if not an RTC GPIO */ 91 uint32_t mux; /*!< Bit mask for selecting digital pad or RTC pad */ 92 uint32_t func; /*!< Shift of pad function (FUN_SEL) field */ 93 uint32_t ie; /*!< Mask of input enable */ 94 uint32_t pullup; /*!< Mask of pullup enable */ 95 uint32_t pulldown; /*!< Mask of pulldown enable */ 96 uint32_t slpsel; /*!< If slpsel bit is set, slpie will be used as pad input enabled signal in sleep mode */ 97 uint32_t slpie; /*!< Mask of input enable in sleep mode */ 98 uint32_t hold; /*!< Mask of hold enable */ 99 uint32_t hold_force;/*!< Mask of hold_force bit for RTC IO in RTC_CNTL_HOLD_FORCE_REG */ 100 uint32_t drv_v; /*!< Mask of drive capability */ 101 uint32_t drv_s; /*!< Offset of drive capability */ 102 int rtc_num; /*!< RTC IO number, or -1 if not an RTC GPIO */ 103 } rtc_gpio_desc_t; 104 105 /** 106 * @brief Provides access to a constant table of RTC I/O pin 107 * function information. 108 * 109 * This is an internal function of the driver, and is not usually useful 110 * for external use. 111 */ 112 extern const rtc_gpio_desc_t rtc_gpio_desc[SOC_GPIO_PIN_COUNT]; 113 114 #endif // CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC 115 116 #endif // SOC_RTCIO_INPUT_OUTPUT_SUPPORTED 117 118 #ifdef __cplusplus 119 } 120 #endif 121