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