From 43352d46b1d07a6db792c76f4be37211c50ec7aa Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sun, 14 Jan 2024 15:08:25 +0100 Subject: pci: correct upcalls, add ymp21 and ds2416 skeletons --- scripts/src/bus.lua | 4 ++++ src/devices/bus/pci/ds2416.cpp | 23 ++++++++++++++++++++++ src/devices/bus/pci/ds2416.h | 22 +++++++++++++++++++++ src/devices/bus/pci/geforce.cpp | 2 +- src/devices/bus/pci/mga2064w.cpp | 6 +++--- src/devices/bus/pci/pci_slot.cpp | 4 ++++ src/devices/bus/pci/riva128.cpp | 6 +++--- src/devices/bus/pci/rivatnt.cpp | 4 ++-- src/devices/bus/pci/sw1000xg.cpp | 25 +++--------------------- src/devices/bus/pci/sw1000xg.h | 10 ++-------- src/devices/bus/pci/virge_pci.cpp | 6 +++--- src/devices/bus/pci/ymp21.cpp | 40 +++++++++++++++++++++++++++++++++++++++ src/devices/bus/pci/ymp21.h | 27 ++++++++++++++++++++++++++ 13 files changed, 137 insertions(+), 42 deletions(-) create mode 100644 src/devices/bus/pci/ds2416.cpp create mode 100644 src/devices/bus/pci/ds2416.h create mode 100644 src/devices/bus/pci/ymp21.cpp create mode 100644 src/devices/bus/pci/ymp21.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 8b2be21d695..13d50f2e0e2 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -5432,7 +5432,11 @@ if (BUSES["PCI"]~=null) then MAME_DIR .. "src/devices/bus/pci/mga2064w.h", MAME_DIR .. "src/devices/bus/pci/promotion.cpp", MAME_DIR .. "src/devices/bus/pci/promotion.h", + MAME_DIR .. "src/devices/bus/pci/ymp21.cpp", + MAME_DIR .. "src/devices/bus/pci/ymp21.h", MAME_DIR .. "src/devices/bus/pci/sw1000xg.cpp", MAME_DIR .. "src/devices/bus/pci/sw1000xg.h", + MAME_DIR .. "src/devices/bus/pci/ds2416.cpp", + MAME_DIR .. "src/devices/bus/pci/ds2416.h", } end diff --git a/src/devices/bus/pci/ds2416.cpp b/src/devices/bus/pci/ds2416.cpp new file mode 100644 index 00000000000..ad050d22a4c --- /dev/null +++ b/src/devices/bus/pci/ds2416.cpp @@ -0,0 +1,23 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +#include "emu.h" +#include "ds2416.h" + +DEFINE_DEVICE_TYPE(DS2416, ds2416_device, "ds2416", "Yamaha DS2416") + +ds2416_device::ds2416_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : ymp21_device(mconfig, DS2416, tag, owner, clock) +{ + set_ids(0x10732000, 0x00, 0x040100, 0x10732000); +} + +void ds2416_device::device_start() +{ + ymp21_device::device_start(); +} + +void ds2416_device::device_reset() +{ + ymp21_device::device_reset(); +} diff --git a/src/devices/bus/pci/ds2416.h b/src/devices/bus/pci/ds2416.h new file mode 100644 index 00000000000..68e09b7d2fa --- /dev/null +++ b/src/devices/bus/pci/ds2416.h @@ -0,0 +1,22 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +#ifndef MAME_SOUND_DS2416_H +#define MAME_SOUND_DS2416_H + +#pragma once + +#include "ymp21.h" + +class ds2416_device : public ymp21_device { +public: + ds2416_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + +protected: + virtual void device_start() override; + virtual void device_reset() override; +}; + +DECLARE_DEVICE_TYPE(DS2416, ds2416_device) + +#endif diff --git a/src/devices/bus/pci/geforce.cpp b/src/devices/bus/pci/geforce.cpp index d420d881547..7ebe882ede4 100644 --- a/src/devices/bus/pci/geforce.cpp +++ b/src/devices/bus/pci/geforce.cpp @@ -50,7 +50,7 @@ const tiny_rom_entry *geforce256_device::device_rom_region() const void geforce256_device::device_start() { - pci_device::device_start(); + pci_card_device::device_start(); add_map( 16*1024*1024, M_MEM, FUNC(geforce256_device::mmio_map)); add_map(128*1024*1024, M_MEM, FUNC(geforce256_device::vram_aperture_map)); diff --git a/src/devices/bus/pci/mga2064w.cpp b/src/devices/bus/pci/mga2064w.cpp index ce64c216ba0..835fc7b5406 100644 --- a/src/devices/bus/pci/mga2064w.cpp +++ b/src/devices/bus/pci/mga2064w.cpp @@ -63,7 +63,7 @@ void mga2064w_device::device_add_mconfig(machine_config &config) void mga2064w_device::device_start() { - pci_device::device_start(); + pci_card_device::device_start(); // NB: following is swapped on G400 add_map( 16*1024, M_MEM, FUNC(mga2064w_device::mgabase1_map)); add_map(8*1024*1024, M_MEM, FUNC(mga2064w_device::mgabase2_map)); @@ -74,7 +74,7 @@ void mga2064w_device::device_start() void mga2064w_device::device_reset() { - pci_device::device_reset(); + pci_card_device::device_reset(); // INTA# intr_pin = 1; @@ -91,7 +91,7 @@ device_memory_interface::space_config_vector mga2064w_device::memory_space_confi void mga2064w_device::config_map(address_map &map) { - pci_device::config_map(map); + pci_card_device::config_map(map); // map(0x40, 0x43) OPTION map(0x44, 0x47).rw(FUNC(mga2064w_device::mga_index_r), FUNC(mga2064w_device::mga_index_w)); map(0x48, 0x4b).rw(FUNC(mga2064w_device::mga_data_r), FUNC(mga2064w_device::mga_data_w)); diff --git a/src/devices/bus/pci/pci_slot.cpp b/src/devices/bus/pci/pci_slot.cpp index 78251aa6213..b726442f426 100644 --- a/src/devices/bus/pci/pci_slot.cpp +++ b/src/devices/bus/pci/pci_slot.cpp @@ -11,6 +11,7 @@ #include "geforce.h" #include "mga2064w.h" #include "promotion.h" +#include "ds2416.h" #include "sw1000xg.h" DEFINE_DEVICE_TYPE(PCI_SLOT, pci_slot_device, "pci_slot", "PCI extension motherboard port") @@ -84,8 +85,11 @@ void pci_cards(device_slot_interface &device) device.option_add("quadro", QUADRO); device.option_add("mga2064w", MGA2064W); device.option_add("promotion3210", PROMOTION3210); + // 0x04 - multimedia controllers device.option_add("sw1000xg", SW1000XG); + device.option_add("ds2416", DS2416); + // 0x05 - memory controllers // 0x06 - bridge devices // 0x07 - simple communication controllers diff --git a/src/devices/bus/pci/riva128.cpp b/src/devices/bus/pci/riva128.cpp index 0fef064e4e8..e1a41a4818a 100644 --- a/src/devices/bus/pci/riva128.cpp +++ b/src/devices/bus/pci/riva128.cpp @@ -78,7 +78,7 @@ void riva128_device::device_add_mconfig(machine_config &config) void riva128_device::device_start() { - pci_device::device_start(); + pci_card_device::device_start(); add_map( 16*1024*1024, M_MEM, FUNC(riva128_device::mmio_map)); add_map(128*1024*1024, M_MEM, FUNC(riva128_device::vram_aperture_map)); @@ -96,7 +96,7 @@ void riva128_device::device_start() void riva128_device::device_reset() { - pci_device::device_reset(); + pci_card_device::device_reset(); // TODO: to be checked command = 0x0000; @@ -110,7 +110,7 @@ void riva128_device::device_reset() // TODO: counter-check everything void riva128_device::config_map(address_map &map) { - pci_device::config_map(map); + pci_card_device::config_map(map); map(0x34, 0x34).lr8(NAME([] () { return 0x44; })); // map(0x40, 0x43) subsystem ID alias (writeable) diff --git a/src/devices/bus/pci/rivatnt.cpp b/src/devices/bus/pci/rivatnt.cpp index 2b24f969d5a..5eca413fa4e 100644 --- a/src/devices/bus/pci/rivatnt.cpp +++ b/src/devices/bus/pci/rivatnt.cpp @@ -71,7 +71,7 @@ const tiny_rom_entry *rivatnt_device::device_rom_region() const // NV4 removes the indirect_io_map from NV3 void rivatnt_device::device_start() { - pci_device::device_start(); + pci_card_device::device_start(); add_map( 16*1024*1024, M_MEM, FUNC(rivatnt_device::mmio_map)); add_map(128*1024*1024, M_MEM, FUNC(rivatnt_device::vram_aperture_map)); @@ -119,7 +119,7 @@ const tiny_rom_entry *rivatnt2_device::device_rom_region() const // All NV5 definitely wants 64K ROM BIOS (would fail CRC checks) void rivatnt2_device::device_start() { - pci_device::device_start(); + pci_card_device::device_start(); add_map( 16*1024*1024, M_MEM, FUNC(rivatnt2_device::mmio_map)); add_map(128*1024*1024, M_MEM, FUNC(rivatnt2_device::vram_aperture_map)); diff --git a/src/devices/bus/pci/sw1000xg.cpp b/src/devices/bus/pci/sw1000xg.cpp index ea724d14aec..9d426ac2a43 100644 --- a/src/devices/bus/pci/sw1000xg.cpp +++ b/src/devices/bus/pci/sw1000xg.cpp @@ -7,36 +7,17 @@ DEFINE_DEVICE_TYPE(SW1000XG, sw1000xg_device, "sw1000xg", "Yamaha SW1000XG") sw1000xg_device::sw1000xg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : pci_card_device(mconfig, SW1000XG, tag, owner, clock) + : ymp21_device(mconfig, SW1000XG, tag, owner, clock) { set_ids(0x10731000, 0x00, 0x040100, 0x10731000); } void sw1000xg_device::device_start() { - pci_device::device_start(); - add_map(0x40000, M_MEM, FUNC(sw1000xg_device::map)); - intr_pin = 0x01; + ymp21_device::device_start(); } void sw1000xg_device::device_reset() { + ymp21_device::device_reset(); } - -void sw1000xg_device::map(address_map &map) -{ - map(0x00000, 0x3ffff).rw(FUNC(sw1000xg_device::read), FUNC(sw1000xg_device::write)); -} - -u32 sw1000xg_device::read(offs_t offset, u32 mem_mask) -{ - logerror("ym read %05x %08x\n", offset*4, mem_mask); - return 0; -} - -void sw1000xg_device::write(offs_t offset, u32 data, u32 mem_mask) -{ - logerror("ym write %05x, %08x %08x\n", offset*4, data, mem_mask); -} - - diff --git a/src/devices/bus/pci/sw1000xg.h b/src/devices/bus/pci/sw1000xg.h index a09944ace0f..b786ebc3439 100644 --- a/src/devices/bus/pci/sw1000xg.h +++ b/src/devices/bus/pci/sw1000xg.h @@ -6,21 +6,15 @@ #pragma once -#include "pci_slot.h" +#include "ymp21.h" -class sw1000xg_device : public pci_card_device { +class sw1000xg_device : public ymp21_device { public: sw1000xg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); protected: virtual void device_start() override; virtual void device_reset() override; - -private: - void map(address_map &map); - - u32 read(offs_t offset, u32 mem_mask); - void write(offs_t offset, u32 data, u32 mem_mask); }; DECLARE_DEVICE_TYPE(SW1000XG, sw1000xg_device) diff --git a/src/devices/bus/pci/virge_pci.cpp b/src/devices/bus/pci/virge_pci.cpp index b38090603f3..0222602e81b 100644 --- a/src/devices/bus/pci/virge_pci.cpp +++ b/src/devices/bus/pci/virge_pci.cpp @@ -61,7 +61,7 @@ void virge_pci_device::lfb_map(address_map& map) void virge_pci_device::config_map(address_map &map) { - pci_device::config_map(map); + pci_card_device::config_map(map); map(0x10, 0x13).rw(FUNC(virge_pci_device::base_address_r),FUNC(virge_pci_device::base_address_w)); } @@ -141,7 +141,7 @@ void virge_pci_device::postload() void virge_pci_device::device_start() { set_ids(0x53335631, 0x00, 0x030000, 0x000000); - pci_device::device_start(); + pci_card_device::device_start(); add_rom(m_bios->base(),0x8000); expansion_rom_base = 0xc0000; @@ -157,7 +157,7 @@ void virge_pci_device::device_start() void virgedx_pci_device::device_start() { set_ids(0x53338a01, 0x00, 0x030000, 0x000000); - pci_device::device_start(); + pci_card_device::device_start(); add_rom(m_bios->base(),0x8000); expansion_rom_base = 0xc0000; diff --git a/src/devices/bus/pci/ymp21.cpp b/src/devices/bus/pci/ymp21.cpp new file mode 100644 index 00000000000..41a20cfb35f --- /dev/null +++ b/src/devices/bus/pci/ymp21.cpp @@ -0,0 +1,40 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +#include "emu.h" +#include "ymp21.h" + +ymp21_device::ymp21_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : pci_card_device(mconfig, type, tag, owner, clock) +{ +} + +void ymp21_device::device_start() +{ + pci_card_device::device_start(); + add_map(0x40000, M_MEM, FUNC(ymp21_device::map)); + intr_pin = 0x01; +} + +void ymp21_device::device_reset() +{ + pci_card_device::device_reset(); +} + +void ymp21_device::map(address_map &map) +{ + map(0x00000, 0x3ffff).rw(FUNC(ymp21_device::read), FUNC(ymp21_device::write)); +} + +u32 ymp21_device::read(offs_t offset, u32 mem_mask) +{ + logerror("ym read %05x %08x\n", offset*4, mem_mask); + return 0; +} + +void ymp21_device::write(offs_t offset, u32 data, u32 mem_mask) +{ + logerror("ym write %05x, %08x %08x\n", offset*4, data, mem_mask); +} + + diff --git a/src/devices/bus/pci/ymp21.h b/src/devices/bus/pci/ymp21.h new file mode 100644 index 00000000000..4bbf9a9e812 --- /dev/null +++ b/src/devices/bus/pci/ymp21.h @@ -0,0 +1,27 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// PCI interfacing gate array common to the sw1000xg and the ds2416 + +#ifndef MAME_SOUND_YMP21_H +#define MAME_SOUND_YMP21_H + +#pragma once + +#include "pci_slot.h" + +class ymp21_device : public pci_card_device { +protected: + ymp21_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock = 0); + + virtual void device_start() override; + virtual void device_reset() override; + +private: + void map(address_map &map); + + u32 read(offs_t offset, u32 mem_mask); + void write(offs_t offset, u32 data, u32 mem_mask); +}; + +#endif -- cgit v1.2.3