Uncrappify voodoo pci devices transfert. Fix some paths on midwayic. (nw)

This commit is contained in:
Olivier Galibert 2018-05-22 22:45:03 +02:00
parent d07b223f14
commit fdf0c866e2
6 changed files with 34 additions and 27 deletions

View File

@ -1468,8 +1468,8 @@ public:
void set_fbmem(int value) { m_fbmem = value; }
void set_tmumem(int value1, int value2) { m_tmumem0 = value1; m_tmumem1 = value2; }
void set_screen_tag(const char *tag) { m_screen.set_tag(tag); }
void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); }
template <typename T> void set_screen_tag(T &&tag) { m_screen.set_tag(std::forward<T>(tag)); }
template <typename T> void set_cpu_tag(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); }
template <class Object> devcb_base &set_vblank_callback(Object &&cb) { return m_vblank.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_stall_callback(Object &&cb) { return m_stall.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_pciint_callback(Object &&cb) { return m_pciint.set_callback(std::forward<Object>(cb)); }

View File

@ -14,24 +14,20 @@ MACHINE_CONFIG_START(voodoo_pci_device::device_add_mconfig)
MCFG_DEVICE_ADD("voodoo", VOODOO_1, STD_VOODOO_1_CLOCK)
MCFG_VOODOO_FBMEM(4)
MCFG_VOODOO_TMUMEM(1, 0)
MCFG_VOODOO_SCREEN_TAG("screen")
break;
case TYPE_VOODOO_2:
MCFG_DEVICE_ADD("voodoo", VOODOO_2, STD_VOODOO_2_CLOCK)
MCFG_VOODOO_FBMEM(4)
MCFG_VOODOO_TMUMEM(1, 0)
MCFG_VOODOO_SCREEN_TAG("screen")
break;
case TYPE_VOODOO_BANSHEE:
MCFG_DEVICE_ADD("voodoo", VOODOO_BANSHEE, STD_VOODOO_BANSHEE_CLOCK)
MCFG_VOODOO_FBMEM(16)
MCFG_VOODOO_SCREEN_TAG("screen")
break;
//case TYPE_VOODOO_3
default:
MCFG_DEVICE_ADD("voodoo", VOODOO_3, STD_VOODOO_3_CLOCK)
MCFG_VOODOO_FBMEM(16)
MCFG_VOODOO_SCREEN_TAG("screen")
break;}
MACHINE_CONFIG_END
@ -67,18 +63,14 @@ void voodoo_pci_device::io_map(address_map &map)
voodoo_pci_device::voodoo_pci_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: pci_device(mconfig, VOODOO_PCI, tag, owner, clock),
m_voodoo(*this, "voodoo"), m_fbmem(2), m_tmumem0(0), m_tmumem1(0)
m_voodoo(*this, "voodoo"), m_cpu(*this, finder_base::DUMMY_TAG), m_screen(*this, finder_base::DUMMY_TAG), m_fbmem(2), m_tmumem0(0), m_tmumem1(0)
{
}
void voodoo_pci_device::set_cpu_tag(const char *_cpu_tag)
{
m_cpu_tag = _cpu_tag;
}
void voodoo_pci_device::device_start()
{
m_voodoo->set_cpu_tag(m_cpu_tag);
m_voodoo->set_cpu_tag(m_cpu);
m_voodoo->set_screen_tag(m_screen);
m_voodoo->set_fbmem(m_fbmem);
m_voodoo->set_tmumem(m_tmumem0, m_tmumem1);
switch (m_type) {

View File

@ -10,10 +10,11 @@
#include "machine/pci.h"
#include "voodoo.h"
#define MCFG_VOODOO_PCI_ADD(_tag, _type, _cpu_tag) \
#define MCFG_VOODOO_PCI_ADD(_tag, _type, _cpu_tag, _screen_tag) \
voodoo_pci_device::set_type(_type); \
MCFG_PCI_DEVICE_ADD(_tag, VOODOO_PCI, 0, 0, 0, 0) \
downcast<voodoo_pci_device *>(device)->set_cpu_tag(_cpu_tag);
downcast<voodoo_pci_device *>(device)->set_cpu_tag(_cpu_tag); \
downcast<voodoo_pci_device *>(device)->set_screen_tag(_screen_tag);
#define MCFG_VOODOO_PCI_FBMEM(_value) \
downcast<voodoo_pci_device *>(device)->set_fbmem(_value);
@ -31,7 +32,8 @@ public:
virtual void config_map(address_map &map) override;
void postload(void);
void set_cpu_tag(const char *tag);
template <typename T> void set_cpu_tag(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); }
template <typename T> void set_screen_tag(T &&tag) { m_screen.set_tag(std::forward<T>(tag)); }
static void set_type(const int type) {m_type = type;}
void set_fbmem(const int fbmem) {m_fbmem = fbmem;}
void set_tmumem(const int tmumem0, const int tmumem1) {m_tmumem0 = tmumem0; m_tmumem1 = tmumem1;}
@ -46,9 +48,10 @@ protected:
private:
required_device<voodoo_device> m_voodoo;
optional_device<cpu_device> m_cpu;
optional_device<screen_device> m_screen;
static int m_type; // FIXME: all voodoo have to be the same? really?
int m_fbmem, m_tmumem0, m_tmumem1;
const char *m_cpu_tag;
uint32_t m_pcictrl_reg[0x20];
void voodoo_reg_map(address_map &map);

View File

@ -303,7 +303,8 @@ public:
/// \brief Set search tag
///
/// Allows search tag to be changed after construction. Note that
/// this must be done before resolution time to take effect.
/// this must be done before resolution time to take effect unless
/// handled in the specialization.
/// \param [in] finder Object finder to take the search base and tag
/// from.
void set_tag(finder_base const &finder)
@ -473,6 +474,15 @@ public:
/// \return Pointer to target object if found, or nullptr otherwise.
virtual ObjectClass *operator->() const { assert(m_target); return m_target; }
/// \brief Set search tag
///
/// Allows search tag to be changed after construction.
/// \param [in] finder Object finder to take the search base and tag
/// from.
void set_tag(object_finder_base const &finder) { finder_base::set_tag(finder); m_target = finder.m_target; }
using finder_base::set_tag;
protected:
/// \brief Designated constructor
///

View File

@ -278,6 +278,7 @@ public:
m_maincpu(*this, "maincpu"),
m_cage(*this, "cage"),
m_dcs(*this, "dcs"),
m_screen(*this, "screen"),
m_ethernet(*this, "ethernet"),
m_ioasic(*this, "ioasic"),
m_io_analog(*this, "AN%u", 0),
@ -289,6 +290,7 @@ public:
required_device<mips3_device> m_maincpu;
optional_device<atari_cage_seattle_device> m_cage;
optional_device<dcs_audio_device> m_dcs;
required_device<screen_device> m_screen;
optional_device<smc91c94_device> m_ethernet;
required_device<midway_ioasic_device> m_ioasic;
optional_ioport_array<8> m_io_analog;
@ -1871,7 +1873,7 @@ INPUT_PORTS_END
MACHINE_CONFIG_START(seattle_state::seattle_common)
/* basic machine hardware */
MCFG_DEVICE_ADD("maincpu", R5000LE, SYSTEM_CLOCK*3)
MCFG_DEVICE_ADD(m_maincpu, R5000LE, SYSTEM_CLOCK*3)
MCFG_MIPS3_ICACHE_SIZE(16384)
MCFG_MIPS3_DCACHE_SIZE(16384)
MCFG_MIPS3_SYSTEM_CLOCK(SYSTEM_CLOCK)
@ -1890,7 +1892,7 @@ MACHINE_CONFIG_START(seattle_state::seattle_common)
MCFG_IDE_PCI_IRQ_ADD(":maincpu", IDE_IRQ_NUM)
MCFG_IDE_PCI_SET_LEGACY_TOP(0x0a0)
MCFG_VOODOO_PCI_ADD(PCI_ID_VIDEO, TYPE_VOODOO_1, ":maincpu")
MCFG_VOODOO_PCI_ADD(PCI_ID_VIDEO, TYPE_VOODOO_1, m_maincpu, m_screen)
MCFG_VOODOO_PCI_FBMEM(2)
MCFG_VOODOO_PCI_TMUMEM(4, 0)
MCFG_DEVICE_MODIFY(PCI_ID_VIDEO":voodoo")
@ -1901,7 +1903,7 @@ MACHINE_CONFIG_START(seattle_state::seattle_common)
MCFG_NVRAM_ADD_1FILL("nvram")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_ADD(m_screen, RASTER)
MCFG_SCREEN_REFRESH_RATE(57)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479)
@ -1912,7 +1914,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(seattle_state::phoenixsa)
seattle_common(config);
MCFG_DEVICE_REPLACE("maincpu", R4700LE, SYSTEM_CLOCK*2)
MCFG_DEVICE_REPLACE(m_maincpu, R4700LE, SYSTEM_CLOCK*2)
MCFG_MIPS3_ICACHE_SIZE(16384)
MCFG_MIPS3_DCACHE_SIZE(16384)
MCFG_MIPS3_SYSTEM_CLOCK(SYSTEM_CLOCK)
@ -1925,7 +1927,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(seattle_state::seattle150)
seattle_common(config);
MCFG_DEVICE_REPLACE("maincpu", R5000LE, SYSTEM_CLOCK*3)
MCFG_DEVICE_REPLACE(m_maincpu, R5000LE, SYSTEM_CLOCK*3)
MCFG_MIPS3_ICACHE_SIZE(16384)
MCFG_MIPS3_DCACHE_SIZE(16384)
MCFG_MIPS3_SYSTEM_CLOCK(SYSTEM_CLOCK)
@ -1941,7 +1943,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(seattle_state::seattle200)
seattle_common(config);
MCFG_DEVICE_REPLACE("maincpu", R5000LE, SYSTEM_CLOCK*4)
MCFG_DEVICE_REPLACE(m_maincpu, R5000LE, SYSTEM_CLOCK*4)
MCFG_MIPS3_ICACHE_SIZE(16384)
MCFG_MIPS3_DCACHE_SIZE(16384)
MCFG_MIPS3_SYSTEM_CLOCK(SYSTEM_CLOCK)
@ -1956,7 +1958,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(seattle_state::flagstaff)
seattle_common(config);
MCFG_DEVICE_REPLACE("maincpu", R5000LE, SYSTEM_CLOCK*4)
MCFG_DEVICE_REPLACE(m_maincpu, R5000LE, SYSTEM_CLOCK*4)
MCFG_MIPS3_ICACHE_SIZE(16384)
MCFG_MIPS3_DCACHE_SIZE(16384)
MCFG_MIPS3_SYSTEM_CLOCK(SYSTEM_CLOCK)

View File

@ -662,8 +662,8 @@ midway_ioasic_device::midway_ioasic_device(const machine_config &mconfig, const
m_fifo_out(0),
m_fifo_bytes(0),
m_fifo_force_buffer_empty_pc(0),
m_cage(*this, "cage"),
m_dcs(*this, "dcs")
m_cage(*this, ":cage"),
m_dcs(*this, ":dcs")
{
memset(m_fifo,0,sizeof(m_fifo));
memset(m_reg,0,sizeof(m_reg));