Interrupts and flags management functions.
More...
Interrupts and flags management functions.
===============================================================================
Interrupts and flags management functions
===============================================================================
This section provides functions allowing to configure the HASH Interrupts and
to get the status and clear flags and Interrupts pending bits.
The HASH provides 2 Interrupts sources and 5 Flags:
Flags :
----------
1. HASH_FLAG_DINIS : set when 16 locations are free in the Data IN FIFO
which means that a new block (512 bit) can be entered
into the input buffer.
2. HASH_FLAG_DCIS : set when Digest calculation is complete
3. HASH_FLAG_DMAS : set when HASH's DMA interface is enabled (DMAE=1) or
a transfer is ongoing.
This Flag is cleared only by hardware.
4. HASH_FLAG_BUSY : set when The hash core is processing a block of data
This Flag is cleared only by hardware.
5. HASH_FLAG_DINNE : set when Data IN FIFO is not empty which means that
the Data IN FIFO contains at least one word of data.
This Flag is cleared only by hardware.
Interrupts :
------------
1. HASH_IT_DINI : if enabled, this interrupt source is pending when 16
locations are free in the Data IN FIFO which means that
a new block (512 bit) can be entered into the input buffer.
This interrupt source is cleared using
HASH_ClearITPendingBit(HASH_IT_DINI) function.
2. HASH_IT_DCI : if enabled, this interrupt source is pending when Digest
calculation is complete.
This interrupt source is cleared using
HASH_ClearITPendingBit(HASH_IT_DCI) function.
Managing the HASH controller events :
------------------------------------
The user should identify which mode will be used in his application to manage
the HASH controller events: Polling mode or Interrupt mode.
1. In the Polling Mode it is advised to use the following functions:
- HASH_GetFlagStatus() : to check if flags events occur.
- HASH_ClearFlag() : to clear the flags events.
2. In the Interrupt Mode it is advised to use the following functions:
- HASH_ITConfig() : to enable or disable the interrupt source.
- HASH_GetITStatus() : to check if Interrupt occurs.
- HASH_ClearITPendingBit() : to clear the Interrupt pending Bit
(corresponding Flag).
void HASH_ClearFlag |
( |
uint16_t |
HASH_FLAG | ) |
|
Clears the HASH flags.
- Parameters
-
HASH_FLAG,: | specifies the flag to clear. This parameter can be any combination of the following values:
- HASH_FLAG_DINIS: Data Input Flag
- HASH_FLAG_DCIS: Digest Calculation Completion Flag
|
- Return values
-
void HASH_ClearITPendingBit |
( |
uint8_t |
HASH_IT | ) |
|
Clears the HASH interrupt pending bit(s).
- Parameters
-
HASH_IT,: | specifies the HASH interrupt pending bit(s) to clear. This parameter can be any combination of the following values:
- HASH_IT_DINI: Data Input interrupt
- HASH_IT_DCI: Digest Calculation Completion Interrupt
|
- Return values
-
FlagStatus HASH_GetFlagStatus |
( |
uint16_t |
HASH_FLAG | ) |
|
Checks whether the specified HASH flag is set or not.
- Parameters
-
HASH_FLAG,: | specifies the HASH flag to check. This parameter can be one of the following values:
- HASH_FLAG_DINIS: Data input interrupt status flag
- HASH_FLAG_DCIS: Digest calculation completion interrupt status flag
- HASH_FLAG_BUSY: Busy flag
- HASH_FLAG_DMAS: DMAS Status flag
- HASH_FLAG_DINNE: Data Input register (DIN) not empty status flag
|
- Return values
-
The | new state of HASH_FLAG (SET or RESET) |
ITStatus HASH_GetITStatus |
( |
uint8_t |
HASH_IT | ) |
|
Checks whether the specified HASH interrupt has occurred or not.
- Parameters
-
HASH_IT,: | specifies the HASH interrupt source to check. This parameter can be one of the following values:
- HASH_IT_DINI: Data Input interrupt
- HASH_IT_DCI: Digest Calculation Completion Interrupt
|
- Return values
-
The | new state of HASH_IT (SET or RESET). |
void HASH_ITConfig |
( |
uint8_t |
HASH_IT, |
|
|
FunctionalState |
NewState |
|
) |
| |
Enables or disables the specified HASH interrupts.
- Parameters
-
HASH_IT,: | specifies the HASH interrupt source to be enabled or disabled. This parameter can be any combination of the following values:
- HASH_IT_DINI: Data Input interrupt
- HASH_IT_DCI: Digest Calculation Completion Interrupt
|
NewState,: | new state of the specified HASH interrupt. This parameter can be: ENABLE or DISABLE. |
- Return values
-