1/* 2 * Copyright (c) 2004-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 37 unchanged lines hidden (view full) --- 46#include "sim/system.hh" 47 48using namespace std; 49using namespace TheISA; 50 51DumbTOD::DumbTOD(Params *p) 52 : BasicPioDevice(p) 53{ |
54 struct tm tm; 55 char *tz; 56 |
57 pioSize = 0x08; 58 |
59 parseTime(p->init_time, &tm); |
60 tz = getenv("TZ"); 61 setenv("TZ", "", 1); 62 tzset(); 63 todTime = mktime(&tm); 64 if (tz) 65 setenv("TZ", tz, 1); 66 else 67 unsetenv("TZ"); 68 tzset(); |
69 70 DPRINTFN("Real-time clock set to %s\n", asctime(&tm)); 71 DPRINTFN("Real-time clock set to %d\n", todTime); 72} 73 74Tick 75DumbTOD::read(PacketPtr pkt) 76{ --- 10 unchanged lines hidden (view full) --- 87} 88 89Tick 90DumbTOD::write(PacketPtr pkt) 91{ 92 panic("Dumb tod device doesn't support writes\n"); 93} 94 |
95void 96DumbTOD::serialize(std::ostream &os) 97{ 98 SERIALIZE_SCALAR(todTime); 99} 100 101void 102DumbTOD::unserialize(Checkpoint *cp, const std::string §ion) 103{ 104 UNSERIALIZE_SCALAR(todTime); 105} 106 107 |
108BEGIN_DECLARE_SIM_OBJECT_PARAMS(DumbTOD) 109 110 Param<Addr> pio_addr; 111 Param<Tick> pio_latency; 112 SimObjectParam<Platform *> platform; 113 SimObjectParam<System *> system; 114 VectorParam<int> time; 115 --- 25 unchanged lines hidden --- |