Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /** |
2 | ****************************************************************************** |
||
3 | * @file stm32f1xx_hal_crc.h |
||
4 | * @author MCD Application Team |
||
5 | * @brief Header file of CRC HAL 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 __STM32F1xx_HAL_CRC_H |
||
38 | #define __STM32F1xx_HAL_CRC_H |
||
39 | |||
40 | #ifdef __cplusplus |
||
41 | extern "C" { |
||
42 | #endif |
||
43 | |||
44 | /* Includes ------------------------------------------------------------------*/ |
||
45 | #include "stm32f1xx_hal_def.h" |
||
46 | |||
47 | /** @addtogroup STM32F1xx_HAL_Driver |
||
48 | * @{ |
||
49 | */ |
||
50 | |||
51 | /** @addtogroup CRC |
||
52 | * @{ |
||
53 | */ |
||
54 | |||
55 | /* Exported types ------------------------------------------------------------*/ |
||
56 | |||
57 | /** @defgroup CRC_Exported_Types CRC Exported Types |
||
58 | * @{ |
||
59 | */ |
||
60 | |||
61 | /** |
||
62 | * @brief CRC HAL State Structure definition |
||
63 | */ |
||
64 | typedef enum |
||
65 | { |
||
66 | HAL_CRC_STATE_RESET = 0x00U, /*!< CRC not yet initialized or disabled */ |
||
67 | HAL_CRC_STATE_READY = 0x01U, /*!< CRC initialized and ready for use */ |
||
68 | HAL_CRC_STATE_BUSY = 0x02U, /*!< CRC internal process is ongoing */ |
||
69 | HAL_CRC_STATE_TIMEOUT = 0x03U, /*!< CRC timeout state */ |
||
70 | HAL_CRC_STATE_ERROR = 0x04U /*!< CRC error state */ |
||
71 | |||
72 | }HAL_CRC_StateTypeDef; |
||
73 | |||
74 | /** |
||
75 | * @brief CRC handle Structure definition |
||
76 | */ |
||
77 | typedef struct |
||
78 | { |
||
79 | CRC_TypeDef *Instance; /*!< Register base address */ |
||
80 | |||
81 | HAL_LockTypeDef Lock; /*!< CRC locking object */ |
||
82 | |||
83 | __IO HAL_CRC_StateTypeDef State; /*!< CRC communication state */ |
||
84 | |||
85 | }CRC_HandleTypeDef; |
||
86 | |||
87 | /** |
||
88 | * @} |
||
89 | */ |
||
90 | |||
91 | /* Exported constants --------------------------------------------------------*/ |
||
92 | /* Exported macro ------------------------------------------------------------*/ |
||
93 | |||
94 | /** @defgroup CRC_Exported_Macros CRC Exported Macros |
||
95 | * @{ |
||
96 | */ |
||
97 | |||
98 | /** @brief Reset CRC handle state |
||
99 | * @param __HANDLE__: CRC handle |
||
100 | * @retval None |
||
101 | */ |
||
102 | #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET) |
||
103 | |||
104 | /** |
||
105 | * @brief Resets CRC Data Register. |
||
106 | * @param __HANDLE__: CRC handle |
||
107 | * @retval None |
||
108 | */ |
||
109 | #define __HAL_CRC_DR_RESET(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR,CRC_CR_RESET)) |
||
110 | |||
111 | /** |
||
112 | * @brief Stores a 8-bit data in the Independent Data(ID) register. |
||
113 | * @param __HANDLE__: CRC handle |
||
114 | * @param __VALUE__: 8-bit value to be stored in the ID register |
||
115 | * @retval None |
||
116 | */ |
||
117 | #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__))) |
||
118 | |||
119 | /** |
||
120 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register. |
||
121 | * @param __HANDLE__: CRC handle |
||
122 | * @retval 8-bit value of the ID register |
||
123 | */ |
||
124 | #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR) |
||
125 | |||
126 | /** |
||
127 | * @} |
||
128 | */ |
||
129 | |||
130 | /* Exported functions --------------------------------------------------------*/ |
||
131 | |||
132 | /** @addtogroup CRC_Exported_Functions |
||
133 | * @{ |
||
134 | */ |
||
135 | |||
136 | /** @addtogroup CRC_Exported_Functions_Group1 |
||
137 | * @{ |
||
138 | */ |
||
139 | |||
140 | /* Initialization/de-initialization functions **********************************/ |
||
141 | HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc); |
||
142 | HAL_StatusTypeDef HAL_CRC_DeInit (CRC_HandleTypeDef *hcrc); |
||
143 | void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc); |
||
144 | void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc); |
||
145 | |||
146 | /** |
||
147 | * @} |
||
148 | */ |
||
149 | |||
150 | /** @addtogroup CRC_Exported_Functions_Group2 |
||
151 | * @{ |
||
152 | */ |
||
153 | |||
154 | /* Peripheral Control functions ************************************************/ |
||
155 | uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); |
||
156 | uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); |
||
157 | |||
158 | |||
159 | /** |
||
160 | * @} |
||
161 | */ |
||
162 | |||
163 | /** @addtogroup CRC_Exported_Functions_Group3 |
||
164 | ** @{ |
||
165 | */ |
||
166 | |||
167 | /* Peripheral State functions **************************************************/ |
||
168 | HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc); |
||
169 | |||
170 | /** |
||
171 | * @} |
||
172 | */ |
||
173 | |||
174 | |||
175 | /** |
||
176 | * @} |
||
177 | */ |
||
178 | |||
179 | /** |
||
180 | * @} |
||
181 | */ |
||
182 | |||
183 | /** |
||
184 | * @} |
||
185 | */ |
||
186 | |||
187 | #ifdef __cplusplus |
||
188 | } |
||
189 | #endif |
||
190 | |||
191 | #endif /* __STM32F1xx_HAL_CRC_H */ |
||
192 | |||
193 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |