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 #ifndef _CS1000AUD_RTC_CORE_H_ 16 #define _CS1000AUD_RTC_CORE_H_ 17 18 #include "chip.h" 19 20 // ============================================================================= 21 // MACROS 22 // ============================================================================= 23 24 // ============================================================================= 25 // TYPES 26 // ============================================================================= 27 28 // ============================================================================= 29 // CS1000AUD_RTC_CORE_T 30 // ----------------------------------------------------------------------------- 31 /// 32 // ============================================================================= 33 #define REG_CS1000AUD_RTC_CORE_BASE 0x50018800 34 35 typedef struct { 36 __IO uint32_t rtc_rg_clk_cfg1; //0x00000000 37 __IO uint32_t rtc_rg_por_ctrl_cfg0; //0x00000004 38 __IO uint32_t rtc_rg_dcdc_rf_cfg1; //0x00000008 39 __IO uint32_t rtc_rg_por_ctrl_cfg1; //0x0000000C 40 __IO uint32_t rtc_rg_por_ctrl_cfg2; //0x00000010 41 __IO uint32_t rtc_rg_other_ctrl_cfg1; //0x00000014 42 __IO uint32_t rtc_rg_other_ctrl_cfg2; //0x00000018 43 __IO uint32_t rtc_rg_por_seq_num_cfg1; //0x0000001C 44 __IO uint32_t rtc_rg_por_seq_num_cfg2; //0x00000020 45 __IO uint32_t rtc_rg_por_seq_num_cfg3; //0x00000024 46 __IO uint32_t rtc_rg_other_ctrl_cfg3; //0x00000028 47 __IO uint32_t rtc_rg_int_irq; //0x0000002C 48 __IO uint32_t rtc_rg_pwr_cfg; //0x00000030 49 __IO uint32_t rtc_rg_ldo_avdd33_cfg; //0x00000034 50 __IO uint32_t Reserved_00000038[2]; //0x00000038 51 __IO uint32_t rtc_rg_reserved0; //0x00000040 52 __IO uint32_t rtc_rg_reserved1; //0x00000044 53 __IO uint32_t rtc_rg_reserved2; //0x00000048 54 __IO uint32_t rtc_rg_reserved3; //0x0000004C 55 __IO uint32_t rtc_rg_reserved4; //0x00000050 56 __IO uint32_t rtc_rg_reserved5; //0x00000054 57 __IO uint32_t rtc_rg_reserved6; //0x00000058 58 __IO uint32_t rtc_rg_reserved7; //0x0000005C 59 } HWP_CS1000AUD_RTC_CORE_T; 60 61 static HWP_CS1000AUD_RTC_CORE_T * const cs1000audRtcCore = ((HWP_CS1000AUD_RTC_CORE_T *)REG_CS1000AUD_RTC_CORE_BASE); 62 63 64 //rtc_rg_clk_cfg1 65 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_CAP_LP_BIT(n) (((n)&31)<<0) 66 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_CAP_NOR_DELTA(n) (((n)&0x3F)<<5) 67 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_CAP_NOR_BIT(n) (((n)&31)<<11) 68 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_CAP_STEP(n) (((n)&0x3F)<<16) 69 #define CS1000AUD_RTC_CORE_RTC_RG_LPO256K_TEMP_COEF_BIT(n) (((n)&15)<<22) 70 #define CS1000AUD_RTC_CORE_RTC_RG_LPO256K_CLK_SEL (1<<26) 71 #define CS1000AUD_RTC_CORE_RTC_RG_CLK_128K_OUT_EN_SW_MODE (1<<27) 72 #define CS1000AUD_RTC_CORE_RTC_RG_CLK_128K_OUT_EN_SW_SET (1<<28) 73 #define CS1000AUD_RTC_CORE_RTC_RG_POR_CLK32K_FBIT(n) (((n)&7)<<29) 74 75 //rtc_rg_por_ctrl_cfg0 76 #define CS1000AUD_RTC_CORE_RTC_RG_BG_TRIM(n) (((n)&7)<<0) 77 #define CS1000AUD_RTC_CORE_RTC_RG_POR_EN_VIOULP30_CLAMP (1<<3) 78 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_PA_CTRL_VLOW (1<<4) 79 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_PA_EN_MORE_SOFTLIMIT_VRTC (1<<5) 80 #define CS1000AUD_RTC_CORE_RTC_RG_RTC_CNT_CLK_RC_32K_SEL (1<<6) 81 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_CAP_LP_DELTA(n) (((n)&0x3F)<<7) 82 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_CAP_RF_ON_DELTA(n) (((n)&0x3F)<<13) 83 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_CAP_RF_ON_BIT(n) (((n)&31)<<19) 84 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_IBIAS_RF_ON_BIT(n) (((n)&31)<<24) 85 #define CS1000AUD_RTC_CORE_RTC_XTAL_CAP_STAB (1<<29) 86 #define CS1000AUD_RTC_CORE_RTC_XTAL_IBIAS_STAB (1<<30) 87 88 //rtc_rg_dcdc_rf_cfg1 89 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_MORE_P (1<<1) 90 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_NOR_VBIT_NOR_SW(n) (((n)&15)<<2) 91 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_VBIT_NOR_TUNE(n) (((n)&15)<<6) 92 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_VBIT_DS_SW(n) (((n)&15)<<10) 93 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_VBIT_AVDD12(n) (((n)&3)<<14) 94 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_VREF_SOURCE_INT (1<<16) 95 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_ADD_I_LIMIT (1<<17) 96 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_LESS_SOFTTIME(n) (((n)&3)<<18) 97 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_IBIT_LDO_LIMIT (1<<20) 98 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_PFM_THRESHOLD(n) (((n)&3)<<21) 99 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_CTRL_VLOW (1<<23) 100 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_EN_CURRENT_LIMIT (1<<24) 101 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_DISCHARGE_ENB (1<<25) 102 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_PFM_MODE_SEL (1<<26) 103 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_REDUCE_I_LIMIT (1<<27) 104 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_CLK_DETVO_LP_DIV(n) (((n)&3)<<28) 105 #define CS1000AUD_RTC_CORE_RTC_RG_PU_DCDC_RF_AVDDRF (1<<30) 106 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_RDY (1<<31) 107 108 //rtc_rg_por_ctrl_cfg1 109 #define CS1000AUD_RTC_CORE_RTC_RG_POR_VRTC_VBIT (1<<0) 110 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_DCDC_MODE_SEL (1<<1) 111 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_PA_DCDC_MODE_SEL (1<<2) 112 #define CS1000AUD_RTC_CORE_RTC_RG_POR_MS_VBIT(n) (((n)&3)<<3) 113 #define CS1000AUD_RTC_CORE_RTC_RG_PU_VBAT_SENSE (1<<5) 114 #define CS1000AUD_RTC_CORE_RTC_RG_UVLO0_EN (1<<6) 115 #define CS1000AUD_RTC_CORE_RTC_RG_UVLO0_VBIT(n) (((n)&15)<<7) 116 #define CS1000AUD_RTC_CORE_RTC_RG_WDG_RSTN_PD_EN (1<<11) 117 #define CS1000AUD_RTC_CORE_RTC_RG_BOR_VBAT_SEL_BIT (1<<12) 118 #define CS1000AUD_RTC_CORE_RTC_RG_LDO_VRTC09_DISABLE_CLK (1<<13) 119 #define CS1000AUD_RTC_CORE_RTC_RG_LVL_PULLR_ENB (1<<14) 120 #define CS1000AUD_RTC_CORE_RTC_RG_POR_EN_VRTC_CLAMP (1<<15) 121 #define CS1000AUD_RTC_CORE_RTC_RG_POR_EN_VIOULP_CLAMP (1<<16) 122 #define CS1000AUD_RTC_CORE_RTC_RG_PU_VRTC_SENSE (1<<17) 123 #define CS1000AUD_RTC_CORE_RTC_RG_BOR_EN (1<<18) 124 #define CS1000AUD_RTC_CORE_RTC_RG_BOR_VBIT(n) (((n)&15)<<19) 125 #define CS1000AUD_RTC_CORE_RTC_RG_PD_RC256K_PWR_PD_EN (1<<23) 126 #define CS1000AUD_RTC_CORE_RTC_RG_LDO_VCORE09_PU_EN (1<<24) 127 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_VCORE09_PU_EN (1<<25) 128 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_PA_LDO_MODE_EN (1<<26) 129 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_LDO_MODE_EN (1<<27) 130 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO_CFG(n) (((n)&15)<<28) 131 132 //rtc_rg_por_ctrl_cfg2 133 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO27_MUX0_EN(n) (((n)&0x3F)<<0) 134 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO27_MUX1_EN(n) (((n)&0x3F)<<6) 135 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO27_MUX2_EN(n) (((n)&0x3F)<<12) 136 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO27_PULL_DN(n) (((n)&0x3F)<<18) 137 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO27_PULL_UP(n) (((n)&0x3F)<<24) 138 #define CS1000AUD_RTC_CORE_RTC_RG_AON_GPIO_PWR_ON_EN (1<<30) 139 #define CS1000AUD_RTC_CORE_RTC_RG_POR_EN_MSDET_DEGLITCH (1<<31) 140 141 //rtc_rg_other_ctrl_cfg1 142 #define CS1000AUD_RTC_CORE_RTC_RG_RESETN_RTC_CNT (1<<0) 143 #define CS1000AUD_RTC_CORE_RTC_RG_PRESETN_RTC_CNT (1<<1) 144 #define CS1000AUD_RTC_CORE_RTC_RG_ALM_POWER_ON_EN (1<<2) 145 #define CS1000AUD_RTC_CORE_RTC_RG_REPOWER_BOR_EN (1<<3) 146 #define CS1000AUD_RTC_CORE_RTC_RG_DEEP_SLEEP_AWAKE_EN(n) (((n)&15)<<4) 147 #define CS1000AUD_RTC_CORE_RTC_RG_REPOWER_WDG_EN (1<<8) 148 #define CS1000AUD_RTC_CORE_RTC_RG_WDG_RST_RTC_RF_EN (1<<9) 149 #define CS1000AUD_RTC_CORE_RTC_RG_BOR_EN_PWR_PD (1<<10) 150 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO_SLEW_RATE_D(n) (((n)&15)<<11) 151 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO_IBIT_D (1<<15) 152 #define CS1000AUD_RTC_CORE_RTC_RG_PRESETN_TWS_UART (1<<16) 153 #define CS1000AUD_RTC_CORE_RTC_RG_RESETN_TWS_UART (1<<17) 154 #define CS1000AUD_RTC_CORE_RTC_RG_TEST_EN_DCDC_RF (1<<19) 155 #define CS1000AUD_RTC_CORE_RTC_RG_AVDD_SENSE_EN_V33V18V13 (1<<20) 156 #define CS1000AUD_RTC_CORE_RTC_RG_MS_VIO_RO (1<<21) 157 #define CS1000AUD_RTC_CORE_RTC_RG_TEST_EN_OSC13M (1<<22) 158 #define CS1000AUD_RTC_CORE_RTC_RG_TEST_EN_USB (1<<23) 159 #define CS1000AUD_RTC_CORE_RTC_RG_TWS_MAIN_RESETN_EN (1<<24) 160 #define CS1000AUD_RTC_CORE_RTC_RG_TWS_PMIC_RESETN_EN (1<<25) 161 #define CS1000AUD_RTC_CORE_RTC_RG_TWS_UART_POWER_ON_EN (1<<26) 162 #define CS1000AUD_RTC_CORE_RTC_RG_LED0_MODE (1<<28) 163 #define CS1000AUD_RTC_CORE_RTC_RG_LED1_MODE (1<<29) 164 #define CS1000AUD_RTC_CORE_RTC_RG_POR_VBIT_VIO30(n) (((n)&3)<<30) 165 166 //rtc_rg_other_ctrl_cfg2 167 #define CS1000AUD_RTC_CORE_A2D_RTC_MS_VBAT (1<<12) 168 #define CS1000AUD_RTC_CORE_RTC_RG_DEVICE_ID_CFG(n) (((n)&7)<<13) 169 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_IBIAS_STEP(n) (((n)&0x3F)<<16) 170 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_IBIAS_LP_BIT(n) (((n)&31)<<22) 171 #define CS1000AUD_RTC_CORE_RTC_RG_XTAL_IBIAS_NOR_BIT(n) (((n)&31)<<27) 172 173 //rtc_rg_por_seq_num_cfg1 174 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_PU_SEQ_NUM(n) (((n)&31)<<0) 175 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_VCORE09_PU_SEQ_NUM(n) (((n)&31)<<5) 176 #define CS1000AUD_RTC_CORE_RTC_RG_LDO_PA_PU_SEQ_NUM(n) (((n)&31)<<10) 177 #define CS1000AUD_RTC_CORE_RTC_RG_AVDD18_PU_SEQ_NUM(n) (((n)&31)<<15) 178 #define CS1000AUD_RTC_CORE_RTC_RG_PU_USB_SEQ_NUM(n) (((n)&31)<<20) 179 #define CS1000AUD_RTC_CORE_RTC_RG_USBPLL_CLK_EN_SEQ_NUM(n) (((n)&31)<<25) 180 #define CS1000AUD_RTC_CORE_RTC_RG_DEVICE_HYS_PFM_MODE_EN (1<<30) 181 #define CS1000AUD_RTC_CORE_RTC_RG_DEVICE_PU_DCDC_RF_SEQ_EN (1<<31) 182 183 //rtc_rg_por_seq_num_cfg2 184 #define CS1000AUD_RTC_CORE_RTC_RG_XEN_EN_SEQ_NUM(n) (((n)&31)<<0) 185 #define CS1000AUD_RTC_CORE_RTC_RG_RESET_B_SEQ_NUM(n) (((n)&31)<<5) 186 #define CS1000AUD_RTC_CORE_RTC_RG_SLP_XEN_EN_SEQ_NUM(n) (((n)&31)<<10) 187 #define CS1000AUD_RTC_CORE_RTC_RG_SLP_RESET_B_SEQ_NUM(n) (((n)&31)<<15) 188 #define CS1000AUD_RTC_CORE_RTC_RG_VBAT_RSTN_TH(n) (((n)&0xFF)<<20) 189 #define CS1000AUD_RTC_CORE_RTC_RG_POR_TRIG_EN_PBINT_CNT_DIV(n) (((n)&15)<<28) 190 191 //rtc_rg_por_seq_num_cfg3 192 #define CS1000AUD_RTC_CORE_RTC_RG_PBINT_POR_TRIG_CNT_TH(n) (((n)&0xFF)<<0) 193 #define CS1000AUD_RTC_CORE_RTC_RG_PBINT_POR_DEBC_CNT_TH(n) (((n)&0xFF)<<8) 194 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO_POR_TRIG_CNT_TH(n) (((n)&0xFF)<<16) 195 #define CS1000AUD_RTC_CORE_RTC_RG_DEVICE_POR_TRIG_CNT_TH(n) (((n)&0xFF)<<24) 196 197 //rtc_rg_other_ctrl_cfg3 198 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO_SLEW_RATE_B(n) (((n)&15)<<0) 199 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO_SLEW_RATE_C(n) (((n)&15)<<4) 200 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO27_OUT_REG(n) (((n)&0x3F)<<8) 201 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO27_IE(n) (((n)&0x3F)<<14) 202 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO27_SEL(n) (((n)&0x3F)<<20) 203 #define CS1000AUD_RTC_CORE_RTC_RG_GPIO27_OEN(n) (((n)&0x3F)<<26) 204 205 //rtc_rg_int_irq 206 #define CS1000AUD_RTC_CORE_RTC_RG_INT_MASK(n) (((n)&15)<<0) 207 #define CS1000AUD_RTC_CORE_RTC_RG_INT_CLR0 (1<<4) 208 #define CS1000AUD_RTC_CORE_RTC_RG_INT_CLR1 (1<<5) 209 #define CS1000AUD_RTC_CORE_RTC_RG_INT_CLR2 (1<<6) 210 #define CS1000AUD_RTC_CORE_RTC_RG_INT_CLR3 (1<<7) 211 #define CS1000AUD_RTC_CORE_RTC_RG_DBG_MUX(n) (((n)&31)<<8) 212 #define CS1000AUD_RTC_CORE_RTC_RG_INT_EN (1<<15) 213 #define CS1000AUD_RTC_CORE_RTC_INT_RAW_STATUS(n) (((n)&15)<<16) 214 #define CS1000AUD_RTC_CORE_RTC_INT_MASK_STATUS(n) (((n)&15)<<20) 215 #define CS1000AUD_RTC_CORE_RTC_RG_DEEP_SLEEP_AWAKE_STATUS(n) (((n)&15)<<24) 216 217 //rtc_rg_pwr_cfg 218 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_VBIT_DET_VO_NOR(n) (((n)&15)<<0) 219 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_VBIT_DET_VO_DS(n) (((n)&15)<<4) 220 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_LOW_SENSE_NOR(n) (((n)&7)<<8) 221 #define CS1000AUD_RTC_CORE_RTC_RG_DCDC_RF_LOW_SENSE_DS(n) (((n)&7)<<11) 222 223 //rtc_rg_ldo_avdd33_cfg 224 #define CS1000AUD_RTC_CORE_RTC_RG_LDO_AVDD33_AUD_VREF_SEL (1<<1) 225 #define CS1000AUD_RTC_CORE_RTC_RG_LDO_AVDD33_AUD_LP_MODE (1<<2) 226 #define CS1000AUD_RTC_CORE_RTC_RG_LDO_AVDD33_AUD_VBIT(n) (((n)&31)<<3) 227 #define CS1000AUD_RTC_CORE_RTC_RG_PU_LDO_AVDD33_AUD_MAIN (1<<8) 228 #define CS1000AUD_RTC_CORE_RTC_RG_PU_LDO_AVDD33_AUD_ULP (1<<9) 229 230 #endif 231