mc146818.cc (5606:6da7a58b0bc8) mc146818.cc (5813:624566640d7c)
1/*
2 * Copyright (c) 2004-2005 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;

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

30 * Miguel Serrano
31 */
32
33#include <sys/time.h>
34#include <time.h>
35
36#include <string>
37
1/*
2 * Copyright (c) 2004-2005 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;

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

30 * Miguel Serrano
31 */
32
33#include <sys/time.h>
34#include <time.h>
35
36#include <string>
37
38#include "base/bitfield.hh"
38#include "base/time.hh"
39#include "base/trace.hh"
40#include "dev/mc146818.hh"
41#include "dev/rtcreg.h"
42
43using namespace std;
44
45MC146818::MC146818(EventManager *em, const string &n, const struct tm time,

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

82void
83MC146818::writeData(const uint8_t addr, const uint8_t data)
84{
85 if (addr < RTC_STAT_REGA)
86 clock_data[addr] = data;
87 else {
88 switch (addr) {
89 case RTC_STAT_REGA:
39#include "base/time.hh"
40#include "base/trace.hh"
41#include "dev/mc146818.hh"
42#include "dev/rtcreg.h"
43
44using namespace std;
45
46MC146818::MC146818(EventManager *em, const string &n, const struct tm time,

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

83void
84MC146818::writeData(const uint8_t addr, const uint8_t data)
85{
86 if (addr < RTC_STAT_REGA)
87 clock_data[addr] = data;
88 else {
89 switch (addr) {
90 case RTC_STAT_REGA:
90 if (data != (RTCA_32768HZ | RTCA_1024HZ))
91 // The "update in progress" bit is read only.
92 if ((data & ~RTCA_UIP) != (RTCA_32768HZ | RTCA_1024HZ))
91 panic("Unimplemented RTC register A value write!\n");
93 panic("Unimplemented RTC register A value write!\n");
92 stat_regA = data;
94 replaceBits(stat_regA, data, 6, 0);
93 break;
94 case RTC_STAT_REGB:
95 if ((data & ~(RTCB_PRDC_IE | RTCB_SQWE)) != (RTCB_BIN | RTCB_24HR))
96 panic("Write to RTC reg B bits that are not implemented!\n");
97
98 if (data & RTCB_PRDC_IE) {
99 if (!event.scheduled())
100 event.scheduleIntr();

--- 88 unchanged lines hidden ---
95 break;
96 case RTC_STAT_REGB:
97 if ((data & ~(RTCB_PRDC_IE | RTCB_SQWE)) != (RTCB_BIN | RTCB_24HR))
98 panic("Write to RTC reg B bits that are not implemented!\n");
99
100 if (data & RTCB_PRDC_IE) {
101 if (!event.scheduled())
102 event.scheduleIntr();

--- 88 unchanged lines hidden ---