nrfx 3.3
Macros
Utility macros and functions for saving and restoring peripherals

Utility macros and functions for saving and restoring peripherals. More...

Macros

#define NRFX_SR_VDMA_REG_ADDR(_inst, _reg, _array)    NRFX_COND_CODE_1(_array, (), (&))NRFX_CONCAT(NRF_, _inst)->_reg
 Macro for returning an address of a register in the instance.
 
#define NRFX_SR_VDMA_INST_REG_JOB(_inst, _regs, _len, _array)    NRFX_VDMA_PERIPH_JOB(NRFX_SR_VDMA_REG_ADDR(_inst, _regs, _array), _len),
 Macro for creating a VDMA job for transfering data from a register set.
 
#define NRFX_SR_VDMA_INST_SET_JOB(_inst, _regs, _array)    NRFX_SR_VDMA_INST_REG_JOB(_inst, _regs, sizeof(NRFX_CONCAT(NRF_, _inst)->_regs), _array)
 Macro for creating a VDMA job for transfering data from a register structure.
 
#define NRFX_SR_VDMA_INST_COND_REG_JOB(_inst, _feature, _regs, _len, _array)
 Macro for conditionally creating a VDMA job for transfering data from a register set.
 
#define NRFX_SR_VDMA_INST_COND_SET_JOB(_inst, _feature, _regs, _array)
 Macro for conditionally creating a VDMA job for transfering data from a register structure.
 
#define NRFX_SR_VDMA_INST_COND_LEN(_inst, _feature, _len)    NRFX_COND_CODE_1(NRFX_CONCAT(_inst, _, _feature), (_len), (0))
 Macro for conditionally returning a length.
 
#define NRFX_SR_VDMA_INST_COND_SET_LEN(_inst, _feature, _regs)    NRFX_SR_VDMA_INST_COND_LEN(_inst, _feature, sizeof(NRFX_CONCAT(NRF_, _inst)->_regs))
 Macro for conditionally calculating length of a structure in a register set.
 
#define NRFX_SR_VDMA_INST_SET_LEN(_inst, _regs)    sizeof(NRFX_CONCAT(NRF_, _inst)->_regs)
 Macro for calculating length of a structure in a register set.
 
#define NRFX_SR_VDMA_JOB(periph)   NRFX_CONCAT(NRFX_SR_VDMA_, periph, _JOB)()
 Macro for generating a VDMA job descriptor for storing or restoring state of all instances of a given peripheral.
 
#define NRFX_SR_VDMA_LEN(periph)   NRFX_CONCAT(NRFX_SR_VDMA_, periph, _LEN)()
 Macro for calculating size of the buffer needed to store state of all instances of a given peripheral.
 

Detailed Description

Utility macros and functions for saving and restoring peripherals.

Macro Definition Documentation

◆ NRFX_SR_VDMA_INST_COND_LEN

#define NRFX_SR_VDMA_INST_COND_LEN (   _inst,
  _feature,
  _len 
)     NRFX_COND_CODE_1(NRFX_CONCAT(_inst, _, _feature), (_len), (0))

Macro for conditionally returning a length.

Macro returns input _len if there is a define formed of concatenation of an instance name and a feature name (e.g. SPU010_BELLS where SPU010 is _inst and BELLS is a _feature) set to 1.

Parameters
[in]_instInstance name, e.g. SPU100.
[in]_featureFeature name as used in peripherals.h file.
[in]_lenName of a register set associated with the given feature.
Returns
_len or 0 is feature define is not set or does not exist.

◆ NRFX_SR_VDMA_INST_COND_REG_JOB

#define NRFX_SR_VDMA_INST_COND_REG_JOB (   _inst,
  _feature,
  _regs,
  _len,
  _array 
)
Value:
NRFX_COND_CODE_1(NRFX_CONCAT(_inst, _, _feature), \
(NRFX_SR_VDMA_INST_REG_JOB(_inst, _regs, _len, _array)), \
())
#define NRFX_SR_VDMA_INST_REG_JOB(_inst, _regs, _len, _array)
Macro for creating a VDMA job for transfering data from a register set.
Definition: nrfx_sr_vdma.h:46
#define NRFX_COND_CODE_1(_flag, _if_1_code, _else_code)
Macro for inserting code depending on whether _flag exists and expands to 1 or not.
Definition: nrfx_utils.h:58
#define NRFX_CONCAT(...)
Macro for concatenating multiple arguments.
Definition: nrfx_utils.h:168

Macro for conditionally creating a VDMA job for transfering data from a register set.

Job is created only if there is a define formed of concatenation of an instance name and a feature name (e.g. SPU010_BELLS where SPU010 is _inst and BELLS is a _feature) set to 1.

Parameters
[in]_instInstance, e.g. SPU010.
[in]_featureFeature name as used in _peripherals.h.
[in]_regsName of a starting register.
[in]_lenLength of the transfer.
[in]_arrayIndication whether provided structure is an array or not. Set to 1 to indicate that it is an array.
Returns
A comma terminated MVDMA job descriptor if condition is met or nothing.

◆ NRFX_SR_VDMA_INST_COND_SET_JOB

#define NRFX_SR_VDMA_INST_COND_SET_JOB (   _inst,
  _feature,
  _regs,
  _array 
)
Value:
NRFX_SR_VDMA_INST_COND_REG_JOB(_inst, _feature, _regs, \
sizeof(NRFX_CONCAT(NRF_, _inst)->_regs), _array)
#define NRFX_SR_VDMA_INST_COND_REG_JOB(_inst, _feature, _regs, _len, _array)
Macro for conditionally creating a VDMA job for transfering data from a register set.
Definition: nrfx_sr_vdma.h:78

Macro for conditionally creating a VDMA job for transfering data from a register structure.

Job is created only if there is a define formed of concatenation of an instance name and a feature name (e.g. SPU010_BELLS where SPU010 is _inst and BELLS is a _feature) set to 1.

Parameters
[in]_instInstance, e.g. SPU010.
[in]_featureFeature name as used in _peripherals.h.
[in]_regsName of a feature register set name.
[in]_arrayIndication whether provided structure is an array or not. Set to 1 to indicate that it is an array.
Returns
A comma terminated MVDMA job descriptor if condition is met or nothing.

◆ NRFX_SR_VDMA_INST_COND_SET_LEN

#define NRFX_SR_VDMA_INST_COND_SET_LEN (   _inst,
  _feature,
  _regs 
)     NRFX_SR_VDMA_INST_COND_LEN(_inst, _feature, sizeof(NRFX_CONCAT(NRF_, _inst)->_regs))

Macro for conditionally calculating length of a structure in a register set.

Macro returns size of a struct if there is a define formed of concatenation of an instance name and a feature name (e.g. SPU010_BELLS where SPU010 is _inst and BELLS is a _feature) set to 1.

Parameters
[in]_instInstance name, e.g. SPU100.
[in]_featureFeature name as used in peripherals.h file.
[in]_regsName of a register set associated with the given feature.
Returns
Size of a structure or 0 is feature define is not set or does not exist.

◆ NRFX_SR_VDMA_INST_REG_JOB

#define NRFX_SR_VDMA_INST_REG_JOB (   _inst,
  _regs,
  _len,
  _array 
)     NRFX_VDMA_PERIPH_JOB(NRFX_SR_VDMA_REG_ADDR(_inst, _regs, _array), _len),

Macro for creating a VDMA job for transfering data from a register set.

Parameters
[in]_instInstance, e.g. SPU010.
[in]_regsName of a starting register.
[in]_lenLength of the transfer.
[in]_arrayIndication whether provided structure is an array or not. Set to 1 to indicate that it is an array.
Returns
A comma terminated MVDMA job descriptor.

◆ NRFX_SR_VDMA_INST_SET_JOB

#define NRFX_SR_VDMA_INST_SET_JOB (   _inst,
  _regs,
  _array 
)     NRFX_SR_VDMA_INST_REG_JOB(_inst, _regs, sizeof(NRFX_CONCAT(NRF_, _inst)->_regs), _array)

Macro for creating a VDMA job for transfering data from a register structure.

Parameters
[in]_instInstance, e.g. SPU010.
[in]_regsName of a feature register set name.
[in]_arrayIndication whether provided structure is an array or not. Set to 1 to indicate that it is an array.
Returns
A comma terminated MVDMA job descriptor.

◆ NRFX_SR_VDMA_INST_SET_LEN

#define NRFX_SR_VDMA_INST_SET_LEN (   _inst,
  _regs 
)     sizeof(NRFX_CONCAT(NRF_, _inst)->_regs)

Macro for calculating length of a structure in a register set.

Parameters
[in]_instInstance name, e.g. SPU100.
[in]_regsName of a register set associated with the given feature.
Returns
Size of a structure.

◆ NRFX_SR_VDMA_JOB

#define NRFX_SR_VDMA_JOB (   periph)    NRFX_CONCAT(NRFX_SR_VDMA_, periph, _JOB)()

Macro for generating a VDMA job descriptor for storing or restoring state of all instances of a given peripheral.

Sum of length of all transfers must equal length calculated by NRFX_SR_VDMA_LEN.

Macro attempts to call NRFX_SR_VDMA_<periph_name>_JOB macro with empty list of arguments. Such macro must exist or compilation will fail.

Return value can be used to initialize an array of jobs.

Parameters
[in]periphPeripheral name, e.g. SPU.
Returns
List of all job descriptor ending with a comma without null termination.

◆ NRFX_SR_VDMA_LEN

#define NRFX_SR_VDMA_LEN (   periph)    NRFX_CONCAT(NRFX_SR_VDMA_, periph, _LEN)()

Macro for calculating size of the buffer needed to store state of all instances of a given peripheral.

Macro attempts to call NRFX_SR_VDMA_<periph_name>_LEN macro with empty list of arguments. Such macro must exist or compilation will fail.

Parameters
[in]periphPeripheral name, e.g. SPU.
Returns
Number of bytes needed for storing state of all instances.

◆ NRFX_SR_VDMA_REG_ADDR

#define NRFX_SR_VDMA_REG_ADDR (   _inst,
  _reg,
  _array 
)     NRFX_COND_CODE_1(_array, (), (&))NRFX_CONCAT(NRF_, _inst)->_reg

Macro for returning an address of a register in the instance.

Parameters
[in]_instInstance, e.g. SPU010.
[in]_regRegister name.
[in]_arrayIndication whether provided structure is an array or not. Set to 1 to indicate that it is an array. It is needed to determine if an ampersand must be added.
Returns
Address of a register in the instance.

Documentation feedback | Developer Zone | Subscribe | Updated