blob: 556b74af55692119c51416b61b02d44a076e4522 [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.i2cimpl;
using zx;
/// See `Transact` below for usage.
struct I2cImplOp {
uint16 address;
[Buffer, Mutable] vector<uint8> data;
bool is_read;
bool stop;
};
/// Low-level protocol for i2c drivers.
[Transport = "Banjo", BanjoLayout = "ddk-protocol"]
protocol I2cImpl {
GetBusCount() -> (uint32 count);
GetMaxTransferSize(uint32 bus_id) -> (zx.status s, uint64 size);
/// Sets the bitrate for the i2c bus in KHz units.
SetBitrate(uint32 bus_id, uint32 bitrate) -> (zx.status s);
/// |Transact| assumes that all ops buf are not null.
/// |Transact| assumes that all ops length are not zero.
/// |Transact| assumes that at least the last op has stop set to true.
Transact(uint32 bus_id, vector<I2cImplOp> op) -> (zx.status status);
};