Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Reset Controller Interface

Reset Controller Interface . More...

Data Structures

struct  reset_dt_spec
 Reset controller device configuration. More...
 

Macros

#define RESET_DT_SPEC_GET_BY_IDX(node_id, idx)
 Static initializer for a reset_dt_spec.
 
#define RESET_DT_SPEC_GET_BY_IDX_OR(node_id, idx, default_value)
 Like RESET_DT_SPEC_GET_BY_IDX(), with a fallback to a default value.
 
#define RESET_DT_SPEC_GET(node_id)
 Equivalent to RESET_DT_SPEC_GET_BY_IDX(node_id, 0).
 
#define RESET_DT_SPEC_GET_OR(node_id, default_value)
 Equivalent to RESET_DT_SPEC_GET_BY_IDX_OR(node_id, 0, default_value).
 
#define RESET_DT_SPEC_INST_GET_BY_IDX(inst, idx)
 Static initializer for a reset_dt_spec from a DT_DRV_COMPAT instance's Reset Controller property at an index.
 
#define RESET_DT_SPEC_INST_GET_BY_IDX_OR(inst, idx, default_value)
 Static initializer for a reset_dt_spec from a DT_DRV_COMPAT instance's 'resets' property at an index, with fallback.
 
#define RESET_DT_SPEC_INST_GET(inst)
 Equivalent to RESET_DT_SPEC_INST_GET_BY_IDX(inst, 0).
 
#define RESET_DT_SPEC_INST_GET_OR(inst, default_value)
 Equivalent to RESET_DT_SPEC_INST_GET_BY_IDX_OR(node_id, 0, default_value).
 

Functions

int reset_status (const struct device *dev, uint32_t id, uint8_t *status)
 Get the reset status.
 
static int reset_status_dt (const struct reset_dt_spec *spec, uint8_t *status)
 Get the reset status from a reset_dt_spec.
 
int reset_line_assert (const struct device *dev, uint32_t id)
 Put the device in reset state.
 
static int reset_line_assert_dt (const struct reset_dt_spec *spec)
 Assert the reset state from a reset_dt_spec.
 
int reset_line_deassert (const struct device *dev, uint32_t id)
 Take out the device from reset state.
 
static int reset_line_deassert_dt (const struct reset_dt_spec *spec)
 Deassert the reset state from a reset_dt_spec.
 
int reset_line_toggle (const struct device *dev, uint32_t id)
 Reset the device.
 
static int reset_line_toggle_dt (const struct reset_dt_spec *spec)
 Reset the device from a reset_dt_spec.
 

Detailed Description

Reset Controller Interface .

Since
3.1
Version
0.2.0

Macro Definition Documentation

◆ RESET_DT_SPEC_GET

#define RESET_DT_SPEC_GET ( node_id)

#include <zephyr/drivers/reset.h>

Value:
#define RESET_DT_SPEC_GET_BY_IDX(node_id, idx)
Static initializer for a reset_dt_spec.
Definition reset.h:71

Equivalent to RESET_DT_SPEC_GET_BY_IDX(node_id, 0).

Parameters
node_iddevicetree node identifier
Returns
static initializer for a struct reset_dt_spec for the property
See also
RESET_DT_SPEC_GET_BY_IDX()

◆ RESET_DT_SPEC_GET_BY_IDX

#define RESET_DT_SPEC_GET_BY_IDX ( node_id,
idx )

#include <zephyr/drivers/reset.h>

Value:
{ \
.dev = DEVICE_DT_GET(DT_RESET_CTLR_BY_IDX(node_id, idx)), \
.id = DT_RESET_ID_BY_IDX(node_id, idx) \
}
#define DEVICE_DT_GET(node_id)
Get a device reference from a devicetree node identifier.
Definition device.h:255
#define DT_RESET_ID_BY_IDX(node_id, idx)
Get a Reset Controller specifier's id cell at an index.
Definition reset.h:269
#define DT_RESET_CTLR_BY_IDX(node_id, idx)
Get the node identifier for the controller phandle from a "resets" phandle-array property at an index...
Definition reset.h:50

Static initializer for a reset_dt_spec.

This returns a static initializer for a reset_dt_spec structure given a devicetree node identifier, a property specifying a Reset Controller and an index.

Example devicetree fragment:

 n: node {
    resets = <&reset 10>;
 }

Example usage:

 const struct reset_dt_spec spec = RESET_DT_SPEC_GET_BY_IDX(DT_NODELABEL(n), 0);
 // Initializes 'spec' to:
 // {
 //         .dev = DEVICE_DT_GET(DT_NODELABEL(reset)),
 //         .id = 10
 // }

The 'reset' field must still be checked for readiness, e.g. using device_is_ready(). It is an error to use this macro unless the node exists, has the given property, and that property specifies a reset controller reset line id as shown above.

Parameters
node_iddevicetree node identifier
idxlogical index into "resets"
Returns
static initializer for a struct reset_dt_spec for the property

◆ RESET_DT_SPEC_GET_BY_IDX_OR

#define RESET_DT_SPEC_GET_BY_IDX_OR ( node_id,
idx,
default_value )

#include <zephyr/drivers/reset.h>

Value:
COND_CODE_1(DT_NODE_HAS_PROP(node_id, resets), \
(RESET_DT_SPEC_GET_BY_IDX(node_id, idx)), \
(default_value))
#define DT_NODE_HAS_PROP(node_id, prop)
Does a devicetree node have a property?
Definition devicetree.h:3684
#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:195

Like RESET_DT_SPEC_GET_BY_IDX(), with a fallback to a default value.

If the devicetree node identifier 'node_id' refers to a node with a 'resets' property, this expands to RESET_DT_SPEC_GET_BY_IDX(node_id, idx). The default_value parameter is not expanded in this case.

Otherwise, this expands to default_value.

Parameters
node_iddevicetree node identifier
idxlogical index into the 'resets' property
default_valuefallback value to expand to
Returns
static initializer for a struct reset_dt_spec for the property, or default_value if the node or property do not exist

◆ RESET_DT_SPEC_GET_OR

#define RESET_DT_SPEC_GET_OR ( node_id,
default_value )

#include <zephyr/drivers/reset.h>

Value:
RESET_DT_SPEC_GET_BY_IDX_OR(node_id, 0, default_value)
#define RESET_DT_SPEC_GET_BY_IDX_OR(node_id, idx, default_value)
Like RESET_DT_SPEC_GET_BY_IDX(), with a fallback to a default value.
Definition reset.h:93

Equivalent to RESET_DT_SPEC_GET_BY_IDX_OR(node_id, 0, default_value).

Parameters
node_iddevicetree node identifier
default_valuefallback value to expand to
Returns
static initializer for a struct reset_dt_spec for the property, or default_value if the node or property do not exist

◆ RESET_DT_SPEC_INST_GET

#define RESET_DT_SPEC_INST_GET ( inst)

#include <zephyr/drivers/reset.h>

Value:
#define RESET_DT_SPEC_INST_GET_BY_IDX(inst, idx)
Static initializer for a reset_dt_spec from a DT_DRV_COMPAT instance's Reset Controller property at a...
Definition reset.h:129

Equivalent to RESET_DT_SPEC_INST_GET_BY_IDX(inst, 0).

Parameters
instDT_DRV_COMPAT instance number
Returns
static initializer for a struct reset_dt_spec for the property
See also
RESET_DT_SPEC_INST_GET_BY_IDX()

◆ RESET_DT_SPEC_INST_GET_BY_IDX

#define RESET_DT_SPEC_INST_GET_BY_IDX ( inst,
idx )

#include <zephyr/drivers/reset.h>

Value:
#define DT_DRV_INST(inst)
Node identifier for an instance of a DT_DRV_COMPAT compatible.
Definition devicetree.h:3809

Static initializer for a reset_dt_spec from a DT_DRV_COMPAT instance's Reset Controller property at an index.

Parameters
instDT_DRV_COMPAT instance number
idxlogical index into "resets"
Returns
static initializer for a struct reset_dt_spec for the property
See also
RESET_DT_SPEC_GET_BY_IDX()

◆ RESET_DT_SPEC_INST_GET_BY_IDX_OR

#define RESET_DT_SPEC_INST_GET_BY_IDX_OR ( inst,
idx,
default_value )

#include <zephyr/drivers/reset.h>

Value:
COND_CODE_1(DT_PROP_HAS_IDX(DT_DRV_INST(inst), resets, idx), \
(default_value))
#define DT_PROP_HAS_IDX(node_id, prop, idx)
Is index idx valid for an array type property?
Definition devicetree.h:826

Static initializer for a reset_dt_spec from a DT_DRV_COMPAT instance's 'resets' property at an index, with fallback.

Parameters
instDT_DRV_COMPAT instance number
idxlogical index into the 'resets' property
default_valuefallback value to expand to
Returns
static initializer for a struct reset_dt_spec for the property, or default_value if the node or property do not exist

◆ RESET_DT_SPEC_INST_GET_OR

#define RESET_DT_SPEC_INST_GET_OR ( inst,
default_value )

#include <zephyr/drivers/reset.h>

Value:
RESET_DT_SPEC_INST_GET_BY_IDX_OR(inst, 0, default_value)
#define RESET_DT_SPEC_INST_GET_BY_IDX_OR(inst, idx, default_value)
Static initializer for a reset_dt_spec from a DT_DRV_COMPAT instance's 'resets' property at an index,...
Definition reset.h:142

Equivalent to RESET_DT_SPEC_INST_GET_BY_IDX_OR(node_id, 0, default_value).

Parameters
instDT_DRV_COMPAT instance number
default_valuefallback value to expand to
Returns
static initializer for a struct reset_dt_spec for the property, or default_value if the node or property do not exist

Function Documentation

◆ reset_line_assert()

int reset_line_assert ( const struct device * dev,
uint32_t id )

#include <zephyr/drivers/reset.h>

Put the device in reset state.

This function sets/clears the reset bits of the device, depending on the logic level (active-high/active-low).

Parameters
devReset controller device.
idReset line.
Return values
0On success.
-ENOSYSIf the functionality is not implemented by the driver.
-errnoOther negative errno in case of failure.

◆ reset_line_assert_dt()

static int reset_line_assert_dt ( const struct reset_dt_spec * spec)
inlinestatic

#include <zephyr/drivers/reset.h>

Assert the reset state from a reset_dt_spec.

This is equivalent to:

reset_line_assert(spec->dev, spec->id);
Parameters
specReset controller specification from devicetree
Returns
a value from reset_line_assert()

◆ reset_line_deassert()

int reset_line_deassert ( const struct device * dev,
uint32_t id )

#include <zephyr/drivers/reset.h>

Take out the device from reset state.

This function sets/clears the reset bits of the device, depending on the logic level (active-low/active-high).

Parameters
devReset controller device.
idReset line.
Return values
0On success.
-ENOSYSIf the functionality is not implemented by the driver.
-errnoOther negative errno in case of failure.

◆ reset_line_deassert_dt()

static int reset_line_deassert_dt ( const struct reset_dt_spec * spec)
inlinestatic

#include <zephyr/drivers/reset.h>

Deassert the reset state from a reset_dt_spec.

This is equivalent to:

reset_line_deassert(spec->dev, spec->id)
Parameters
specReset controller specification from devicetree
Returns
a value from reset_line_deassert()

◆ reset_line_toggle()

int reset_line_toggle ( const struct device * dev,
uint32_t id )

#include <zephyr/drivers/reset.h>

Reset the device.

This function performs reset for a device (assert + deassert).

Parameters
devReset controller device.
idReset line.
Return values
0On success.
-ENOSYSIf the functionality is not implemented by the driver.
-errnoOther negative errno in case of failure.

◆ reset_line_toggle_dt()

static int reset_line_toggle_dt ( const struct reset_dt_spec * spec)
inlinestatic

#include <zephyr/drivers/reset.h>

Reset the device from a reset_dt_spec.

This is equivalent to:

reset_line_toggle(spec->dev, spec->id)
Parameters
specReset controller specification from devicetree
Returns
a value from reset_line_toggle()

◆ reset_status()

int reset_status ( const struct device * dev,
uint32_t id,
uint8_t * status )

#include <zephyr/drivers/reset.h>

Get the reset status.

This function returns the reset status of the device.

Parameters
devReset controller device.
idReset line.
statusWhere to write the reset status.
Return values
0On success.
-ENOSYSIf the functionality is not implemented by the driver.
-errnoOther negative errno in case of failure.

◆ reset_status_dt()

static int reset_status_dt ( const struct reset_dt_spec * spec,
uint8_t * status )
inlinestatic

#include <zephyr/drivers/reset.h>

Get the reset status from a reset_dt_spec.

This is equivalent to:

reset_status(spec->dev, spec->id, status);

Parameters
specReset controller specification from devicetree
statusWhere to write the reset status.
Returns
a value from reset_status()