Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
cubexHal.pdf
Скачиваний:
111
Добавлен:
10.02.2016
Размер:
16.16 Mб
Скачать

HAL CRC Generic Driver

UM1725

9 HAL CRC Generic Driver

9.1CRC Firmware driver registers structures

9.1.1CRC_HandleTypeDef

Data Fields

CRC_TypeDef * Instance

HAL_LockTypeDef Lock

__IO HAL_CRC_StateTypeDef State

Field Documentation

CRC_TypeDef* CRC_HandleTypeDef::Instance

Register base address

HAL_LockTypeDef CRC_HandleTypeDef::Lock

CRC locking object

__IO HAL_CRC_StateTypeDef CRC_HandleTypeDef::State

CRC communication state

9.2CRC Firmware driver API description

9.2.1How to use this driver

The CRC HAL driver can be used as follows:

1.Enable CRC AHB clock using __HAL_RCC_CRC_CLK_ENABLE();

2.Use HAL_CRC_Accumulate() function to compute the CRC value of a 32-bit data buffer using combination of the previous CRC value and the new one.

3.Use HAL_CRC_Calculate() function to compute the CRC Value of a new 32-bit data buffer. This function resets the CRC computation unit before starting the computation to avoid getting wrong CRC values.

9.2.2Initialization and de-initialization functions

This section provides functions allowing to:

Initialize the CRC according to the specified parameters in the CRC_InitTypeDef and create the associated handle

DeInitialize the CRC peripheral

Initialize the CRC MSP

DeInitialize CRC MSP

This section contains the following APIs:

HAL_CRC_Init()

HAL_CRC_DeInit()

HAL_CRC_MspInit()

HAL_CRC_MspDeInit()

168/900

DOCID025834 Rev 2

UM1725

HAL CRC Generic Driver

9.2.3Peripheral Control functions

This section provides functions allowing to:

Compute the 32-bit CRC value of 32-bit data buffer, using combination of the previous CRC value and the new one.

Compute the 32-bit CRC value of 32-bit data buffer, independently of the previous CRC value.

This section contains the following APIs:

HAL_CRC_Accumulate()

HAL_CRC_Calculate()

9.2.4Peripheral State functions

This subsection permits to get in run-time the status of the peripheral and the data flow. This section contains the following APIs:

HAL_CRC_GetState()

9.2.5HAL_CRC_Init

Function Name

HAL_StatusTypeDef HAL_CRC_Init (CRC_HandleTypeDef *

 

hcrc)

Function Description

Initializes the CRC according to the specified parameters in the

 

CRC_InitTypeDef and creates the associated handle.

Parameters

 

hcrc: pointer to a CRC_HandleTypeDef structure that

 

 

contains the configuration information for CRC

Return values

 

HAL status

9.2.6HAL_CRC_DeInit

Function Name

HAL_StatusTypeDef HAL_CRC_DeInit (CRC_HandleTypeDef *

 

hcrc)

Function Description

DeInitializes the CRC peripheral.

Parameters

 

hcrc: pointer to a CRC_HandleTypeDef structure that

 

 

contains the configuration information for CRC

Return values

 

HAL status

9.2.7HAL_CRC_MspInit

Function Name

void HAL_CRC_MspInit (CRC_HandleTypeDef * hcrc)

Function Description

Initializes the CRC MSP.

Parameters

 

hcrc: pointer to a CRC_HandleTypeDef structure that

 

 

contains the configuration information for CRC

Return values

 

None

9.2.8HAL_CRC_MspDeInit

Function Name

void HAL_CRC_MspDeInit (CRC_HandleTypeDef * hcrc)

 

DOCID025834 Rev 2

169/900

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]