blob: 930298e5a731e7d8c7d99e8a3bbdb83b38e2571d [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.nand;
using fuchsia.hardware.nand;
using zx;
// Defines a Read/Write/Erase request to be sent to the nand driver.
struct BrokerRequest {
handle<vmo>? vmo; // Only used for read and write.
uint32 length; // In pages (read / write) or blocks (erase).
uint32 offset_nand; // In pages (read / write) or blocks (erase).
uint64 offset_data_vmo; // In pages.
uint64 offset_oob_vmo; // In pages.
bool data_vmo; // True to read or write data.
bool oob_vmo; // True to read or write OOB data.
};
[Layout = "Simple"]
protocol Broker {
// Retrieves the nand info from the underlying device.
GetInfo() -> (zx.status status, fuchsia.hardware.nand.Info? info);
// Reads from the nand device.
Read(BrokerRequest request) -> (zx.status status, uint32 corrected_bit_flips);
// Writes to the nand device.
Write(BrokerRequest request) -> (zx.status status);
// Erases part of the nand device.
Erase(BrokerRequest request) -> (zx.status status);
};