Lines Matching +full:device +full:- +full:id

2  * Copyright (c) 2022 Andrei-Edward Popa <andrei.popa105@yahoo.com>
4 * SPDX-License-Identifier: Apache-2.0
27 #include <zephyr/device.h>
33 /** Reset controller device configuration. */
35 /** Reset controller device. */
36 const struct device *dev;
38 uint32_t id; member
59 * // .id = 10
65 * controller reset line id as shown above.
74 .id = DT_RESET_ID_BY_IDX(node_id, idx) \
172 * API template to get the reset status of the device.
176 typedef int (*reset_api_status)(const struct device *dev, uint32_t id, uint8_t *status);
179 * API template to put the device in reset state.
183 typedef int (*reset_api_line_assert)(const struct device *dev, uint32_t id);
186 * API template to take out the device from reset state.
190 typedef int (*reset_api_line_deassert)(const struct device *dev, uint32_t id);
193 * API template to reset the device.
197 typedef int (*reset_api_line_toggle)(const struct device *dev, uint32_t id);
214 * This function returns the reset status of the device.
216 * @param dev Reset controller device.
217 * @param id Reset line.
221 * @retval -ENOSYS If the functionality is not implemented by the driver.
222 * @retval -errno Other negative errno in case of failure.
224 __syscall int reset_status(const struct device *dev, uint32_t id, uint8_t *status);
226 static inline int z_impl_reset_status(const struct device *dev, uint32_t id, uint8_t *status) in z_impl_reset_status() argument
228 const struct reset_driver_api *api = (const struct reset_driver_api *)dev->api; in z_impl_reset_status()
230 if (api->status == NULL) { in z_impl_reset_status()
231 return -ENOSYS; in z_impl_reset_status()
234 return api->status(dev, id, status); in z_impl_reset_status()
242 * reset_status(spec->dev, spec->id, status);
251 return reset_status(spec->dev, spec->id, status); in reset_status_dt()
255 * @brief Put the device in reset state
257 * This function sets/clears the reset bits of the device,
258 * depending on the logic level (active-high/active-low).
260 * @param dev Reset controller device.
261 * @param id Reset line.
264 * @retval -ENOSYS If the functionality is not implemented by the driver.
265 * @retval -errno Other negative errno in case of failure.
267 __syscall int reset_line_assert(const struct device *dev, uint32_t id);
269 static inline int z_impl_reset_line_assert(const struct device *dev, uint32_t id) in z_impl_reset_line_assert() argument
271 const struct reset_driver_api *api = (const struct reset_driver_api *)dev->api; in z_impl_reset_line_assert()
273 if (api->line_assert == NULL) { in z_impl_reset_line_assert()
274 return -ENOSYS; in z_impl_reset_line_assert()
277 return api->line_assert(dev, id); in z_impl_reset_line_assert()
285 * reset_line_assert(spec->dev, spec->id);
293 return reset_line_assert(spec->dev, spec->id); in reset_line_assert_dt()
297 * @brief Take out the device from reset state.
299 * This function sets/clears the reset bits of the device,
300 * depending on the logic level (active-low/active-high).
302 * @param dev Reset controller device.
303 * @param id Reset line.
306 * @retval -ENOSYS If the functionality is not implemented by the driver.
307 * @retval -errno Other negative errno in case of failure.
309 __syscall int reset_line_deassert(const struct device *dev, uint32_t id);
311 static inline int z_impl_reset_line_deassert(const struct device *dev, uint32_t id) in z_impl_reset_line_deassert() argument
313 const struct reset_driver_api *api = (const struct reset_driver_api *)dev->api; in z_impl_reset_line_deassert()
315 if (api->line_deassert == NULL) { in z_impl_reset_line_deassert()
316 return -ENOSYS; in z_impl_reset_line_deassert()
319 return api->line_deassert(dev, id); in z_impl_reset_line_deassert()
327 * reset_line_deassert(spec->dev, spec->id)
335 return reset_line_deassert(spec->dev, spec->id); in reset_line_deassert_dt()
339 * @brief Reset the device.
341 * This function performs reset for a device (assert + deassert).
343 * @param dev Reset controller device.
344 * @param id Reset line.
347 * @retval -ENOSYS If the functionality is not implemented by the driver.
348 * @retval -errno Other negative errno in case of failure.
350 __syscall int reset_line_toggle(const struct device *dev, uint32_t id);
352 static inline int z_impl_reset_line_toggle(const struct device *dev, uint32_t id) in z_impl_reset_line_toggle() argument
354 const struct reset_driver_api *api = (const struct reset_driver_api *)dev->api; in z_impl_reset_line_toggle()
356 if (api->line_toggle == NULL) { in z_impl_reset_line_toggle()
357 return -ENOSYS; in z_impl_reset_line_toggle()
360 return api->line_toggle(dev, id); in z_impl_reset_line_toggle()
364 * @brief Reset the device from a @p reset_dt_spec.
368 * reset_line_toggle(spec->dev, spec->id)
376 return reset_line_toggle(spec->dev, spec->id); in reset_line_toggle_dt()