
Hash processor (HASH)
RM0351
862/1830
DocID024597 Rev 5
Data loaded by software
When the DMA is not used to load the message into the hash processor, the context can be
saved only when no block processing is ongoing. This means that the user application must
wait until DINIS = 1 (last block processed and input FIFO empty) or NBW
≠
0 (FIFO not full
and no processing ongoing). The detailed procedure is described below.
•
Current context saving
Before interrupting the current message digest calculation, the application must store
the contents of the following registers into memory:
–
HASH_IMR
–
HASH_STR
–
HASH_CR
–
HASH_CSR0 to HASH_CSR53
•
Current context restoring
To resume processing the interrupted message, the application must respect the
following steps:
a) Write the following registers with the values saved in memory: HASH_IMR,
HASH_STR and HASH_CR.
b) Initialize the hash processor by setting the INIT bit in the HASH_CR register.
c) Write the HASH_CSR0 to HASH_CSR53 registers with the values saved in
memory.
d) Restart the processing from the point where it has been interrupted.
Data loaded by DMA
When the DMA is used to load the message into the hash processor, it is not possible to
predict if a DMA transfer is ongoing. The user application must thus stop DMA transfers,
then wait until the hash processor is ready before interrupting the current message digest
calculation. The detailed procedure is described below.
•
Current context saving
Before interrupting the current message digest calculation using DMA, the application
must respect the following steps:
a) Clear the DMAE bit to disable the DMA interface.
b) Wait until the current DMA transfer is complete (wait for DMAES = 0 in the
HASH_SR register). Note that the block may or may not have been totally
transferred to the HASH.
c) Disable the corresponding channel in the DMA controller.
d) Wait until the hash processor is ready (no block is being processed), that is wait
for DINIS = 1
•
Current context restoring
To resume processing the interrupted message using DMA, the application must
respect the following steps:
a) Reconfigure the DMA controller so that it proceeds with the transfer of the
message up to the end if it is not interrupted again.
b) Restart the processing from the point where it was interrupted by setting the
DMAE bit.