mbed library with additional peripherals for ST F401 board

Fork of mbed-src by mbed official

This mbed LIB has additional peripherals for ST F401 board

  • UART2 : PA_3 rx, PA_2 tx
  • UART3 : PC_7 rx, PC_6 tx
  • I2C2 : PB_3 SDA, PB_10 SCL
  • I2C3 : PB_4 SDA, PA_8 SCL
Committer:
mbed_official
Date:
Mon Jan 27 14:30:07 2014 +0000
Revision:
76:aeb1df146756
Child:
80:66393a7b209d
Synchronized with git revision a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd

Full URL: https://github.com/mbedmicro/mbed/commit/a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd/

Add NUCLEO_L152RE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 76:aeb1df146756 1 /**
mbed_official 76:aeb1df146756 2 ******************************************************************************
mbed_official 76:aeb1df146756 3 * @file stm32l1xx_aes.h
mbed_official 76:aeb1df146756 4 * @author MCD Application Team
mbed_official 76:aeb1df146756 5 * @version V1.2.0
mbed_official 76:aeb1df146756 6 * @date 22-February-2013
mbed_official 76:aeb1df146756 7 * @brief This file contains all the functions prototypes for the AES firmware
mbed_official 76:aeb1df146756 8 * library.
mbed_official 76:aeb1df146756 9 ******************************************************************************
mbed_official 76:aeb1df146756 10 * @attention
mbed_official 76:aeb1df146756 11 *
mbed_official 76:aeb1df146756 12 * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
mbed_official 76:aeb1df146756 13 *
mbed_official 76:aeb1df146756 14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
mbed_official 76:aeb1df146756 15 * You may not use this file except in compliance with the License.
mbed_official 76:aeb1df146756 16 * You may obtain a copy of the License at:
mbed_official 76:aeb1df146756 17 *
mbed_official 76:aeb1df146756 18 * http://www.st.com/software_license_agreement_liberty_v2
mbed_official 76:aeb1df146756 19 *
mbed_official 76:aeb1df146756 20 * Unless required by applicable law or agreed to in writing, software
mbed_official 76:aeb1df146756 21 * distributed under the License is distributed on an "AS IS" BASIS,
mbed_official 76:aeb1df146756 22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbed_official 76:aeb1df146756 23 * See the License for the specific language governing permissions and
mbed_official 76:aeb1df146756 24 * limitations under the License.
mbed_official 76:aeb1df146756 25 *
mbed_official 76:aeb1df146756 26 ******************************************************************************
mbed_official 76:aeb1df146756 27 */
mbed_official 76:aeb1df146756 28
mbed_official 76:aeb1df146756 29 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 76:aeb1df146756 30 #ifndef __STM32L1xx_AES_H
mbed_official 76:aeb1df146756 31 #define __STM32L1xx_AES_H
mbed_official 76:aeb1df146756 32
mbed_official 76:aeb1df146756 33 #ifdef __cplusplus
mbed_official 76:aeb1df146756 34 extern "C" {
mbed_official 76:aeb1df146756 35 #endif
mbed_official 76:aeb1df146756 36
mbed_official 76:aeb1df146756 37 /* Includes ------------------------------------------------------------------*/
mbed_official 76:aeb1df146756 38 #include "stm32l1xx.h"
mbed_official 76:aeb1df146756 39
mbed_official 76:aeb1df146756 40 /** @addtogroup STM32L1xx_StdPeriph_Driver
mbed_official 76:aeb1df146756 41 * @{
mbed_official 76:aeb1df146756 42 */
mbed_official 76:aeb1df146756 43
mbed_official 76:aeb1df146756 44 /** @addtogroup AES
mbed_official 76:aeb1df146756 45 * @{
mbed_official 76:aeb1df146756 46 */
mbed_official 76:aeb1df146756 47
mbed_official 76:aeb1df146756 48 /* Exported types ------------------------------------------------------------*/
mbed_official 76:aeb1df146756 49
mbed_official 76:aeb1df146756 50 /**
mbed_official 76:aeb1df146756 51 * @brief AES Init structure definition
mbed_official 76:aeb1df146756 52 */
mbed_official 76:aeb1df146756 53 typedef struct
mbed_official 76:aeb1df146756 54 {
mbed_official 76:aeb1df146756 55 uint32_t AES_Operation; /*!< Specifies the AES mode of operation.
mbed_official 76:aeb1df146756 56 This parameter can be a value of @ref AES_possible_Operation_modes */
mbed_official 76:aeb1df146756 57 uint32_t AES_Chaining; /*!< Specifies the AES Chaining modes: ECB, CBC or CTR.
mbed_official 76:aeb1df146756 58 This parameter can be a value of @ref AES_possible_chaining_modes */
mbed_official 76:aeb1df146756 59 uint32_t AES_DataType; /*!< Specifies the AES data swapping: 32-bit, 16-bit, 8-bit or 1-bit.
mbed_official 76:aeb1df146756 60 This parameter can be a value of @ref AES_Data_Types */
mbed_official 76:aeb1df146756 61 }AES_InitTypeDef;
mbed_official 76:aeb1df146756 62
mbed_official 76:aeb1df146756 63 /**
mbed_official 76:aeb1df146756 64 * @brief AES Key(s) structure definition
mbed_official 76:aeb1df146756 65 */
mbed_official 76:aeb1df146756 66 typedef struct
mbed_official 76:aeb1df146756 67 {
mbed_official 76:aeb1df146756 68 uint32_t AES_Key0; /*!< Key[31:0] */
mbed_official 76:aeb1df146756 69 uint32_t AES_Key1; /*!< Key[63:32] */
mbed_official 76:aeb1df146756 70 uint32_t AES_Key2; /*!< Key[95:64] */
mbed_official 76:aeb1df146756 71 uint32_t AES_Key3; /*!< Key[127:96] */
mbed_official 76:aeb1df146756 72 }AES_KeyInitTypeDef;
mbed_official 76:aeb1df146756 73
mbed_official 76:aeb1df146756 74 /**
mbed_official 76:aeb1df146756 75 * @brief AES Initialization Vectors (IV) structure definition
mbed_official 76:aeb1df146756 76 */
mbed_official 76:aeb1df146756 77 typedef struct
mbed_official 76:aeb1df146756 78 {
mbed_official 76:aeb1df146756 79 uint32_t AES_IV0; /*!< Init Vector IV[31:0] */
mbed_official 76:aeb1df146756 80 uint32_t AES_IV1; /*!< Init Vector IV[63:32] */
mbed_official 76:aeb1df146756 81 uint32_t AES_IV2; /*!< Init Vector IV[95:64] */
mbed_official 76:aeb1df146756 82 uint32_t AES_IV3; /*!< Init Vector IV[127:96] */
mbed_official 76:aeb1df146756 83 }AES_IVInitTypeDef;
mbed_official 76:aeb1df146756 84
mbed_official 76:aeb1df146756 85 /* Exported constants --------------------------------------------------------*/
mbed_official 76:aeb1df146756 86
mbed_official 76:aeb1df146756 87 /** @defgroup AES_Exported_Constants
mbed_official 76:aeb1df146756 88 * @{
mbed_official 76:aeb1df146756 89 */
mbed_official 76:aeb1df146756 90
mbed_official 76:aeb1df146756 91 /** @defgroup AES_possible_Operation_modes
mbed_official 76:aeb1df146756 92 * @{
mbed_official 76:aeb1df146756 93 */
mbed_official 76:aeb1df146756 94 #define AES_Operation_Encryp ((uint32_t)0x00000000) /*!< AES in Encryption mode */
mbed_official 76:aeb1df146756 95 #define AES_Operation_KeyDeriv AES_CR_MODE_0 /*!< AES in Key Derivation mode */
mbed_official 76:aeb1df146756 96 #define AES_Operation_Decryp AES_CR_MODE_1 /*!< AES in Decryption mode */
mbed_official 76:aeb1df146756 97 #define AES_Operation_KeyDerivAndDecryp AES_CR_MODE /*!< AES in Key Derivation and Decryption mode */
mbed_official 76:aeb1df146756 98
mbed_official 76:aeb1df146756 99 #define IS_AES_MODE(OPERATION) (((OPERATION) == AES_Operation_Encryp) || \
mbed_official 76:aeb1df146756 100 ((OPERATION) == AES_Operation_KeyDeriv) || \
mbed_official 76:aeb1df146756 101 ((OPERATION) == AES_Operation_Decryp) || \
mbed_official 76:aeb1df146756 102 ((OPERATION) == AES_Operation_KeyDerivAndDecryp))
mbed_official 76:aeb1df146756 103
mbed_official 76:aeb1df146756 104 /**
mbed_official 76:aeb1df146756 105 * @}
mbed_official 76:aeb1df146756 106 */
mbed_official 76:aeb1df146756 107
mbed_official 76:aeb1df146756 108 /** @defgroup AES_possible_chaining_modes
mbed_official 76:aeb1df146756 109 * @{
mbed_official 76:aeb1df146756 110 */
mbed_official 76:aeb1df146756 111 #define AES_Chaining_ECB ((uint32_t)0x00000000) /*!< AES in ECB chaining mode */
mbed_official 76:aeb1df146756 112 #define AES_Chaining_CBC AES_CR_CHMOD_0 /*!< AES in CBC chaining mode */
mbed_official 76:aeb1df146756 113 #define AES_Chaining_CTR AES_CR_CHMOD_1 /*!< AES in CTR chaining mode */
mbed_official 76:aeb1df146756 114
mbed_official 76:aeb1df146756 115 #define IS_AES_CHAINING(CHAINING) (((CHAINING) == AES_Chaining_ECB) || \
mbed_official 76:aeb1df146756 116 ((CHAINING) == AES_Chaining_CBC) || \
mbed_official 76:aeb1df146756 117 ((CHAINING) == AES_Chaining_CTR))
mbed_official 76:aeb1df146756 118 /**
mbed_official 76:aeb1df146756 119 * @}
mbed_official 76:aeb1df146756 120 */
mbed_official 76:aeb1df146756 121
mbed_official 76:aeb1df146756 122 /** @defgroup AES_Data_Types
mbed_official 76:aeb1df146756 123 * @{
mbed_official 76:aeb1df146756 124 */
mbed_official 76:aeb1df146756 125 #define AES_DataType_32b ((uint32_t)0x00000000) /*!< 32-bit data. No swapping */
mbed_official 76:aeb1df146756 126 #define AES_DataType_16b AES_CR_DATATYPE_0 /*!< 16-bit data. Each half word is swapped */
mbed_official 76:aeb1df146756 127 #define AES_DataType_8b AES_CR_DATATYPE_1 /*!< 8-bit data. All bytes are swapped */
mbed_official 76:aeb1df146756 128 #define AES_DataType_1b AES_CR_DATATYPE /*!< 1-bit data. In the word all bits are swapped */
mbed_official 76:aeb1df146756 129
mbed_official 76:aeb1df146756 130 #define IS_AES_DATATYPE(DATATYPE) (((DATATYPE) == AES_DataType_32b) || \
mbed_official 76:aeb1df146756 131 ((DATATYPE) == AES_DataType_16b)|| \
mbed_official 76:aeb1df146756 132 ((DATATYPE) == AES_DataType_8b) || \
mbed_official 76:aeb1df146756 133 ((DATATYPE) == AES_DataType_1b))
mbed_official 76:aeb1df146756 134 /**
mbed_official 76:aeb1df146756 135 * @}
mbed_official 76:aeb1df146756 136 */
mbed_official 76:aeb1df146756 137
mbed_official 76:aeb1df146756 138 /** @defgroup AES_Flags
mbed_official 76:aeb1df146756 139 * @{
mbed_official 76:aeb1df146756 140 */
mbed_official 76:aeb1df146756 141 #define AES_FLAG_CCF AES_SR_CCF /*!< Computation Complete Flag */
mbed_official 76:aeb1df146756 142 #define AES_FLAG_RDERR AES_SR_RDERR /*!< Read Error Flag */
mbed_official 76:aeb1df146756 143 #define AES_FLAG_WRERR AES_SR_WRERR /*!< Write Error Flag */
mbed_official 76:aeb1df146756 144
mbed_official 76:aeb1df146756 145 #define IS_AES_FLAG(FLAG) (((FLAG) == AES_FLAG_CCF) || \
mbed_official 76:aeb1df146756 146 ((FLAG) == AES_FLAG_RDERR) || \
mbed_official 76:aeb1df146756 147 ((FLAG) == AES_FLAG_WRERR))
mbed_official 76:aeb1df146756 148 /**
mbed_official 76:aeb1df146756 149 * @}
mbed_official 76:aeb1df146756 150 */
mbed_official 76:aeb1df146756 151
mbed_official 76:aeb1df146756 152 /** @defgroup AES_Interrupts
mbed_official 76:aeb1df146756 153 * @{
mbed_official 76:aeb1df146756 154 */
mbed_official 76:aeb1df146756 155 #define AES_IT_CC AES_CR_CCIE /*!< Computation Complete interrupt */
mbed_official 76:aeb1df146756 156 #define AES_IT_ERR AES_CR_ERRIE /*!< Error interrupt */
mbed_official 76:aeb1df146756 157
mbed_official 76:aeb1df146756 158 #define IS_AES_IT(IT) ((((IT) & (uint32_t)0xFFFFF9FF) == 0x00) && ((IT) != 0x00))
mbed_official 76:aeb1df146756 159 #define IS_AES_GET_IT(IT) (((IT) == AES_IT_CC) || ((IT) == AES_IT_ERR))
mbed_official 76:aeb1df146756 160
mbed_official 76:aeb1df146756 161 /**
mbed_official 76:aeb1df146756 162 * @}
mbed_official 76:aeb1df146756 163 */
mbed_official 76:aeb1df146756 164
mbed_official 76:aeb1df146756 165 /** @defgroup AES_DMA_Transfer_modes
mbed_official 76:aeb1df146756 166 * @{
mbed_official 76:aeb1df146756 167 */
mbed_official 76:aeb1df146756 168 #define AES_DMATransfer_In AES_CR_DMAINEN /*!< DMA requests enabled for input transfer phase */
mbed_official 76:aeb1df146756 169 #define AES_DMATransfer_Out AES_CR_DMAOUTEN /*!< DMA requests enabled for input transfer phase */
mbed_official 76:aeb1df146756 170 #define AES_DMATransfer_InOut (AES_CR_DMAINEN | AES_CR_DMAOUTEN) /*!< DMA requests enabled for both input and output phases */
mbed_official 76:aeb1df146756 171
mbed_official 76:aeb1df146756 172 #define IS_AES_DMA_TRANSFER(TRANSFER) (((TRANSFER) == AES_DMATransfer_In) || \
mbed_official 76:aeb1df146756 173 ((TRANSFER) == AES_DMATransfer_Out) || \
mbed_official 76:aeb1df146756 174 ((TRANSFER) == AES_DMATransfer_InOut))
mbed_official 76:aeb1df146756 175 /**
mbed_official 76:aeb1df146756 176 * @}
mbed_official 76:aeb1df146756 177 */
mbed_official 76:aeb1df146756 178
mbed_official 76:aeb1df146756 179 /**
mbed_official 76:aeb1df146756 180 * @}
mbed_official 76:aeb1df146756 181 */
mbed_official 76:aeb1df146756 182
mbed_official 76:aeb1df146756 183 /* Exported macro ------------------------------------------------------------*/
mbed_official 76:aeb1df146756 184 /* Exported functions ------------------------------------------------------- */
mbed_official 76:aeb1df146756 185
mbed_official 76:aeb1df146756 186 /* Initialization and configuration functions *********************************/
mbed_official 76:aeb1df146756 187 void AES_DeInit(void);
mbed_official 76:aeb1df146756 188 void AES_Init(AES_InitTypeDef* AES_InitStruct);
mbed_official 76:aeb1df146756 189 void AES_KeyInit(AES_KeyInitTypeDef* AES_KeyInitStruct);
mbed_official 76:aeb1df146756 190 void AES_IVInit(AES_IVInitTypeDef* AES_IVInitStruct);
mbed_official 76:aeb1df146756 191 void AES_Cmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 192
mbed_official 76:aeb1df146756 193 /* Structures initialization functions ****************************************/
mbed_official 76:aeb1df146756 194 void AES_StructInit(AES_InitTypeDef* AES_InitStruct);
mbed_official 76:aeb1df146756 195 void AES_KeyStructInit(AES_KeyInitTypeDef* AES_KeyInitStruct);
mbed_official 76:aeb1df146756 196 void AES_IVStructInit(AES_IVInitTypeDef* AES_IVInitStruct);
mbed_official 76:aeb1df146756 197
mbed_official 76:aeb1df146756 198 /* AES Read and Write functions **********************************************/
mbed_official 76:aeb1df146756 199 void AES_WriteSubData(uint32_t Data);
mbed_official 76:aeb1df146756 200 uint32_t AES_ReadSubData(void);
mbed_official 76:aeb1df146756 201 void AES_ReadKey(AES_KeyInitTypeDef* AES_KeyInitStruct);
mbed_official 76:aeb1df146756 202 void AES_ReadIV(AES_IVInitTypeDef* AES_IVInitStruct);
mbed_official 76:aeb1df146756 203
mbed_official 76:aeb1df146756 204 /* DMA transfers management function ******************************************/
mbed_official 76:aeb1df146756 205 void AES_DMAConfig(uint32_t AES_DMATransfer, FunctionalState NewState);
mbed_official 76:aeb1df146756 206
mbed_official 76:aeb1df146756 207 /* Interrupts and flags management functions **********************************/
mbed_official 76:aeb1df146756 208 void AES_ITConfig(uint32_t AES_IT, FunctionalState NewState);
mbed_official 76:aeb1df146756 209 FlagStatus AES_GetFlagStatus(uint32_t AES_FLAG);
mbed_official 76:aeb1df146756 210 void AES_ClearFlag(uint32_t AES_FLAG);
mbed_official 76:aeb1df146756 211 ITStatus AES_GetITStatus(uint32_t AES_IT);
mbed_official 76:aeb1df146756 212 void AES_ClearITPendingBit(uint32_t AES_IT);
mbed_official 76:aeb1df146756 213
mbed_official 76:aeb1df146756 214 /* High Level AES functions **************************************************/
mbed_official 76:aeb1df146756 215 ErrorStatus AES_ECB_Encrypt(uint8_t* Key, uint8_t* Input, uint32_t Ilength, uint8_t* Output);
mbed_official 76:aeb1df146756 216 ErrorStatus AES_ECB_Decrypt(uint8_t* Key, uint8_t* Input, uint32_t Ilength, uint8_t* Output);
mbed_official 76:aeb1df146756 217 ErrorStatus AES_CBC_Encrypt(uint8_t* Key, uint8_t InitVectors[16], uint8_t* Input, uint32_t Ilength, uint8_t* Output);
mbed_official 76:aeb1df146756 218 ErrorStatus AES_CBC_Decrypt(uint8_t* Key, uint8_t InitVectors[16], uint8_t* Input, uint32_t Ilength, uint8_t* Output);
mbed_official 76:aeb1df146756 219 ErrorStatus AES_CTR_Encrypt(uint8_t* Key, uint8_t InitVectors[16], uint8_t* Input, uint32_t Ilength, uint8_t* Output);
mbed_official 76:aeb1df146756 220 ErrorStatus AES_CTR_Decrypt(uint8_t* Key, uint8_t InitVectors[16], uint8_t* Input, uint32_t Ilength, uint8_t* Output);
mbed_official 76:aeb1df146756 221
mbed_official 76:aeb1df146756 222 #ifdef __cplusplus
mbed_official 76:aeb1df146756 223 }
mbed_official 76:aeb1df146756 224 #endif
mbed_official 76:aeb1df146756 225
mbed_official 76:aeb1df146756 226 #endif /*__STM32L1xx_AES_H */
mbed_official 76:aeb1df146756 227
mbed_official 76:aeb1df146756 228 /**
mbed_official 76:aeb1df146756 229 * @}
mbed_official 76:aeb1df146756 230 */
mbed_official 76:aeb1df146756 231
mbed_official 76:aeb1df146756 232 /**
mbed_official 76:aeb1df146756 233 * @}
mbed_official 76:aeb1df146756 234 */
mbed_official 76:aeb1df146756 235
mbed_official 76:aeb1df146756 236 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/