@@ -134,6 +134,28 @@ typedef struct
134134 * @}
135135 */
136136
137+ #if (defined(RNG_NSCR_EN_OSC1 ) || defined(RNG_NSCR_EN_OSC2 ) || defined(RNG_NSCR_EN_OSC3 ))
138+ /** @defgroup RNG_LL_NSCR_Oscillator_Sources Oscillator Sources Defines
139+ * @{
140+ */
141+ #define LL_RNG_OSC_1 RNG_NSCR_EN_OSC1
142+ #define LL_RNG_OSC_2 RNG_NSCR_EN_OSC2
143+ #define LL_RNG_OSC_3 RNG_NSCR_EN_OSC3
144+ /**
145+ * @}
146+ */
147+
148+ /** @defgroup RNG_LL_NSCR_Noise_Sources_Ports Noise Sources Ports Defines
149+ * @{
150+ */
151+ #define LL_RNG_NOISE_SRC_1 (0x01UL)
152+ #define LL_RNG_NOISE_SRC_2 (0x02UL)
153+ #define LL_RNG_NOISE_SRC_3 (0x04UL)
154+ /**
155+ * @}
156+ */
157+
158+ #endif /* RNG_CR_CONDRST */
137159/** @defgroup RNG_LL_EC_IT IT Defines
138160 * @brief IT defines which can be used with LL_RNG_ReadReg and LL_RNG_WriteReg macros
139161 * @{
@@ -677,11 +699,11 @@ __STATIC_INLINE void LL_RNG_SetHealthConfig(RNG_TypeDef *RNGx, uint32_t HTCFG)
677699#if defined(RNG_HTCR_NIST_VALUE )
678700 /* For NIST compliance we can fin the recommended value in the application note AN4230 */
679701#endif /* defined(RNG_HTCR_NIST_VALUE) */
680- #if defined(RNG_HTCR0_HTCFG )
702+ #if defined(RNG_HTCR3_HTCFG )
681703 WRITE_REG (RNGx -> HTCR [0 ], HTCFG );
682704#else
683705 WRITE_REG (RNGx -> HTCR , HTCFG );
684- #endif /* defined( RNG_HTCR0_HTCFG) */
706+ #endif /* RNG_HTCR0_HTCFG || RNG_HTCR1_HTCFG || RNG_HTCR2_HTCFG || RNG_HTCR3_HTCFG */
685707}
686708
687709/**
@@ -692,17 +714,53 @@ __STATIC_INLINE void LL_RNG_SetHealthConfig(RNG_TypeDef *RNGx, uint32_t HTCFG)
692714 */
693715__STATIC_INLINE uint32_t LL_RNG_GetHealthConfig (const RNG_TypeDef * RNGx )
694716{
695- #if defined(RNG_HTCR0_HTCFG )
717+ #if defined(RNG_HTCR3_HTCFG )
696718 return (uint32_t )READ_REG (RNGx -> HTCR [0 ]);
697719#else
698720 return (uint32_t )READ_REG (RNGx -> HTCR );
699- #endif /* defined(RNG_HTCR0_HTCFG) */
721+ #endif /* RNG_HTCR0_HTCFG || RNG_HTCR1_HTCFG || RNG_HTCR2_HTCFG || RNG_HTCR3_HTCFG */
722+ }
723+
724+ /**
725+ * @}
726+ */
727+ #if defined(RNG_HTCR3_HTCFG )
728+
729+ /** @defgroup RNG Additional Health Test Control
730+ * @{
731+ */
732+
733+ /**
734+ * @brief Set RNG Additional Health Test Control
735+ * @rmtoll HTCR HTCFG LL_RNG_SetAdditionalHealthTest
736+ * @param RNGx RNG Instance
737+ * @param htcr_idx Additional health tests registers index can be one f the following values
738+ * @param HTCFG can be values of 32 bits
739+ * @retval None
740+ */
741+ __STATIC_INLINE void LL_RNG_SetAdditionalHealthTest (RNG_TypeDef * RNGx , uint32_t htcr_idx , uint32_t HTCFG )
742+ {
743+ WRITE_REG (RNGx -> HTCR [htcr_idx ], HTCFG );
700744}
701745
746+ /**
747+ * @brief Get RNG Additional Health Test Control
748+ * @rmtoll HTCR HTCFG LL_RNG_GetAdditionalHealthTest
749+ * @param RNGx RNG Instance
750+ * @param htcr_idx Additional health tests registers index
751+ * @retval Return 32-bit RNG Health Test configuration
752+ */
753+ __STATIC_INLINE uint32_t LL_RNG_GetAdditionalHealthTest (const RNG_TypeDef * RNGx , uint32_t htcr_idx )
754+ {
755+ return (uint32_t )READ_REG (RNGx -> HTCR [htcr_idx ]);
756+ }
702757/**
703758 * @}
704759 */
705760
761+ #endif /* RNG_HTCR0_HTCFG || RNG_HTCR1_HTCFG || RNG_HTCR2_HTCFG || RNG_HTCR3_HTCFG */
762+ #if defined(RNG_NSCR_NIST_VALUE )
763+
706764/** @defgroup RNG_LL_EF_Noise_Test_Control Noise Test Control
707765 * @{
708766 */
@@ -728,14 +786,112 @@ __STATIC_INLINE void LL_RNG_SetNoiseConfig(RNG_TypeDef *RNGx, uint32_t NOISECFG)
728786 */
729787__STATIC_INLINE uint32_t LL_RNG_GetNoiseConfig (const RNG_TypeDef * RNGx )
730788{
731-
732789 return (uint32_t )READ_REG (RNGx -> NSCR );
733790}
734791
735792/**
736793 * @}
737794 */
738795
796+ #endif /* defined(RNG_NSCR_NIST_VALUE) */
797+ #if defined(RNG_HTCR3_HTCFG )
798+ /** @defgroup RNG Health Tests Status control
799+ * @{
800+ */
801+
802+ /**
803+ * @brief Get RNG Health Tests Status.
804+ * @rmtoll HTSR htsr_idx LL_RNG_GetHealthTestStatus
805+ * @param RNGx RNG Instance
806+ * @param htsr_idx Health tests registers status index
807+ * @retval Return 32-bit RNG Health Test Status
808+ */
809+ __STATIC_INLINE uint32_t LL_RNG_GetHealthTestStatus (const RNG_TypeDef * RNGx , uint32_t htsr_idx )
810+ {
811+ return (uint32_t )READ_REG (RNGx -> HTSR [htsr_idx ]);
812+ }
813+
814+ /**
815+ * @}
816+ */
817+
818+ #endif /* defined(RNG_HTCR0_HTCFG) || defined(RNG_HTCR1_HTCFG) || defined(RNG_HTCR2_HTCFG) */
819+ #if defined(RNG_NSMR_MOSC1 )
820+ /** @defgroup RNG noise source mask Control
821+ * @{
822+ */
823+
824+ /**
825+ * @brief Set RNG noise source mask.
826+ * @rmtoll NSMR htsr_idx LL_RNG_GetNoiseSourceMask
827+ * @param RNGx RNG Instance
828+ * @param nsmr can be values of 32 bits
829+ */
830+ __STATIC_INLINE void LL_RNG_SetNoiseSourceMask (RNG_TypeDef * RNGx , uint32_t nsmr )
831+ {
832+ WRITE_REG (RNGx -> NSMR , nsmr );
833+ }
834+
835+ /**
836+ * @brief Get RNG noise source mask.
837+ * @rmtoll NSMR htsr_idx LL_RNG_GetNoiseSourceMask
838+ * @param RNGx RNG Instance
839+ * @retval Return 32-bit RNG Noise Source Mask
840+ */
841+ __STATIC_INLINE uint32_t LL_RNG_GetNoiseSourceMask (const RNG_TypeDef * RNGx )
842+ {
843+ return READ_REG (RNGx -> NSMR );
844+ }
845+
846+ /**
847+ * @}
848+ */
849+
850+ #endif /* RNG_NSMR_MOSC1 */
851+ #if (defined(RNG_NSCR_EN_OSC1 ) || defined(RNG_NSCR_EN_OSC2 ) || defined(RNG_NSCR_EN_OSC3 ))
852+ /** @defgroup RNG noise source Control
853+ * @{
854+ */
855+
856+ /**
857+ * @brief Set RNG Noise Source Configuration.
858+ * @rmtoll
859+ * NSCR NSCR LL_RNG_GetOscNoiseSrc
860+ * @param RNGx RNG Instance
861+ * @param osc be one of the following values:
862+ * @arg @ref LL_RNG_OSC_1
863+ * @arg @ref LL_RNG_OSC_2
864+ * @arg @ref LL_RNG_OSC_3
865+ * @retval can be one of the following values:
866+ * @arg @ref LL_RNG_NOISE_SRC_1
867+ * @arg @ref LL_RNG_NOISE_SRC_2
868+ * @arg @ref LL_RNG_NOISE_SRC_3
869+ */
870+ __STATIC_INLINE void LL_RNG_SetOscNoiseSrc (RNG_TypeDef * RNGx , uint32_t osc )
871+ {
872+ WRITE_REG (RNGx -> NSCR , osc );
873+ }
874+
875+ /**
876+ * @brief Get RNG Noise Source Configuration.
877+ * @rmtoll
878+ * NSCR NSCR LL_RNG_GetOscNoiseSrc
879+ * @param RNGx RNG Instance
880+ * @param osc be one of the following values:
881+ * @arg @ref LL_RNG_OSC_1
882+ * @arg @ref LL_RNG_OSC_2
883+ * @arg @ref LL_RNG_OSC_3
884+ * @retval can be one of the following values:
885+ * @arg @ref LL_RNG_NOISE_SRC_1
886+ * @arg @ref LL_RNG_NOISE_SRC_2
887+ * @arg @ref LL_RNG_NOISE_SRC_3
888+ */
889+ __STATIC_INLINE uint32_t LL_RNG_GetOscNoiseSrc (const RNG_TypeDef * RNGx , uint32_t osc )
890+ {
891+ return (READ_BIT (RNGx -> NSCR , osc ) >> POSITION_VAL (osc ));
892+ }
893+
894+ #endif /* defined(defined(RNG_NSCR_EN_OSC1) || RNG_NSCR_EN_OSC2 ||RNG_NSCR_EN_OSC3) */
739895#if defined(USE_FULL_LL_DRIVER )
740896/** @defgroup RNG_LL_EF_Init Initialization and de-initialization functions
741897 * @{
0 commit comments