Handler for external IRQ's to communicate with IRQ system and mask/flag registers. More...
#include <externalirq.h>
Public Member Functions | |
ExternalIRQHandler (AvrDevice *core, HWIrqSystem *irqsys, IOSpecialReg *mask, IOSpecialReg *flag) | |
~ExternalIRQHandler () | |
void | registerIrq (int vector, int irqBit, ExternalIRQ *extirq) |
virtual void | ClearIrqFlag (unsigned int vector) |
virtual void | Reset (void) |
virtual bool | IsLevelInterrupt (unsigned int vector) |
virtual bool | LevelInterruptPending (unsigned int vector) |
virtual unsigned char | set_from_reg (const IOSpecialReg *reg, unsigned char nv) |
virtual unsigned char | get_from_client (const IOSpecialReg *reg, unsigned char v) |
Protected Member Functions | |
void | fireInterrupt (int idx) |
fire a interupt from IRQ with index | |
Protected Attributes | |
HWIrqSystem * | irqsystem |
pointer to irq system | |
IOSpecialReg * | mask_reg |
the interrupt mask register | |
IOSpecialReg * | flag_reg |
the interrupt flag register | |
std::vector< ExternalIRQ * > | extirqs |
list with external IRQ's | |
unsigned char | irq_mask |
mask register value for registered IRQ's | |
unsigned char | irq_flag |
flag register value for registered IRQ's | |
unsigned char | reg_mask |
mask for relevant bits in flag and mask register | |
std::vector< int > | vectors |
mapping index to vector | |
std::vector< int > | irqbits |
mapping index to mask bit | |
std::map< int, int > | vector2idx |
mapping irq vector to index | |
Friends | |
class | ExternalIRQ |
Handler for external IRQ's to communicate with IRQ system and mask/flag registers.
Definition at line 41 of file externalirq.h.
ExternalIRQHandler::ExternalIRQHandler | ( | AvrDevice * | core, | |
HWIrqSystem * | irqsys, | |||
IOSpecialReg * | mask, | |||
IOSpecialReg * | flag | |||
) |
Definition at line 29 of file externalirq.cpp.
References IOSpecialReg::connectSRegClient(), flag_reg, mask_reg, reg_mask, and Reset().
ExternalIRQHandler::~ExternalIRQHandler | ( | void | ) |
Definition at line 48 of file externalirq.cpp.
References extirqs.
void ExternalIRQHandler::ClearIrqFlag | ( | unsigned int | vector | ) | [virtual] |
This signals the hardware that the given IRQ vector has been handled by the AVR core.
Reimplemented from Hardware.
Definition at line 76 of file externalirq.cpp.
References HWIrqSystem::ClearIrqFlag(), extirqs, flag_reg, IOSpecialReg::hardwareChangeMask(), irq_flag, irq_mask, irqbits, irqsystem, reg_mask, HWIrqSystem::SetIrqFlag(), vector2idx, and vectors.
void ExternalIRQHandler::fireInterrupt | ( | int | idx | ) | [protected] |
fire a interupt from IRQ with index
Definition at line 67 of file externalirq.cpp.
References extirqs, flag_reg, IOSpecialReg::hardwareChangeMask(), irq_flag, irq_mask, irqbits, irqsystem, reg_mask, HWIrqSystem::SetIrqFlag(), and vectors.
Referenced by ExternalIRQ::fireInterrupt().
unsigned char ExternalIRQHandler::get_from_client | ( | const IOSpecialReg * | reg, | |
unsigned char | v | |||
) | [virtual] |
Informs your class, that a read access from IO register happens
v | the internal saved register value (but maybe changed by other clients) |
Implements IOSpecialRegClient.
Definition at line 131 of file externalirq.cpp.
bool ExternalIRQHandler::IsLevelInterrupt | ( | unsigned int | vector | ) | [virtual] |
Does the hardware have a level interrupt (triggered otherwise, the default!)
Reimplemented from Hardware.
Definition at line 91 of file externalirq.cpp.
References extirqs, and vector2idx.
bool ExternalIRQHandler::LevelInterruptPending | ( | unsigned int | vector | ) | [virtual] |
Check a level interrupt on the time, where interrupt routine will be called
Reimplemented from Hardware.
Definition at line 97 of file externalirq.cpp.
References extirqs, irq_mask, irqbits, and vector2idx.
void ExternalIRQHandler::registerIrq | ( | int | vector, | |
int | irqBit, | |||
ExternalIRQ * | extirq | |||
) |
Definition at line 53 of file externalirq.cpp.
References HWIrqSystem::DebugVerifyInterruptVector(), extirqs, irqbits, irqsystem, reg_mask, ExternalIRQ::setHandlerIndex(), vector2idx, and vectors.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_at90s4433::AvrDevice_at90s4433(), AvrDevice_at90s8515::AvrDevice_at90s8515(), AvrDevice_atmega128::AvrDevice_atmega128(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_atmega8::AvrDevice_atmega8(), and AvrDevice_attiny2313::AvrDevice_attiny2313().
void ExternalIRQHandler::Reset | ( | void | ) | [virtual] |
Implement the hardware's reset functionality here. The default is no action on reset.
Reimplemented from Hardware.
Definition at line 103 of file externalirq.cpp.
References extirqs, irq_flag, and irq_mask.
Referenced by ExternalIRQHandler().
unsigned char ExternalIRQHandler::set_from_reg | ( | const IOSpecialReg * | reg, | |
unsigned char | nv | |||
) | [virtual] |
Informs your class, that a write access to IO register is happen
reg | caller register instance | |
nv | the value, which is written to IO register (but maybe changed by other clients) |
Implements IOSpecialRegClient.
Definition at line 110 of file externalirq.cpp.
References extirqs, irq_flag, irq_mask, irqbits, irqsystem, mask_reg, reg_mask, HWIrqSystem::SetIrqFlag(), and vectors.
friend class ExternalIRQ [friend] |
Definition at line 57 of file externalirq.h.
std::vector<ExternalIRQ*> ExternalIRQHandler::extirqs [protected] |
list with external IRQ's
Definition at line 47 of file externalirq.h.
Referenced by ClearIrqFlag(), fireInterrupt(), IsLevelInterrupt(), LevelInterruptPending(), registerIrq(), Reset(), set_from_reg(), and ~ExternalIRQHandler().
IOSpecialReg* ExternalIRQHandler::flag_reg [protected] |
the interrupt flag register
Definition at line 46 of file externalirq.h.
Referenced by ClearIrqFlag(), ExternalIRQHandler(), and fireInterrupt().
unsigned char ExternalIRQHandler::irq_flag [protected] |
flag register value for registered IRQ's
Definition at line 49 of file externalirq.h.
Referenced by ClearIrqFlag(), fireInterrupt(), get_from_client(), Reset(), and set_from_reg().
unsigned char ExternalIRQHandler::irq_mask [protected] |
mask register value for registered IRQ's
Definition at line 48 of file externalirq.h.
Referenced by ClearIrqFlag(), fireInterrupt(), get_from_client(), LevelInterruptPending(), Reset(), and set_from_reg().
std::vector<int> ExternalIRQHandler::irqbits [protected] |
mapping index to mask bit
Definition at line 52 of file externalirq.h.
Referenced by ClearIrqFlag(), fireInterrupt(), LevelInterruptPending(), registerIrq(), and set_from_reg().
HWIrqSystem* ExternalIRQHandler::irqsystem [protected] |
pointer to irq system
Definition at line 44 of file externalirq.h.
Referenced by ClearIrqFlag(), fireInterrupt(), registerIrq(), and set_from_reg().
IOSpecialReg* ExternalIRQHandler::mask_reg [protected] |
the interrupt mask register
Definition at line 45 of file externalirq.h.
Referenced by ExternalIRQHandler(), get_from_client(), and set_from_reg().
unsigned char ExternalIRQHandler::reg_mask [protected] |
mask for relevant bits in flag and mask register
Definition at line 50 of file externalirq.h.
Referenced by ClearIrqFlag(), ExternalIRQHandler(), fireInterrupt(), get_from_client(), registerIrq(), and set_from_reg().
std::map<int, int> ExternalIRQHandler::vector2idx [protected] |
mapping irq vector to index
Definition at line 53 of file externalirq.h.
Referenced by ClearIrqFlag(), IsLevelInterrupt(), LevelInterruptPending(), and registerIrq().
std::vector<int> ExternalIRQHandler::vectors [protected] |
mapping index to vector
Definition at line 51 of file externalirq.h.
Referenced by ClearIrqFlag(), fireInterrupt(), registerIrq(), and set_from_reg().