blob: 103daa0fa1a6c76ddd44291b2e2f927206c2a9da [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.
};
/// The Broker allows for serialized entry to the raw nand, which ensures only a single client is
/// ever talking to the nand device, and all higher level clients have disconnected. In addition,
/// access to raw nand is restricted from the system during production where nand-broker is not
/// present.
[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);
};