speaker.hh revision 7903
12810SN/A/* 211893Snikos.nikoleris@arm.com * Copyright (c) 2008 The Regents of The University of Michigan 39796Sprakash.ramrakhyani@arm.com * All rights reserved. 49796Sprakash.ramrakhyani@arm.com * 59796Sprakash.ramrakhyani@arm.com * Redistribution and use in source and binary forms, with or without 69796Sprakash.ramrakhyani@arm.com * modification, are permitted provided that the following conditions are 79796Sprakash.ramrakhyani@arm.com * met: redistributions of source code must retain the above copyright 89796Sprakash.ramrakhyani@arm.com * notice, this list of conditions and the following disclaimer; 99796Sprakash.ramrakhyani@arm.com * redistributions in binary form must reproduce the above copyright 109796Sprakash.ramrakhyani@arm.com * notice, this list of conditions and the following disclaimer in the 119796Sprakash.ramrakhyani@arm.com * documentation and/or other materials provided with the distribution; 129796Sprakash.ramrakhyani@arm.com * neither the name of the copyright holders nor the names of its 139796Sprakash.ramrakhyani@arm.com * contributors may be used to endorse or promote products derived from 142810SN/A * this software without specific prior written permission. 152810SN/A * 162810SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172810SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182810SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192810SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202810SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212810SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222810SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232810SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242810SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252810SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262810SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272810SN/A * 282810SN/A * Authors: Gabe Black 292810SN/A */ 302810SN/A 312810SN/A#ifndef __DEV_X86_SPEAKER_HH__ 322810SN/A#define __DEV_X86_SPEAKER_HH__ 332810SN/A 342810SN/A#include "base/bitunion.hh" 352810SN/A#include "params/PcSpeaker.hh" 362810SN/A 372810SN/Anamespace X86ISA 382810SN/A{ 392810SN/A 402810SN/Aclass I8254; 412810SN/A 422810SN/Aclass Speaker : public BasicPioDevice 432810SN/A{ 442810SN/A protected: 452810SN/A Tick latency; 462810SN/A 472810SN/A BitUnion8(SpeakerControl) 482810SN/A Bitfield<0> gate; 4911486Snikos.nikoleris@arm.com Bitfield<1> speaker; 5011486Snikos.nikoleris@arm.com Bitfield<5> timer; 5112727Snikos.nikoleris@arm.com EndBitUnion(SpeakerControl) 5212727Snikos.nikoleris@arm.com 5312727Snikos.nikoleris@arm.com SpeakerControl controlVal; 545338Sstever@gmail.com 5512727Snikos.nikoleris@arm.com I8254 * timer; 5612727Snikos.nikoleris@arm.com 5712727Snikos.nikoleris@arm.com public: 582810SN/A typedef PcSpeakerParams Params; 5912727Snikos.nikoleris@arm.com 602810SN/A const Params * 619796Sprakash.ramrakhyani@arm.com params() const 6211893Snikos.nikoleris@arm.com { 6311893Snikos.nikoleris@arm.com return dynamic_cast<const Params *>(_params); 6411722Ssophiane.senni@gmail.com } 6511722Ssophiane.senni@gmail.com 6611722Ssophiane.senni@gmail.com Speaker(Params *p) : BasicPioDevice(p), 6711722Ssophiane.senni@gmail.com latency(p->pio_latency), controlVal(0), timer(p->i8254) 6812513Sodanrc@yahoo.com.br { 6912513Sodanrc@yahoo.com.br pioSize = 1; 7012629Sodanrc@yahoo.com.br } 7112629Sodanrc@yahoo.com.br 729796Sprakash.ramrakhyani@arm.com Tick read(PacketPtr pkt); 739796Sprakash.ramrakhyani@arm.com 749796Sprakash.ramrakhyani@arm.com Tick write(PacketPtr pkt); 752810SN/A 762810SN/A virtual void serialize(std::ostream &os); 772810SN/A virtual void unserialize(Checkpoint *cp, const std::string §ion); 7810360Sandreas.hansson@arm.com 792810SN/A}; 802810SN/A 812810SN/A} // namespace X86ISA 822810SN/A 8312636Sodanrc@yahoo.com.br#endif //__DEV_X86_SPEAKER_HH__ 8412636Sodanrc@yahoo.com.br