stm32f4xx_rng.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_rng.h
  4. * @author MCD Application Team
  5. * @version V1.8.1
  6. * @date 27-January-2022
  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) 2016 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 __STM32F4xx_RNG_H
  23. #define __STM32F4xx_RNG_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* Includes ------------------------------------------------------------------*/
  28. #include "stm32f4xx.h"
  29. /** @addtogroup STM32F4xx_StdPeriph_Driver
  30. * @{
  31. */
  32. /** @addtogroup RNG
  33. * @{
  34. */
  35. #if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F429_439xx) || defined(STM32F469_479xx)
  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. #endif /* STM32F40_41xxx || STM32F427_437xx || STM32F410xx || STM32F412xG || STM32F413_423xx || STM32F429_439xx || STM32F469_479xx */
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86. #endif /*__STM32F4xx_RNG_H */
  87. /**
  88. * @}
  89. */
  90. /**
  91. * @}
  92. */