blob: d03fcf90a8d8c48e705550222b6e864df22027c5 [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.async;
using zx;
using fuchsia.hardware.serial;
enum SerialState : uint32 {
READABLE = 0x1;
WRITABLE = 0x2;
};
[Transport = "Banjo", BanjoLayout = "ddk-protocol"]
protocol SerialImplAsync {
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);
/// Queues a receive operation. It is an error to queue
/// more than one receive operation at a time.
/// The callback will be invoked on the interrupt thread or the calling thread
/// if the write completes immediately.
/// ZX_ERR_NOT_SUPPORTED will be returned if a read is already pending.
[Async]
ReadAsync() -> (zx.status s, [Buffer] vector<uint8> buf);
/// Queues a packet for transmission. It is an error to queue
/// more than one transmit at a time. The callback will be invoked
/// on the interrupt thread, or the calling thread if data is available.
/// ZX_ERR_NOT_SUPPORTED will be returned if a write is already pending.
[Async]
WriteAsync([Buffer] vector<uint8> buf) -> (zx.status s);
/// Immediately cancels all outstanding asynchronous I/O
CancelAll() -> ();
};