dtod.hh revision 8332:23711432221f
110816SN/A/* 29288SN/A * Copyright (c) 2004-2006 The Regents of The University of Michigan 39288SN/A * All rights reserved. 49288SN/A * 59288SN/A * Redistribution and use in source and binary forms, with or without 69288SN/A * modification, are permitted provided that the following conditions are 79288SN/A * met: redistributions of source code must retain the above copyright 89288SN/A * notice, this list of conditions and the following disclaimer; 99288SN/A * redistributions in binary form must reproduce the above copyright 109288SN/A * notice, this list of conditions and the following disclaimer in the 119288SN/A * documentation and/or other materials provided with the distribution; 129288SN/A * neither the name of the copyright holders nor the names of its 134486SN/A * contributors may be used to endorse or promote products derived from 144486SN/A * this software without specific prior written permission. 154486SN/A * 164486SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174486SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184486SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194486SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204486SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214486SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224486SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234486SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244486SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254486SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264486SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274486SN/A * 284486SN/A * Authors: Ali Saidi 294486SN/A */ 304486SN/A 314486SN/A/** @file 324486SN/A * This device acts as a simple time of date device. It's implemented as a 334486SN/A * simple device register read. 344486SN/A */ 354486SN/A 364486SN/A#ifndef __DEV_SPARC_DTOD_HH__ 374486SN/A#define __DEV_SPARC_DTOD_HH__ 384486SN/A 394486SN/A#include <vector> 4011053Sandreas.hansson@arm.com 414486SN/A#include "base/range.hh" 423102SN/A#include "dev/io_device.hh" 438833SN/A#include "params/DumbTOD.hh" 442826SN/A 458831SN/A/** 469796SN/A * DumbTOD simply returns some idea of time when read. Until we finish with 471615SN/A * legion it starts with the start time and increments itself by 1000 each time. 482826SN/A */ 491366SN/Aclass DumbTOD : public BasicPioDevice 5011053Sandreas.hansson@arm.com{ 519338SN/A private: 5210816SN/A uint64_t todTime; 5310816SN/A 5410816SN/A public: 5510816SN/A typedef DumbTODParams Params; 5611722Ssophiane.senni@gmail.com DumbTOD(const Params *p); 5711722Ssophiane.senni@gmail.com 5810816SN/A const Params * 5910816SN/A params() const 6012513Sodanrc@yahoo.com.br { 6112513Sodanrc@yahoo.com.br return dynamic_cast<const Params *>(_params); 6212513Sodanrc@yahoo.com.br } 631310SN/A 6410816SN/A virtual Tick read(PacketPtr pkt); 6510816SN/A virtual Tick write(PacketPtr pkt); 6610816SN/A 6710816SN/A /** 6810816SN/A * Serialize this object to the given output stream. 6910816SN/A * @param os The stream to serialize to. 7010816SN/A */ 7110884SN/A virtual void serialize(std::ostream &os); 7210816SN/A 7310816SN/A /** 745875SN/A * Reconstruct the state of this object from a checkpoint. 7510816SN/A * @param cp The checkpoint use. 7610816SN/A * @param section The section name of this object 7710816SN/A */ 7810025SN/A virtual void unserialize(Checkpoint *cp, const std::string §ion); 7910025SN/A 8010816SN/A 8110816SN/A}; 8210816SN/A 8310816SN/A#endif // __DEV_BADDEV_HH__ 8410816SN/A