cmos.hh (5632:65132fd646c6) cmos.hh (5634:22553ec2f177)
1/*
2 * Copyright (c) 2008 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;

--- 24 unchanged lines hidden (view full) ---

33
34#include "dev/io_device.hh"
35#include "dev/mc146818.hh"
36#include "params/Cmos.hh"
37
38namespace X86ISA
39{
40
1/*
2 * Copyright (c) 2008 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;

--- 24 unchanged lines hidden (view full) ---

33
34#include "dev/io_device.hh"
35#include "dev/mc146818.hh"
36#include "params/Cmos.hh"
37
38namespace X86ISA
39{
40
41class I8259;
41class IntPin;
42
43class Cmos : public BasicPioDevice
44{
45 protected:
46 Tick latency;
47
48 uint8_t address;
49
50 static const int numRegs = 128;
51
52 uint8_t regs[numRegs];
53
54 uint8_t readRegister(uint8_t reg);
55 void writeRegister(uint8_t reg, uint8_t val);
56
57 class X86RTC : public MC146818
58 {
59 protected:
42
43class Cmos : public BasicPioDevice
44{
45 protected:
46 Tick latency;
47
48 uint8_t address;
49
50 static const int numRegs = 128;
51
52 uint8_t regs[numRegs];
53
54 uint8_t readRegister(uint8_t reg);
55 void writeRegister(uint8_t reg, uint8_t val);
56
57 class X86RTC : public MC146818
58 {
59 protected:
60 I8259 * i8259;
61 int intLine;
60 IntPin * intPin;
62 public:
63 X86RTC(EventManager *em, const std::string &n, const struct tm time,
61 public:
62 X86RTC(EventManager *em, const std::string &n, const struct tm time,
64 bool bcd, Tick frequency, I8259 *_i8259, int _intLine) :
65 MC146818(em, n, time, bcd, frequency),
66 i8259(_i8259), intLine(_intLine)
63 bool bcd, Tick frequency, IntPin * _intPin) :
64 MC146818(em, n, time, bcd, frequency), intPin(_intPin)
67 {
68 }
69 protected:
70 void handleEvent();
71 } rtc;
72
73 public:
74 typedef CmosParams Params;
75
76 Cmos(const Params *p) : BasicPioDevice(p), latency(p->pio_latency),
65 {
66 }
67 protected:
68 void handleEvent();
69 } rtc;
70
71 public:
72 typedef CmosParams Params;
73
74 Cmos(const Params *p) : BasicPioDevice(p), latency(p->pio_latency),
77 rtc(this, "rtc", p->time, true, ULL(5000000000),
78 p->i8259, p->int_line)
75 rtc(this, "rtc", p->time, true, ULL(5000000000), p->int_pin)
79 {
80 pioSize = 2;
81 memset(regs, 0, numRegs * sizeof(uint8_t));
82 address = 0;
83 }
84
85 Tick read(PacketPtr pkt);
86
87 Tick write(PacketPtr pkt);
88};
89
90}; // namespace X86ISA
91
92#endif //__DEV_X86_CMOS_HH__
76 {
77 pioSize = 2;
78 memset(regs, 0, numRegs * sizeof(uint8_t));
79 address = 0;
80 }
81
82 Tick read(PacketPtr pkt);
83
84 Tick write(PacketPtr pkt);
85};
86
87}; // namespace X86ISA
88
89#endif //__DEV_X86_CMOS_HH__