1 /** 2 ****************************************************************************** 3 * @file rtl8721d_backup_reg.h 4 * @author 5 * @version V1.0.0 6 * @date 2016-05-17 7 * @brief This file provides firmware functions to manage the 16bytes backup registers 8 ****************************************************************************** 9 * @attention 10 * 11 * This module is a confidential and proprietary property of RealTek and 12 * possession or use of this module requires written permission of RealTek. 13 * 14 * Copyright(c) 2016, Realtek Semiconductor Corporation. All rights reserved. 15 ****************************************************************************** 16 */ 17 18 #ifndef _RTL8721D_BACKUP_REG_H_ 19 #define _RTL8721D_BACKUP_REG_H_ 20 21 /** @addtogroup AmebaD_Platform 22 * @{ 23 */ 24 25 /** @defgroup BKUP_REG 26 * @brief BKUP_REG driver modules 27 * @{ 28 */ 29 30 /** @addtogroup BKUP_REG 31 * @verbatim 32 ***************************************************************************************** 33 * Introduction 34 ***************************************************************************************** 35 * backup register size: 36 * -32bytes (8 dwords) 37 * 38 * usage: 39 * - user can use this registers to save some data before reset happens 40 * 41 * backup register can not be reset by following functions: 42 * - cpu reset 43 * - system reset 44 * - soc sleep mode 45 * 46 * backup register will be reset by following functions: 47 * - soc deep sleep mode 48 * - soc power down reset 49 * - soc power off 50 * 51 * system defined bits (other bits are reserved for user): 52 * - dword0[0]: system reset 53 * - dword0[1]: watchdog reset 54 * - dword0[2]: BOR2 HW temp bit 55 * - dword0[3]: this is SW set bit before reboot, for uart download 56 * - dword0[4]: this is SW set bit before reboot, for uart download debug 57 * - dword0[5]: this is SW set bit before reboot, for rtc init indication 58 * - dword0[6]: BOR2 HW temp bit 59 * - dword0[7]: 1: enable bor2 detection; 0: disable 60 * 61 ***************************************************************************************** 62 * how to use 63 ***************************************************************************************** 64 * BKUP_Write: write a dword backup register 65 * BKUP_Read: read a dword backup register 66 * BKUP_Set: set 1 to some bits of backup register 67 * BKUP_Clear: set 0 to some bits of backup register 68 ***************************************************************************************** 69 * @endverbatim 70 */ 71 72 /* Exported constants --------------------------------------------------------*/ 73 74 /** @defgroup BKUP_REG_Exported_Constants BKUP_REG Exported Constants 75 * @{ 76 */ 77 78 /** @defgroup BKUP_REG_Idx_definitions 79 * @{ 80 */ 81 #define BKUP_REG0 ((u32)0x00000000) /*!< byte1 is used by system */ 82 #define BKUP_REG1 ((u32)0x00000001) /*!< all bits can be used by user */ 83 #define BKUP_REG2 ((u32)0x00000002) /*!< all bits can be used by user */ 84 #define BKUP_REG3 ((u32)0x00000003) /*!< all bits can be used by user */ 85 #define BKUP_REG4 ((u32)0x00000004) /*!< all bits can be used by user */ 86 #define BKUP_REG5 ((u32)0x00000005) /*!< all bits can be used by user */ 87 #define BKUP_REG6 ((u32)0x00000006) /*!< all bits can be used by user */ 88 #define BKUP_REG7 ((u32)0x00000007) /*!< all bits can be used by user */ 89 #define IS_BKUP_REG(IDX) (((IDX) == BKUP_REG0) || \ 90 ((IDX) == BKUP_REG1) ||\ 91 ((IDX) == BKUP_REG2) ||\ 92 ((IDX) == BKUP_REG3) ||\ 93 ((IDX) == BKUP_REG4) ||\ 94 ((IDX) == BKUP_REG5) ||\ 95 ((IDX) == BKUP_REG6) ||\ 96 ((IDX) == BKUP_REG7)) 97 /** 98 * @} 99 */ 100 /** 101 * @} 102 */ 103 104 105 /** @defgroup BKUP_REG_Exported_Functions BKUP_REG Exported Functions 106 * @{ 107 */ 108 _LONG_CALL_ void BKUP_Write(u32 DwordIdx, u32 WriteVal); 109 _LONG_CALL_ u32 BKUP_Read(u32 DwordIdx); 110 _LONG_CALL_ void BKUP_Set(u32 DwordIdx, u32 BitMask); 111 _LONG_CALL_ void BKUP_Clear(u32 DwordIdx, u32 BitMask); 112 _LONG_CALL_ u32 BOOT_Reason(void); 113 /** 114 * @} 115 */ 116 117 /* Registers Definitions --------------------------------------------------------*/ 118 /**************************************************************************//** 119 * @defgroup BKUP_REG_Register_Definitions BKUP_REG Register Definitions 120 * @{ 121 *****************************************************************************/ 122 123 /* @defgroup BKUP_REG_WDORD7 124 * @{ 125 */ 126 127 #define BIT_MASK_FLASH_STRUCT_ADDR ((u32)0xFFFFFFFF) /*!< used to backup address of flash_init_para*/ 128 129 130 /** @} */ 131 132 /**************************************************************************//** 133 * @defgroup BKUP_REG_WDORD0 REG_LP_BOOT_REASON0 134 * @{ 135 *****************************************************************************/ 136 #define BIT_RTC_BACKUP ((u32)0x00FF0000) /*!< used to backup rtc year before reset */ 137 #define BIT_RTC_BACKUP_SHIFT 16 /*!< used to backup rtc year before reset */ 138 139 #define BIT_CAPTOUCH_ENABLE BIT(15) /*!< KM4 captouch init controlled by this bit*/ 140 #define BIT_KEY_ENABLE BIT(14) /*!< KM4 key init controlled by this bit*/ 141 #define BIT_KM4_WAKE_DELAY BIT(13) /*!< km4 wakeup should be delayed if wakeup happend when km4 suspend */ 142 #define BIT_RTC_RESTORE BIT(12) /*!< this is SW set bit after rtc init */ 143 #define BIT_WIFI_ENABLE BIT(11) /*!< KM0 WIFIFW INIT & KM4 WIFI Driver INIT Controlled by this bit */ 144 #define BIT_UARTBURN_DEBUG BIT(10) /*!< this is SW set bit before reboot, for uart download debug */ 145 #define BIT_UARTBURN_BOOT BIT(9) /*!< this is SW set bit before reboot, for uart download */ 146 #define BIT_SW_SIM_RSVD BIT(8) /*!< 1: boot for simulation */ 147 148 #define BIT_RESVED_BIT7 BIT(7) /*!< RESVED */ 149 #define BIT_RESVED_BIT6 BIT(6) /*!< RESVED */ 150 #define BIT_GPIO_ENABLE BIT(5) /*!< KM4 GPIO wake up controlled by this bit */ 151 #define BIT_KM4WDG_RESET_HAPPEN BIT(4) /*!< km4 watchdog reset */ 152 #define BIT_KM4SYS_RESET_HAPPEN BIT(3) /*!< km4 system reset */ 153 #define BIT_RESVED_BIT2 BIT(2) /*!< RESVED */ 154 #define BIT_WDG_RESET_HAPPEN BIT(1) /*!< km0 watchdog reset */ 155 #define BIT_SYS_RESET_HAPPEN BIT(0) /*!< km0 system reset */ 156 157 #define BIT_MASK_BOOT_REASON ((u32)0x0000001F) 158 /** @} */ 159 /** @} */ 160 161 /** 162 * @} 163 */ 164 165 /** 166 * @} 167 */ 168 169 #endif //_RTL8710B_BACKUP_REG_H_ 170 /******************* (C) COPYRIGHT 2016 Realtek Semiconductor *****END OF FILE****/ 171