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:
Kojto
Date:
Tue Mar 15 14:34:00 2016 +0000
Revision:
116:c0f6e94411f5
Release 116 of the mbed library

Changes:
- new targets - NUCLEO_L073RZ
- fixes to IOTSS BEID platform
- LPC824, LPC1549 and LPC11U68 - fix PWMOut SCT bugs
- STM32F7 - Cube driver
- STM32F4 - add RTC LSI macro, defined as 0
- STM32F3 - fix multiple ADC clock initialization
- retarget - binary mode fix for GCC

Who changed what in which revision?

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