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 26 /* Define to prevent recursive inclusion */ 27 #ifndef __APM32F4XX_RNG_H 28 #define __APM32F4XX_RNG_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* Includes */ 35 #include "apm32f4xx.h" 36 37 /** @addtogroup APM32F4xx_StdPeriphDriver 38 @{ 39 */ 40 41 /** @addtogroup RNG_Driver 42 @{ 43 */ 44 45 /** @defgroup RNG_Enumerations 46 @{ 47 */ 48 49 /** 50 * @brief RNG flags definition 51 */ 52 typedef enum 53 { 54 RNG_FLAG_DATARDY = (uint8_t)BIT0, /*!< Data ready flag */ 55 RNG_FLAG_CLKERCSTS = (uint8_t)BIT1, /*!< RNG clock error flag */ 56 RNG_FLAG_FSCSTS = (uint8_t)BIT2, /*!< Faulty sequence flag */ 57 }RNG_FLAG_T; 58 59 /** 60 * @brief RNG interrupts definition 61 */ 62 typedef enum 63 { 64 RNG_INT_FLAG_CLKERINT = (uint8_t)BIT5, /*!< RNG clock Error interrupt */ 65 RNG_INT_FLAG_FSINT = (uint8_t)BIT6, /*!< Faulty Sequence Interrupt */ 66 }RNG_INT_FLAG_T; 67 68 /**@} end of group RNG_Enumerations*/ 69 70 /** @defgroup RNG_Functions 71 @{ 72 */ 73 74 /* RNG Reset and Configuration */ 75 void RNG_Reset(void); 76 void RNG_Enable(void); 77 void RNG_Disable(void); 78 79 /* Get 32 bit Random number */ 80 uint32_t RNG_ReadRandomNumber(void); 81 82 /* Interrupts and flags */ 83 void EnableInterrupt(void); 84 void DisableInterrupt(void); 85 uint8_t RNG_ReadStatusFlag(RNG_FLAG_T flag); 86 void RNG_ClearStatusFlag(uint8_t flag); 87 uint8_t RNG_ReadIntFlag(RNG_INT_FLAG_T flag); 88 void RNG_ClearIntFlag(uint8_t flag); 89 90 #ifdef __cplusplus 91 } 92 #endif 93 94 #endif /*__APM32F4XX_RNG_H */ 95 96 /**@} end of group RNG_Enumerations */ 97 /**@} end of group RNG_Driver */ 98 /**@} end of group APM32F4xx_StdPeriphDriver */ 99