generic_timer.hh (10845:75df7a87be83) | generic_timer.hh (10847:1826ee736709) |
---|---|
1/* 2 * Copyright (c) 2013, 2015 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 40 unchanged lines hidden (view full) --- 49 50/// @file 51/// This module implements the global system counter and the local per-CPU 52/// architected timers as specified by the ARM Generic Timer extension (ARM 53/// ARM, Issue C, Chapter 17). 54 55class Checkpoint; 56class GenericTimerParams; | 1/* 2 * Copyright (c) 2013, 2015 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 40 unchanged lines hidden (view full) --- 49 50/// @file 51/// This module implements the global system counter and the local per-CPU 52/// architected timers as specified by the ARM Generic Timer extension (ARM 53/// ARM, Issue C, Chapter 17). 54 55class Checkpoint; 56class GenericTimerParams; |
57class GenericTimerMemParams; |
|
57 58/// Global system counter. It is shared by the architected timers. 59/// @todo: implement memory-mapped controls 60class SystemCounter 61{ 62 protected: 63 /// Counter frequency (as specified by CNTFRQ). 64 uint64_t _freq; --- 203 unchanged lines hidden (view full) --- 268 return parent.readMiscReg(misc_reg, cpu); 269 } 270 271 protected: 272 GenericTimer &parent; 273 unsigned cpu; 274}; 275 | 58 59/// Global system counter. It is shared by the architected timers. 60/// @todo: implement memory-mapped controls 61class SystemCounter 62{ 63 protected: 64 /// Counter frequency (as specified by CNTFRQ). 65 uint64_t _freq; --- 203 unchanged lines hidden (view full) --- 269 return parent.readMiscReg(misc_reg, cpu); 270 } 271 272 protected: 273 GenericTimer &parent; 274 unsigned cpu; 275}; 276 |
277class GenericTimerMem : public PioDevice 278{ 279 public: 280 GenericTimerMem(GenericTimerMemParams *p); 281 282 void serialize(std::ostream &os) M5_ATTR_OVERRIDE; 283 void unserialize(Checkpoint *cp, const std::string &sec) M5_ATTR_OVERRIDE; 284 285 public: // PioDevice 286 AddrRangeList getAddrRanges() const M5_ATTR_OVERRIDE { return addrRanges; } 287 Tick read(PacketPtr pkt) M5_ATTR_OVERRIDE; 288 Tick write(PacketPtr pkt) M5_ATTR_OVERRIDE; 289 290 protected: 291 uint64_t ctrlRead(Addr addr, size_t size) const; 292 void ctrlWrite(Addr addr, size_t size, uint64_t value); 293 294 uint64_t timerRead(Addr addr, size_t size) const; 295 void timerWrite(Addr addr, size_t size, uint64_t value); 296 297 protected: // Registers 298 static const Addr CTRL_CNTFRQ = 0x000; 299 static const Addr CTRL_CNTNSAR = 0x004; 300 static const Addr CTRL_CNTTIDR = 0x008; 301 static const Addr CTRL_CNTACR_BASE = 0x040; 302 static const Addr CTRL_CNTVOFF_LO_BASE = 0x080; 303 static const Addr CTRL_CNTVOFF_HI_BASE = 0x084; 304 305 static const Addr TIMER_CNTPCT_LO = 0x000; 306 static const Addr TIMER_CNTPCT_HI = 0x004; 307 static const Addr TIMER_CNTVCT_LO = 0x008; 308 static const Addr TIMER_CNTVCT_HI = 0x00C; 309 static const Addr TIMER_CNTFRQ = 0x010; 310 static const Addr TIMER_CNTEL0ACR = 0x014; 311 static const Addr TIMER_CNTVOFF_LO = 0x018; 312 static const Addr TIMER_CNTVOFF_HI = 0x01C; 313 static const Addr TIMER_CNTP_CVAL_LO = 0x020; 314 static const Addr TIMER_CNTP_CVAL_HI = 0x024; 315 static const Addr TIMER_CNTP_TVAL = 0x028; 316 static const Addr TIMER_CNTP_CTL = 0x02C; 317 static const Addr TIMER_CNTV_CVAL_LO = 0x030; 318 static const Addr TIMER_CNTV_CVAL_HI = 0x034; 319 static const Addr TIMER_CNTV_TVAL = 0x038; 320 static const Addr TIMER_CNTV_CTL = 0x03C; 321 322 protected: // Params 323 const AddrRange ctrlRange; 324 const AddrRange timerRange; 325 const AddrRangeList addrRanges; 326 327 protected: 328 /// System counter. 329 SystemCounter systemCounter; 330 ArchTimer physTimer; 331 ArchTimer virtTimer; 332}; 333 |
|
276#endif // __DEV_ARM_GENERIC_TIMER_HH__ | 334#endif // __DEV_ARM_GENERIC_TIMER_HH__ |