|
STM32G474xx HAL用户手册
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32g4xx_ll_iwdg.h 00004 * @author MCD Application Team 00005 * @brief Header file of IWDG LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2019 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32G4xx_LL_IWDG_H 00021 #define STM32G4xx_LL_IWDG_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32g4xx.h" 00029 00030 /** @addtogroup STM32G4xx_LL_Driver 00031 * @{ 00032 */ 00033 00034 #if defined(IWDG) 00035 00036 /** @defgroup IWDG_LL IWDG 00037 * @{ 00038 */ 00039 00040 /* Private types -------------------------------------------------------------*/ 00041 /* Private variables ---------------------------------------------------------*/ 00042 00043 /* Private constants ---------------------------------------------------------*/ 00044 /** @defgroup IWDG_LL_Private_Constants IWDG Private Constants 00045 * @{ 00046 */ 00047 #define LL_IWDG_KEY_RELOAD 0x00AAAAU /*!< IWDG Reload Counter Enable */ 00048 #define LL_IWDG_KEY_ENABLE 0x00CCCCU /*!< IWDG Peripheral Enable */ 00049 #define LL_IWDG_KEY_WR_ACCESS_ENABLE 0x00d555U /*!< IWDG KR Write Access Enable */ 00050 #define LL_IWDG_KEY_WR_ACCESS_DISABLE 0x0000000U /*!< IWDG KR Write Access Disable */ 00051 /** 00052 * @} 00053 */ 00054 00055 /* Private macros ------------------------------------------------------------*/ 00056 00057 /* Exported types ------------------------------------------------------------*/ 00058 /* Exported constants --------------------------------------------------------*/ 00059 /** @defgroup IWDG_LL_Exported_Constants IWDG Exported Constants 00060 * @{ 00061 */ 00062 00063 /** @defgroup IWDG_LL_EC_GET_FLAG Get Flags Defines 00064 * @brief Flags defines which can be used with LL_IWDG_ReadReg function 00065 * @{ 00066 */ 00067 #define LL_IWDG_SR_PVU IWDG_SR_PVU /*!< 看门狗预分频器值更新 */ 00068 #define LL_IWDG_SR_RVU IWDG_SR_RVU /*!< 看门狗计数器重新加载值更新 */ 00069 #define LL_IWDG_SR_WVU IWDG_SR_WVU /*!< 看门狗计数器窗口值更新 */ 00070 /** 00071 * @} 00072 */ 00073 00074 /** @defgroup IWDG_LL_EC_PRESCALER Prescaler Divider 00075 * @{ 00076 */ 00077 #define LL_IWDG_PRESCALER_4 0x000000U /*!< 4分频 */ 00078 #define LL_IWDG_PRESCALER_8 (IWDG_PR_PR_0) /*!< 8分频 */ 00079 #define LL_IWDG_PRESCALER_16 (IWDG_PR_PR_1) /*!< 16分频 */ 00080 #define LL_IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< 32分频 */ 00081 #define LL_IWDG_PRESCALER_64 (IWDG_PR_PR_2) /*!< 64分频 */ 00082 #define LL_IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< 128分频 */ 00083 #define LL_IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< 256分频 */ 00084 /** 00085 * @} 00086 */ 00087 00088 /** 00089 * @} 00090 */ 00091 00092 /* Exported macro ------------------------------------------------------------*/ 00093 /** @defgroup IWDG_LL_Exported_Macros IWDG Exported Macros 00094 * @{ 00095 */ 00096 00097 /** @defgroup IWDG_LL_EM_WRITE_READ Common Write and read registers Macros 00098 * @{ 00099 */ 00100 00101 /** 00102 * @brief 向IWDG寄存器写入值 00103 * @param __INSTANCE__ IWDG Instance 00104 * @param __REG__ Register to be written 00105 * @param __VALUE__ Value to be written in the register 00106 * @retval None 00107 */ 00108 #define LL_IWDG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) 00109 00110 /** 00111 * @brief 读取IWDG寄存器中的值 00112 * @param __INSTANCE__ IWDG Instance 00113 * @param __REG__ Register to be read 00114 * @retval 寄存器值 00115 */ 00116 #define LL_IWDG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 00117 /** 00118 * @} 00119 */ 00120 00121 /** 00122 * @} 00123 */ 00124 00125 00126 /* Exported functions --------------------------------------------------------*/ 00127 /** @defgroup IWDG_LL_Exported_Functions IWDG Exported Functions 00128 * @{ 00129 */ 00130 /** @defgroup IWDG_LL_EF_Configuration Configuration 00131 * @{ 00132 */ 00133 00134 /** 00135 * @brief 启动独立看门狗 00136 * @note Except if the hardware watchdog option is selected 00137 * @rmtoll KR KEY LL_IWDG_Enable 00138 * @param IWDGx IWDG Instance 00139 * @retval None 00140 */ 00141 __STATIC_INLINE void LL_IWDG_Enable(IWDG_TypeDef *IWDGx) 00142 { 00143 WRITE_REG(IWDGx->KR,