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