blob: 8960bbad01d62f28f5928a45e3eda8e920538a89 [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.
#pragma once
#include <ddk/driver.h>
#include <ddk/protocol/nand.h>
#include <ddktl/protocol/nand.h>
namespace ftl {
// Automatically doubles the effective OOB size if it's less than 16 bytes.
class OobDoubler {
public:
constexpr static uint32_t kThreshold = 16;
explicit OobDoubler(const nand_protocol_t* parent) : parent_(parent) {}
~OobDoubler() {}
// Nand protocol interface.
void Query(fuchsia_hardware_nand_Info* info_out, size_t* nand_op_size_out);
void Queue(nand_operation_t* operation, nand_queue_callback completion_cb, void* cookie);
private:
ddk::NandProtocolClient parent_;
bool active_ = false;
};
} // namespace ftl.