meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Mar 17 14:27:45 2015 +0000
Revision:
96:487b796308b0
Parent:
92:4fc01daae5a5
Release 96 of the mbed library

Changes:
- IAR support for ble boards, lpc, ethernet stack
- RTC - attach function to redirect time functions
- Nucleo F103RB - cube driver
- k20xx - fixes for teensy and k20 platforms in sleep/deepsleep and usb
- STM32L0, Nucleo/Disco L053 - refactoring

Who changed what in which revision?

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