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

Common definitions for clock control emul. More...

Go to the source code of this file.

Data Structures

union  clock_control_emul_subsys
 Storage for the different subsystem selector representations. More...

Macros

#define CLOCK_CONTROL_SUBSYS_MATCH_1CELL(compat)
 Define a subsystem matcher for a one-cell clock selector.
#define CLOCK_CONTROL_RATE_TO_VALUE_1CELL(compat)
 Define a rate converter for a one-cell clock selector.
#define CLOCK_CONTROL_SUBSYS_1CELL(compat)
 Define a subsystem converter for a one-cell clock selector.
#define CLOCK_CONTROL_EMUL_DEFINE_1CELL(compat)
 Define all hooks for a one-cell clock controller compatible.

Functions

static bool clock_control_emul_1cell_subsys_match (clock_control_subsys_t sys, const uint32_t *cells, size_t num_cells)
 Match a one-cell clock selector against a subsystem.
static int clock_control_emul_1cell_rate_to_value (clock_control_subsys_rate_t rate, uint32_t *value)
 Convert a subsystem rate to a one-cell value.
static clock_control_subsys_t clock_control_emul_1cell_cells_to_subsys (const uint32_t *cells, union clock_control_emul_subsys *storage)
 Convert one clock-id cell to a subsystem selector.
static bool zephyr_clock_controller_emul_id_subsys_match (clock_control_subsys_t sys, const uint32_t *cells, size_t num_cells)
 Match a one-cell clock selector against a subsystem.
static int zephyr_clock_controller_emul_id_rate_to_value (clock_control_subsys_rate_t rate, uint32_t *value)
 Convert a subsystem rate to a one-cell value.
static clock_control_subsys_t zephyr_clock_controller_emul_id_cells_to_subsys (const uint32_t *cells, union clock_control_emul_subsys *storage)
 Convert one clock-id cell to a subsystem selector.
static bool zephyr_clock_controller_emul_clkid_subsys_match (clock_control_subsys_t sys, const uint32_t *cells, size_t num_cells)
 Match a one-cell clock selector against a subsystem.
static int zephyr_clock_controller_emul_clkid_rate_to_value (clock_control_subsys_rate_t rate, uint32_t *value)
 Convert a subsystem rate to a one-cell value.
static clock_control_subsys_t zephyr_clock_controller_emul_clkid_cells_to_subsys (const uint32_t *cells, union clock_control_emul_subsys *storage)
 Convert one clock-id cell to a subsystem selector.
static bool zephyr_clock_controller_emul_clk_id_subsys_match (clock_control_subsys_t sys, const uint32_t *cells, size_t num_cells)
 Match a one-cell clock selector against a subsystem.
static int zephyr_clock_controller_emul_clk_id_rate_to_value (clock_control_subsys_rate_t rate, uint32_t *value)
 Convert a subsystem rate to a one-cell value.
static clock_control_subsys_t zephyr_clock_controller_emul_clk_id_cells_to_subsys (const uint32_t *cells, union clock_control_emul_subsys *storage)
 Convert one clock-id cell to a subsystem selector.
static bool zephyr_clock_controller_emul_rcar_cpg_mssr_subsys_match (clock_control_subsys_t sys, const uint32_t *cells, size_t num_cells)
 Match an R-Car CPG/MSSR selector against devicetree cells.
static int zephyr_clock_controller_emul_rcar_cpg_mssr_rate_to_value (clock_control_subsys_rate_t rate, uint32_t *value)
 Convert an R-Car CPG/MSSR rate to a stored value.
static clock_control_subsys_t zephyr_clock_controller_emul_rcar_cpg_mssr_cells_to_subsys (const uint32_t *cells, union clock_control_emul_subsys *storage)
 Build an R-Car CPG/MSSR selector from devicetree cells.

Detailed Description

Common definitions for clock control emul.

Each supported compatible provides three functions, named after the devicetree compatible token so that the driver can reach them with UTIL_CAT():

  • [compat]_subsys_match() tells whether a subsystem selector refers to a given entry of the clock-ids property,
  • [compat]_rate_to_value() converts a rate argument to a plain value,
  • [compat]_cells_to_subsys() builds a subsystem selector out of the cells of one clock-ids entry.

The last one lets a caller drive any variant from its devicetree data alone, without knowing how many cells the selector has or what type it is.

Macro Definition Documentation

◆ CLOCK_CONTROL_EMUL_DEFINE_1CELL

#define CLOCK_CONTROL_EMUL_DEFINE_1CELL ( compat)
Value:
CLOCK_CONTROL_RATE_TO_VALUE_1CELL(compat) \
CLOCK_CONTROL_SUBSYS_1CELL(compat)
#define CLOCK_CONTROL_SUBSYS_MATCH_1CELL(compat)
Define a subsystem matcher for a one-cell clock selector.
Definition clock_control_emul.h:94

Define all hooks for a one-cell clock controller compatible.

Parameters
compatToken naming the devicetree compatible and generated hook functions.

◆ CLOCK_CONTROL_RATE_TO_VALUE_1CELL

#define CLOCK_CONTROL_RATE_TO_VALUE_1CELL ( compat)
Value:
\
static inline int compat##_rate_to_value(clock_control_subsys_rate_t rate, \
uint32_t *value) \
{ \
}
static int clock_control_emul_1cell_rate_to_value(clock_control_subsys_rate_t rate, uint32_t *value)
Convert a subsystem rate to a one-cell value.
Definition clock_control_emul.h:66
void * clock_control_subsys_rate_t
Opaque handle identifying the rate of a clock controller subsystem.
Definition clock_control.h:73
__UINT32_TYPE__ uint32_t
Definition stdint.h:90

Define a rate converter for a one-cell clock selector.

Parameters
compatToken used to form the generated function name.

◆ CLOCK_CONTROL_SUBSYS_1CELL

#define CLOCK_CONTROL_SUBSYS_1CELL ( compat)
Value:
\
static inline clock_control_subsys_t compat##_cells_to_subsys( \
const uint32_t *cells, union clock_control_emul_subsys *storage) \
{ \
return clock_control_emul_1cell_cells_to_subsys(cells, storage); \
}
static clock_control_subsys_t clock_control_emul_1cell_cells_to_subsys(const uint32_t *cells, union clock_control_emul_subsys *storage)
Convert one clock-id cell to a subsystem selector.
Definition clock_control_emul.h:81
void * clock_control_subsys_t
Opaque handle identifying a clock controller subsystem.
Definition clock_control.h:65
Storage for the different subsystem selector representations.
Definition clock_control_emul.h:36

Define a subsystem converter for a one-cell clock selector.

Parameters
compatToken used to form the generated function name.

◆ CLOCK_CONTROL_SUBSYS_MATCH_1CELL

#define CLOCK_CONTROL_SUBSYS_MATCH_1CELL ( compat)
Value:
\
static inline bool compat##_subsys_match(clock_control_subsys_t sys, \
const uint32_t *cells, size_t num_cells) \
{ \
return clock_control_emul_1cell_subsys_match(sys, cells, num_cells); \
}
static bool clock_control_emul_1cell_subsys_match(clock_control_subsys_t sys, const uint32_t *cells, size_t num_cells)
Match a one-cell clock selector against a subsystem.
Definition clock_control_emul.h:53

Define a subsystem matcher for a one-cell clock selector.

Parameters
compatToken used to form the generated function name.

Function Documentation

◆ clock_control_emul_1cell_cells_to_subsys()

clock_control_subsys_t clock_control_emul_1cell_cells_to_subsys ( const uint32_t * cells,
union clock_control_emul_subsys * storage )
inlinestatic

Convert one clock-id cell to a subsystem selector.

Parameters
cellsOne-cell clock identifier from the devicetree clock-ids property.
storageStorage for a structured selector; unused by this scalar variant.
Returns
The scalar subsystem selector encoded by cells[0].

◆ clock_control_emul_1cell_rate_to_value()

int clock_control_emul_1cell_rate_to_value ( clock_control_subsys_rate_t rate,
uint32_t * value )
inlinestatic

Convert a subsystem rate to a one-cell value.

Parameters
rateScalar rate encoded in the opaque subsystem-rate pointer.
[out]valueConverted rate value.
Return values
0Conversion succeeds.

◆ clock_control_emul_1cell_subsys_match()

bool clock_control_emul_1cell_subsys_match ( clock_control_subsys_t sys,
const uint32_t * cells,
size_t num_cells )
inlinestatic

Match a one-cell clock selector against a subsystem.

Parameters
sysSubsystem selector encoded as a scalar clock identifier.
cellsOne-cell clock identifier from the devicetree clock-ids property.
num_cellsNumber of cells in cells; must be one.
Returns
true if sys matches the clock identifier in cells, or false otherwise.

◆ zephyr_clock_controller_emul_clk_id_cells_to_subsys()

clock_control_subsys_t zephyr_clock_controller_emul_clk_id_cells_to_subsys ( const uint32_t * cells,
union clock_control_emul_subsys * storage )
inlinestatic

Convert one clock-id cell to a subsystem selector.

Parameters
cellsOne-cell clock identifier from the devicetree clock-ids property.
storageStorage for a structured selector; unused by this scalar variant.
Returns
The scalar subsystem selector encoded by cells[0].

◆ zephyr_clock_controller_emul_clk_id_rate_to_value()

int zephyr_clock_controller_emul_clk_id_rate_to_value ( clock_control_subsys_rate_t rate,
uint32_t * value )
inlinestatic

Convert a subsystem rate to a one-cell value.

Parameters
rateScalar rate encoded in the opaque subsystem-rate pointer.
[out]valueConverted rate value.
Return values
0Conversion succeeds.

◆ zephyr_clock_controller_emul_clk_id_subsys_match()

bool zephyr_clock_controller_emul_clk_id_subsys_match ( clock_control_subsys_t sys,
const uint32_t * cells,
size_t num_cells )
inlinestatic

Match a one-cell clock selector against a subsystem.

Parameters
sysSubsystem selector encoded as a scalar clock identifier.
cellsOne-cell clock identifier from the devicetree clock-ids property.
num_cellsNumber of cells in cells; must be one.
Returns
true if sys matches the clock identifier in cells, or false otherwise.

◆ zephyr_clock_controller_emul_clkid_cells_to_subsys()

clock_control_subsys_t zephyr_clock_controller_emul_clkid_cells_to_subsys ( const uint32_t * cells,
union clock_control_emul_subsys * storage )
inlinestatic

Convert one clock-id cell to a subsystem selector.

Parameters
cellsOne-cell clock identifier from the devicetree clock-ids property.
storageStorage for a structured selector; unused by this scalar variant.
Returns
The scalar subsystem selector encoded by cells[0].

◆ zephyr_clock_controller_emul_clkid_rate_to_value()

int zephyr_clock_controller_emul_clkid_rate_to_value ( clock_control_subsys_rate_t rate,
uint32_t * value )
inlinestatic

Convert a subsystem rate to a one-cell value.

Parameters
rateScalar rate encoded in the opaque subsystem-rate pointer.
[out]valueConverted rate value.
Return values
0Conversion succeeds.

◆ zephyr_clock_controller_emul_clkid_subsys_match()

bool zephyr_clock_controller_emul_clkid_subsys_match ( clock_control_subsys_t sys,
const uint32_t * cells,
size_t num_cells )
inlinestatic

Match a one-cell clock selector against a subsystem.

Parameters
sysSubsystem selector encoded as a scalar clock identifier.
cellsOne-cell clock identifier from the devicetree clock-ids property.
num_cellsNumber of cells in cells; must be one.
Returns
true if sys matches the clock identifier in cells, or false otherwise.

◆ zephyr_clock_controller_emul_id_cells_to_subsys()

clock_control_subsys_t zephyr_clock_controller_emul_id_cells_to_subsys ( const uint32_t * cells,
union clock_control_emul_subsys * storage )
inlinestatic

Convert one clock-id cell to a subsystem selector.

Parameters
cellsOne-cell clock identifier from the devicetree clock-ids property.
storageStorage for a structured selector; unused by this scalar variant.
Returns
The scalar subsystem selector encoded by cells[0].

◆ zephyr_clock_controller_emul_id_rate_to_value()

int zephyr_clock_controller_emul_id_rate_to_value ( clock_control_subsys_rate_t rate,
uint32_t * value )
inlinestatic

Convert a subsystem rate to a one-cell value.

Parameters
rateScalar rate encoded in the opaque subsystem-rate pointer.
[out]valueConverted rate value.
Return values
0Conversion succeeds.

◆ zephyr_clock_controller_emul_id_subsys_match()

bool zephyr_clock_controller_emul_id_subsys_match ( clock_control_subsys_t sys,
const uint32_t * cells,
size_t num_cells )
inlinestatic

Match a one-cell clock selector against a subsystem.

Parameters
sysSubsystem selector encoded as a scalar clock identifier.
cellsOne-cell clock identifier from the devicetree clock-ids property.
num_cellsNumber of cells in cells; must be one.
Returns
true if sys matches the clock identifier in cells, or false otherwise.

◆ zephyr_clock_controller_emul_rcar_cpg_mssr_cells_to_subsys()

clock_control_subsys_t zephyr_clock_controller_emul_rcar_cpg_mssr_cells_to_subsys ( const uint32_t * cells,
union clock_control_emul_subsys * storage )
inlinestatic

Build an R-Car CPG/MSSR selector from devicetree cells.

Parameters
cellsTwo-cell clock identifier in domain, module order.
[out]storageStorage that receives the selector descriptor. Keep it valid while the returned selector is in use.
Returns
A pointer to the R-Car selector stored in storage.

◆ zephyr_clock_controller_emul_rcar_cpg_mssr_rate_to_value()

int zephyr_clock_controller_emul_rcar_cpg_mssr_rate_to_value ( clock_control_subsys_rate_t rate,
uint32_t * value )
inlinestatic

Convert an R-Car CPG/MSSR rate to a stored value.

Parameters
rateScalar rate encoded in the opaque subsystem-rate pointer.
[out]valueConverted rate value.
Return values
0Conversion succeeds.

◆ zephyr_clock_controller_emul_rcar_cpg_mssr_subsys_match()

bool zephyr_clock_controller_emul_rcar_cpg_mssr_subsys_match ( clock_control_subsys_t sys,
const uint32_t * cells,
size_t num_cells )
inlinestatic

Match an R-Car CPG/MSSR selector against devicetree cells.

Parameters
sysR-Car selector pointing to a rcar_cpg_clk descriptor.
cellsTwo-cell clock identifier in domain, module order.
num_cellsNumber of cells in cells; must be two.
Returns
true if the selector's domain and module match cells, or false otherwise.