AbstractInterruptFlag Class Reference

yasimavr: AbstractInterruptFlag Class Reference
yasimavr
Loading...
Searching...
No Matches
AbstractInterruptFlag Class Referenceabstract

Abstract interrupt flag. More...

#include <sim_interrupt.h>

Inheritance diagram for AbstractInterruptFlag:
InterruptHandler ArchXT_Port::_InterruptHandler ArchXT_SPI::_InterruptHandler InterruptFlag

Public Member Functions

 AbstractInterruptFlag (bool clear_on_ack=false)
 
bool init (Device &device, int_vect_t vector)
 
int update ()
 
bool raised () const
 Returns the raised state of the interrupt flag.
 
virtual bool interrupt_ack_handler (int_vect_t vector) override
 
- Public Member Functions inherited from InterruptHandler
 InterruptHandler ()
 
virtual ~InterruptHandler ()
 
void raise_interrupt (int_vect_t vector) const
 
void cancel_interrupt (int_vect_t vector) const
 
bool interrupt_raised (int_vect_t vector) const
 
 InterruptHandler (const InterruptHandler &)=delete
 
InterruptHandleroperator= (const InterruptHandler &)=delete
 

Protected Member Functions

bool clear_on_ack () const
 Returns the raised state of the interrupt flag.
 
virtual bool flag_raised () const =0
 

Detailed Description

Abstract interrupt flag.

Abstract class that manages an interrupt flag corresponding to an interrupt vector. How the flag is raised or cleared is left to concrete sub-classes by overriding flag_raised().

Constructor & Destructor Documentation

◆ AbstractInterruptFlag()

AbstractInterruptFlag::AbstractInterruptFlag ( bool  clear_on_ack = false)
explicit

Construct an Interrupt Flag.

Parameters
clear_on_ackif true, the flag will be cleared when the interrupt is ACK'ed by the CPU. If false, (default) the flag can only be cleared by writing to the register.

Member Function Documentation

◆ clear_on_ack()

bool AbstractInterruptFlag::clear_on_ack ( ) const
inlineprotected

Returns the raised state of the interrupt flag.

◆ flag_raised()

virtual bool AbstractInterruptFlag::flag_raised ( ) const
protectedpure virtual

Abstract virtual function called when a flag update is required.

Returns
true if the flag is raised, false if cleared.

◆ init()

bool AbstractInterruptFlag::init ( Device device,
int_vect_t  vector 
)

Initialise an Interrupt Flag. Register this flag with the interrupt controller for a particular vector.

Note
If the vector is < 0, then no interrupt is registered. (can be used for future or unsupported features)
Registering with the reset vector (vector 0) is an error.
Parameters
vectorinterrupt vector index
Returns
true if successful, false otherwise

◆ interrupt_ack_handler()

bool AbstractInterruptFlag::interrupt_ack_handler ( int_vect_t  vector)
overridevirtual

Callback method called when a vector has been ACK'ed by the CPU. (i.e. the CPU is about to jump to the corresponding vector table entry) The returned boolean determines the behaviour once the CPU has jumped to the vector.

Returns
true if the interrupt should be cleared, false if it should stay raised

Implements InterruptHandler.

◆ raised()

bool AbstractInterruptFlag::raised ( ) const
inline

Returns the raised state of the interrupt flag.

◆ update()

int AbstractInterruptFlag::update ( )

Update the state of the interrupt flag.

Returns
+1 if the interrupt has been raised as a result of the update, -1 if it has been cleared, 0 if unchanged.

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