mc146818.cc (5813:624566640d7c) | mc146818.cc (5949:04ed7a1d9904) |
---|---|
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; --- 35 unchanged lines hidden (view full) --- 44using namespace std; 45 46MC146818::MC146818(EventManager *em, const string &n, const struct tm time, 47 bool bcd, Tick frequency) 48 : EventManager(em), _name(n), event(this, frequency) 49{ 50 memset(clock_data, 0, sizeof(clock_data)); 51 stat_regA = RTCA_32768HZ | RTCA_1024HZ; | 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; --- 35 unchanged lines hidden (view full) --- 44using namespace std; 45 46MC146818::MC146818(EventManager *em, const string &n, const struct tm time, 47 bool bcd, Tick frequency) 48 : EventManager(em), _name(n), event(this, frequency) 49{ 50 memset(clock_data, 0, sizeof(clock_data)); 51 stat_regA = RTCA_32768HZ | RTCA_1024HZ; |
52 stat_regB = RTCB_PRDC_IE |RTCB_BIN | RTCB_24HR; | 52 stat_regB = RTCB_PRDC_IE | RTCB_24HR; 53 if (!bcd) 54 stat_regB |= RTCB_BIN; |
53 54 year = time.tm_year; 55 56 if (bcd) { 57 // The datasheet says that the year field can be either BCD or 58 // years since 1900. Linux seems to be happy with years since 59 // 1900. 60 year = year % 100; --- 130 unchanged lines hidden --- | 55 56 year = time.tm_year; 57 58 if (bcd) { 59 // The datasheet says that the year field can be either BCD or 60 // years since 1900. Linux seems to be happy with years since 61 // 1900. 62 year = year % 100; --- 130 unchanged lines hidden --- |