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

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.

Detailed Description

Interfaces for system control registers.

Since
2.7.0
Version
0.8.0

Typedef Documentation

◆ syscon_api_get_base

typedef int(* syscon_api_get_base) (const struct device *dev, uintptr_t *addr)

#include <syscon.h>

@def_driverbackendgroup{SYSCON, syscon_interface}

Get the base address of the syscon region. See syscon_get_base() for argument description.

◆ syscon_api_get_size

typedef int(* syscon_api_get_size) (const struct device *dev, size_t *size)

#include <syscon.h>

Get the size of the syscon register region.

See syscon_get_size() for argument description.

◆ syscon_api_read_reg

typedef int(* syscon_api_read_reg) (const struct device *dev, uint32_t reg, uint32_t *val)

#include <syscon.h>

Read a single register.

See syscon_read_reg() for argument description.

◆ syscon_api_update_bits

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.

◆ syscon_api_write_reg

typedef int(* syscon_api_write_reg) (const struct device *dev, uint32_t reg, uint32_t val)

#include <syscon.h>

Write a single register.

See syscon_write_reg() for argument description.

Function Documentation

◆ syscon_get_base()

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

#include <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 <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,
uint32_t reg,
uint32_t * val )

#include <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,
uint32_t reg,
uint32_t mask,
uint32_t val )

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

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,
uint32_t reg,
uint32_t val )

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