The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Thu Oct 27 16:45:56 2016 +0100
Revision:
128:9bcdf88f62b0
Parent:
TARGET_NUCLEO_L432KC/stm32l4xx_ll_crs.h@122:f9eeca106725
Child:
145:64910690c574
Release 128 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

2966: Add kw24 support https://github.com/ARMmbed/mbed-os/pull/2966
3068: MultiTech mDot - clean up PeripheralPins.c and add new pin names https://github.com/ARMmbed/mbed-os/pull/3068
3089: Kinetis HAL: Remove clock initialization code from serial and ticker https://github.com/ARMmbed/mbed-os/pull/3089
2943: [NRF5] NVIC_SetVector functionality https://github.com/ARMmbed/mbed-os/pull/2943
2938: InterruptIn changes in NCS36510 HAL. https://github.com/ARMmbed/mbed-os/pull/2938
3108: Fix sleep function for NRF52. https://github.com/ARMmbed/mbed-os/pull/3108
3076: STM32F1: Correct timer master value reading https://github.com/ARMmbed/mbed-os/pull/3076
3085: Add LOWPOWERTIMER capability for NUCLEO_F303ZE https://github.com/ARMmbed/mbed-os/pull/3085
3046: [BEETLE] Update BLE stack on Beetle board https://github.com/ARMmbed/mbed-os/pull/3046
3122: [Silicon Labs] Update of Silicon Labs HAL https://github.com/ARMmbed/mbed-os/pull/3122
3022: OnSemi RAM usage fix https://github.com/ARMmbed/mbed-os/pull/3022
3121: STM32F3: Correct UART4 and UART5 defines when using DEVICE_SERIAL_ASYNCH https://github.com/ARMmbed/mbed-os/pull/3121
3142: Targets- NUMAKER_PFM_NUC47216 remove mbed 2 https://github.com/ARMmbed/mbed-os/pull/3142

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 122:f9eeca106725 1 /**
Kojto 122:f9eeca106725 2 ******************************************************************************
Kojto 122:f9eeca106725 3 * @file stm32l4xx_ll_crs.h
Kojto 122:f9eeca106725 4 * @author MCD Application Team
Kojto 122:f9eeca106725 5 * @version V1.5.1
Kojto 122:f9eeca106725 6 * @date 31-May-2016
Kojto 122:f9eeca106725 7 * @brief Header file of CRS LL module.
Kojto 122:f9eeca106725 8 ******************************************************************************
Kojto 122:f9eeca106725 9 * @attention
Kojto 122:f9eeca106725 10 *
Kojto 122:f9eeca106725 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Kojto 122:f9eeca106725 12 *
Kojto 122:f9eeca106725 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 122:f9eeca106725 14 * are permitted provided that the following conditions are met:
Kojto 122:f9eeca106725 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 122:f9eeca106725 16 * this list of conditions and the following disclaimer.
Kojto 122:f9eeca106725 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 122:f9eeca106725 18 * this list of conditions and the following disclaimer in the documentation
Kojto 122:f9eeca106725 19 * and/or other materials provided with the distribution.
Kojto 122:f9eeca106725 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 122:f9eeca106725 21 * may be used to endorse or promote products derived from this software
Kojto 122:f9eeca106725 22 * without specific prior written permission.
Kojto 122:f9eeca106725 23 *
Kojto 122:f9eeca106725 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 122:f9eeca106725 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 122:f9eeca106725 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 122:f9eeca106725 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 122:f9eeca106725 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 122:f9eeca106725 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 122:f9eeca106725 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 122:f9eeca106725 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 122:f9eeca106725 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 122:f9eeca106725 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 122:f9eeca106725 34 *
Kojto 122:f9eeca106725 35 ******************************************************************************
Kojto 122:f9eeca106725 36 */
Kojto 122:f9eeca106725 37
Kojto 122:f9eeca106725 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 122:f9eeca106725 39 #ifndef __STM32L4xx_LL_CRS_H
Kojto 122:f9eeca106725 40 #define __STM32L4xx_LL_CRS_H
Kojto 122:f9eeca106725 41
Kojto 122:f9eeca106725 42 #ifdef __cplusplus
Kojto 122:f9eeca106725 43 extern "C" {
Kojto 122:f9eeca106725 44 #endif
Kojto 122:f9eeca106725 45
Kojto 122:f9eeca106725 46 /* Includes ------------------------------------------------------------------*/
Kojto 122:f9eeca106725 47 #include "stm32l4xx.h"
Kojto 122:f9eeca106725 48
Kojto 122:f9eeca106725 49 /** @addtogroup STM32L4xx_LL_Driver
Kojto 122:f9eeca106725 50 * @{
Kojto 122:f9eeca106725 51 */
Kojto 122:f9eeca106725 52
Kojto 122:f9eeca106725 53 #if defined(CRS)
Kojto 122:f9eeca106725 54
Kojto 122:f9eeca106725 55 /** @defgroup CRS_LL CRS
Kojto 122:f9eeca106725 56 * @{
Kojto 122:f9eeca106725 57 */
Kojto 122:f9eeca106725 58
Kojto 122:f9eeca106725 59 /* Private types -------------------------------------------------------------*/
Kojto 122:f9eeca106725 60 /* Private variables ---------------------------------------------------------*/
Kojto 122:f9eeca106725 61
Kojto 122:f9eeca106725 62 /* Private constants ---------------------------------------------------------*/
Kojto 122:f9eeca106725 63 /** @defgroup CRS_LL_Private_Constants CRS Private Constants
Kojto 122:f9eeca106725 64 * @{
Kojto 122:f9eeca106725 65 */
Kojto 122:f9eeca106725 66
Kojto 122:f9eeca106725 67 /* Defines used for the bit position in the register and perform offsets*/
Kojto 122:f9eeca106725 68 #define CRS_POSITION_TRIM (uint32_t)POSITION_VAL(CRS_CR_TRIM) /* bit position in CR reg */
Kojto 122:f9eeca106725 69 #define CRS_POSITION_FECAP (uint32_t)POSITION_VAL(CRS_ISR_FECAP) /* bit position in ISR reg */
Kojto 122:f9eeca106725 70 #define CRS_POSITION_FELIM (uint32_t)POSITION_VAL(CRS_CFGR_FELIM) /* bit position in CFGR reg */
Kojto 122:f9eeca106725 71
Kojto 122:f9eeca106725 72
Kojto 122:f9eeca106725 73 /**
Kojto 122:f9eeca106725 74 * @}
Kojto 122:f9eeca106725 75 */
Kojto 122:f9eeca106725 76
Kojto 122:f9eeca106725 77 /* Private macros ------------------------------------------------------------*/
Kojto 122:f9eeca106725 78
Kojto 122:f9eeca106725 79 /* Exported types ------------------------------------------------------------*/
Kojto 122:f9eeca106725 80 /* Exported constants --------------------------------------------------------*/
Kojto 122:f9eeca106725 81 /** @defgroup CRS_LL_Exported_Constants CRS Exported Constants
Kojto 122:f9eeca106725 82 * @{
Kojto 122:f9eeca106725 83 */
Kojto 122:f9eeca106725 84
Kojto 122:f9eeca106725 85 /** @defgroup CRS_LL_EC_GET_FLAG Get Flags Defines
Kojto 122:f9eeca106725 86 * @brief Flags defines which can be used with LL_CRS_ReadReg function
Kojto 122:f9eeca106725 87 * @{
Kojto 122:f9eeca106725 88 */
Kojto 122:f9eeca106725 89 #define LL_CRS_ISR_SYNCOKF CRS_ISR_SYNCOKF
Kojto 122:f9eeca106725 90 #define LL_CRS_ISR_SYNCWARNF CRS_ISR_SYNCWARNF
Kojto 122:f9eeca106725 91 #define LL_CRS_ISR_ERRF CRS_ISR_ERRF
Kojto 122:f9eeca106725 92 #define LL_CRS_ISR_ESYNCF CRS_ISR_ESYNCF
Kojto 122:f9eeca106725 93 #define LL_CRS_ISR_SYNCERR CRS_ISR_SYNCERR
Kojto 122:f9eeca106725 94 #define LL_CRS_ISR_SYNCMISS CRS_ISR_SYNCMISS
Kojto 122:f9eeca106725 95 #define LL_CRS_ISR_TRIMOVF CRS_ISR_TRIMOVF
Kojto 122:f9eeca106725 96 /**
Kojto 122:f9eeca106725 97 * @}
Kojto 122:f9eeca106725 98 */
Kojto 122:f9eeca106725 99
Kojto 122:f9eeca106725 100 /** @defgroup CRS_LL_EC_IT IT Defines
Kojto 122:f9eeca106725 101 * @brief IT defines which can be used with LL_CRS_ReadReg and LL_CRS_WriteReg functions
Kojto 122:f9eeca106725 102 * @{
Kojto 122:f9eeca106725 103 */
Kojto 122:f9eeca106725 104 #define LL_CRS_CR_SYNCOKIE CRS_CR_SYNCOKIE
Kojto 122:f9eeca106725 105 #define LL_CRS_CR_SYNCWARNIE CRS_CR_SYNCWARNIE
Kojto 122:f9eeca106725 106 #define LL_CRS_CR_ERRIE CRS_CR_ERRIE
Kojto 122:f9eeca106725 107 #define LL_CRS_CR_ESYNCIE CRS_CR_ESYNCIE
Kojto 122:f9eeca106725 108 /**
Kojto 122:f9eeca106725 109 * @}
Kojto 122:f9eeca106725 110 */
Kojto 122:f9eeca106725 111
Kojto 122:f9eeca106725 112 /** @defgroup CRS_LL_EC_SYNC_DIV Synchronization Signal Divider
Kojto 122:f9eeca106725 113 * @{
Kojto 122:f9eeca106725 114 */
Kojto 122:f9eeca106725 115 #define LL_CRS_SYNC_DIV_1 ((uint32_t)0x00U) /*!< Synchro Signal not divided (default) */
Kojto 122:f9eeca106725 116 #define LL_CRS_SYNC_DIV_2 CRS_CFGR_SYNCDIV_0 /*!< Synchro Signal divided by 2 */
Kojto 122:f9eeca106725 117 #define LL_CRS_SYNC_DIV_4 CRS_CFGR_SYNCDIV_1 /*!< Synchro Signal divided by 4 */
Kojto 122:f9eeca106725 118 #define LL_CRS_SYNC_DIV_8 (CRS_CFGR_SYNCDIV_1 | CRS_CFGR_SYNCDIV_0) /*!< Synchro Signal divided by 8 */
Kojto 122:f9eeca106725 119 #define LL_CRS_SYNC_DIV_16 CRS_CFGR_SYNCDIV_2 /*!< Synchro Signal divided by 16 */
Kojto 122:f9eeca106725 120 #define LL_CRS_SYNC_DIV_32 (CRS_CFGR_SYNCDIV_2 | CRS_CFGR_SYNCDIV_0) /*!< Synchro Signal divided by 32 */
Kojto 122:f9eeca106725 121 #define LL_CRS_SYNC_DIV_64 (CRS_CFGR_SYNCDIV_2 | CRS_CFGR_SYNCDIV_1) /*!< Synchro Signal divided by 64 */
Kojto 122:f9eeca106725 122 #define LL_CRS_SYNC_DIV_128 CRS_CFGR_SYNCDIV /*!< Synchro Signal divided by 128 */
Kojto 122:f9eeca106725 123 /**
Kojto 122:f9eeca106725 124 * @}
Kojto 122:f9eeca106725 125 */
Kojto 122:f9eeca106725 126
Kojto 122:f9eeca106725 127 /** @defgroup CRS_LL_EC_SYNC_SOURCE Synchronization Signal Source
Kojto 122:f9eeca106725 128 * @{
Kojto 122:f9eeca106725 129 */
Kojto 122:f9eeca106725 130 #define LL_CRS_SYNC_SOURCE_GPIO ((uint32_t)0x00U) /*!< Synchro Signal soucre GPIO */
Kojto 122:f9eeca106725 131 #define LL_CRS_SYNC_SOURCE_LSE CRS_CFGR_SYNCSRC_0 /*!< Synchro Signal source LSE */
Kojto 122:f9eeca106725 132 #define LL_CRS_SYNC_SOURCE_USB CRS_CFGR_SYNCSRC_1 /*!< Synchro Signal source USB SOF (default)*/
Kojto 122:f9eeca106725 133 /**
Kojto 122:f9eeca106725 134 * @}
Kojto 122:f9eeca106725 135 */
Kojto 122:f9eeca106725 136
Kojto 122:f9eeca106725 137 /** @defgroup CRS_LL_EC_SYNC_POLARITY Synchronization Signal Polarity
Kojto 122:f9eeca106725 138 * @{
Kojto 122:f9eeca106725 139 */
Kojto 122:f9eeca106725 140 #define LL_CRS_SYNC_POLARITY_RISING ((uint32_t)0x00U) /*!< Synchro Active on rising edge (default) */
Kojto 122:f9eeca106725 141 #define LL_CRS_SYNC_POLARITY_FALLING CRS_CFGR_SYNCPOL /*!< Synchro Active on falling edge */
Kojto 122:f9eeca106725 142 /**
Kojto 122:f9eeca106725 143 * @}
Kojto 122:f9eeca106725 144 */
Kojto 122:f9eeca106725 145
Kojto 122:f9eeca106725 146 /** @defgroup CRS_LL_EC_FREQERRORDIR Frequency Error Direction
Kojto 122:f9eeca106725 147 * @{
Kojto 122:f9eeca106725 148 */
Kojto 122:f9eeca106725 149 #define LL_CRS_FREQ_ERROR_DIR_UP ((uint32_t)0x00U) /*!< Upcounting direction, the actual frequency is above the target */
Kojto 122:f9eeca106725 150 #define LL_CRS_FREQ_ERROR_DIR_DOWN ((uint32_t)CRS_ISR_FEDIR) /*!< Downcounting direction, the actual frequency is below the target */
Kojto 122:f9eeca106725 151 /**
Kojto 122:f9eeca106725 152 * @}
Kojto 122:f9eeca106725 153 */
Kojto 122:f9eeca106725 154
Kojto 122:f9eeca106725 155 /** @defgroup CRS_LL_EC_DEFAULTVALUES Default Values
Kojto 122:f9eeca106725 156 * @{
Kojto 122:f9eeca106725 157 */
Kojto 122:f9eeca106725 158 /**
Kojto 122:f9eeca106725 159 * @brief Reset value of the RELOAD field
Kojto 122:f9eeca106725 160 * @note The reset value of the RELOAD field corresponds to a target frequency of 48 MHz
Kojto 122:f9eeca106725 161 * and a synchronization signal frequency of 1 kHz (SOF signal from USB)
Kojto 122:f9eeca106725 162 */
Kojto 122:f9eeca106725 163 #define LL_CRS_RELOADVALUE_DEFAULT ((uint32_t)0xBB7FU)
Kojto 122:f9eeca106725 164
Kojto 122:f9eeca106725 165 /**
Kojto 122:f9eeca106725 166 * @brief Reset value of Frequency error limit.
Kojto 122:f9eeca106725 167 */
Kojto 122:f9eeca106725 168 #define LL_CRS_ERRORLIMIT_DEFAULT ((uint32_t)0x22U)
Kojto 122:f9eeca106725 169
Kojto 122:f9eeca106725 170 /**
Kojto 122:f9eeca106725 171 * @brief Reset value of the HSI48 Calibration field
Kojto 122:f9eeca106725 172 * @note The default value is 32, which corresponds to the middle of the trimming interval.
Kojto 122:f9eeca106725 173 * The trimming step is around 67 kHz between two consecutive TRIM steps.
Kojto 122:f9eeca106725 174 * A higher TRIM value corresponds to a higher output frequency
Kojto 122:f9eeca106725 175 */
Kojto 122:f9eeca106725 176 #define LL_CRS_HSI48CALIBRATION_DEFAULT ((uint32_t)0x20U)
Kojto 122:f9eeca106725 177 /**
Kojto 122:f9eeca106725 178 * @}
Kojto 122:f9eeca106725 179 */
Kojto 122:f9eeca106725 180
Kojto 122:f9eeca106725 181 /**
Kojto 122:f9eeca106725 182 * @}
Kojto 122:f9eeca106725 183 */
Kojto 122:f9eeca106725 184
Kojto 122:f9eeca106725 185 /* Exported macro ------------------------------------------------------------*/
Kojto 122:f9eeca106725 186 /** @defgroup CRS_LL_Exported_Macros CRS Exported Macros
Kojto 122:f9eeca106725 187 * @{
Kojto 122:f9eeca106725 188 */
Kojto 122:f9eeca106725 189
Kojto 122:f9eeca106725 190 /** @defgroup CRS_LL_EM_WRITE_READ Common Write and read registers Macros
Kojto 122:f9eeca106725 191 * @{
Kojto 122:f9eeca106725 192 */
Kojto 122:f9eeca106725 193
Kojto 122:f9eeca106725 194 /**
Kojto 122:f9eeca106725 195 * @brief Write a value in CRS register
Kojto 122:f9eeca106725 196 * @param __INSTANCE__ CRS Instance
Kojto 122:f9eeca106725 197 * @param __REG__ Register to be written
Kojto 122:f9eeca106725 198 * @param __VALUE__ Value to be written in the register
Kojto 122:f9eeca106725 199 * @retval None
Kojto 122:f9eeca106725 200 */
Kojto 122:f9eeca106725 201 #define LL_CRS_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
Kojto 122:f9eeca106725 202
Kojto 122:f9eeca106725 203 /**
Kojto 122:f9eeca106725 204 * @brief Read a value in CRS register
Kojto 122:f9eeca106725 205 * @param __INSTANCE__ CRS Instance
Kojto 122:f9eeca106725 206 * @param __REG__ Register to be read
Kojto 122:f9eeca106725 207 * @retval Register value
Kojto 122:f9eeca106725 208 */
Kojto 122:f9eeca106725 209 #define LL_CRS_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
Kojto 122:f9eeca106725 210 /**
Kojto 122:f9eeca106725 211 * @}
Kojto 122:f9eeca106725 212 */
Kojto 122:f9eeca106725 213
Kojto 122:f9eeca106725 214 /** @defgroup CRS_LL_EM_Exported_Macros_Calculate_Reload Exported_Macros_Calculate_Reload
Kojto 122:f9eeca106725 215 * @{
Kojto 122:f9eeca106725 216 */
Kojto 122:f9eeca106725 217
Kojto 122:f9eeca106725 218 /**
Kojto 122:f9eeca106725 219 * @brief Macro to calculate reload value to be set in CRS register according to target and sync frequencies
Kojto 122:f9eeca106725 220 * @note The RELOAD value should be selected according to the ratio between
Kojto 122:f9eeca106725 221 * the target frequency and the frequency of the synchronization source after
Kojto 122:f9eeca106725 222 * prescaling. It is then decreased by one in order to reach the expected
Kojto 122:f9eeca106725 223 * synchronization on the zero value. The formula is the following:
Kojto 122:f9eeca106725 224 * RELOAD = (fTARGET / fSYNC) -1
Kojto 122:f9eeca106725 225 * @param __FTARGET__ Target frequency (value in Hz)
Kojto 122:f9eeca106725 226 * @param __FSYNC__ Synchronization signal frequency (value in Hz)
Kojto 122:f9eeca106725 227 * @retval Reload value (in Hz)
Kojto 122:f9eeca106725 228 */
Kojto 122:f9eeca106725 229 #define __LL_CRS_CALC_CALCULATE_RELOADVALUE(__FTARGET__, __FSYNC__) (((__FTARGET__) / (__FSYNC__)) - 1U)
Kojto 122:f9eeca106725 230
Kojto 122:f9eeca106725 231 /**
Kojto 122:f9eeca106725 232 * @}
Kojto 122:f9eeca106725 233 */
Kojto 122:f9eeca106725 234
Kojto 122:f9eeca106725 235 /**
Kojto 122:f9eeca106725 236 * @}
Kojto 122:f9eeca106725 237 */
Kojto 122:f9eeca106725 238
Kojto 122:f9eeca106725 239 /* Exported functions --------------------------------------------------------*/
Kojto 122:f9eeca106725 240 /** @defgroup CRS_LL_Exported_Functions CRS Exported Functions
Kojto 122:f9eeca106725 241 * @{
Kojto 122:f9eeca106725 242 */
Kojto 122:f9eeca106725 243
Kojto 122:f9eeca106725 244 /** @defgroup CRS_LL_EF_Configuration Configuration
Kojto 122:f9eeca106725 245 * @{
Kojto 122:f9eeca106725 246 */
Kojto 122:f9eeca106725 247
Kojto 122:f9eeca106725 248 /**
Kojto 122:f9eeca106725 249 * @brief Enable Frequency error counter
Kojto 122:f9eeca106725 250 * @note When this bit is set, the CRS_CFGR register is write-protected and cannot be modified
Kojto 122:f9eeca106725 251 * @rmtoll CR CEN LL_CRS_EnableFreqErrorCounter
Kojto 122:f9eeca106725 252 * @retval None
Kojto 122:f9eeca106725 253 */
Kojto 122:f9eeca106725 254 __STATIC_INLINE void LL_CRS_EnableFreqErrorCounter(void)
Kojto 122:f9eeca106725 255 {
Kojto 122:f9eeca106725 256 SET_BIT(CRS->CR, CRS_CR_CEN);
Kojto 122:f9eeca106725 257 }
Kojto 122:f9eeca106725 258
Kojto 122:f9eeca106725 259 /**
Kojto 122:f9eeca106725 260 * @brief Disable Frequency error counter
Kojto 122:f9eeca106725 261 * @rmtoll CR CEN LL_CRS_DisableFreqErrorCounter
Kojto 122:f9eeca106725 262 * @retval None
Kojto 122:f9eeca106725 263 */
Kojto 122:f9eeca106725 264 __STATIC_INLINE void LL_CRS_DisableFreqErrorCounter(void)
Kojto 122:f9eeca106725 265 {
Kojto 122:f9eeca106725 266 CLEAR_BIT(CRS->CR, CRS_CR_CEN);
Kojto 122:f9eeca106725 267 }
Kojto 122:f9eeca106725 268
Kojto 122:f9eeca106725 269 /**
Kojto 122:f9eeca106725 270 * @brief Check if Frequency error counter is enabled or not
Kojto 122:f9eeca106725 271 * @rmtoll CR CEN LL_CRS_IsEnabledFreqErrorCounter
Kojto 122:f9eeca106725 272 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 273 */
Kojto 122:f9eeca106725 274 __STATIC_INLINE uint32_t LL_CRS_IsEnabledFreqErrorCounter(void)
Kojto 122:f9eeca106725 275 {
Kojto 122:f9eeca106725 276 return (READ_BIT(CRS->CR, CRS_CR_CEN) == (CRS_CR_CEN));
Kojto 122:f9eeca106725 277 }
Kojto 122:f9eeca106725 278
Kojto 122:f9eeca106725 279 /**
Kojto 122:f9eeca106725 280 * @brief Enable Automatic trimming counter
Kojto 122:f9eeca106725 281 * @rmtoll CR AUTOTRIMEN LL_CRS_EnableAutoTrimming
Kojto 122:f9eeca106725 282 * @retval None
Kojto 122:f9eeca106725 283 */
Kojto 122:f9eeca106725 284 __STATIC_INLINE void LL_CRS_EnableAutoTrimming(void)
Kojto 122:f9eeca106725 285 {
Kojto 122:f9eeca106725 286 SET_BIT(CRS->CR, CRS_CR_AUTOTRIMEN);
Kojto 122:f9eeca106725 287 }
Kojto 122:f9eeca106725 288
Kojto 122:f9eeca106725 289 /**
Kojto 122:f9eeca106725 290 * @brief Disable Automatic trimming counter
Kojto 122:f9eeca106725 291 * @rmtoll CR AUTOTRIMEN LL_CRS_DisableAutoTrimming
Kojto 122:f9eeca106725 292 * @retval None
Kojto 122:f9eeca106725 293 */
Kojto 122:f9eeca106725 294 __STATIC_INLINE void LL_CRS_DisableAutoTrimming(void)
Kojto 122:f9eeca106725 295 {
Kojto 122:f9eeca106725 296 CLEAR_BIT(CRS->CR, CRS_CR_AUTOTRIMEN);
Kojto 122:f9eeca106725 297 }
Kojto 122:f9eeca106725 298
Kojto 122:f9eeca106725 299 /**
Kojto 122:f9eeca106725 300 * @brief Check if Automatic trimming is enabled or not
Kojto 122:f9eeca106725 301 * @rmtoll CR AUTOTRIMEN LL_CRS_IsEnabledAutoTrimming
Kojto 122:f9eeca106725 302 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 303 */
Kojto 122:f9eeca106725 304 __STATIC_INLINE uint32_t LL_CRS_IsEnabledAutoTrimming(void)
Kojto 122:f9eeca106725 305 {
Kojto 122:f9eeca106725 306 return (READ_BIT(CRS->CR, CRS_CR_AUTOTRIMEN) == (CRS_CR_AUTOTRIMEN));
Kojto 122:f9eeca106725 307 }
Kojto 122:f9eeca106725 308
Kojto 122:f9eeca106725 309 /**
Kojto 122:f9eeca106725 310 * @brief Set HSI48 oscillator smooth trimming
Kojto 122:f9eeca106725 311 * @note When the AUTOTRIMEN bit is set, this field is controlled by hardware and is read-only
Kojto 122:f9eeca106725 312 * @rmtoll CR TRIM LL_CRS_SetHSI48SmoothTrimming
Kojto 122:f9eeca106725 313 * @param Value a number between Min_Data = 0 and Max_Data = 63
Kojto 122:f9eeca106725 314 * @note Default value can be set thanks to @ref LL_CRS_HSI48CALIBRATION_DEFAULT
Kojto 122:f9eeca106725 315 * @retval None
Kojto 122:f9eeca106725 316 */
Kojto 122:f9eeca106725 317 __STATIC_INLINE void LL_CRS_SetHSI48SmoothTrimming(uint32_t Value)
Kojto 122:f9eeca106725 318 {
Kojto 122:f9eeca106725 319 MODIFY_REG(CRS->CR, CRS_CR_TRIM, Value << CRS_POSITION_TRIM);
Kojto 122:f9eeca106725 320 }
Kojto 122:f9eeca106725 321
Kojto 122:f9eeca106725 322 /**
Kojto 122:f9eeca106725 323 * @brief Get HSI48 oscillator smooth trimming
Kojto 122:f9eeca106725 324 * @rmtoll CR TRIM LL_CRS_GetHSI48SmoothTrimming
Kojto 122:f9eeca106725 325 * @retval a number between Min_Data = 0 and Max_Data = 63
Kojto 122:f9eeca106725 326 */
Kojto 122:f9eeca106725 327 __STATIC_INLINE uint32_t LL_CRS_GetHSI48SmoothTrimming(void)
Kojto 122:f9eeca106725 328 {
Kojto 122:f9eeca106725 329 return (uint32_t)(READ_BIT(CRS->CR, CRS_CR_TRIM) >> CRS_POSITION_TRIM);
Kojto 122:f9eeca106725 330 }
Kojto 122:f9eeca106725 331
Kojto 122:f9eeca106725 332 /**
Kojto 122:f9eeca106725 333 * @brief Set counter reload value
Kojto 122:f9eeca106725 334 * @rmtoll CFGR RELOAD LL_CRS_SetReloadCounter
Kojto 122:f9eeca106725 335 * @param Value a number between Min_Data = 0 and Max_Data = 0xFFFF
Kojto 122:f9eeca106725 336 * @note Default value can be set thanks to @ref LL_CRS_RELOADVALUE_DEFAULT
Kojto 122:f9eeca106725 337 * Otherwise it can be calculated in using macro @ref __LL_CRS_CALC_CALCULATE_RELOADVALUE (_FTARGET_, _FSYNC_)
Kojto 122:f9eeca106725 338 * @retval None
Kojto 122:f9eeca106725 339 */
Kojto 122:f9eeca106725 340 __STATIC_INLINE void LL_CRS_SetReloadCounter(uint32_t Value)
Kojto 122:f9eeca106725 341 {
Kojto 122:f9eeca106725 342 MODIFY_REG(CRS->CFGR, CRS_CFGR_RELOAD, Value);
Kojto 122:f9eeca106725 343 }
Kojto 122:f9eeca106725 344
Kojto 122:f9eeca106725 345 /**
Kojto 122:f9eeca106725 346 * @brief Get counter reload value
Kojto 122:f9eeca106725 347 * @rmtoll CFGR RELOAD LL_CRS_GetReloadCounter
Kojto 122:f9eeca106725 348 * @retval a number between Min_Data = 0 and Max_Data = 0xFFFF
Kojto 122:f9eeca106725 349 */
Kojto 122:f9eeca106725 350 __STATIC_INLINE uint32_t LL_CRS_GetReloadCounter(void)
Kojto 122:f9eeca106725 351 {
Kojto 122:f9eeca106725 352 return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_RELOAD));
Kojto 122:f9eeca106725 353 }
Kojto 122:f9eeca106725 354
Kojto 122:f9eeca106725 355 /**
Kojto 122:f9eeca106725 356 * @brief Set frequency error limit
Kojto 122:f9eeca106725 357 * @rmtoll CFGR FELIM LL_CRS_SetFreqErrorLimit
Kojto 122:f9eeca106725 358 * @param Value a number between Min_Data = 0 and Max_Data = 255
Kojto 122:f9eeca106725 359 * @note Default value can be set thanks to @ref LL_CRS_ERRORLIMIT_DEFAULT
Kojto 122:f9eeca106725 360 * @retval None
Kojto 122:f9eeca106725 361 */
Kojto 122:f9eeca106725 362 __STATIC_INLINE void LL_CRS_SetFreqErrorLimit(uint32_t Value)
Kojto 122:f9eeca106725 363 {
Kojto 122:f9eeca106725 364 MODIFY_REG(CRS->CFGR, CRS_CFGR_FELIM, Value << CRS_POSITION_FELIM);
Kojto 122:f9eeca106725 365 }
Kojto 122:f9eeca106725 366
Kojto 122:f9eeca106725 367 /**
Kojto 122:f9eeca106725 368 * @brief Get frequency error limit
Kojto 122:f9eeca106725 369 * @rmtoll CFGR FELIM LL_CRS_GetFreqErrorLimit
Kojto 122:f9eeca106725 370 * @retval A number between Min_Data = 0 and Max_Data = 255
Kojto 122:f9eeca106725 371 */
Kojto 122:f9eeca106725 372 __STATIC_INLINE uint32_t LL_CRS_GetFreqErrorLimit(void)
Kojto 122:f9eeca106725 373 {
Kojto 122:f9eeca106725 374 return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_FELIM) >> CRS_POSITION_FELIM);
Kojto 122:f9eeca106725 375 }
Kojto 122:f9eeca106725 376
Kojto 122:f9eeca106725 377 /**
Kojto 122:f9eeca106725 378 * @brief Set division factor for SYNC signal
Kojto 122:f9eeca106725 379 * @rmtoll CFGR SYNCDIV LL_CRS_SetSyncDivider
Kojto 122:f9eeca106725 380 * @param Divider This parameter can be one of the following values:
Kojto 122:f9eeca106725 381 * @arg @ref LL_CRS_SYNC_DIV_1
Kojto 122:f9eeca106725 382 * @arg @ref LL_CRS_SYNC_DIV_2
Kojto 122:f9eeca106725 383 * @arg @ref LL_CRS_SYNC_DIV_4
Kojto 122:f9eeca106725 384 * @arg @ref LL_CRS_SYNC_DIV_8
Kojto 122:f9eeca106725 385 * @arg @ref LL_CRS_SYNC_DIV_16
Kojto 122:f9eeca106725 386 * @arg @ref LL_CRS_SYNC_DIV_32
Kojto 122:f9eeca106725 387 * @arg @ref LL_CRS_SYNC_DIV_64
Kojto 122:f9eeca106725 388 * @arg @ref LL_CRS_SYNC_DIV_128
Kojto 122:f9eeca106725 389 * @retval None
Kojto 122:f9eeca106725 390 */
Kojto 122:f9eeca106725 391 __STATIC_INLINE void LL_CRS_SetSyncDivider(uint32_t Divider)
Kojto 122:f9eeca106725 392 {
Kojto 122:f9eeca106725 393 MODIFY_REG(CRS->CFGR, CRS_CFGR_SYNCDIV, Divider);
Kojto 122:f9eeca106725 394 }
Kojto 122:f9eeca106725 395
Kojto 122:f9eeca106725 396 /**
Kojto 122:f9eeca106725 397 * @brief Get division factor for SYNC signal
Kojto 122:f9eeca106725 398 * @rmtoll CFGR SYNCDIV LL_CRS_GetSyncDivider
Kojto 122:f9eeca106725 399 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 400 * @arg @ref LL_CRS_SYNC_DIV_1
Kojto 122:f9eeca106725 401 * @arg @ref LL_CRS_SYNC_DIV_2
Kojto 122:f9eeca106725 402 * @arg @ref LL_CRS_SYNC_DIV_4
Kojto 122:f9eeca106725 403 * @arg @ref LL_CRS_SYNC_DIV_8
Kojto 122:f9eeca106725 404 * @arg @ref LL_CRS_SYNC_DIV_16
Kojto 122:f9eeca106725 405 * @arg @ref LL_CRS_SYNC_DIV_32
Kojto 122:f9eeca106725 406 * @arg @ref LL_CRS_SYNC_DIV_64
Kojto 122:f9eeca106725 407 * @arg @ref LL_CRS_SYNC_DIV_128
Kojto 122:f9eeca106725 408 */
Kojto 122:f9eeca106725 409 __STATIC_INLINE uint32_t LL_CRS_GetSyncDivider(void)
Kojto 122:f9eeca106725 410 {
Kojto 122:f9eeca106725 411 return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_SYNCDIV));
Kojto 122:f9eeca106725 412 }
Kojto 122:f9eeca106725 413
Kojto 122:f9eeca106725 414 /**
Kojto 122:f9eeca106725 415 * @brief Set SYNC signal source
Kojto 122:f9eeca106725 416 * @rmtoll CFGR SYNCSRC LL_CRS_SetSyncSignalSource
Kojto 122:f9eeca106725 417 * @param Source This parameter can be one of the following values:
Kojto 122:f9eeca106725 418 * @arg @ref LL_CRS_SYNC_SOURCE_GPIO
Kojto 122:f9eeca106725 419 * @arg @ref LL_CRS_SYNC_SOURCE_LSE
Kojto 122:f9eeca106725 420 * @arg @ref LL_CRS_SYNC_SOURCE_USB
Kojto 122:f9eeca106725 421 * @retval None
Kojto 122:f9eeca106725 422 */
Kojto 122:f9eeca106725 423 __STATIC_INLINE void LL_CRS_SetSyncSignalSource(uint32_t Source)
Kojto 122:f9eeca106725 424 {
Kojto 122:f9eeca106725 425 MODIFY_REG(CRS->CFGR, CRS_CFGR_SYNCSRC, Source);
Kojto 122:f9eeca106725 426 }
Kojto 122:f9eeca106725 427
Kojto 122:f9eeca106725 428 /**
Kojto 122:f9eeca106725 429 * @brief Get SYNC signal source
Kojto 122:f9eeca106725 430 * @rmtoll CFGR SYNCSRC LL_CRS_GetSyncSignalSource
Kojto 122:f9eeca106725 431 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 432 * @arg @ref LL_CRS_SYNC_SOURCE_GPIO
Kojto 122:f9eeca106725 433 * @arg @ref LL_CRS_SYNC_SOURCE_LSE
Kojto 122:f9eeca106725 434 * @arg @ref LL_CRS_SYNC_SOURCE_USB
Kojto 122:f9eeca106725 435 */
Kojto 122:f9eeca106725 436 __STATIC_INLINE uint32_t LL_CRS_GetSyncSignalSource(void)
Kojto 122:f9eeca106725 437 {
Kojto 122:f9eeca106725 438 return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_SYNCSRC));
Kojto 122:f9eeca106725 439 }
Kojto 122:f9eeca106725 440
Kojto 122:f9eeca106725 441 /**
Kojto 122:f9eeca106725 442 * @brief Set input polarity for the SYNC signal source
Kojto 122:f9eeca106725 443 * @rmtoll CFGR SYNCPOL LL_CRS_SetSyncPolarity
Kojto 122:f9eeca106725 444 * @param Polarity This parameter can be one of the following values:
Kojto 122:f9eeca106725 445 * @arg @ref LL_CRS_SYNC_POLARITY_RISING
Kojto 122:f9eeca106725 446 * @arg @ref LL_CRS_SYNC_POLARITY_FALLING
Kojto 122:f9eeca106725 447 * @retval None
Kojto 122:f9eeca106725 448 */
Kojto 122:f9eeca106725 449 __STATIC_INLINE void LL_CRS_SetSyncPolarity(uint32_t Polarity)
Kojto 122:f9eeca106725 450 {
Kojto 122:f9eeca106725 451 MODIFY_REG(CRS->CFGR, CRS_CFGR_SYNCPOL, Polarity);
Kojto 122:f9eeca106725 452 }
Kojto 122:f9eeca106725 453
Kojto 122:f9eeca106725 454 /**
Kojto 122:f9eeca106725 455 * @brief Get input polarity for the SYNC signal source
Kojto 122:f9eeca106725 456 * @rmtoll CFGR SYNCPOL LL_CRS_GetSyncPolarity
Kojto 122:f9eeca106725 457 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 458 * @arg @ref LL_CRS_SYNC_POLARITY_RISING
Kojto 122:f9eeca106725 459 * @arg @ref LL_CRS_SYNC_POLARITY_FALLING
Kojto 122:f9eeca106725 460 */
Kojto 122:f9eeca106725 461 __STATIC_INLINE uint32_t LL_CRS_GetSyncPolarity(void)
Kojto 122:f9eeca106725 462 {
Kojto 122:f9eeca106725 463 return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_SYNCPOL));
Kojto 122:f9eeca106725 464 }
Kojto 122:f9eeca106725 465
Kojto 122:f9eeca106725 466 /**
Kojto 122:f9eeca106725 467 * @brief Configure CRS for the synchronization
Kojto 122:f9eeca106725 468 * @rmtoll CR TRIM LL_CRS_ConfigSynchronization\n
Kojto 122:f9eeca106725 469 * CFGR RELOAD LL_CRS_ConfigSynchronization\n
Kojto 122:f9eeca106725 470 * CFGR FELIM LL_CRS_ConfigSynchronization\n
Kojto 122:f9eeca106725 471 * CFGR SYNCDIV LL_CRS_ConfigSynchronization\n
Kojto 122:f9eeca106725 472 * CFGR SYNCSRC LL_CRS_ConfigSynchronization\n
Kojto 122:f9eeca106725 473 * CFGR SYNCPOL LL_CRS_ConfigSynchronization
Kojto 122:f9eeca106725 474 * @param HSI48CalibrationValue a number between Min_Data = 0 and Max_Data = 63
Kojto 122:f9eeca106725 475 * @param ErrorLimitValue a number between Min_Data = 0 and Max_Data = 0xFFFF
Kojto 122:f9eeca106725 476 * @param ReloadValue a number between Min_Data = 0 and Max_Data = 255
Kojto 122:f9eeca106725 477 * @param Settings This parameter can be a combination of the following values:
Kojto 122:f9eeca106725 478 * @arg @ref LL_CRS_SYNC_DIV_1 or @ref LL_CRS_SYNC_DIV_2 or @ref LL_CRS_SYNC_DIV_4 or @ref LL_CRS_SYNC_DIV_8
Kojto 122:f9eeca106725 479 * or @ref LL_CRS_SYNC_DIV_16 or @ref LL_CRS_SYNC_DIV_32 or @ref LL_CRS_SYNC_DIV_64 or @ref LL_CRS_SYNC_DIV_128
Kojto 122:f9eeca106725 480 * @arg @ref LL_CRS_SYNC_SOURCE_GPIO or @ref LL_CRS_SYNC_SOURCE_LSE or @ref LL_CRS_SYNC_SOURCE_USB
Kojto 122:f9eeca106725 481 * @arg @ref LL_CRS_SYNC_POLARITY_RISING or @ref LL_CRS_SYNC_POLARITY_FALLING
Kojto 122:f9eeca106725 482 * @retval None
Kojto 122:f9eeca106725 483 */
Kojto 122:f9eeca106725 484 __STATIC_INLINE void LL_CRS_ConfigSynchronization(uint32_t HSI48CalibrationValue, uint32_t ErrorLimitValue, uint32_t ReloadValue, uint32_t Settings)
Kojto 122:f9eeca106725 485 {
Kojto 122:f9eeca106725 486 MODIFY_REG(CRS->CR, CRS_CR_TRIM, HSI48CalibrationValue);
Kojto 122:f9eeca106725 487 MODIFY_REG(CRS->CFGR,
Kojto 122:f9eeca106725 488 CRS_CFGR_RELOAD | CRS_CFGR_FELIM | CRS_CFGR_SYNCDIV | CRS_CFGR_SYNCSRC | CRS_CFGR_SYNCPOL,
Kojto 122:f9eeca106725 489 ReloadValue | (ErrorLimitValue << CRS_POSITION_FELIM) | Settings);
Kojto 122:f9eeca106725 490 }
Kojto 122:f9eeca106725 491
Kojto 122:f9eeca106725 492 /**
Kojto 122:f9eeca106725 493 * @}
Kojto 122:f9eeca106725 494 */
Kojto 122:f9eeca106725 495
Kojto 122:f9eeca106725 496 /** @defgroup CRS_LL_EF_CRS_Management CRS_Management
Kojto 122:f9eeca106725 497 * @{
Kojto 122:f9eeca106725 498 */
Kojto 122:f9eeca106725 499
Kojto 122:f9eeca106725 500 /**
Kojto 122:f9eeca106725 501 * @brief Generate software SYNC event
Kojto 122:f9eeca106725 502 * @rmtoll CR SWSYNC LL_CRS_GenerateEvent_SWSYNC
Kojto 122:f9eeca106725 503 * @retval None
Kojto 122:f9eeca106725 504 */
Kojto 122:f9eeca106725 505 __STATIC_INLINE void LL_CRS_GenerateEvent_SWSYNC(void)
Kojto 122:f9eeca106725 506 {
Kojto 122:f9eeca106725 507 SET_BIT(CRS->CR, CRS_CR_SWSYNC);
Kojto 122:f9eeca106725 508 }
Kojto 122:f9eeca106725 509
Kojto 122:f9eeca106725 510 /**
Kojto 122:f9eeca106725 511 * @brief Get the frequency error direction latched in the time of the last
Kojto 122:f9eeca106725 512 * SYNC event
Kojto 122:f9eeca106725 513 * @rmtoll ISR FEDIR LL_CRS_GetFreqErrorDirection
Kojto 122:f9eeca106725 514 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 515 * @arg @ref LL_CRS_FREQ_ERROR_DIR_UP
Kojto 122:f9eeca106725 516 * @arg @ref LL_CRS_FREQ_ERROR_DIR_DOWN
Kojto 122:f9eeca106725 517 */
Kojto 122:f9eeca106725 518 __STATIC_INLINE uint32_t LL_CRS_GetFreqErrorDirection(void)
Kojto 122:f9eeca106725 519 {
Kojto 122:f9eeca106725 520 return (uint32_t)(READ_BIT(CRS->ISR, CRS_ISR_FEDIR));
Kojto 122:f9eeca106725 521 }
Kojto 122:f9eeca106725 522
Kojto 122:f9eeca106725 523 /**
Kojto 122:f9eeca106725 524 * @brief Get the frequency error counter value latched in the time of the last SYNC event
Kojto 122:f9eeca106725 525 * @rmtoll ISR FECAP LL_CRS_GetFreqErrorCapture
Kojto 122:f9eeca106725 526 * @retval A number between Min_Data = 0x0000 and Max_Data = 0xFFFF
Kojto 122:f9eeca106725 527 */
Kojto 122:f9eeca106725 528 __STATIC_INLINE uint32_t LL_CRS_GetFreqErrorCapture(void)
Kojto 122:f9eeca106725 529 {
Kojto 122:f9eeca106725 530 return (uint32_t)(READ_BIT(CRS->ISR, CRS_ISR_FECAP) >> CRS_POSITION_FECAP);
Kojto 122:f9eeca106725 531 }
Kojto 122:f9eeca106725 532
Kojto 122:f9eeca106725 533 /**
Kojto 122:f9eeca106725 534 * @}
Kojto 122:f9eeca106725 535 */
Kojto 122:f9eeca106725 536
Kojto 122:f9eeca106725 537 /** @defgroup CRS_LL_EF_FLAG_Management FLAG_Management
Kojto 122:f9eeca106725 538 * @{
Kojto 122:f9eeca106725 539 */
Kojto 122:f9eeca106725 540
Kojto 122:f9eeca106725 541 /**
Kojto 122:f9eeca106725 542 * @brief Check if SYNC event OK signal occurred or not
Kojto 122:f9eeca106725 543 * @rmtoll ISR SYNCOKF LL_CRS_IsActiveFlag_SYNCOK
Kojto 122:f9eeca106725 544 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 545 */
Kojto 122:f9eeca106725 546 __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_SYNCOK(void)
Kojto 122:f9eeca106725 547 {
Kojto 122:f9eeca106725 548 return (READ_BIT(CRS->ISR, CRS_ISR_SYNCOKF) == (CRS_ISR_SYNCOKF));
Kojto 122:f9eeca106725 549 }
Kojto 122:f9eeca106725 550
Kojto 122:f9eeca106725 551 /**
Kojto 122:f9eeca106725 552 * @brief Check if SYNC warning signal occurred or not
Kojto 122:f9eeca106725 553 * @rmtoll ISR SYNCWARNF LL_CRS_IsActiveFlag_SYNCWARN
Kojto 122:f9eeca106725 554 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 555 */
Kojto 122:f9eeca106725 556 __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_SYNCWARN(void)
Kojto 122:f9eeca106725 557 {
Kojto 122:f9eeca106725 558 return (READ_BIT(CRS->ISR, CRS_ISR_SYNCWARNF) == (CRS_ISR_SYNCWARNF));
Kojto 122:f9eeca106725 559 }
Kojto 122:f9eeca106725 560
Kojto 122:f9eeca106725 561 /**
Kojto 122:f9eeca106725 562 * @brief Check if Synchronization or trimming error signal occurred or not
Kojto 122:f9eeca106725 563 * @rmtoll ISR ERRF LL_CRS_IsActiveFlag_ERR
Kojto 122:f9eeca106725 564 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 565 */
Kojto 122:f9eeca106725 566 __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_ERR(void)
Kojto 122:f9eeca106725 567 {
Kojto 122:f9eeca106725 568 return (READ_BIT(CRS->ISR, CRS_ISR_ERRF) == (CRS_ISR_ERRF));
Kojto 122:f9eeca106725 569 }
Kojto 122:f9eeca106725 570
Kojto 122:f9eeca106725 571 /**
Kojto 122:f9eeca106725 572 * @brief Check if Expected SYNC signal occurred or not
Kojto 122:f9eeca106725 573 * @rmtoll ISR ESYNCF LL_CRS_IsActiveFlag_ESYNC
Kojto 122:f9eeca106725 574 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 575 */
Kojto 122:f9eeca106725 576 __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_ESYNC(void)
Kojto 122:f9eeca106725 577 {
Kojto 122:f9eeca106725 578 return (READ_BIT(CRS->ISR, CRS_ISR_ESYNCF) == (CRS_ISR_ESYNCF));
Kojto 122:f9eeca106725 579 }
Kojto 122:f9eeca106725 580
Kojto 122:f9eeca106725 581 /**
Kojto 122:f9eeca106725 582 * @brief Check if SYNC error signal occurred or not
Kojto 122:f9eeca106725 583 * @rmtoll ISR SYNCERR LL_CRS_IsActiveFlag_SYNCERR
Kojto 122:f9eeca106725 584 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 585 */
Kojto 122:f9eeca106725 586 __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_SYNCERR(void)
Kojto 122:f9eeca106725 587 {
Kojto 122:f9eeca106725 588 return (READ_BIT(CRS->ISR, CRS_ISR_SYNCERR) == (CRS_ISR_SYNCERR));
Kojto 122:f9eeca106725 589 }
Kojto 122:f9eeca106725 590
Kojto 122:f9eeca106725 591 /**
Kojto 122:f9eeca106725 592 * @brief Check if SYNC missed error signal occurred or not
Kojto 122:f9eeca106725 593 * @rmtoll ISR SYNCMISS LL_CRS_IsActiveFlag_SYNCMISS
Kojto 122:f9eeca106725 594 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 595 */
Kojto 122:f9eeca106725 596 __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_SYNCMISS(void)
Kojto 122:f9eeca106725 597 {
Kojto 122:f9eeca106725 598 return (READ_BIT(CRS->ISR, CRS_ISR_SYNCMISS) == (CRS_ISR_SYNCMISS));
Kojto 122:f9eeca106725 599 }
Kojto 122:f9eeca106725 600
Kojto 122:f9eeca106725 601 /**
Kojto 122:f9eeca106725 602 * @brief Check if Trimming overflow or underflow occurred or not
Kojto 122:f9eeca106725 603 * @rmtoll ISR TRIMOVF LL_CRS_IsActiveFlag_TRIMOVF
Kojto 122:f9eeca106725 604 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 605 */
Kojto 122:f9eeca106725 606 __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_TRIMOVF(void)
Kojto 122:f9eeca106725 607 {
Kojto 122:f9eeca106725 608 return (READ_BIT(CRS->ISR, CRS_ISR_TRIMOVF) == (CRS_ISR_TRIMOVF));
Kojto 122:f9eeca106725 609 }
Kojto 122:f9eeca106725 610
Kojto 122:f9eeca106725 611 /**
Kojto 122:f9eeca106725 612 * @brief Clear the SYNC event OK flag
Kojto 122:f9eeca106725 613 * @rmtoll ICR SYNCOKC LL_CRS_ClearFlag_SYNCOK
Kojto 122:f9eeca106725 614 * @retval None
Kojto 122:f9eeca106725 615 */
Kojto 122:f9eeca106725 616 __STATIC_INLINE void LL_CRS_ClearFlag_SYNCOK(void)
Kojto 122:f9eeca106725 617 {
Kojto 122:f9eeca106725 618 WRITE_REG(CRS->ICR, CRS_ICR_SYNCOKC);
Kojto 122:f9eeca106725 619 }
Kojto 122:f9eeca106725 620
Kojto 122:f9eeca106725 621 /**
Kojto 122:f9eeca106725 622 * @brief Clear the SYNC warning flag
Kojto 122:f9eeca106725 623 * @rmtoll ICR SYNCWARNC LL_CRS_ClearFlag_SYNCWARN
Kojto 122:f9eeca106725 624 * @retval None
Kojto 122:f9eeca106725 625 */
Kojto 122:f9eeca106725 626 __STATIC_INLINE void LL_CRS_ClearFlag_SYNCWARN(void)
Kojto 122:f9eeca106725 627 {
Kojto 122:f9eeca106725 628 WRITE_REG(CRS->ICR, CRS_ICR_SYNCWARNC);
Kojto 122:f9eeca106725 629 }
Kojto 122:f9eeca106725 630
Kojto 122:f9eeca106725 631 /**
Kojto 122:f9eeca106725 632 * @brief Clear TRIMOVF, SYNCMISS and SYNCERR bits and consequently also
Kojto 122:f9eeca106725 633 * the ERR flag
Kojto 122:f9eeca106725 634 * @rmtoll ICR ERRC LL_CRS_ClearFlag_ERR
Kojto 122:f9eeca106725 635 * @retval None
Kojto 122:f9eeca106725 636 */
Kojto 122:f9eeca106725 637 __STATIC_INLINE void LL_CRS_ClearFlag_ERR(void)
Kojto 122:f9eeca106725 638 {
Kojto 122:f9eeca106725 639 WRITE_REG(CRS->ICR, CRS_ICR_ERRC);
Kojto 122:f9eeca106725 640 }
Kojto 122:f9eeca106725 641
Kojto 122:f9eeca106725 642 /**
Kojto 122:f9eeca106725 643 * @brief Clear Expected SYNC flag
Kojto 122:f9eeca106725 644 * @rmtoll ICR ESYNCC LL_CRS_ClearFlag_ESYNC
Kojto 122:f9eeca106725 645 * @retval None
Kojto 122:f9eeca106725 646 */
Kojto 122:f9eeca106725 647 __STATIC_INLINE void LL_CRS_ClearFlag_ESYNC(void)
Kojto 122:f9eeca106725 648 {
Kojto 122:f9eeca106725 649 WRITE_REG(CRS->ICR, CRS_ICR_ESYNCC);
Kojto 122:f9eeca106725 650 }
Kojto 122:f9eeca106725 651
Kojto 122:f9eeca106725 652 /**
Kojto 122:f9eeca106725 653 * @}
Kojto 122:f9eeca106725 654 */
Kojto 122:f9eeca106725 655
Kojto 122:f9eeca106725 656 /** @defgroup CRS_LL_EF_IT_Management IT_Management
Kojto 122:f9eeca106725 657 * @{
Kojto 122:f9eeca106725 658 */
Kojto 122:f9eeca106725 659
Kojto 122:f9eeca106725 660 /**
Kojto 122:f9eeca106725 661 * @brief Enable SYNC event OK interrupt
Kojto 122:f9eeca106725 662 * @rmtoll CR SYNCOKIE LL_CRS_EnableIT_SYNCOK
Kojto 122:f9eeca106725 663 * @retval None
Kojto 122:f9eeca106725 664 */
Kojto 122:f9eeca106725 665 __STATIC_INLINE void LL_CRS_EnableIT_SYNCOK(void)
Kojto 122:f9eeca106725 666 {
Kojto 122:f9eeca106725 667 SET_BIT(CRS->CR, CRS_CR_SYNCOKIE);
Kojto 122:f9eeca106725 668 }
Kojto 122:f9eeca106725 669
Kojto 122:f9eeca106725 670 /**
Kojto 122:f9eeca106725 671 * @brief Disable SYNC event OK interrupt
Kojto 122:f9eeca106725 672 * @rmtoll CR SYNCOKIE LL_CRS_DisableIT_SYNCOK
Kojto 122:f9eeca106725 673 * @retval None
Kojto 122:f9eeca106725 674 */
Kojto 122:f9eeca106725 675 __STATIC_INLINE void LL_CRS_DisableIT_SYNCOK(void)
Kojto 122:f9eeca106725 676 {
Kojto 122:f9eeca106725 677 CLEAR_BIT(CRS->CR, CRS_CR_SYNCOKIE);
Kojto 122:f9eeca106725 678 }
Kojto 122:f9eeca106725 679
Kojto 122:f9eeca106725 680 /**
Kojto 122:f9eeca106725 681 * @brief Check if SYNC event OK interrupt is enabled or not
Kojto 122:f9eeca106725 682 * @rmtoll CR SYNCOKIE LL_CRS_IsEnabledIT_SYNCOK
Kojto 122:f9eeca106725 683 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 684 */
Kojto 122:f9eeca106725 685 __STATIC_INLINE uint32_t LL_CRS_IsEnabledIT_SYNCOK(void)
Kojto 122:f9eeca106725 686 {
Kojto 122:f9eeca106725 687 return (READ_BIT(CRS->CR, CRS_CR_SYNCOKIE) == (CRS_CR_SYNCOKIE));
Kojto 122:f9eeca106725 688 }
Kojto 122:f9eeca106725 689
Kojto 122:f9eeca106725 690 /**
Kojto 122:f9eeca106725 691 * @brief Enable SYNC warning interrupt
Kojto 122:f9eeca106725 692 * @rmtoll CR SYNCWARNIE LL_CRS_EnableIT_SYNCWARN
Kojto 122:f9eeca106725 693 * @retval None
Kojto 122:f9eeca106725 694 */
Kojto 122:f9eeca106725 695 __STATIC_INLINE void LL_CRS_EnableIT_SYNCWARN(void)
Kojto 122:f9eeca106725 696 {
Kojto 122:f9eeca106725 697 SET_BIT(CRS->CR, CRS_CR_SYNCWARNIE);
Kojto 122:f9eeca106725 698 }
Kojto 122:f9eeca106725 699
Kojto 122:f9eeca106725 700 /**
Kojto 122:f9eeca106725 701 * @brief Disable SYNC warning interrupt
Kojto 122:f9eeca106725 702 * @rmtoll CR SYNCWARNIE LL_CRS_DisableIT_SYNCWARN
Kojto 122:f9eeca106725 703 * @retval None
Kojto 122:f9eeca106725 704 */
Kojto 122:f9eeca106725 705 __STATIC_INLINE void LL_CRS_DisableIT_SYNCWARN(void)
Kojto 122:f9eeca106725 706 {
Kojto 122:f9eeca106725 707 CLEAR_BIT(CRS->CR, CRS_CR_SYNCWARNIE);
Kojto 122:f9eeca106725 708 }
Kojto 122:f9eeca106725 709
Kojto 122:f9eeca106725 710 /**
Kojto 122:f9eeca106725 711 * @brief Check if SYNC warning interrupt is enabled or not
Kojto 122:f9eeca106725 712 * @rmtoll CR SYNCWARNIE LL_CRS_IsEnabledIT_SYNCWARN
Kojto 122:f9eeca106725 713 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 714 */
Kojto 122:f9eeca106725 715 __STATIC_INLINE uint32_t LL_CRS_IsEnabledIT_SYNCWARN(void)
Kojto 122:f9eeca106725 716 {
Kojto 122:f9eeca106725 717 return (READ_BIT(CRS->CR, CRS_CR_SYNCWARNIE) == (CRS_CR_SYNCWARNIE));
Kojto 122:f9eeca106725 718 }
Kojto 122:f9eeca106725 719
Kojto 122:f9eeca106725 720 /**
Kojto 122:f9eeca106725 721 * @brief Enable Synchronization or trimming error interrupt
Kojto 122:f9eeca106725 722 * @rmtoll CR ERRIE LL_CRS_EnableIT_ERR
Kojto 122:f9eeca106725 723 * @retval None
Kojto 122:f9eeca106725 724 */
Kojto 122:f9eeca106725 725 __STATIC_INLINE void LL_CRS_EnableIT_ERR(void)
Kojto 122:f9eeca106725 726 {
Kojto 122:f9eeca106725 727 SET_BIT(CRS->CR, CRS_CR_ERRIE);
Kojto 122:f9eeca106725 728 }
Kojto 122:f9eeca106725 729
Kojto 122:f9eeca106725 730 /**
Kojto 122:f9eeca106725 731 * @brief Disable Synchronization or trimming error interrupt
Kojto 122:f9eeca106725 732 * @rmtoll CR ERRIE LL_CRS_DisableIT_ERR
Kojto 122:f9eeca106725 733 * @retval None
Kojto 122:f9eeca106725 734 */
Kojto 122:f9eeca106725 735 __STATIC_INLINE void LL_CRS_DisableIT_ERR(void)
Kojto 122:f9eeca106725 736 {
Kojto 122:f9eeca106725 737 CLEAR_BIT(CRS->CR, CRS_CR_ERRIE);
Kojto 122:f9eeca106725 738 }
Kojto 122:f9eeca106725 739
Kojto 122:f9eeca106725 740 /**
Kojto 122:f9eeca106725 741 * @brief Check if Synchronization or trimming error interrupt is enabled or not
Kojto 122:f9eeca106725 742 * @rmtoll CR ERRIE LL_CRS_IsEnabledIT_ERR
Kojto 122:f9eeca106725 743 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 744 */
Kojto 122:f9eeca106725 745 __STATIC_INLINE uint32_t LL_CRS_IsEnabledIT_ERR(void)
Kojto 122:f9eeca106725 746 {
Kojto 122:f9eeca106725 747 return (READ_BIT(CRS->CR, CRS_CR_ERRIE) == (CRS_CR_ERRIE));
Kojto 122:f9eeca106725 748 }
Kojto 122:f9eeca106725 749
Kojto 122:f9eeca106725 750 /**
Kojto 122:f9eeca106725 751 * @brief Enable Expected SYNC interrupt
Kojto 122:f9eeca106725 752 * @rmtoll CR ESYNCIE LL_CRS_EnableIT_ESYNC
Kojto 122:f9eeca106725 753 * @retval None
Kojto 122:f9eeca106725 754 */
Kojto 122:f9eeca106725 755 __STATIC_INLINE void LL_CRS_EnableIT_ESYNC(void)
Kojto 122:f9eeca106725 756 {
Kojto 122:f9eeca106725 757 SET_BIT(CRS->CR, CRS_CR_ESYNCIE);
Kojto 122:f9eeca106725 758 }
Kojto 122:f9eeca106725 759
Kojto 122:f9eeca106725 760 /**
Kojto 122:f9eeca106725 761 * @brief Disable Expected SYNC interrupt
Kojto 122:f9eeca106725 762 * @rmtoll CR ESYNCIE LL_CRS_DisableIT_ESYNC
Kojto 122:f9eeca106725 763 * @retval None
Kojto 122:f9eeca106725 764 */
Kojto 122:f9eeca106725 765 __STATIC_INLINE void LL_CRS_DisableIT_ESYNC(void)
Kojto 122:f9eeca106725 766 {
Kojto 122:f9eeca106725 767 CLEAR_BIT(CRS->CR, CRS_CR_ESYNCIE);
Kojto 122:f9eeca106725 768 }
Kojto 122:f9eeca106725 769
Kojto 122:f9eeca106725 770 /**
Kojto 122:f9eeca106725 771 * @brief Check if Expected SYNC interrupt is enabled or not
Kojto 122:f9eeca106725 772 * @rmtoll CR ESYNCIE LL_CRS_IsEnabledIT_ESYNC
Kojto 122:f9eeca106725 773 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 774 */
Kojto 122:f9eeca106725 775 __STATIC_INLINE uint32_t LL_CRS_IsEnabledIT_ESYNC(void)
Kojto 122:f9eeca106725 776 {
Kojto 122:f9eeca106725 777 return (READ_BIT(CRS->CR, CRS_CR_ESYNCIE) == (CRS_CR_ESYNCIE));
Kojto 122:f9eeca106725 778 }
Kojto 122:f9eeca106725 779
Kojto 122:f9eeca106725 780 /**
Kojto 122:f9eeca106725 781 * @}
Kojto 122:f9eeca106725 782 */
Kojto 122:f9eeca106725 783
Kojto 122:f9eeca106725 784 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 785 /** @defgroup CRS_LL_EF_Init Initialization and de-initialization functions
Kojto 122:f9eeca106725 786 * @{
Kojto 122:f9eeca106725 787 */
Kojto 122:f9eeca106725 788
Kojto 122:f9eeca106725 789 ErrorStatus LL_CRS_DeInit(void);
Kojto 122:f9eeca106725 790
Kojto 122:f9eeca106725 791 /**
Kojto 122:f9eeca106725 792 * @}
Kojto 122:f9eeca106725 793 */
Kojto 122:f9eeca106725 794 #endif /* USE_FULL_LL_DRIVER */
Kojto 122:f9eeca106725 795
Kojto 122:f9eeca106725 796 /**
Kojto 122:f9eeca106725 797 * @}
Kojto 122:f9eeca106725 798 */
Kojto 122:f9eeca106725 799
Kojto 122:f9eeca106725 800 /**
Kojto 122:f9eeca106725 801 * @}
Kojto 122:f9eeca106725 802 */
Kojto 122:f9eeca106725 803
Kojto 122:f9eeca106725 804 #endif /* defined(CRS) */
Kojto 122:f9eeca106725 805
Kojto 122:f9eeca106725 806 /**
Kojto 122:f9eeca106725 807 * @}
Kojto 122:f9eeca106725 808 */
Kojto 122:f9eeca106725 809
Kojto 122:f9eeca106725 810 #ifdef __cplusplus
Kojto 122:f9eeca106725 811 }
Kojto 122:f9eeca106725 812 #endif
Kojto 122:f9eeca106725 813
Kojto 122:f9eeca106725 814 #endif /* __STM32L4xx_LL_CRS_H */
Kojto 122:f9eeca106725 815
Kojto 122:f9eeca106725 816 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/