speaker.hh revision 9338
1451SN/A/* 21762SN/A * Copyright (c) 2008 The Regents of The University of Michigan 3451SN/A * All rights reserved. 4451SN/A * 5451SN/A * Redistribution and use in source and binary forms, with or without 6451SN/A * modification, are permitted provided that the following conditions are 7451SN/A * met: redistributions of source code must retain the above copyright 8451SN/A * notice, this list of conditions and the following disclaimer; 9451SN/A * redistributions in binary form must reproduce the above copyright 10451SN/A * notice, this list of conditions and the following disclaimer in the 11451SN/A * documentation and/or other materials provided with the distribution; 12451SN/A * neither the name of the copyright holders nor the names of its 13451SN/A * contributors may be used to endorse or promote products derived from 14451SN/A * this software without specific prior written permission. 15451SN/A * 16451SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17451SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18451SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19451SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20451SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21451SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22451SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23451SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24451SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25451SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26451SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Gabe Black 292665Ssaidi@eecs.umich.edu */ 302665Ssaidi@eecs.umich.edu 312665Ssaidi@eecs.umich.edu#ifndef __DEV_X86_SPEAKER_HH__ 32451SN/A#define __DEV_X86_SPEAKER_HH__ 33451SN/A 34885SN/A#include "base/bitunion.hh" 35885SN/A#include "dev/io_device.hh" 361040SN/A#include "params/PcSpeaker.hh" 371040SN/A 381040SN/Anamespace X86ISA 391040SN/A{ 401040SN/A 41885SN/Aclass I8254; 42885SN/A 432212SN/Aclass Speaker : public BasicPioDevice 448229Snate@binkert.org{ 452158SN/A protected: 469329Sdam.sunwoo@arm.com Tick latency; 478229Snate@binkert.org 481180SN/A BitUnion8(SpeakerControl) 498229Snate@binkert.org Bitfield<0> gate; 502680Sktlim@umich.edu Bitfield<1> speaker; 518232Snate@binkert.org Bitfield<5> timer; 528229Snate@binkert.org EndBitUnion(SpeakerControl) 531885SN/A 542521SN/A SpeakerControl controlVal; 552521SN/A 564826Ssaidi@eecs.umich.edu I8254 * timer; 572036SN/A 58451SN/A public: 59451SN/A typedef PcSpeakerParams Params; 602212SN/A 612212SN/A const Params * 62451SN/A params() const 632212SN/A { 642158SN/A return dynamic_cast<const Params *>(_params); 65451SN/A } 668706Sandreas.hansson@arm.com 678706Sandreas.hansson@arm.com Speaker(Params *p) : BasicPioDevice(p), 688706Sandreas.hansson@arm.com latency(p->pio_latency), controlVal(0), timer(p->i8254) 698706Sandreas.hansson@arm.com { 708706Sandreas.hansson@arm.com pioSize = 1; 718706Sandreas.hansson@arm.com } 728706Sandreas.hansson@arm.com 738706Sandreas.hansson@arm.com Tick read(PacketPtr pkt); 748706Sandreas.hansson@arm.com 758706Sandreas.hansson@arm.com Tick write(PacketPtr pkt); 768706Sandreas.hansson@arm.com 77451SN/A virtual void serialize(std::ostream &os); 781855SN/A virtual void unserialize(Checkpoint *cp, const std::string §ion); 791855SN/A 801855SN/A}; 811855SN/A 821855SN/A} // namespace X86ISA 831855SN/A 841855SN/A#endif //__DEV_X86_SPEAKER_HH__ 851855SN/A