stm32f4xx_rng.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_rng.h
  4. * @author MCD Application Team
  5. * @version V1.0.0
  6. * @date 30-September-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. /* Define to prevent recursive inclusion -------------------------------------*/
  23. #ifndef __STM32F4xx_RNG_H
  24. #define __STM32F4xx_RNG_H
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* Includes ------------------------------------------------------------------*/
  29. #include "stm32f4xx.h"
  30. /** @addtogroup STM32F4xx_StdPeriph_Driver
  31. * @{
  32. */
  33. /** @addtogroup RNG
  34. * @{
  35. */
  36. /* Exported types ------------------------------------------------------------*/
  37. /* Exported constants --------------------------------------------------------*/
  38. /** @defgroup RNG_Exported_Constants
  39. * @{
  40. */
  41. /** @defgroup RNG_flags_definition
  42. * @{
  43. */
  44. #define RNG_FLAG_DRDY ((uint8_t)0x0001) /*!< Data ready */
  45. #define RNG_FLAG_CECS ((uint8_t)0x0002) /*!< Clock error current status */
  46. #define RNG_FLAG_SECS ((uint8_t)0x0004) /*!< Seed error current status */
  47. #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \
  48. ((RNG_FLAG) == RNG_FLAG_CECS) || \
  49. ((RNG_FLAG) == RNG_FLAG_SECS))
  50. #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \
  51. ((RNG_FLAG) == RNG_FLAG_SECS))
  52. /**
  53. * @}
  54. */
  55. /** @defgroup RNG_interrupts_definition
  56. * @{
  57. */
  58. #define RNG_IT_CEI ((uint8_t)0x20) /*!< Clock error interrupt */
  59. #define RNG_IT_SEI ((uint8_t)0x40) /*!< Seed error interrupt */
  60. #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00))
  61. #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI))
  62. /**
  63. * @}
  64. */
  65. /**
  66. * @}
  67. */
  68. /* Exported macro ------------------------------------------------------------*/
  69. /* Exported functions --------------------------------------------------------*/
  70. /* Function used to set the RNG configuration to the default reset state *****/
  71. void RNG_DeInit(void);
  72. /* Configuration function *****************************************************/
  73. void RNG_Cmd(FunctionalState NewState);
  74. /* Get 32 bit Random number function ******************************************/
  75. uint32_t RNG_GetRandomNumber(void);
  76. /* Interrupts and flags management functions **********************************/
  77. void RNG_ITConfig(FunctionalState NewState);
  78. FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG);
  79. void RNG_ClearFlag(uint8_t RNG_FLAG);
  80. ITStatus RNG_GetITStatus(uint8_t RNG_IT);
  81. void RNG_ClearITPendingBit(uint8_t RNG_IT);
  82. #ifdef __cplusplus
  83. }
  84. #endif
  85. #endif /*__STM32F4xx_RNG_H */
  86. /**
  87. * @}
  88. */
  89. /**
  90. * @}
  91. */
  92. /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/