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: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
inc/stm32f30x_crc.h@1:f8e3e71af478, 2018-04-26 (annotated)
- Committer:
- MartinJohnson
- Date:
- Thu Apr 26 03:11:18 2018 +0000
- Revision:
- 1:f8e3e71af478
- Parent:
- 0:404f5a4f1385
Add stdio.h serial I/O support for the version D discovery board.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| MartinJohnson | 0:404f5a4f1385 | 1 | /** |
| MartinJohnson | 0:404f5a4f1385 | 2 | ****************************************************************************** |
| MartinJohnson | 0:404f5a4f1385 | 3 | * @file stm32f30x_crc.h |
| MartinJohnson | 0:404f5a4f1385 | 4 | * @author MCD Application Team |
| MartinJohnson | 0:404f5a4f1385 | 5 | * @version V1.2.3 |
| MartinJohnson | 0:404f5a4f1385 | 6 | * @date 10-July-2015 |
| MartinJohnson | 0:404f5a4f1385 | 7 | * @brief This file contains all the functions prototypes for the CRC firmware |
| MartinJohnson | 0:404f5a4f1385 | 8 | * library. |
| MartinJohnson | 0:404f5a4f1385 | 9 | ****************************************************************************** |
| MartinJohnson | 0:404f5a4f1385 | 10 | * @attention |
| MartinJohnson | 0:404f5a4f1385 | 11 | * |
| MartinJohnson | 0:404f5a4f1385 | 12 | * <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> |
| MartinJohnson | 0:404f5a4f1385 | 13 | * |
| MartinJohnson | 0:404f5a4f1385 | 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
| MartinJohnson | 0:404f5a4f1385 | 15 | * You may not use this file except in compliance with the License. |
| MartinJohnson | 0:404f5a4f1385 | 16 | * You may obtain a copy of the License at: |
| MartinJohnson | 0:404f5a4f1385 | 17 | * |
| MartinJohnson | 0:404f5a4f1385 | 18 | * http://www.st.com/software_license_agreement_liberty_v2 |
| MartinJohnson | 0:404f5a4f1385 | 19 | * |
| MartinJohnson | 0:404f5a4f1385 | 20 | * Unless required by applicable law or agreed to in writing, software |
| MartinJohnson | 0:404f5a4f1385 | 21 | * distributed under the License is distributed on an "AS IS" BASIS, |
| MartinJohnson | 0:404f5a4f1385 | 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| MartinJohnson | 0:404f5a4f1385 | 23 | * See the License for the specific language governing permissions and |
| MartinJohnson | 0:404f5a4f1385 | 24 | * limitations under the License. |
| MartinJohnson | 0:404f5a4f1385 | 25 | * |
| MartinJohnson | 0:404f5a4f1385 | 26 | ****************************************************************************** |
| MartinJohnson | 0:404f5a4f1385 | 27 | */ |
| MartinJohnson | 0:404f5a4f1385 | 28 | |
| MartinJohnson | 0:404f5a4f1385 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| MartinJohnson | 0:404f5a4f1385 | 30 | #ifndef __STM32F30x_CRC_H |
| MartinJohnson | 0:404f5a4f1385 | 31 | #define __STM32F30x_CRC_H |
| MartinJohnson | 0:404f5a4f1385 | 32 | |
| MartinJohnson | 0:404f5a4f1385 | 33 | #ifdef __cplusplus |
| MartinJohnson | 0:404f5a4f1385 | 34 | extern "C" { |
| MartinJohnson | 0:404f5a4f1385 | 35 | #endif |
| MartinJohnson | 0:404f5a4f1385 | 36 | |
| MartinJohnson | 0:404f5a4f1385 | 37 | /*!< Includes ----------------------------------------------------------------*/ |
| MartinJohnson | 0:404f5a4f1385 | 38 | #include "stm32f30x.h" |
| MartinJohnson | 0:404f5a4f1385 | 39 | |
| MartinJohnson | 0:404f5a4f1385 | 40 | /** @addtogroup STM32F30x_StdPeriph_Driver |
| MartinJohnson | 0:404f5a4f1385 | 41 | * @{ |
| MartinJohnson | 0:404f5a4f1385 | 42 | */ |
| MartinJohnson | 0:404f5a4f1385 | 43 | |
| MartinJohnson | 0:404f5a4f1385 | 44 | /** @addtogroup CRC |
| MartinJohnson | 0:404f5a4f1385 | 45 | * @{ |
| MartinJohnson | 0:404f5a4f1385 | 46 | */ |
| MartinJohnson | 0:404f5a4f1385 | 47 | |
| MartinJohnson | 0:404f5a4f1385 | 48 | /* Exported types ------------------------------------------------------------*/ |
| MartinJohnson | 0:404f5a4f1385 | 49 | /* Exported constants --------------------------------------------------------*/ |
| MartinJohnson | 0:404f5a4f1385 | 50 | |
| MartinJohnson | 0:404f5a4f1385 | 51 | /** @defgroup CRC_ReverseInputData |
| MartinJohnson | 0:404f5a4f1385 | 52 | * @{ |
| MartinJohnson | 0:404f5a4f1385 | 53 | */ |
| MartinJohnson | 0:404f5a4f1385 | 54 | #define CRC_ReverseInputData_No ((uint32_t)0x00000000) /*!< No reverse operation of Input Data */ |
| MartinJohnson | 0:404f5a4f1385 | 55 | #define CRC_ReverseInputData_8bits CRC_CR_REV_IN_0 /*!< Reverse operation of Input Data on 8 bits */ |
| MartinJohnson | 0:404f5a4f1385 | 56 | #define CRC_ReverseInputData_16bits CRC_CR_REV_IN_1 /*!< Reverse operation of Input Data on 16 bits */ |
| MartinJohnson | 0:404f5a4f1385 | 57 | #define CRC_ReverseInputData_32bits CRC_CR_REV_IN /*!< Reverse operation of Input Data on 32 bits */ |
| MartinJohnson | 0:404f5a4f1385 | 58 | |
| MartinJohnson | 0:404f5a4f1385 | 59 | #define IS_CRC_REVERSE_INPUT_DATA(DATA) (((DATA) == CRC_ReverseInputData_No) || \ |
| MartinJohnson | 0:404f5a4f1385 | 60 | ((DATA) == CRC_ReverseInputData_8bits) || \ |
| MartinJohnson | 0:404f5a4f1385 | 61 | ((DATA) == CRC_ReverseInputData_16bits) || \ |
| MartinJohnson | 0:404f5a4f1385 | 62 | ((DATA) == CRC_ReverseInputData_32bits)) |
| MartinJohnson | 0:404f5a4f1385 | 63 | |
| MartinJohnson | 0:404f5a4f1385 | 64 | /** |
| MartinJohnson | 0:404f5a4f1385 | 65 | * @} |
| MartinJohnson | 0:404f5a4f1385 | 66 | */ |
| MartinJohnson | 0:404f5a4f1385 | 67 | |
| MartinJohnson | 0:404f5a4f1385 | 68 | /** @defgroup CRC_PolynomialSize |
| MartinJohnson | 0:404f5a4f1385 | 69 | * @{ |
| MartinJohnson | 0:404f5a4f1385 | 70 | */ |
| MartinJohnson | 0:404f5a4f1385 | 71 | #define CRC_PolSize_7 CRC_CR_POLSIZE /*!< 7-bit polynomial for CRC calculation */ |
| MartinJohnson | 0:404f5a4f1385 | 72 | #define CRC_PolSize_8 CRC_CR_POLSIZE_1 /*!< 8-bit polynomial for CRC calculation */ |
| MartinJohnson | 0:404f5a4f1385 | 73 | #define CRC_PolSize_16 CRC_CR_POLSIZE_0 /*!< 16-bit polynomial for CRC calculation */ |
| MartinJohnson | 0:404f5a4f1385 | 74 | #define CRC_PolSize_32 ((uint32_t)0x00000000)/*!< 32-bit polynomial for CRC calculation */ |
| MartinJohnson | 0:404f5a4f1385 | 75 | |
| MartinJohnson | 0:404f5a4f1385 | 76 | #define IS_CRC_POL_SIZE(SIZE) (((SIZE) == CRC_PolSize_7) || \ |
| MartinJohnson | 0:404f5a4f1385 | 77 | ((SIZE) == CRC_PolSize_8) || \ |
| MartinJohnson | 0:404f5a4f1385 | 78 | ((SIZE) == CRC_PolSize_16) || \ |
| MartinJohnson | 0:404f5a4f1385 | 79 | ((SIZE) == CRC_PolSize_32)) |
| MartinJohnson | 0:404f5a4f1385 | 80 | |
| MartinJohnson | 0:404f5a4f1385 | 81 | /** |
| MartinJohnson | 0:404f5a4f1385 | 82 | * @} |
| MartinJohnson | 0:404f5a4f1385 | 83 | */ |
| MartinJohnson | 0:404f5a4f1385 | 84 | |
| MartinJohnson | 0:404f5a4f1385 | 85 | /* Exported macro ------------------------------------------------------------*/ |
| MartinJohnson | 0:404f5a4f1385 | 86 | /* Exported functions ------------------------------------------------------- */ |
| MartinJohnson | 0:404f5a4f1385 | 87 | /* Configuration of the CRC computation unit **********************************/ |
| MartinJohnson | 0:404f5a4f1385 | 88 | void CRC_DeInit(void); |
| MartinJohnson | 0:404f5a4f1385 | 89 | void CRC_ResetDR(void); |
| MartinJohnson | 0:404f5a4f1385 | 90 | void CRC_PolynomialSizeSelect(uint32_t CRC_PolSize); |
| MartinJohnson | 0:404f5a4f1385 | 91 | void CRC_ReverseInputDataSelect(uint32_t CRC_ReverseInputData); |
| MartinJohnson | 0:404f5a4f1385 | 92 | void CRC_ReverseOutputDataCmd(FunctionalState NewState); |
| MartinJohnson | 0:404f5a4f1385 | 93 | void CRC_SetInitRegister(uint32_t CRC_InitValue); |
| MartinJohnson | 0:404f5a4f1385 | 94 | void CRC_SetPolynomial(uint32_t CRC_Pol); |
| MartinJohnson | 0:404f5a4f1385 | 95 | |
| MartinJohnson | 0:404f5a4f1385 | 96 | /* CRC computation ************************************************************/ |
| MartinJohnson | 0:404f5a4f1385 | 97 | uint32_t CRC_CalcCRC(uint32_t CRC_Data); |
| MartinJohnson | 0:404f5a4f1385 | 98 | uint32_t CRC_CalcCRC16bits(uint16_t CRC_Data); |
| MartinJohnson | 0:404f5a4f1385 | 99 | uint32_t CRC_CalcCRC8bits(uint8_t CRC_Data); |
| MartinJohnson | 0:404f5a4f1385 | 100 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); |
| MartinJohnson | 0:404f5a4f1385 | 101 | uint32_t CRC_GetCRC(void); |
| MartinJohnson | 0:404f5a4f1385 | 102 | |
| MartinJohnson | 0:404f5a4f1385 | 103 | /* Independent register (IDR) access (write/read) *****************************/ |
| MartinJohnson | 0:404f5a4f1385 | 104 | void CRC_SetIDRegister(uint8_t CRC_IDValue); |
| MartinJohnson | 0:404f5a4f1385 | 105 | uint8_t CRC_GetIDRegister(void); |
| MartinJohnson | 0:404f5a4f1385 | 106 | |
| MartinJohnson | 0:404f5a4f1385 | 107 | #ifdef __cplusplus |
| MartinJohnson | 0:404f5a4f1385 | 108 | } |
| MartinJohnson | 0:404f5a4f1385 | 109 | #endif |
| MartinJohnson | 0:404f5a4f1385 | 110 | |
| MartinJohnson | 0:404f5a4f1385 | 111 | #endif /* __STM32F30x_CRC_H */ |
| MartinJohnson | 0:404f5a4f1385 | 112 | |
| MartinJohnson | 0:404f5a4f1385 | 113 | /** |
| MartinJohnson | 0:404f5a4f1385 | 114 | * @} |
| MartinJohnson | 0:404f5a4f1385 | 115 | */ |
| MartinJohnson | 0:404f5a4f1385 | 116 | |
| MartinJohnson | 0:404f5a4f1385 | 117 | /** |
| MartinJohnson | 0:404f5a4f1385 | 118 | * @} |
| MartinJohnson | 0:404f5a4f1385 | 119 | */ |
| MartinJohnson | 0:404f5a4f1385 | 120 | |
| MartinJohnson | 0:404f5a4f1385 | 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |