blob: 09912a71c7e68b1f353e521a7e7ea3433d5741c2 [file] [log] [blame]
// Copyright 2017 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_ARM_SEMAPHORE_H
#define MSD_ARM_SEMAPHORE_H
#include "magma_util/macros.h"
#include "msd_defs.h"
#include "platform_semaphore.h"
class MsdArmAbiSemaphore : public msd_semaphore_t {
public:
MsdArmAbiSemaphore(std::shared_ptr<magma::PlatformSemaphore> ptr) : ptr_(std::move(ptr))
{
magic_ = kMagic;
}
static MsdArmAbiSemaphore* cast(msd_semaphore_t* semaphore)
{
DASSERT(semaphore);
DASSERT(semaphore->magic_ == kMagic);
return static_cast<MsdArmAbiSemaphore*>(semaphore);
}
std::shared_ptr<magma::PlatformSemaphore> ptr() { return ptr_; }
private:
std::shared_ptr<magma::PlatformSemaphore> ptr_;
static constexpr uint32_t kMagic = 0x73656d61; // "sema"
};
#endif // MSD_ARM_SEMAPHORE_H