1 /* 2 * Copyright (c) 2020-2020, BLUETRUM Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef AB32VG1_HAL_RTC_H__ 8 #define AB32VG1_HAL_RTC_H__ 9 10 #define RTC_BASE ((hal_sfr_t)&RTCCON) 11 12 enum 13 { 14 RTCxCON, 15 RTCxDAT, 16 RTCxCPND = 3, 17 }; 18 19 // RTCCON 20 #define RTC_CON_VUSB_OLINE (0x1u << 20) /*!< VUSB online state */ 21 #define RTC_CON_WK_PIN_STATE (0x1u << 19) /*!< RTC wakeup pin state */ 22 #define RTC_CON_1S_PEND (0x1u << 18) /*!< RTC 1s pending */ 23 #define RTC_CON_ALM_PEND (0x1u << 17) /*!< RTC alarm pending */ 24 #define RTC_CON_TRANS_DONE (0x1u << 16) /*!< RTC trans done */ 25 #define RTC_CON_ALM_WK_ENABLE (0x1u << 8) /*!< RTC alarm wakeup enable */ 26 #define RTC_CON_1S_WK_ENABLE (0x1u << 7) /*!< RTC 1s wakeup enable */ 27 #define RTC_CON_VUSB_RST_ENABLE (0x1u << 6) /*!< VUSB insert reset system enable */ 28 #define RTC_CON_WK_RST_ENABLE (0x1u << 5) /*!< RTC wakeup power down mode reset \ 29 system enable */ 30 #define RTC_CON_ALM_INTERRUPT (0x1u << 4) /*!< RTC alarm interrupt enable */ 31 #define RTC_CON_1S_INTERRUPT (0x1u << 3) /*!< RTC 1s interrupt enable */ 32 #define RTC_CON_BAUD_SELECT (0x3u << 1) /*!< Increase clock selection */ 33 #define RTC_CON_CHIP_SELECT (0x1u << 0) /*!< RTC chip select */ 34 35 // RTCCPND 36 #define RTC_CPND_1S (0x1u << 18) /*!< Clear RTC 1S pending */ 37 #define RTC_CPND_ALM (0x1u << 17) /*!< Clear RTC alarm pendind */ 38 39 // RTCCON0 40 #define RTC_CON0_PWRUP_FIRST (0x01u << 7) /*!< RTC first power up flag */ 41 #define RTC_CON0_INTERNAL_32K (0x01u << 6) /*!< Internal 32K select */ 42 #define RTC_CON0_VDD_ENABLE (0x01u << 5) /*!< RTC VDD12 enable */ 43 #define RTC_CON0_BG_ENABLE (0x01u << 4) /*!< BG enable */ 44 #define RTC_CON0_LVD_OUTPUT_ENABLE (0x01u << 3) /*!< LVD output enable */ 45 #define RTC_CON0_LVD_ENABLE (0x01u << 2) /*!< LVD enbale */ 46 #define RTC_CON0_XOSC32K_ENABLE (0x01u << 1) /*!< XOSC32K enable */ 47 #define RTC_CON0_RCOSC_ENABLE (0x01u << 0) /*!< RCOSC enable */ 48 49 // RTCCON2 50 #define RTC_CON2_32K_SELECT (0x01u << 7) /*!< 32K osc select */ 51 52 #endif 53