Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
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 . | |
Reset Controller Interface .
#define RESET_DT_SPEC_GET | ( | node_id | ) |
#include <zephyr/drivers/reset.h>
Equivalent to RESET_DT_SPEC_GET_BY_IDX(node_id, 0).
node_id | devicetree node identifier |
#define RESET_DT_SPEC_GET_BY_IDX | ( | node_id, | |
idx ) |
#include <zephyr/drivers/reset.h>
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.
node_id | devicetree node identifier |
idx | logical index into "resets" |
#define RESET_DT_SPEC_GET_BY_IDX_OR | ( | node_id, | |
idx, | |||
default_value ) |
#include <zephyr/drivers/reset.h>
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
.
node_id | devicetree node identifier |
idx | logical index into the 'resets' property |
default_value | fallback value to expand to |
#define RESET_DT_SPEC_GET_OR | ( | node_id, | |
default_value ) |
#include <zephyr/drivers/reset.h>
Equivalent to RESET_DT_SPEC_GET_BY_IDX_OR(node_id, 0, default_value).
node_id | devicetree node identifier |
default_value | fallback value to expand to |
#define RESET_DT_SPEC_INST_GET | ( | inst | ) |
#include <zephyr/drivers/reset.h>
Equivalent to RESET_DT_SPEC_INST_GET_BY_IDX(inst, 0).
inst | DT_DRV_COMPAT instance number |
#define RESET_DT_SPEC_INST_GET_BY_IDX | ( | 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.
inst | DT_DRV_COMPAT instance number |
idx | logical index into "resets" |
#define RESET_DT_SPEC_INST_GET_BY_IDX_OR | ( | inst, | |
idx, | |||
default_value ) |
#include <zephyr/drivers/reset.h>
Static initializer for a reset_dt_spec
from a DT_DRV_COMPAT instance's 'resets' property at an index, with fallback.
inst | DT_DRV_COMPAT instance number |
idx | logical index into the 'resets' property |
default_value | fallback value to expand to |
#define RESET_DT_SPEC_INST_GET_OR | ( | inst, | |
default_value ) |
#include <zephyr/drivers/reset.h>
Equivalent to RESET_DT_SPEC_INST_GET_BY_IDX_OR(node_id, 0, default_value).
inst | DT_DRV_COMPAT instance number |
default_value | fallback value to expand to |
#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).
dev | Reset controller device. |
id | Reset line. |
0 | On success. |
-ENOSYS | If the functionality is not implemented by the driver. |
-errno | Other negative errno in case of failure. |
|
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);
spec | Reset controller specification from devicetree |
#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).
dev | Reset controller device. |
id | Reset line. |
0 | On success. |
-ENOSYS | If the functionality is not implemented by the driver. |
-errno | Other negative errno in case of failure. |
|
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)
spec | Reset controller specification from devicetree |
#include <zephyr/drivers/reset.h>
Reset the device.
This function performs reset for a device (assert + deassert).
dev | Reset controller device. |
id | Reset line. |
0 | On success. |
-ENOSYS | If the functionality is not implemented by the driver. |
-errno | Other negative errno in case of failure. |
|
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)
spec | Reset controller specification from devicetree |
#include <zephyr/drivers/reset.h>
Get the reset status.
This function returns the reset status of the device.
dev | Reset controller device. |
id | Reset line. |
status | Where to write the reset status. |
0 | On success. |
-ENOSYS | If the functionality is not implemented by the driver. |
-errno | Other negative errno in case of failure. |
|
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);
spec | Reset controller specification from devicetree |
status | Where to write the reset status. |