mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
92:4fc01daae5a5
remove SerialHalfDuplex.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 89:552587b429a1 1 /**
bogdanm 89:552587b429a1 2 ******************************************************************************
bogdanm 89:552587b429a1 3 * @file stm32f4xx_hal_rng.h
bogdanm 89:552587b429a1 4 * @author MCD Application Team
bogdanm 92:4fc01daae5a5 5 * @version V1.1.0
bogdanm 92:4fc01daae5a5 6 * @date 19-June-2014
bogdanm 89:552587b429a1 7 * @brief Header file of RNG HAL module.
bogdanm 89:552587b429a1 8 ******************************************************************************
bogdanm 89:552587b429a1 9 * @attention
bogdanm 89:552587b429a1 10 *
bogdanm 89:552587b429a1 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 89:552587b429a1 12 *
bogdanm 89:552587b429a1 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 89:552587b429a1 14 * are permitted provided that the following conditions are met:
bogdanm 89:552587b429a1 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 89:552587b429a1 16 * this list of conditions and the following disclaimer.
bogdanm 89:552587b429a1 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 89:552587b429a1 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 89:552587b429a1 19 * and/or other materials provided with the distribution.
bogdanm 89:552587b429a1 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 89:552587b429a1 21 * may be used to endorse or promote products derived from this software
bogdanm 89:552587b429a1 22 * without specific prior written permission.
bogdanm 89:552587b429a1 23 *
bogdanm 89:552587b429a1 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 89:552587b429a1 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 89:552587b429a1 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 89:552587b429a1 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 89:552587b429a1 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 89:552587b429a1 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 89:552587b429a1 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 89:552587b429a1 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 89:552587b429a1 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 89:552587b429a1 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 89:552587b429a1 34 *
bogdanm 89:552587b429a1 35 ******************************************************************************
bogdanm 89:552587b429a1 36 */
bogdanm 89:552587b429a1 37
bogdanm 89:552587b429a1 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 89:552587b429a1 39 #ifndef __STM32F4xx_HAL_RNG_H
bogdanm 89:552587b429a1 40 #define __STM32F4xx_HAL_RNG_H
bogdanm 89:552587b429a1 41
bogdanm 89:552587b429a1 42 #ifdef __cplusplus
bogdanm 89:552587b429a1 43 extern "C" {
bogdanm 89:552587b429a1 44 #endif
bogdanm 89:552587b429a1 45
bogdanm 92:4fc01daae5a5 46 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
bogdanm 92:4fc01daae5a5 47 defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
bogdanm 89:552587b429a1 48 /* Includes ------------------------------------------------------------------*/
bogdanm 89:552587b429a1 49 #include "stm32f4xx_hal_def.h"
bogdanm 89:552587b429a1 50
bogdanm 89:552587b429a1 51 /** @addtogroup STM32F4xx_HAL_Driver
bogdanm 89:552587b429a1 52 * @{
bogdanm 89:552587b429a1 53 */
bogdanm 89:552587b429a1 54
bogdanm 89:552587b429a1 55 /** @addtogroup RNG
bogdanm 89:552587b429a1 56 * @{
bogdanm 89:552587b429a1 57 */
bogdanm 89:552587b429a1 58
bogdanm 89:552587b429a1 59 /* Exported types ------------------------------------------------------------*/
bogdanm 89:552587b429a1 60
bogdanm 89:552587b429a1 61 /**
bogdanm 89:552587b429a1 62 * @brief RNG HAL State Structure definition
bogdanm 89:552587b429a1 63 */
bogdanm 89:552587b429a1 64 typedef enum
bogdanm 89:552587b429a1 65 {
bogdanm 89:552587b429a1 66 HAL_RNG_STATE_RESET = 0x00, /*!< RNG not yet initialized or disabled */
bogdanm 89:552587b429a1 67 HAL_RNG_STATE_READY = 0x01, /*!< RNG initialized and ready for use */
bogdanm 89:552587b429a1 68 HAL_RNG_STATE_BUSY = 0x02, /*!< RNG internal process is ongoing */
bogdanm 89:552587b429a1 69 HAL_RNG_STATE_TIMEOUT = 0x03, /*!< RNG timeout state */
bogdanm 89:552587b429a1 70 HAL_RNG_STATE_ERROR = 0x04 /*!< RNG error state */
bogdanm 89:552587b429a1 71
bogdanm 89:552587b429a1 72 }HAL_RNG_StateTypeDef;
bogdanm 89:552587b429a1 73
bogdanm 89:552587b429a1 74 /**
bogdanm 89:552587b429a1 75 * @brief RNG Handle Structure definition
bogdanm 89:552587b429a1 76 */
bogdanm 89:552587b429a1 77 typedef struct
bogdanm 89:552587b429a1 78 {
bogdanm 89:552587b429a1 79 RNG_TypeDef *Instance; /*!< Register base address */
bogdanm 89:552587b429a1 80
bogdanm 89:552587b429a1 81 HAL_LockTypeDef Lock; /*!< RNG locking object */
bogdanm 89:552587b429a1 82
bogdanm 89:552587b429a1 83 __IO HAL_RNG_StateTypeDef State; /*!< RNG communication state */
bogdanm 89:552587b429a1 84
bogdanm 89:552587b429a1 85 }RNG_HandleTypeDef;
bogdanm 89:552587b429a1 86
bogdanm 89:552587b429a1 87 /* Exported constants --------------------------------------------------------*/
bogdanm 89:552587b429a1 88
bogdanm 89:552587b429a1 89 /** @defgroup RNG_Exported_Constants
bogdanm 89:552587b429a1 90 * @{
bogdanm 89:552587b429a1 91 */
bogdanm 89:552587b429a1 92
bogdanm 89:552587b429a1 93 /** @defgroup RNG_Interrupt_definition
bogdanm 89:552587b429a1 94 * @{
bogdanm 89:552587b429a1 95 */
bogdanm 89:552587b429a1 96 #define RNG_IT_CEI ((uint32_t)0x20) /*!< Clock error interrupt */
bogdanm 89:552587b429a1 97 #define RNG_IT_SEI ((uint32_t)0x40) /*!< Seed error interrupt */
bogdanm 89:552587b429a1 98
bogdanm 89:552587b429a1 99 #define IS_RNG_IT(IT) (((IT) == RNG_IT_CEI) || \
bogdanm 89:552587b429a1 100 ((IT) == RNG_IT_SEI))
bogdanm 89:552587b429a1 101 /**
bogdanm 89:552587b429a1 102 * @}
bogdanm 89:552587b429a1 103 */
bogdanm 89:552587b429a1 104
bogdanm 89:552587b429a1 105
bogdanm 89:552587b429a1 106 /** @defgroup RNG_Flag_definition
bogdanm 89:552587b429a1 107 * @{
bogdanm 89:552587b429a1 108 */
bogdanm 89:552587b429a1 109 #define RNG_FLAG_DRDY ((uint32_t)0x0001) /*!< Data ready */
bogdanm 89:552587b429a1 110 #define RNG_FLAG_CECS ((uint32_t)0x0002) /*!< Clock error current status */
bogdanm 89:552587b429a1 111 #define RNG_FLAG_SECS ((uint32_t)0x0004) /*!< Seed error current status */
bogdanm 89:552587b429a1 112
bogdanm 89:552587b429a1 113 #define IS_RNG_FLAG(FLAG) (((FLAG) == RNG_FLAG_DRDY) || \
bogdanm 89:552587b429a1 114 ((FLAG) == RNG_FLAG_CECS) || \
bogdanm 89:552587b429a1 115 ((FLAG) == RNG_FLAG_SECS))
bogdanm 89:552587b429a1 116 /**
bogdanm 89:552587b429a1 117 * @}
bogdanm 89:552587b429a1 118 */
bogdanm 89:552587b429a1 119
bogdanm 89:552587b429a1 120 /**
bogdanm 89:552587b429a1 121 * @}
bogdanm 89:552587b429a1 122 */
bogdanm 89:552587b429a1 123
bogdanm 89:552587b429a1 124 /* Exported macro ------------------------------------------------------------*/
bogdanm 89:552587b429a1 125
bogdanm 89:552587b429a1 126 /** @brief Reset RNG handle state
bogdanm 89:552587b429a1 127 * @param __HANDLE__: RNG Handle
bogdanm 89:552587b429a1 128 * @retval None
bogdanm 89:552587b429a1 129 */
bogdanm 89:552587b429a1 130 #define __HAL_RNG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RNG_STATE_RESET)
bogdanm 89:552587b429a1 131
bogdanm 89:552587b429a1 132 /**
bogdanm 89:552587b429a1 133 * @brief Enables the RNG peripheral.
bogdanm 89:552587b429a1 134 * @param __HANDLE__: RNG Handle
bogdanm 89:552587b429a1 135 * @retval None
bogdanm 89:552587b429a1 136 */
bogdanm 89:552587b429a1 137 #define __HAL_RNG_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_RNGEN)
bogdanm 89:552587b429a1 138
bogdanm 89:552587b429a1 139 /**
bogdanm 89:552587b429a1 140 * @brief Disables the RNG peripheral.
bogdanm 89:552587b429a1 141 * @param __HANDLE__: RNG Handle
bogdanm 89:552587b429a1 142 * @retval None
bogdanm 89:552587b429a1 143 */
bogdanm 89:552587b429a1 144 #define __HAL_RNG_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_RNGEN)
bogdanm 89:552587b429a1 145
bogdanm 89:552587b429a1 146 /**
bogdanm 89:552587b429a1 147 * @brief Gets the selected RNG's flag status.
bogdanm 89:552587b429a1 148 * @param __HANDLE__: RNG Handle
bogdanm 89:552587b429a1 149 * @param __FLAG__: RNG flag
bogdanm 89:552587b429a1 150 * @retval The new state of RNG_FLAG (SET or RESET).
bogdanm 89:552587b429a1 151 */
bogdanm 89:552587b429a1 152 #define __HAL_RNG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
bogdanm 89:552587b429a1 153
bogdanm 89:552587b429a1 154 /**
bogdanm 89:552587b429a1 155 * @brief Clears the RNG's pending flags.
bogdanm 89:552587b429a1 156 * @param __HANDLE__: RNG Handle
bogdanm 89:552587b429a1 157 * @param __FLAG__: RNG flag
bogdanm 89:552587b429a1 158 * @retval None
bogdanm 89:552587b429a1 159 */
bogdanm 92:4fc01daae5a5 160 #define __HAL_RNG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__))
bogdanm 89:552587b429a1 161
bogdanm 89:552587b429a1 162 /**
bogdanm 89:552587b429a1 163 * @brief Enables the RNG interrupts.
bogdanm 89:552587b429a1 164 * @param __HANDLE__: RNG Handle
bogdanm 89:552587b429a1 165 * @retval None
bogdanm 89:552587b429a1 166 */
bogdanm 89:552587b429a1 167 #define __HAL_RNG_ENABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_IE)
bogdanm 89:552587b429a1 168
bogdanm 89:552587b429a1 169 /**
bogdanm 89:552587b429a1 170 * @brief Disables the RNG interrupts.
bogdanm 89:552587b429a1 171 * @param __HANDLE__: RNG Handle
bogdanm 89:552587b429a1 172 * @retval None
bogdanm 89:552587b429a1 173 */
bogdanm 89:552587b429a1 174 #define __HAL_RNG_DISABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_IE)
bogdanm 89:552587b429a1 175
bogdanm 89:552587b429a1 176 /**
bogdanm 89:552587b429a1 177 * @brief Checks whether the specified RNG interrupt has occurred or not.
bogdanm 89:552587b429a1 178 * @param __HANDLE__: RNG Handle
bogdanm 89:552587b429a1 179 * @param __INTERRUPT__: specifies the RNG interrupt source to check.
bogdanm 89:552587b429a1 180 * This parameter can be one of the following values:
bogdanm 89:552587b429a1 181 * @arg RNG_FLAG_DRDY: Data ready interrupt
bogdanm 89:552587b429a1 182 * @arg RNG_FLAG_CECS: Clock error interrupt
bogdanm 89:552587b429a1 183 * @arg RNG_FLAG_SECS: Seed error interrupt
bogdanm 89:552587b429a1 184 * @retval The new state of RNG_FLAG (SET or RESET).
bogdanm 89:552587b429a1 185 */
bogdanm 89:552587b429a1 186 #define __HAL_RNG_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->SR & (__INTERRUPT__)) == (__INTERRUPT__))
bogdanm 89:552587b429a1 187
bogdanm 89:552587b429a1 188 /* Exported functions --------------------------------------------------------*/
bogdanm 89:552587b429a1 189
bogdanm 89:552587b429a1 190 /* Initialization/de-initialization functions **********************************/
bogdanm 89:552587b429a1 191 HAL_StatusTypeDef HAL_RNG_Init(RNG_HandleTypeDef *hrng);
bogdanm 89:552587b429a1 192 HAL_StatusTypeDef HAL_RNG_DeInit (RNG_HandleTypeDef *hrng);
bogdanm 89:552587b429a1 193 void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng);
bogdanm 89:552587b429a1 194 void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng);
bogdanm 89:552587b429a1 195
bogdanm 89:552587b429a1 196 /* Peripheral Control functions ************************************************/
bogdanm 89:552587b429a1 197 uint32_t HAL_RNG_GetRandomNumber(RNG_HandleTypeDef *hrng);
bogdanm 89:552587b429a1 198 uint32_t HAL_RNG_GetRandomNumber_IT(RNG_HandleTypeDef *hrng);
bogdanm 89:552587b429a1 199 void HAL_RNG_IRQHandler(RNG_HandleTypeDef *hrng);
bogdanm 89:552587b429a1 200 void HAL_RNG_ReadyCallback(RNG_HandleTypeDef* hrng);
bogdanm 89:552587b429a1 201 void HAL_RNG_ErrorCallback(RNG_HandleTypeDef *hrng);
bogdanm 89:552587b429a1 202
bogdanm 89:552587b429a1 203 /* Peripheral State functions **************************************************/
bogdanm 89:552587b429a1 204 HAL_RNG_StateTypeDef HAL_RNG_GetState(RNG_HandleTypeDef *hrng);
bogdanm 89:552587b429a1 205
bogdanm 92:4fc01daae5a5 206 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
bogdanm 92:4fc01daae5a5 207
bogdanm 89:552587b429a1 208 /**
bogdanm 89:552587b429a1 209 * @}
bogdanm 89:552587b429a1 210 */
bogdanm 89:552587b429a1 211
bogdanm 89:552587b429a1 212 /**
bogdanm 89:552587b429a1 213 * @}
bogdanm 89:552587b429a1 214 */
bogdanm 89:552587b429a1 215
bogdanm 89:552587b429a1 216 #ifdef __cplusplus
bogdanm 89:552587b429a1 217 }
bogdanm 89:552587b429a1 218 #endif
bogdanm 89:552587b429a1 219
bogdanm 89:552587b429a1 220 #endif /* __STM32F4xx_HAL_RNG_H */
bogdanm 89:552587b429a1 221
bogdanm 89:552587b429a1 222 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/