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; --- 43 unchanged lines hidden (view full) --- 52#include "mem/packet_access.hh" 53#include "mem/port.hh" 54#include "sim/system.hh" 55 56using namespace std; 57//Should this be AlphaISA? 58using namespace TheISA; 59 |
60TsunamiIO::TsunamiRTC::TsunamiRTC(const string &n, const TsunamiIOParams *p) : 61 MC146818(n, p->time, p->year_is_bcd, p->frequency), tsunami(p->tsunami) |
62{ |
63} 64 |
65TsunamiIO::PITimer::PITimer(const string &name) 66 : _name(name), counter0(name + ".counter0"), counter1(name + ".counter1"), 67 counter2(name + ".counter2") 68{ 69 counter[0] = &counter0; 70 counter[1] = &counter0; 71 counter[2] = &counter0; 72} --- 210 unchanged lines hidden (view full) --- 283const char * 284TsunamiIO::PITimer::Counter::CounterEvent::description() const 285{ 286 return "tsunami 8254 Interval timer"; 287} 288 289TsunamiIO::TsunamiIO(const Params *p) 290 : BasicPioDevice(p), tsunami(p->tsunami), pitimer(p->name + "pitimer"), |
291 rtc(p->name + ".rtc", p) |
292{ 293 pioSize = 0x100; 294 295 // set the back pointer from tsunami to myself 296 tsunami->io = this; 297 298 timerData = 0; 299 picr = 0; --- 42 unchanged lines hidden (view full) --- 342 break; 343 case TSDEV_TMR1_DATA: 344 pkt->set(pitimer.counter1.read()); 345 break; 346 case TSDEV_TMR2_DATA: 347 pkt->set(pitimer.counter2.read()); 348 break; 349 case TSDEV_RTC_DATA: |
350 pkt->set(rtc.readData(rtcAddr)); |
351 break; 352 case TSDEV_CTRL_PORTB: 353 if (pitimer.counter2.outputHigh()) 354 pkt->set(PORTB_SPKR_HIGH); 355 else 356 pkt->set(0x00); 357 break; 358 default: --- 61 unchanged lines hidden (view full) --- 420 break; 421 case TSDEV_TMR2_DATA: 422 pitimer.counter2.write(pkt->get<uint8_t>()); 423 break; 424 case TSDEV_TMR_CTRL: 425 pitimer.writeControl(pkt->get<uint8_t>()); 426 break; 427 case TSDEV_RTC_ADDR: |
428 rtcAddr = pkt->get<uint8_t>(); |
429 break; 430 case TSDEV_RTC_DATA: |
431 rtc.writeData(rtcAddr, pkt->get<uint8_t>()); |
432 break; 433 case TSDEV_KBD: 434 case TSDEV_DMA1_CMND: 435 case TSDEV_DMA2_CMND: 436 case TSDEV_DMA1_MMASK: 437 case TSDEV_DMA2_MMASK: 438 case TSDEV_PIC2_ACK: 439 case TSDEV_DMA1_RESET: --- 30 unchanged lines hidden (view full) --- 470 tsunami->cchip->clearDRIR(55); 471 DPRINTF(Tsunami, "clearing pic interrupt to cchip\n"); 472 } 473} 474 475void 476TsunamiIO::serialize(ostream &os) 477{ |
478 SERIALIZE_SCALAR(rtcAddr); |
479 SERIALIZE_SCALAR(timerData); 480 SERIALIZE_SCALAR(mask1); 481 SERIALIZE_SCALAR(mask2); 482 SERIALIZE_SCALAR(mode1); 483 SERIALIZE_SCALAR(mode2); 484 SERIALIZE_SCALAR(picr); 485 SERIALIZE_SCALAR(picInterrupting); 486 487 // Serialize the timers 488 pitimer.serialize("pitimer", os); 489 rtc.serialize("rtc", os); 490} 491 492void 493TsunamiIO::unserialize(Checkpoint *cp, const string §ion) 494{ |
495 UNSERIALIZE_SCALAR(rtcAddr); |
496 UNSERIALIZE_SCALAR(timerData); 497 UNSERIALIZE_SCALAR(mask1); 498 UNSERIALIZE_SCALAR(mask2); 499 UNSERIALIZE_SCALAR(mode1); 500 UNSERIALIZE_SCALAR(mode2); 501 UNSERIALIZE_SCALAR(picr); 502 UNSERIALIZE_SCALAR(picInterrupting); 503 504 // Unserialize the timers 505 pitimer.unserialize("pitimer", cp, section); 506 rtc.unserialize("rtc", cp, section); 507} 508 509TsunamiIO * 510TsunamiIOParams::create() 511{ 512 return new TsunamiIO(this); 513} |