Initialization, configuration and call-back functions.
More...
Initialization, configuration and call-back functions.
===============================================================================
##### Initialization and de-initialization functions #####
===============================================================================
[..] This section provides functions allowing to:
(+) Initialize the HASH according to the specified parameters
in the HASH_InitTypeDef and create the associated handle
(+) DeInitialize the HASH peripheral
(+) Initialize the HASH MCU Specific Package (MSP)
(+) DeInitialize the HASH MSP
[..] This section provides as well call back functions definitions for user
code to manage:
(+) Input data transfer to Peripheral completion
(+) Calculated digest retrieval completion
(+) Error management
◆ HAL_HASH_DeInit()
DeInitialize the HASH peripheral.
- Parameters
-
- Return values
-
Definition at line 399 of file stm32l4xx_hal_hash.c.
414 hhash->HashInCount = 0;
415 hhash->HashBuffSize = 0;
416 hhash->HashITCounter = 0;
418 hhash->DigestCalculationDisable = RESET;
420 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1) 421 if(hhash->MspDeInitCallback == NULL)
427 hhash->MspDeInitCallback(hhash);
441 hhash->ErrorCode = HAL_HASH_ERROR_NONE;
444 hhash->Accumulation = 0U;
void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash)
DeInitialize the HASH MSP.
◆ HAL_HASH_DgstCpltCallback()
◆ HAL_HASH_ErrorCallback()
Error callback.
- Note
- Code user can resort to hhash->Status (HAL_ERROR, HAL_TIMEOUT,...) to retrieve the error type.
- Parameters
-
- Return values
-
Definition at line 525 of file stm32l4xx_hal_hash.c.
◆ HAL_HASH_InCpltCallback()
Input data transfer complete call back.
- Note
- HAL_HASH_InCpltCallback() is called when the complete input message has been fed to the Peripheral. This API is invoked only when input data are entered under interruption or thru DMA.
-
In case of HASH or HMAC multi-buffer DMA feeding case (MDMAT bit set), HAL_HASH_InCpltCallback() is called at the end of each buffer feeding to the Peripheral.
- Parameters
-
- Return values
-
Definition at line 491 of file stm32l4xx_hal_hash.c.
◆ HAL_HASH_Init()
Initialize the HASH according to the specified parameters in the HASH_HandleTypeDef and create the associated handle.
- Note
- Only MDMAT and DATATYPE bits of HASH Peripheral are set by HAL_HASH_Init(), other configuration bits are set by HASH or HMAC processing APIs.
-
MDMAT bit is systematically reset by HAL_HASH_Init(). To set it for multi-buffer HASH processing, user needs to resort to __HAL_HASH_SET_MDMAT() macro. For HMAC multi-buffer processing, the relevant APIs manage themselves the MDMAT bit.
- Parameters
-
- Return values
-
Definition at line 324 of file stm32l4xx_hal_hash.c.
335 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1) 345 if(hhash->MspInitCallback == NULL)
351 hhash->MspInitCallback(hhash);
368 hhash->HashInCount = 0;
369 hhash->HashBuffSize = 0;
370 hhash->HashITCounter = 0;
371 hhash->NbWordsAlreadyPushed = 0;
373 hhash->DigestCalculationDisable = RESET;
378 MODIFY_REG(HASH->CR, HASH_CR_DATATYPE, hhash->Init.DataType);
380 __HAL_HASH_RESET_MDMAT();
388 hhash->ErrorCode = HAL_HASH_ERROR_NONE;
void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash)
Initialize the HASH MSP.
void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash)
Input data transfer complete call back.
void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash)
Digest computation complete call back.
void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash)
Error callback.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_HASH_MspDeInit()
◆ HAL_HASH_MspInit()
◆ HAL_HASH_RegisterCallback()
Register a User HASH Callback To be used instead of the weak (surcharged) predefined callback.
- Parameters
-
| hhash | HASH handle |
| CallbackID | ID of the callback to be registered This parameter can be one of the following values:
|
| pCallback | pointer to the Callback function |
- Return values
-
Definition at line 550 of file stm32l4xx_hal_hash.c.
552 HAL_StatusTypeDef status =
HAL_OK;
554 if(pCallback == NULL)
557 hhash->ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
568 hhash->InCpltCallback = pCallback;
572 hhash->DgstCpltCallback = pCallback;
576 hhash->ErrorCallback = pCallback;
580 hhash->MspInitCallback = pCallback;
584 hhash->MspDeInitCallback = pCallback;
589 hhash->ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
600 hhash->MspInitCallback = pCallback;
604 hhash->MspDeInitCallback = pCallback;
609 hhash->ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
618 hhash->ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
◆ HAL_HASH_UnRegisterCallback()
Unregister a HASH Callback HASH Callback is redirected to the weak (surcharged) predefined callback.
- Parameters
-
| hhash | HASH handle |
| CallbackID | ID of the callback to be unregistered This parameter can be one of the following values:
|
- Return values
-
Definition at line 641 of file stm32l4xx_hal_hash.c.
643 HAL_StatusTypeDef status =
HAL_OK;
674 hhash->ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
694 hhash->ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
703 hhash->ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash)
Initialize the HASH MSP.
void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash)
DeInitialize the HASH MSP.
void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash)
Input data transfer complete call back.
void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash)
Digest computation complete call back.
void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash)
Error callback.