nrfx 4.5.0
Loading...
Searching...
No Matches
Helper layer for mapping VPR VIO pin indices

Helper layer that provides the mapping between GPIO pins and bit indices in VPR VIO registers. More...

Macros

#define NRF_VPR_IDX_FLPR   VPR_IDX_FLPR
 Symbol specifying the index of the VPR instance for FLPR.
#define NRF_VPR_IDX_PPR   VPR_IDX_PPR
 Symbol specifying the index of the VPR instance for PPR.
#define NRFX_VPR_VIO_PIN_NOT_PRESENT   UINT8_MAX
 Symbol specifying a pin that is not accessible by the VIO.
#define NRFX_VPR_VIO_PIN_PRESENT_CHECK(vpr_idx, port, pin)
 Macro for checking whether a pin is accessible by the VIO of a given VPR instance.
#define NRFX_VPR_VIO_PIN_INDEX_GET(vpr_idx, port, pin)
 Macro for getting the VIO bit index of a given pin.
#define NRFX_VPR_VIO_PIN_BIT_GET(vpr_idx, port, pin)
 Macro for getting the VIO register bit mask of a given pin.
#define NRFX_VPR_VIO_PORT_MASK_GET(vpr_idx, port)
 Macro for getting the VIO register bit mask of all pins of a given port.
#define NRFX_VPR_VIO_PORT_PIN_NUM_LOWEST(vpr_idx, port)
 Macro for getting the pin with the lowest number which is accessible by the VIO of the specified VPR instance.
#define NRFX_VPR_VIO_PORT_PIN_NUM_HIGHEST(vpr_idx, port)
 Macro for getting the pin with the highest number which is accessible by the VIO of the specified VPR instance.
#define NRFX_VPR_VIO_PORT_ACCESSIBLE_CHECK(vpr_idx, port)
 Macro for checking whether the specified port is accessible by the VIO of the specified VPR instance.
#define NRFX_VPR_VIO_MAPPING_DEFINED_CHECK(vpr_idx)
 Macro for checking whether there is a definition of VIO pin mapping associated with the specified VPR instance.
#define NRFX_VPR_VIO_FOR_EACH_PIN(vpr_idx, F, sep)
 Macro for calling a macro F for each GPIO pin that can be accessed by the specified VPR VIO instance.
#define NRFX_VPR_VIO_FOR_EACH_VIO_PIN(vpr_idx, vio_idx, F, sep)
 Macro for calling a macro F for each GPIO pin corresponding to a given VIO index in the specified VPR VIO instance.
#define NRFX_VPR_VIO_PRESENT_CHECK(vpr_idx, vio_idx)
 Macro for checking whether there exists a mapping for a given VIO index in the specified VPR VIO instance.
#define NRFX_VPR_VIO_PRESENT_COUNT_GET(vpr_idx)
 Macro for getting the number of VIO indices for which pin mapping has been defined.
#define NRFX_VPR_VIO_MAPPED_PORT_COUNT_GET(vpr_idx)
 Macro for getting the number of GPIO ports for which pin mapping has been defined.

Detailed Description

Helper layer that provides the mapping between GPIO pins and bit indices in VPR VIO registers.

The mapping is resolved entirely by the preprocessor. Therefore it can be used in constant expressions, such as static assertions or array sizes, and it occupies neither code nor data memory.

The VPR instance is specified by its index, for example 121, and not by a pointer to its registers.

The mapping itself is declared per SoC in nrfx_soc_defines.h.

Macro Definition Documentation

◆ NRFX_VPR_VIO_FOR_EACH_PIN

#define NRFX_VPR_VIO_FOR_EACH_PIN ( vpr_idx,
F,
sep )
Value:
(NRFX_FOR_EACH_FIXED_ARG(_NRFX_VPR_VIO_FOR_EACH_PIN_DEBRACKET, \
sep, (vpr_idx, F), \
_NRFX_VPR_VIO_ACCESSIBLE_PORT_PINS_LIST(vpr_idx))), \
())
#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:667
#define NRFX_FOR_EACH_FIXED_ARG(F, sep, fixed_arg,...)
Macro for calling macro F on each provided argument, with an additional fixed argument as a parameter...
Definition nrfx_utils.h:867
#define NRFX_VPR_VIO_MAPPING_DEFINED_CHECK(vpr_idx)
Macro for checking whether there is a definition of VIO pin mapping associated with the specified VPR...
Definition nrfx_vpr_vio_pins.h:448

Macro for calling a macro F for each GPIO pin that can be accessed by the specified VPR VIO instance.

Example:

struct vpr_pin_info
{
uint8_t port;
uint8_t pin;
};
#define GET_PIN_INFO(_vpr_idx, _port, _pin) { .port = _port, .pin = _pin }
struct vpr_pin_info my_vio_pins[] =
{
NRFX_VPR_VIO_FOR_EACH_PIN(121, GET_PIN_INFO, (,))
};
#define NRFX_VPR_VIO_FOR_EACH_PIN(vpr_idx, F, sep)
Macro for calling a macro F for each GPIO pin that can be accessed by the specified VPR VIO instance.
Definition nrfx_vpr_vio_pins.h:497

This expands to:

struct vpr_pin_info my_vio_pins[] =
{
{ .port = 1, .pin = 8 },
{ .port = 1, .pin = 9 },
...
};
Parameters
[in]vpr_idxIndex of the VPR instance.
[in]FMacro to invoke. The macro is passed three arguments: VPR index, port, and pin.
[in]sepSeparator (e.g. comma or semicolon). Must be in parentheses.
Note
This macro internally uses NRFX_LISTIFY and NRFX_FOR_EACH macros, which cannot be nested. Therefore, using this macro within another invocation of NRFX_LISTIFY or NRFX_FOR_EACH results in a compilation error.

◆ NRFX_VPR_VIO_FOR_EACH_VIO_PIN

#define NRFX_VPR_VIO_FOR_EACH_VIO_PIN ( vpr_idx,
vio_idx,
F,
sep )
Value:
NRFX_FOR_EACH(_NRFX_VPR_VIO_FOR_EACH_VIO_PIN_COMMA_SEP_DEBRACKET, sep, \
_NRFX_VPR_VIO_FOR_EACH_VIO_PIN_COMMA_SEP(vpr_idx, vio_idx, F))
#define NRFX_FOR_EACH(F, sep,...)
Macro for calling a macro F on each provided argument with a given separator between each call.
Definition nrfx_utils.h:812

Macro for calling a macro F for each GPIO pin corresponding to a given VIO index in the specified VPR VIO instance.

Example:

#define GET_PIN_INFO(_vpr_idx, _port, _pin) { .port = _port, .pin = _pin }
struct vpr_pin_info my_vio_pins[] =
{
NRFX_VPR_VIO_FOR_EACH_VIO_PIN(121, 3, GET_PIN_INFO, (,))
};
#define NRFX_VPR_VIO_FOR_EACH_VIO_PIN(vpr_idx, vio_idx, F, sep)
Macro for calling a macro F for each GPIO pin corresponding to a given VIO index in the specified VPR...
Definition nrfx_vpr_vio_pins.h:540

This expands to:

struct vpr_pin_info my_vio_pins[] =
{
{ .port = 1, .pin = 11 },
{ .port = 6, .pin = 5 },
...
};
Parameters
[in]vpr_idxIndex of the VPR instance.
[in]vio_idxIndex in the VIO registers of the specified VPR instance.
[in]FMacro to invoke. The macro is passed three arguments: VPR index, port, and pin.
[in]sepSeparator (e.g. comma or semicolon). Must be in parentheses.
Note
This macro internally uses NRFX_LISTIFY and NRFX_FOR_EACH macros, which cannot be nested. Therefore, using this macro within another invocation of NRFX_LISTIFY or NRFX_FOR_EACH results in a compilation error.

◆ NRFX_VPR_VIO_MAPPED_PORT_COUNT_GET

#define NRFX_VPR_VIO_MAPPED_PORT_COUNT_GET ( vpr_idx)
Value:
NRFX_NUM_VA_ARGS_LESS_1(_NRFX_VPR_VIO_PORT_LIST_GET(vpr_idx))
#define NRFX_NUM_VA_ARGS_LESS_1(...)
Macro for calculating number of arguments in the variable arguments list minus one.
Definition nrfx_utils.h:761

Macro for getting the number of GPIO ports for which pin mapping has been defined.

Parameters
[in]vpr_idxIndex of the VPR instance.
Note
This macro internally uses NRFX_LISTIFY, which cannot be nested. Therefore, using this macro within another NRFX_LISTIFY invocation results in a compilation error.
Returns
Number of VIO indices.

◆ NRFX_VPR_VIO_MAPPING_DEFINED_CHECK

#define NRFX_VPR_VIO_MAPPING_DEFINED_CHECK ( vpr_idx)
Value:
_NRFX_GET_ARG1( \
NRFX_FOR_EACH_FIXED_ARG(_NRFX_VPR_VIO_MAPPING_DEFINED_LIST, \
(), vpr_idx, \
NRFX_LISTIFY(_NRFX_VPR_VIO_PORT_MAX_COUNT, \
_NRFX_GET_ARG1, (,))) \
0 \
)
#define NRFX_LISTIFY(LEN, F, sep,...)
Macro for generating a sequence of code with configurable separator.
Definition nrfx_utils.h:735

Macro for checking whether there is a definition of VIO pin mapping associated with the specified VPR instance.

Parameters
[in]vpr_idxIndex of the VPR instance, for example 121.
Note
This macro internally uses NRFX_LISTIFY and NRFX_FOR_EACH macros, which cannot be nested. Therefore, using this macro within another invocation of NRFX_LISTIFY or NRFX_FOR_EACH results in a compilation error.
Return values
1If the mapping is defined.
0If the mapping is not defined.

◆ NRFX_VPR_VIO_PIN_BIT_GET

#define NRFX_VPR_VIO_PIN_BIT_GET ( vpr_idx,
port,
pin )
Value:
((1UL << _NRFX_VPR_VIO_PIN_SYMBOL(vpr_idx, port, pin))), \
(0UL))
#define NRFX_VPR_VIO_PIN_PRESENT_CHECK(vpr_idx, port, pin)
Macro for checking whether a pin is accessible by the VIO of a given VPR instance.
Definition nrfx_vpr_vio_pins.h:321

Macro for getting the VIO register bit mask of a given pin.

Parameters
[in]vpr_idxIndex of the VPR instance, for example 121.
[in]portPort number of the pin.
[in]pinPin number within the port.
Returns
Mask with the bit that corresponds to the specified pin set, or 0 if the pin is not accessible by the VIO.

◆ NRFX_VPR_VIO_PIN_INDEX_GET

#define NRFX_VPR_VIO_PIN_INDEX_GET ( vpr_idx,
port,
pin )
Value:
(NRFX_DEBRACKET _NRFX_VPR_VIO_PIN_SYMBOL(vpr_idx, port, pin)), \
#define NRFX_VPR_VIO_PIN_NOT_PRESENT
Symbol specifying a pin that is not accessible by the VIO.
Definition nrfx_vpr_vio_pins.h:309

Macro for getting the VIO bit index of a given pin.

Parameters
[in]vpr_idxIndex of the VPR instance, for example 121.
[in]portPort number of the pin.
[in]pinPin number within the port.
Returns
Index of the bit in the VIO registers that corresponds to the specified pin, or NRFX_VPR_VIO_PIN_NOT_PRESENT if the pin is not accessible by the VIO.

◆ NRFX_VPR_VIO_PIN_PRESENT_CHECK

#define NRFX_VPR_VIO_PIN_PRESENT_CHECK ( vpr_idx,
port,
pin )
Value:
NRFX_ARG_HAS_PARENTHESIS(_NRFX_VPR_VIO_PIN_SYMBOL(vpr_idx, port, pin))
#define NRFX_ARG_HAS_PARENTHESIS(x)
Macro for checking if argument starts with opening round bracket and contains matching closing bracke...
Definition nrfx_utils.h:789

Macro for checking whether a pin is accessible by the VIO of a given VPR instance.

Parameters
[in]vpr_idxIndex of the VPR instance, for example 121.
[in]portPort number of the pin.
[in]pinPin number within the port.
Return values
1If the pin is accessible by the VIO.
0If the pin is not accessible by the VIO.

◆ NRFX_VPR_VIO_PORT_ACCESSIBLE_CHECK

#define NRFX_VPR_VIO_PORT_ACCESSIBLE_CHECK ( vpr_idx,
port )
Value:
_NRFX_GET_ARG1( \
NRFX_LISTIFY(_NRFX_VPR_VIO_PORT_PIN_MAX_COUNT, \
_NRFX_VPR_VIO_PORT_ACCESSIBLE_LIST, \
(), vpr_idx, port) \
0 \
)

Macro for checking whether the specified port is accessible by the VIO of the specified VPR instance.

Parameters
[in]vpr_idxIndex of the VPR instance, for example 121.
[in]portPort number.
Note
This macro internally uses NRFX_LISTIFY, which cannot be nested. Therefore, using this macro within another NRFX_LISTIFY invocation results in a compilation error.
Return values
1If the port can be accessed.
0If the port cannot be accessed.

◆ NRFX_VPR_VIO_PORT_MASK_GET

#define NRFX_VPR_VIO_PORT_MASK_GET ( vpr_idx,
port )
Value:
(NRFX_LISTIFY(_NRFX_VPR_VIO_PORT_PIN_MAX_COUNT, _NRFX_VPR_VIO_PIN_BIT, (|), \
vpr_idx, port))

Macro for getting the VIO register bit mask of all pins of a given port.

Parameters
[in]vpr_idxIndex of the VPR instance, for example 121.
[in]portPort number.
Note
This macro internally uses NRFX_LISTIFY, which cannot be nested. Therefore, using this macro within another NRFX_LISTIFY invocation results in a compilation error.
Returns
Mask with the bits that correspond to all pins of the specified port that are accessible by the VIO set, or 0 if none of the pins of the port are accessible by the VIO.

◆ NRFX_VPR_VIO_PORT_PIN_NUM_HIGHEST

#define NRFX_VPR_VIO_PORT_PIN_NUM_HIGHEST ( vpr_idx,
port )
Value:
_NRFX_GET_ARG1( \
NRFX_LISTIFY(_NRFX_VPR_VIO_PORT_PIN_MAX_COUNT, \
_NRFX_VPR_VIO_PIN_NUM_LIST_COMMA_FIRST, \
(), vpr_idx, port)))
#define NRFX_REVERSE_ARGS(...)
Macro for reversing arguments order.
Definition nrfx_utils.h:905

Macro for getting the pin with the highest number which is accessible by the VIO of the specified VPR instance.

Parameters
[in]vpr_idxIndex of the VPR instance, for example 121.
[in]portPort number.
Note
This macro internally uses NRFX_LISTIFY and NRFX_FOR_EACH macros, which cannot be nested. Therefore, using this macro within another invocation of NRFX_LISTIFY or NRFX_FOR_EACH results in a compilation error.
Returns
Pin number, or NRFX_VPR_VIO_PIN_NOT_PRESENT if none of the pins of the port are accessible by the VIO.

◆ NRFX_VPR_VIO_PORT_PIN_NUM_LOWEST

#define NRFX_VPR_VIO_PORT_PIN_NUM_LOWEST ( vpr_idx,
port )
Value:
_NRFX_GET_ARG1( \
NRFX_LISTIFY(_NRFX_VPR_VIO_PORT_PIN_MAX_COUNT, \
_NRFX_VPR_VIO_PIN_NUM_LIST_PIN_FIRST, \
(), vpr_idx, port) \

Macro for getting the pin with the lowest number which is accessible by the VIO of the specified VPR instance.

Parameters
[in]vpr_idxIndex of the VPR instance, for example 121.
[in]portPort number.
Note
This macro internally uses NRFX_LISTIFY, which cannot be nested. Therefore, using this macro within another NRFX_LISTIFY invocation results in a compilation error.
Returns
Pin number, or NRFX_VPR_VIO_PIN_NOT_PRESENT if none of the pins of the port are accessible by the VIO.

◆ NRFX_VPR_VIO_PRESENT_CHECK

#define NRFX_VPR_VIO_PRESENT_CHECK ( vpr_idx,
vio_idx )
Value:
NRFX_VPR_VIO_FOR_EACH_VIO_PIN(vpr_idx, vio_idx, _NRFX_GET_ARG1, ())))
#define NRFX_IS_EMPTY(arg)
Macro for checking if input argument is empty.
Definition nrfx_utils.h:752
#define NRFX_NOT(x)
Macro for logically negating the value of an expression at C preprocessor time.
Definition nrfx_utils.h:987

Macro for checking whether there exists a mapping for a given VIO index in the specified VPR VIO instance.

Parameters
[in]vpr_idxIndex of the VPR instance.
[in]vio_idxIndex in the VIO registers of the specified VPR instance.
Note
This macro internally uses NRFX_LISTIFY and NRFX_FOR_EACH macros, which cannot be nested. Therefore, using this macro within another invocation of NRFX_LISTIFY or NRFX_FOR_EACH results in a compilation error.
Return values
1If the mapping exists.
0If the mapping doesn't exist.

◆ NRFX_VPR_VIO_PRESENT_COUNT_GET

#define NRFX_VPR_VIO_PRESENT_COUNT_GET ( vpr_idx)
Value:
NRFX_NUM_VA_ARGS_LESS_1(_NRFX_VPR_VIO_LIST_GET(vpr_idx))

Macro for getting the number of VIO indices for which pin mapping has been defined.

Parameters
[in]vpr_idxIndex of the VPR instance.
Note
This macro internally uses NRFX_LISTIFY, which cannot be nested. Therefore, using this macro within another NRFX_LISTIFY invocation results in a compilation error.
Returns
Number of VIO indices.