Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
System control (SYSCON)

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.

Detailed Description

Interfaces for system control registers.

Function Documentation

◆ syscon_get_base()

int syscon_get_base ( const struct device * dev,
uintptr_t * addr )

#include <zephyr/drivers/syscon.h>

Get the syscon base address.

Parameters
devThe device to get the register size for.
addrWhere to write the base address.
Return values
0When addr was written to.
-ENOSYSIf the API or function isn't implemented.

◆ syscon_get_size()

int syscon_get_size ( const struct device * dev,
size_t * size )

#include <zephyr/drivers/syscon.h>

Get the size of the syscon register in bytes.

Parameters
devThe device to get the register size for.
sizePointer to write the size to.
Return values
0on success.
-ENOSYSIf the API or function isn't implemented.

◆ syscon_read_reg()

int syscon_read_reg ( const struct device * dev,
uint16_t reg,
uint32_t * val )

#include <zephyr/drivers/syscon.h>

Read from syscon register.

This function reads from a specific register in the syscon area

Parameters
devThe device to get the register size for.
regThe register offset
valThe returned value read from the syscon register
Return values
0on success.
-ENOSYSIf the API or function isn't implemented.

◆ syscon_update_bits()

int syscon_update_bits ( const struct device * dev,
uint16_t reg,
uint32_t mask,
uint32_t val )

#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.

Parameters
devThe syscon device.
regThe register offset.
maskBitmask of bits to modify.
valNew values for the bits selected by mask.
Return values
0on success.
-ENOSYSIf the API or function isn't implemented.

◆ syscon_write_reg()

int syscon_write_reg ( const struct device * dev,
uint16_t reg,
uint32_t val )

#include <zephyr/drivers/syscon.h>

Write to syscon register.

This function writes to a specific register in the syscon area

Parameters
devThe device to get the register size for.
regThe register offset
valThe value to be written in the register
Return values
0on success.
-ENOSYSIf the API or function isn't implemented.