1 /********************************** (C) COPYRIGHT ******************************* 2 * File Name : ch32f20x_rng.h 3 * Author : WCH 4 * Version : V1.0.0 5 * Date : 2021/08/08 6 * Description : This file contains all the functions prototypes for the 7 * RNG firmware library. 8 *******************************************************************************/ 9 #ifndef __CH32F20x_RNG_H 10 #define __CH32F20x_RNG_H 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 #include "ch32f20x.h" 16 17 /* RNG_flags_definition*/ 18 #define RNG_FLAG_DRDY ((uint8_t)0x0001) /* Data ready */ 19 #define RNG_FLAG_CECS ((uint8_t)0x0002) /* Clock error current status */ 20 #define RNG_FLAG_SECS ((uint8_t)0x0004) /* Seed error current status */ 21 22 /* RNG_interrupts_definition */ 23 #define RNG_IT_CEI ((uint8_t)0x20) /* Clock error interrupt */ 24 #define RNG_IT_SEI ((uint8_t)0x40) /* Seed error interrupt */ 25 26 27 void RNG_Cmd(FunctionalState NewState); 28 uint32_t RNG_GetRandomNumber(void); 29 void RNG_ITConfig(FunctionalState NewState); 30 FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG); 31 void RNG_ClearFlag(uint8_t RNG_FLAG); 32 ITStatus RNG_GetITStatus(uint8_t RNG_IT); 33 void RNG_ClearITPendingBit(uint8_t RNG_IT); 34 35 #ifdef __cplusplus 36 } 37 #endif 38 39 #endif 40