8. Hash_sha1_dma

8.1. Function description:

This demo shows the operation of HASH SHA1, the means about filling data writed to fifo is via DMA.

  • Enable global interrupt & register DMA interrupt.

  • Configure the HASH and enable DMA function.

  • Configure UDMA P2M to transfer filling data.

  • Enable DMA interrupt and HASH to start calculation.

  • Waiting calculation done to compare the result with the golden data to check.

Note

  1. The golden data getted by hash online calculator.

  2. For DMA mode, the input buffer address must be aligned.

8.2. Main configuration:

8.2.1. Hash configure

Algorithm

Mode

DMA

Data Type

sha1

hash

enable

8 bits swap

8.2.2. Udma p2m configure

Mode

Buffer size

Des address mode

Src address mode

Transfer width

normal

mult-4 bytes

fiexd

increasing

32 bits

Note

The buffer size according the length of message to configure, but must be a multiple of 4 bytes; transfer width also must be 32 bits.

8.3. Test result:

If the output result is same as the golden data, then print pass, if not print fail.

8.4. IO connection:

None