Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
TARGET_NUCLEO_F302R8/stm32f30x_crc.h@89:552587b429a1, 2014-09-12 (annotated)
- Committer:
- bogdanm
- Date:
- Fri Sep 12 16:41:52 2014 +0100
- Revision:
- 89:552587b429a1
- Parent:
- 82:6473597d706e
Release 89 of the mbed library
Main changes:
- low power optimizations for Nordic targets
- code structure changes for Freescale K64F targets
- bug fixes in various backends
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| bogdanm | 82:6473597d706e | 1 | /** |
| bogdanm | 82:6473597d706e | 2 | ****************************************************************************** |
| bogdanm | 82:6473597d706e | 3 | * @file stm32f30x_crc.h |
| bogdanm | 82:6473597d706e | 4 | * @author MCD Application Team |
| bogdanm | 82:6473597d706e | 5 | * @version V1.1.0 |
| bogdanm | 82:6473597d706e | 6 | * @date 27-February-2014 |
| bogdanm | 82:6473597d706e | 7 | * @brief This file contains all the functions prototypes for the CRC firmware |
| bogdanm | 82:6473597d706e | 8 | * library. |
| bogdanm | 82:6473597d706e | 9 | ****************************************************************************** |
| bogdanm | 82:6473597d706e | 10 | * @attention |
| bogdanm | 82:6473597d706e | 11 | * |
| bogdanm | 82:6473597d706e | 12 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
| bogdanm | 82:6473597d706e | 13 | * |
| bogdanm | 82:6473597d706e | 14 | * Redistribution and use in source and binary forms, with or without modification, |
| bogdanm | 82:6473597d706e | 15 | * are permitted provided that the following conditions are met: |
| bogdanm | 82:6473597d706e | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
| bogdanm | 82:6473597d706e | 17 | * this list of conditions and the following disclaimer. |
| bogdanm | 82:6473597d706e | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| bogdanm | 82:6473597d706e | 19 | * this list of conditions and the following disclaimer in the documentation |
| bogdanm | 82:6473597d706e | 20 | * and/or other materials provided with the distribution. |
| bogdanm | 82:6473597d706e | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| bogdanm | 82:6473597d706e | 22 | * may be used to endorse or promote products derived from this software |
| bogdanm | 82:6473597d706e | 23 | * without specific prior written permission. |
| bogdanm | 82:6473597d706e | 24 | * |
| bogdanm | 82:6473597d706e | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| bogdanm | 82:6473597d706e | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| bogdanm | 82:6473597d706e | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| bogdanm | 82:6473597d706e | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| bogdanm | 82:6473597d706e | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| bogdanm | 82:6473597d706e | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| bogdanm | 82:6473597d706e | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| bogdanm | 82:6473597d706e | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| bogdanm | 82:6473597d706e | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| bogdanm | 82:6473597d706e | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| bogdanm | 82:6473597d706e | 35 | * |
| bogdanm | 82:6473597d706e | 36 | ****************************************************************************** |
| bogdanm | 82:6473597d706e | 37 | */ |
| bogdanm | 82:6473597d706e | 38 | |
| bogdanm | 82:6473597d706e | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| bogdanm | 82:6473597d706e | 40 | #ifndef __STM32F30x_CRC_H |
| bogdanm | 82:6473597d706e | 41 | #define __STM32F30x_CRC_H |
| bogdanm | 82:6473597d706e | 42 | |
| bogdanm | 82:6473597d706e | 43 | #ifdef __cplusplus |
| bogdanm | 82:6473597d706e | 44 | extern "C" { |
| bogdanm | 82:6473597d706e | 45 | #endif |
| bogdanm | 82:6473597d706e | 46 | |
| bogdanm | 82:6473597d706e | 47 | /*!< Includes ----------------------------------------------------------------*/ |
| bogdanm | 82:6473597d706e | 48 | #include "stm32f30x.h" |
| bogdanm | 82:6473597d706e | 49 | |
| bogdanm | 82:6473597d706e | 50 | /** @addtogroup STM32F30x_StdPeriph_Driver |
| bogdanm | 82:6473597d706e | 51 | * @{ |
| bogdanm | 82:6473597d706e | 52 | */ |
| bogdanm | 82:6473597d706e | 53 | |
| bogdanm | 82:6473597d706e | 54 | /** @addtogroup CRC |
| bogdanm | 82:6473597d706e | 55 | * @{ |
| bogdanm | 82:6473597d706e | 56 | */ |
| bogdanm | 82:6473597d706e | 57 | |
| bogdanm | 82:6473597d706e | 58 | /* Exported types ------------------------------------------------------------*/ |
| bogdanm | 82:6473597d706e | 59 | /* Exported constants --------------------------------------------------------*/ |
| bogdanm | 82:6473597d706e | 60 | |
| bogdanm | 82:6473597d706e | 61 | /** @defgroup CRC_ReverseInputData |
| bogdanm | 82:6473597d706e | 62 | * @{ |
| bogdanm | 82:6473597d706e | 63 | */ |
| bogdanm | 82:6473597d706e | 64 | #define CRC_ReverseInputData_No ((uint32_t)0x00000000) /*!< No reverse operation of Input Data */ |
| bogdanm | 82:6473597d706e | 65 | #define CRC_ReverseInputData_8bits CRC_CR_REV_IN_0 /*!< Reverse operation of Input Data on 8 bits */ |
| bogdanm | 82:6473597d706e | 66 | #define CRC_ReverseInputData_16bits CRC_CR_REV_IN_1 /*!< Reverse operation of Input Data on 16 bits */ |
| bogdanm | 82:6473597d706e | 67 | #define CRC_ReverseInputData_32bits CRC_CR_REV_IN /*!< Reverse operation of Input Data on 32 bits */ |
| bogdanm | 82:6473597d706e | 68 | |
| bogdanm | 82:6473597d706e | 69 | #define IS_CRC_REVERSE_INPUT_DATA(DATA) (((DATA) == CRC_ReverseInputData_No) || \ |
| bogdanm | 82:6473597d706e | 70 | ((DATA) == CRC_ReverseInputData_8bits) || \ |
| bogdanm | 82:6473597d706e | 71 | ((DATA) == CRC_ReverseInputData_16bits) || \ |
| bogdanm | 82:6473597d706e | 72 | ((DATA) == CRC_ReverseInputData_32bits)) |
| bogdanm | 82:6473597d706e | 73 | |
| bogdanm | 82:6473597d706e | 74 | /** |
| bogdanm | 82:6473597d706e | 75 | * @} |
| bogdanm | 82:6473597d706e | 76 | */ |
| bogdanm | 82:6473597d706e | 77 | |
| bogdanm | 82:6473597d706e | 78 | /** @defgroup CRC_PolynomialSize |
| bogdanm | 82:6473597d706e | 79 | * @{ |
| bogdanm | 82:6473597d706e | 80 | */ |
| bogdanm | 82:6473597d706e | 81 | #define CRC_PolSize_7 CRC_CR_POLSIZE /*!< 7-bit polynomial for CRC calculation */ |
| bogdanm | 82:6473597d706e | 82 | #define CRC_PolSize_8 CRC_CR_POLSIZE_1 /*!< 8-bit polynomial for CRC calculation */ |
| bogdanm | 82:6473597d706e | 83 | #define CRC_PolSize_16 CRC_CR_POLSIZE_0 /*!< 16-bit polynomial for CRC calculation */ |
| bogdanm | 82:6473597d706e | 84 | #define CRC_PolSize_32 ((uint32_t)0x00000000)/*!< 32-bit polynomial for CRC calculation */ |
| bogdanm | 82:6473597d706e | 85 | |
| bogdanm | 82:6473597d706e | 86 | #define IS_CRC_POL_SIZE(SIZE) (((SIZE) == CRC_PolSize_7) || \ |
| bogdanm | 82:6473597d706e | 87 | ((SIZE) == CRC_PolSize_8) || \ |
| bogdanm | 82:6473597d706e | 88 | ((SIZE) == CRC_PolSize_16) || \ |
| bogdanm | 82:6473597d706e | 89 | ((SIZE) == CRC_PolSize_32)) |
| bogdanm | 82:6473597d706e | 90 | |
| bogdanm | 82:6473597d706e | 91 | /** |
| bogdanm | 82:6473597d706e | 92 | * @} |
| bogdanm | 82:6473597d706e | 93 | */ |
| bogdanm | 82:6473597d706e | 94 | |
| bogdanm | 82:6473597d706e | 95 | /* Exported macro ------------------------------------------------------------*/ |
| bogdanm | 82:6473597d706e | 96 | /* Exported functions ------------------------------------------------------- */ |
| bogdanm | 82:6473597d706e | 97 | /* Configuration of the CRC computation unit **********************************/ |
| bogdanm | 82:6473597d706e | 98 | void CRC_DeInit(void); |
| bogdanm | 82:6473597d706e | 99 | void CRC_ResetDR(void); |
| bogdanm | 82:6473597d706e | 100 | void CRC_PolynomialSizeSelect(uint32_t CRC_PolSize); |
| bogdanm | 82:6473597d706e | 101 | void CRC_ReverseInputDataSelect(uint32_t CRC_ReverseInputData); |
| bogdanm | 82:6473597d706e | 102 | void CRC_ReverseOutputDataCmd(FunctionalState NewState); |
| bogdanm | 82:6473597d706e | 103 | void CRC_SetInitRegister(uint32_t CRC_InitValue); |
| bogdanm | 82:6473597d706e | 104 | void CRC_SetPolynomial(uint32_t CRC_Pol); |
| bogdanm | 82:6473597d706e | 105 | |
| bogdanm | 82:6473597d706e | 106 | /* CRC computation ************************************************************/ |
| bogdanm | 82:6473597d706e | 107 | uint32_t CRC_CalcCRC(uint32_t CRC_Data); |
| bogdanm | 82:6473597d706e | 108 | uint32_t CRC_CalcCRC16bits(uint16_t CRC_Data); |
| bogdanm | 82:6473597d706e | 109 | uint32_t CRC_CalcCRC8bits(uint8_t CRC_Data); |
| bogdanm | 82:6473597d706e | 110 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); |
| bogdanm | 82:6473597d706e | 111 | uint32_t CRC_GetCRC(void); |
| bogdanm | 82:6473597d706e | 112 | |
| bogdanm | 82:6473597d706e | 113 | /* Independent register (IDR) access (write/read) *****************************/ |
| bogdanm | 82:6473597d706e | 114 | void CRC_SetIDRegister(uint8_t CRC_IDValue); |
| bogdanm | 82:6473597d706e | 115 | uint8_t CRC_GetIDRegister(void); |
| bogdanm | 82:6473597d706e | 116 | |
| bogdanm | 82:6473597d706e | 117 | #ifdef __cplusplus |
| bogdanm | 82:6473597d706e | 118 | } |
| bogdanm | 82:6473597d706e | 119 | #endif |
| bogdanm | 82:6473597d706e | 120 | |
| bogdanm | 82:6473597d706e | 121 | #endif /* __STM32F30x_CRC_H */ |
| bogdanm | 82:6473597d706e | 122 | |
| bogdanm | 82:6473597d706e | 123 | /** |
| bogdanm | 82:6473597d706e | 124 | * @} |
| bogdanm | 82:6473597d706e | 125 | */ |
| bogdanm | 82:6473597d706e | 126 | |
| bogdanm | 82:6473597d706e | 127 | /** |
| bogdanm | 82:6473597d706e | 128 | * @} |
| bogdanm | 82:6473597d706e | 129 | */ |
| bogdanm | 82:6473597d706e | 130 | |
| bogdanm | 82:6473597d706e | 131 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |


