Pigweed
 
Loading...
Searching...
No Matches
pw::clock_tree::ClockTree Class Reference

#include <clock_tree.h>

Public Member Functions

void Acquire (ElementNonBlockingCannotFail &element)
 
Status Acquire (ElementNonBlockingMightFail &element)
 
Status Acquire (ElementBlocking &element)
 
Status Acquire (Element &element)
 
Status AcquireWith (Element &element, Element &element_with)
 
void Release (ElementNonBlockingCannotFail &element)
 
Status Release (ElementNonBlockingMightFail &element)
 
Status Release (ElementBlocking &element)
 
Status Release (Element &element)
 
void SetDividerValue (ClockDividerNonBlockingCannotFail &clock_divider, uint32_t divider_value)
 
Status SetDividerValue (ClockDividerNonBlockingMightFail &clock_divider, uint32_t divider_value)
 
Status SetDividerValue (ClockDividerBlocking &clock_divider, uint32_t divider_value)
 
Status SetDividerValue (ClockDivider &clock_divider, uint32_t divider_value)
 

Protected Attributes

sync::Mutex mutex_
 mutex_ protects ElementBlocking clock tree elements.
 
sync::InterruptSpinLock interrupt_spin_lock_
 

Detailed Description

Clock tree class that manages the state of clock tree elements.

The ClockTree provides the Acquire and Release methods to acquire a reference to ElementNonBlockingCannotFail, ElementNonBlockingMightFail, or ElementBlocking elements or to the generic Element element. These functions will acquire the proper lock to ensure that clock updates are synchronized.

The SetDividerValue method allows to change the divider value for ClockDividerNonBlockingCannotFail, ClockDividerNonBlockingMightFail or ClockDividerBlocking elements, or to the generic ClockDivider element.

Member Function Documentation

◆ Acquire() [1/4]

Status pw::clock_tree::ClockTree::Acquire ( Element element)
inline

Acquire a reference to a clock tree element. Acquiring the clock tree element might fail.

Note: May not be called from inside an interrupt context or with interrupts disabled.

◆ Acquire() [2/4]

Status pw::clock_tree::ClockTree::Acquire ( ElementBlocking element)
inline

Acquire a reference to a blocking clock tree element. Acquiring the clock tree element might fail.

◆ Acquire() [3/4]

void pw::clock_tree::ClockTree::Acquire ( ElementNonBlockingCannotFail element)
inline

Acquire a reference to a non-blocking clock tree element. Acquiring the clock tree element will succeed.

◆ Acquire() [4/4]

Status pw::clock_tree::ClockTree::Acquire ( ElementNonBlockingMightFail element)
inline

Acquire a reference to a non-blocking clock tree element. Acquiring the clock tree element might fail.

◆ AcquireWith()

Status pw::clock_tree::ClockTree::AcquireWith ( Element element,
Element element_with 
)
inline

Acquire a reference to clock tree element element while element_with clock tree is enabled. Acquiring the clock tree element might fail.

This is useful when dealing with synchronized clock muxes where, in order to switch to a new clock source, both the old and new clock must be running. This ensures that the old clock source (element_with) is running before attempting to activate the new clock source (element).

Note: May not be called from inside an interrupt context or with interrupts disabled.

◆ Release() [1/4]

Status pw::clock_tree::ClockTree::Release ( Element element)
inline

Release a reference to a clock tree element. Releasing the clock tree element might fail.

Note: May not be called from inside an interrupt context or with interrupts disabled.

◆ Release() [2/4]

Status pw::clock_tree::ClockTree::Release ( ElementBlocking element)
inline

Release a reference to a blocking clock tree element. Releasing the clock tree element might fail.

◆ Release() [3/4]

void pw::clock_tree::ClockTree::Release ( ElementNonBlockingCannotFail element)
inline

Release a reference to a non-blocking clock tree element. Releasing the clock tree element will succeed.

◆ Release() [4/4]

Status pw::clock_tree::ClockTree::Release ( ElementNonBlockingMightFail element)
inline

Release a reference to a non-blocking clock tree element. Releasing the clock tree element might fail.

◆ SetDividerValue() [1/4]

Status pw::clock_tree::ClockTree::SetDividerValue ( ClockDivider clock_divider,
uint32_t  divider_value 
)
inline

Set divider value for a clock divider element. Setting the clock divider value might fail.

Note: May not be called from inside an interrupt context or with interrupts disabled.

◆ SetDividerValue() [2/4]

Status pw::clock_tree::ClockTree::SetDividerValue ( ClockDividerBlocking clock_divider,
uint32_t  divider_value 
)
inline

Set divider value for a blocking clock divider element. Setting the clock divider value might fail.

◆ SetDividerValue() [3/4]

void pw::clock_tree::ClockTree::SetDividerValue ( ClockDividerNonBlockingCannotFail clock_divider,
uint32_t  divider_value 
)
inline

Set divider value for a non-blocking clock divider element. Setting the clock divider value will succeed.

◆ SetDividerValue() [4/4]

Status pw::clock_tree::ClockTree::SetDividerValue ( ClockDividerNonBlockingMightFail clock_divider,
uint32_t  divider_value 
)
inline

Set divider value for a non-blocking clock divider element. Setting the clock divider value might fail.

Member Data Documentation

◆ interrupt_spin_lock_

sync::InterruptSpinLock pw::clock_tree::ClockTree::interrupt_spin_lock_
protected

interrupt_spin_lock_ protects ElementNonBlockingCannotFail and ElementNonBlockingMightFail clock tree elements.


The documentation for this class was generated from the following file: