PebbleOS v4.47.0-1312-gf1984a001
Loading...
Searching...
No Matches
System controller

System controller class. More...

Modules

 Memory-mapped
 System controller whose registers are memory-mapped.
 

Data Structures

struct  pbl_syscon_ops
 System controller driver operations. More...
 
struct  pbl_syscon
 System controller. More...
 

Macros

#define PBL_SYSCON_STATE_DEFINE(sym)   PBL_DEVICE_STATE_DEFINE(sym)
 Define the class state of a system controller.
 
#define PBL_SYSCON_INIT(sym, _name, _parent, _ops)
 Initialize a struct pbl_syscon.
 

Functions

int pbl_syscon_read (const struct pbl_syscon *syscon, uint32_t offset, uint32_t *val)
 Read a register.
 
int pbl_syscon_write (const struct pbl_syscon *syscon, uint32_t offset, uint32_t val)
 Write a register.
 
int pbl_syscon_update_bits (const struct pbl_syscon *syscon, uint32_t offset, uint32_t mask, uint32_t val)
 Update bits of a register, atomically.
 

Detailed Description

System controller class.

A system controller is a struct pbl_syscon device: a block of registers that drivers of other blocks reach by reference, to set the bits that concern them. Updates of a register are atomic with respect to each other.

ret = pbl_syscon_update_bits(wdt->pmuc, PMUC_WER_OFFSET, PMUC_WER_WDT1, PMUC_WER_WDT1);
int pbl_syscon_update_bits(const struct pbl_syscon *syscon, uint32_t offset, uint32_t mask, uint32_t val)
Update bits of a register, atomically.

Data Structure Documentation

◆ pbl_syscon

struct pbl_syscon

System controller.

Data Fields
struct pbl_device dev Device.
const struct pbl_syscon_ops * ops Driver operations.

Macro Definition Documentation

◆ PBL_SYSCON_INIT

#define PBL_SYSCON_INIT (   sym,
  _name,
  _parent,
  _ops 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, nullptr, _parent, &pbl_syscon_class), \
.ops = (_ops), \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153

Initialize a struct pbl_syscon.

Parameters
symSymbol of the instance, as passed to PBL_SYSCON_STATE_DEFINE().
_nameDevice name.
_parentParent device, or NULL.
_opsDriver operations.

◆ PBL_SYSCON_STATE_DEFINE

#define PBL_SYSCON_STATE_DEFINE (   sym)    PBL_DEVICE_STATE_DEFINE(sym)

Define the class state of a system controller.

Parameters
symSymbol of the instance.

Function Documentation

◆ pbl_syscon_read()

int pbl_syscon_read ( const struct pbl_syscon *  syscon,
uint32_t  offset,
uint32_t *  val 
)

Read a register.

Parameters
sysconSystem controller.
offsetOffset of the register.
[out]valValue.
Returns
0, -ENODEV if the controller is not ready, or a negative errno.

◆ pbl_syscon_update_bits()

int pbl_syscon_update_bits ( const struct pbl_syscon *  syscon,
uint32_t  offset,
uint32_t  mask,
uint32_t  val 
)

Update bits of a register, atomically.

Parameters
sysconSystem controller.
offsetOffset of the register.
maskBits to update.
valNew value of the bits in mask.
Returns
0, -ENODEV if the controller is not ready, or a negative errno.

◆ pbl_syscon_write()

int pbl_syscon_write ( const struct pbl_syscon *  syscon,
uint32_t  offset,
uint32_t  val 
)

Write a register.

Parameters
sysconSystem controller.
offsetOffset of the register.
valValue.
Returns
0, -ENODEV if the controller is not ready, or a negative errno.