Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
99:dbbf35b96557
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 99:dbbf35b96557 1 /**
Kojto 99:dbbf35b96557 2 ******************************************************************************
Kojto 99:dbbf35b96557 3 * @file stm32l0xx_hal_cryp.h
Kojto 99:dbbf35b96557 4 * @author MCD Application Team
Kojto 99:dbbf35b96557 5 * @version V1.2.0
Kojto 99:dbbf35b96557 6 * @date 06-February-2015
Kojto 99:dbbf35b96557 7 * @brief Header file of CRYP HAL module.
Kojto 99:dbbf35b96557 8 ******************************************************************************
Kojto 99:dbbf35b96557 9 * @attention
Kojto 99:dbbf35b96557 10 *
Kojto 99:dbbf35b96557 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 99:dbbf35b96557 12 *
Kojto 99:dbbf35b96557 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 99:dbbf35b96557 14 * are permitted provided that the following conditions are met:
Kojto 99:dbbf35b96557 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 99:dbbf35b96557 16 * this list of conditions and the following disclaimer.
Kojto 99:dbbf35b96557 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 99:dbbf35b96557 18 * this list of conditions and the following disclaimer in the documentation
Kojto 99:dbbf35b96557 19 * and/or other materials provided with the distribution.
Kojto 99:dbbf35b96557 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 99:dbbf35b96557 21 * may be used to endorse or promote products derived from this software
Kojto 99:dbbf35b96557 22 * without specific prior written permission.
Kojto 99:dbbf35b96557 23 *
Kojto 99:dbbf35b96557 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 99:dbbf35b96557 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 99:dbbf35b96557 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 99:dbbf35b96557 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 99:dbbf35b96557 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 99:dbbf35b96557 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 99:dbbf35b96557 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 99:dbbf35b96557 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 99:dbbf35b96557 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 99:dbbf35b96557 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 99:dbbf35b96557 34 *
Kojto 99:dbbf35b96557 35 ******************************************************************************
Kojto 99:dbbf35b96557 36 */
Kojto 99:dbbf35b96557 37
Kojto 99:dbbf35b96557 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 99:dbbf35b96557 39 #ifndef __STM32L0xx_HAL_CRYP_H
Kojto 99:dbbf35b96557 40 #define __STM32L0xx_HAL_CRYP_H
Kojto 99:dbbf35b96557 41
Kojto 99:dbbf35b96557 42 #ifdef __cplusplus
Kojto 99:dbbf35b96557 43 extern "C" {
Kojto 99:dbbf35b96557 44 #endif
Kojto 99:dbbf35b96557 45
Kojto 99:dbbf35b96557 46 #if defined (STM32L041xx) || defined (STM32L061xx) || defined (STM32L062xx) || defined (STM32L063xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
Kojto 99:dbbf35b96557 47
Kojto 99:dbbf35b96557 48 /* Includes ------------------------------------------------------------------*/
Kojto 99:dbbf35b96557 49 #include "stm32l0xx_hal_def.h"
Kojto 99:dbbf35b96557 50
Kojto 99:dbbf35b96557 51 /** @addtogroup STM32L0xx_HAL_Driver
Kojto 99:dbbf35b96557 52 * @{
Kojto 99:dbbf35b96557 53 */
Kojto 99:dbbf35b96557 54
Kojto 99:dbbf35b96557 55 /** @addtogroup CRYP
Kojto 99:dbbf35b96557 56 * @{
Kojto 99:dbbf35b96557 57 */
Kojto 99:dbbf35b96557 58
Kojto 99:dbbf35b96557 59 /* Exported types ------------------------------------------------------------*/
Kojto 99:dbbf35b96557 60
Kojto 99:dbbf35b96557 61 /** @defgroup CRYP_Exported_Types CRYP Exported Types
Kojto 99:dbbf35b96557 62 * @{
Kojto 99:dbbf35b96557 63 */
Kojto 99:dbbf35b96557 64
Kojto 99:dbbf35b96557 65 /**
Kojto 99:dbbf35b96557 66 * @brief CRYP Configuration Structure definition
Kojto 99:dbbf35b96557 67 */
Kojto 99:dbbf35b96557 68 typedef struct
Kojto 99:dbbf35b96557 69 {
Kojto 99:dbbf35b96557 70 uint32_t DataType; /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string.
Kojto 99:dbbf35b96557 71 This parameter can be a value of @ref CRYP_Data_Type */
Kojto 99:dbbf35b96557 72
Kojto 99:dbbf35b96557 73 uint8_t* pKey; /*!< The key used for encryption/decryption */
Kojto 99:dbbf35b96557 74
Kojto 99:dbbf35b96557 75 uint8_t* pInitVect; /*!< The initialization vector used also as initialization
Kojto 99:dbbf35b96557 76 counter in CTR mode */
Kojto 99:dbbf35b96557 77
Kojto 99:dbbf35b96557 78 }CRYP_InitTypeDef;
Kojto 99:dbbf35b96557 79
Kojto 99:dbbf35b96557 80 /**
Kojto 99:dbbf35b96557 81 * @brief HAL CRYP State structures definition
Kojto 99:dbbf35b96557 82 */
Kojto 99:dbbf35b96557 83 typedef enum
Kojto 99:dbbf35b96557 84 {
Kojto 99:dbbf35b96557 85 HAL_CRYP_STATE_RESET = 0x00, /*!< CRYP not yet initialized or disabled */
Kojto 99:dbbf35b96557 86 HAL_CRYP_STATE_READY = 0x01, /*!< CRYP initialized and ready for use */
Kojto 99:dbbf35b96557 87 HAL_CRYP_STATE_BUSY = 0x02, /*!< CRYP internal processing is ongoing */
Kojto 99:dbbf35b96557 88 HAL_CRYP_STATE_TIMEOUT = 0x03, /*!< CRYP timeout state */
Kojto 99:dbbf35b96557 89 HAL_CRYP_STATE_ERROR = 0x04 /*!< CRYP error state */
Kojto 99:dbbf35b96557 90
Kojto 99:dbbf35b96557 91 }HAL_CRYP_STATETypeDef;
Kojto 99:dbbf35b96557 92
Kojto 99:dbbf35b96557 93 /**
Kojto 99:dbbf35b96557 94 * @brief HAL CRYP phase structures definition
Kojto 99:dbbf35b96557 95 */
Kojto 99:dbbf35b96557 96 typedef enum
Kojto 99:dbbf35b96557 97 {
Kojto 99:dbbf35b96557 98 HAL_CRYP_PHASE_READY = 0x01, /*!< CRYP peripheral is ready for initialization. */
Kojto 99:dbbf35b96557 99 HAL_CRYP_PHASE_PROCESS = 0x02, /*!< CRYP peripheral is in processing phase */
Kojto 99:dbbf35b96557 100 }HAL_PhaseTypeDef;
Kojto 99:dbbf35b96557 101
Kojto 99:dbbf35b96557 102 /**
Kojto 99:dbbf35b96557 103 * @brief CRYP handle Structure definition
Kojto 99:dbbf35b96557 104 */
Kojto 99:dbbf35b96557 105 typedef struct
Kojto 99:dbbf35b96557 106 {
Kojto 99:dbbf35b96557 107 AES_TypeDef *Instance; /*!< Register base address */
Kojto 99:dbbf35b96557 108
Kojto 99:dbbf35b96557 109 CRYP_InitTypeDef Init; /*!< CRYP required parameters */
Kojto 99:dbbf35b96557 110
Kojto 99:dbbf35b96557 111 uint8_t *pCrypInBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
Kojto 99:dbbf35b96557 112
Kojto 99:dbbf35b96557 113 uint8_t *pCrypOutBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
Kojto 99:dbbf35b96557 114
Kojto 99:dbbf35b96557 115 __IO uint16_t CrypInCount; /*!< Counter of inputed data */
Kojto 99:dbbf35b96557 116
Kojto 99:dbbf35b96557 117 __IO uint16_t CrypOutCount; /*!< Counter of outputed data */
Kojto 99:dbbf35b96557 118
Kojto 99:dbbf35b96557 119 HAL_StatusTypeDef Status; /*!< CRYP peripheral status */
Kojto 99:dbbf35b96557 120
Kojto 99:dbbf35b96557 121 HAL_PhaseTypeDef Phase; /*!< CRYP peripheral phase */
Kojto 99:dbbf35b96557 122
Kojto 99:dbbf35b96557 123 DMA_HandleTypeDef *hdmain; /*!< CRYP In DMA handle parameters */
Kojto 99:dbbf35b96557 124
Kojto 99:dbbf35b96557 125 DMA_HandleTypeDef *hdmaout; /*!< CRYP Out DMA handle parameters */
Kojto 99:dbbf35b96557 126
Kojto 99:dbbf35b96557 127 HAL_LockTypeDef Lock; /*!< CRYP locking object */
Kojto 99:dbbf35b96557 128
Kojto 99:dbbf35b96557 129 __IO HAL_CRYP_STATETypeDef State; /*!< CRYP peripheral state */
Kojto 99:dbbf35b96557 130
Kojto 99:dbbf35b96557 131 }CRYP_HandleTypeDef;
Kojto 99:dbbf35b96557 132
Kojto 99:dbbf35b96557 133 /**
Kojto 99:dbbf35b96557 134 * @}
Kojto 99:dbbf35b96557 135 */
Kojto 99:dbbf35b96557 136
Kojto 99:dbbf35b96557 137 /* Exported constants --------------------------------------------------------*/
Kojto 99:dbbf35b96557 138
Kojto 99:dbbf35b96557 139 /** @defgroup CRYP_Exported_Constants CRYP Exported Constants
Kojto 99:dbbf35b96557 140 * @{
Kojto 99:dbbf35b96557 141 */
Kojto 99:dbbf35b96557 142
Kojto 99:dbbf35b96557 143 /** @defgroup CRYP_Data_Type CRYP Data Type
Kojto 99:dbbf35b96557 144 * @{
Kojto 99:dbbf35b96557 145 */
Kojto 99:dbbf35b96557 146 #define CRYP_DATATYPE_32B ((uint32_t)0x00000000)
Kojto 99:dbbf35b96557 147 #define CRYP_DATATYPE_16B AES_CR_DATATYPE_0
Kojto 99:dbbf35b96557 148 #define CRYP_DATATYPE_8B AES_CR_DATATYPE_1
Kojto 99:dbbf35b96557 149 #define CRYP_DATATYPE_1B AES_CR_DATATYPE
Kojto 99:dbbf35b96557 150
Kojto 99:dbbf35b96557 151 #define IS_CRYP_DATATYPE(DATATYPE) (((DATATYPE) == CRYP_DATATYPE_32B) || \
Kojto 99:dbbf35b96557 152 ((DATATYPE) == CRYP_DATATYPE_16B) || \
Kojto 99:dbbf35b96557 153 ((DATATYPE) == CRYP_DATATYPE_8B) || \
Kojto 99:dbbf35b96557 154 ((DATATYPE) == CRYP_DATATYPE_1B))
Kojto 99:dbbf35b96557 155 /**
Kojto 99:dbbf35b96557 156 * @}
Kojto 99:dbbf35b96557 157 */
Kojto 99:dbbf35b96557 158
Kojto 99:dbbf35b96557 159 /** @defgroup CRYP_AlgoModeDirection CRYP Algo Mode Direction
Kojto 99:dbbf35b96557 160 * @{
Kojto 99:dbbf35b96557 161 */
Kojto 99:dbbf35b96557 162 #define CRYP_CR_ALGOMODE_DIRECTION (uint32_t)(AES_CR_MODE|AES_CR_CHMOD)
Kojto 99:dbbf35b96557 163
Kojto 99:dbbf35b96557 164 #define CRYP_CR_ALGOMODE_AES_ECB_ENCRYPT ((uint32_t)0x00000000)
Kojto 99:dbbf35b96557 165 #define CRYP_CR_ALGOMODE_AES_ECB_KEYDERDECRYPT (AES_CR_MODE)
Kojto 99:dbbf35b96557 166 #define CRYP_CR_ALGOMODE_AES_CBC_ENCRYPT (AES_CR_CHMOD_0)
Kojto 99:dbbf35b96557 167 #define CRYP_CR_ALGOMODE_AES_CBC_KEYDERDECRYPT ((uint32_t)(AES_CR_CHMOD_0|AES_CR_MODE))
Kojto 99:dbbf35b96557 168 #define CRYP_CR_ALGOMODE_AES_CTR_ENCRYPT (AES_CR_CHMOD_1)
Kojto 99:dbbf35b96557 169 #define CRYP_CR_ALGOMODE_AES_CTR_DECRYPT ((uint32_t)(AES_CR_CHMOD_1 | AES_CR_MODE_1))
Kojto 99:dbbf35b96557 170 /**
Kojto 99:dbbf35b96557 171 * @}
Kojto 99:dbbf35b96557 172 */
Kojto 99:dbbf35b96557 173
Kojto 99:dbbf35b96557 174 /** @defgroup CRYP_AES_Interrupts AES Interrupts
Kojto 99:dbbf35b96557 175 * @{
Kojto 99:dbbf35b96557 176 */
Kojto 99:dbbf35b96557 177 #define CRYP_IT_CC AES_CR_CCIE /*!< Computation Complete interrupt */
Kojto 99:dbbf35b96557 178 #define CRYP_IT_ERR AES_CR_ERRIE /*!< Error interrupt */
Kojto 99:dbbf35b96557 179
Kojto 99:dbbf35b96557 180 #define IS_CRYP_AES_IT(IT) ((((IT) & (uint32_t)0xFFFFF9FF) == 0x00000000) && ((IT) != 0x00000000))
Kojto 99:dbbf35b96557 181 #define IS_CRYP_AES_GET_IT(IT) (((IT) == CRYP_IT_CC) || ((IT) == CRYP_IT_ERR))
Kojto 99:dbbf35b96557 182
Kojto 99:dbbf35b96557 183 /**
Kojto 99:dbbf35b96557 184 * @}
Kojto 99:dbbf35b96557 185 */
Kojto 99:dbbf35b96557 186
Kojto 99:dbbf35b96557 187
Kojto 99:dbbf35b96557 188 /** @defgroup CRYP_AES_Flags AES Flags
Kojto 99:dbbf35b96557 189 * @{
Kojto 99:dbbf35b96557 190 */
Kojto 99:dbbf35b96557 191 #define CRYP_FLAG_CCF AES_SR_CCF /*!< Computation Complete Flag */
Kojto 99:dbbf35b96557 192 #define CRYP_FLAG_RDERR AES_SR_RDERR /*!< Read Error Flag */
Kojto 99:dbbf35b96557 193 #define CRYP_FLAG_WRERR AES_SR_WRERR /*!< Write Error Flag */
Kojto 99:dbbf35b96557 194
Kojto 99:dbbf35b96557 195 #define IS_CRYP_STATUS_FLAG(FLAG) (((FLAG) == CRYP_FLAG_CCF) || \
Kojto 99:dbbf35b96557 196 ((FLAG) == CRYP_FLAG_RDERR) || \
Kojto 99:dbbf35b96557 197 ((FLAG) == CRYP_FLAG_WRERR))
Kojto 99:dbbf35b96557 198 /**
Kojto 99:dbbf35b96557 199 * @}
Kojto 99:dbbf35b96557 200 */
Kojto 99:dbbf35b96557 201
Kojto 99:dbbf35b96557 202 /** @defgroup CRYP_AES_Clear_Flags AES Clear Flags
Kojto 99:dbbf35b96557 203 * @{
Kojto 99:dbbf35b96557 204 */
Kojto 99:dbbf35b96557 205 #define CRYP_CLEARFLAG_CCF AES_CR_CCFC /*!< Computation Complete Flag Clear */
Kojto 99:dbbf35b96557 206 #define CRYP_CLEARFLAG_RDERR AES_CR_ERRC /*!< Read Error Clear */
Kojto 99:dbbf35b96557 207 #define CRYP_CLEARFLAG_WRERR AES_CR_ERRC /*!< Write Error Clear */
Kojto 99:dbbf35b96557 208
Kojto 99:dbbf35b96557 209 /**
Kojto 99:dbbf35b96557 210 * @}
Kojto 99:dbbf35b96557 211 */
Kojto 99:dbbf35b96557 212
Kojto 99:dbbf35b96557 213 /**
Kojto 99:dbbf35b96557 214 * @}
Kojto 99:dbbf35b96557 215 */
Kojto 99:dbbf35b96557 216
Kojto 99:dbbf35b96557 217 /* Exported macro ------------------------------------------------------------*/
Kojto 99:dbbf35b96557 218
Kojto 99:dbbf35b96557 219 /** @defgroup CRYP_Exported_Macros CRYP Exported Macros
Kojto 99:dbbf35b96557 220 * @{
Kojto 99:dbbf35b96557 221 */
Kojto 99:dbbf35b96557 222
Kojto 99:dbbf35b96557 223 /** @brief Reset CRYP handle state
Kojto 99:dbbf35b96557 224 * @param __HANDLE__: specifies the CRYP handle.
Kojto 99:dbbf35b96557 225 * @retval None
Kojto 99:dbbf35b96557 226 */
Kojto 99:dbbf35b96557 227 #define __HAL_CRYP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRYP_STATE_RESET)
Kojto 99:dbbf35b96557 228
Kojto 99:dbbf35b96557 229 /**
Kojto 99:dbbf35b96557 230 * @brief Enable/Disable the CRYP peripheral.
Kojto 99:dbbf35b96557 231 * @param __HANDLE__: specifies the CRYP handle.
Kojto 99:dbbf35b96557 232 * @retval None
Kojto 99:dbbf35b96557 233 */
Kojto 99:dbbf35b96557 234 #define __HAL_CRYP_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, AES_CR_EN)
Kojto 99:dbbf35b96557 235 #define __HAL_CRYP_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, AES_CR_EN)
Kojto 99:dbbf35b96557 236
Kojto 99:dbbf35b96557 237 /**
Kojto 99:dbbf35b96557 238 * @brief Set the algorithm mode: AES-ECB, AES-CBC, AES-CTR, DES-ECB, DES-CBC,...
Kojto 99:dbbf35b96557 239 * @param __HANDLE__: specifies the CRYP handle.
Kojto 99:dbbf35b96557 240 * @param __MODE__: The algorithm mode.
Kojto 99:dbbf35b96557 241 * @retval None
Kojto 99:dbbf35b96557 242 */
Kojto 99:dbbf35b96557 243 #define __HAL_CRYP_SET_MODE(__HANDLE__,__MODE__) SET_BIT((__HANDLE__)->Instance->CR, (__MODE__))
Kojto 99:dbbf35b96557 244
Kojto 99:dbbf35b96557 245
Kojto 99:dbbf35b96557 246 /** @brief Check whether the specified CRYP flag is set or not.
Kojto 99:dbbf35b96557 247 * @param __HANDLE__: specifies the CRYP handle.
Kojto 99:dbbf35b96557 248 * @param __FLAG__: specifies the flag to check.
Kojto 99:dbbf35b96557 249 * This parameter can be one of the following values:
Kojto 99:dbbf35b96557 250 * @arg CRYP_FLAG_CCF : Computation Complete Flag
Kojto 99:dbbf35b96557 251 * @arg CRYP_FLAG_RDERR : Read Error Flag
Kojto 99:dbbf35b96557 252 * @arg CRYP_FLAG_WRERR : Write Error Flag
Kojto 99:dbbf35b96557 253 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 99:dbbf35b96557 254 */
Kojto 99:dbbf35b96557 255 #define __HAL_CRYP_GET_FLAG(__HANDLE__,__FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
Kojto 99:dbbf35b96557 256
Kojto 99:dbbf35b96557 257 /** @brief Clear the CRYP pending flag.
Kojto 99:dbbf35b96557 258 * @param __HANDLE__: specifies the CRYP handle.
Kojto 99:dbbf35b96557 259 * @param __FLAG__: specifies the flag to clear.
Kojto 99:dbbf35b96557 260 * This parameter can be one of the following values:
Kojto 99:dbbf35b96557 261 * @arg CRYP_CLEARFLAG_CCF : Computation Complete Clear Flag
Kojto 99:dbbf35b96557 262 * @arg CRYP_CLEARFLAG_RDERR : Read Error Clear
Kojto 99:dbbf35b96557 263 * @arg CRYP_CLEARFLAG_WRERR : Write Error Clear
Kojto 99:dbbf35b96557 264 * @retval None
Kojto 99:dbbf35b96557 265 */
Kojto 99:dbbf35b96557 266 #define __HAL_CRYP_CLEAR_FLAG(__HANDLE__, __FLAG__) SET_BIT((__HANDLE__)->Instance->CR, (__FLAG__))
Kojto 99:dbbf35b96557 267
Kojto 99:dbbf35b96557 268 /**
Kojto 99:dbbf35b96557 269 * @brief Enable the CRYP interrupt.
Kojto 99:dbbf35b96557 270 * @param __HANDLE__: specifies the CRYP handle.
Kojto 99:dbbf35b96557 271 * @param __INTERRUPT__: CRYP Interrupt.
Kojto 99:dbbf35b96557 272 * @retval None
Kojto 99:dbbf35b96557 273 */
Kojto 99:dbbf35b96557 274 #define __HAL_CRYP_ENABLE_IT(__HANDLE__,__INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__))
Kojto 99:dbbf35b96557 275
Kojto 99:dbbf35b96557 276 /**
Kojto 99:dbbf35b96557 277 * @brief Disable the CRYP interrupt.
Kojto 99:dbbf35b96557 278 * @param __HANDLE__: specifies the CRYP handle.
Kojto 99:dbbf35b96557 279 * @param __INTERRUPT__: CRYP interrupt.
Kojto 99:dbbf35b96557 280 * @retval None
Kojto 99:dbbf35b96557 281 */
Kojto 99:dbbf35b96557 282 #define __HAL_CRYP_DISABLE_IT(__HANDLE__,__INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__))
Kojto 99:dbbf35b96557 283
Kojto 99:dbbf35b96557 284 /** @brief Checks if the specified CRYP interrupt source is enabled or disabled.
Kojto 99:dbbf35b96557 285 * @param __HANDLE__: specifies the CRYP handle.
Kojto 99:dbbf35b96557 286 * @param __INTERRUPT__: CRYP interrupt source to check
Kojto 99:dbbf35b96557 287 * This parameter can be one of the following values:
Kojto 99:dbbf35b96557 288 * @arg CRYP_IT_CC : Computation Complete interrupt
Kojto 99:dbbf35b96557 289 * @arg CRYP_IT_ERR : Error interrupt (used for RDERR and WRERR)
Kojto 99:dbbf35b96557 290 * @retval State of interruption (SET or RESET)
Kojto 99:dbbf35b96557 291 */
Kojto 99:dbbf35b96557 292 #define __HAL_CRYP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
Kojto 99:dbbf35b96557 293 (( ((__HANDLE__)->Instance->CR & (__INTERRUPT__)) == (__INTERRUPT__) \
Kojto 99:dbbf35b96557 294 )? SET : RESET \
Kojto 99:dbbf35b96557 295 )
Kojto 99:dbbf35b96557 296
Kojto 99:dbbf35b96557 297 /** @brief Clear the CRYP pending IT.
Kojto 99:dbbf35b96557 298 * @param __HANDLE__: specifies the CRYP handle.
Kojto 99:dbbf35b96557 299 * @param __IT__: specifies the IT to clear.
Kojto 99:dbbf35b96557 300 * This parameter can be one of the following values:
Kojto 99:dbbf35b96557 301 * @arg CRYP_CLEARFLAG_CCF : Computation Complete Clear Flag
Kojto 99:dbbf35b96557 302 * @arg CRYP_CLEARFLAG_RDERR : Read Error Clear
Kojto 99:dbbf35b96557 303 * @arg CRYP_CLEARFLAG_WRERR : Write Error Clear
Kojto 99:dbbf35b96557 304 * @retval None
Kojto 99:dbbf35b96557 305 */
Kojto 99:dbbf35b96557 306 #define __HAL_CRYP_CLEAR_IT(__HANDLE__, __IT__) SET_BIT((__HANDLE__)->Instance->CR, (__IT__))
Kojto 99:dbbf35b96557 307
Kojto 99:dbbf35b96557 308 /**
Kojto 99:dbbf35b96557 309 * @}
Kojto 99:dbbf35b96557 310 */
Kojto 99:dbbf35b96557 311
Kojto 99:dbbf35b96557 312 /* Include CRYP HAL Extension module */
Kojto 99:dbbf35b96557 313 #include "stm32l0xx_hal_cryp_ex.h"
Kojto 99:dbbf35b96557 314
Kojto 99:dbbf35b96557 315 /* Exported functions --------------------------------------------------------*/
Kojto 99:dbbf35b96557 316
Kojto 99:dbbf35b96557 317 /** @addtogroup CRYP_Exported_Functions
Kojto 99:dbbf35b96557 318 * @{
Kojto 99:dbbf35b96557 319 */
Kojto 99:dbbf35b96557 320
Kojto 99:dbbf35b96557 321 /** @addtogroup CRYP_Exported_Functions_Group1
Kojto 99:dbbf35b96557 322 * @{
Kojto 99:dbbf35b96557 323 */
Kojto 99:dbbf35b96557 324
Kojto 99:dbbf35b96557 325 /* Initialization/de-initialization functions *********************************/
Kojto 99:dbbf35b96557 326 HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp);
Kojto 99:dbbf35b96557 327 HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp);
Kojto 99:dbbf35b96557 328
Kojto 99:dbbf35b96557 329 /* MSP functions *************************************************************/
Kojto 99:dbbf35b96557 330 void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp);
Kojto 99:dbbf35b96557 331 void HAL_CRYP_MspDeInit(CRYP_HandleTypeDef *hcryp);
Kojto 99:dbbf35b96557 332
Kojto 99:dbbf35b96557 333 /**
Kojto 99:dbbf35b96557 334 * @}
Kojto 99:dbbf35b96557 335 */
Kojto 99:dbbf35b96557 336
Kojto 99:dbbf35b96557 337 /** @addtogroup CRYP_Exported_Functions_Group2
Kojto 99:dbbf35b96557 338 * @{
Kojto 99:dbbf35b96557 339 */
Kojto 99:dbbf35b96557 340
Kojto 99:dbbf35b96557 341 /* AES encryption/decryption using polling ***********************************/
Kojto 99:dbbf35b96557 342 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
Kojto 99:dbbf35b96557 343 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
Kojto 99:dbbf35b96557 344 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
Kojto 99:dbbf35b96557 345 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
Kojto 99:dbbf35b96557 346 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
Kojto 99:dbbf35b96557 347 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
Kojto 99:dbbf35b96557 348
Kojto 99:dbbf35b96557 349 /* AES encryption/decryption using interrupt *********************************/
Kojto 99:dbbf35b96557 350 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
Kojto 99:dbbf35b96557 351 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
Kojto 99:dbbf35b96557 352 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
Kojto 99:dbbf35b96557 353 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
Kojto 99:dbbf35b96557 354 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
Kojto 99:dbbf35b96557 355 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
Kojto 99:dbbf35b96557 356
Kojto 99:dbbf35b96557 357 /* AES encryption/decryption using DMA ***************************************/
Kojto 99:dbbf35b96557 358 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
Kojto 99:dbbf35b96557 359 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
Kojto 99:dbbf35b96557 360 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
Kojto 99:dbbf35b96557 361 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
Kojto 99:dbbf35b96557 362 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
Kojto 99:dbbf35b96557 363 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
Kojto 99:dbbf35b96557 364
Kojto 99:dbbf35b96557 365 /**
Kojto 99:dbbf35b96557 366 * @}
Kojto 99:dbbf35b96557 367 */
Kojto 99:dbbf35b96557 368
Kojto 99:dbbf35b96557 369 /** @addtogroup CRYP_Exported_Functions_Group3
Kojto 99:dbbf35b96557 370 * @{
Kojto 99:dbbf35b96557 371 */
Kojto 99:dbbf35b96557 372
Kojto 99:dbbf35b96557 373 /* CallBack functions ********************************************************/
Kojto 99:dbbf35b96557 374 void HAL_CRYP_InCpltCallback(CRYP_HandleTypeDef *hcryp);
Kojto 99:dbbf35b96557 375 void HAL_CRYP_OutCpltCallback(CRYP_HandleTypeDef *hcryp);
Kojto 99:dbbf35b96557 376 void HAL_CRYP_ErrorCallback(CRYP_HandleTypeDef *hcryp);
Kojto 99:dbbf35b96557 377
Kojto 99:dbbf35b96557 378 /**
Kojto 99:dbbf35b96557 379 * @}
Kojto 99:dbbf35b96557 380 */
Kojto 99:dbbf35b96557 381
Kojto 99:dbbf35b96557 382 /** @addtogroup CRYP_Exported_Functions_Group4
Kojto 99:dbbf35b96557 383 * @{
Kojto 99:dbbf35b96557 384 */
Kojto 99:dbbf35b96557 385
Kojto 99:dbbf35b96557 386 /* Processing functions ********************************************************/
Kojto 99:dbbf35b96557 387 void HAL_CRYP_IRQHandler(CRYP_HandleTypeDef *hcryp);
Kojto 99:dbbf35b96557 388
Kojto 99:dbbf35b96557 389 /**
Kojto 99:dbbf35b96557 390 * @}
Kojto 99:dbbf35b96557 391 */
Kojto 99:dbbf35b96557 392
Kojto 99:dbbf35b96557 393 /** @addtogroup CRYP_Exported_Functions_Group5
Kojto 99:dbbf35b96557 394 * @{
Kojto 99:dbbf35b96557 395 */
Kojto 99:dbbf35b96557 396
Kojto 99:dbbf35b96557 397 /* Peripheral State functions **************************************************/
Kojto 99:dbbf35b96557 398 HAL_CRYP_STATETypeDef HAL_CRYP_GetState(CRYP_HandleTypeDef *hcryp);
Kojto 99:dbbf35b96557 399
Kojto 99:dbbf35b96557 400 /**
Kojto 99:dbbf35b96557 401 * @}
Kojto 99:dbbf35b96557 402 */
Kojto 99:dbbf35b96557 403
Kojto 99:dbbf35b96557 404 /**
Kojto 99:dbbf35b96557 405 * @}
Kojto 99:dbbf35b96557 406 */
Kojto 99:dbbf35b96557 407
Kojto 99:dbbf35b96557 408 /**
Kojto 99:dbbf35b96557 409 * @}
Kojto 99:dbbf35b96557 410 */
Kojto 99:dbbf35b96557 411
Kojto 99:dbbf35b96557 412 /**
Kojto 99:dbbf35b96557 413 * @}
Kojto 99:dbbf35b96557 414 */
Kojto 99:dbbf35b96557 415
Kojto 99:dbbf35b96557 416 #endif /* STM32L041xx || STM32L061xx || STM32L062xx || STM32L063xx || STM32L081xx || STM32L082xx || STM32L083xx */
Kojto 99:dbbf35b96557 417 #ifdef __cplusplus
Kojto 99:dbbf35b96557 418 }
Kojto 99:dbbf35b96557 419 #endif
Kojto 99:dbbf35b96557 420
Kojto 99:dbbf35b96557 421 #endif /* __STM32L0xx_HAL_CRYP_H */
Kojto 99:dbbf35b96557 422
Kojto 99:dbbf35b96557 423 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Kojto 99:dbbf35b96557 424