15390SN/A/* 25445SN/A * Copyright (c) 2008 The Regents of The University of Michigan 35390SN/A * All rights reserved. 45390SN/A * 55390SN/A * Redistribution and use in source and binary forms, with or without 65390SN/A * modification, are permitted provided that the following conditions are 75390SN/A * met: redistributions of source code must retain the above copyright 85390SN/A * notice, this list of conditions and the following disclaimer; 95390SN/A * redistributions in binary form must reproduce the above copyright 105390SN/A * notice, this list of conditions and the following disclaimer in the 115390SN/A * documentation and/or other materials provided with the distribution; 125390SN/A * neither the name of the copyright holders nor the names of its 135390SN/A * contributors may be used to endorse or promote products derived from 145390SN/A * this software without specific prior written permission. 155390SN/A * 165390SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175390SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185390SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195390SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205390SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215390SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225390SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235390SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245390SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255390SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265390SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 275390SN/A * 285390SN/A * Authors: Gabe Black 295390SN/A */ 305390SN/A 315636Sgblack@eecs.umich.edu#ifndef __DEV_X86_SPEAKER_HH__ 325636Sgblack@eecs.umich.edu#define __DEV_X86_SPEAKER_HH__ 335390SN/A 345636Sgblack@eecs.umich.edu#include "base/bitunion.hh" 359338SAndreas.Sandberg@arm.com#include "dev/io_device.hh" 365636Sgblack@eecs.umich.edu#include "params/PcSpeaker.hh" 375390SN/A 385390SN/Anamespace X86ISA 395390SN/A{ 405390SN/A 415445SN/Aclass I8254; 425445SN/A 435636Sgblack@eecs.umich.educlass Speaker : public BasicPioDevice 445390SN/A{ 455445SN/A protected: 465636Sgblack@eecs.umich.edu Tick latency; 475636Sgblack@eecs.umich.edu 485445SN/A BitUnion8(SpeakerControl) 495445SN/A Bitfield<0> gate; 505445SN/A Bitfield<1> speaker; 515445SN/A Bitfield<5> timer; 525445SN/A EndBitUnion(SpeakerControl) 535445SN/A 545445SN/A SpeakerControl controlVal; 555445SN/A 565445SN/A I8254 * timer; 575445SN/A 585390SN/A public: 595636Sgblack@eecs.umich.edu typedef PcSpeakerParams Params; 605390SN/A 615636Sgblack@eecs.umich.edu const Params * 625636Sgblack@eecs.umich.edu params() const 635636Sgblack@eecs.umich.edu { 645636Sgblack@eecs.umich.edu return dynamic_cast<const Params *>(_params); 655636Sgblack@eecs.umich.edu } 665636Sgblack@eecs.umich.edu 679808Sstever@gmail.com Speaker(Params *p) : BasicPioDevice(p, 1), 685826Sgblack@eecs.umich.edu latency(p->pio_latency), controlVal(0), timer(p->i8254) 695636Sgblack@eecs.umich.edu { 705636Sgblack@eecs.umich.edu } 715390SN/A 7211175Sandreas.hansson@arm.com Tick read(PacketPtr pkt) override; 735390SN/A 7411175Sandreas.hansson@arm.com Tick write(PacketPtr pkt) override; 757903Shestness@cs.utexas.edu 7611168Sandreas.hansson@arm.com void serialize(CheckpointOut &cp) const override; 7711168Sandreas.hansson@arm.com void unserialize(CheckpointIn &cp) override; 785390SN/A}; 795390SN/A 807811Ssteve.reinhardt@amd.com} // namespace X86ISA 815390SN/A 825636Sgblack@eecs.umich.edu#endif //__DEV_X86_SPEAKER_HH__ 83