mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/cmsis/TARGET_STM/TARGET_DISCO_F407VG/stm32f4xx_hal_rng.c
- Revision:
- 242:7074e42da0b2
- Parent:
- 133:d4dda5c437f0
diff -r ffe41b0c8126 -r 7074e42da0b2 targets/cmsis/TARGET_STM/TARGET_DISCO_F407VG/stm32f4xx_hal_rng.c --- a/targets/cmsis/TARGET_STM/TARGET_DISCO_F407VG/stm32f4xx_hal_rng.c Thu Jun 26 10:30:09 2014 +0100 +++ b/targets/cmsis/TARGET_STM/TARGET_DISCO_F407VG/stm32f4xx_hal_rng.c Fri Jun 27 07:30:09 2014 +0100 @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f4xx_hal_rng.c * @author MCD Application Team - * @version V1.0.0 - * @date 18-February-2014 + * @version V1.1.0RC2 + * @date 14-May-2014 * @brief RNG HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Random Number Generator (RNG) peripheral: @@ -102,7 +102,8 @@ /** * @brief Initializes the RNG according to the specified * parameters in the RNG_InitTypeDef and creates the associated handle. - * @param hrng: RNG handle + * @param hrng: pointer to a RNG_HandleTypeDef structure that contains + * the configuration information for RNG. * @retval HAL status */ HAL_StatusTypeDef HAL_RNG_Init(RNG_HandleTypeDef *hrng) @@ -118,20 +119,23 @@ /* Init the low level hardware */ HAL_RNG_MspInit(hrng); } + /* Change RNG peripheral state */ + hrng->State = HAL_RNG_STATE_BUSY; /* Enable the RNG Peripheral */ __HAL_RNG_ENABLE(hrng); - + /* Initialize the RNG state */ hrng->State = HAL_RNG_STATE_READY; - + /* Return function status */ return HAL_OK; } /** * @brief DeInitializes the RNG peripheral. - * @param hrng: RNG handle + * @param hrng: pointer to a RNG_HandleTypeDef structure that contains + * the configuration information for RNG. * @retval HAL status */ HAL_StatusTypeDef HAL_RNG_DeInit(RNG_HandleTypeDef *hrng) @@ -168,7 +172,8 @@ /** * @brief Initializes the RNG MSP. - * @param hrng: RNG handle + * @param hrng: pointer to a RNG_HandleTypeDef structure that contains + * the configuration information for RNG. * @retval None */ __weak void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng) @@ -180,7 +185,8 @@ /** * @brief DeInitializes the RNG MSP. - * @param hrng: RNG handle + * @param hrng: pointer to a RNG_HandleTypeDef structure that contains + * the configuration information for RNG. * @retval None */ __weak void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng) @@ -215,7 +221,8 @@ * @brief Returns a 32-bit random number. * @note Each time the random number data is read the RNG_FLAG_DRDY flag * is automatically cleared. - * @param hrng: RNG handle + * @param hrng: pointer to a RNG_HandleTypeDef structure that contains + * the configuration information for RNG. * @retval 32-bit random number */ uint32_t HAL_RNG_GetRandomNumber(RNG_HandleTypeDef *hrng) @@ -249,7 +256,8 @@ /** * @brief Returns a 32-bit random number with interrupt enabled. - * @param hrng: RNG handle + * @param hrng: pointer to a RNG_HandleTypeDef structure that contains + * the configuration information for RNG. * @retval 32-bit random number */ uint32_t HAL_RNG_GetRandomNumber_IT(RNG_HandleTypeDef *hrng) @@ -286,13 +294,14 @@ * not have enough entropy. In this case, it is recommended to clear the * SEIS bit using __HAL_RNG_CLEAR_FLAG(), then disable and enable * the RNG peripheral to reinitialize and restart the RNG. - * @param hrng: RNG handle + * @param hrng: pointer to a RNG_HandleTypeDef structure that contains + * the configuration information for RNG. * @retval None */ void HAL_RNG_IRQHandler(RNG_HandleTypeDef *hrng) { - /* RNG clock error interrupt occured */ + /* RNG clock error interrupt occurred */ if(__HAL_RNG_GET_FLAG(hrng, RNG_IT_CEI) != RESET) { HAL_RNG_ErrorCallback(hrng); @@ -307,7 +316,7 @@ __HAL_UNLOCK(hrng); } - /* RNG seed error interrupt occured */ + /* RNG seed error interrupt occurred */ if(__HAL_RNG_GET_FLAG(hrng, RNG_IT_SEI) != RESET) { HAL_RNG_ErrorCallback(hrng); @@ -341,7 +350,8 @@ /** * @brief Data Ready callback in non-blocking mode. - * @param hrng: RNG handle + * @param hrng: pointer to a RNG_HandleTypeDef structure that contains + * the configuration information for RNG. * @retval None */ @@ -354,7 +364,8 @@ /** * @brief RNG error callbacks. - * @param hrng: RNG handle + * @param hrng: pointer to a RNG_HandleTypeDef structure that contains + * the configuration information for RNG. * @retval None */ __weak void HAL_RNG_ErrorCallback(RNG_HandleTypeDef *hrng) @@ -385,7 +396,8 @@ /** * @brief Returns the RNG state. - * @param hrng: RNG handle + * @param hrng: pointer to a RNG_HandleTypeDef structure that contains + * the configuration information for RNG. * @retval HAL state */ HAL_RNG_StateTypeDef HAL_RNG_GetState(RNG_HandleTypeDef *hrng)