Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 9 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @brief Header file of CRC HAL module. |
5 | * @brief Header file of CRC HAL module. |
| 6 | ****************************************************************************** |
6 | ****************************************************************************** |
| 7 | * @attention |
7 | * @attention |
| 8 | * |
8 | * |
| 9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
| - | 10 | * All rights reserved.</center></h2> |
|
| 10 | * |
11 | * |
| 11 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
| 12 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
| 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. |
14 | * License. You may obtain a copy of the License at: |
| 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 |
15 | * opensource.org/licenses/BSD-3-Clause |
| 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 | * |
16 | * |
| 33 | ****************************************************************************** |
17 | ****************************************************************************** |
| 34 | */ |
18 | */ |
| 35 | 19 | ||
| 36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| 37 | #ifndef __STM32F1xx_HAL_CRC_H |
21 | #ifndef STM32F1xx_HAL_CRC_H |
| 38 | #define __STM32F1xx_HAL_CRC_H |
22 | #define STM32F1xx_HAL_CRC_H |
| 39 | 23 | ||
| 40 | #ifdef __cplusplus |
24 | #ifdef __cplusplus |
| 41 | extern "C" { |
25 | extern "C" { |
| 42 | #endif |
26 | #endif |
| 43 | 27 | ||
| 44 | /* Includes ------------------------------------------------------------------*/ |
28 | /* Includes ------------------------------------------------------------------*/ |
| 45 | #include "stm32f1xx_hal_def.h" |
29 | #include "stm32f1xx_hal_def.h" |
| 46 | 30 | ||
| Line 48... | Line 32... | ||
| 48 | * @{ |
32 | * @{ |
| 49 | */ |
33 | */ |
| 50 | 34 | ||
| 51 | /** @addtogroup CRC |
35 | /** @addtogroup CRC |
| 52 | * @{ |
36 | * @{ |
| 53 | */ |
37 | */ |
| 54 | 38 | ||
| 55 | /* Exported types ------------------------------------------------------------*/ |
39 | /* Exported types ------------------------------------------------------------*/ |
| 56 | - | ||
| 57 | /** @defgroup CRC_Exported_Types CRC Exported Types |
40 | /** @defgroup CRC_Exported_Types CRC Exported Types |
| 58 | * @{ |
41 | * @{ |
| 59 | */ |
42 | */ |
| 60 | 43 | ||
| 61 | /** |
44 | /** |
| 62 | * @brief CRC HAL State Structure definition |
45 | * @brief CRC HAL State Structure definition |
| 63 | */ |
46 | */ |
| 64 | typedef enum |
47 | typedef enum |
| 65 | { |
48 | { |
| 66 | HAL_CRC_STATE_RESET = 0x00U, /*!< CRC not yet initialized or disabled */ |
49 | HAL_CRC_STATE_RESET = 0x00U, /*!< CRC not yet initialized or disabled */ |
| 67 | HAL_CRC_STATE_READY = 0x01U, /*!< CRC initialized and ready for use */ |
50 | HAL_CRC_STATE_READY = 0x01U, /*!< CRC initialized and ready for use */ |
| 68 | HAL_CRC_STATE_BUSY = 0x02U, /*!< CRC internal process is ongoing */ |
51 | HAL_CRC_STATE_BUSY = 0x02U, /*!< CRC internal process is ongoing */ |
| 69 | HAL_CRC_STATE_TIMEOUT = 0x03U, /*!< CRC timeout state */ |
52 | HAL_CRC_STATE_TIMEOUT = 0x03U, /*!< CRC timeout state */ |
| 70 | HAL_CRC_STATE_ERROR = 0x04U /*!< CRC error state */ |
53 | HAL_CRC_STATE_ERROR = 0x04U /*!< CRC error state */ |
| - | 54 | } HAL_CRC_StateTypeDef; |
|
| 71 | 55 | ||
| 72 | }HAL_CRC_StateTypeDef; |
- | |
| 73 | 56 | ||
| 74 | /** |
57 | /** |
| 75 | * @brief CRC handle Structure definition |
58 | * @brief CRC Handle Structure definition |
| 76 | */ |
59 | */ |
| 77 | typedef struct |
60 | typedef struct |
| 78 | { |
61 | { |
| 79 | CRC_TypeDef *Instance; /*!< Register base address */ |
62 | CRC_TypeDef *Instance; /*!< Register base address */ |
| 80 | - | ||
| 81 | HAL_LockTypeDef Lock; /*!< CRC locking object */ |
- | |
| 82 | 63 | ||
| 83 | __IO HAL_CRC_StateTypeDef State; /*!< CRC communication state */ |
64 | HAL_LockTypeDef Lock; /*!< CRC Locking object */ |
| 84 | 65 | ||
| 85 | }CRC_HandleTypeDef; |
66 | __IO HAL_CRC_StateTypeDef State; /*!< CRC communication state */ |
| 86 | 67 | ||
| - | 68 | } CRC_HandleTypeDef; |
|
| 87 | /** |
69 | /** |
| 88 | * @} |
70 | * @} |
| 89 | */ |
71 | */ |
| 90 | 72 | ||
| 91 | /* Exported constants --------------------------------------------------------*/ |
73 | /* Exported constants --------------------------------------------------------*/ |
| 92 | /* Exported macro ------------------------------------------------------------*/ |
74 | /** @defgroup CRC_Exported_Constants CRC Exported Constants |
| - | 75 | * @{ |
|
| - | 76 | */ |
|
| - | 77 | ||
| - | 78 | /** |
|
| - | 79 | * @} |
|
| - | 80 | */ |
|
| 93 | 81 | ||
| - | 82 | /* Exported macros -----------------------------------------------------------*/ |
|
| 94 | /** @defgroup CRC_Exported_Macros CRC Exported Macros |
83 | /** @defgroup CRC_Exported_Macros CRC Exported Macros |
| 95 | * @{ |
84 | * @{ |
| 96 | */ |
85 | */ |
| 97 | 86 | ||
| 98 | /** @brief Reset CRC handle state |
87 | /** @brief Reset CRC handle state. |
| 99 | * @param __HANDLE__: CRC handle |
88 | * @param __HANDLE__ CRC handle. |
| 100 | * @retval None |
89 | * @retval None |
| 101 | */ |
90 | */ |
| 102 | #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET) |
91 | #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET) |
| 103 | 92 | ||
| 104 | /** |
93 | /** |
| 105 | * @brief Resets CRC Data Register. |
94 | * @brief Reset CRC Data Register. |
| 106 | * @param __HANDLE__: CRC handle |
95 | * @param __HANDLE__ CRC handle |
| 107 | * @retval None |
96 | * @retval None |
| 108 | */ |
97 | */ |
| 109 | #define __HAL_CRC_DR_RESET(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR,CRC_CR_RESET)) |
98 | #define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET) |
| 110 | 99 | ||
| 111 | /** |
100 | /** |
| 112 | * @brief Stores a 8-bit data in the Independent Data(ID) register. |
101 | * @brief Store data in the Independent Data (ID) register. |
| 113 | * @param __HANDLE__: CRC handle |
102 | * @param __HANDLE__ CRC handle |
| 114 | * @param __VALUE__: 8-bit value to be stored in the ID register |
103 | * @param __VALUE__ Value to be stored in the ID register |
| - | 104 | * @note Refer to the Reference Manual to get the authorized __VALUE__ length in bits |
|
| 115 | * @retval None |
105 | * @retval None |
| 116 | */ |
106 | */ |
| 117 | #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__))) |
107 | #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__))) |
| 118 | 108 | ||
| 119 | /** |
109 | /** |
| 120 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register. |
110 | * @brief Return the data stored in the Independent Data (ID) register. |
| 121 | * @param __HANDLE__: CRC handle |
111 | * @param __HANDLE__ CRC handle |
| - | 112 | * @note Refer to the Reference Manual to get the authorized __VALUE__ length in bits |
|
| 122 | * @retval 8-bit value of the ID register |
113 | * @retval Value of the ID register |
| 123 | */ |
114 | */ |
| 124 | #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR) |
115 | #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR) |
| 125 | - | ||
| 126 | /** |
116 | /** |
| 127 | * @} |
117 | * @} |
| 128 | */ |
118 | */ |
| 129 | 119 | ||
| 130 | /* Exported functions --------------------------------------------------------*/ |
- | |
| 131 | 120 | ||
| - | 121 | /* Private macros --------------------------------------------------------*/ |
|
| 132 | /** @addtogroup CRC_Exported_Functions |
122 | /** @defgroup CRC_Private_Macros CRC Private Macros |
| 133 | * @{ |
123 | * @{ |
| 134 | */ |
124 | */ |
| 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 | 125 | ||
| 146 | /** |
126 | /** |
| 147 | * @} |
127 | * @} |
| 148 | */ |
128 | */ |
| 149 | 129 | ||
| - | 130 | /* Exported functions --------------------------------------------------------*/ |
|
| 150 | /** @addtogroup CRC_Exported_Functions_Group2 |
131 | /** @defgroup CRC_Exported_Functions CRC Exported Functions |
| 151 | * @{ |
132 | * @{ |
| 152 | */ |
133 | */ |
| 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 | 134 | ||
| - | 135 | /* Initialization and de-initialization functions ****************************/ |
|
| - | 136 | /** @defgroup CRC_Exported_Functions_Group1 Initialization and de-initialization functions |
|
| - | 137 | * @{ |
|
| 158 | 138 | */ |
|
| - | 139 | HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc); |
|
| - | 140 | HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc); |
|
| - | 141 | void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc); |
|
| - | 142 | void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc); |
|
| 159 | /** |
143 | /** |
| 160 | * @} |
144 | * @} |
| 161 | */ |
145 | */ |
| 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 | 146 | ||
| - | 147 | /* Peripheral Control functions ***********************************************/ |
|
| - | 148 | /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions |
|
| - | 149 | * @{ |
|
| - | 150 | */ |
|
| - | 151 | uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); |
|
| - | 152 | uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); |
|
| 170 | /** |
153 | /** |
| 171 | * @} |
154 | * @} |
| 172 | */ |
155 | */ |
| 173 | 156 | ||
| - | 157 | /* Peripheral State and Error functions ***************************************/ |
|
| - | 158 | /** @defgroup CRC_Exported_Functions_Group3 Peripheral State functions |
|
| - | 159 | * @{ |
|
| - | 160 | */ |
|
| - | 161 | HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc); |
|
| - | 162 | /** |
|
| - | 163 | * @} |
|
| - | 164 | */ |
|
| 174 | 165 | ||
| 175 | /** |
166 | /** |
| 176 | * @} |
167 | * @} |
| 177 | */ |
168 | */ |
| 178 | 169 | ||
| 179 | /** |
170 | /** |
| 180 | * @} |
171 | * @} |
| 181 | */ |
172 | */ |
| 182 | 173 | ||
| 183 | /** |
174 | /** |
| 184 | * @} |
175 | * @} |
| 185 | */ |
176 | */ |
| 186 | 177 | ||
| 187 | #ifdef __cplusplus |
178 | #ifdef __cplusplus |
| 188 | } |
179 | } |
| 189 | #endif |
180 | #endif |
| 190 | 181 | ||
| 191 | #endif /* __STM32F1xx_HAL_CRC_H */ |
182 | #endif /* STM32F1xx_HAL_CRC_H */ |
| 192 | 183 | ||
| 193 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
184 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |