RRAMC HAL

group nrf_rramc_hal

Hardware access layer for managing the the Resistive Random Access Memory Controller (RRAMC) peripheral.

Defines

NRF_RRAMC_CONFIG_WRITE_BUFF_SIZE_MAX

Maximum size of a write-buffer in number of 128-bit words.

NRF_RRAMC_READYNEXTTIMEOUT_MAX

Maximum preload timeout value for waiting for a next write.

NRF_RRAMC_REGION_CONFIG_PERM_MASK

RRAMC region permissions bitmask.

Enums

enum nrf_rramc_task_t

RRAMC tasks.

Values:

enumerator NRF_RRAMC_TASK_WAKEUP

Wakeup the RRAM from low power mode.

enumerator NRF_RRAMC_TASK_COMMIT_WRITEBUF

Commit the data stored in internal write-buffer to RRAM.

enum nrf_rramc_event_t

RRAMC events.

Values:

enumerator NRF_RRAMC_EVENT_WOKENUP

The RRAM is woken up from low power mode.

enumerator NRF_RRAMC_EVENT_READY

RRAMC is ready.

enumerator NRF_RRAMC_EVENT_READY_NEXT

Ready to accept a new write operation.

enumerator NRF_RRAMC_EVENT_ERROR_ACCESS

RRAM access error.

enum nrf_rramc_int_mask_t

RRAMC interrupts.

Values:

enumerator NRF_RRAMC_INT_WOKENUP_MASK

Interrupt on WOKENUP event.

enumerator NRF_RRAMC_INT_READY_MASK

Interrupt on READY event.

enumerator NRF_RRAMC_INT_READY_NEXT_MASK

Interrupt on READYNEXT event.

enumerator NRF_RRAMC_INT_ERROR_ACCESS_MASK

Interrupt on ACCESSERROR event.

enumerator NRF_RRAMC_ALL_INTS_MASK

All RRAMC interrupts.

enum nrf_rramc_region_perm_mask_t

RRAMC region permissions mask.

Note

When bit is set, the selected action is allowed.

Values:

enumerator NRF_RRAMC_REGION_PERM_READ_MASK

Read access.

enumerator NRF_RRAMC_REGION_PERM_WRITE_MASK

Write access.

enumerator NRF_RRAMC_REGION_PERM_EXECUTE_MASK

Software execute.

enumerator NRF_RRAMC_REGION_PERM_SECURE_MASK

Secure-only access.

Functions

NRF_STATIC_INLINE void nrf_rramc_task_trigger(NRF_RRAMC_Type *p_reg, nrf_rramc_task_t task)

Function for activating the specified RRAMC 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_rramc_task_address_get(NRF_RRAMC_Type const *p_reg, nrf_rramc_task_t task)

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

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

  • task[in] RRAMC task.

Returns:

Address of the specified task register.

NRF_STATIC_INLINE void nrf_rramc_event_clear(NRF_RRAMC_Type *p_reg, nrf_rramc_event_t event)

Function for clearing the specified RRAMC event.

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

  • event[in] Event to clear.

NRF_STATIC_INLINE bool nrf_rramc_event_check(NRF_RRAMC_Type const *p_reg, nrf_rramc_event_t event)

Function for retrieving the state of the RRAMC 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_rramc_event_address_get(NRF_RRAMC_Type const *p_reg, nrf_rramc_event_t event)

Function for getting the address of the specified RRAMC 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_rramc_int_enable(NRF_RRAMC_Type *p_reg, uint32_t mask)

Function for enabling the specified interrupts.

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

  • mask[in] Mask of interrupts to be enabled. Use nrf_rramc_int_mask_t values for bit masking.

NRF_STATIC_INLINE void nrf_rramc_int_disable(NRF_RRAMC_Type *p_reg, uint32_t mask)

Function for disabling the specified interrupts.

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

  • mask[in] Mask of interrupts to be disabled. Use nrf_rramc_int_mask_t values for bit masking.

NRF_STATIC_INLINE uint32_t nrf_rramc_int_enable_check(NRF_RRAMC_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. Use nrf_rramc_int_mask_t values for bit masking.

Returns:

Mask of enabled interrupts.

NRF_STATIC_INLINE uint32_t nrf_rramc_int_pending_get(NRF_RRAMC_Type const *p_reg)

Function for getting the state of pending interrupts.

Note

States of pending interrupt are saved as a bitmask. One set at particular position means that interrupt for event is pending.

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

Returns:

Bitmask with information about pending interrupts. Use nrf_rramc_int_mask_t values for bit masking.

NRF_STATIC_INLINE void nrf_rramc_subscribe_set(NRF_RRAMC_Type *p_reg, nrf_rramc_task_t task, uint8_t channel)

Function for setting the subscribe configuration for a wakeup RRAMC task.

Note

Not every task has its corresponding subscribe register. Refer to the Product Specification for more information.

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_rramc_subscribe_clear(NRF_RRAMC_Type *p_reg, nrf_rramc_task_t task)

Function for clearing the subscribe configuration for a wakeup RRAMC task.

Note

Not every task has its corresponding subscribe register. Refer to the Product Specification for more information.

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_rramc_publish_set(NRF_RRAMC_Type *p_reg, nrf_rramc_event_t event, uint8_t channel)

Function for setting the publish configuration for a wokenup RRAMC event.

Note

Not every event has its corresponding publish register. Refer to the Product Specification for more information.

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_rramc_publish_clear(NRF_RRAMC_Type *p_reg, nrf_rramc_event_t event)

Function for clearing the publish configuration for a wokenup RRAMC event.

Note

Not every event has its corresponding publish register. Refer to the Product Specification for more information.

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

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

NRF_STATIC_INLINE bool nrf_rramc_ready_check(NRF_RRAMC_Type const *p_reg)

Function for checking current RRAMC operation status.

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

Return values:
  • true – Current operation is completed, and RRAMC is ready.

  • false – RRAMC is busy.

NRF_STATIC_INLINE bool nrf_rramc_write_ready_check(NRF_RRAMC_Type const *p_reg)

Function for checking whether RRAMC is ready to accept a new write operation.

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

Return values:
  • true – RRAMC is ready to accept a new write operation.

  • false – RRAMC cannot accept any write operation now.

NRF_STATIC_INLINE uint32_t nrf_rramc_error_access_addr_get(NRF_RRAMC_Type const *p_reg)

Fuction for checking the address of the first access error.

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

Returns:

Access error address.

NRF_STATIC_INLINE bool nrf_rramc_empty_buffer_check(NRF_RRAMC_Type const *p_reg)

Function for checking whether the internal write-buffer has been committed to RRAM and is now empty.

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

Return values:
  • true – The internal write-buffer is empty and has no content that needs to be commited.

  • false – The internal write-buffer has data that needs to be committed.

NRF_STATIC_INLINE void nrf_rramc_config_get(NRF_RRAMC_Type const *p_reg, nrf_rramc_config_t *p_config)

Function for getting the RRAMC peripheral configuration.

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

  • p_config[out] Pointer to the structure to be filled with RRAMC configuration data.

NRF_STATIC_INLINE void nrf_rramc_config_set(NRF_RRAMC_Type *p_reg, nrf_rramc_config_t const *p_config)

Function for setting the RRAMC peripheral configuration.

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

  • p_config[in] Pointer to the structure with configuration to be set.

NRF_STATIC_INLINE void nrf_rramc_ready_next_timeout_get(NRF_RRAMC_Type const *p_reg, nrf_rramc_ready_next_timeout_t *p_config)

Function for getting preload timeout value for waiting for a next write.

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

  • p_config[out] Pointer to the structure to be filled with information about preload timeout value.

NRF_STATIC_INLINE void nrf_rramc_ready_next_timeout_set(NRF_RRAMC_Type *p_reg, nrf_rramc_ready_next_timeout_t const *p_config)

Function for setting preload timeout value for waiting for a next write.

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

  • p_config[in] Pointer to the structure filled with information about$ preload timeout value.

NRF_STATIC_INLINE void nrf_rramc_power_config_get(NRF_RRAMC_Type const *p_reg, nrf_rramc_power_t *p_config)

Function for getting the RRAMC power configuration.

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

  • p_config[out] Pointer to the structure to be filled with information about power configuration.

NRF_STATIC_INLINE void nrf_rramc_power_config_set(NRF_RRAMC_Type *p_reg, nrf_rramc_power_t const *p_config)

Function for setting the RRAMC power configuration.

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

  • p_config[in] Pointer to the structure filled with information about power configuration.

NRF_STATIC_INLINE bool nrf_rramc_erase_all_check(NRF_RRAMC_Type const *p_reg)

Function for checking if the erasing operation of the whole RRAM main block has been started.

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

Return values:
  • true – Erase of chip started.

  • false – No operation.

NRF_STATIC_INLINE void nrf_rramc_erase_all_set(NRF_RRAMC_Type *p_reg)

Function for erasing whole RRAM main block, that includes the SICR and the UICR.

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

NRF_STATIC_INLINE void nrf_rramc_region_config_set(NRF_RRAMC_Type *p_reg, uint8_t region, nrf_rramc_region_config_t const *p_config)

Function for setting the configuration of the specified RRAMC region.

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

  • region[in] Region number.

  • p_config[in] Pointer to the configuration structure.

NRF_STATIC_INLINE void nrf_rramc_region_config_get(NRF_RRAMC_Type const *p_reg, uint8_t region, nrf_rramc_region_config_t *p_config)

Function for getting the configuration of the specified RRAMC region.

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

  • region[in] Region number.

  • p_config[in] Pointer to the structure to be filled with RRAMC region settings.

NRF_STATIC_INLINE uint32_t nrf_rramc_region_config_raw_get(NRF_RRAMC_Type const *p_reg, uint8_t region)

Function for getting the raw configuration of the specified RRAMC region.

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

  • region[in] Region number.

Returns:

Raw configuration.

struct nrf_rramc_config_t
#include <nrf_rramc.h>

RRAMC configuration structure.

Public Members

bool mode_write

True if write mode is to be enabled, false otherwise.

uint8_t write_buff_size

Write-buffer size in case set to 0 buffering is disabled.

struct nrf_rramc_ready_next_timeout_t
#include <nrf_rramc.h>

Preload timeout value for waiting for a next write.

Public Members

uint16_t value

Preload value expressed in clock cycles.

bool enable

True if write to the RRAM is to be triggered on the next timeout, false otherwise.

struct nrf_rramc_power_t
#include <nrf_rramc.h>

Power configuration.

Public Members

uint16_t access_timeout

Access timeout used for going into standby power mode or remain active on wake up, expressed in clock cycles.

bool abort_on_pof

True if the current RRAM write operation is to be aborted on the power failure, false otherwise.

struct nrf_rramc_region_config_t
#include <nrf_rramc.h>

RRAMC region configuration.

Public Members

uint32_t address

Start address of the region.

uint32_t permissions

Permissions created using nrf_rramc_region_perm_mask_t.

bool writeonce

True if writes to the region are to be applied only when the current data is 0xFFFFFFFF.

bool lock

True if memory belonging to given region is to be read-only.

uint16_t size_kb

Region size in kBs. */.