Add interrupt controller interface and definitions.

This commit is contained in:
Maxim Poliakovski 2022-01-10 17:34:14 +01:00
parent aefc66d118
commit d9d8384d4a
2 changed files with 52 additions and 0 deletions

View File

@ -37,6 +37,7 @@ enum HWCompType : int {
I2C_DEV = 61, /* I2C device */
ADB_HOST = 70, /* ADB host */
ADB_DEV = 71, /* ADB device */
INT_CTRL = 80, /* interrupt controller */
SND_SERVER = 100, /* host sound server */
};

View File

@ -0,0 +1,51 @@
/*
DingusPPC - The Experimental PowerPC Macintosh emulator
Copyright (C) 2018-22 divingkatae and maximum
(theweirdo) spatium
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef HW_INTERRUPT_H
#define HW_INTERRUPT_H
#include <cinttypes>
/** Enumerator for various interrupt sources. */
enum IntSrc : int {
VIA_CUDA = 1,
VIA2 = 2,
SCC = 3,
ETHERNET = 4,
NMI = 5,
};
/** Base class for interrupt controllers. */
class InterruptCtrl {
public:
InterruptCtrl() = default;
virtual ~InterruptCtrl() = default;
// register interrupt sources for a device
virtual uint32_t register_dev_int(IntSrc src_id) = 0;
virtual uint32_t register_dma_int(IntSrc src_id) = 0;
// acknowledge HW interrupt
virtual void ack_int(uint32_t irq_id, uint8_t irq_line_state) = 0;
virtual void ack_dma_int(uint32_t irq_id, uint8_t irq_line_state) = 0;
};
#endif // HW_INTERRUPT_H