From a2599e4fc1272e4c1fdf5cff90da88653579b62f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 11 Oct 2008 15:15:34 -0700 Subject: X86: Set up a mechanism for the I8254 timer to cause interrupts. --- src/dev/x86/SConscript | 1 + src/dev/x86/i8254.cc | 9 +++++++++ src/dev/x86/i8254.hh | 24 ++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) (limited to 'src/dev/x86') diff --git a/src/dev/x86/SConscript b/src/dev/x86/SConscript index ae270aa90..7e3cc6eff 100644 --- a/src/dev/x86/SConscript +++ b/src/dev/x86/SConscript @@ -47,6 +47,7 @@ if env['FULL_SYSTEM'] and env['TARGET_ISA'] == 'x86': SimObject('I8254.py') Source('i8254.cc') + TraceFlag('I8254', 'Interrupts from the I8254 timer'); SimObject('PcSpeaker.py') Source('speaker.cc') diff --git a/src/dev/x86/i8254.cc b/src/dev/x86/i8254.cc index cc7c48980..ac3847cd6 100644 --- a/src/dev/x86/i8254.cc +++ b/src/dev/x86/i8254.cc @@ -29,9 +29,18 @@ */ #include "dev/x86/i8254.hh" +#include "dev/x86/intdev.hh" #include "mem/packet.hh" #include "mem/packet_access.hh" +void +X86ISA::I8254::counterInterrupt(unsigned int num) +{ + DPRINTF(I8254, "Interrupt from counter %d.\n", num); + if (num == 0) + intPin->signalInterrupt(); +} + Tick X86ISA::I8254::read(PacketPtr pkt) { diff --git a/src/dev/x86/i8254.hh b/src/dev/x86/i8254.hh index 9528013c8..e6860b2c4 100644 --- a/src/dev/x86/i8254.hh +++ b/src/dev/x86/i8254.hh @@ -44,9 +44,29 @@ class I8254 : public BasicPioDevice { protected: Tick latency; - Intel8254Timer pit; + class X86Intel8254Timer : public Intel8254Timer + { + protected: + I8254 * parent; + + void + counterInterrupt(unsigned int num) + { + parent->counterInterrupt(num); + } + + public: + X86Intel8254Timer(const std::string &name, I8254 * _parent) : + Intel8254Timer(_parent, name), parent(_parent) + {} + }; + + + X86Intel8254Timer pit; IntPin *intPin; + + void counterInterrupt(unsigned int num); public: typedef I8254Params Params; @@ -58,7 +78,7 @@ class I8254 : public BasicPioDevice } I8254(Params *p) : BasicPioDevice(p), latency(p->pio_latency), - pit(this, p->name), intPin(p->int_pin) + pit(p->name, this), intPin(p->int_pin) { pioSize = 4; } -- cgit v1.2.3