12#ifndef ZEPHYR_INCLUDE_DRIVERS_RESET_H_
13#define ZEPHYR_INCLUDE_DRIVERS_RESET_H_
67#define RESET_DT_SPEC_GET_BY_IDX(node_id, idx) \
69 .dev = DEVICE_DT_GET(DT_RESET_CTLR_BY_IDX(node_id, idx)), \
70 .id = DT_RESET_ID_BY_IDX(node_id, idx) \
80#define RESET_DT_SPEC_GET(node_id) \
81 RESET_DT_SPEC_GET_BY_IDX(node_id, 0)
92#define RESET_DT_SPEC_INST_GET_BY_IDX(inst, idx) \
93 RESET_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst), idx)
102#define RESET_DT_SPEC_INST_GET(inst) \
103 RESET_DT_SPEC_INST_GET_BY_IDX(inst, 0)
119typedef int (*reset_api_line_assert)(
const struct device *dev,
uint32_t id);
126typedef int (*reset_api_line_deassert)(
const struct device *dev,
uint32_t id);
133typedef int (*reset_api_line_toggle)(
const struct device *dev,
uint32_t id);
138__subsystem
struct reset_driver_api {
139 reset_api_status status;
140 reset_api_line_assert line_assert;
141 reset_api_line_deassert line_deassert;
142 reset_api_line_toggle line_toggle;
164 const struct reset_driver_api *api = (
const struct reset_driver_api *)dev->
api;
166 if (api->status == NULL) {
170 return api->status(dev,
id, status);
205static inline int z_impl_reset_line_assert(
const struct device *dev,
uint32_t id)
207 const struct reset_driver_api *api = (
const struct reset_driver_api *)dev->
api;
209 if (api->line_assert == NULL) {
213 return api->line_assert(dev,
id);
247static inline int z_impl_reset_line_deassert(
const struct device *dev,
uint32_t id)
249 const struct reset_driver_api *api = (
const struct reset_driver_api *)dev->
api;
251 if (api->line_deassert == NULL) {
255 return api->line_deassert(dev,
id);
288static inline int z_impl_reset_line_toggle(
const struct device *dev,
uint32_t id)
290 const struct reset_driver_api *api = (
const struct reset_driver_api *)dev->
api;
292 if (api->line_toggle == NULL) {
296 return api->line_toggle(dev,
id);
323#include <syscalls/reset.h>
int reset_line_toggle(const struct device *dev, uint32_t id)
Reset the device.
static int reset_line_deassert_dt(const struct reset_dt_spec *spec)
Deassert the reset state from a reset_dt_spec.
Definition: reset.h:269
static int reset_status_dt(const struct reset_dt_spec *spec, uint8_t *status)
Get the reset status from a reset_dt_spec.
Definition: reset.h:185
int reset_line_deassert(const struct device *dev, uint32_t id)
Take out the device from reset state.
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.
Definition: reset.h:227
int reset_status(const struct device *dev, uint32_t id, uint8_t *status)
Get the reset status.
static int reset_line_toggle_dt(const struct reset_dt_spec *spec)
Reset the device from a reset_dt_spec.
Definition: reset.h:310
#define ENOSYS
Definition: errno.h:83
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition: device.h:435
const void * api
Definition: device.h:441
const struct device * dev
Definition: reset.h:32
uint32_t id
Definition: reset.h:34