mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Thu Oct 16 15:00:10 2014 +0100
Revision:
354:e67efb2aab0e
Synchronized with git revision 36a8882a54cbf25645fa6e11af937c8b8048e184

Full URL: https://github.com/mbedmicro/mbed/commit/36a8882a54cbf25645fa6e11af937c8b8048e184/

Targets: NUCLEO_L152RE - Migration to STM32Cube driver (CMSIS and HAL)

Who changed what in which revision?

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