#include "lpc_handler.hpp"

#include <cstdint>
#include <cstring>
#include <vector>

namespace blobs
{

bool LpcDataHandler::open()
{
    /* For the ASPEED LPC CTRL driver, the ioctl is required to set up the
     * window, with information from write() below.
     */
    return true;
}

bool LpcDataHandler::close()
{
    /* TODO: implement ioctl call to close window. */
    return false;
}

std::vector<std::uint8_t> LpcDataHandler::copyFrom(std::uint32_t length)
{
    /* TODO: implement this -- in an earlier and different version of this that
     * didn't use BLOBs, the region was memory-mapped and the writes to the data
     * were just done directly from the memory-mapped region instead of a
     * copyFrom() first call.  The idea with this change is that we may not be
     * able to get a memory-mapped handle from the driver from which to
     * automatically read data, but rather must perform some ioctl or other
     * access to get the data from the driver.
     */
    return {};
}

bool LpcDataHandler::write(const std::vector<std::uint8_t>& configuration)
{
    struct LpcRegion lpcRegion;

    if (configuration.size() != sizeof(lpcRegion))
    {
        return false;
    }

    std::memcpy(&lpcRegion, configuration.data(), configuration.size());

    std::uint32_t windowOffset;
    std::uint32_t windowSize;

    /* TODO: LpcRegion sanity checking. */

    std::tie(windowOffset, windowSize) =
        mapper->mapWindow(lpcRegion.address, lpcRegion.length);
    if (windowSize == 0)
    {
        /* Failed to map region. */
    }

    return false;
}

std::vector<std::uint8_t> LpcDataHandler::read()
{
    return {};
}

} // namespace blobs
