GD32W51x User Manual
959
28.5.
HAU suspended mode
It is possible to suspend HASH or HMAC operation to perform a high-prior task first, then after
the high-prior task is finished, resume the suspended operation.
When suspending the current task, it is necessary to save the context of the current task from
registers to memory, and then the task can be resumed by restoring the context from memory
to the HAU registers.
The following steps can be performed to complete the HAU process of the suspended data
blocks.
28.5.1.
Transfer data by CPU
1. Stop the current data transmission and calculation. Wait for BUSY = 0, and wait for DIF =
1 when NWIF[3:0] is larger than 0 (do not wait for DIF = 1 when NWIF[3:0] is 0).Only when
no data block is processing, users can save context.
2. Save the configuration. Save the content of HAU_INTEN, HAU_CFG, HAU_CTL,
HAU_CTXS0 to HAU_CTXS37 (HAU_CTXS0 to HAU_CTXS53 when HMAC operation is
processing) registers to memory.
3. Configure and process the new message.
4. Restore the process before. Restore the content from memory to HAU_INTEN, HAU_CFG
and HAU_CTL registers.
5. Resume the message calculation. Set START bit of HAU_CTL register to 1, to restart a
new message digest calculation.
6. Resume the previous core state. Restore the content from memory to HAU_CTXS0 ~
HAU_CTXS37 (HAU_CTXS0 ~ HAU_CTXS53 when HMAC operation is to be resumed)
registers.
7. Continue the operation from where it suspended before.
28.5.2.
Transfer data by DMA
1. Wait for BUSY = 0, then if the CCF bit of HAU_STAT register is set, the proceeding context
switch is no longer need, otherwise wait for BUSY = 1 again.
2. Stop the current data transfer. Disable DMA1 channel 7 data transmission, then clear
DMAE bit of HAU_CTL register to disable DMA request.
3. Save the current configuration. Wait for BUSY = 0, then if the CCF bit of HAU_STAT
register is set, the proceeding context switch is no longer need, otherwise save the content
of HAU_INTEN, HAU_CFG, HAU_CTL, HAU_CTXS0 to HAU_CTXS37 (HAU_CTXS0 to
HAU_CTXS53 when HMAC operation is processing) registers to memory.