stm32f4xx_rng.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_rng.h
  4. * @author MCD Application Team
  5. * @version V1.5.0
  6. * @date 06-March-2015
  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 2015 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. /* Exported types ------------------------------------------------------------*/
  43. /* Exported constants --------------------------------------------------------*/
  44. /** @defgroup RNG_Exported_Constants
  45. * @{
  46. */
  47. /** @defgroup RNG_flags_definition
  48. * @{
  49. */
  50. #define RNG_FLAG_DRDY ((uint8_t)0x0001) /*!< Data ready */
  51. #define RNG_FLAG_CECS ((uint8_t)0x0002) /*!< Clock error current status */
  52. #define RNG_FLAG_SECS ((uint8_t)0x0004) /*!< Seed error current status */
  53. #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \
  54. ((RNG_FLAG) == RNG_FLAG_CECS) || \
  55. ((RNG_FLAG) == RNG_FLAG_SECS))
  56. #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \
  57. ((RNG_FLAG) == RNG_FLAG_SECS))
  58. /**
  59. * @}
  60. */
  61. /** @defgroup RNG_interrupts_definition
  62. * @{
  63. */
  64. #define RNG_IT_CEI ((uint8_t)0x20) /*!< Clock error interrupt */
  65. #define RNG_IT_SEI ((uint8_t)0x40) /*!< Seed error interrupt */
  66. #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00))
  67. #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI))
  68. /**
  69. * @}
  70. */
  71. /**
  72. * @}
  73. */
  74. /* Exported macro ------------------------------------------------------------*/
  75. /* Exported functions --------------------------------------------------------*/
  76. /* Function used to set the RNG configuration to the default reset state *****/
  77. void RNG_DeInit(void);
  78. /* Configuration function *****************************************************/
  79. void RNG_Cmd(FunctionalState NewState);
  80. /* Get 32 bit Random number function ******************************************/
  81. uint32_t RNG_GetRandomNumber(void);
  82. /* Interrupts and flags management functions **********************************/
  83. void RNG_ITConfig(FunctionalState NewState);
  84. FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG);
  85. void RNG_ClearFlag(uint8_t RNG_FLAG);
  86. ITStatus RNG_GetITStatus(uint8_t RNG_IT);
  87. void RNG_ClearITPendingBit(uint8_t RNG_IT);
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif /*__STM32F4xx_RNG_H */
  92. /**
  93. * @}
  94. */
  95. /**
  96. * @}
  97. */
  98. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/