Martin Johnson / STM32F3-Discovery

Dependents:   Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32f30x_crc.h Source File

stm32f30x_crc.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f30x_crc.h
00004   * @author  MCD Application Team
00005   * @version V1.2.3
00006   * @date    10-July-2015
00007   * @brief   This file contains all the functions prototypes for the CRC firmware 
00008   *          library.
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
00013   *
00014   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00015   * You may not use this file except in compliance with the License.
00016   * You may obtain a copy of the License at:
00017   *
00018   *        http://www.st.com/software_license_agreement_liberty_v2
00019   *
00020   * Unless required by applicable law or agreed to in writing, software 
00021   * distributed under the License is distributed on an "AS IS" BASIS, 
00022   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00023   * See the License for the specific language governing permissions and
00024   * limitations under the License.
00025   *
00026   ******************************************************************************
00027   */ 
00028 
00029 /* Define to prevent recursive inclusion -------------------------------------*/
00030 #ifndef __STM32F30x_CRC_H
00031 #define __STM32F30x_CRC_H
00032 
00033 #ifdef __cplusplus
00034  extern "C" {
00035 #endif
00036 
00037 /*!< Includes ----------------------------------------------------------------*/
00038 #include "stm32f30x.h"
00039 
00040 /** @addtogroup STM32F30x_StdPeriph_Driver
00041   * @{
00042   */
00043 
00044 /** @addtogroup CRC
00045   * @{
00046   */
00047 
00048 /* Exported types ------------------------------------------------------------*/
00049 /* Exported constants --------------------------------------------------------*/
00050 
00051 /** @defgroup CRC_ReverseInputData
00052   * @{
00053   */
00054 #define CRC_ReverseInputData_No             ((uint32_t)0x00000000) /*!< No reverse operation of Input Data */
00055 #define CRC_ReverseInputData_8bits          CRC_CR_REV_IN_0        /*!< Reverse operation of Input Data on 8 bits */
00056 #define CRC_ReverseInputData_16bits         CRC_CR_REV_IN_1        /*!< Reverse operation of Input Data on 16 bits */
00057 #define CRC_ReverseInputData_32bits         CRC_CR_REV_IN          /*!< Reverse operation of Input Data on 32 bits */
00058 
00059 #define IS_CRC_REVERSE_INPUT_DATA(DATA) (((DATA) == CRC_ReverseInputData_No)     || \
00060                                          ((DATA) == CRC_ReverseInputData_8bits)  || \
00061                                          ((DATA) == CRC_ReverseInputData_16bits) || \
00062                                          ((DATA) == CRC_ReverseInputData_32bits))
00063 
00064 /**
00065   * @}
00066   */
00067 
00068 /** @defgroup CRC_PolynomialSize
00069   * @{
00070   */
00071 #define CRC_PolSize_7                       CRC_CR_POLSIZE        /*!< 7-bit polynomial for CRC calculation */
00072 #define CRC_PolSize_8                       CRC_CR_POLSIZE_1      /*!< 8-bit polynomial for CRC calculation */
00073 #define CRC_PolSize_16                      CRC_CR_POLSIZE_0      /*!< 16-bit polynomial for CRC calculation */
00074 #define CRC_PolSize_32                      ((uint32_t)0x00000000)/*!< 32-bit polynomial for CRC calculation */
00075 
00076 #define IS_CRC_POL_SIZE(SIZE) (((SIZE) == CRC_PolSize_7)  || \
00077                                ((SIZE) == CRC_PolSize_8)  || \
00078                                ((SIZE) == CRC_PolSize_16) || \
00079                                ((SIZE) == CRC_PolSize_32))
00080 
00081 /**
00082   * @}
00083   */
00084 
00085 /* Exported macro ------------------------------------------------------------*/
00086 /* Exported functions ------------------------------------------------------- */
00087 /* Configuration of the CRC computation unit **********************************/
00088 void CRC_DeInit(void);
00089 void CRC_ResetDR(void);
00090 void CRC_PolynomialSizeSelect(uint32_t CRC_PolSize); 
00091 void CRC_ReverseInputDataSelect(uint32_t CRC_ReverseInputData);
00092 void CRC_ReverseOutputDataCmd(FunctionalState NewState);
00093 void CRC_SetInitRegister(uint32_t CRC_InitValue); 
00094 void CRC_SetPolynomial(uint32_t CRC_Pol);
00095 
00096 /* CRC computation ************************************************************/
00097 uint32_t CRC_CalcCRC(uint32_t CRC_Data);
00098 uint32_t CRC_CalcCRC16bits(uint16_t CRC_Data);
00099 uint32_t CRC_CalcCRC8bits(uint8_t CRC_Data);
00100 uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength);
00101 uint32_t CRC_GetCRC(void);
00102 
00103 /* Independent register (IDR) access (write/read) *****************************/
00104 void CRC_SetIDRegister(uint8_t CRC_IDValue);
00105 uint8_t CRC_GetIDRegister(void);
00106 
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #endif /* __STM32F30x_CRC_H */
00112 
00113 /**
00114   * @}
00115   */
00116 
00117 /**
00118   * @}
00119   */
00120 
00121 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/