Zephyr API Documentation  3.6.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(node_id)    RESET_DT_SPEC_GET_BY_IDX(node_id, 0)
 Equivalent to RESET_DT_SPEC_GET_BY_IDX(node_id, 0).
 
#define RESET_DT_SPEC_INST_GET_BY_IDX(inst, idx)    RESET_DT_SPEC_GET_BY_IDX(DT_DRV_INST(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(inst)    RESET_DT_SPEC_INST_GET_BY_IDX(inst, 0)
 Equivalent to RESET_DT_SPEC_INST_GET_BY_IDX(inst, 0).
 

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.1.0

Macro Definition Documentation

◆ RESET_DT_SPEC_GET

#define RESET_DT_SPEC_GET (   node_id)     RESET_DT_SPEC_GET_BY_IDX(node_id, 0)

#include <zephyr/drivers/reset.h>

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:245
#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_INST_GET

#define RESET_DT_SPEC_INST_GET (   inst)     RESET_DT_SPEC_INST_GET_BY_IDX(inst, 0)

#include <zephyr/drivers/reset.h>

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 
)     RESET_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst), idx)

#include <zephyr/drivers/reset.h>

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()

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()