blob: d7daaa27d59fb621b4e392662e09428e78ddd201 [file] [log] [blame] [edit]
// Copyright 2018 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;
@transport("Banjo")
@banjo_layout("ddk-protocol")
closed protocol GpioImpl {
/// Configures a GPIO for input.
strict ConfigIn(struct {
index uint32;
flags uint32;
}) -> (struct {
s zx.Status;
});
/// Configures a GPIO for output.
strict ConfigOut(struct {
index uint32;
initial_value uint8;
}) -> (struct {
s zx.Status;
});
/// Configures the GPIO pin for an alternate function (I2C, SPI, etc)
/// the interpretation of "function" is platform dependent.
strict SetAltFunction(struct {
index uint32;
function uint64;
}) -> (struct {
s zx.Status;
});
/// Configures the GPIO pin drive strength.
strict SetDriveStrength(struct {
index uint32;
ua uint64;
}) -> (struct {
s zx.Status;
actual_ua uint64;
});
/// Returns the configured drive strength for a GPIO pin in microamps (ua).
strict GetDriveStrength(struct {
index uint32;
}) -> (struct {
s zx.Status;
value uint64;
});
/// Reads the current value of a GPIO (0 or 1).
strict Read(struct {
index uint32;
}) -> (struct {
s zx.Status;
value uint8;
});
/// Sets the current value of the GPIO (any non-zero value maps to 1).
strict Write(struct {
index uint32;
value uint8;
}) -> (struct {
s zx.Status;
});
/// Gets an interrupt object pertaining to a particular GPIO pin.
strict GetInterrupt(struct {
index uint32;
flags uint32;
}) -> (resource struct {
s zx.Status;
irq zx.Handle:INTERRUPT;
});
/// Release the interrupt.
strict ReleaseInterrupt(struct {
index uint32;
}) -> (struct {
s zx.Status;
});
/// Set GPIO polarity.
strict SetPolarity(struct {
index uint32;
polarity fuchsia.hardware.gpio.GpioPolarity;
}) -> (struct {
s zx.Status;
});
};