Add NCR 53C90 stub.

This commit is contained in:
Maxim Poliakovski 2021-10-26 19:00:04 +02:00
parent 87b8e1759a
commit 392fa87ba4
4 changed files with 135 additions and 2 deletions

View File

@ -0,0 +1,38 @@
/*
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 NCR 53C94 SCSI controller emulation. */
#include "ncr53c94.h"
#include <loguru.hpp>
#include <cinttypes>
uint8_t Ncr53C94::read(uint8_t reg_offset)
{
LOG_F(9, "NCR53C94: reading from register %d", reg_offset);
return 0;
}
void Ncr53C94::write(uint8_t reg_offset, uint8_t value)
{
LOG_F(INFO, "NCR53C94: writing 0x%X to %d register", value, reg_offset);
}

View File

@ -0,0 +1,89 @@
/*
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 NCR 53C94 SCSI controller definitions. */
/* NOTE: Power Macintosh computers don't have a real NCR 53C94 chip.
The corresponding functionality is provided by the 53C94 compatible
cell in the custom Curio IC (Am79C950).
*/
#ifndef NCR53C94_H
#define NCR53C94_H
#include <cinttypes>
/** NCR 53C94 read registers */
namespace Read {
enum Reg53C94 : uint8_t {
Xfer_Cnt_LSB = 0,
Xfer_Cnt_MSB = 1,
FIFO = 2,
Command = 3,
Status = 4,
Interrupt = 5,
Seq_Step = 6,
FIFO_Flags = 7,
Config_1 = 8,
Config_2 = 0xB,
Config_3 = 0xC,
Config_4 = 0xD, // Curio extension?
Xfer_Cnt_Hi = 0xE, // Curio extension?
DMA = 0xF, // Curio extension?
};
};
/** NCR 53C94 write registers */
namespace Write {
enum Reg53C94 : uint8_t {
Xfer_Cnt_LSB = 0,
Xfer_Cnt_MSB = 1,
FIFO = 2,
Command = 3,
Dest_Bus_ID = 4,
Sel_Timeout = 5,
Synch_Period = 6,
Synch_Offset = 7,
Config_1 = 8,
Clk_Conv_Fac = 9,
Test_Mode = 0xA,
Config_2 = 0xB,
Config_3 = 0xC,
Config_4 = 0xD, // Curio extension?
Chip_ID = 0xE, // Curio extension?
DMA = 0xF, // Curio extension?
};
};
class Ncr53C94 {
public:
Ncr53C94() = default;
~Ncr53C94() = default;
// NCR 53C94 registers access
uint8_t read(uint8_t reg_offset);
void write(uint8_t reg_offset, uint8_t value);
private:
uint8_t chip_id;
};
#endif // NCR53C94_H

View File

@ -25,6 +25,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <cpu/ppc/ppcmmu.h> #include <cpu/ppc/ppcmmu.h>
#include <devices/common/scsi/ncr53c94.h>
#include <devices/common/viacuda.h> #include <devices/common/viacuda.h>
#include <devices/ethernet/mace.h> #include <devices/ethernet/mace.h>
#include <devices/ioctrl/amic.h> #include <devices/ioctrl/amic.h>
@ -49,6 +50,7 @@ AMIC::AMIC()
LOG_F(ERROR, "Couldn't register AMIC registers!"); LOG_F(ERROR, "Couldn't register AMIC registers!");
} }
this->scsi = std::unique_ptr<Ncr53C94> (new Ncr53C94());
this->escc = std::unique_ptr<EsccController> (new EsccController()); this->escc = std::unique_ptr<EsccController> (new EsccController());
this->mace = std::unique_ptr<MaceController> (new MaceController(MACE_ID)); this->mace = std::unique_ptr<MaceController> (new MaceController(MACE_ID));
this->viacuda = std::unique_ptr<ViaCuda> (new ViaCuda()); this->viacuda = std::unique_ptr<ViaCuda> (new ViaCuda());
@ -81,8 +83,7 @@ uint32_t AMIC::read(uint32_t reg_start, uint32_t offset, int size)
case 0xA: // MACE registers case 0xA: // MACE registers
return this->mace->read((offset >> 4) & 0xF); return this->mace->read((offset >> 4) & 0xF);
case 0x10: // SCSI registers case 0x10: // SCSI registers
LOG_F(WARNING, "AMIC: read attempt from unimplemented SCSI register"); return this->scsi->read((offset >> 4) & 0xF);
return 0;
case 0x14: // Sound registers case 0x14: // Sound registers
switch (offset) { switch (offset) {
case AMICReg::Snd_Stat_0: case AMICReg::Snd_Stat_0:
@ -133,6 +134,9 @@ void AMIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int size)
case 0xA: // MACE registers case 0xA: // MACE registers
this->mace->write((offset >> 4) & 0xF, value); this->mace->write((offset >> 4) & 0xF, value);
return; return;
case 0x10:
this->scsi->write((offset >> 4) & 0xF, value);
return;
case 0x14: // Sound registers case 0x14: // Sound registers
switch(offset) { switch(offset) {
case AMICReg::Snd_Ctrl_0: case AMICReg::Snd_Ctrl_0:

View File

@ -25,6 +25,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#define AMIC_H #define AMIC_H
#include <devices/common/mmiodevice.h> #include <devices/common/mmiodevice.h>
#include <devices/common/scsi/ncr53c94.h>
#include <devices/common/viacuda.h> #include <devices/common/viacuda.h>
#include <devices/ethernet/mace.h> #include <devices/ethernet/mace.h>
#include <devices/serial/escc.h> #include <devices/serial/escc.h>
@ -144,6 +145,7 @@ private:
uint8_t scsi_dma_cs = 0; // SCSI DMA control/status register value uint8_t scsi_dma_cs = 0; // SCSI DMA control/status register value
// AMIC subdevices instances // AMIC subdevices instances
std::unique_ptr<Ncr53C94> scsi;
std::unique_ptr<EsccController> escc; std::unique_ptr<EsccController> escc;
std::unique_ptr<MaceController> mace; std::unique_ptr<MaceController> mace;
std::unique_ptr<ViaCuda> viacuda; std::unique_ptr<ViaCuda> viacuda;