| // Copyright 2024 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. |
| @available(added=25) |
| library fuchsia.hardware.pinimpl; |
| |
| using fuchsia.hardware.gpio; |
| using fuchsia.hardware.pin; |
| using zx; |
| |
| /// This protocol combines the functionality of fuchsia.hardware.gpio.Gpio and |
| /// fuchsia.hardware.pin.Pin, accepting a number indicating the pin to act on. See those protocol |
| /// definitions for details on specific methods. |
| /// |
| /// A PinImpl server must support at least one client connection. The server should release all |
| /// interrupts returned by `GetInterrupt()` if the client that requested the interrupts disconnects. |
| /// |
| /// Common error codes: |
| /// - `ZX_ERR_NOT_FOUND`: No pin exists with number `pin`. |
| /// - `ZX_ERR_NOT_SUPPORTED`: The requested operation is not supported by this controller. |
| /// - `ZX_ERR_WRONG_TYPE`: If the pin does not support GPIO. |
| @transport("Driver") |
| open protocol PinImpl { |
| strict Read(struct { |
| pin uint32; |
| }) -> (struct { |
| value bool; |
| }) error zx.Status; |
| |
| strict SetBufferMode(struct { |
| pin uint32; |
| mode fuchsia.hardware.gpio.BufferMode; |
| }) -> () error zx.Status; |
| |
| strict ConfigureInterrupt(struct { |
| pin uint32; |
| config fuchsia.hardware.gpio.InterruptConfiguration; |
| }) -> () error zx.Status; |
| |
| /// The PinImpl server should create a new interrupt object for each call to `GetInterrupt()`. |
| strict GetInterrupt(struct { |
| pin uint32; |
| options fuchsia.hardware.gpio.InterruptOptions; |
| }) -> (resource struct { |
| interrupt zx.Handle:INTERRUPT; |
| }) error zx.Status; |
| |
| strict ReleaseInterrupt(struct { |
| pin uint32; |
| }) -> () error zx.Status; |
| |
| strict Configure(struct { |
| pin uint32; |
| config fuchsia.hardware.pin.Configuration; |
| }) -> (struct { |
| new_config fuchsia.hardware.pin.Configuration; |
| }) error zx.Status; |
| }; |
| |
| service Service { |
| device client_end:PinImpl; |
| }; |