blob: 04ebb5da4deaf0fa5f61d9fe117446956994f1df [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.hardware.clock;
using zx;
/// Used for driver-to-driver communication.
@discoverable
open protocol Clock {
/// Enables (ungates) this clock.
/// Drivers *must* call enable on all clocks they depend upon.
flexible Enable() -> () error zx.Status;
/// Disables (gates) this clock.
/// Drivers should call this method to indicate to the clock subsystem that
/// a particular clock signal is no longer necessary.
flexible Disable() -> () error zx.Status;
/// Returns `true` if a given clock is running.
/// May query the hardware or return a cached value.
flexible IsEnabled() -> (struct {
enabled bool;
}) error zx.Status;
/// Attempt to set the rate of the clock provider.
flexible SetRate(struct {
hz uint64;
}) -> () error zx.Status;
/// Query the hardware for the highest supported rate that does not
/// exceed hz_in.
flexible QuerySupportedRate(struct {
hz_in uint64;
}) -> (struct {
hz_out uint64;
}) error zx.Status;
/// Returns the current rate that a given clock is running at.
flexible GetRate() -> (struct {
hz uint64;
}) error zx.Status;
/// Sets the input of this clock by index. I.e. by selecting a mux.
/// This clock has N inputs defined 0 through N-1, which are valid arguemts
/// as the index to SetInput.
flexible SetInput(struct {
idx uint32;
}) -> () error zx.Status;
/// Returns the number of inputs this clock has.
/// Any value between 0 and UINT32_MAX is a valid return for this method.
/// A Root Oscillator may return 0 for instance, if it has no inputs.
flexible GetNumInputs() -> (struct {
n uint32;
}) error zx.Status;
/// Returns the index of the current input of this clock.
flexible GetInput() -> (struct {
index uint32;
}) error zx.Status;
};
service Service {
clock client_end:Clock;
};