rng.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /**
  2. ******************************************************************************
  3. * @file rng.c
  4. * @brief This file provides code for the configuration
  5. * of the RNG instances.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under Ultimate Liberty license
  13. * SLA0044, the "License"; You may not use this file except in compliance with
  14. * the License. You may obtain a copy of the License at:
  15. * www.st.com/SLA0044
  16. *
  17. ******************************************************************************
  18. */
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "rng.h"
  21. /* USER CODE BEGIN 0 */
  22. /* USER CODE END 0 */
  23. RNG_HandleTypeDef hrng;
  24. /* RNG init function */
  25. void MX_RNG_Init(void)
  26. {
  27. /* USER CODE BEGIN RNG_Init 0 */
  28. /* USER CODE END RNG_Init 0 */
  29. /* USER CODE BEGIN RNG_Init 1 */
  30. /* USER CODE END RNG_Init 1 */
  31. hrng.Instance = RNG;
  32. hrng.Init.ClockErrorDetection = RNG_CED_ENABLE;
  33. if (HAL_RNG_Init(&hrng) != HAL_OK)
  34. {
  35. Error_Handler();
  36. }
  37. /* USER CODE BEGIN RNG_Init 2 */
  38. /* USER CODE END RNG_Init 2 */
  39. }
  40. void HAL_RNG_MspInit(RNG_HandleTypeDef* rngHandle)
  41. {
  42. if(rngHandle->Instance==RNG)
  43. {
  44. /* USER CODE BEGIN RNG_MspInit 0 */
  45. /* USER CODE END RNG_MspInit 0 */
  46. /* RNG clock enable */
  47. __HAL_RCC_RNG_CLK_ENABLE();
  48. /* USER CODE BEGIN RNG_MspInit 1 */
  49. /* USER CODE END RNG_MspInit 1 */
  50. }
  51. }
  52. void HAL_RNG_MspDeInit(RNG_HandleTypeDef* rngHandle)
  53. {
  54. if(rngHandle->Instance==RNG)
  55. {
  56. /* USER CODE BEGIN RNG_MspDeInit 0 */
  57. /* USER CODE END RNG_MspDeInit 0 */
  58. /* Peripheral clock disable */
  59. __HAL_RCC_RNG_CLK_DISABLE();
  60. /* USER CODE BEGIN RNG_MspDeInit 1 */
  61. /* USER CODE END RNG_MspDeInit 1 */
  62. }
  63. }
  64. /* USER CODE BEGIN 1 */
  65. /* USER CODE END 1 */
  66. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/