Added STM32F4xx StdPeriph Driver sources
[fw/stlink] / example / stm32f4 / STM32F4xx_StdPeriph_Driver / inc / stm32f4xx_rng.h
1 /**
2   ******************************************************************************
3   * @file    stm32f4xx_rng.h
4   * @author  MCD Application Team
5   * @version V1.0.0RC1
6   * @date    25-August-2011
7   * @brief   This file contains all the functions prototypes for the Random 
8   *          Number Generator(RNG) firmware library.
9   ******************************************************************************
10   * @attention
11   *
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.
18   *
19   * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
20   ******************************************************************************
21   */
22
23 /* Define to prevent recursive inclusion -------------------------------------*/
24 #ifndef __STM32F4xx_RNG_H
25 #define __STM32F4xx_RNG_H
26
27 #ifdef __cplusplus
28  extern "C" {
29 #endif
30
31 /* Includes ------------------------------------------------------------------*/
32 #include "stm32f4xx.h"
33
34 /** @addtogroup STM32F4xx_StdPeriph_Driver
35   * @{
36   */
37
38 /** @addtogroup RNG
39   * @{
40   */ 
41
42 /* Exported types ------------------------------------------------------------*/
43 /* Exported constants --------------------------------------------------------*/ 
44
45 /** @defgroup RNG_Exported_Constants
46   * @{
47   */
48   
49 /** @defgroup RNG_flags_definition  
50   * @{
51   */ 
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 */
55
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))
61 /**
62   * @}
63   */ 
64
65 /** @defgroup RNG_interrupts_definition   
66   * @{
67   */  
68 #define RNG_IT_CEI                  ((uint8_t)0x20) /*!< Clock error interrupt */
69 #define RNG_IT_SEI                  ((uint8_t)0x40) /*!< Seed error interrupt */
70
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))
73 /**
74   * @}
75   */ 
76
77 /**
78   * @}
79   */ 
80
81 /* Exported macro ------------------------------------------------------------*/
82 /* Exported functions --------------------------------------------------------*/ 
83
84 /*  Function used to set the RNG configuration to the default reset state *****/ 
85 void RNG_DeInit(void);
86
87 /* Configuration function *****************************************************/
88 void RNG_Cmd(FunctionalState NewState);
89
90 /* Get 32 bit Random number function ******************************************/
91 uint32_t RNG_GetRandomNumber(void);
92
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);
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #endif /*__STM32F4xx_RNG_H */
105
106 /**
107   * @}
108   */ 
109
110 /**
111   * @}
112   */ 
113
114 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/