InterruptController Class Reference
|
yasimavr
|
Generic interrupt controller. More...
#include <sim_interrupt.h>
Classes | |
| struct | IRQ_t |
Public Types | |
| enum | SignalId { Signal_StateChange } |
| enum | State { State_Raised = 0x01 , State_Cancelled = 0x10 , State_Acknowledged = 0x20 , State_Returned = 0x30 , State_RaisedFromSleep = 0x41 , State_Reset = 0x50 } |
Public Member Functions | |
| InterruptController (unsigned int vector_count) | |
| virtual void | reset (int flags) override |
| virtual bool | ctlreq (ctlreq_id_t req, ctlreq_data_t *data) override |
| virtual void | sleep (bool on, SleepMode mode) override |
| bool | cpu_has_irq () const |
| IRQ_t | cpu_get_irq () const |
| void | cpu_ack_irq () |
| virtual void | cpu_reti () |
Public Member Functions inherited from Peripheral | |
| Peripheral (ctl_id_t id) | |
| virtual | ~Peripheral () |
| ctl_id_t | id () const |
| Unique identifier of the peripheral. | |
| std::string | name () const |
| The name of the peripheral. | |
| virtual bool | init (Device &device) |
| virtual uint8_t | ioreg_read_handler (reg_addr_t addr, uint8_t value) override |
| virtual uint8_t | ioreg_peek_handler (reg_addr_t addr, uint8_t value) override |
| virtual void | ioreg_write_handler (reg_addr_t addr, const ioreg_write_t &data) override |
| Peripheral (const Peripheral &)=delete | |
| Peripheral & | operator= (const Peripheral &)=delete |
Public Member Functions inherited from IORegHandler | |
| virtual | ~IORegHandler ()=default |
Static Public Attributes | |
| static constexpr IRQ_t | NO_INTERRUPT = { AVR_INTERRUPT_NONE, 0, false } |
Protected Member Functions | |
| bool | interrupt_raised (int_vect_t vector) const |
| Interrupt state getter. | |
| int_vect_t | intr_count () const |
| Interrupt table size getter. | |
| void | set_interrupt_raised (int_vect_t vector, bool raised) |
| Interrupt state setter. | |
| virtual void | cpu_ack_irq (int_vect_t vector) |
| virtual IRQ_t | get_next_irq () const =0 |
| void | update_irq () |
Protected Member Functions inherited from Peripheral | |
| Device * | device () const |
| Access to the device. It is null before init() is called. | |
| Logger & | logger () |
| Logging object associated with this peripheral. | |
| bool | register_interrupt (int_vect_t vector, InterruptHandler &handler) const |
| Signal * | get_signal (ctl_id_t ctl_id) const |
| void | add_ioreg (const regmask_t &rm, IORegister::BitMode bitmode=IORegister::RW) |
| void | add_ioreg (const regbit_compound_t &rbc, IORegister::BitMode bitmode=IORegister::RW) |
| void | add_ioreg (reg_addr_t addr, IORegister::BitMode bitmode=IORegister::RW) |
| void | add_ioreg (reg_addr_t addr, bitmask_t mask, IORegister::BitMode bitmode=IORegister::RW) |
| uint8_t | read_ioreg (const regbit_t &rb) const |
| uint64_t | read_ioreg (const regbit_compound_t &rbc) const |
| uint8_t | read_ioreg (reg_addr_t addr) const |
| uint8_t | read_ioreg (reg_addr_t addr, const bitspec_t &bs) const |
| bool | test_ioreg (const regbit_t &rb) const |
| bool | test_ioreg (const regbit_compound_t &rbc) const |
| bool | test_ioreg (reg_addr_t addr, const bitspec_t &bs) const |
| bool | test_ioreg (reg_addr_t addr, bitmask_t bm=0xFF) const |
| void | write_ioreg (reg_addr_t addr, bitmask_t bm, uint8_t value) |
| void | write_ioreg (const regbit_t &rb, uint8_t value) |
| void | write_ioreg (const regbit_compound_t &rbc, uint64_t value) |
| void | write_ioreg (reg_addr_t addr, uint8_t value) |
| void | write_ioreg (reg_addr_t addr, const bitspec_t &bs, uint8_t value) |
| void | set_ioreg (reg_addr_t addr, bitmask_t bm=0xFF) |
| void | set_ioreg (const regbit_t &rb) |
| void | set_ioreg (const regbit_compound_t &rbc) |
| void | set_ioreg (reg_addr_t addr, const bitspec_t &bs) |
| void | clear_ioreg (reg_addr_t addr, bitmask_t bm=0xFF) |
| void | clear_ioreg (const regbit_t &rb) |
| void | clear_ioreg (const regbit_compound_t &rbc) |
| void | clear_ioreg (reg_addr_t addr, const bitspec_t &bs) |
Friends | |
| class | InterruptHandler |
Detailed Description
Generic interrupt controller.
It manages an interrupt vector table that the CPU can access to know if a interrupt routine should be executed. Each interrupt vector may be allocated by a interrupt handler which controls the raise (or cancellation) of the interrupt.
The arbitration of priorities between vectors is left to concrete sub-classes.
- See also
- AVR_InterruptHandler
Member Enumeration Documentation
◆ SignalId
| Enumerator | |
|---|---|
| Signal_StateChange | Signal ID for indicating that the state of an interrupt has changed. index is the vector index. |
◆ State
Constructor & Destructor Documentation
◆ InterruptController()
|
explicit |
Construct the controller with the given vector table size
Member Function Documentation
◆ cpu_ack_irq() [1/2]
| void InterruptController::cpu_ack_irq | ( | ) |
Used by the CPU to acknowledge the IRQ obtained with cpu_get_irq().
◆ cpu_ack_irq() [2/2]
|
protectedvirtual |
Called by the CPU when it acknowledges a vector, i.e. it is about to execute the vector address in the flash.
The base implementation calls the ACK handler of the vector and raise the signal with the "Acknowledged" state.
Reimplemented in ArchXT_IntCtrl.
◆ cpu_get_irq()
|
inline |
Used by the CPU to interrogate the controller whether an interrupt is raised.
If a valid vector is returned and the Global Interrupt Enable flag is set, the CPU initiates a jump to the corresponding routine.
- Returns
- a vector index if there is an IRQ raised, AVR_INTERRUPT_NONE if not.
◆ cpu_has_irq()
|
inline |
Used by the CPU to do a quick test whether an interrupt is raised.
- Returns
- true if there is an IRQ raised.
◆ cpu_reti()
|
virtual |
Called by the CPU when returning from an ISR (executing a RETI instruction).
The base implementation calls update_irq to determine the next vector to be given to the CPU.
Reimplemented in ArchXT_IntCtrl.
◆ ctlreq()
|
overridevirtual |
Virtual method called for a CTL request. The method must return true if the request has been processed.
Reimplemented from Peripheral.
◆ get_next_irq()
|
protectedpure virtual |
Abstract method indicating which vector should be executed next. Architecture specific behaviors can be implemented here to take into account priority arbitration between vectors.
- Note
- implementations should assume the GIE flag is set.
- Returns
- IRQ to be executed next or NO_INTERRUPT
Implemented in ArchXT_IntCtrl.
◆ interrupt_raised()
|
inlineprotected |
Interrupt state getter.
◆ intr_count()
|
inlineprotected |
Interrupt table size getter.
◆ reset()
|
overridevirtual |
Virtual method called when the device is reset. Note that resetting I/O registers is only necessary here if their reset value is not zero.
- Parameters
-
flags Reset flags (OR'ed combination of Device::ResetFlag enumeration values)
Reimplemented from Peripheral.
◆ set_interrupt_raised()
|
protected |
Interrupt state setter.
◆ sleep()
|
overridevirtual |
Virtual method called when the device enters or exits a sleep mode.
- Parameters
-
on true when entering a sleep mode, false when exiting it. mode one of the enum SleepMode values
Reimplemented from Peripheral.
◆ update_irq()
|
protected |
Update the controller, by storing the next vector to be given to the CPU
Friends And Related Symbol Documentation
◆ InterruptHandler
|
friend |
Member Data Documentation
◆ NO_INTERRUPT
|
staticconstexpr |
The documentation for this class was generated from the following files:
Generated by
Public Member Functions inherited from