提交 | 用户 | age
|
483170
|
1 |
/** |
Q |
2 |
****************************************************************************** |
|
3 |
* @file stm32f0xx_hal_crc_ex.h |
|
4 |
* @author MCD Application Team |
|
5 |
* @brief Header file of CRC HAL extension module. |
|
6 |
****************************************************************************** |
|
7 |
* @attention |
|
8 |
* |
|
9 |
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
|
10 |
* |
|
11 |
* Redistribution and use in source and binary forms, with or without modification, |
|
12 |
* are permitted provided that the following conditions are met: |
|
13 |
* 1. Redistributions of source code must retain the above copyright notice, |
|
14 |
* this list of conditions and the following disclaimer. |
|
15 |
* 2. Redistributions in binary form must reproduce the above copyright notice, |
|
16 |
* this list of conditions and the following disclaimer in the documentation |
|
17 |
* and/or other materials provided with the distribution. |
|
18 |
* 3. Neither the name of STMicroelectronics nor the names of its contributors |
|
19 |
* may be used to endorse or promote products derived from this software |
|
20 |
* without specific prior written permission. |
|
21 |
* |
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
23 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
24 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
25 |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
|
26 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
27 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
28 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
29 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
30 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
31 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
32 |
* |
|
33 |
****************************************************************************** |
|
34 |
*/ |
|
35 |
|
|
36 |
/* Define to prevent recursive inclusion -------------------------------------*/ |
|
37 |
#ifndef __STM32F0xx_HAL_CRC_EX_H |
|
38 |
#define __STM32F0xx_HAL_CRC_EX_H |
|
39 |
|
|
40 |
#ifdef __cplusplus |
|
41 |
extern "C" { |
|
42 |
#endif |
|
43 |
|
|
44 |
/* Includes ------------------------------------------------------------------*/ |
|
45 |
#include "stm32f0xx_hal_def.h" |
|
46 |
|
|
47 |
/** @addtogroup STM32F0xx_HAL_Driver |
|
48 |
* @{ |
|
49 |
*/ |
|
50 |
|
|
51 |
/** @addtogroup CRCEx CRCEx |
|
52 |
* @{ |
|
53 |
*/ |
|
54 |
|
|
55 |
/* Exported types ------------------------------------------------------------*/ |
|
56 |
/* Exported constants --------------------------------------------------------*/ |
|
57 |
/** @defgroup CRCEx_Exported_Constants CRCEx Exported Constants |
|
58 |
* @{ |
|
59 |
*/ |
|
60 |
/** @defgroup CRCEx_Input_Data_Inversion Input Data Inversion Modes |
|
61 |
* @{ |
|
62 |
*/ |
|
63 |
#define CRC_INPUTDATA_INVERSION_NONE (0x00000000U) |
|
64 |
#define CRC_INPUTDATA_INVERSION_BYTE ((uint32_t)CRC_CR_REV_IN_0) |
|
65 |
#define CRC_INPUTDATA_INVERSION_HALFWORD ((uint32_t)CRC_CR_REV_IN_1) |
|
66 |
#define CRC_INPUTDATA_INVERSION_WORD ((uint32_t)CRC_CR_REV_IN) |
|
67 |
|
|
68 |
#define IS_CRC_INPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_INPUTDATA_INVERSION_NONE) || \ |
|
69 |
((MODE) == CRC_INPUTDATA_INVERSION_BYTE) || \ |
|
70 |
((MODE) == CRC_INPUTDATA_INVERSION_HALFWORD) || \ |
|
71 |
((MODE) == CRC_INPUTDATA_INVERSION_WORD)) |
|
72 |
/** |
|
73 |
* @} |
|
74 |
*/ |
|
75 |
|
|
76 |
/** @defgroup CRCEx_Output_Data_Inversion Output Data Inversion Modes |
|
77 |
* @{ |
|
78 |
*/ |
|
79 |
#define CRC_OUTPUTDATA_INVERSION_DISABLE (0x00000000U) |
|
80 |
#define CRC_OUTPUTDATA_INVERSION_ENABLE ((uint32_t)CRC_CR_REV_OUT) |
|
81 |
|
|
82 |
#define IS_CRC_OUTPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_OUTPUTDATA_INVERSION_DISABLE) || \ |
|
83 |
((MODE) == CRC_OUTPUTDATA_INVERSION_ENABLE)) |
|
84 |
/** |
|
85 |
* @} |
|
86 |
*/ |
|
87 |
|
|
88 |
/** @defgroup CRCEx_Polynomial_Sizes Polynomial sizes to configure the IP |
|
89 |
* @{ |
|
90 |
*/ |
|
91 |
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) |
|
92 |
#define CRC_POLYLENGTH_32B (0x00000000U) |
|
93 |
#define CRC_POLYLENGTH_16B ((uint32_t)CRC_CR_POLYSIZE_0) |
|
94 |
#define CRC_POLYLENGTH_8B ((uint32_t)CRC_CR_POLYSIZE_1) |
|
95 |
#define CRC_POLYLENGTH_7B ((uint32_t)CRC_CR_POLYSIZE) |
|
96 |
#define IS_CRC_POL_LENGTH(LENGTH) (((LENGTH) == CRC_POLYLENGTH_32B) || \ |
|
97 |
((LENGTH) == CRC_POLYLENGTH_16B) || \ |
|
98 |
((LENGTH) == CRC_POLYLENGTH_8B) || \ |
|
99 |
((LENGTH) == CRC_POLYLENGTH_7B)) |
|
100 |
#else |
|
101 |
#define CRC_POLYLENGTH_32B (0x00000000U) |
|
102 |
#define IS_CRC_POL_LENGTH(LENGTH) ((LENGTH) == CRC_POLYLENGTH_32B) |
|
103 |
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */ |
|
104 |
/** |
|
105 |
* @} |
|
106 |
*/ |
|
107 |
|
|
108 |
/** @defgroup CRCEx_Polynomial_Size_Definitions CRC polynomial possible sizes actual definitions |
|
109 |
* @{ |
|
110 |
*/ |
|
111 |
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) |
|
112 |
#define HAL_CRC_LENGTH_32B 32U |
|
113 |
#define HAL_CRC_LENGTH_16B 16U |
|
114 |
#define HAL_CRC_LENGTH_8B 8U |
|
115 |
#define HAL_CRC_LENGTH_7B 7U |
|
116 |
#else |
|
117 |
#define HAL_CRC_LENGTH_32B 32U |
|
118 |
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */ |
|
119 |
/** |
|
120 |
* @} |
|
121 |
*/ |
|
122 |
|
|
123 |
/** |
|
124 |
* @} |
|
125 |
*/ |
|
126 |
/* Exported macro ------------------------------------------------------------*/ |
|
127 |
|
|
128 |
/** @defgroup CRCEx_Exported_Macros CRCEx Exported Macros |
|
129 |
* @{ |
|
130 |
*/ |
|
131 |
|
|
132 |
/** |
|
133 |
* @brief Set CRC output reversal |
|
134 |
* @param __HANDLE__ CRC handle |
|
135 |
* @retval None. |
|
136 |
*/ |
|
137 |
#define __HAL_CRC_OUTPUTREVERSAL_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_REV_OUT) |
|
138 |
|
|
139 |
/** |
|
140 |
* @brief Unset CRC output reversal |
|
141 |
* @param __HANDLE__ CRC handle |
|
142 |
* @retval None. |
|
143 |
*/ |
|
144 |
#define __HAL_CRC_OUTPUTREVERSAL_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(CRC_CR_REV_OUT)) |
|
145 |
|
|
146 |
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) |
|
147 |
/** |
|
148 |
* @brief Set CRC non-default polynomial |
|
149 |
* @param __HANDLE__ CRC handle |
|
150 |
* @param __POLYNOMIAL__ 7, 8, 16 or 32-bit polynomial |
|
151 |
* @retval None. |
|
152 |
*/ |
|
153 |
#define __HAL_CRC_POLYNOMIAL_CONFIG(__HANDLE__, __POLYNOMIAL__) ((__HANDLE__)->Instance->POL = (__POLYNOMIAL__)) |
|
154 |
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */ |
|
155 |
/** |
|
156 |
* @} |
|
157 |
*/ |
|
158 |
|
|
159 |
/* Exported functions --------------------------------------------------------*/ |
|
160 |
/** @addtogroup CRCEx_Exported_Functions |
|
161 |
* @{ |
|
162 |
*/ |
|
163 |
|
|
164 |
/** @addtogroup CRCEx_Exported_Functions_Group1 Extended Initialization/de-initialization functions |
|
165 |
* @brief Extended Initialization and Configuration functions. |
|
166 |
* @{ |
|
167 |
*/ |
|
168 |
|
|
169 |
/* Initialization and de-initialization functions ****************************/ |
|
170 |
HAL_StatusTypeDef HAL_CRCEx_Init(CRC_HandleTypeDef *hcrc); |
|
171 |
HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode); |
|
172 |
HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode); |
|
173 |
|
|
174 |
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) |
|
175 |
HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength); |
|
176 |
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */ |
|
177 |
/** |
|
178 |
* @} |
|
179 |
*/ |
|
180 |
/* Peripheral Control functions ***********************************************/ |
|
181 |
/* Peripheral State and Error functions ***************************************/ |
|
182 |
/** |
|
183 |
* @} |
|
184 |
*/ |
|
185 |
|
|
186 |
/** |
|
187 |
* @} |
|
188 |
*/ |
|
189 |
|
|
190 |
/** |
|
191 |
* @} |
|
192 |
*/ |
|
193 |
|
|
194 |
#ifdef __cplusplus |
|
195 |
} |
|
196 |
#endif |
|
197 |
|
|
198 |
#endif /* __STM32F0xx_HAL_CRC_EX_H */ |
|
199 |
|
|
200 |
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |