Connect ESCC to AMIC and Heathrow.

This commit is contained in:
Maxim Poliakovski 2021-10-25 22:19:27 +02:00
parent cb946e41b5
commit 87b8e1759a
5 changed files with 32 additions and 7 deletions

View File

@ -11,6 +11,7 @@ file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ethernet/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ioctrl/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/memctrl/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/serial/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/sound/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/video/*.cpp"
)

View File

@ -28,6 +28,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <devices/common/viacuda.h>
#include <devices/ethernet/mace.h>
#include <devices/ioctrl/amic.h>
#include <devices/serial/escc.h>
#include <machines/machinebase.h>
#include <devices/memctrl/memctrlbase.h>
@ -48,6 +49,7 @@ AMIC::AMIC()
LOG_F(ERROR, "Couldn't register AMIC registers!");
}
this->escc = std::unique_ptr<EsccController> (new EsccController());
this->mace = std::unique_ptr<MaceController> (new MaceController(MACE_ID));
this->viacuda = std::unique_ptr<ViaCuda> (new ViaCuda());
@ -74,10 +76,10 @@ uint32_t AMIC::read(uint32_t reg_start, uint32_t offset, int size)
case 1:
return this->viacuda->read(offset >> 9);
case 4: // SCC registers
LOG_F(WARNING, "AMIC: read attempt from unimplemented SCC register");
this->escc->read_compat((offset >> 1) & 0xF);
return 0;
case 0xA: // MACE registers
return this->mace->read((offset >> 4) & 0xFF);
return this->mace->read((offset >> 4) & 0xF);
case 0x10: // SCSI registers
LOG_F(WARNING, "AMIC: read attempt from unimplemented SCSI register");
return 0;
@ -125,8 +127,11 @@ void AMIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int size)
case 1:
this->viacuda->write(offset >> 9, value);
return;
case 4:
this->escc->write_compat((offset >> 1) & 0xF, value);
return;
case 0xA: // MACE registers
this->mace->write((offset >> 4) & 0xFF, value);
this->mace->write((offset >> 4) & 0xF, value);
return;
case 0x14: // Sound registers
switch(offset) {

View File

@ -27,6 +27,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <devices/common/mmiodevice.h>
#include <devices/common/viacuda.h>
#include <devices/ethernet/mace.h>
#include <devices/serial/escc.h>
#include <devices/sound/awacs.h>
#include <cinttypes>
@ -142,6 +143,8 @@ private:
uint8_t scsi_dma_cs = 0; // SCSI DMA control/status register value
// AMIC subdevices instances
std::unique_ptr<EsccController> escc;
std::unique_ptr<MaceController> mace;
std::unique_ptr<ViaCuda> viacuda;
std::unique_ptr<AwacDevicePdm> awacs;

View File

@ -23,6 +23,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <devices/common/dbdma.h>
#include <devices/common/viacuda.h>
#include <devices/ioctrl/macio.h>
#include <devices/serial/escc.h>
#include <devices/sound/awacs.h>
#include <loguru.hpp>
#include <machines/machinebase.h>
@ -55,6 +56,7 @@ HeathrowIC::HeathrowIC() : PCIDevice("mac-io/heathrow") {
);
this->mesh = std::unique_ptr<MESHController> (new MESHController(HeathrowMESHID));
this->escc = std::unique_ptr<EsccController> (new EsccController());
}
uint32_t HeathrowIC::pci_cfg_read(uint32_t reg_offs, uint32_t size) {
@ -126,6 +128,10 @@ uint32_t HeathrowIC::read(uint32_t reg_start, uint32_t offset, int size) {
case 0x10:
res = this->mesh->read((offset >> 4) & 0xF);
break;
case 0x12: // ESCC compatible
return this->escc->read_compat((offset >> 4) & 0xF);
case 0x13: // ESCC MacRISC
return this->escc->read((offset >> 4) & 0xF);
case 0x14:
res = this->screamer->snd_ctrl_read(offset - 0x14000, size);
break;
@ -159,6 +165,12 @@ void HeathrowIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int
case 0x10:
this->mesh->write((offset >> 4) & 0xF, value);
break;
case 0x12: // ESCC compatible
this->escc->write_compat((offset >> 4) & 0xF, value);
break;
case 0x13: // ESCC MacRISC
this->escc->write((offset >> 4) & 0xF, value);
break;
case 0x14:
this->screamer->snd_ctrl_write(offset - 0x14000, value, size);
break;

View File

@ -60,6 +60,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <devices/common/scsi/mesh.h>
#include <devices/common/viacuda.h>
#include <devices/memctrl/memctrlbase.h>
#include <devices/serial/escc.h>
#include <devices/sound/awacs.h>
#include <cinttypes>
@ -78,7 +79,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
----------------------------------------------------------------
mesh(SCSI) register space: 0x00010000, DMA space: 0x00008000
bmac(ethernet) register space: 0x00011000, DMA space: 0x00008200, 0x00008300
escc(serial) register space: 0x00013000, size: 0x00001000
escc(compat) register space: 0x00012000, size: 0x00001000
DMA space: 0x00008400, size: 0x00000400
escc(MacRISC) register space: 0x00013000, size: 0x00001000
DMA space: 0x00008400, size: 0x00000400
escc:ch-a register space: 0x00013020, DMA space: 0x00008400, 0x00008500
escc:ch-b register space: 0x00013000, DMA space: 0x00008600, 0x00008700
@ -149,10 +152,11 @@ private:
uint32_t aux_ctrl = 0; // aux features control register
/* device cells */
std::unique_ptr<ViaCuda> viacuda; // VIA cell with Cuda MCU attached to it
std::unique_ptr<NVram> nvram; // NVRAM cell
std::unique_ptr<ViaCuda> viacuda; // VIA cell with Cuda MCU attached to it
std::unique_ptr<NVram> nvram; // NVRAM cell
std::unique_ptr<AwacsScreamer> screamer; // Screamer audio codec instance
std::unique_ptr<MESHController> mesh; // MESH SCSI cell instance
std::unique_ptr<MESHController> mesh; // MESH SCSI cell instance
std::unique_ptr<EsccController> escc; // ESCC serial controller
std::unique_ptr<DMAChannel> snd_out_dma;
};