2 ******************************************************************************
3 * @file stm32f4xx_rng.h
4 * @author MCD Application Team
7 * @brief This file contains all the functions prototypes for the Random
8 * Number Generator(RNG) firmware library.
9 ******************************************************************************
12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
20 ******************************************************************************
23 /* Define to prevent recursive inclusion -------------------------------------*/
24 #ifndef __STM32F4xx_RNG_H
25 #define __STM32F4xx_RNG_H
31 /* Includes ------------------------------------------------------------------*/
32 #include "stm32f4xx.h"
34 /** @addtogroup STM32F4xx_StdPeriph_Driver
42 /* Exported types ------------------------------------------------------------*/
43 /* Exported constants --------------------------------------------------------*/
45 /** @defgroup RNG_Exported_Constants
49 /** @defgroup RNG_flags_definition
52 #define RNG_FLAG_DRDY ((uint8_t)0x0001) /*!< Data ready */
53 #define RNG_FLAG_CECS ((uint8_t)0x0002) /*!< Clock error current status */
54 #define RNG_FLAG_SECS ((uint8_t)0x0004) /*!< Seed error current status */
56 #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \
57 ((RNG_FLAG) == RNG_FLAG_CECS) || \
58 ((RNG_FLAG) == RNG_FLAG_SECS))
59 #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \
60 ((RNG_FLAG) == RNG_FLAG_SECS))
65 /** @defgroup RNG_interrupts_definition
68 #define RNG_IT_CEI ((uint8_t)0x20) /*!< Clock error interrupt */
69 #define RNG_IT_SEI ((uint8_t)0x40) /*!< Seed error interrupt */
71 #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00))
72 #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI))
81 /* Exported macro ------------------------------------------------------------*/
82 /* Exported functions --------------------------------------------------------*/
84 /* Function used to set the RNG configuration to the default reset state *****/
85 void RNG_DeInit(void);
87 /* Configuration function *****************************************************/
88 void RNG_Cmd(FunctionalState NewState);
90 /* Get 32 bit Random number function ******************************************/
91 uint32_t RNG_GetRandomNumber(void);
93 /* Interrupts and flags management functions **********************************/
94 void RNG_ITConfig(FunctionalState NewState);
95 FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG);
96 void RNG_ClearFlag(uint8_t RNG_FLAG);
97 ITStatus RNG_GetITStatus(uint8_t RNG_IT);
98 void RNG_ClearITPendingBit(uint8_t RNG_IT);
104 #endif /*__STM32F4xx_RNG_H */
114 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/