blob: 5039e85178dd0b5102f071f156146151f22e6314 [file] [log] [blame]
// 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.gpioimpl;
using 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 fuchsia.hardware.gpio.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;
};
/// Information passed to the GPIO core driver through GpioImpl protocol methods.
type ControllerMetadata = struct {
/// ID for the controller which is unique among all gpio controllers.
/// Passed through GetControllerId to the core driver.
id uint32;
};