KMU HAL

group nrf_kmu_hal

Hardware access layer for managing the Key Management Unit (KMU) peripheral.

Defines

NRF_KMU_HAS_INTEN

Symbol indicating whether INTEN register is available.

NRF_KMU_HAS_PROVISION

Symbol indicating whether KMU has PROVISION registers.

NRF_KMU_HAS_REVOKE

Symbol indicating whether KMU has REVOKE registers.

NRF_KMU_HAS_READ_METADATA

Symbol indicating whether KMU has READMETADATA registers.

NRF_KMU_HAS_PUSH_BLOCK

Symbol indicating whether KMU has PUSHBLOCK registers.

NRF_KMU_HAS_SRC

Symbol indicating whether KMU has SRC registers.

NRF_KMU_HAS_METADATA

Symbol indicating whether KMU has METADATA registers.

Enums

enum nrf_kmu_task_t

KMU tasks.

Values:

enumerator NRF_KMU_TASK_PROVISION_KEYSLOT

Provision key slot.

enumerator NRF_KMU_TASK_PUSH_KEYSLOT

Push a key slot over secure APB.

enumerator NRF_KMU_TASK_REVOKE_KEYSLOT

Revoke key slot.

enumerator NRF_KMU_TASK_READ_METADATA

Read key slot metedata into METADATA register.

enumerator NRF_KMU_TASK_PUSH_BLOCK

Block the PUSH operation of key slot, preventing the key slot being PUSH until next reset.

enum nrf_kmu_event_t

KMU events.

Values:

enumerator NRF_KMU_EVENT_EVENTS_PROVISIONED

Key slot successfully provisioned.

enumerator NRF_KMU_EVENT_KEYSLOT_PUSHED

Key successfully pushed over secure APB.

enumerator NRF_KMU_EVENT_KEYSLOT_REVOKED

Key has been revoked and cannot be tasked for selection.

enumerator NRF_KMU_EVENT_KEYSLOT_ERROR

No key slot selected or no destination address defined or error during push mechanism.

enumerator NRF_KMU_EVENT_EVENTS_EVENTS_METADATA_READ

Key slot metedata has been read into METADATA register.

enumerator NRF_KMU_EVENT_EVENTS_EVENTS_PUSHBLOCKED

The PUSHBLOCK operation was succesful.

enum nrf_kmu_int_mask_t

KMU interrupts.

Values:

enumerator NRF_KMU_INT_PUSHED_MASK

Interrupt on KEYSLOT_PUSHED event.

enumerator NRF_KMU_INT_REVOKED_MASK

Interrupt on KEYSLOT_REVOKED event.

enumerator NRF_KMU_INT_ERROR_MASK

Interrupt on KEYSLOT_ERROR event.

enum nrf_kmu_status_t

KMU operation status.

Values:

enumerator NRF_KMU_STATUS_BLOCKED_MASK

Access violation detected and blocked.

enumerator NRF_KMU_STATUS_SELECTED_MASK

Key slot ID successfully selected by KMU.

enumerator NRF_KMU_STATUS_READY

KMU is ready for a new operation.

enumerator NRF_KMU_STATUS_BUSY

KMU is busy, an operation is in progress.

Functions

NRF_STATIC_INLINE void nrf_kmu_task_trigger(NRF_KMU_Type *p_reg, nrf_kmu_task_t task)

Function for activating a specific KMU task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task to be activated.

NRF_STATIC_INLINE uint32_t nrf_kmu_task_address_get(NRF_KMU_Type const *p_reg, nrf_kmu_task_t task)

Function for getting the address of a specific KMU task register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Requested task.

Returns:

Address of the specified task register.

NRF_STATIC_INLINE void nrf_kmu_event_clear(NRF_KMU_Type *p_reg, nrf_kmu_event_t event)

Function for clearing a specific KMU event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to clear.

NRF_STATIC_INLINE bool nrf_kmu_event_check(NRF_KMU_Type const *p_reg, nrf_kmu_event_t event)

Function for retrieving the state of the KMU event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to be checked.

Return values:
  • true – The event has been generated.

  • false – The event has not been generated.

NRF_STATIC_INLINE uint32_t nrf_kmu_event_address_get(NRF_KMU_Type const *p_reg, nrf_kmu_event_t event)

Function for getting the address of a specific KMU event register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Requested event.

Returns:

Address of the specified event register.

NRF_STATIC_INLINE void nrf_kmu_int_enable(NRF_KMU_Type *p_reg, uint32_t mask)

Function for enabling specified interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Interrupts to be enabled.

NRF_STATIC_INLINE void nrf_kmu_int_disable(NRF_KMU_Type *p_reg, uint32_t mask)

Function for disabling specified interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Interrupts to be disabled.

NRF_STATIC_INLINE uint32_t nrf_kmu_int_enable_check(NRF_KMU_Type const *p_reg, uint32_t mask)

Function for checking if the specified interrupts are enabled.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be checked.

Returns:

Mask of enabled interrupts.

NRF_STATIC_INLINE uint32_t nrf_kmu_intpend_get(NRF_KMU_Type const *p_reg)

Function for retrieving the state of interrupts.

Function returns bitmask. Please use nrf_kmu_int_mask_t to check interrupts status.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Bitmask with pending interrupts bits.

NRF_STATIC_INLINE uint32_t nrf_kmu_status_get(NRF_KMU_Type const *p_reg)

Function for getting status bits of the KMU operation.

Please use nrf_kmu_status_t to check operations status.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Operation status.

NRF_STATIC_INLINE void nrf_kmu_keyslot_set(NRF_KMU_Type *p_reg, uint8_t keyslot_id)

Function for selecting the key slot ID.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • keyslot_id[in] Key slot ID to be read over AHB or pushed over secure APB when TASKS_PUSH_KEYSLOT is started.

NRF_STATIC_INLINE uint8_t nrf_kmu_keyslot_get(NRF_KMU_Type const *p_reg)

Function for getting the key slot ID.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Key slot ID.

NRF_STATIC_INLINE void nrf_kmu_src_set(NRF_KMU_Type *p_reg, uint32_t src)

Function for setting the source address for provisioning.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • src[in] Source address to be set.

NRF_STATIC_INLINE uint32_t nrf_kmu_src_get(NRF_KMU_Type const *p_reg)

Function for getting the source address for provisioning.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Source address.

NRF_STATIC_INLINE void nrf_kmu_metadata_set(NRF_KMU_Type *p_reg, uint32_t metdata)

Function for setting the key slot metadata.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • metdata[in] Key slot metadata.

NRF_STATIC_INLINE uint32_t nrf_kmu_metadata_get(NRF_KMU_Type const *p_reg)

Function for getting the key slot metadata.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Key slot metadata.