blob: bae583df88231ba9f08ec9e4bc788cc16c1b22a4 [file] [log] [blame] [edit]
// Copyright 2022 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.gpio;
using zx;
/// A fuchsia.hardware.gpio.Gpio call to make as part of an `InitStep`.
type InitCall = flexible union {
/// If set, the GPIO core driver will call `ConfigIn` with the given flags.
1: input_flags GpioFlags;
/// If set, the GPIO core driver will call `ConfigOut` with the given output value.
2: output_value uint8;
/// If set, the GPIO core driver will call `SetAltFunction` with the given alt function value
/// (specific to the GPIO implementation driver).
3: alt_function uint64;
/// If set, the GPIO core driver will call `SetDriveStrength` with the given value in microamps.
4: drive_strength_ua uint64;
/// If set, the GPIO core driver will delay for this long before processing the next step.
5: delay zx.Duration;
};
/// A single init step to be performed by the GPIO core driver.
type InitStep = struct {
/// The platform-specific GPIO index that this step operates on.
index uint32;
/// A call to make on this GPIO.
call InitCall;
};
/// Passed to the GPIO core driver in metadata as DEVICE_METADATA_GPIO_INIT. Steps are processed
/// sequentially in the order that they appear in the vector. Processing occurs once during the GPIO
/// core driver's bind hook.
type InitMetadata = struct {
steps vector<InitStep>:MAX;
};