| // 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.init; |
| |
| using fuchsia.hardware.gpio; |
| |
| /// GPIO calls to make as part of an init step. Calls are made in the order that they appear in the |
| /// table; multiple steps can be used for a single GPIO if a different order is needed. |
| type GpioInitOptions = table { |
| /// If set, the GPIO core driver will call `SetAltFunction` with the given alt function value |
| /// (specific to the GPIO implementation driver). |
| 1: alt_function uint64; |
| /// If set, the GPIO core driver will call `ConfigIn` with the given flags. |
| 2: input_flags fuchsia.hardware.gpio.GpioFlags; |
| /// If set, the GPIO core driver will call `ConfigOut` with the given output value. |
| 3: output_value uint8; |
| /// If set, the GPIO core driver will call `SetDriveStrength` with the given value in microamps. |
| 4: drive_strength_ua uint64; |
| }; |
| |
| /// A single init step to be performed by the GPIO core driver. |
| type GpioInitStep = struct { |
| /// The platform-specific GPIO index that this step operates on. |
| index uint32; |
| /// Zero or more calls to make on this GPIO. |
| options GpioInitOptions; |
| }; |
| |
| /// Passed to the GPIO core driver in metadata as DEVICE_METADATA_GPIO_INIT_STEPS. 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 GpioInitMetadata = struct { |
| steps vector<GpioInitStep>:MAX; |
| }; |