|
Zephyr Project API 4.4.99
A Scalable Open Source RTOS
|
Interfaces for system control registers. More...
Files | |
| file | syscon.h |
| Main header file for SYSCON (System Control) driver API. | |
Data Structures | |
| struct | syscon_driver_api |
| @driver_ops{SYSCON} More... | |
Functions | |
| int | syscon_get_base (const struct device *dev, uintptr_t *addr) |
| Get the syscon base address. | |
| int | syscon_read_reg (const struct device *dev, uint32_t reg, uint32_t *val) |
| Read from syscon register. | |
| int | syscon_write_reg (const struct device *dev, uint32_t reg, uint32_t val) |
| Write to syscon register. | |
| 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_get_size (const struct device *dev, size_t *size) |
| Get the size of the syscon register in bytes. | |
| typedef int(* | syscon_api_get_base) (const struct device *dev, uintptr_t *addr) |
| @def_driverbackendgroup{SYSCON, syscon_interface} | |
| typedef int(* | syscon_api_read_reg) (const struct device *dev, uint32_t reg, uint32_t *val) |
| Read a single register. | |
| typedef int(* | syscon_api_write_reg) (const struct device *dev, uint32_t reg, uint32_t val) |
| Write a single register. | |
| typedef int(* | syscon_api_update_bits) (const struct device *dev, uint32_t reg, uint32_t mask, uint32_t val) |
| Atomically update bits in a register. | |
| typedef int(* | syscon_api_get_size) (const struct device *dev, size_t *size) |
| Get the size of the syscon register region. | |
Interfaces for system control registers.
#include <syscon.h>
@def_driverbackendgroup{SYSCON, syscon_interface}
Get the base address of the syscon region. See syscon_get_base() for argument description.
#include <syscon.h>
Get the size of the syscon register region.
See syscon_get_size() for argument description.
| typedef int(* syscon_api_update_bits) (const struct device *dev, uint32_t reg, uint32_t mask, uint32_t val) |
#include <syscon.h>
Atomically update bits in a register.
See syscon_update_bits() for argument description.
#include <syscon.h>
Get the syscon base address.
| dev | The device to get the register size for. |
| addr | Where to write the base address. |
| 0 | When addr was written to. |
| -ENOSYS | If the API or function isn't implemented. |
#include <syscon.h>
Get the size of the syscon register in bytes.
| dev | The device to get the register size for. |
| size | Pointer to write the size to. |
| 0 | on success. |
| -ENOSYS | If the API or function isn't implemented. |
#include <syscon.h>
Read from syscon register.
This function reads from a specific register in the syscon area
| dev | The device to get the register size for. |
| reg | The register offset |
| val | The returned value read from the syscon register |
| 0 | on success. |
| -ENOSYS | If the API or function isn't implemented. |
#include <syscon.h>
Atomically update bits in a syscon register.
Performs a read-modify-write on a register under the driver's internal lock. Bits selected by mask are cleared and replaced with the corresponding bits from val. Equivalent to:
syscon_read_reg(dev, reg, &tmp); tmp = (tmp & ~mask) | (val & mask); syscon_write_reg(dev, reg, tmp);
but executed atomically with respect to other syscon operations on the same device.
| dev | The syscon device. |
| reg | The register offset. |
| mask | Bitmask of bits to modify. |
| val | New values for the bits selected by mask. |
| 0 | on success. |
| -ENOSYS | If the API or function isn't implemented. |
#include <syscon.h>
Write to syscon register.
This function writes to a specific register in the syscon area
| dev | The device to get the register size for. |
| reg | The register offset |
| val | The value to be written in the register |
| 0 | on success. |
| -ENOSYS | If the API or function isn't implemented. |