Hardware access layer with cache and barrier support for managing the RRAMC peripheral. More...
Data Structures | |
struct | nrfy_rramc_config_t |
RRAMC configuration structure. More... | |
Macros | |
#define | NRFY_RRAMC_BYTES_IN_WORD 4 |
Value representing the number of bytes in a word. | |
#define | NRFY_RRAMC_WORDS_IN_BUFER_LINE 4 |
Value representing the number of words in a buffer line. | |
#define | NRFY_RRAMC_RRAM_BASE_ADDRESS NRF_MEMORY_FLASH_BASE |
Value representing resistive random access memory (RRAM) base address. | |
#define | NRFY_RRAMC_READY_NEXT_TIMEOUT_DEFAULT RRAMC_READYNEXTTIMEOUT_ResetValue |
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. | |
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. | |
NRFY_STATIC_INLINE void | nrfy_rramc_int_uninit (NRF_RRAMC_Type *p_reg) |
Function for uninitializing the RRAMC interrupts. | |
NRFY_STATIC_INLINE uint32_t | nrfy_rramc_events_process (NRF_RRAMC_Type *p_reg, uint32_t mask) |
Function for processing the specified RRAMC events. | |
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. | |
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. | |
NRFY_STATIC_INLINE uint8_t | nrfy_rramc_byte_read (uint32_t address) |
Function for reading a byte from the 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. | |
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. | |
NRFY_STATIC_INLINE uint32_t | nrfy_rramc_word_read (uint32_t address) |
Function for reading a 32-bit word from the 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. | |
NRFY_STATIC_INLINE uint32_t | nrfy_rramc_otp_word_read (uint32_t index) |
Function for reading a word from the OTP in UICR. | |
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. | |
NRFY_STATIC_INLINE void | nrfy_rramc_task_trigger (NRF_RRAMC_Type *p_reg, nrf_rramc_task_t task) |
NRFY_STATIC_INLINE uint32_t | nrfy_rramc_task_address_get (NRF_RRAMC_Type const *p_reg, nrf_rramc_task_t task) |
NRFY_STATIC_INLINE void | nrfy_rramc_event_clear (NRF_RRAMC_Type *p_reg, nrf_rramc_event_t event) |
NRFY_STATIC_INLINE bool | nrfy_rramc_event_check (NRF_RRAMC_Type const *p_reg, nrf_rramc_event_t event) |
NRFY_STATIC_INLINE uint32_t | nrfy_rramc_event_address_get (NRF_RRAMC_Type const *p_reg, nrf_rramc_event_t event) |
NRFY_STATIC_INLINE void | nrfy_rramc_int_enable (NRF_RRAMC_Type *p_reg, uint32_t mask) |
NRFY_STATIC_INLINE void | nrfy_rramc_int_disable (NRF_RRAMC_Type *p_reg, uint32_t mask) |
NRFY_STATIC_INLINE uint32_t | nrfy_rramc_int_enable_check (NRF_RRAMC_Type const *p_reg, uint32_t mask) |
NRFY_STATIC_INLINE void | nrfy_rramc_subscribe_set (NRF_RRAMC_Type *p_reg, nrf_rramc_task_t task, uint8_t channel) |
NRFY_STATIC_INLINE void | nrfy_rramc_subscribe_clear (NRF_RRAMC_Type *p_reg, nrf_rramc_task_t task) |
NRFY_STATIC_INLINE void | nrfy_rramc_publish_set (NRF_RRAMC_Type *p_reg, nrf_rramc_event_t event, uint8_t channel) |
NRFY_STATIC_INLINE void | nrfy_rramc_publish_clear (NRF_RRAMC_Type *p_reg, nrf_rramc_event_t event) |
NRFY_STATIC_INLINE bool | nrfy_rramc_ready_check (NRF_RRAMC_Type *p_reg) |
NRFY_STATIC_INLINE bool | nrfy_rramc_write_ready_check (NRF_RRAMC_Type *p_reg) |
NRFY_STATIC_INLINE uint32_t | nrfy_rramc_error_access_addr_get (NRF_RRAMC_Type const *p_reg) |
NRFY_STATIC_INLINE bool | nrfy_rramc_empty_buffer_check (NRF_RRAMC_Type const *p_reg) |
NRFY_STATIC_INLINE void | nrfy_rramc_config_get (NRF_RRAMC_Type const *p_reg, nrf_rramc_config_t *p_config) |
NRFY_STATIC_INLINE void | nrfy_rramc_config_set (NRF_RRAMC_Type *p_reg, nrf_rramc_config_t const *p_config) |
NRFY_STATIC_INLINE void | nrfy_rramc_ready_next_timeout_get (NRF_RRAMC_Type const *p_reg, nrf_rramc_ready_next_timeout_t *p_config) |
NRFY_STATIC_INLINE void | nrfy_rramc_ready_next_timeout_set (NRF_RRAMC_Type *p_reg, nrf_rramc_ready_next_timeout_t const *p_config) |
NRFY_STATIC_INLINE void | nrfy_rramc_power_config_get (NRF_RRAMC_Type const *p_reg, nrf_rramc_power_t *p_config) |
NRFY_STATIC_INLINE void | nrfy_rramc_power_config_set (NRF_RRAMC_Type *p_reg, nrf_rramc_power_t const *p_config) |
NRFY_STATIC_INLINE bool | nrfy_rramc_erase_all_check (NRF_RRAMC_Type const *p_reg) |
NRFY_STATIC_INLINE void | nrfy_rramc_erase_all_set (NRF_RRAMC_Type *p_reg) |
Hardware access layer with cache and barrier support for managing the RRAMC peripheral.
#define NRFY_RRAMC_BYTES_IN_WORD 4 |
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.
#define NRFY_RRAMC_WORDS_IN_BUFER_LINE 4 |
Value representing the number of words in a buffer line.
It is used in loops iterating over words contained in buffer lines.
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.
[out] | dst | Pointer to the buffer to store the data. |
[in] | address | Address of the first byte to be read. |
[in] | num_bytes | Number of bytes to be read. |
NRFY_STATIC_INLINE uint8_t nrfy_rramc_byte_read | ( | uint32_t | address | ) |
Function for reading a byte from the RRAM.
[in] | address | Address of the byte to be read. |
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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | address | Address to where data is to be written. |
[in] | value | 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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | address | Address to where data is to be written. |
[in] | src | Pointer to data to be copied. |
[in] | num_bytes | Number of bytes to be written. |
NRFY_STATIC_INLINE void nrfy_rramc_config_get | ( | NRF_RRAMC_Type const * | p_reg, |
nrf_rramc_config_t * | p_config | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[out] | p_config | 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 | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_config | Pointer to the structure with configuration to be set. |
NRFY_STATIC_INLINE void nrfy_rramc_configure | ( | NRF_RRAMC_Type * | p_reg, |
nrfy_rramc_config_t const * | p_config | ||
) |
Function for configuring the RRAMC.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_config | Pointer to the structure of configuration of the peripheral. |
NRFY_STATIC_INLINE bool nrfy_rramc_empty_buffer_check | ( | NRF_RRAMC_Type const * | p_reg | ) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
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 bool nrfy_rramc_erase_all_check | ( | NRF_RRAMC_Type const * | p_reg | ) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
true | Erase of chip started. |
false | No operation. |
NRFY_STATIC_INLINE void nrfy_rramc_erase_all_set | ( | NRF_RRAMC_Type * | p_reg | ) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRFY_STATIC_INLINE uint32_t nrfy_rramc_error_access_addr_get | ( | NRF_RRAMC_Type const * | p_reg | ) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRFY_STATIC_INLINE uint32_t nrfy_rramc_event_address_get | ( | NRF_RRAMC_Type const * | p_reg, |
nrf_rramc_event_t | event | ||
) |
[in] | p_reg | Pointer to the peripheral register structure. |
[in] | event | Requested event. |
NRFY_STATIC_INLINE bool nrfy_rramc_event_check | ( | NRF_RRAMC_Type const * | p_reg, |
nrf_rramc_event_t | event | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event to be checked. |
true | The event has been generated. |
false | The event has not been generated. |
NRFY_STATIC_INLINE void nrfy_rramc_event_clear | ( | NRF_RRAMC_Type * | p_reg, |
nrf_rramc_event_t | event | ||
) |
[in] | p_reg | Pointer to the peripheral register structure. |
[in] | event | Event to clear. |
NRFY_STATIC_INLINE uint32_t nrfy_rramc_events_process | ( | NRF_RRAMC_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for processing the specified RRAMC events.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of events to be processed, created by NRFY_EVENT_TO_INT_BITMASK(). |
NRFY_STATIC_INLINE void nrfy_rramc_int_disable | ( | NRF_RRAMC_Type * | p_reg, |
uint32_t | mask | ||
) |
[in] | p_reg | Pointer to the peripheral register structure. |
[in] | mask | Mask of interrupts to be disabled. Use nrf_rramc_int_mask_t values for bit masking. |
NRFY_STATIC_INLINE void nrfy_rramc_int_enable | ( | NRF_RRAMC_Type * | p_reg, |
uint32_t | mask | ||
) |
[in] | p_reg | Pointer to the peripheral register structure. |
[in] | mask | Mask of interrupts to be enabled. 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 | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be checked. Use nrf_rramc_int_mask_t values for bit masking. |
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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be initialized. |
[in] | irq_priority | Interrupt priority. |
[in] | enable | 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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
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.
[in] | index | Address (index) in OTP table from which a word is to be read. |
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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | index | Address (index) in OTP table to which a word it to be written. |
[in] | value | Value to be written. |
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_power_config_get | ( | NRF_RRAMC_Type const * | p_reg, |
nrf_rramc_power_t * | p_config | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[out] | p_config | 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 | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_config | Pointer to the structure filled with information about power configuration. |
NRFY_STATIC_INLINE void nrfy_rramc_publish_clear | ( | NRF_RRAMC_Type * | p_reg, |
nrf_rramc_event_t | event | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event 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 | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event for which to set the configuration. |
[in] | channel | Channel through which to publish the event. |
NRFY_STATIC_INLINE bool nrfy_rramc_ready_check | ( | NRF_RRAMC_Type * | p_reg | ) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
true | Current operation is completed, and RRAMC is ready. |
false | RRAMC is busy. |
NRFY_STATIC_INLINE void nrfy_rramc_ready_next_timeout_get | ( | NRF_RRAMC_Type const * | p_reg, |
nrf_rramc_ready_next_timeout_t * | p_config | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[out] | p_config | 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 | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_config | Pointer to the structure filled with information about$ preload timeout value. |
NRFY_STATIC_INLINE void nrfy_rramc_subscribe_clear | ( | NRF_RRAMC_Type * | p_reg, |
nrf_rramc_task_t | task | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task for which to clear the configuration. |
NRFY_STATIC_INLINE void nrfy_rramc_subscribe_set | ( | NRF_RRAMC_Type * | p_reg, |
nrf_rramc_task_t | task, | ||
uint8_t | channel | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task for which to set the configuration. |
[in] | channel | Channel through which to subscribe events. |
NRFY_STATIC_INLINE uint32_t nrfy_rramc_task_address_get | ( | NRF_RRAMC_Type const * | p_reg, |
nrf_rramc_task_t | task | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | RRAMC task. |
NRFY_STATIC_INLINE void nrfy_rramc_task_trigger | ( | NRF_RRAMC_Type * | p_reg, |
nrf_rramc_task_t | task | ||
) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task to be activated. |
NRFY_STATIC_INLINE uint32_t nrfy_rramc_word_read | ( | uint32_t | address | ) |
Function for reading a 32-bit word from the RRAM.
[in] | address | Address of the word to be read. |
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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | address | Address to where data is to be written. Must be word-aligned. |
[in] | value | 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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | address | Address to where data is to be written. Must be word-aligned. |
[in] | src | Pointer to data to be copied. Must be word-aligned. |
[in] | num_words | Number of words to be written. |
NRFY_STATIC_INLINE bool nrfy_rramc_write_ready_check | ( | NRF_RRAMC_Type * | p_reg | ) |
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
true | RRAMC is ready to accept a new write operation. |
false | RRAMC cannot accept any write operation now. |