Pigweed
 
Loading...
Searching...
No Matches
pw::clock_tree::DependentElement< ElementType > Class Template Reference

#include <clock_tree.h>

Inheritance diagram for pw::clock_tree::DependentElement< ElementType >:
pw::clock_tree::ClockDividerElement< ElementType > pw::clock_tree::ClockMcuxpressoAudioPll< ElementType > pw::clock_tree::ClockMcuxpressoClkIn< ElementType > pw::clock_tree::ClockMcuxpressoClockIp< ElementType > pw::clock_tree::ClockMcuxpressoFrg< ElementType > pw::clock_tree::ClockMcuxpressoMclk< ElementType > pw::clock_tree::ClockMcuxpressoRtc< ElementType > pw::clock_tree::ClockMcuxpressoSelector< ElementType >

Public Member Functions

constexpr DependentElement (ElementType &source)
 Create a dependent clock tree element that depends on source.
 

Protected Member Functions

Status UpdateSource (ElementType &new_source, bool permit_change_if_in_use)
 

Private Member Functions

Status Acquire () final
 
Status Release () final
 

Detailed Description

template<typename ElementType>
class pw::clock_tree::DependentElement< ElementType >

Abstract class template of a clock tree element that depends on another clock tree element.

A DependentElement clock tree element depends on another clock tree element.

Class implementations of DependentElement must override the DoEnable function, the DoDisable function can be overridden to disable the dependent clock tree element to save power.

Template argument ElementType can be of class ElementBlocking, ElementNonBlockingCannotFail or ElementNonBlockingMightFail.

Member Function Documentation

◆ Acquire()

template<typename ElementType >
Status pw::clock_tree::DependentElement< ElementType >::Acquire ( )
inlinefinalprivate

Acquire a reference to the dependent clock tree element.

When the first reference gets acquired, a reference to the source element gets acquired, before the dependent clock tree element gets enabled.

◆ Release()

template<typename ElementType >
Status pw::clock_tree::DependentElement< ElementType >::Release ( )
inlinefinalprivate

Release a reference to the dependent clock tree element.

When the last reference gets released, the dependent clock tree element gets disabled (if implemented), before the reference to the source element gets released.

◆ UpdateSource()

template<typename ElementType >
Status pw::clock_tree::DependentElement< ElementType >::UpdateSource ( ElementType &  new_source,
bool  permit_change_if_in_use 
)
inlineprotected

Update source dependency.

It is the responsibility of the derived class to ensure that the source dependency can only be changed when permitted, i.e. only if reference count is zero. If the update is permitted while the reference count is greater than zero, the caller of this function must make sure that the DoEnable method has access to the updated configuration matching the new source dependency. Only if the UpdateSource call succeeds, the new source has been configured as the source_ element for this element, otherwise the old source element is still configured as source_ element for this element. If the DoEnable call of the new source fails, the current element will be disabled, since the previous source got already released, and the old source remains configured as the dependent element.


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