stm32f2xx_rng.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. ******************************************************************************
  3. * @file stm32f2xx_rng.h
  4. * @author MCD Application Team
  5. * @version V1.1.3
  6. * @date 31-December-2021
  7. * @brief This file contains all the functions prototypes for the Random
  8. * Number Generator(RNG) firmware library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * Copyright (c) 2012 STMicroelectronics.
  13. * All rights reserved.
  14. *
  15. * This software is licensed under terms that can be found in the LICENSE file
  16. * in the root directory of this software component.
  17. * If no LICENSE file comes with this software, it is provided AS-IS.
  18. *
  19. ******************************************************************************
  20. */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __STM32F2xx_RNG_H
  23. #define __STM32F2xx_RNG_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* Includes ------------------------------------------------------------------*/
  28. #include "stm32f2xx.h"
  29. /** @addtogroup STM32F2xx_StdPeriph_Driver
  30. * @{
  31. */
  32. /** @addtogroup RNG
  33. * @{
  34. */
  35. /* Exported types ------------------------------------------------------------*/
  36. /* Exported constants --------------------------------------------------------*/
  37. /** @defgroup RNG_Exported_Constants
  38. * @{
  39. */
  40. /** @defgroup RNG_flags_definition
  41. * @{
  42. */
  43. #define RNG_FLAG_DRDY ((uint8_t)0x0001) /*!< Data ready */
  44. #define RNG_FLAG_CECS ((uint8_t)0x0002) /*!< Clock error current status */
  45. #define RNG_FLAG_SECS ((uint8_t)0x0004) /*!< Seed error current status */
  46. #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \
  47. ((RNG_FLAG) == RNG_FLAG_CECS) || \
  48. ((RNG_FLAG) == RNG_FLAG_SECS))
  49. #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \
  50. ((RNG_FLAG) == RNG_FLAG_SECS))
  51. /**
  52. * @}
  53. */
  54. /** @defgroup RNG_interrupts_definition
  55. * @{
  56. */
  57. #define RNG_IT_CEI ((uint8_t)0x20) /*!< Clock error interrupt */
  58. #define RNG_IT_SEI ((uint8_t)0x40) /*!< Seed error interrupt */
  59. #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00))
  60. #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI))
  61. /**
  62. * @}
  63. */
  64. /**
  65. * @}
  66. */
  67. /* Exported macro ------------------------------------------------------------*/
  68. /* Exported functions --------------------------------------------------------*/
  69. /* Function used to set the RNG configuration to the default reset state *****/
  70. void RNG_DeInit(void);
  71. /* Configuration function *****************************************************/
  72. void RNG_Cmd(FunctionalState NewState);
  73. /* Get 32 bit Random number function ******************************************/
  74. uint32_t RNG_GetRandomNumber(void);
  75. /* Interrupts and flags management functions **********************************/
  76. void RNG_ITConfig(FunctionalState NewState);
  77. FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG);
  78. void RNG_ClearFlag(uint8_t RNG_FLAG);
  79. ITStatus RNG_GetITStatus(uint8_t RNG_IT);
  80. void RNG_ClearITPendingBit(uint8_t RNG_IT);
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif /*__STM32F2xx_RNG_H */
  85. /**
  86. * @}
  87. */
  88. /**
  89. * @}
  90. */