InterruptFlag Class Reference

yasimavr: InterruptFlag Class Reference
yasimavr
Loading...
Searching...
No Matches
InterruptFlag Class Reference

Generic helper to manage a typical Interrupt Flag/Enable in a I/O register. More...

#include <sim_interrupt.h>

Inheritance diagram for InterruptFlag:
AbstractInterruptFlag IORegHandler InterruptHandler

Public Member Functions

 InterruptFlag (bool clear_on_ack=false)
 
bool init (Device &device, const regmask_t &rm_enable, const regmask_t &rm_flag, int_vect_t vector)
 
bool set_flag (bitmask_t mask=0xFF)
 
bool clear_flag (bitmask_t mask=0xFF)
 
- Public Member Functions inherited from AbstractInterruptFlag
 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.
 
- 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
 
- Public Member Functions inherited from IORegHandler
virtual ~IORegHandler ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractInterruptFlag
bool clear_on_ack () const
 Returns the raised state of the interrupt flag.
 

Detailed Description

Generic helper to manage a typical Interrupt Flag/Enable in a I/O register.

The flag is made of one or several bits of a I/O register, along with corresponding enable bit(s).

The interrupt is raised if and only if at least one flag bit and its corresponding enable bit are set.

The flag can be configured to clear-on-ack. If enabled, the flag will be cleared when the interrupt is ACK'ed by the CPU. If disabled, the flag will be unchanged by a CPU ACK'ed. The effect is to keep the interrupt raised until the flag is cleared directly in the register.

Constructor & Destructor Documentation

◆ InterruptFlag()

InterruptFlag::InterruptFlag ( 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_flag()

bool InterruptFlag::clear_flag ( bitmask_t  mask = 0xFF)

Clear the interrupt flag bits by AND'ing them with the mask argument.

Returns
true if the interrupt is canceled as a result of the flag bit changes, false if the interrupt is unchanged.

◆ init()

bool InterruptFlag::init ( Device device,
const regmask_t rm_enable,
const regmask_t rm_flag,
int_vect_t  vector 
)

Initialise an Interrupt Flag. Allocates the registers for the flag and the enable register fields and register 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
rm_enableregister location for the flag enable bits
rm_flagregister location for the flag state bits
vectorinterrupt vector index
Returns
true if successful, false otherwise

◆ set_flag()

bool InterruptFlag::set_flag ( bitmask_t  mask = 0xFF)

Set the interrupt flag bits by OR'ing them with the mask argument.

Returns
true if the interrupt is raised as a result of the flag bit changes, false if the interrupt is unchanged.

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