stm32f4xx_rng.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_rng.h
  4. * @author MCD Application Team
  5. * @version V1.8.0
  6. * @date 04-November-2016
  7. * @brief This file contains all the functions prototypes for the Random
  8. * Number Generator(RNG) firmware library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM32F4xx_RNG_H
  30. #define __STM32F4xx_RNG_H
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* Includes ------------------------------------------------------------------*/
  35. #include "stm32f4xx.h"
  36. /** @addtogroup STM32F4xx_StdPeriph_Driver
  37. * @{
  38. */
  39. /** @addtogroup RNG
  40. * @{
  41. */
  42. #if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F429_439xx) || defined(STM32F469_479xx)
  43. /* Exported types ------------------------------------------------------------*/
  44. /* Exported constants --------------------------------------------------------*/
  45. /** @defgroup RNG_Exported_Constants
  46. * @{
  47. */
  48. /** @defgroup RNG_flags_definition
  49. * @{
  50. */
  51. #define RNG_FLAG_DRDY ((uint8_t)0x0001) /*!< Data ready */
  52. #define RNG_FLAG_CECS ((uint8_t)0x0002) /*!< Clock error current status */
  53. #define RNG_FLAG_SECS ((uint8_t)0x0004) /*!< Seed error current status */
  54. #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \
  55. ((RNG_FLAG) == RNG_FLAG_CECS) || \
  56. ((RNG_FLAG) == RNG_FLAG_SECS))
  57. #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \
  58. ((RNG_FLAG) == RNG_FLAG_SECS))
  59. /**
  60. * @}
  61. */
  62. /** @defgroup RNG_interrupts_definition
  63. * @{
  64. */
  65. #define RNG_IT_CEI ((uint8_t)0x20) /*!< Clock error interrupt */
  66. #define RNG_IT_SEI ((uint8_t)0x40) /*!< Seed error interrupt */
  67. #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00))
  68. #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI))
  69. /**
  70. * @}
  71. */
  72. /**
  73. * @}
  74. */
  75. /* Exported macro ------------------------------------------------------------*/
  76. /* Exported functions --------------------------------------------------------*/
  77. /* Function used to set the RNG configuration to the default reset state *****/
  78. void RNG_DeInit(void);
  79. /* Configuration function *****************************************************/
  80. void RNG_Cmd(FunctionalState NewState);
  81. /* Get 32 bit Random number function ******************************************/
  82. uint32_t RNG_GetRandomNumber(void);
  83. /* Interrupts and flags management functions **********************************/
  84. void RNG_ITConfig(FunctionalState NewState);
  85. FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG);
  86. void RNG_ClearFlag(uint8_t RNG_FLAG);
  87. ITStatus RNG_GetITStatus(uint8_t RNG_IT);
  88. void RNG_ClearITPendingBit(uint8_t RNG_IT);
  89. #endif /* STM32F40_41xxx || STM32F427_437xx || STM32F410xx || STM32F412xG || STM32F413_423xx || STM32F429_439xx || STM32F469_479xx */
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif /*__STM32F4xx_RNG_H */
  94. /**
  95. * @}
  96. */
  97. /**
  98. * @}
  99. */
  100. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/