blob: 795f9ee5e3c9c4a5df7a70e27c6c7d3ffd2091cc [file] [log] [blame]
// Copyright 2019 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.
#ifndef MSD_IMG_DEVICE_H
#define MSD_IMG_DEVICE_H
#include <memory>
#include "magma_util/macros.h"
#include "msd.h"
#include "platform_device.h"
typedef struct _PVRSRV_DEVICE_NODE_ PVRSRV_DEVICE_NODE;
class MsdImgDevice : public msd_device_t
{
public:
virtual ~MsdImgDevice();
static std::unique_ptr<MsdImgDevice> Create(struct msd_driver_t* drv, void* device);
bool Init();
static void Destroy(MsdImgDevice* drv);
static MsdImgDevice* cast(msd_device_t* drv)
{
DASSERT(drv);
DASSERT(drv->magic_ == kMagic);
return static_cast<MsdImgDevice*>(drv);
}
magma::PlatformHandle* bti() { return bti_.get(); }
private:
MsdImgDevice(std::unique_ptr<magma::PlatformDevice>);
static const uint32_t kMagic = 'idev';
std::unique_ptr<magma::PlatformDevice> platform_device_;
std::unique_ptr<magma::PlatformHandle> bti_;
PVRSRV_DEVICE_NODE* device_node_ = nullptr;
};
#endif // MSD_IMG_DEVICE_H