Download HAL Driver User Manual

Transcript
HAL HASH Generic Driver
UM1725
Field Documentation








20.2
__IO uint32_t HASH_TypeDef::CR

HASH control register, Address offset: 0x00
__IO uint32_t HASH_TypeDef::DIN

HASH data input register, Address offset: 0x04
__IO uint32_t HASH_TypeDef::STR

HASH start register, Address offset: 0x08
__IO uint32_t HASH_TypeDef::HR[5]

HASH digest registers, Address offset: 0x0C-0x1C
__IO uint32_t HASH_TypeDef::IMR

HASH interrupt enable register, Address offset: 0x20
__IO uint32_t HASH_TypeDef::SR

HASH status register, Address offset: 0x24
uint32_t HASH_TypeDef::RESERVED[52]

Reserved, 0x28-0xF4
__IO uint32_t HASH_TypeDef::CSR[54]

HASH context swap registers, Address offset: 0x0F8-0x1CC
HASH Firmware driver API description
The following section lists the various functions of the HASH library.
20.2.1
How to use this driver
The HASH HAL driver can be used as follows:
1.
2.
3.
356/865
Initialize the HASH low level resources by implementing the HAL_HASH_MspInit():
a.
Enable the HASH interface clock using __HASH_CLK_ENABLE()
b.
In case of using processing APIs based on interrupts (e.g.
HAL_HMAC_SHA1_Start_IT())

Configure the HASH interrupt priority using HAL_NVIC_SetPriority()

Enable the HASH IRQ handler using HAL_NVIC_EnableIRQ()

In HASH IRQ handler, call HAL_HASH_IRQHandler()
c.
In case of using DMA to control data transfer (e.g.
HAL_HMAC_SHA1_Start_DMA())

Enable the DMAx interface clock using __DMAx_CLK_ENABLE()

Configure and enable one DMA stream one for managing data transfer from
memory to peripheral (input stream). Managing data transfer from peripheral
to memory can be performed only using CPU

Associate the initialized DMA handle to the HASH DMA handle using
__HAL_LINKDMA()

Configure the priority and enable the NVIC for the transfer complete
interrupt on the DMA Stream using HAL_NVIC_SetPriority() and
HAL_NVIC_EnableIRQ()
Initialize the HASH HAL using HAL_HASH_Init(). This function configures mainly:
a.
The data type: 1-bit, 8-bit, 16-bit and 32-bit.
b.
For HMAC, the encryption key.
c.
For HMAC, the key size used for encryption.
Three processing functions are available:
DocID025834 Rev 1