blob: 81ab3638ab82988bc1c03468f8695b9b253b3b7f [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.serialimpl;
using zx;
using fuchsia.hardware.serial;
enum SerialState : uint32 {
READABLE = 0x1;
WRITABLE = 0x2;
};
/// Callback for notification of readable/writeable state changes
/// This may be called from an interrupt thread it should just signal another thread
/// and return as soon as possible. In particular, it may not be safe to make protocol calls
/// from these callbacks.
[Transport = "Banjo", BanjoLayout = "ddk-callback"]
protocol SerialNotify {
Callback(SerialState state) -> ();
};
[Transport = "Banjo", BanjoLayout = "ddk-protocol"]
protocol SerialImpl {
GetInfo() -> (zx.status s, fuchsia.hardware.serial.SerialPortInfo info);
/// Configures the given serial port.
Config(uint32 baud_rate, uint32 flags) -> (zx.status s);
Enable(bool enable) -> (zx.status s);
Read() -> (zx.status s, [Buffer] vector<uint8> buf);
Write([Buffer] vector<uint8> buf) -> (zx.status s, uint64 actual);
SetNotifyCallback(SerialNotify cb) -> (zx.status s);
};