Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 3 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /** |
1 | /** |
2 | ****************************************************************************** |
2 | ****************************************************************************** |
3 | * @file stm32f1xx_ll_crc.h |
3 | * @file stm32f1xx_ll_crc.h |
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @brief Header file of CRC LL module. |
5 | * @brief Header file of CRC LL module. |
6 | ****************************************************************************** |
6 | ****************************************************************************** |
7 | * @attention |
7 | * @attention |
8 | * |
8 | * |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
9 | * Copyright (c) 2016 STMicroelectronics. |
10 | * All rights reserved.</center></h2> |
10 | * All rights reserved. |
11 | * |
11 | * |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
12 | * This software is licensed under terms that can be found in the LICENSE file |
13 | * the "License"; You may not use this file except in compliance with the |
13 | * in the root directory of this software component. |
14 | * License. You may obtain a copy of the License at: |
14 | * If no LICENSE file comes with this software, it is provided AS-IS. |
15 | * opensource.org/licenses/BSD-3-Clause |
15 | * |
16 | * |
16 | ****************************************************************************** |
17 | ****************************************************************************** |
17 | */ |
18 | */ |
18 | |
19 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ |
|
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | #ifndef STM32F1xx_LL_CRC_H |
21 | #ifndef STM32F1xx_LL_CRC_H |
21 | #define STM32F1xx_LL_CRC_H |
22 | #define STM32F1xx_LL_CRC_H |
22 | |
23 | 23 | #ifdef __cplusplus |
|
24 | #ifdef __cplusplus |
24 | extern "C" { |
25 | extern "C" { |
25 | #endif |
26 | #endif |
26 | |
27 | 27 | /* Includes ------------------------------------------------------------------*/ |
|
28 | /* Includes ------------------------------------------------------------------*/ |
28 | #include "stm32f1xx.h" |
29 | #include "stm32f1xx.h" |
29 | |
30 | 30 | /** @addtogroup STM32F1xx_LL_Driver |
|
31 | /** @addtogroup STM32F1xx_LL_Driver |
31 | * @{ |
32 | * @{ |
32 | */ |
33 | */ |
33 | |
34 | 34 | #if defined(CRC) |
|
35 | #if defined(CRC) |
35 | |
36 | 36 | /** @defgroup CRC_LL CRC |
|
37 | /** @defgroup CRC_LL CRC |
37 | * @{ |
38 | * @{ |
38 | */ |
39 | */ |
39 | |
40 | 40 | /* Private types -------------------------------------------------------------*/ |
|
41 | /* Private types -------------------------------------------------------------*/ |
41 | /* Private variables ---------------------------------------------------------*/ |
42 | /* Private variables ---------------------------------------------------------*/ |
42 | /* Private constants ---------------------------------------------------------*/ |
43 | /* Private constants ---------------------------------------------------------*/ |
43 | /* Private macros ------------------------------------------------------------*/ |
44 | /* Private macros ------------------------------------------------------------*/ |
44 | |
45 | 45 | /* Exported types ------------------------------------------------------------*/ |
|
46 | /* Exported types ------------------------------------------------------------*/ |
46 | /* Exported constants --------------------------------------------------------*/ |
47 | /* Exported constants --------------------------------------------------------*/ |
47 | /** @defgroup CRC_LL_Exported_Constants CRC Exported Constants |
48 | /** @defgroup CRC_LL_Exported_Constants CRC Exported Constants |
48 | * @{ |
49 | * @{ |
49 | */ |
50 | */ |
50 | |
51 | 51 | /** |
|
52 | /** |
52 | * @} |
53 | * @} |
53 | */ |
54 | */ |
54 | |
55 | 55 | /* Exported macro ------------------------------------------------------------*/ |
|
56 | /* Exported macro ------------------------------------------------------------*/ |
56 | /** @defgroup CRC_LL_Exported_Macros CRC Exported Macros |
57 | /** @defgroup CRC_LL_Exported_Macros CRC Exported Macros |
57 | * @{ |
58 | * @{ |
58 | */ |
59 | */ |
59 | |
60 | 60 | /** @defgroup CRC_LL_EM_WRITE_READ Common Write and read registers Macros |
|
61 | /** @defgroup CRC_LL_EM_WRITE_READ Common Write and read registers Macros |
61 | * @{ |
62 | * @{ |
62 | */ |
63 | */ |
63 | |
64 | 64 | /** |
|
65 | /** |
65 | * @brief Write a value in CRC register |
66 | * @brief Write a value in CRC register |
66 | * @param __INSTANCE__ CRC Instance |
67 | * @param __INSTANCE__ CRC Instance |
67 | * @param __REG__ Register to be written |
68 | * @param __REG__ Register to be written |
68 | * @param __VALUE__ Value to be written in the register |
69 | * @param __VALUE__ Value to be written in the register |
69 | * @retval None |
70 | * @retval None |
70 | */ |
71 | */ |
71 | #define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, __VALUE__) |
72 | #define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, __VALUE__) |
72 | |
73 | 73 | /** |
|
74 | /** |
74 | * @brief Read a value in CRC register |
75 | * @brief Read a value in CRC register |
75 | * @param __INSTANCE__ CRC Instance |
76 | * @param __INSTANCE__ CRC Instance |
76 | * @param __REG__ Register to be read |
77 | * @param __REG__ Register to be read |
77 | * @retval Register value |
78 | * @retval Register value |
78 | */ |
79 | */ |
79 | #define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
80 | #define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
80 | /** |
81 | /** |
81 | * @} |
82 | * @} |
82 | */ |
83 | */ |
83 | |
84 | 84 | /** |
|
85 | /** |
85 | * @} |
86 | * @} |
86 | */ |
87 | */ |
87 | |
88 | 88 | ||
89 | 89 | /* Exported functions --------------------------------------------------------*/ |
|
90 | /* Exported functions --------------------------------------------------------*/ |
90 | /** @defgroup CRC_LL_Exported_Functions CRC Exported Functions |
91 | /** @defgroup CRC_LL_Exported_Functions CRC Exported Functions |
91 | * @{ |
92 | * @{ |
92 | */ |
93 | */ |
93 | |
94 | 94 | /** @defgroup CRC_LL_EF_Configuration CRC Configuration functions |
|
95 | /** @defgroup CRC_LL_EF_Configuration CRC Configuration functions |
95 | * @{ |
96 | * @{ |
96 | */ |
97 | */ |
97 | |
98 | 98 | /** |
|
99 | /** |
99 | * @brief Reset the CRC calculation unit. |
100 | * @brief Reset the CRC calculation unit. |
100 | * @note If Programmable Initial CRC value feature |
101 | * @note If Programmable Initial CRC value feature |
101 | * is available, also set the Data Register to the value stored in the |
102 | * is available, also set the Data Register to the value stored in the |
102 | * CRC_INIT register, otherwise, reset Data Register to its default value. |
103 | * CRC_INIT register, otherwise, reset Data Register to its default value. |
103 | * @rmtoll CR RESET LL_CRC_ResetCRCCalculationUnit |
104 | * @rmtoll CR RESET LL_CRC_ResetCRCCalculationUnit |
104 | * @param CRCx CRC Instance |
105 | * @param CRCx CRC Instance |
105 | * @retval None |
106 | * @retval None |
106 | */ |
107 | */ |
107 | __STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx) |
108 | __STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx) |
108 | { |
109 | { |
109 | SET_BIT(CRCx->CR, CRC_CR_RESET); |
110 | SET_BIT(CRCx->CR, CRC_CR_RESET); |
110 | } |
111 | } |
111 | |
112 | 112 | /** |
|
113 | /** |
113 | * @} |
114 | * @} |
114 | */ |
115 | */ |
115 | |
116 | 116 | /** @defgroup CRC_LL_EF_Data_Management Data_Management |
|
117 | /** @defgroup CRC_LL_EF_Data_Management Data_Management |
117 | * @{ |
118 | * @{ |
118 | */ |
119 | */ |
119 | |
120 | 120 | /** |
|
121 | /** |
121 | * @brief Write given 32-bit data to the CRC calculator |
122 | * @brief Write given 32-bit data to the CRC calculator |
122 | * @rmtoll DR DR LL_CRC_FeedData32 |
123 | * @rmtoll DR DR LL_CRC_FeedData32 |
123 | * @param CRCx CRC Instance |
124 | * @param CRCx CRC Instance |
124 | * @param InData value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFFFFFF |
125 | * @param InData value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFFFFFF |
125 | * @retval None |
126 | * @retval None |
126 | */ |
127 | */ |
127 | __STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData) |
128 | __STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData) |
128 | { |
129 | { |
129 | WRITE_REG(CRCx->DR, InData); |
130 | WRITE_REG(CRCx->DR, InData); |
130 | } |
131 | } |
131 | |
132 | 132 | /** |
|
133 | /** |
133 | * @brief Return current CRC calculation result. 32 bits value is returned. |
134 | * @brief Return current CRC calculation result. 32 bits value is returned. |
134 | * @rmtoll DR DR LL_CRC_ReadData32 |
135 | * @rmtoll DR DR LL_CRC_ReadData32 |
135 | * @param CRCx CRC Instance |
136 | * @param CRCx CRC Instance |
136 | * @retval Current CRC calculation result as stored in CRC_DR register (32 bits). |
137 | * @retval Current CRC calculation result as stored in CRC_DR register (32 bits). |
137 | */ |
138 | */ |
138 | __STATIC_INLINE uint32_t LL_CRC_ReadData32(const CRC_TypeDef *CRCx) |
139 | __STATIC_INLINE uint32_t LL_CRC_ReadData32(CRC_TypeDef *CRCx) |
139 | { |
140 | { |
140 | return (uint32_t)(READ_REG(CRCx->DR)); |
141 | return (uint32_t)(READ_REG(CRCx->DR)); |
141 | } |
142 | } |
142 | |
143 | 143 | /** |
|
144 | /** |
144 | * @brief Return data stored in the Independent Data(IDR) register. |
145 | * @brief Return data stored in the Independent Data(IDR) register. |
145 | * @note This register can be used as a temporary storage location for one byte. |
146 | * @note This register can be used as a temporary storage location for one byte. |
146 | * @rmtoll IDR IDR LL_CRC_Read_IDR |
147 | * @rmtoll IDR IDR LL_CRC_Read_IDR |
147 | * @param CRCx CRC Instance |
148 | * @param CRCx CRC Instance |
148 | * @retval Value stored in CRC_IDR register (General-purpose 8-bit data register). |
149 | * @retval Value stored in CRC_IDR register (General-purpose 8-bit data register). |
149 | */ |
150 | */ |
150 | __STATIC_INLINE uint32_t LL_CRC_Read_IDR(CRC_TypeDef *CRCx) |
151 | __STATIC_INLINE uint32_t LL_CRC_Read_IDR(CRC_TypeDef *CRCx) |
151 | { |
152 | { |
152 | return (uint32_t)(READ_REG(CRCx->IDR)); |
153 | return (uint32_t)(READ_REG(CRCx->IDR)); |
153 | } |
154 | } |
154 | |
155 | 155 | /** |
|
156 | /** |
156 | * @brief Store data in the Independent Data(IDR) register. |
157 | * @brief Store data in the Independent Data(IDR) register. |
157 | * @note This register can be used as a temporary storage location for one byte. |
158 | * @note This register can be used as a temporary storage location for one byte. |
158 | * @rmtoll IDR IDR LL_CRC_Write_IDR |
159 | * @rmtoll IDR IDR LL_CRC_Write_IDR |
159 | * @param CRCx CRC Instance |
160 | * @param CRCx CRC Instance |
160 | * @param InData value to be stored in CRC_IDR register (8-bit) between Min_Data=0 and Max_Data=0xFF |
161 | * @param InData value to be stored in CRC_IDR register (8-bit) between Min_Data=0 and Max_Data=0xFF |
161 | * @retval None |
162 | * @retval None |
162 | */ |
163 | */ |
163 | __STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData) |
164 | __STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData) |
164 | { |
165 | { |
165 | *((uint8_t __IO *)(&CRCx->IDR)) = (uint8_t) InData; |
166 | *((uint8_t __IO *)(&CRCx->IDR)) = (uint8_t) InData; |
166 | } |
167 | } |
167 | /** |
168 | /** |
168 | * @} |
169 | * @} |
169 | */ |
170 | */ |
170 | |
171 | 171 | #if defined(USE_FULL_LL_DRIVER) |
|
172 | #if defined(USE_FULL_LL_DRIVER) |
172 | /** @defgroup CRC_LL_EF_Init Initialization and de-initialization functions |
173 | /** @defgroup CRC_LL_EF_Init Initialization and de-initialization functions |
173 | * @{ |
174 | * @{ |
174 | */ |
175 | */ |
175 | |
176 | 176 | ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx); |
|
177 | ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx); |
177 | |
178 | 178 | /** |
|
179 | /** |
179 | * @} |
180 | * @} |
180 | */ |
181 | */ |
181 | #endif /* USE_FULL_LL_DRIVER */ |
182 | #endif /* USE_FULL_LL_DRIVER */ |
182 | |
183 | 183 | /** |
|
184 | /** |
184 | * @} |
185 | * @} |
185 | */ |
186 | */ |
186 | |
187 | 187 | /** |
|
188 | /** |
188 | * @} |
189 | * @} |
189 | */ |
190 | */ |
190 | |
191 | 191 | #endif /* defined(CRC) */ |
|
192 | #endif /* defined(CRC) */ |
192 | |
193 | 193 | /** |
|
194 | /** |
194 | * @} |
195 | * @} |
195 | */ |
196 | */ |
196 | |
197 | 197 | #ifdef __cplusplus |
|
198 | #ifdef __cplusplus |
198 | } |
199 | } |
199 | #endif |
200 | #endif |
200 | |
201 | 201 | #endif /* STM32F1xx_LL_CRC_H */ |
|
202 | #endif /* STM32F1xx_LL_CRC_H */ |
- | |
203 | - | ||
204 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
- |