RTEMS 6.1-rc5
Loading...
Searching...
No Matches
stm32h7xx_hal_crc.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_CRC_H
21#define STM32H7xx_HAL_CRC_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
38/* Exported types ------------------------------------------------------------*/
47typedef enum
48{
53 HAL_CRC_STATE_ERROR = 0x04U
55
59typedef struct
60{
80 uint32_t CRCLength;
87 uint32_t InitValue;
106
110typedef struct
111{
137/* Exported constants --------------------------------------------------------*/
147#define DEFAULT_CRC32_POLY 0x04C11DB7U
156#define DEFAULT_CRC_INITVALUE 0xFFFFFFFFU
165#define DEFAULT_POLYNOMIAL_ENABLE ((uint8_t)0x00U)
166#define DEFAULT_POLYNOMIAL_DISABLE ((uint8_t)0x01U)
175#define DEFAULT_INIT_VALUE_ENABLE ((uint8_t)0x00U)
176#define DEFAULT_INIT_VALUE_DISABLE ((uint8_t)0x01U)
185#define CRC_POLYLENGTH_32B 0x00000000U
186#define CRC_POLYLENGTH_16B CRC_CR_POLYSIZE_0
187#define CRC_POLYLENGTH_8B CRC_CR_POLYSIZE_1
188#define CRC_POLYLENGTH_7B CRC_CR_POLYSIZE
197#define HAL_CRC_LENGTH_32B 32U
198#define HAL_CRC_LENGTH_16B 16U
199#define HAL_CRC_LENGTH_8B 8U
200#define HAL_CRC_LENGTH_7B 7U
209/* WARNING: CRC_INPUT_FORMAT_UNDEFINED is created for reference purposes but
210 * an error is triggered in HAL_CRC_Init() if InputDataFormat field is set
211 * to CRC_INPUT_FORMAT_UNDEFINED: the format MUST be defined by the user for
212 * the CRC APIs to provide a correct result */
213#define CRC_INPUTDATA_FORMAT_UNDEFINED 0x00000000U
214#define CRC_INPUTDATA_FORMAT_BYTES 0x00000001U
215#define CRC_INPUTDATA_FORMAT_HALFWORDS 0x00000002U
216#define CRC_INPUTDATA_FORMAT_WORDS 0x00000003U
225/* Exported macros -----------------------------------------------------------*/
235#define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET)
236
242#define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET)
243
250#define __HAL_CRC_INITIALCRCVALUE_CONFIG(__HANDLE__, __INIT__) ((__HANDLE__)->Instance->INIT = (__INIT__))
251
259#define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__)))
260
267#define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR)
273/* Private macros --------------------------------------------------------*/
279#define IS_DEFAULT_POLYNOMIAL(DEFAULT) (((DEFAULT) == DEFAULT_POLYNOMIAL_ENABLE) || \
280 ((DEFAULT) == DEFAULT_POLYNOMIAL_DISABLE))
281
282#define IS_DEFAULT_INIT_VALUE(VALUE) (((VALUE) == DEFAULT_INIT_VALUE_ENABLE) || \
283 ((VALUE) == DEFAULT_INIT_VALUE_DISABLE))
284
285#define IS_CRC_POL_LENGTH(LENGTH) (((LENGTH) == CRC_POLYLENGTH_32B) || \
286 ((LENGTH) == CRC_POLYLENGTH_16B) || \
287 ((LENGTH) == CRC_POLYLENGTH_8B) || \
288 ((LENGTH) == CRC_POLYLENGTH_7B))
289
290#define IS_CRC_INPUTDATA_FORMAT(FORMAT) (((FORMAT) == CRC_INPUTDATA_FORMAT_BYTES) || \
291 ((FORMAT) == CRC_INPUTDATA_FORMAT_HALFWORDS) || \
292 ((FORMAT) == CRC_INPUTDATA_FORMAT_WORDS))
293
298/* Include CRC HAL Extended module */
299#include "stm32h7xx_hal_crc_ex.h"
300
301/* Exported functions --------------------------------------------------------*/
307/* Initialization and de-initialization functions ****************************/
312HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc);
313HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc);
314void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc);
315void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc);
320/* Peripheral Control functions ***********************************************/
325uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength);
326uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength);
331/* Peripheral State and Error functions ***************************************/
336HAL_CRC_StateTypeDef HAL_CRC_GetState(const CRC_HandleTypeDef *hcrc);
353#ifdef __cplusplus
354}
355#endif
356
357#endif /* STM32H7xx_HAL_CRC_H */
#define __IO
Definition: core_cm4.h:239
HAL_CRC_StateTypeDef
CRC HAL State Structure definition.
Definition: stm32h7xx_hal_crc.h:48
@ HAL_CRC_STATE_RESET
Definition: stm32h7xx_hal_crc.h:49
@ HAL_CRC_STATE_TIMEOUT
Definition: stm32h7xx_hal_crc.h:52
@ HAL_CRC_STATE_BUSY
Definition: stm32h7xx_hal_crc.h:51
@ HAL_CRC_STATE_READY
Definition: stm32h7xx_hal_crc.h:50
@ HAL_CRC_STATE_ERROR
Definition: stm32h7xx_hal_crc.h:53
Header file of CRC HAL extended module.
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
CRC Handle Structure definition.
Definition: stm32h7xx_hal_crc.h:111
__IO HAL_CRC_StateTypeDef State
Definition: stm32h7xx_hal_crc.h:118
uint32_t InputDataFormat
Definition: stm32h7xx_hal_crc.h:120
CRC_TypeDef * Instance
Definition: stm32h7xx_hal_crc.h:112
HAL_LockTypeDef Lock
Definition: stm32h7xx_hal_crc.h:116
CRC_InitTypeDef Init
Definition: stm32h7xx_hal_crc.h:114
CRC Init Structure definition.
Definition: stm32h7xx_hal_crc.h:60
uint32_t GeneratingPolynomial
Definition: stm32h7xx_hal_crc.h:74
uint32_t OutputDataInversionMode
Definition: stm32h7xx_hal_crc.h:100
uint8_t DefaultPolynomialUse
Definition: stm32h7xx_hal_crc.h:61
uint32_t InputDataInversionMode
Definition: stm32h7xx_hal_crc.h:90
uint32_t InitValue
Definition: stm32h7xx_hal_crc.h:87
uint32_t CRCLength
Definition: stm32h7xx_hal_crc.h:80
uint8_t DefaultInitValueUse
Definition: stm32h7xx_hal_crc.h:69
CRC calculation unit.
Definition: stm32h723xx.h:442