13#ifndef ZEPHYR_INCLUDE_DRIVERS_SYSCON_H_
14#define ZEPHYR_INCLUDE_DRIVERS_SYSCON_H_
97static inline int z_impl_syscon_get_base(
const struct device *dev,
uintptr_t *addr)
101 if ((api ==
NULL) || (api->get_base ==
NULL)) {
105 return api->get_base(dev, addr);
127 if ((api ==
NULL) || (api->read ==
NULL)) {
131 return api->read(dev, reg, val);
153 if ((api ==
NULL) || (api->write ==
NULL)) {
157 return api->write(dev, reg, val);
185static inline int z_impl_syscon_update_bits(
const struct device *dev,
uint32_t reg,
190 if ((api ==
NULL) || (api->update_bits ==
NULL)) {
194 return api->update_bits(dev, reg, mask, val);
208static inline int z_impl_syscon_get_size(
const struct device *dev,
size_t *size)
212 if ((api ==
NULL) || (api->get_size ==
NULL)) {
216 return api->get_size(dev, size);
227#include <zephyr/syscalls/syscon.h>
int(* syscon_api_get_base)(const struct device *dev, uintptr_t *addr)
Get the base address of the syscon region.
Definition syscon.h:41
int(* syscon_api_read_reg)(const struct device *dev, uint32_t reg, uint32_t *val)
Read a single register.
Definition syscon.h:47
int(* syscon_api_write_reg)(const struct device *dev, uint32_t reg, uint32_t val)
Write a single register.
Definition syscon.h:53
int(* syscon_api_update_bits)(const struct device *dev, uint32_t reg, uint32_t mask, uint32_t val)
Atomically update bits in a register.
Definition syscon.h:59
int(* syscon_api_get_size)(const struct device *dev, size_t *size)
Get the size of the syscon register region.
Definition syscon.h:66
int syscon_get_base(const struct device *dev, uintptr_t *addr)
Get the syscon base address.
int syscon_get_size(const struct device *dev, size_t *size)
Get the size of the syscon register in bytes.
int syscon_update_bits(const struct device *dev, uint32_t reg, uint32_t mask, uint32_t val)
Atomically update bits in a syscon register.
int syscon_write_reg(const struct device *dev, uint32_t reg, uint32_t val)
Write to syscon register.
int syscon_read_reg(const struct device *dev, uint32_t reg, uint32_t *val)
Read from syscon register.
#define ENOSYS
Function not implemented.
Definition errno.h:82
#define NULL
Definition iar_missing_defs.h:20
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:519
<span class="mlabel">Driver Operations</span> SYSCON driver operations
Definition syscon.h:71
syscon_api_get_base get_base
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition syscon.h:79
syscon_api_read_reg read
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition syscon.h:73
syscon_api_get_size get_size
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition syscon.h:81
syscon_api_update_bits update_bits
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition syscon.h:77
syscon_api_write_reg write
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition syscon.h:75