sc_semaphore.hh revision 12841
18512Sgeoffrey.blake@arm.com/*
28512Sgeoffrey.blake@arm.com * Copyright 2018 Google, Inc.
38512Sgeoffrey.blake@arm.com *
48512Sgeoffrey.blake@arm.com * Redistribution and use in source and binary forms, with or without
58512Sgeoffrey.blake@arm.com * modification, are permitted provided that the following conditions are
68512Sgeoffrey.blake@arm.com * met: redistributions of source code must retain the above copyright
78512Sgeoffrey.blake@arm.com * notice, this list of conditions and the following disclaimer;
88512Sgeoffrey.blake@arm.com * redistributions in binary form must reproduce the above copyright
98512Sgeoffrey.blake@arm.com * notice, this list of conditions and the following disclaimer in the
108512Sgeoffrey.blake@arm.com * documentation and/or other materials provided with the distribution;
118512Sgeoffrey.blake@arm.com * neither the name of the copyright holders nor the names of its
128512Sgeoffrey.blake@arm.com * contributors may be used to endorse or promote products derived from
138512Sgeoffrey.blake@arm.com * this software without specific prior written permission.
148512Sgeoffrey.blake@arm.com *
158512Sgeoffrey.blake@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
168512Sgeoffrey.blake@arm.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
178512Sgeoffrey.blake@arm.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
188512Sgeoffrey.blake@arm.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
198512Sgeoffrey.blake@arm.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
208512Sgeoffrey.blake@arm.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
218512Sgeoffrey.blake@arm.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
228512Sgeoffrey.blake@arm.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
238512Sgeoffrey.blake@arm.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
248512Sgeoffrey.blake@arm.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
258512Sgeoffrey.blake@arm.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
268512Sgeoffrey.blake@arm.com *
278512Sgeoffrey.blake@arm.com * Authors: Gabe Black
288512Sgeoffrey.blake@arm.com */
298512Sgeoffrey.blake@arm.com
308512Sgeoffrey.blake@arm.com#ifndef __SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_HH__
318512Sgeoffrey.blake@arm.com#define __SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_HH__
328512Sgeoffrey.blake@arm.com
338512Sgeoffrey.blake@arm.com#include "../core/sc_object.hh"
348512Sgeoffrey.blake@arm.com#include "sc_semaphore_if.hh"
358512Sgeoffrey.blake@arm.com
368512Sgeoffrey.blake@arm.comnamespace sc_core
378512Sgeoffrey.blake@arm.com{
388512Sgeoffrey.blake@arm.com
398512Sgeoffrey.blake@arm.comclass sc_semaphore : public sc_semaphore_if, public sc_object
408512Sgeoffrey.blake@arm.com{
418512Sgeoffrey.blake@arm.com  public:
428512Sgeoffrey.blake@arm.com    explicit sc_semaphore(int);
438512Sgeoffrey.blake@arm.com    sc_semaphore(const char *name, int);
449338SAndreas.Sandberg@arm.com
458512Sgeoffrey.blake@arm.com    virtual int wait();
468512Sgeoffrey.blake@arm.com    virtual int trywait();
478512Sgeoffrey.blake@arm.com    virtual int post();
488512Sgeoffrey.blake@arm.com    virtual int get_value() const;
498512Sgeoffrey.blake@arm.com
508512Sgeoffrey.blake@arm.com    virtual const char *kind() const;
518512Sgeoffrey.blake@arm.com
528512Sgeoffrey.blake@arm.com  private:
539525SAndreas.Sandberg@ARM.com    // Disabled
548512Sgeoffrey.blake@arm.com    sc_semaphore(const sc_semaphore &) :
558512Sgeoffrey.blake@arm.com            sc_interface(), sc_semaphore_if(), sc_object()
568512Sgeoffrey.blake@arm.com    {}
578512Sgeoffrey.blake@arm.com
5810905Sandreas.sandberg@arm.com    sc_semaphore &operator = (const sc_semaphore &) { return *this; }
598512Sgeoffrey.blake@arm.com};
608512Sgeoffrey.blake@arm.com
618512Sgeoffrey.blake@arm.com} // namespace sc_core
628512Sgeoffrey.blake@arm.com
638512Sgeoffrey.blake@arm.com#endif  //__SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_HH__
648512Sgeoffrey.blake@arm.com