ECB HAL

group nrf_ecb_hal

Hardware access layer (HAL) for managing the Advanced Encryption Standard (AES) Electronic Codebook (ECB) peripheral.

Defines

NRF_ECB_HAS_TASK_STARTECB

Presence of the STARTECB task.

NRF_ECB_HAS_TASK_START

Presence of the START task.

NRF_ECB_HAS_TASK_STOPECB

Presence of the STOPECB task.

NRF_ECB_HAS_TASK_STOP

Presence of the STOP task.

NRF_ECB_HAS_EVENT_ENDECB

Presence of the ENDECB event.

NRF_ECB_HAS_EVENT_END

Presence of the END event.

NRF_ECB_HAS_EVENT_ERRORECB

Presence of the ERRORECB event.

NRF_ECB_HAS_EVENT_ERROR

Presence of the ERROR event.

NRF_ECB_HAS_KEY

Presence of the KEY register.

NRF_ECB_HAS_IN_PTR

Presence of the IN.PTR register.

NRF_ECB_HAS_IN_AMOUNT

Presence of the IN.AMOUNT register.

NRF_ECB_HAS_OUT_PTR

Presence of the OUT.PTR register.

NRF_ECB_HAS_OUT_AMOUNT

Presence of the OUT.AMOUNT register.

NRF_ECB_HAS_ECBDATAPTR

Presence of the ECBDATAPTR register.

Enums

enum nrf_ecb_task_t

ECB tasks.

Values:

enumerator NRF_ECB_TASK_STARTECB

Task for starting the ECB block encryption.

enumerator NRF_ECB_TASK_START

Task for starting the ECB block encryption.

enumerator NRF_ECB_TASK_STOPECB

Task for stopping the ECB block encryption.

enumerator NRF_ECB_TASK_STOP

Task for stopping the ECB block encryption.

enum nrf_ecb_event_t

ECB events.

Values:

enumerator NRF_ECB_EVENT_ENDECB

ECB block encrypt complete.

enumerator NRF_ECB_EVENT_ERRORECB

ECB block encrypt aborted because of a STOPECB task or due to an error.

enumerator NRF_ECB_EVENT_END

ECB block encrypt complete.

enumerator NRF_ECB_EVENT_ERROR

ECB block encrypt aborted because of a STOPECB task or due to an error.

enum nrf_ecb_int_mask_t

ECB interrupts.

Values:

enumerator NRF_ECB_INT_ENDECB_MASK

Interrupt on ENDECB event.

enumerator NRF_ECB_INT_ERRORECB_MASK

Interrupt on ERRORECB event.

enumerator NRF_ECB_INT_END_MASK

Interrupt on END event.

enumerator NRF_ECB_INT_ERROR_MASK

Interrupt on ERROR event.

Functions

NRF_STATIC_INLINE void nrf_ecb_task_trigger(NRF_ECB_Type *p_reg, nrf_ecb_task_t task)

Function for activating the specified ECB task.

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

  • task[in] Task to be activated.

NRF_STATIC_INLINE uint32_t nrf_ecb_task_address_get(NRF_ECB_Type const *p_reg, nrf_ecb_task_t task)

Function for getting the address of the specified ECB task register.

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

  • task[in] Requested task.

Returns:

Address of the specified task register.

NRF_STATIC_INLINE void nrf_ecb_event_clear(NRF_ECB_Type *p_reg, nrf_ecb_event_t event)

Function for clearing the specified ECB event.

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

  • event[in] Event to clear.

NRF_STATIC_INLINE bool nrf_ecb_event_check(NRF_ECB_Type const *p_reg, nrf_ecb_event_t event)

Function for retrieving the state of the ECB 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_ecb_event_address_get(NRF_ECB_Type const *p_reg, nrf_ecb_event_t event)

Function for getting the address of the specified ECB event register.

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

  • event[in] Requested event.

Returns:

Address of the specified event register.

NRF_STATIC_INLINE void nrf_ecb_int_enable(NRF_ECB_Type *p_reg, uint32_t mask)

Function for enabling the specified interrupts.

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

  • mask[in] Interrupts to be enabled.

NRF_STATIC_INLINE void nrf_ecb_int_disable(NRF_ECB_Type *p_reg, uint32_t mask)

Function for disabling the specified interrupts.

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

  • mask[in] Interrupts to be disabled.

NRF_STATIC_INLINE uint32_t nrf_ecb_int_enable_check(NRF_ECB_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 void nrf_ecb_data_pointer_set(NRF_ECB_Type *p_reg, void const *p_buffer)

Function for setting the pointer to the ECB data buffer.

Note

The buffer has to be placed in the Data RAM region. For description of the data structure in this buffer, see the Product Specification.

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

  • p_buffer[in] Pointer to the ECB data buffer.

NRF_STATIC_INLINE void *nrf_ecb_data_pointer_get(NRF_ECB_Type const *p_reg)

Function for getting the pointer to the ECB data buffer.

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

Returns:

Pointer to the ECB data buffer.

NRF_STATIC_INLINE void nrf_ecb_key_set(NRF_ECB_Type *p_reg, uint32_t const *p_key)

Function for setting the AES key.

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

  • p_key[in] Pointer to the AES 128-bit key value. The key shall be stored in big endian byte order.

NRF_STATIC_INLINE void nrf_ecb_in_ptr_set(NRF_ECB_Type *p_reg, nrf_vdma_job_t const *p_job)

Function for setting the pointer to a job list containing unencrypted ECB data structure in Encryption mode or encrypted ECB data structure in Decryption mode.

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

  • p_job[in] Pointer to a job list.

NRF_STATIC_INLINE nrf_vdma_job_t *nrf_ecb_in_ptr_get(NRF_ECB_Type const *p_reg)

Function for getting the pointer to job list containing unencrypted ECB data structure in Encryption mode or encrypted ECB data structure in Decryption mode.

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

Returns:

Pointer to a job list.

NRF_STATIC_INLINE uint32_t nrf_ecb_in_amount_get(NRF_ECB_Type const *p_reg)

Function for getting number of bytes read from the input data, not including the job list structure.

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

Returns:

Number of bytes read from the input data.

NRF_STATIC_INLINE void nrf_ecb_out_ptr_set(NRF_ECB_Type *p_reg, nrf_vdma_job_t const *p_job)

Function for setting the pointer to a job list containing encrypted ECB data structure in Encryption mode or decrypted ECB data structure in Decryption mode.

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

  • p_job[in] Pointer to a job list.

NRF_STATIC_INLINE nrf_vdma_job_t *nrf_ecb_out_ptr_get(NRF_ECB_Type const *p_reg)

Function for getting the pointer to a job list containing encrypted ECB data structure in Encryption mode or decrypted ECB data structure in Decryption mode.

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

Returns:

Pointer to the job list.

NRF_STATIC_INLINE uint32_t nrf_ecb_out_amount_get(NRF_ECB_Type const *p_reg)

Function for getting number of bytes available in the output data, not including the job list structure.

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

Returns:

Number of bytes available in the output data.

NRF_STATIC_INLINE void nrf_ecb_subscribe_set(NRF_ECB_Type *p_reg, nrf_ecb_task_t task, uint8_t channel)

Function for setting the subscribe configuration for a given ECB task.

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

  • task[in] Task for which to set the configuration.

  • channel[in] Channel through which to subscribe events.

NRF_STATIC_INLINE void nrf_ecb_subscribe_clear(NRF_ECB_Type *p_reg, nrf_ecb_task_t task)

Function for clearing the subscribe configuration for a given ECB task.

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

  • task[in] Task for which to clear the configuration.

NRF_STATIC_INLINE void nrf_ecb_publish_set(NRF_ECB_Type *p_reg, nrf_ecb_event_t event, uint8_t channel)

Function for setting the publish configuration for a given ECB event.

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

  • event[in] Event for which to set the configuration.

  • channel[in] Channel through which to publish the event.

NRF_STATIC_INLINE void nrf_ecb_publish_clear(NRF_ECB_Type *p_reg, nrf_ecb_event_t event)

Function for clearing the publish configuration for a given ECB event.

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

  • event[in] Event for which to clear the configuration.