dtod.cc (3943:68e673d2db04) | dtod.cc (3990:6a5fd06c76a0) |
---|---|
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{ | 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 |
|
54 pioSize = 0x08; 55 | 57 pioSize = 0x08; 58 |
56 struct tm tm; | |
57 parseTime(p->init_time, &tm); | 59 parseTime(p->init_time, &tm); |
58 todTime = timegm(&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(); |
59 60 DPRINTFN("Real-time clock set to %s\n", asctime(&tm)); 61 DPRINTFN("Real-time clock set to %d\n", todTime); 62} 63 64Tick 65DumbTOD::read(PacketPtr pkt) 66{ --- 10 unchanged lines hidden (view full) --- 77} 78 79Tick 80DumbTOD::write(PacketPtr pkt) 81{ 82 panic("Dumb tod device doesn't support writes\n"); 83} 84 | 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 |
|
85BEGIN_DECLARE_SIM_OBJECT_PARAMS(DumbTOD) 86 87 Param<Addr> pio_addr; 88 Param<Tick> pio_latency; 89 SimObjectParam<Platform *> platform; 90 SimObjectParam<System *> system; 91 VectorParam<int> time; 92 --- 25 unchanged lines hidden --- | 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 --- |