00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef TIMERIRQ
00027 #define TIMERIRQ
00028 #include <string>
00029 #include <vector>
00030 #include "hardware.h"
00031 #include "irqsystem.h"
00032 #include "avrdevice.h"
00033 #include "rwmem.h"
00034 #include "traceval.h"
00035
00036 class TimerIRQRegister;
00037
00039
00042 class IRQLine {
00043
00044 protected:
00045 friend class TimerIRQRegister;
00046
00047 int irqvector;
00048 std::string name;
00049 TimerIRQRegister *irqreg;
00050
00051 public:
00053 IRQLine(const std::string& name, int irqvector);
00055 void fireInterrupt(void);
00056 };
00057
00059 class TimerIRQRegister: public Hardware, public IOSpecialRegClient, public TraceValueRegister {
00060
00061 private:
00062 HWIrqSystem* irqsystem;
00063 AvrDevice* core;
00064 std::vector<IRQLine*> lines;
00065 std::map<std::string, int> name2line;
00066 std::map<int, int> vector2line;
00067 unsigned char irqmask;
00068 unsigned char irqflags;
00069 unsigned char bitmask;
00070
00071 public:
00072 IOSpecialReg timsk_reg;
00073 IOSpecialReg tifr_reg;
00074
00075 TimerIRQRegister(AvrDevice* core, HWIrqSystem* irqsys, int regidx = -1);
00076 void registerLine(int idx, IRQLine* irq);
00077 IRQLine* getLine(const std::string& name);
00078 void fireInterrupt(int irqvector);
00079
00080 virtual void ClearIrqFlag(unsigned int vector);
00081 virtual void Reset(void);
00082
00083 virtual unsigned char set_from_reg(const IOSpecialReg* reg, unsigned char nv);
00084 virtual unsigned char get_from_client(const IOSpecialReg* reg, unsigned char v);
00085 };
00086
00087 #endif // TIMERIRQ