mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-23 21:34:06 +00:00
Basic MESH emulation skeleton with events logging.
This commit is contained in:
parent
6d80ead5b1
commit
16d9e6c681
@ -45,6 +45,8 @@ HeathrowIC::HeathrowIC() : PCIDevice("mac-io/heathrow") {
|
||||
this->screamer = new AWACDevice();
|
||||
this->snd_out_dma = new DMAChannel(this->screamer);
|
||||
this->screamer->set_dma_out(this->snd_out_dma);
|
||||
|
||||
this->mesh = new MESHController(HeathrowMESHID);
|
||||
}
|
||||
|
||||
HeathrowIC::~HeathrowIC() {
|
||||
@ -53,6 +55,9 @@ HeathrowIC::~HeathrowIC() {
|
||||
|
||||
if (this->viacuda)
|
||||
delete (this->viacuda);
|
||||
|
||||
if (this->mesh)
|
||||
delete (this->mesh);
|
||||
}
|
||||
|
||||
|
||||
@ -122,6 +127,9 @@ uint32_t HeathrowIC::read(uint32_t reg_start, uint32_t offset, int size) {
|
||||
case 8:
|
||||
res = dma_read(offset - 0x8000, size);
|
||||
break;
|
||||
case 0x10:
|
||||
res = this->mesh->read((offset >> 4) & 0xF);
|
||||
break;
|
||||
case 0x14:
|
||||
res = this->screamer->snd_ctrl_read(offset - 0x14000, size);
|
||||
break;
|
||||
@ -152,6 +160,9 @@ void HeathrowIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int
|
||||
case 8:
|
||||
dma_write(offset - 0x8000, value, size);
|
||||
break;
|
||||
case 0x10:
|
||||
this->mesh->write((offset >> 4) & 0xF, value);
|
||||
break;
|
||||
case 0x14:
|
||||
this->screamer->snd_ctrl_write(offset - 0x14000, value, size);
|
||||
break;
|
||||
|
@ -55,6 +55,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include "dbdma.h"
|
||||
#include "hwcomponent.h"
|
||||
#include "memctrlbase.h"
|
||||
#include "mesh.h"
|
||||
#include "mmiodevice.h"
|
||||
#include "nvram.h"
|
||||
#include "pcidevice.h"
|
||||
@ -146,9 +147,10 @@ private:
|
||||
uint32_t aux_ctrl = 0; // aux features control register
|
||||
|
||||
/* device cells */
|
||||
ViaCuda* viacuda; /* VIA cell with Cuda MCU attached to it */
|
||||
NVram* nvram; /* NVRAM cell */
|
||||
AWACDevice* screamer; /* Screamer audio codec instance */
|
||||
ViaCuda* viacuda; // VIA cell with Cuda MCU attached to it
|
||||
NVram* nvram; // NVRAM cell
|
||||
AWACDevice* screamer; // Screamer audio codec instance
|
||||
MESHController *mesh; // MESH SCSI cell instance
|
||||
|
||||
DMAChannel* snd_out_dma;
|
||||
};
|
||||
|
68
devices/mesh.cpp
Normal file
68
devices/mesh.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-21 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/>.
|
||||
*/
|
||||
|
||||
/** @file MESH (Macintosh Enhanced SCSI Hardware) controller emulation. */
|
||||
|
||||
#include "mesh.h"
|
||||
#include <cinttypes>
|
||||
#include <thirdparty/loguru/loguru.hpp>
|
||||
|
||||
uint8_t MESHController::read(uint8_t reg_offset)
|
||||
{
|
||||
switch(reg_offset) {
|
||||
case MeshReg::BusStatus0:
|
||||
LOG_F(INFO, "MESH: read from BusStatus0 register");
|
||||
return 0;
|
||||
case MeshReg::MeshID:
|
||||
LOG_F(INFO, "MESH: read from MeshID register");
|
||||
return this->chip_id; // tell them who we are
|
||||
default:
|
||||
LOG_F(WARNING, "MESH: read from unimplemented register at offset %d", reg_offset);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MESHController::write(uint8_t reg_offset, uint8_t value)
|
||||
{
|
||||
switch(reg_offset) {
|
||||
case MeshReg::Sequence:
|
||||
LOG_F(INFO, "MESH: write 0x%02X to Sequence register", value);
|
||||
break;
|
||||
case MeshReg::BusStatus1:
|
||||
LOG_F(INFO, "MESH: write 0x%02X to BusStatus1 register", value);
|
||||
break;
|
||||
case MeshReg::IntMask:
|
||||
LOG_F(INFO, "MESH: write 0x%02X to IntMask register", value);
|
||||
break;
|
||||
case MeshReg::Interrupt:
|
||||
LOG_F(INFO, "MESH: write 0x%02X to Interrupt register", value);
|
||||
break;
|
||||
case MeshReg::SourceID:
|
||||
LOG_F(INFO, "MESH: write 0x%02X to SourceID register", value);
|
||||
break;
|
||||
case MeshReg::SyncParms:
|
||||
LOG_F(INFO, "MESH: write 0x%02X to SyncParms register", value);
|
||||
break;
|
||||
default:
|
||||
LOG_F(WARNING, "MESH: write to unimplemented register at offset %d", reg_offset);
|
||||
}
|
||||
}
|
65
devices/mesh.h
Normal file
65
devices/mesh.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-21 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/>.
|
||||
*/
|
||||
|
||||
/** @file MESH (Macintosh Enhanced SCSI Hardware) controller definitions. */
|
||||
|
||||
#ifndef MESH_H
|
||||
#define MESH_H
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
// Chip ID returned by the MESH cell inside the Heathrow ASIC
|
||||
#define HeathrowMESHID 4
|
||||
|
||||
// MESH registers offsets
|
||||
enum MeshReg : uint8_t {
|
||||
XferCount0 = 0,
|
||||
XferCount1 = 1,
|
||||
FIFO = 2,
|
||||
Sequence = 3,
|
||||
BusStatus0 = 4,
|
||||
BusStatus1 = 5,
|
||||
FIFOCount = 6,
|
||||
Exception = 7,
|
||||
Error = 8,
|
||||
IntMask = 9,
|
||||
Interrupt = 0xA,
|
||||
SourceID = 0xB,
|
||||
DestID = 0xC,
|
||||
SyncParms = 0xD,
|
||||
MeshID = 0xE,
|
||||
SelTimeOut = 0xF
|
||||
};
|
||||
|
||||
class MESHController {
|
||||
public:
|
||||
MESHController(uint8_t mesh_id) { this->chip_id = mesh_id; };
|
||||
~MESHController() = default;
|
||||
|
||||
// MESH registers access
|
||||
uint8_t read(uint8_t reg_offset);
|
||||
void write(uint8_t reg_offset, uint8_t value);
|
||||
|
||||
private:
|
||||
uint8_t chip_id; // Chip ID for the MESH controller
|
||||
};
|
||||
|
||||
#endif // MESH_H
|
Loading…
x
Reference in New Issue
Block a user