mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
wd: simplify handlers, upgrade hpc1 [O. Galibert]
This commit is contained in:
parent
edda9abeee
commit
f7bec53c14
@ -470,10 +470,10 @@ void wd33c9x_base_device::scsi_ctrl_changed()
|
||||
// dir_r
|
||||
//-------------------------------------------------
|
||||
|
||||
READ8_MEMBER(wd33c9x_base_device::dir_r)
|
||||
uint8_t wd33c9x_base_device::dir_r(offs_t offset)
|
||||
{
|
||||
m_addr = offset & REGS_MASK;
|
||||
return indir_reg_r(space, 0, mem_mask);
|
||||
return indir_reg_r();
|
||||
}
|
||||
|
||||
|
||||
@ -481,10 +481,10 @@ READ8_MEMBER(wd33c9x_base_device::dir_r)
|
||||
// dir_w
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE8_MEMBER(wd33c9x_base_device::dir_w)
|
||||
void wd33c9x_base_device::dir_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_addr = offset & REGS_MASK;
|
||||
indir_reg_w(space, 0, data, mem_mask);
|
||||
indir_reg_w(data);
|
||||
}
|
||||
|
||||
|
||||
@ -492,13 +492,13 @@ WRITE8_MEMBER(wd33c9x_base_device::dir_w)
|
||||
// indir_r
|
||||
//-------------------------------------------------
|
||||
|
||||
READ8_MEMBER(wd33c9x_base_device::indir_r)
|
||||
uint8_t wd33c9x_base_device::indir_r(offs_t offset)
|
||||
{
|
||||
switch (offset) {
|
||||
case 0:
|
||||
return indir_addr_r(space, 0, mem_mask);
|
||||
return indir_addr_r();
|
||||
case 1:
|
||||
return indir_reg_r(space, 0, mem_mask);
|
||||
return indir_reg_r();
|
||||
default:
|
||||
LOGMASKED(LOG_READS | LOG_ERRORS, "Read from invalid offset %d\n", offset);
|
||||
break;
|
||||
@ -511,14 +511,14 @@ READ8_MEMBER(wd33c9x_base_device::indir_r)
|
||||
// indir_w
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE8_MEMBER(wd33c9x_base_device::indir_w)
|
||||
void wd33c9x_base_device::indir_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
switch (offset) {
|
||||
case 0:
|
||||
indir_addr_w(space, 0, data, mem_mask);
|
||||
indir_addr_w(data);
|
||||
break;
|
||||
case 1:
|
||||
indir_reg_w(space, 0, data, mem_mask);
|
||||
indir_reg_w(data);
|
||||
break;
|
||||
default:
|
||||
LOGMASKED(LOG_WRITES | LOG_ERRORS, "Write to invalid offset %d (data=%02x)\n", offset, data);
|
||||
@ -531,11 +531,8 @@ WRITE8_MEMBER(wd33c9x_base_device::indir_w)
|
||||
// indir_addr_r
|
||||
//-------------------------------------------------
|
||||
|
||||
READ8_MEMBER(wd33c9x_base_device::indir_addr_r)
|
||||
uint8_t wd33c9x_base_device::indir_addr_r()
|
||||
{
|
||||
if (offset != 0) {
|
||||
fatalerror("%s: Read from invalid address offset %d\n", shortname(), offset);
|
||||
}
|
||||
// Trick to push the interrupt flag after the fifo is empty to help cps3
|
||||
return m_regs[AUXILIARY_STATUS] & 0x01 ? m_regs[AUXILIARY_STATUS] & 0x7f : m_regs[AUXILIARY_STATUS];
|
||||
}
|
||||
@ -545,11 +542,8 @@ READ8_MEMBER(wd33c9x_base_device::indir_addr_r)
|
||||
// indir_addr_w
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE8_MEMBER(wd33c9x_base_device::indir_addr_w)
|
||||
void wd33c9x_base_device::indir_addr_w(uint8_t data)
|
||||
{
|
||||
if (offset != 0) {
|
||||
fatalerror("%s: Write to invalid address offset %d (data=%02x)\n", shortname(), offset, data);
|
||||
}
|
||||
m_addr = data & REGS_MASK;
|
||||
}
|
||||
|
||||
@ -558,12 +552,8 @@ WRITE8_MEMBER(wd33c9x_base_device::indir_addr_w)
|
||||
// indir_reg_r
|
||||
//-------------------------------------------------
|
||||
|
||||
READ8_MEMBER(wd33c9x_base_device::indir_reg_r)
|
||||
uint8_t wd33c9x_base_device::indir_reg_r()
|
||||
{
|
||||
if (offset != 0) {
|
||||
fatalerror("%s: Read from invalid indirect register offset %d\n", shortname(), offset);
|
||||
}
|
||||
|
||||
uint8_t ret;
|
||||
switch (m_addr) {
|
||||
case DATA: {
|
||||
@ -614,12 +604,8 @@ READ8_MEMBER(wd33c9x_base_device::indir_reg_r)
|
||||
// indir_reg_w
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE8_MEMBER(wd33c9x_base_device::indir_reg_w)
|
||||
void wd33c9x_base_device::indir_reg_w(uint8_t data)
|
||||
{
|
||||
if (offset != 0) {
|
||||
fatalerror("%s: Write to invalid indirect register offset %d (data=%02x)\n", shortname(), offset, data);
|
||||
}
|
||||
|
||||
switch (m_addr) {
|
||||
case SCSI_STATUS:
|
||||
case QUEUE_TAG: // Only for 92/93 and 93A
|
||||
|
@ -18,18 +18,18 @@ public:
|
||||
auto drq_cb() { return m_drq_cb.bind(); }
|
||||
|
||||
// Direct Addressing Interface
|
||||
DECLARE_READ8_MEMBER(dir_r);
|
||||
DECLARE_WRITE8_MEMBER(dir_w);
|
||||
uint8_t dir_r(offs_t offset);
|
||||
void dir_w(offs_t offset, uint8_t data);
|
||||
|
||||
// Indirect Addressing Interface
|
||||
DECLARE_READ8_MEMBER(indir_r);
|
||||
DECLARE_WRITE8_MEMBER(indir_w);
|
||||
uint8_t indir_r(offs_t offset);
|
||||
void indir_w(offs_t offset, uint8_t data);
|
||||
|
||||
// Alternative Indirect Addressing Interface
|
||||
DECLARE_READ8_MEMBER(indir_addr_r);
|
||||
DECLARE_WRITE8_MEMBER(indir_addr_w);
|
||||
DECLARE_READ8_MEMBER(indir_reg_r);
|
||||
DECLARE_WRITE8_MEMBER(indir_reg_w);
|
||||
uint8_t indir_addr_r();
|
||||
void indir_addr_w(uint8_t data);
|
||||
uint8_t indir_reg_r();
|
||||
void indir_reg_w(uint8_t data);
|
||||
|
||||
// Master Reset (MR) Interface
|
||||
DECLARE_WRITE_LINE_MEMBER(reset_w);
|
||||
|
@ -105,6 +105,8 @@ protected:
|
||||
|
||||
void wd33c93(device_t *device);
|
||||
|
||||
static void scsi_devices(device_slot_interface &device);
|
||||
|
||||
required_device<mips3_device> m_maincpu;
|
||||
required_shared_ptr<uint64_t> m_mainram;
|
||||
required_device<sgi_mc_device> m_mem_ctrl;
|
||||
@ -196,11 +198,10 @@ void ip22_state::wd33c93(device_t *device)
|
||||
downcast<wd33c93n_device *>(device)->drq_cb().set(m_hpc3, FUNC(hpc3_device::scsi0_drq));
|
||||
}
|
||||
|
||||
static void ip22_scsi_devices(device_slot_interface &device)
|
||||
void ip22_state::scsi_devices(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("cdrom", NSCSI_CDROM);
|
||||
device.option_add("harddisk", NSCSI_HARDDISK);
|
||||
device.option_add_internal("wd33c93", WD33C93N);
|
||||
//device.set_option_machine_config("cdrom", cdrom_config);
|
||||
}
|
||||
|
||||
@ -222,15 +223,15 @@ void ip22_state::ip22_base(machine_config &config)
|
||||
SGI_MC(config, m_mem_ctrl, m_maincpu, ":hpc3:eeprom");
|
||||
|
||||
NSCSI_BUS(config, "scsibus", 0);
|
||||
NSCSI_CONNECTOR(config, "scsibus:0", ip22_scsi_devices, "wd33c93", true)
|
||||
.set_option_machine_config("wd33c93", [this](device_t *device) { wd33c93(device); });
|
||||
NSCSI_CONNECTOR(config, "scsibus:1", ip22_scsi_devices, "harddisk", false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:2", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:3", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:4", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:5", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:6", ip22_scsi_devices, "cdrom", false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:7", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:0").option_set("wd33c93", WD33C93N)
|
||||
.machine_config([this](device_t *device) { wd33c93(device); });
|
||||
NSCSI_CONNECTOR(config, "scsibus:1", scsi_devices, "harddisk", false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:2", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:3", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:4", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:5", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:6", scsi_devices, "cdrom", false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:7", scsi_devices, nullptr, false);
|
||||
}
|
||||
|
||||
void ip22_state::ip225015(machine_config &config)
|
||||
@ -274,15 +275,15 @@ void ip24_state::ip244415(machine_config &config)
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &ip24_state::ip22_map);
|
||||
|
||||
NSCSI_BUS(config, "scsibus2", 0);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:0", ip22_scsi_devices, "wd33c93", true)
|
||||
.set_option_machine_config("wd33c93", [this](device_t *device) { wd33c93_2(device); });
|
||||
NSCSI_CONNECTOR(config, "scsibus2:1", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:2", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:3", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:4", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:5", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:6", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:7", ip22_scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:0").option_set("wd33c93", WD33C93N)
|
||||
.machine_config([this](device_t *device) { wd33c93_2(device); });
|
||||
NSCSI_CONNECTOR(config, "scsibus2:1", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:2", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:3", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:4", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:5", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:6", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus2:7", scsi_devices, nullptr, false);
|
||||
|
||||
SGI_HPC3(config, m_hpc3, m_maincpu, m_scsi_ctrl, m_scsi_ctrl2);
|
||||
}
|
||||
|
@ -10,9 +10,9 @@
|
||||
#include "cpu/mips/mips3.h"
|
||||
#include "bus/rs232/rs232.h"
|
||||
#include "bus/rs232/hlemouse.h"
|
||||
#include "bus/scsi/scsi.h"
|
||||
#include "bus/scsi/scsicd512.h"
|
||||
#include "bus/scsi/scsihd.h"
|
||||
#include "machine/nscsi_bus.h"
|
||||
#include "machine/nscsi_cd.h"
|
||||
#include "machine/nscsi_hd.h"
|
||||
#include "bus/sgikbd/sgikbd.h"
|
||||
#include "machine/hpc1.h"
|
||||
#include "speaker.h"
|
||||
@ -28,9 +28,10 @@
|
||||
#define LOG_DUART1 (1 << 8)
|
||||
#define LOG_DUART2 (1 << 9)
|
||||
#define LOG_PIT (1 << 10)
|
||||
#define LOG_CHAIN (1 << 11)
|
||||
#define LOG_REGS (LOG_UNKNOWN | LOG_READS | LOG_WRITES)
|
||||
#define LOG_DUART (LOG_DUART0 | LOG_DUART1 | LOG_DUART2)
|
||||
#define LOG_ALL (LOG_REGS | LOG_INT | LOG_EEPROM | LOG_SCSI | LOG_SCSI_DMA | LOG_DUART | LOG_PIT)
|
||||
#define LOG_ALL (LOG_REGS | LOG_INT | LOG_EEPROM | LOG_SCSI | LOG_SCSI_DMA | LOG_DUART | LOG_PIT | LOG_CHAIN)
|
||||
|
||||
#define VERBOSE (LOG_UNKNOWN)
|
||||
#include "logmacro.h"
|
||||
@ -50,7 +51,7 @@ hpc1_device::hpc1_device(const machine_config &mconfig, const char *tag, device_
|
||||
: device_t(mconfig, SGI_HPC1, tag, owner, clock)
|
||||
, m_maincpu(*this, finder_base::DUMMY_TAG)
|
||||
, m_eeprom(*this, finder_base::DUMMY_TAG)
|
||||
, m_wd33c93(*this, "wd33c93")
|
||||
, m_wd33c93(*this, "scsibus:0:wd33c93")
|
||||
, m_scc(*this, "scc%u", 0U)
|
||||
, m_pit(*this, "pit")
|
||||
, m_rtc(*this, "rtc")
|
||||
@ -68,14 +69,14 @@ void hpc1_device::device_start()
|
||||
save_item(NAME(m_vme_int_mask));
|
||||
|
||||
save_item(NAME(m_scsi_dma.m_desc));
|
||||
save_item(NAME(m_scsi_dma.m_ctrl));
|
||||
save_item(NAME(m_scsi_dma.m_addr));
|
||||
save_item(NAME(m_scsi_dma.m_flag));
|
||||
save_item(NAME(m_scsi_dma.m_next));
|
||||
save_item(NAME(m_scsi_dma.m_ctrl));
|
||||
save_item(NAME(m_scsi_dma.m_length));
|
||||
save_item(NAME(m_scsi_dma.m_next));
|
||||
save_item(NAME(m_scsi_dma.m_irq));
|
||||
save_item(NAME(m_scsi_dma.m_drq));
|
||||
save_item(NAME(m_scsi_dma.m_to_mem));
|
||||
save_item(NAME(m_scsi_dma.m_active));
|
||||
save_item(NAME(m_scsi_dma.m_end));
|
||||
|
||||
save_item(NAME(m_duart_int_status));
|
||||
}
|
||||
@ -91,14 +92,14 @@ void hpc1_device::device_reset()
|
||||
memset(m_vme_int_mask, 0, sizeof(uint32_t) * 2);
|
||||
|
||||
m_scsi_dma.m_desc = 0;
|
||||
m_scsi_dma.m_ctrl = 0;
|
||||
m_scsi_dma.m_addr = 0;
|
||||
m_scsi_dma.m_flag = 0;
|
||||
m_scsi_dma.m_next = 0;
|
||||
m_scsi_dma.m_ctrl = 0;
|
||||
m_scsi_dma.m_length = 0;
|
||||
m_scsi_dma.m_next = 0;
|
||||
m_scsi_dma.m_irq = false;
|
||||
m_scsi_dma.m_drq = false;
|
||||
m_scsi_dma.m_to_mem = false;
|
||||
m_scsi_dma.m_active = false;
|
||||
m_scsi_dma.m_end = false;
|
||||
|
||||
m_duart_int_status = 0;
|
||||
|
||||
@ -111,8 +112,8 @@ void hpc1_device::device_reset()
|
||||
|
||||
void hpc1_device::cdrom_config(device_t *device)
|
||||
{
|
||||
cdda_device *cdda = device->subdevice<cdda_device>("cdda");
|
||||
cdda->add_route(ALL_OUTPUTS, "^^mono", 1.0);
|
||||
// cdda_device *cdda = device->subdevice<cdda_device>("cdda");
|
||||
// cdda->add_route(ALL_OUTPUTS, "^^mono", 1.0);
|
||||
}
|
||||
|
||||
void hpc1_device::indigo_mice(device_slot_interface &device)
|
||||
@ -120,6 +121,19 @@ void hpc1_device::indigo_mice(device_slot_interface &device)
|
||||
device.option_add("sgimouse", SGI_HLE_SERIAL_MOUSE);
|
||||
}
|
||||
|
||||
void hpc1_device::scsi_devices(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("cdrom", NSCSI_CDROM);
|
||||
device.option_add("harddisk", NSCSI_HARDDISK);
|
||||
}
|
||||
|
||||
void hpc1_device::wd33c93(device_t *device)
|
||||
{
|
||||
device->set_clock(10000000);
|
||||
downcast<wd33c93n_device *>(device)->irq_cb().set(*this, FUNC(hpc1_device::scsi_irq));
|
||||
downcast<wd33c93n_device *>(device)->drq_cb().set(*this, FUNC(hpc1_device::scsi_drq));
|
||||
}
|
||||
|
||||
void hpc1_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
SCC85C30(config, m_scc[0], SCC_PCLK);
|
||||
@ -159,17 +173,19 @@ void hpc1_device::device_add_mconfig(machine_config &config)
|
||||
rs232b.dcd_handler().set(m_scc[1], FUNC(scc85c30_device::dcdb_w));
|
||||
rs232b.rxd_handler().set(m_scc[1], FUNC(scc85c30_device::rxb_w));
|
||||
|
||||
scsi_port_device &scsi(SCSI_PORT(config, "scsi"));
|
||||
scsi.set_slot_device(1, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_1));
|
||||
scsi.set_slot_device(2, "cdrom", RRD45, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_4));
|
||||
scsi.slot(2).set_option_machine_config("cdrom", cdrom_config);
|
||||
NSCSI_BUS(config, "scsibus", 0);
|
||||
NSCSI_CONNECTOR(config, "scsibus:0").option_set("wd33c93", WD33C93N)
|
||||
.machine_config([this](device_t *device) { wd33c93(device); });
|
||||
NSCSI_CONNECTOR(config, "scsibus:1", scsi_devices, "harddisk", false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:2", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:3", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:4", scsi_devices, "cdrom", false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:5", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:6", scsi_devices, nullptr, false);
|
||||
NSCSI_CONNECTOR(config, "scsibus:7", scsi_devices, nullptr, false);
|
||||
|
||||
DP8573(config, m_rtc);
|
||||
|
||||
WD33C93(config, m_wd33c93);
|
||||
m_wd33c93->set_scsi_port("scsi");
|
||||
m_wd33c93->irq_cb().set(FUNC(hpc1_device::scsi_irq));
|
||||
|
||||
PIT8254(config, m_pit, 0);
|
||||
m_pit->set_clk<0>(1000000);
|
||||
m_pit->set_clk<1>(1000000);
|
||||
@ -207,13 +223,13 @@ READ32_MEMBER(hpc1_device::read)
|
||||
return 0x00000000;
|
||||
case 0x0120/4:
|
||||
{
|
||||
uint32_t ret = m_wd33c93->read(space, 0) << 8;
|
||||
uint32_t ret = m_wd33c93->indir_addr_r() << 8;
|
||||
LOGMASKED(LOG_SCSI, "%s: HPC SCSI Offset 0 Read: %08x & %08x\n", machine().describe_context(), ret, mem_mask);
|
||||
return ret;
|
||||
}
|
||||
case 0x0124/4:
|
||||
{
|
||||
uint32_t ret = m_wd33c93->read(space, 1) << 8;
|
||||
uint32_t ret = m_wd33c93->indir_reg_r() << 8;
|
||||
LOGMASKED(LOG_SCSI, "%s: HPC SCSI Offset 1 Read: %08x & %08x\n", machine().describe_context(), ret, mem_mask);
|
||||
return ret;
|
||||
}
|
||||
@ -332,6 +348,8 @@ WRITE32_MEMBER(hpc1_device::write)
|
||||
m_scsi_dma.m_ctrl = data &~ (HPC_DMACTRL_FLUSH | HPC_DMACTRL_RESET);
|
||||
m_scsi_dma.m_to_mem = (m_scsi_dma.m_ctrl & HPC_DMACTRL_TO_MEM);
|
||||
m_scsi_dma.m_active = (m_scsi_dma.m_ctrl & HPC_DMACTRL_ENABLE);
|
||||
if (m_scsi_dma.m_drq && m_scsi_dma.m_active)
|
||||
do_scsi_dma();
|
||||
break;
|
||||
|
||||
case 0x00ac/4:
|
||||
@ -342,14 +360,14 @@ WRITE32_MEMBER(hpc1_device::write)
|
||||
if (ACCESSING_BITS_8_15)
|
||||
{
|
||||
LOGMASKED(LOG_SCSI, "%s: HPC SCSI Controller Address Write: %08x & %08x\n", machine().describe_context(), data, mem_mask);
|
||||
m_wd33c93->write(space, 0, (uint8_t)(data >> 8));
|
||||
m_wd33c93->indir_addr_w((uint8_t)(data >> 8));
|
||||
}
|
||||
break;
|
||||
case 0x0124/4:
|
||||
if (ACCESSING_BITS_8_15)
|
||||
{
|
||||
LOGMASKED(LOG_SCSI, "%s: HPC SCSI Controller Data Write: %08x & %08x\n", machine().describe_context(), data, mem_mask);
|
||||
m_wd33c93->write(space, 1, (uint8_t)(data >> 8));
|
||||
m_wd33c93->indir_reg_w((uint8_t)(data >> 8));
|
||||
}
|
||||
break;
|
||||
case 0x01b0/4:
|
||||
@ -484,134 +502,76 @@ WRITE32_MEMBER(hpc1_device::write)
|
||||
// SCSI DMA
|
||||
//**************************************************************************
|
||||
|
||||
void hpc1_device::dump_chain(uint32_t base)
|
||||
{
|
||||
const uint32_t addr = m_cpu_space->read_dword(base);
|
||||
const uint32_t ctrl = m_cpu_space->read_dword(base+4);
|
||||
const uint32_t next = m_cpu_space->read_dword(base+8);
|
||||
|
||||
LOGMASKED(LOG_CHAIN, "Chain Node:\n");
|
||||
LOGMASKED(LOG_CHAIN, " Addr: %08x\n", addr);
|
||||
LOGMASKED(LOG_CHAIN, " Ctrl: %08x\n", ctrl);
|
||||
LOGMASKED(LOG_CHAIN, " Next: %08x\n", next);
|
||||
|
||||
if (next != 0 && !BIT(addr, 31))
|
||||
{
|
||||
dump_chain(next & 0x0fffffff);
|
||||
}
|
||||
}
|
||||
void hpc1_device::fetch_chain()
|
||||
{
|
||||
m_scsi_dma.m_flag = m_cpu_space->read_dword(m_scsi_dma.m_desc);
|
||||
m_scsi_dma.m_ctrl = m_cpu_space->read_dword(m_scsi_dma.m_desc);
|
||||
m_scsi_dma.m_addr = m_cpu_space->read_dword(m_scsi_dma.m_desc+4);
|
||||
m_scsi_dma.m_next = m_cpu_space->read_dword(m_scsi_dma.m_desc+8);
|
||||
m_scsi_dma.m_length = m_scsi_dma.m_flag & 0x1fff;
|
||||
LOGMASKED(LOG_SCSI_DMA, "Fetched SCSI DMA Descriptor block:\n");
|
||||
LOGMASKED(LOG_SCSI_DMA, " Ctrl: %08x\n", m_scsi_dma.m_flag);
|
||||
LOGMASKED(LOG_SCSI_DMA, " Addr: %08x\n", m_scsi_dma.m_addr);
|
||||
LOGMASKED(LOG_SCSI_DMA, " Next: %08x\n", m_scsi_dma.m_next);
|
||||
LOGMASKED(LOG_SCSI_DMA, " Length: %04x\n", m_scsi_dma.m_length);
|
||||
m_scsi_dma.m_end = BIT(m_scsi_dma.m_addr, 31);
|
||||
m_scsi_dma.m_addr &= 0x0fffffff;
|
||||
m_scsi_dma.m_next &= 0x0fffffff;
|
||||
m_scsi_dma.m_length = m_scsi_dma.m_ctrl & 0x3fff;
|
||||
|
||||
LOGMASKED(LOG_CHAIN, "Fetching chain from %08x:\n", m_scsi_dma.m_desc);
|
||||
LOGMASKED(LOG_CHAIN, " Addr: %08x\n", m_scsi_dma.m_addr);
|
||||
LOGMASKED(LOG_CHAIN, " Ctrl: %08x\n", m_scsi_dma.m_ctrl);
|
||||
LOGMASKED(LOG_CHAIN, " Next: %08x\n", m_scsi_dma.m_next);
|
||||
}
|
||||
|
||||
void hpc1_device::advance_chain()
|
||||
void hpc1_device::decrement_chain()
|
||||
{
|
||||
m_scsi_dma.m_addr++;
|
||||
m_scsi_dma.m_length--;
|
||||
if (m_scsi_dma.m_length == 0)
|
||||
{
|
||||
if (m_scsi_dma.m_end)
|
||||
if (BIT(m_scsi_dma.m_addr, 31))
|
||||
{
|
||||
LOGMASKED(LOG_SCSI_DMA, "HPC: Disabling SCSI DMA due to end of chain\n");
|
||||
m_scsi_dma.m_active = false;
|
||||
m_scsi_dma.m_ctrl &= ~HPC_DMACTRL_ENABLE;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scsi_dma.m_desc = m_scsi_dma.m_next;
|
||||
fetch_chain();
|
||||
}
|
||||
m_scsi_dma.m_desc = m_scsi_dma.m_next & 0x0fffffff;
|
||||
fetch_chain();
|
||||
}
|
||||
}
|
||||
|
||||
void hpc1_device::scsi_dma()
|
||||
WRITE_LINE_MEMBER(hpc1_device::scsi_drq)
|
||||
{
|
||||
int byte_count = m_wd33c93->get_dma_count();
|
||||
m_scsi_dma.m_drq = state;
|
||||
|
||||
LOGMASKED(LOG_SCSI_DMA, "HPC: Transferring %d bytes %s %08x %s SCSI0\n",
|
||||
byte_count, m_scsi_dma.m_to_mem ? "to" : "from", m_scsi_dma.m_addr, m_scsi_dma.m_to_mem ? "from" : "to");
|
||||
if (m_scsi_dma.m_drq && m_scsi_dma.m_active)
|
||||
{
|
||||
do_scsi_dma();
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t dma_buffer[512];
|
||||
if (m_scsi_dma.m_to_mem)
|
||||
{
|
||||
// HPC SCSI DMA: device to host
|
||||
if (byte_count <= 512)
|
||||
{
|
||||
m_wd33c93->dma_read_data(byte_count, dma_buffer);
|
||||
|
||||
for (int i = 0; i < byte_count; i++)
|
||||
{
|
||||
LOGMASKED(LOG_SCSI_DMA, "HPC: Reading %02x to %08x\n", dma_buffer[i], m_scsi_dma.m_addr);
|
||||
m_cpu_space->write_byte(m_scsi_dma.m_addr, dma_buffer[i]);
|
||||
advance_chain();
|
||||
if (!m_scsi_dma.m_active)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (byte_count)
|
||||
{
|
||||
int sub_count = m_wd33c93->dma_read_data(512, dma_buffer);
|
||||
|
||||
for (int i = 0; i < sub_count; i++)
|
||||
{
|
||||
LOGMASKED(LOG_SCSI_DMA, "HPC: Reading %02x to %08x\n", dma_buffer[i], m_scsi_dma.m_addr);
|
||||
m_cpu_space->write_byte(m_scsi_dma.m_addr, dma_buffer[i]);
|
||||
advance_chain();
|
||||
if (!m_scsi_dma.m_active)
|
||||
break;
|
||||
}
|
||||
|
||||
byte_count -= sub_count;
|
||||
if (!m_scsi_dma.m_active)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void hpc1_device::do_scsi_dma()
|
||||
{
|
||||
if (m_scsi_dma.m_to_mem)
|
||||
m_cpu_space->write_byte(m_scsi_dma.m_addr & 0x0fffffff, m_wd33c93->dma_r());
|
||||
else
|
||||
m_wd33c93->dma_w(m_cpu_space->read_byte(m_scsi_dma.m_addr & 0x0fffffff));
|
||||
|
||||
m_scsi_dma.m_addr++;
|
||||
decrement_chain();
|
||||
|
||||
if (!m_scsi_dma.m_active)
|
||||
{
|
||||
// HPC SCSI DMA: host to device
|
||||
if (byte_count <= 512)
|
||||
{
|
||||
for (int i = 0; i < byte_count; i++)
|
||||
{
|
||||
dma_buffer[i] = m_cpu_space->read_byte(m_scsi_dma.m_addr);
|
||||
LOGMASKED(LOG_SCSI_DMA, "HPC: Writing %02x from %08x\n", dma_buffer[i], m_scsi_dma.m_addr);
|
||||
advance_chain();
|
||||
if (!m_scsi_dma.m_active)
|
||||
break;
|
||||
}
|
||||
|
||||
m_wd33c93->dma_write_data(byte_count, dma_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (byte_count)
|
||||
{
|
||||
int sub_count = std::min(512, byte_count);
|
||||
|
||||
for (int i = 0; i < sub_count; i++)
|
||||
{
|
||||
dma_buffer[i] = m_cpu_space->read_byte(m_scsi_dma.m_addr);
|
||||
LOGMASKED(LOG_SCSI_DMA, "HPC: Writing %02x from %08x\n", dma_buffer[i], m_scsi_dma.m_addr);
|
||||
advance_chain();
|
||||
if (!m_scsi_dma.m_active)
|
||||
break;
|
||||
}
|
||||
|
||||
m_wd33c93->dma_write_data(sub_count, dma_buffer);
|
||||
|
||||
if (!m_scsi_dma.m_active)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte_count -= sub_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
// clear HPC3 DMA active flag
|
||||
m_scsi_dma.m_ctrl &= ~HPC_DMACTRL_ENABLE;
|
||||
}
|
||||
|
||||
// clear DMA on the controller
|
||||
m_wd33c93->clear_dma();
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@ -710,11 +670,6 @@ WRITE_LINE_MEMBER(hpc1_device::scsi_irq)
|
||||
if (state)
|
||||
{
|
||||
LOGMASKED(LOG_SCSI, "SCSI: Set IRQ\n");
|
||||
int count = m_wd33c93->get_dma_count();
|
||||
LOGMASKED(LOG_SCSI_DMA, "SCSI: count %d, active %d\n", count, m_scsi_dma.m_active);
|
||||
if (count && m_scsi_dma.m_active)
|
||||
scsi_dma();
|
||||
|
||||
raise_local_irq(0, LOCAL0_SCSI);
|
||||
}
|
||||
else
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "machine/dp8573.h"
|
||||
#include "machine/eepromser.h"
|
||||
#include "machine/pit8253.h"
|
||||
#include "machine/wd33c93.h"
|
||||
#include "machine/wd33c9x.h"
|
||||
#include "machine/z80scc.h"
|
||||
|
||||
class hpc1_device : public device_t
|
||||
@ -39,6 +39,7 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(scsi_irq);
|
||||
DECLARE_WRITE_LINE_MEMBER(scsi_drq);
|
||||
|
||||
void set_timer_int_clear(uint32_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER(timer0_int);
|
||||
@ -53,13 +54,15 @@ protected:
|
||||
void lower_local_irq(int channel, uint8_t source_mask);
|
||||
void update_irq(int channel);
|
||||
|
||||
void do_scsi_dma();
|
||||
|
||||
void dump_chain(uint32_t base);
|
||||
void fetch_chain();
|
||||
void advance_chain();
|
||||
void scsi_dma();
|
||||
void decrement_chain();
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<eeprom_serial_93cxx_device> m_eeprom;
|
||||
required_device<wd33c93_device> m_wd33c93;
|
||||
required_device<wd33c93n_device> m_wd33c93;
|
||||
required_device_array<scc85c30_device, 3> m_scc;
|
||||
required_device<pit8254_device> m_pit;
|
||||
required_device<dp8573_device> m_rtc;
|
||||
@ -94,18 +97,20 @@ protected:
|
||||
struct scsi_dma_t
|
||||
{
|
||||
uint32_t m_desc;
|
||||
uint32_t m_ctrl;
|
||||
uint32_t m_addr;
|
||||
uint32_t m_flag;
|
||||
uint32_t m_ctrl;
|
||||
uint32_t m_length;
|
||||
uint32_t m_next;
|
||||
uint16_t m_length;
|
||||
bool m_irq;
|
||||
bool m_drq;
|
||||
bool m_to_mem;
|
||||
bool m_active;
|
||||
bool m_end;
|
||||
};
|
||||
|
||||
static void cdrom_config(device_t *device);
|
||||
static void scsi_devices(device_slot_interface &device);
|
||||
static void indigo_mice(device_slot_interface &device);
|
||||
void wd33c93(device_t *device);
|
||||
|
||||
uint8_t m_misc_status;
|
||||
uint32_t m_cpu_aux_ctrl;
|
||||
|
@ -303,7 +303,7 @@ READ32_MEMBER(hpc3_device::hd_r)
|
||||
case 0x4000/4:
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
const uint8_t ret = index ? m_wd33c93_2->indir_r(space, 0) : m_wd33c93->indir_r(space, 0);
|
||||
const uint8_t ret = index ? m_wd33c93_2->indir_addr_r() : m_wd33c93->indir_addr_r();
|
||||
LOGMASKED(LOG_SCSI, "%s: SCSI%d Read 0: %02x\n", machine().describe_context(), index, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -312,7 +312,7 @@ READ32_MEMBER(hpc3_device::hd_r)
|
||||
case 0x4004/4:
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
const uint8_t ret = index ? m_wd33c93_2->indir_r(space, 1) : m_wd33c93->indir_r(space, 1);
|
||||
const uint8_t ret = index ? m_wd33c93_2->indir_reg_r() : m_wd33c93->indir_reg_r();
|
||||
LOGMASKED(LOG_SCSI, "%s: SCSI%d Read 1: %02x\n", machine().describe_context(), index, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -337,14 +337,14 @@ WRITE32_MEMBER(hpc3_device::hd_w)
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
LOGMASKED(LOG_SCSI, "%s: SCSI%d Write 0 = %02x\n", machine().describe_context(), index, (uint8_t)data);
|
||||
index ? m_wd33c93_2->indir_w(space, 0, data & 0xff) : m_wd33c93->indir_w(space, 0, data & 0xff);
|
||||
index ? m_wd33c93_2->indir_addr_w(data & 0xff) : m_wd33c93->indir_addr_w(data & 0xff);
|
||||
}
|
||||
break;
|
||||
case 0x0001:
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
LOGMASKED(LOG_SCSI, "%s: SCSI%d Write 1 = %02x\n", machine().describe_context(), index, (uint8_t)data);
|
||||
index ? m_wd33c93_2->indir_w(space, 1, data & 0xff) : m_wd33c93->indir_w(space, 1, data & 0xff);
|
||||
index ? m_wd33c93_2->indir_reg_w(data & 0xff) : m_wd33c93->indir_reg_w(data & 0xff);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user