class Tree

Defined at line 40 of file ../../src/devices/clock/lib/clocktree/include/clocktree.h

clk::Tree class manages an array of BaseClock objects that represent a clock tree

For more information see ClockTree.md -- TODO(https://fxbug.dev/42122493): Write documentation.

Example Usage:

// Create some clock classes that inherit from BaseClock

class MyGateClock : public clk::BaseClock {};

class MyMuxClock : public clk::BaseClock {};

// Instantiate these classes.

MyGateClock gateClock;

MyMuxClock muxClock;

// Add these clocks to an array of clocks and instantiate a clk::Tree.

BaseClock* clocks[] = {

&gateClock

,

&muxClock

};

clk::Tree tree(clocks, std::size(clocks));

// Now the Clock tree can be manupulated via calls to the Tree class as follows:

zx_status_t st = tree.Enable(kClk0);

Public Methods

zx_status_t Enable (const uint32_t id)

Defined at line 26 of file ../../src/devices/clock/lib/clocktree/clocktree.cc

void Tree (cpp20::span<BaseClock *> clocks, const uint32_t count)

Notes on ownership:

(1) The caller is responsible for managing the `clocks` array's memory. The tree class will

not attempt to free the `clocks` array Note that this permits the caller to statically

allocate the clock array.

(2) While the `Tree` class is in scope, it is not safe to manipulate the underlying clocks

array. While the lifetime of the `clocks` array is the responsibility of the caller, the

`Tree` class maintains exclusive access to the array for the duration of its lifespan.

Defined at line 49 of file ../../src/devices/clock/lib/clocktree/include/clocktree.h

zx_status_t Disable (const uint32_t id)

Defined at line 61 of file ../../src/devices/clock/lib/clocktree/clocktree.cc

zx_status_t IsEnabled (const uint32_t id, bool * out)

Defined at line 109 of file ../../src/devices/clock/lib/clocktree/clocktree.cc

zx_status_t SetRate (const uint32_t id, const Hertz rate)

Defined at line 123 of file ../../src/devices/clock/lib/clocktree/clocktree.cc

zx_status_t QuerySupportedRate (const uint32_t id, const Hertz max)

Defined at line 131 of file ../../src/devices/clock/lib/clocktree/clocktree.cc

zx_status_t GetRate (const uint32_t id, Hertz * out)

Defined at line 139 of file ../../src/devices/clock/lib/clocktree/clocktree.cc

zx_status_t SetInput (const uint32_t id, const uint32_t input_index)

Defined at line 145 of file ../../src/devices/clock/lib/clocktree/clocktree.cc

zx_status_t GetNumInputs (const uint32_t id, uint32_t * out)

Defined at line 200 of file ../../src/devices/clock/lib/clocktree/clocktree.cc

zx_status_t GetInput (const uint32_t id, uint32_t * out)

Defined at line 213 of file ../../src/devices/clock/lib/clocktree/clocktree.cc