1// Copyright 2018 The Fuchsia Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5library ddk.protocol.gpioimpl; 6 7using ddk.protocol.gpio; 8using zx; 9 10[Layout = "ddk-protocol", HandleWrappers] 11interface GpioImpl { 12 /// Configures a GPIO for input. 13 ConfigIn(uint32 index, uint32 flags) -> (zx.status s); 14 /// Configures a GPIO for output. 15 ConfigOut(uint32 index, uint8 initial_value) -> (zx.status s); 16 /// Configures the GPIO pin for an alternate function (I2C, SPI, etc) 17 /// the interpretation of "function" is platform dependent. 18 SetAltFunction(uint32 index, uint64 function) -> (zx.status s); 19 /// Reads the current value of a GPIO (0 or 1). 20 Read(uint32 index) -> (zx.status s, uint8 value); 21 /// Sets the current value of the GPIO (any non-zero value maps to 1). 22 Write(uint32 index, uint8 value) -> (zx.status s); 23 /// Gets an interrupt object pertaining to a particular GPIO pin. 24 GetInterrupt(uint32 index, uint32 flags) -> (zx.status s, handle<interrupt> irq); 25 /// Release the interrupt. 26 ReleaseInterrupt(uint32 index) -> (zx.status s); 27 /// Set GPIO polarity. 28 SetPolarity(uint32 index, ddk.protocol.gpio.GpioPolarity polarity) -> (zx.status s); 29}; 30