RRAMC HALY

group nrfy_rramc

Hardware access layer with cache and barrier support for managing the RRAMC peripheral.

Defines

NRFY_RRAMC_BYTES_IN_WORD

Value representing the number of bytes in a word.

It is used in loops iterating over bytes contained in a word or in word-alignment checks.

NRFY_RRAMC_WORDS_IN_BUFER_LINE

Value representing the number of words in a buffer line.

It is used in loops iterating over words contained in buffer lines.

NRFY_RRAMC_RRAM_BASE_ADDRESS

Value representing resistive random access memory (RRAM) base address.

NRFY_RRAMC_READY_NEXT_TIMEOUT_DEFAULT

Default value for waiting for a next write.

Functions

NRFY_STATIC_INLINE void nrfy_rramc_configure(NRF_RRAMC_Type *p_reg, nrfy_rramc_config_t const *p_config)

Function for configuring the RRAMC.

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

  • p_config[in] Pointer to the structure of configuration of the peripheral.

NRFY_STATIC_INLINE void nrfy_rramc_int_init(NRF_RRAMC_Type *p_reg, uint32_t mask, uint8_t irq_priority, bool enable)

Function for initializing the specified RRAMC interrupts.

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

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

  • irq_priority[in] Interrupt priority.

  • enable[in] True if interrupts associated with the event mask are to be enabled, false otherwise.

NRFY_STATIC_INLINE void nrfy_rramc_int_uninit(NRF_RRAMC_Type *p_reg)

Function for uninitializing the RRAMC interrupts.

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

NRFY_STATIC_INLINE uint32_t nrfy_rramc_events_process(NRF_RRAMC_Type *p_reg, uint32_t mask)

Function for processing the specified RRAMC events.

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

  • mask[in] Mask of events to be processed, created by NRFY_EVENT_TO_INT_BITMASK().

Returns:

Mask of events that were generated and processed. To be checked against the result of NRFY_EVENT_TO_INT_BITMASK().

NRFY_STATIC_INLINE void nrfy_rramc_byte_write(NRF_RRAMC_Type *p_reg, uint32_t address, uint8_t value)

Function for writing a single byte to RRAM.

Note

Depending on the source of the code being executed, the CPU may be halted during the operation. Refer to the Product Specification for more information.

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

  • address[in] Address to where data is to be written.

  • value[in] Value to be written.

NRFY_STATIC_INLINE void nrfy_rramc_bytes_write(NRF_RRAMC_Type *p_reg, uint32_t address, void const *src, uint32_t num_bytes)

Function for writing consecutive bytes to RRAM.

Note

Depending on the source of the code being executed, the CPU may be halted during the operation. Refer to the Product Specification for more information.

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

  • address[in] Address to where data is to be written.

  • src[in] Pointer to data to be copied.

  • num_bytes[in] Number of bytes to be written.

NRFY_STATIC_INLINE uint8_t nrfy_rramc_byte_read(uint32_t address)

Function for reading a byte from the RRAM.

Parameters:
  • address[in] Address of the byte to be read.

Returns:

Value read from RRAM.

NRFY_STATIC_INLINE void nrfy_rramc_word_write(NRF_RRAMC_Type *p_reg, uint32_t address, uint32_t value)

Function for writing a 32-bit word to RRAM.

Note

Depending on the source of the code being executed, the CPU may be halted during the operation. Refer to the Product Specification for more information.

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

  • address[in] Address to where data is to be written. Must be word-aligned.

  • value[in] Value to be written.

NRFY_STATIC_INLINE void nrfy_rramc_words_write(NRF_RRAMC_Type *p_reg, uint32_t address, void const *src, uint32_t num_words)

Function for writing consecutive 32-bit words to RRAM.

Note

Depending on the source of the code being executed, the CPU may be halted during the operation. Refer to the Product Specification for more information.

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

  • address[in] Address to where data is to be written. Must be word-aligned.

  • src[in] Pointer to data to be copied. Must be word-aligned.

  • num_words[in] Number of words to be written.

NRFY_STATIC_INLINE uint32_t nrfy_rramc_word_read(uint32_t address)

Function for reading a 32-bit word from the RRAM.

Parameters:
  • address[in] Address of the word to be read.

Returns:

Value read from RRAM.

NRFY_STATIC_INLINE void nrfy_rramc_buffer_read(void *dst, uint32_t address, uint32_t num_bytes)

Function for reading a given number of bytes from the RRAM into the specified buffer.

Parameters:
  • dst[out] Pointer to the buffer to store the data.

  • address[in] Address of the first byte to be read.

  • num_bytes[in] Number of bytes to be read.

NRFY_STATIC_INLINE uint32_t nrfy_rramc_otp_word_read(uint32_t index)

Function for reading a word from the OTP in UICR.

OTP is a region of the UICR present in some chips. This function must be used to read word data from this region since unaligned accesses are not available on the OTP RRAM area.

Parameters:
  • index[in] Address (index) in OTP table from which a word is to be read.

Return values:

The – contents at index.

NRFY_STATIC_INLINE bool nrfy_rramc_otp_word_write(NRF_RRAMC_Type *p_reg, uint32_t index, uint32_t value)

Function for writing a 32-bit word at index position to OTP region in UICR.

The OTP is only able to write ‘0’ to bits in the UICR that are erased (set to ‘1’). It cannot rewrite a bit back to ‘1’. This function checks if the value currently residing at the specified index can be transformed to the desired value without any ‘0’ to ‘1’ transitions. If yes, then perform the write operation.

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

  • index[in] Address (index) in OTP table to which a word it to be written.

  • value[in] Value to be written.

Return values:
  • true – Word can be written into the specified OTP index address.

  • false – Word cannot be written into the specified OTP index address. Erase UICR or change index address.

NRFY_STATIC_INLINE void nrfy_rramc_task_trigger(NRF_RRAMC_Type *p_reg, nrf_rramc_task_t task)

See also

nrf_rramc_task_trigger 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.

NRFY_STATIC_INLINE uint32_t nrfy_rramc_task_address_get(NRF_RRAMC_Type const *p_reg, nrf_rramc_task_t task)

See also

nrf_rramc_task_address_get 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.

NRFY_STATIC_INLINE void nrfy_rramc_event_clear(NRF_RRAMC_Type *p_reg, nrf_rramc_event_t event)

See also

nrf_rramc_event_clear Function for clearing the specified RRAMC event.

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

  • event[in] Event to clear.

NRFY_STATIC_INLINE bool nrfy_rramc_event_check(NRF_RRAMC_Type const *p_reg, nrf_rramc_event_t event)

See also

nrf_rramc_event_check 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.

NRFY_STATIC_INLINE uint32_t nrfy_rramc_event_address_get(NRF_RRAMC_Type const *p_reg, nrf_rramc_event_t event)

See also

nrf_rramc_event_address_get 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.

NRFY_STATIC_INLINE void nrfy_rramc_int_enable(NRF_RRAMC_Type *p_reg, uint32_t mask)

See also

nrf_rramc_int_enable 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.

NRFY_STATIC_INLINE void nrfy_rramc_int_disable(NRF_RRAMC_Type *p_reg, uint32_t mask)

See also

nrf_rramc_int_disable 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.

NRFY_STATIC_INLINE uint32_t nrfy_rramc_int_enable_check(NRF_RRAMC_Type const *p_reg, uint32_t mask)

See also

nrf_rramc_int_enable_check 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.

NRFY_STATIC_INLINE void nrfy_rramc_subscribe_set(NRF_RRAMC_Type *p_reg, nrf_rramc_task_t task, uint8_t channel)

See also

nrf_rramc_subscribe_set 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.

NRFY_STATIC_INLINE void nrfy_rramc_subscribe_clear(NRF_RRAMC_Type *p_reg, nrf_rramc_task_t task)

See also

nrf_rramc_subscribe_clear 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.

NRFY_STATIC_INLINE void nrfy_rramc_publish_set(NRF_RRAMC_Type *p_reg, nrf_rramc_event_t event, uint8_t channel)

See also

nrf_rramc_publish_set 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.

NRFY_STATIC_INLINE void nrfy_rramc_publish_clear(NRF_RRAMC_Type *p_reg, nrf_rramc_event_t event)

See also

nrf_rramc_publish_clear 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.

NRFY_STATIC_INLINE bool nrfy_rramc_ready_check(NRF_RRAMC_Type *p_reg)

See also

nrf_rramc_ready_check 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.

NRFY_STATIC_INLINE bool nrfy_rramc_write_ready_check(NRF_RRAMC_Type *p_reg)

See also

nrf_rramc_write_ready_check 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.

NRFY_STATIC_INLINE uint32_t nrfy_rramc_error_access_addr_get(NRF_RRAMC_Type const *p_reg)

See also

nrf_rramc_error_access_addr_get 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.

NRFY_STATIC_INLINE bool nrfy_rramc_empty_buffer_check(NRF_RRAMC_Type const *p_reg)

See also

nrf_rramc_empty_buffer_check 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.

NRFY_STATIC_INLINE void nrfy_rramc_config_get(NRF_RRAMC_Type const *p_reg, nrf_rramc_config_t *p_config)

See also

nrf_rramc_config_get 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.

NRFY_STATIC_INLINE void nrfy_rramc_config_set(NRF_RRAMC_Type *p_reg, nrf_rramc_config_t const *p_config)

See also

nrf_rramc_config_set 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.

NRFY_STATIC_INLINE void nrfy_rramc_ready_next_timeout_get(NRF_RRAMC_Type const *p_reg, nrf_rramc_ready_next_timeout_t *p_config)

See also

nrf_rramc_ready_next_timeout_get 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.

NRFY_STATIC_INLINE void nrfy_rramc_ready_next_timeout_set(NRF_RRAMC_Type *p_reg, nrf_rramc_ready_next_timeout_t const *p_config)

See also

nrf_rramc_ready_next_timeout_set 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.

NRFY_STATIC_INLINE void nrfy_rramc_power_config_get(NRF_RRAMC_Type const *p_reg, nrf_rramc_power_t *p_config)

See also

nrf_rramc_power_config_get 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.

NRFY_STATIC_INLINE void nrfy_rramc_power_config_set(NRF_RRAMC_Type *p_reg, nrf_rramc_power_t const *p_config)

See also

nrf_rramc_power_config_set 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.

NRFY_STATIC_INLINE bool nrfy_rramc_erase_all_check(NRF_RRAMC_Type const *p_reg)

See also

nrf_rramc_erase_all_check 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.

NRFY_STATIC_INLINE void nrfy_rramc_erase_all_set(NRF_RRAMC_Type *p_reg)

See also

nrf_rramc_erase_all_set 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.

struct nrfy_rramc_config_t
#include <nrfy_rramc.h>

RRAMC configuration structure.

Public Members

nrf_rramc_config_t config

Mode and buffer size configuration.

nrf_rramc_ready_next_timeout_t preload_timeout

Preload timeout value for waiting for a next write.

nrf_rramc_power_t power

RRAMC power configuration.