Files @ a3acc7c3a063
Branch filter:

Location: therm/libraries/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_crs.c - annotation

Ethan Zonca
Removed old system files, fixed _it files
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
be6c0feb9b98
/**
  ******************************************************************************
  * @file    stm32f0xx_crs.c
  * @author  MCD Application Team
  * @version V1.4.0
  * @date    24-July-2014
  * @brief   This file provides firmware functions to manage the following 
  *          functionalities of CRS peripheral applicable only on STM32F042 and 
  *          STM32F072 devices:
  *            + Configuration of the CRS peripheral
  *            + Interrupts and flags management
  *              
  *
  *  @verbatim
 ===============================================================================
                     ##### How to use this driver #####
 ===============================================================================
    [..]
    
         (+) Enable CRS AHB clock using RCC_APB1eriphClockCmd(RCC_APB1Periph_CRS, ENABLE)
             function

      
     @endverbatim
  *  
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  *
  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  * You may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
  *
  *        http://www.st.com/software_license_agreement_liberty_v2
  *
  * Unless required by applicable law or agreed to in writing, software 
  * distributed under the License is distributed on an "AS IS" BASIS, 
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "stm32f0xx_crs.h"
#include "stm32f0xx_rcc.h"

/** @addtogroup STM32F0xx_StdPeriph_Driver
  * @{
  */

/** @defgroup CRS 
  * @brief CRS driver modules
  * @{
  */

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* CRS Flag Mask */
#define FLAG_MASK                 ((uint32_t)0x700)

/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

/** @defgroup CRS_Private_Functions
  * @{
  */

/** @defgroup CRS_Group1 Configuration of the CRS functions
 *  @brief   Configuration of the CRS  functions 
 *
@verbatim
 ===============================================================================
                     ##### CRS configuration functions #####
 ===============================================================================

@endverbatim
  * @{
  */

/**
  * @brief  Deinitializes CRS peripheral registers to their default reset values.
  * @param  None
  * @retval None
  */
void CRS_DeInit(void)
{
  RCC_APB1PeriphResetCmd(RCC_APB1Periph_CRS, ENABLE);
  RCC_APB1PeriphResetCmd(RCC_APB1Periph_CRS, DISABLE);
}

/**
  * @brief  Adjusts the Internal High Speed 48 oscillator (HSI 48) calibration value.
  * @note   The calibration is used to compensate for the variations in voltage
  *         and temperature that influence the frequency of the internal HSI48 RC.
  * @note   This function can be called only when the AUTOTRIMEN bit is reset.
  * @param  CRS_HSI48CalibrationValue: 
  * @retval None
  */
void CRS_AdjustHSI48CalibrationValue(uint8_t CRS_HSI48CalibrationValue)
{
  /* Clear TRIM[5:0] bits */
  CRS->CR &= ~CRS_CR_TRIM;
  
  /* Set the TRIM[5:0] bits according to CRS_HSI48CalibrationValue value */
  CRS->CR |= (uint32_t)((uint32_t)CRS_HSI48CalibrationValue << 8);

}

/**
  * @brief  Enables or disables the oscillator clock for frequency error counter.
  * @note   when the CEN bit is set the CRS_CFGR register becomes write-protected.
  * @param  NewState: new state of the frequency error counter.
  *          This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void CRS_FrequencyErrorCounterCmd(FunctionalState NewState)
{
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
     CRS->CR |= CRS_CR_CEN;
  }
  else
  {
    CRS->CR &= ~CRS_CR_CEN;
  }
}

/**
  * @brief  Enables or disables the automatic hardware adjustement of TRIM bits.
  * @note   When the AUTOTRIMEN bit is set the CRS_CFGR register becomes write-protected.
  * @param  NewState: new state of the automatic trimming.
  *          This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void CRS_AutomaticCalibrationCmd(FunctionalState NewState)
{
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    CRS->CR |= CRS_CR_AUTOTRIMEN;
  }
else
  {
    CRS->CR &= ~CRS_CR_AUTOTRIMEN;
  }
}

/**
  * @brief  Generate the software synchronization event
  * @param  None
  * @retval None
  */
void CRS_SoftwareSynchronizationGenerate(void)
{
  CRS->CR |= CRS_CR_SWSYNC;
}

/**
  * @brief  Adjusts the Internal High Speed 48 oscillator (HSI 48) calibration value.
  * @note   The calibration is used to compensate for the variations in voltage
  *         and temperature that influence the frequency of the internal HSI48 RC.
  * @note   This function can be called only when the CEN bit is reset.
  * @param  CRS_ReloadValue: specifies the HSI calibration trimming value.
  *          This parameter must be a number between 0 and .
  * @retval None
  */
void CRS_FrequencyErrorCounterReload(uint32_t CRS_ReloadValue)
{
 
  /* Clear RELOAD[15:0] bits */
  CRS->CFGR &= ~CRS_CFGR_RELOAD;
  
  /* Set the RELOAD[15:0] bits according to CRS_ReloadValue value */
  CRS->CFGR |= (uint32_t)CRS_ReloadValue;

}

/**
  * @brief  
  * @note   This function can be called only when the CEN bit is reset.
  * @param  CRS_ErrorLimitValue: specifies the HSI calibration trimming value.
  *          This parameter must be a number between 0 and .
  * @retval None
  */
void CRS_FrequencyErrorLimitConfig(uint8_t CRS_ErrorLimitValue)
{
  /* Clear FELIM[7:0] bits */
  CRS->CFGR &= ~CRS_CFGR_FELIM;
  
  /* Set the FELIM[7:0] bits according to CRS_ErrorLimitValue value */
  CRS->CFGR |= (uint32_t)CRS_ErrorLimitValue;
}

/**
  * @brief  
  * @note   This function can be called only when the CEN bit is reset.
  * @param  CRS_Prescaler: specifies the HSI calibration trimming value.
  *          This parameter can be one of the following values:
  *            @arg CRS_SYNC_Div1:   
  *            @arg CRS_SYNC_Div2:   
  *            @arg CRS_SYNC_Div4:   
  *            @arg CRS_SYNC_Div8:   
  *            @arg CRS_SYNC_Div16:  
  *            @arg CRS_SYNC_Div32:  
  *            @arg CRS_SYNC_Div64: 
  *            @arg CRS_SYNC_Div128: 
  * @retval None
  */
void CRS_SynchronizationPrescalerConfig(uint32_t CRS_Prescaler)
{
  /* Check the parameters */
  assert_param(IS_CRS_SYNC_DIV(CRS_Prescaler));
  
  /* Clear SYNCDIV[2:0] bits */
  CRS->CFGR &= ~CRS_CFGR_SYNCDIV;
  
  /* Set the CRS_CFGR_SYNCDIV[2:0] bits according to CRS_Prescaler value */
  CRS->CFGR |= CRS_Prescaler;
}

/**
  * @brief  
  * @note   This function can be called only when the CEN bit is reset.
  * @param  CRS_Source: .
  *          This parameter can be one of the following values:
  *            @arg CRS_SYNCSource_GPIO:   
  *            @arg CRS_SYNCSource_LSE:   
  *            @arg CRS_SYNCSource_USB:   
  * @retval None
  */
void CRS_SynchronizationSourceConfig(uint32_t CRS_Source)
{
  /* Check the parameters */
  assert_param(IS_CRS_SYNC_SOURCE(CRS_Source));
  
  /* Clear SYNCSRC[1:0] bits */
  CRS->CFGR &= ~CRS_CFGR_SYNCSRC;
  
  /* Set the SYNCSRC[1:0] bits according to CRS_Source value */
  CRS->CFGR |= CRS_Source;
}

/**
  * @brief  
  * @note   This function can be called only when the CEN bit is reset.
  * @param  CRS_Polarity: .
  *          This parameter can be one of the following values:
  *            @arg CRS_SYNCPolarity_Rising:   
  *            @arg CRS_SYNCPolarity_Falling:   
  * @retval None
  */
void CRS_SynchronizationPolarityConfig(uint32_t CRS_Polarity)
{
  /* Check the parameters */
  assert_param(IS_CRS_SYNC_POLARITY(CRS_Polarity));
  
  /* Clear SYNCSPOL bit */
  CRS->CFGR &= ~CRS_CFGR_SYNCPOL;
  
  /* Set the SYNCSPOL bits according to CRS_Polarity value */
  CRS->CFGR |= CRS_Polarity;
}

/**
  * @brief  Returns the Relaod value.
  * @param  None
  * @retval The reload value 
  */
uint32_t CRS_GetReloadValue(void)
{
  return ((uint32_t)(CRS->CFGR & CRS_CFGR_RELOAD));
}

/**
  * @brief  Returns the HSI48 Calibration value.
  * @param  None
  * @retval The reload value 
  */
uint32_t CRS_GetHSI48CalibrationValue(void)
{
  return (((uint32_t)(CRS->CR & CRS_CR_TRIM)) >> 8);
}

/**
  * @brief  Returns the frequency error capture.
  * @param  None
  * @retval The frequency error capture value 
  */
uint32_t CRS_GetFrequencyErrorValue(void)
{
  return ((uint32_t)(CRS->ISR & CRS_ISR_FECAP));
}

/**
  * @brief  Returns the frequency error direction.
  * @param  None
  * @retval The frequency error direction. The returned value can be one 
  *         of the following values:
  *           - 0x00: Up counting
  *           - 0x8000: Down counting   
  */
uint32_t CRS_GetFrequencyErrorDirection(void)
{
  return ((uint32_t)(CRS->ISR & CRS_ISR_FEDIR));
}

/** @defgroup CRS_Group2 Interrupts and flags management functions
 *  @brief   Interrupts and flags management functions 
 *
@verbatim
 ===============================================================================
             ##### Interrupts and flags management functions #####
 ===============================================================================
@endverbatim
  * @{
  */
/**
  * @brief  Enables or disables the specified CRS interrupts.
  * @param  CRS_IT: specifies the RCC interrupt sources to be enabled or disabled.
  *          This parameter can be any combination of the following values:
  *              @arg CRS_IT_SYNCOK: 
  *              @arg CRS_IT_SYNCWARN: 
  *              @arg CRS_IT_ERR: 
  *              @arg CRS_IT_ESYNC: 
  * @param  NewState: new state of the specified CRS interrupts.
  *          This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void CRS_ITConfig(uint32_t CRS_IT, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_CRS_IT(CRS_IT));
  assert_param(IS_FUNCTIONAL_STATE(NewState));
  
  if (NewState != DISABLE)
  {
    CRS->CR |= CRS_IT;
  }
  else
  {
    CRS->CR &= ~CRS_IT;
  }
}

/**
  * @brief  Checks whether the specified CRS flag is set or not.
  * @param  CRS_FLAG: specifies the flag to check.
  *          This parameter can be one of the following values:
  *              @arg CRS_FLAG_SYNCOK: 
  *              @arg CRS_FLAG_SYNCWARN: 
  *              @arg CRS_FLAG_ERR: 
  *              @arg CRS_FLAG_ESYNC:   
  *              @arg CRS_FLAG_TRIMOVF: 
  *              @arg CRS_FLAG_SYNCERR: 
  *              @arg CRS_FLAG_SYNCMISS: 
  * @retval The new state of CRS_FLAG (SET or RESET).
  */
FlagStatus CRS_GetFlagStatus(uint32_t CRS_FLAG)
{
  /* Check the parameters */
  assert_param(IS_CRS_FLAG(CRS_FLAG));

  return ((FlagStatus)(CRS->ISR & CRS_FLAG));
}

/**
  * @brief  Clears the CRS specified FLAG.
  * @param  CRS_FLAG: specifies the flag to check.
  *          This parameter can be one of the following values:
  *              @arg CRS_FLAG_SYNCOK: 
  *              @arg CRS_FLAG_SYNCWARN: 
  *              @arg CRS_FLAG_ERR: 
  *              @arg CRS_FLAG_ESYNC:   
  *              @arg CRS_FLAG_TRIMOVF: 
  *              @arg CRS_FLAG_SYNCERR: 
  *              @arg CRS_FLAG_SYNCMISS: 
  * @retval None
  */
void CRS_ClearFlag(uint32_t CRS_FLAG)
{
  /* Check the parameters */
  assert_param(IS_CRS_FLAG(CRS_FLAG));
  
  if ((CRS_FLAG & FLAG_MASK)!= 0)
  {
    CRS->ICR |= CRS_ICR_ERRC;  
  }
  else
  {
    CRS->ICR |= CRS_FLAG;
  }
}

/**
  * @brief  Checks whether the specified CRS IT pending bit is set or not.
  * @param  CRS_IT: specifies the IT pending bit to check.
  *          This parameter can be one of the following values:
  *              @arg CRS_IT_SYNCOK: 
  *              @arg CRS_IT_SYNCWARN: 
  *              @arg CRS_IT_ERR: 
  *              @arg CRS_IT_ESYNC:   
  *              @arg CRS_IT_TRIMOVF: 
  *              @arg CRS_IT_SYNCERR: 
  *              @arg CRS_IT_SYNCMISS: 
  * @retval The new state of CRS_IT (SET or RESET).
  */
ITStatus CRS_GetITStatus(uint32_t CRS_IT)
{
  /* Check the parameters */
  assert_param(IS_CRS_GET_IT(CRS_IT));

  return ((ITStatus)(CRS->ISR & CRS_IT));
}

/**
  * @brief  Clears the CRS specified IT pending bi.
  * @param  CRS_FLAG: specifies the IT pending bi to clear.
  *          This parameter can be one of the following values:
  *              @arg CRS_IT_SYNCOK: 
  *              @arg CRS_IT_SYNCWARN: 
  *              @arg CRS_IT_ERR: 
  *              @arg CRS_IT_ESYNC:   
  *              @arg CRS_IT_TRIMOVF: 
  *              @arg CRS_IT_SYNCERR: 
  *              @arg CRS_IT_SYNCMISS: 
  * @retval None
  */
void CRS_ClearITPendingBit(uint32_t CRS_IT)
{
  /* Check the parameters */
  assert_param(IS_CRS_CLEAR_IT(CRS_IT));
  
  if ((CRS_IT & FLAG_MASK)!= 0)
  {
    CRS->ICR |= CRS_ICR_ERRC;  
  }
  else
  {
    CRS->ICR |= CRS_IT;
  }
}
/**
  * @}
  */
  
/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/