Move devices into dedicated subdirectories.

This commit is contained in:
Maxim Poliakovski 2021-10-23 20:17:47 +02:00
parent 7919cd0590
commit 9329d56d83
50 changed files with 177 additions and 134 deletions

View File

@ -79,7 +79,8 @@ add_subdirectory(thirdparty/cubeb EXCLUDE_FROM_ALL)
set(CLI11_ROOT ${PROJECT_SOURCE_DIR}/thirdparty/CLI11)
include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/devices"
include_directories("${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/devices"
"${PROJECT_SOURCE_DIR}/cpu/ppc"
"${PROJECT_SOURCE_DIR}/debugger"
"${PROJECT_SOURCE_DIR}/utils"

View File

@ -22,8 +22,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef PPCEMU_H
#define PPCEMU_H
#include "devices/memctrlbase.h"
#include "endianswap.h"
#include <devices/memctrl/memctrlbase.h>
#include <endianswap.h>
#include <cinttypes>
#include <functional>
#include <setjmp.h>

View File

@ -21,10 +21,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
/** @file PowerPC Memory Management Unit emulation. */
#include "ppcmmu.h"
#include "devices/memctrlbase.h"
#include "memaccess.h"
#include <devices/memctrl/memctrlbase.h>
#include <memaccess.h>
#include "ppcemu.h"
#include "ppcmmu.h"
#include <array>
#include <cinttypes>
#include <functional>

View File

@ -24,11 +24,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef PPCMMU_H
#define PPCMMU_H
#include <devices/memctrl/memctrlbase.h>
#include <array>
#include <cinttypes>
#include <functional>
#include <vector>
#include "devices/memctrlbase.h"
/* Uncomment this to exhaustive MMU integrity checks. */
//#define MMU_INTEGRITY_CHECKS

View File

@ -2,7 +2,17 @@ include_directories("${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/thirdparty/loguru/"
"${PROJECT_SOURCE_DIR}/thirdparty/SDL2/")
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/common/adb/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/common/i2c/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/common/pci/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/common/scsi/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ioctrl/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/memctrl/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/sound/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/video/*.cpp"
)
add_library(devices OBJECT ${SOURCES})
target_link_libraries(devices PRIVATE cubeb)

View File

@ -25,7 +25,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "devices/adb.h"
#include <devices/common/adb/adb.h>
#include <loguru.hpp>
#include <cinttypes>
#include <cstring>
@ -37,8 +39,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <thirdparty/SDL2/include/SDL_stdinc.h>
#endif
#include <loguru.hpp>
using namespace std;
ADB_Bus::ADB_Bus() {

View File

@ -21,10 +21,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
/** @file Descriptor-based direct memory access emulation. */
#include "dmacore.h"
#include "dbdma.h"
#include "cpu/ppc/ppcmmu.h"
#include "endianswap.h"
#include <cpu/ppc/ppcmmu.h>
#include <devices/common/dbdma.h>
#include <devices/common/dmacore.h>
#include <endianswap.h>
#include <cinttypes>
#include <cstring>
#include <loguru.hpp>

View File

@ -29,7 +29,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef DB_DMA_H
#define DB_DMA_H
#include "dmacore.h"
#include <devices/common/dmacore.h>
#include <cinttypes>
#include <functional>

View File

@ -22,8 +22,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef MACHINE_ID_H
#define MACHINE_ID_H
#include "hwcomponent.h"
#include "mmiodevice.h"
#include <devices/common/hwcomponent.h>
#include <devices/common/mmiodevice.h>
#include <cinttypes>
/**

View File

@ -22,7 +22,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef MMIO_DEVICE_H
#define MMIO_DEVICE_H
#include "hwcomponent.h"
#include <devices/common/hwcomponent.h>
#include <cinttypes>
#include <string>

View File

@ -19,7 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "nvram.h"
#include <devices/common/nvram.h>
#include <cinttypes>
#include <cstring>
#include <fstream>

View File

@ -22,8 +22,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef PCI_DEVICE_H
#define PCI_DEVICE_H
#include "mmiodevice.h"
#include "pcihost.h"
#include <devices/common/mmiodevice.h>
#include <devices/common/pci/pcihost.h>
#include <cinttypes>
#include <string>

View File

@ -21,7 +21,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
/** @file MESH (Macintosh Enhanced SCSI Hardware) controller emulation. */
#include "mesh.h"
#include <devices/common/scsi/mesh.h>
#include <cinttypes>
#include <loguru.hpp>

View File

@ -24,11 +24,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
Author: Max Poliakovski 2019
*/
#include "adb.h"
#include "memaccess.h"
#include "viacuda.h"
#include <cinttypes>
#include <devices/common/adb/adb.h>
#include <devices/common/viacuda.h>
#include <loguru.hpp>
#include <memaccess.h>
#include <cinttypes>
#include <memory>
using namespace std;

View File

@ -45,10 +45,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef VIACUDA_H
#define VIACUDA_H
#include "adb.h"
#include "hwcomponent.h"
#include "i2c.h"
#include "nvram.h"
#include <devices/common/adb/adb.h>
#include <devices/common/hwcomponent.h>
#include <devices/common/i2c/i2c.h>
#include <devices/common/nvram.h>
#include <memory>
/** VIA register offsets. */

View File

@ -24,12 +24,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
Author: Max Poliakovski
*/
#include "amic.h"
#include "cpu/ppc/ppcmmu.h"
#include "dmacore.h"
#include "machines/machinebase.h"
#include "memctrlbase.h"
#include "viacuda.h"
#include <cpu/ppc/ppcmmu.h>
#include <devices/common/viacuda.h>
#include <devices/ioctrl/amic.h>
#include <machines/machinebase.h>
#include <devices/memctrl/memctrlbase.h>
#include <algorithm>
#include <cinttypes>
#include <loguru.hpp>

View File

@ -24,10 +24,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef AMIC_H
#define AMIC_H
#include "awacs.h"
#include "dmacore.h"
#include "mmiodevice.h"
#include "viacuda.h"
#include <devices/common/mmiodevice.h>
#include <devices/common/viacuda.h>
#include <devices/sound/awacs.h>
#include <cinttypes>
#include <memory>

View File

@ -19,16 +19,17 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "awacs.h"
#include "dbdma.h"
#include "machines/machinebase.h"
#include "macio.h"
#include "viacuda.h"
#include <cpu/ppc/ppcemu.h>
#include <devices/common/dbdma.h>
#include <devices/common/viacuda.h>
#include <devices/ioctrl/macio.h>
#include <devices/sound/awacs.h>
#include <machines/machinebase.h>
#include <cinttypes>
#include <functional>
#include <iostream>
#include <loguru.hpp>
#include <cpu/ppc/ppcemu.h>
/** Heathrow Mac I/O device emulation.

View File

@ -51,16 +51,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef MACIO_H
#define MACIO_H
#include "awacs.h"
#include "dbdma.h"
#include "hwcomponent.h"
#include "memctrlbase.h"
#include "mesh.h"
#include "mmiodevice.h"
#include "nvram.h"
#include "pcidevice.h"
#include "pcihost.h"
#include "viacuda.h"
#include <devices/common/dbdma.h>
#include <devices/common/hwcomponent.h>
#include <devices/common/mmiodevice.h>
#include <devices/common/nvram.h>
#include <devices/common/pci/pcidevice.h>
#include <devices/common/pci/pcihost.h>
#include <devices/common/scsi/mesh.h>
#include <devices/common/viacuda.h>
#include <devices/memctrl/memctrlbase.h>
#include <devices/sound/awacs.h>
#include <cinttypes>
/**

View File

@ -24,7 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
Author: Max Poliakovski
*/
#include "hmc.h"
#include <devices/memctrl/hmc.h>
HMC::HMC() : MemCtrlBase()
{

View File

@ -31,9 +31,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef HMC_H
#define HMC_H
#include "hwcomponent.h"
#include "memctrlbase.h"
#include "mmiodevice.h"
#include <devices/common/hwcomponent.h>
#include <devices/common/mmiodevice.h>
#include <devices/memctrl/memctrlbase.h>
#include <cinttypes>
class HMC : public MemCtrlBase, public MMIODevice {

View File

@ -19,13 +19,13 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <devices/memctrl/memctrlbase.h>
#include <algorithm> // to shut up MSVC errors (:
#include <cstring>
#include <string>
#include <vector>
#include "memctrlbase.h"
MemCtrlBase::~MemCtrlBase() {
for (auto& entry : address_map) {

View File

@ -22,7 +22,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef MEMORY_CONTROLLER_BASE_H
#define MEMORY_CONTROLLER_BASE_H
#include "mmiodevice.h"
#include <devices/common/mmiodevice.h>
#include <cinttypes>
#include <string>
#include <vector>

View File

@ -24,17 +24,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
Author: Max Poliakovski
*/
#include <devices/common/hwcomponent.h>
#include <devices/common/mmiodevice.h>
#include <devices/memctrl/memctrlbase.h>
#include <devices/memctrl/mpc106.h>
#include <memaccess.h>
#include <cinttypes>
#include <cstring>
#include <iostream>
#include <loguru.hpp>
#include "hwcomponent.h"
#include "memctrlbase.h"
#include "memaccess.h"
#include "mmiodevice.h"
#include "mpc106.h"
MPC106::MPC106() : MemCtrlBase(), PCIDevice("Grackle PCI host bridge") {
this->name = "Grackle";

View File

@ -35,11 +35,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef MPC106_H_
#define MPC106_H_
#include "hwcomponent.h"
#include "memctrlbase.h"
#include "mmiodevice.h"
#include "pcidevice.h"
#include "pcihost.h"
#include <devices/common/hwcomponent.h>
#include <devices/common/mmiodevice.h>
#include <devices/common/pci/pcidevice.h>
#include <devices/common/pci/pcihost.h>
#include <devices/memctrl/memctrlbase.h>
#include <cinttypes>
#include <unordered_map>

View File

@ -47,12 +47,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef SPD_EEPROM_H
#define SPD_EEPROM_H
#include "hwcomponent.h"
#include "i2c.h"
#include <devices/common/hwcomponent.h>
#include <devices/common/i2c/i2c.h>
#include <loguru.hpp>
#include <cinttypes>
#include <stdexcept>
#include <string>
#include <loguru.hpp>
enum RAMType : int { SDRAM = 4 };

View File

@ -28,11 +28,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
Author: Max Poliakovski 2019-21
*/
#include "awacs.h"
#include "dbdma.h"
#include "endianswap.h"
#include "machines/machinebase.h"
#include "soundserver.h"
#include <devices/common/dbdma.h>
#include <devices/sound/awacs.h>
#include <devices/sound/soundserver.h>
#include <endianswap.h>
#include <machines/machinebase.h>
#include <algorithm>
#include <loguru.hpp>
#include <memory>

View File

@ -28,10 +28,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef AWAC_H
#define AWAC_H
#include "dmacore.h"
#include "dbdma.h"
#include "i2c.h"
#include "soundserver.h"
#include <devices/common/dbdma.h>
#include <devices/common/dmacore.h>
#include <devices/common/i2c/i2c.h>
#include <devices/sound/soundserver.h>
#include <cinttypes>
#include <memory>

View File

@ -19,9 +19,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "dmacore.h"
#include "endianswap.h"
#include "soundserver.h"
#include <devices/common/dmacore.h>
#include <devices/sound/soundserver.h>
#include <endianswap.h>
#include <loguru.hpp>
#include <cubeb/cubeb.h>
#ifdef _WIN32

View File

@ -34,8 +34,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef SOUND_SERVER_H
#define SOUND_SERVER_H
#include "hwcomponent.h"
#include <cubeb/cubeb.h>
#include <devices/common/hwcomponent.h>
enum {
SND_SERVER_DOWN = 0,

View File

@ -19,15 +19,16 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "displayid.h"
#include "endianswap.h"
#include "memaccess.h"
#include "pcidevice.h"
#include <atirage.h>
#include <devices/common/pci/pcidevice.h>
#include <devices/video/atirage.h>
#include <devices/video/displayid.h>
#include <endianswap.h>
#include <loguru.hpp>
#include <memaccess.h>
#include <chrono>
#include <cstdint>
#include <map>
#include <loguru.hpp>
/* Mach64 post dividers. */
static const int mach64_post_div[8] = {

View File

@ -22,8 +22,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef ATI_RAGE_H
#define ATI_RAGE_H
#include "displayid.h"
#include "pcidevice.h"
#include <devices/common/pci/pcidevice.h>
#include <devices/video/displayid.h>
#include <cinttypes>
/* PCI related definitions. */

View File

@ -19,9 +19,9 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "displayid.h"
#include <devices/video/displayid.h>
#include <loguru.hpp>
#include "SDL.h"
#include <SDL.h>
DisplayID::DisplayID() {
/* Initialize Apple monitor codes */

View File

@ -33,7 +33,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef DISPLAY_ID_H
#define DISPLAY_ID_H
#include "SDL.h"
#include <SDL.h>
#include <cinttypes>
/** I2C bus states. */

View File

@ -1,6 +1,7 @@
set(CMAKE_CXX_STANDARD 11)
include_directories("${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/devices"
"${PROJECT_SOURCE_DIR}/thirdparty/loguru/")
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")

View File

@ -1,9 +1,10 @@
#include "machinebase.h"
#include "devices/hwcomponent.h"
#include <devices/common/hwcomponent.h>
#include <loguru.hpp>
#include <machines/machinebase.h>
#include <map>
#include <memory>
#include <string>
#include <loguru.hpp>
std::unique_ptr<MachineBase> gMachineObj = 0;

View File

@ -27,7 +27,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef MACHINE_BASE_H
#define MACHINE_BASE_H
#include "devices/hwcomponent.h"
#include <devices/common/hwcomponent.h>
#include <map>
#include <memory>
#include <string>

View File

@ -24,10 +24,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
Author: Max Poliakovski
*/
#include "machinefactory.h"
#include "devices/memctrlbase.h"
#include "memaccess.h"
#include "machineproperties.h"
#include <devices/memctrl/memctrlbase.h>
#include <loguru.hpp>
#include <machines/machinefactory.h>
#include <machines/machineproperties.h>
#include <memaccess.h>
#include <cinttypes>
#include <cstring>
#include <fstream>
@ -38,7 +40,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <memory>
#include <string>
#include <vector>
#include <loguru.hpp>
using namespace std;

View File

@ -27,7 +27,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef MACHINE_FACTORY_H
#define MACHINE_FACTORY_H
#include "machinebase.h"
#include <machines/machinebase.h>
#include <fstream>
#include <string>

View File

@ -24,17 +24,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
Author: Max Poliakovski
*/
#include "cpu/ppc/ppcemu.h"
#include "devices/atirage.h"
#include "devices/machineid.h"
#include "devices/soundserver.h"
#include "devices/macio.h"
#include "devices/mpc106.h"
#include "devices/spdram.h"
#include "devices/viacuda.h"
#include "machinebase.h"
#include "machineproperties.h"
#include <cpu/ppc/ppcemu.h>
#include <devices/common/machineid.h>
#include <devices/ioctrl/macio.h>
#include <devices/memctrl/mpc106.h>
#include <devices/memctrl/spdram.h>
#include <devices/sound/soundserver.h>
#include <devices/video/atirage.h>
#include <loguru.hpp>
#include <machines/machinebase.h>
#include <machines/machineproperties.h>
#include <string>

View File

@ -24,14 +24,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
Author: Max Poliakovski
*/
#include "cpu/ppc/ppcemu.h"
#include "devices/amic.h"
#include "devices/hmc.h"
#include "devices/machineid.h"
#include "devices/soundserver.h"
#include "machinebase.h"
#include "machineproperties.h"
#include <cpu/ppc/ppcemu.h>
#include <devices/common/machineid.h>
#include <devices/ioctrl/amic.h>
#include <devices/memctrl/hmc.h>
#include <devices/sound/soundserver.h>
#include <loguru.hpp>
#include <machines/machinebase.h>
#include <machines/machineproperties.h>
#include <string>
int create_pdm(std::string& id) {

View File

@ -1,4 +1,5 @@
#include "machineproperties.h"
#include <machines/machineproperties.h>
#include <map>
static std::map<std::string, StrProperty> PowerMac6100_Properties = {

View File

@ -1,5 +1,6 @@
#include "endianswap.h"
#include <endianswap.h>
#include <loguru.hpp>
#include <algorithm>
#include <cinttypes>
#include <string>