simulavr
1.1.0
|
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) |
![]() | |
Hardware (AvrDevice *core) | |
virtual | ~Hardware () |
virtual unsigned int | CpuCycle (void) |
![]() | |
virtual | ~IOSpecialRegClient () |
Protected Member Functions | |
void | fireInterrupt (int idx) |
fire a interupt from IRQ with index More... | |
Protected Attributes | |
HWIrqSystem * | irqsystem |
pointer to irq system More... | |
IOSpecialReg * | mask_reg |
the interrupt mask register More... | |
IOSpecialReg * | flag_reg |
the interrupt flag register More... | |
std::vector< ExternalIRQ * > | extirqs |
list with external IRQ's More... | |
unsigned char | irq_mask |
mask register value for registered IRQ's More... | |
unsigned char | irq_flag |
flag register value for registered IRQ's More... | |
unsigned char | reg_mask |
mask for relevant bits in flag and mask register More... | |
std::vector< int > | vectors |
mapping index to vector More... | |
std::vector< int > | irqbits |
mapping index to mask bit More... | |
std::map< int, int > | vector2idx |
mapping irq vector to index More... | |
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.
|
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.
|
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().
|
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.
|
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.
|
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_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), and AvrDevice_attinyX5::AvrDevice_attinyX5().
|
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().
|
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 |
Definition at line 57 of file externalirq.h.
|
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().
|
protected |
the interrupt flag register
Definition at line 46 of file externalirq.h.
Referenced by ClearIrqFlag(), ExternalIRQHandler(), and fireInterrupt().
|
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().
|
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().
|
protected |
mapping index to mask bit
Definition at line 52 of file externalirq.h.
Referenced by ClearIrqFlag(), fireInterrupt(), LevelInterruptPending(), registerIrq(), and set_from_reg().
|
protected |
pointer to irq system
Definition at line 44 of file externalirq.h.
Referenced by ClearIrqFlag(), fireInterrupt(), registerIrq(), and set_from_reg().
|
protected |
the interrupt mask register
Definition at line 45 of file externalirq.h.
Referenced by ExternalIRQHandler(), get_from_client(), and set_from_reg().
|
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().
|
protected |
mapping irq vector to index
Definition at line 53 of file externalirq.h.
Referenced by ClearIrqFlag(), IsLevelInterrupt(), LevelInterruptPending(), and registerIrq().
|
protected |
mapping index to vector
Definition at line 51 of file externalirq.h.
Referenced by ClearIrqFlag(), fireInterrupt(), registerIrq(), and set_from_reg().