blob: 4da742f164e6a08c2472fb4b83dec35ea45ddaee [file] [log] [blame]
// 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")
protocol GpioImpl {
/// Configures a GPIO for input.
ConfigIn(struct {
index uint32;
flags uint32;
}) -> (struct {
s zx.status;
});
/// Configures a GPIO for output.
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.
SetAltFunction(struct {
index uint32;
function uint64;
}) -> (struct {
s zx.status;
});
/// Configures the GPIO pin drive strength.
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).
GetDriveStrength(struct {
index uint32;
}) -> (struct {
s zx.status;
value uint64;
});
/// Reads the current value of a GPIO (0 or 1).
Read(struct {
index uint32;
}) -> (struct {
s zx.status;
value uint8;
});
/// Sets the current value of the GPIO (any non-zero value maps to 1).
Write(struct {
index uint32;
value uint8;
}) -> (struct {
s zx.status;
});
/// Gets an interrupt object pertaining to a particular GPIO pin.
GetInterrupt(struct {
index uint32;
flags uint32;
}) -> (resource struct {
s zx.status;
irq zx.handle:INTERRUPT;
});
/// Release the interrupt.
ReleaseInterrupt(struct {
index uint32;
}) -> (struct {
s zx.status;
});
/// Set GPIO polarity.
SetPolarity(struct {
index uint32;
polarity fuchsia.hardware.gpio.GpioPolarity;
}) -> (struct {
s zx.status;
});
};