79 #ifdef HAL_CRC_MODULE_ENABLED 86 static uint32_t CRC_Handle_8(
CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_t BufferLength);
87 static uint32_t CRC_Handle_16(
CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint32_t BufferLength);
315 for(index = 0; index < BufferLength; index++)
323 temp = CRC_Handle_8(hcrc, (uint8_t*)pBuffer, BufferLength);
327 temp = CRC_Handle_16(hcrc, (uint16_t*)pBuffer, BufferLength);
377 for(index = 0; index < BufferLength; index++)
386 temp = CRC_Handle_8(hcrc, (uint8_t*)pBuffer, BufferLength);
391 temp = CRC_Handle_16(hcrc, (uint16_t*)pBuffer, BufferLength);
415 static uint32_t CRC_Handle_8(
CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_t BufferLength)
422 for(i = 0; i < (BufferLength/4); i++)
424 hcrc->
Instance->
DR = (uint32_t)(((uint32_t)(pBuffer[4*i])<<24) | ((uint32_t)(pBuffer[4*i+1])<<16) | ((uint32_t)(pBuffer[4*i+2])<<8) | (uint32_t)(pBuffer[4*i+3]));
427 if((BufferLength%4) != 0)
429 if(BufferLength%4 == 1)
433 if(BufferLength%4 == 2)
435 *(
__IO uint16_t*)(&hcrc->
Instance->
DR) = (uint16_t)((uint16_t)((uint16_t)(pBuffer[4*i])<<8) | (uint16_t)(pBuffer[4*i+1]));
437 if(BufferLength%4 == 3)
439 *(
__IO uint16_t*)(&hcrc->
Instance->
DR) = (uint16_t)((uint16_t)((uint16_t)(pBuffer[4*i])<<8) | (uint16_t)(pBuffer[4*i+1]));
456 static uint32_t CRC_Handle_16(
CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint32_t BufferLength)
463 for(i = 0; i < (BufferLength/2); i++)
465 hcrc->
Instance->
DR = (((uint32_t)(pBuffer[2*i])<<16) | (uint32_t)(pBuffer[2*i+1]));
467 if((BufferLength%2) != 0)
#define MODIFY_REG(REG, CLEARMASK, SETMASK)
#define assert_param(expr)
Include module's header file.
#define DEFAULT_CRC32_POLY
#define __HAL_UNLOCK(__HANDLE__)
#define IS_CRC_INPUTDATA_FORMAT(__FORMAT__)
void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc)
#define IS_DEFAULT_INIT_VALUE(__VALUE__)
#define WRITE_REG(REG, VAL)
#define DEFAULT_INIT_VALUE_ENABLE
#define IS_DEFAULT_POLYNOMIAL(__DEFAULT__)
#define DEFAULT_CRC_INITVALUE
#define __HAL_LOCK(__HANDLE__)
#define IS_CRC_OUTPUTDATA_INVERSION_MODE(__MODE__)
void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc)
This file contains all the functions prototypes for the HAL module driver.
uint32_t OutputDataInversionMode
__IO HAL_CRC_StateTypeDef State
uint32_t InputDataInversionMode
uint8_t DefaultPolynomialUse
uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)
#define IS_CRC_ALL_INSTANCE(__INSTANCE__)
#define __HAL_CRC_DR_RESET(__HANDLE__)
Reset CRC Data Register.
#define CRC_POLYLENGTH_32B
HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc)
#define DEFAULT_POLYNOMIAL_ENABLE
uint32_t GeneratingPolynomial
uint8_t DefaultInitValueUse
HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength)
HAL_StatusTypeDef
HAL Status structures definition.
HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc)
uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)
HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc)