simulavr  1.1.0
ExternalIRQHandler Class Reference

Handler for external IRQ's to communicate with IRQ system and mask/flag registers. More...

#include <externalirq.h>

Inheritance diagram for ExternalIRQHandler:

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)
 
- Public Member Functions inherited from Hardware
 Hardware (AvrDevice *core)
 
virtual ~Hardware ()
 
virtual unsigned int CpuCycle (void)
 
- Public Member Functions inherited from IOSpecialRegClient
virtual ~IOSpecialRegClient ()
 

Protected Member Functions

void fireInterrupt (int idx)
 fire a interupt from IRQ with index More...
 

Protected Attributes

HWIrqSystemirqsystem
 pointer to irq system More...
 
IOSpecialRegmask_reg
 the interrupt mask register More...
 
IOSpecialRegflag_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
 

Detailed Description

Handler for external IRQ's to communicate with IRQ system and mask/flag registers.

Definition at line 41 of file externalirq.h.

Constructor & Destructor Documentation

◆ ExternalIRQHandler()

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::~ExternalIRQHandler ( void  )

Definition at line 48 of file externalirq.cpp.

References extirqs.

Member Function Documentation

◆ ClearIrqFlag()

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.

◆ fireInterrupt()

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().

◆ get_from_client()

unsigned char ExternalIRQHandler::get_from_client ( const IOSpecialReg reg,
unsigned char  v 
)
virtual

Informs your class, that a read access from IO register happens

Parameters
vthe internal saved register value (but maybe changed by other clients)
Returns
v, if nothing is changed or your changed value

Implements IOSpecialRegClient.

Definition at line 131 of file externalirq.cpp.

References irq_flag, irq_mask, mask_reg, and reg_mask.

◆ IsLevelInterrupt()

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.

◆ LevelInterruptPending()

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.

◆ registerIrq()

◆ Reset()

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().

◆ set_from_reg()

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

Parameters
regcaller register instance
nvthe value, which is written to IO register (but maybe changed by other clients)
Returns
nv, if nothing is changed or your changed value

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.

Friends And Related Function Documentation

◆ ExternalIRQ

friend class ExternalIRQ
friend

Definition at line 57 of file externalirq.h.

Member Data Documentation

◆ extirqs

std::vector<ExternalIRQ*> ExternalIRQHandler::extirqs
protected

◆ flag_reg

IOSpecialReg* ExternalIRQHandler::flag_reg
protected

the interrupt flag register

Definition at line 46 of file externalirq.h.

Referenced by ClearIrqFlag(), ExternalIRQHandler(), and fireInterrupt().

◆ irq_flag

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().

◆ irq_mask

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().

◆ irqbits

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().

◆ irqsystem

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().

◆ mask_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().

◆ reg_mask

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().

◆ vector2idx

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().

◆ vectors

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().


The documentation for this class was generated from the following files: