|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
Interfaces for system control registers. More...
Topics | |
| SYSCON Driver Backend API | |
Files | |
| file | syscon.h |
| Main header file for SYSCON (System Control) driver API. | |
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, uint16_t reg, uint32_t *val) |
| Read from syscon register. | |
| int | syscon_write_reg (const struct device *dev, uint16_t reg, uint32_t val) |
| Write to syscon register. | |
| int | syscon_update_bits (const struct device *dev, uint16_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. | |
Interfaces for system control registers.
#include <zephyr/drivers/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 <zephyr/drivers/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 <zephyr/drivers/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 <zephyr/drivers/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 <zephyr/drivers/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. |