nrfx 4.5.0
Loading...
Searching...
No Matches
MRAMC driver

Magnetoresistive Random Access Memory Controller (MRAMC) peripheral driver. More...

Data Structures

struct  nrfx_mramc_config_t
 Configuration structure of the MRAMC driver instance. More...
 

Macros

#define NRFX_MRAMC_MAP_TO_ADDR(offset)
 Macro for mapping relative MRAMC offset to absolute address.
 
#define NRFX_MRAMC_DEFAULT_CONFIG()
 MRAMC driver default configuration.
 

Typedefs

typedef void(* nrfx_mramc_evt_handler_t) (nrf_mramc_event_t const event_type)
 MRAMC driver event handler type.
 

Functions

bool nrfx_mramc_valid_address_check (uint32_t addr, bool uicr_allowed)
 Function for checking if the address is valid.
 
bool nrfx_mramc_fits_memory_check (uint32_t addr, bool uicr_allowed, uint32_t bytes)
 Function for checking if the address and size fit in MRAM memory.
 
void nrfx_mramc_all_erase (void)
 Function for erasing the whole MRAM memory.
 
void nrfx_mramc_word_write (uint32_t address, uint32_t value)
 Function for writing a 32-bit word to MRAM.
 
void nrfx_mramc_words_write (uint32_t address, void const *src, uint32_t num_words)
 Function for writing consecutive 32-bit words to MRAM.
 
void nrfx_mramc_buffer_read (void *dst, uint32_t address, uint32_t num_bytes)
 Function for reading consecutive bytes from MRAM.
 
void nrfx_mramc_config_write_mode_set (nrf_mramc_mode_write_t write_mode)
 Function for setting the MRAMC write mode.
 
void nrfx_mramc_config_erase_mode_set (nrf_mramc_mode_erase_t erase_mode)
 Function for setting the MRAMC erase mode.
 
void nrfx_mramc_confignvr_perm_set (bool enable, uint8_t page)
 Function for setting the MRAMC NVR page write and erase permission,.
 
int nrfx_mramc_init (nrfx_mramc_config_t const *p_config, nrfx_mramc_evt_handler_t handler)
 Function for initializing the MRAMC driver instance.
 
int nrfx_mramc_reconfigure (nrfx_mramc_config_t const *p_config)
 Function for reconfiguring the MRAMC driver instance.
 
void nrfx_mramc_uninit (void)
 Function for uninitializing the MRAMC driver instance.
 
uint32_t nrfx_mramc_memory_size_get (void)
 Function for getting the total MRAM size in bytes.
 
void nrfx_mramc_area_erase (uint32_t address, uint32_t size)
 Function for erasing MRAM area in given MRAM words size.
 
void nrfx_mramc_erase (uint32_t address, uint32_t num_words)
 Function for erasing MRAM area in given 32-bit words size.
 
NRFX_STATIC_INLINE uint32_t nrfx_mramc_word_read (uint32_t address)
 Function for reading a 32-bit word from the MRAM.
 
NRFX_STATIC_INLINE bool nrfx_mramc_ready_check (void)
 Function for checking current MRAMC operation status.
 
NRFX_STATIC_INLINE uint32_t nrfx_mramc_otp_word_read (uint32_t index)
 Function for reading a word from the OTP in UICR.
 
NRFX_STATIC_INLINE bool nrfx_mramc_otp_word_write (uint32_t index, uint32_t value)
 Function for writing a 32-bit word at index position to OTP region in UICR.
 

Detailed Description

Magnetoresistive Random Access Memory Controller (MRAMC) peripheral driver.

Macro Definition Documentation

◆ NRFX_MRAMC_DEFAULT_CONFIG

#define NRFX_MRAMC_DEFAULT_CONFIG ( )
Value:
{ \
.config = { \
NRFX_COND_CODE_1(NRF_MRAMC_HAS_CONFIG_DISABLEECC, \
(.disable_ecc = false,), ()) \
(.enable_ecc_bus_fault = false,), ()) \
}, \
.preload_timeout = { \
.direct_write = true, \
}, \
.powerdown = { \
.enable = false, \
.power_down_cfg = false, \
}, \
.lowavgcurr = { \
}, \
.irq_priority = NRFX_MRAMC_DEFAULT_CONFIG_IRQ_PRIORITY, \
}
#define NRF_MRAMC_LOWAVGCURR_WRITE_MIN
Minimum timeout value for low average current write in MRAMC clock cycles.
Definition nrf_mramc.h:151
#define NRF_MRAMC_AUTOPOWERDOWN_TIMEOUT_MIN
Minimum timeout value for automatic power down in MRAMC clock cycles.
Definition nrf_mramc.h:161
#define NRF_MRAMC_HAS_CONFIG_DISABLEECC
Symbol indicating whether the CONFIG register has a DISABLEECC field.
Definition nrf_mramc.h:70
#define NRF_MRAMC_LOWAVGCURR_READ_MIN
Minimum timeout value for low average current read in MRAMC clock cycles.
Definition nrf_mramc.h:149
#define NRF_MRAMC_LOWAVGCURR_ERASE_MIN
Minimum timeout value for low average current erase in MRAMC clock cycles.
Definition nrf_mramc.h:153
#define NRF_MRAMC_HAS_CONFIG_ENABLEECCBUSFAULT
Symbol indicating whether the CONFIG register has an ENABLEECCBUSFAULT field.
Definition nrf_mramc.h:77
#define NRF_MRAMC_READYNEXTTIMEOUT_DEFAULT
Default timeout value for waiting for next write in in MRAMC clock cycles.
Definition nrf_mramc.h:147
@ NRF_MRAMC_MODE_ERASE_DISABLE
Erase is disabled but read is allowed.
Definition nrf_mramc.h:230
@ NRF_MRAMC_MODE_WRITE_DISABLE
Write is disabled.
Definition nrf_mramc.h:222

MRAMC driver default configuration.

This configuration sets up MRAMC with the following options:

  • Write mode disabled
  • Erase mode disabled
  • ECC enabled (if present)
  • Bus fault on ECC error disabled (if present)
  • Preload timeout value: 0x0
  • Write to the MRAM backed-to-backed on the next preload timeout in direct mode enabled
  • Automatic power-down feature disabled
  • Entering power-down mode when the timeout happens disabled
  • Access timeout: 0x0
  • Low average current read, write, and erase preload timeout values: 0x0

◆ NRFX_MRAMC_MAP_TO_ADDR

#define NRFX_MRAMC_MAP_TO_ADDR ( offset)
Value:
#define NRFY_MRAMC_MRAM_BASE_ADDRESS
Value representing resistive random access memory (MRAM) base address.
Definition nrfy_mramc.h:95

Macro for mapping relative MRAMC offset to absolute address.

Parameters
[in]offsetOffset to map.

Typedef Documentation

◆ nrfx_mramc_evt_handler_t

typedef void(* nrfx_mramc_evt_handler_t) (nrf_mramc_event_t const event_type)

MRAMC driver event handler type.

Parameters
[in]event_typeMRAMC event.

Function Documentation

◆ nrfx_mramc_all_erase()

void nrfx_mramc_all_erase ( void )

Function for erasing the whole MRAM memory.

Note
All user code and UICR will be erased.

◆ nrfx_mramc_area_erase()

void nrfx_mramc_area_erase ( uint32_t address,
uint32_t size )

Function for erasing MRAM area in given MRAM words size.

Deprecated
Use nrfx_mramc_erase instead.
Parameters
[in]addressAddress to be erased.
[in]sizeSize to erase per number of NRF_MRAMC_BUS_SIZE in bytes.

◆ nrfx_mramc_buffer_read()

void nrfx_mramc_buffer_read ( void * dst,
uint32_t address,
uint32_t num_bytes )

Function for reading consecutive bytes from MRAM.

Parameters
[out]dstPointer to the buffer to store the data.
[in]addressAddress of the first byte to be read. Must be word-aligned.
[in]num_bytesNumber of bytes to be read.

◆ nrfx_mramc_config_erase_mode_set()

void nrfx_mramc_config_erase_mode_set ( nrf_mramc_mode_erase_t erase_mode)

Function for setting the MRAMC erase mode.

Parameters
[in]erase_modeOne of the enum in nrf_mramc_mode_erase_t.

◆ nrfx_mramc_config_write_mode_set()

void nrfx_mramc_config_write_mode_set ( nrf_mramc_mode_write_t write_mode)

Function for setting the MRAMC write mode.

Parameters
[in]write_modeOne of the enum in nrf_mramc_mode_write_t.

◆ nrfx_mramc_confignvr_perm_set()

void nrfx_mramc_confignvr_perm_set ( bool enable,
uint8_t page )

Function for setting the MRAMC NVR page write and erase permission,.

Note
: Setting enable allows nrf_mramc_readynext_timeout_t diret_write and preload_timeout to minimum, nrf_mramc_config_nvr_t PAGE[n] to be writtable and erasable.
Parameters
[in]enableTrue to enable write and erase permission of CONFIGNVR.PAGE[n], false to disable.
[in]pagePage number of CONFIGNVR.PAGE[0...n].

◆ nrfx_mramc_erase()

void nrfx_mramc_erase ( uint32_t address,
uint32_t num_words )

Function for erasing MRAM area in given 32-bit words size.

Parameters
[in]addressAddress to be erased.
[in]num_wordsNumber of 32-bit words to be erased.

◆ nrfx_mramc_fits_memory_check()

bool nrfx_mramc_fits_memory_check ( uint32_t addr,
bool uicr_allowed,
uint32_t bytes )

Function for checking if the address and size fit in MRAM memory.

Parameters
[in]addrAddress to be checked.
[in]uicr_allowedIf true, the UICR area is considered valid.
[in]bytesNumber of bytes to be checked.
Return values
trueAddress and size fit in memory.
falseAddress and size not fitting in memory.

◆ nrfx_mramc_init()

int nrfx_mramc_init ( nrfx_mramc_config_t const * p_config,
nrfx_mramc_evt_handler_t handler )

Function for initializing the MRAMC driver instance.

Parameters
[in]p_configPointer to the structure containing configuration.
[in]handlerEvent handler provided by the user.
Return values
0Initialization was successful.
-EALREADYThe driver has already been initialized.

◆ nrfx_mramc_memory_size_get()

uint32_t nrfx_mramc_memory_size_get ( void )

Function for getting the total MRAM size in bytes.

Note
The function will return FICR_INFO_MRAM_MRAM_Unspecified value if the total MRAM size cannot be determined based on the FICR data.
Returns
MRAM total size in bytes.

◆ nrfx_mramc_otp_word_read()

NRFX_STATIC_INLINE uint32_t nrfx_mramc_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
[in]indexAddress (index) in OTP table from which a word is to be read.
Return values
Thecontents at index.

◆ nrfx_mramc_otp_word_write()

NRFX_STATIC_INLINE bool nrfx_mramc_otp_word_write ( uint32_t index,
uint32_t value )

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

The OTP can only be written once after each Erase All is performed. This function checks if the value currently residing at the specified index can be transformed to the desired value. If yes, then performs the write operation.

Parameters
[in]indexAddress (index) in OTP table to which a word it to be written.
[in]valueValue to be written.
Return values
trueWord can be written into the specified OTP index address.
falseWord cannot be written into the specified OTP index address. Erase UICR or change index address.

◆ nrfx_mramc_ready_check()

NRFX_STATIC_INLINE bool nrfx_mramc_ready_check ( void )

Function for checking current MRAMC operation status.

The status is updated for all MRAMC operations.

Return values
trueCurrent operation is completed, and MRAMC is ready.
falseMRAMC is busy.

◆ nrfx_mramc_reconfigure()

int nrfx_mramc_reconfigure ( nrfx_mramc_config_t const * p_config)

Function for reconfiguring the MRAMC driver instance.

Parameters
[in]p_configPointer to the structure containing configuration.
Return values
0Reconfiguration was successful.
-EINPROGRESSThe driver is uninitialized.

◆ nrfx_mramc_valid_address_check()

bool nrfx_mramc_valid_address_check ( uint32_t addr,
bool uicr_allowed )

Function for checking if the address is valid.

Parameters
[in]addrAddress to be checked.
[in]uicr_allowedIf true, the UICR area is considered valid.
Return values
trueAddress is valid.
falseAddress is invalid.

◆ nrfx_mramc_word_read()

NRFX_STATIC_INLINE uint32_t nrfx_mramc_word_read ( uint32_t address)

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

Use this function in case accessing the MRAM gives the possibility to run the code in an environment where the MRAM is simulated.

Parameters
[in]addressAddress of the word to be read.
Returns
Value read from MRAM.

◆ nrfx_mramc_word_write()

void nrfx_mramc_word_write ( uint32_t address,
uint32_t value )

Function for writing a 32-bit word to MRAM.

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
[in]addressAddress to where data is to be written. Must be word-aligned.
[in]valueValue to be written.

◆ nrfx_mramc_words_write()

void nrfx_mramc_words_write ( uint32_t address,
void const * src,
uint32_t num_words )

Function for writing consecutive 32-bit words to MRAM.

Function uses direct write mode to write to MRAM directly.

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
[in]addressAddress to where data is to be written. Must be word-aligned.
[in]srcPointer to data to be copied. Must be word-aligned.
[in]num_wordsNumber of words to be written.