#include <clock_tree.h>
Public Member Functions | |
constexpr | Element (bool may_block=false) |
uint32_t | ref_count () const |
Get reference count for this clock tree element. | |
bool | may_block () const |
Check whether acquiring or releasing the element may block. | |
Element (const Element &)=delete | |
Element (const Element &&)=delete | |
Element & | operator= (const Element &)=delete |
Element & | operator= (const Element &&)=delete |
Protected Member Functions | |
virtual Status | Acquire ()=0 |
virtual Status | Release ()=0 |
uint32_t | IncRef () |
Increment reference count and return incremented value. | |
uint32_t | DecRef () |
Decrement reference count and return decremented value. | |
virtual Status | DoEnable ()=0 |
Function called when the clock tree element needs to get enabled. | |
virtual Status | DoDisable () |
Friends | |
class | ClockTree |
template<typename ElementType > | |
class | DependentElement |
class | ClockDivider |
Abstract base class for a clock tree element of a clock tree.
Class implementations of Element
must implement Acquire
and Release
functions. For clock tree elements that only get enabled / configured, it is sufficient to only override the DoEnable
function, otherwise it is required to override the DoDisable
function to disable the respective clock tree element.
Note: Clock tree element classes shouldn't be directly derived from the Element
class, but from the ElementBlocking
, ElementNonBlockingCannotFail
or ElementNonBlockingMightFail
class.
|
protectedpure virtual |
Acquire a reference to the clock tree element.
Acquiring a reference to a clock tree element ensures that the clock tree element is configured and enabled.
If the clock tree element depends on another clock tree element, a reference to the dependent clock tree element will get acquired when the first reference to this clock tree element gets acquired. This ensures that all dependent clock tree elements have been enabled before this clock tree element gets configured and enabled.
Implemented in pw::clock_tree::ClockSource< ElementNonBlockingCannotFail >.
|
inlineprotectedvirtual |
Function called when the clock tree element can get disabled.
Can be overridden by child class in case the clock tree element can be disabled to save power.
Reimplemented in pw::clock_tree::ClockSourceNoOp, pw::clock_tree::ClockMcuxpressoFro, and pw::clock_tree::ClockMcuxpressoLpOsc.
|
protectedpure virtual |
Function called when the clock tree element needs to get enabled.
Implemented in pw::clock_tree::ClockSourceNoOp, pw::clock_tree::ClockMcuxpressoFro, and pw::clock_tree::ClockMcuxpressoLpOsc.
|
protectedpure virtual |
Release a reference to the clock tree element.
Releasing the last reference to the clock tree element will disable the clock tree element.
When the last reference to the clock tree element gets released, the clock tree element gets disabled if the DoDisable
function is overridden.
If the clock tree element depends on another clock tree element, a reference to the dependent clock tree element will get released once the last reference to this clock tree element has been released and the clock tree element has been disabled. This ensures that the clock tree element gets disabled before all dependent clock tree elements have been disabled.
Implemented in pw::clock_tree::ClockSource< ElementNonBlockingCannotFail >.