1 /**
2   ******************************************************************************
3   * @file    stm32f2xx_rng.h
4   * @author  MCD Application Team
5   * @version V1.1.2
6   * @date    05-March-2012
7   * @brief   This file contains all the functions prototypes for the Random
8   *          Number Generator(RNG) firmware library.
9   ******************************************************************************
10   * @attention
11   *
12   * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
13   *
14   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15   * You may not use this file except in compliance with the License.
16   * You may obtain a copy of the License at:
17   *
18   *        http://www.st.com/software_license_agreement_liberty_v2
19   *
20   * Unless required by applicable law or agreed to in writing, software
21   * distributed under the License is distributed on an "AS IS" BASIS,
22   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23   * See the License for the specific language governing permissions and
24   * limitations under the License.
25   *
26   ******************************************************************************
27   */
28 
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F2xx_RNG_H
31 #define __STM32F2xx_RNG_H
32 
33 #ifdef __cplusplus
34  extern "C" {
35 #endif
36 
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f2xx.h"
39 
40 /** @addtogroup STM32F2xx_StdPeriph_Driver
41   * @{
42   */
43 
44 /** @addtogroup RNG
45   * @{
46   */
47 
48 /* Exported types ------------------------------------------------------------*/
49 /* Exported constants --------------------------------------------------------*/
50 
51 /** @defgroup RNG_Exported_Constants
52   * @{
53   */
54 
55 /** @defgroup RNG_flags_definition
56   * @{
57   */
58 #define RNG_FLAG_DRDY               ((uint8_t)0x0001) /*!< Data ready */
59 #define RNG_FLAG_CECS               ((uint8_t)0x0002) /*!< Clock error current status */
60 #define RNG_FLAG_SECS               ((uint8_t)0x0004) /*!< Seed error current status */
61 
62 #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \
63                                    ((RNG_FLAG) == RNG_FLAG_CECS) || \
64                                    ((RNG_FLAG) == RNG_FLAG_SECS))
65 #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \
66                                     ((RNG_FLAG) == RNG_FLAG_SECS))
67 /**
68   * @}
69   */
70 
71 /** @defgroup RNG_interrupts_definition
72   * @{
73   */
74 #define RNG_IT_CEI                  ((uint8_t)0x20) /*!< Clock error interrupt */
75 #define RNG_IT_SEI                  ((uint8_t)0x40) /*!< Seed error interrupt */
76 
77 #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00))
78 #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI))
79 /**
80   * @}
81   */
82 
83 /**
84   * @}
85   */
86 
87 /* Exported macro ------------------------------------------------------------*/
88 /* Exported functions --------------------------------------------------------*/
89 
90 /*  Function used to set the RNG configuration to the default reset state *****/
91 void RNG_DeInit(void);
92 
93 /* Configuration function *****************************************************/
94 void RNG_Cmd(FunctionalState NewState);
95 
96 /* Get 32 bit Random number function ******************************************/
97 uint32_t RNG_GetRandomNumber(void);
98 
99 /* Interrupts and flags management functions **********************************/
100 void RNG_ITConfig(FunctionalState NewState);
101 FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG);
102 void RNG_ClearFlag(uint8_t RNG_FLAG);
103 ITStatus RNG_GetITStatus(uint8_t RNG_IT);
104 void RNG_ClearITPendingBit(uint8_t RNG_IT);
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /*__STM32F2xx_RNG_H */
111 
112 /**
113   * @}
114   */
115 
116 /**
117   * @}
118   */
119 
120 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
121