57 #ifdef HAL_CRC_MODULE_ENABLED 130 WRITE_REG(hcrc->
Instance->POL, DEFAULT_CRC32_POLY);
147 WRITE_REG(hcrc->
Instance->INIT, DEFAULT_CRC_INITVALUE);
200 __HAL_CRC_DR_RESET(hcrc);
297 case CRC_INPUTDATA_FORMAT_WORDS:
299 for (index = 0U; index < BufferLength; index++)
301 hcrc->
Instance->DR = pBuffer[index];
306 case CRC_INPUTDATA_FORMAT_BYTES:
307 temp =
CRC_Handle_8(hcrc, (uint8_t *)pBuffer, BufferLength);
310 case CRC_INPUTDATA_FORMAT_HALFWORDS:
311 temp =
CRC_Handle_16(hcrc, (uint16_t *)(
void *)pBuffer, BufferLength);
349 __HAL_CRC_DR_RESET(hcrc);
353 case CRC_INPUTDATA_FORMAT_WORDS:
355 for (index = 0U; index < BufferLength; index++)
357 hcrc->
Instance->DR = pBuffer[index];
362 case CRC_INPUTDATA_FORMAT_BYTES:
364 temp =
CRC_Handle_8(hcrc, (uint8_t *)pBuffer, BufferLength);
367 case CRC_INPUTDATA_FORMAT_HALFWORDS:
369 temp =
CRC_Handle_16(hcrc, (uint16_t *)(
void *)pBuffer, BufferLength);
441 for (i = 0U; i < (BufferLength / 4U); i++)
443 hcrc->
Instance->DR = ((uint32_t)pBuffer[4U * i] << 24U) | \
444 ((uint32_t)pBuffer[(4U * i) + 1U] << 16U) | \
445 ((uint32_t)pBuffer[(4U * i) + 2U] << 8U) | \
446 (uint32_t)pBuffer[(4U * i) + 3U];
449 if ((BufferLength % 4U) != 0U)
451 if ((BufferLength % 4U) == 1U)
453 *(__IO uint8_t *)(__IO
void *)(&hcrc->
Instance->DR) = pBuffer[4U * i];
455 if ((BufferLength % 4U) == 2U)
457 data = ((uint16_t)(pBuffer[4U * i]) << 8U) | (uint16_t)pBuffer[(4U * i) + 1U];
458 pReg = (__IO uint16_t *)(__IO
void *)(&hcrc->
Instance->DR);
461 if ((BufferLength % 4U) == 3U)
463 data = ((uint16_t)(pBuffer[4U * i]) << 8U) | (uint16_t)pBuffer[(4U * i) + 1U];
464 pReg = (__IO uint16_t *)(__IO
void *)(&hcrc->
Instance->DR);
467 *(__IO uint8_t *)(__IO
void *)(&hcrc->
Instance->DR) = pBuffer[(4U * i) + 2U];
491 for (i = 0U; i < (BufferLength / 2U); i++)
493 hcrc->
Instance->DR = ((uint32_t)pBuffer[2U * i] << 16U) | (uint32_t)pBuffer[(2U * i) + 1U];
495 if ((BufferLength % 2U) != 0U)
497 pReg = (__IO uint16_t *)(__IO
void *)(&hcrc->
Instance->DR);
498 *pReg = pBuffer[2U * i];
uint32_t OutputDataInversionMode
uint32_t GeneratingPolynomial
This file contains all the functions prototypes for the HAL module driver.
static uint32_t CRC_Handle_8(CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_t BufferLength)
Enter 8-bit input data to the CRC calculator. Specific data handling to optimize processing time...
__IO HAL_CRC_StateTypeDef State
void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc)
Initializes the CRC MSP.
uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)
Compute the 7, 8, 16 or 32-bit CRC value of an 8, 16 or 32-bit data buffer starting with the previous...
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
static uint32_t CRC_Handle_16(CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint32_t BufferLength)
Enter 16-bit input data to the CRC calculator. Specific data handling to optimize processing time...
uint8_t DefaultPolynomialUse
HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength)
Initialize the CRC polynomial if different from default one.
uint32_t InputDataInversionMode
uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)
Compute the 7, 8, 16 or 32-bit CRC value of an 8, 16 or 32-bit data buffer starting with hcrc->Instan...
CRC Handle Structure definition.
HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc)
DeInitialize the CRC peripheral.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
HAL_CRC_StateTypeDef
CRC HAL State Structure definition.
uint8_t DefaultInitValueUse
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc)
DeInitialize the CRC MSP.
HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc)
Initialize the CRC according to the specified parameters in the CRC_InitTypeDef and create the associ...
HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc)
Return the CRC handle state.