blob: a81d33adc61a5fa3b97e7b6f324117a8fbf1240a [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;
};
[Layout = "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, vector<voidptr> 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(vector<voidptr> buf) -> (zx.status s);
/// Immediately cancels all outstanding asynchronous I/O
CancelAll() -> ();
};