diff --git a/devices/common/hwcomponent.h b/devices/common/hwcomponent.h index 6fd2327..c774fa8 100644 --- a/devices/common/hwcomponent.h +++ b/devices/common/hwcomponent.h @@ -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 */ }; diff --git a/devices/common/hwinterrupt.h b/devices/common/hwinterrupt.h new file mode 100644 index 0000000..d897f42 --- /dev/null +++ b/devices/common/hwinterrupt.h @@ -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 . +*/ + +#ifndef HW_INTERRUPT_H +#define HW_INTERRUPT_H + +#include + +/** 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 \ No newline at end of file