STM8L15x Standard Peripherals Drivers: stm8l15x_aes.h Source File

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

stm8l15x_aes.h

Go to the documentation of this file.
00001 /**
00002   ********************************************************************************
00003   * @file    stm8l15x_aes.h
00004   * @author  MCD Application Team
00005   * @version V1.5.0
00006   * @date    13-May-2011
00007   * @brief   This file contains all the functions prototypes for the AES firmware
00008   *          library.
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00013   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00014   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00015   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00016   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00017   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00018   *
00019   * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
00020   ******************************************************************************  
00021   */
00022 
00023 /* Define to prevent recursive inclusion -------------------------------------*/
00024 #ifndef __STM8L15x_AES_H
00025 #define __STM8L15x_AES_H
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm8l15x.h"
00029 
00030 /** @addtogroup STM8L15x_StdPeriph_Driver
00031   * @{
00032   */
00033   
00034 /** @addtogroup AES
00035   * @{
00036   */ 
00037 
00038 /* Exported types ------------------------------------------------------------*/
00039 
00040 /** @defgroup AES_Exported_Types
00041   * @{
00042   */
00043 
00044 /** @defgroup AES_Operation_Mode
00045   * @{
00046   */
00047 typedef enum
00048 {
00049   AES_Operation_Encryp            = (uint8_t)0x00, /*!< AES in Encryption mode */
00050   AES_Operation_KeyDeriv          = (uint8_t)0x02, /*!< AES in Key Derivation mode */
00051   AES_Operation_Decryp            = (uint8_t)0x04, /*!< AES in Decryption mode */
00052   AES_Operation_KeyDerivAndDecryp = (uint8_t)0x06  /*!< AES in Key Derivation and Decryption mode */
00053 } AES_Operation_TypeDef;
00054 
00055 #define IS_AES_MODE(Operation) (((Operation) == AES_Operation_Encryp) || \
00056                                 ((Operation) == AES_Operation_KeyDeriv) || \
00057                                 ((Operation) == AES_Operation_Decryp)   || \
00058                                 ((Operation) == AES_Operation_KeyDerivAndDecryp))
00059 /**
00060   * @}
00061   */
00062   
00063 /** @defgroup AES_Flags
00064   * @{
00065   */
00066 typedef enum
00067 {
00068   AES_FLAG_CCF      = (uint8_t)0x01,  /*!< Computation Complete Flag */
00069   AES_FLAG_RDERR    = (uint8_t)0x02,  /*!< Read Error Flag           */
00070   AES_FLAG_WRERR    = (uint8_t)0x04   /*!< Write Error Flag          */
00071 }AES_FLAG_TypeDef;
00072 
00073 #define IS_AES_FLAG(Flag)  (((Flag) == AES_FLAG_CCF) || \
00074                             ((Flag) == AES_FLAG_RDERR)  || \
00075                             ((Flag) == AES_FLAG_WRERR))
00076    
00077 /**
00078   * @}
00079   */
00080   
00081 /** @defgroup AES_Interrupts
00082   * @{
00083   */
00084 typedef enum
00085 {
00086   AES_IT_CCIE   = (uint16_t)0x20, /*!< Computation Complete interrupt enable */
00087   AES_IT_ERRIE  = (uint16_t)0x40  /*!< Error interrupt enable                */
00088 }AES_IT_TypeDef;
00089 
00090 #define IS_AES_IT(IT) (((IT) == AES_IT_CCIE) || \
00091                        ((IT) == AES_IT_ERRIE))
00092    
00093 /**
00094   * @}
00095   */
00096   
00097 /** @defgroup AES_DMA_Transfer_Direction
00098   * @{
00099   */
00100 typedef enum
00101 {
00102   AES_DMATransfer_InOut = (uint8_t) 0x80 /*!< DMA requests enabled for input transfer phase
00103                                               as well as for the output transfer phase */
00104 }
00105 AES_DMATransfer_TypeDef;
00106 
00107 #define IS_AES_DMATRANSFER(Transfer)   ((Transfer) == AES_DMATransfer_InOut)
00108 /**
00109   * @}
00110   */
00111   
00112 /**
00113   * @}
00114   */
00115   
00116 /* Exported constants --------------------------------------------------------*/
00117 /* Exported macros -----------------------------------------------------------*/
00118 /* Exported functions ------------------------------------------------------- */
00119 /*  Function used to set the AES configuration to the default reset state *****/  
00120 void AES_DeInit(void);
00121 
00122 /* AES Configuration **********************************************************/
00123 void AES_OperationModeConfig(AES_Operation_TypeDef AES_Operation);
00124 void AES_Cmd(FunctionalState NewState);
00125 
00126 /* AES Read and Write operations **********************************************/
00127 void AES_WriteSubData(uint8_t Data);
00128 void AES_WriteSubKey(uint8_t Key);
00129 uint8_t AES_ReadSubData(void);
00130 uint8_t AES_ReadSubKey(void);
00131 
00132 /* DMA transfers management function ******************************************/
00133 void AES_DMAConfig(AES_DMATransfer_TypeDef AES_DMATransfer, FunctionalState NewState);
00134 
00135 /* Interrupts and flags management functions **********************************/
00136 void AES_ITConfig(AES_IT_TypeDef AES_IT, FunctionalState NewState);
00137 FlagStatus AES_GetFlagStatus(AES_FLAG_TypeDef AES_FLAG);
00138 void AES_ClearFlag(AES_FLAG_TypeDef AES_FLAG);
00139 ITStatus AES_GetITStatus(AES_IT_TypeDef AES_IT);
00140 void AES_ClearITPendingBit(AES_IT_TypeDef AES_IT);
00141 
00142 #endif /* __STM8L15x_AES_H */
00143 
00144 /**
00145   * @}
00146   */
00147 
00148 /**
00149   * @}
00150   */
00151 
00152 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com