| // 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 ddk.protocol.gpioimpl; |
| |
| using ddk.protocol.gpio; |
| using zx; |
| |
| [Layout = "ddk-protocol"] |
| protocol GpioImpl { |
| /// Configures a GPIO for input. |
| ConfigIn(uint32 index, uint32 flags) -> (zx.status s); |
| /// Configures a GPIO for output. |
| ConfigOut(uint32 index, uint8 initial_value) -> (zx.status s); |
| /// Configures the GPIO pin for an alternate function (I2C, SPI, etc) |
| /// the interpretation of "function" is platform dependent. |
| SetAltFunction(uint32 index, uint64 function) -> (zx.status s); |
| /// Configures the GPIO pin drive strength. |
| SetDriveStrength(uint32 index, uint8 mA) -> (zx.status s); |
| /// Reads the current value of a GPIO (0 or 1). |
| Read(uint32 index) -> (zx.status s, uint8 value); |
| /// Sets the current value of the GPIO (any non-zero value maps to 1). |
| Write(uint32 index, uint8 value) -> (zx.status s); |
| /// Gets an interrupt object pertaining to a particular GPIO pin. |
| GetInterrupt(uint32 index, uint32 flags) -> (zx.status s, handle<interrupt> irq); |
| /// Release the interrupt. |
| ReleaseInterrupt(uint32 index) -> (zx.status s); |
| /// Set GPIO polarity. |
| SetPolarity(uint32 index, ddk.protocol.gpio.GpioPolarity polarity) -> (zx.status s); |
| }; |