apm32f4xx_rng.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*!
  2. * @file apm32f4xx_rng.h
  3. *
  4. * @brief This file contains all the functions prototypes for the Random Number Generator(RNG) firmware library.
  5. *
  6. * @version V1.0.2
  7. *
  8. * @date 2022-06-23
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2021-2022 Geehy Semiconductor
  13. *
  14. * You may not use this file except in compliance with the
  15. * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
  16. *
  17. * The program is only for reference, which is distributed in the hope
  18. * that it will be usefull and instructional for customers to develop
  19. * their software. Unless required by applicable law or agreed to in
  20. * writing, the program is distributed on an "AS IS" BASIS, WITHOUT
  21. * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
  23. * and limitations under the License.
  24. */
  25. /* Define to prevent recursive inclusion */
  26. #ifndef __APM32F4XX_RNG_H
  27. #define __APM32F4XX_RNG_H
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* Includes */
  32. #include "apm32f4xx.h"
  33. /** @addtogroup APM32F4xx_StdPeriphDriver
  34. @{
  35. */
  36. /** @addtogroup RNG_Driver
  37. @{
  38. */
  39. /** @defgroup RNG_Enumerations
  40. @{
  41. */
  42. /**
  43. * @brief RNG flags definition
  44. */
  45. typedef enum
  46. {
  47. RNG_FLAG_DATARDY = (uint8_t)BIT0, /*!< Data ready flag */
  48. RNG_FLAG_CLKERCSTS = (uint8_t)BIT1, /*!< RNG clock error flag */
  49. RNG_FLAG_FSCSTS = (uint8_t)BIT2, /*!< Faulty sequence flag */
  50. }RNG_FLAG_T;
  51. /**
  52. * @brief RNG interrupts definition
  53. */
  54. typedef enum
  55. {
  56. RNG_INT_FLAG_CLKERINT = (uint8_t)BIT5, /*!< RNG clock Error interrupt */
  57. RNG_INT_FLAG_FSINT = (uint8_t)BIT6, /*!< Faulty Sequence Interrupt */
  58. }RNG_INT_FLAG_T;
  59. /**@} end of group RNG_Enumerations*/
  60. /** @defgroup RNG_Functions
  61. @{
  62. */
  63. /* RNG Reset and Configuration */
  64. void RNG_Reset(void);
  65. void RNG_Enable(void);
  66. void RNG_Disable(void);
  67. /* Get 32 bit Random number */
  68. uint32_t RNG_ReadRandomNumber(void);
  69. /* Interrupts and flags */
  70. void EnableInterrupt(void);
  71. void DisableInterrupt(void);
  72. uint8_t RNG_ReadStatusFlag(RNG_FLAG_T flag);
  73. void RNG_ClearStatusFlag(uint8_t flag);
  74. uint8_t RNG_ReadIntFlag(RNG_INT_FLAG_T flag);
  75. void RNG_ClearIntFlag(uint8_t flag);
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif /*__APM32F4XX_RNG_H */
  80. /**@} end of group RNG_Enumerations */
  81. /**@} end of group RNG_Driver */
  82. /**@} end of group APM32F4xx_StdPeriphDriver */