Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
nrf_clock_control.h File Reference

Go to the source code of this file.

Macros

#define NRF_PERIPH_GET_FREQUENCY(node)
 Get clock frequency that is used for the given node.
 

Macro Definition Documentation

◆ NRF_PERIPH_GET_FREQUENCY

#define NRF_PERIPH_GET_FREQUENCY ( node)
Value:
(COND_CODE_1(DT_NODE_HAS_PROP(DT_CLOCKS_CTLR(node), clock_frequency), \
(DT_PROP(DT_CLOCKS_CTLR(node), clock_frequency)), \
(DT_PROP_LAST(DT_CLOCKS_CTLR(node), supported_clock_frequency)))), \
(NRFX_MHZ_TO_HZ(16)))
#define DT_CLOCKS_CTLR(node_id)
Equivalent to DT_CLOCKS_CTLR_BY_IDX(node_id, 0)
Definition clocks.h:146
#define DT_CLOCKS_HAS_IDX(node_id, idx)
Test if a node has a clocks phandle-array property at a given index.
Definition clocks.h:52
#define DT_NODE_HAS_PROP(node_id, prop)
Does a devicetree node have a property?
Definition devicetree.h:3744
#define DT_PROP_LAST(node_id, prop)
Get the last element of an array type property.
Definition devicetree.h:909
#define DT_PROP(node_id, prop)
Get a devicetree property value.
Definition devicetree.h:752
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition util_macro.h:203

Get clock frequency that is used for the given node.

Macro checks if node has clock property and if yes then if clock has clock_frequency property then it is returned. If it has supported_clock_frequency property with the list of supported frequencies then the last one is returned with assumption that they are ordered and the last one is the highest. If node does not have clock then 16 MHz is returned which is the default frequency.

Parameters
nodeDevicetree node.
Returns
Frequency of the clock that is used for the node.