diff options
author | 2016-05-29 17:26:59 -0600 | |
---|---|---|
committer | 2016-05-29 17:31:29 -0600 | |
commit | 585cfd07121c315b476bb0581431248fe786f513 (patch) | |
tree | a9c79c313289769653ee449234124bcae1449f2e /src/devices/machine/pci9050.cpp | |
parent | 9520558af1383f95147907cb648e5084d6c8141e (diff) |
(nw) WIP: Updated atlantis driver.
Diffstat (limited to 'src/devices/machine/pci9050.cpp')
-rw-r--r-- | src/devices/machine/pci9050.cpp | 74 |
1 files changed, 57 insertions, 17 deletions
diff --git a/src/devices/machine/pci9050.cpp b/src/devices/machine/pci9050.cpp index 6e74a19e284..718a64e0fa1 100644 --- a/src/devices/machine/pci9050.cpp +++ b/src/devices/machine/pci9050.cpp @@ -41,7 +41,8 @@ DEVICE_ADDRESS_MAP_START(empty, 32, pci9050_device) ADDRESS_MAP_END pci9050_device::pci9050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : pci_device(mconfig, PCI9050, "PLX PCI9050 PCI to Local Bus Bridge", tag, owner, clock, "pci9050", __FILE__) + : pci_device(mconfig, PCI9050, "PLX PCI9050 PCI to Local Bus Bridge", tag, owner, clock, "pci9050", __FILE__), + m_user_input_handler(*this), m_user_output_handler(*this) { for(int i=0; i<4; i++) { m_devices[i] = nullptr; @@ -68,8 +69,8 @@ void pci9050_device::device_start() pci_device::device_start(); - add_map(0x100, M_MEM, FUNC(pci9050_device::map)); // map 0 is our config registers, mem space - add_map(0x100, M_IO, FUNC(pci9050_device::map)); // map 1 is our config registers, i/o space + add_map(0x80, M_MEM, FUNC(pci9050_device::map)); // map 0 is our config registers, mem space + add_map(0x80, M_IO, FUNC(pci9050_device::map)); // map 1 is our config registers, i/o space for(int i=0; i<4; i++) if(m_names[i]) @@ -77,6 +78,9 @@ void pci9050_device::device_start() add_map(0, M_MEM | M_DISABLED, trampolines[i], m_names[i]); else add_map(0, M_MEM | M_DISABLED, FUNC(pci9050_device::empty)); + + m_user_input_handler.resolve(); + m_user_output_handler.resolve(); } void pci9050_device::device_config_complete() @@ -106,7 +110,7 @@ void pci9050_device::remap_local(int id) { UINT32 csbase = m_csbase[id]; UINT32 lasrr = m_lasrr[id]; - logerror("%d csbase=%08x lasrr=%08x\n", id, csbase, lasrr); + logerror("local bus %d csbase=%08x lasrr=%08x\n", id, csbase, lasrr); if(!(csbase & 1)) { set_map_flags(id+2, M_MEM | M_DISABLED); @@ -119,10 +123,11 @@ void pci9050_device::remap_local(int id) return; } int size = 2 << lsize; - if(csbase & 0x0fffffff & ~(size-1)) { - logerror("PCI9050 local bus %d disabled due to unimplemented post-decode remapping\n", id); - // set_map_flags(id+2, M_MEM | M_DISABLED); - // return; + // Address map is directly connected to PCI address space so post-decode mapping is not needed. (Ted Green) + if(0 & csbase & 0x0fffffff & ~(size-1)) { + logerror("PCI9050 local bus %d size=%08x csbase=%08X disabled due to unimplemented post-decode remapping\n", id, size, csbase); + set_map_flags(id+2, M_MEM | M_DISABLED); + return; } UINT32 mask = ~(size - 1); @@ -143,6 +148,21 @@ void pci9050_device::remap_local(int id) void pci9050_device::remap_rom() { + switch ((m_cntrl >> 12) & 0x3) { + case 0: + case 3: + set_map_flags(0, M_MEM); + set_map_flags(1, M_IO); + break; + case 1: + set_map_flags(0, M_MEM); + set_map_flags(1, M_IO | M_DISABLED); + break; + case 2: + set_map_flags(0, M_MEM | M_DISABLED); + set_map_flags(1, M_IO); + break; + } } READ32_MEMBER (pci9050_device::lasrr_r) @@ -152,7 +172,7 @@ READ32_MEMBER (pci9050_device::lasrr_r) WRITE32_MEMBER(pci9050_device::lasrr_w) { - logerror("%06X:PCI9050 local bus %d range %08x: %s flags %d pf %d addr bits 27-4 %08x\n", space.device().safe_pc(), offset, data, (data & 1) ? "I/O" : "MEM", (data & 6)>>1, (data & 8)>>3, data & 0xfffffff); + logerror("%06X:PCI9050 local bus %d range = %08x: %s flags %d pf %d addr bits 27-4 %08x\n", machine().device("maincpu")->safe_pc(), offset, data, (data & 1) ? "I/O" : "MEM", (data & 6)>>1, (data & 8)>>3, data & 0xfffffff); m_lasrr[offset] = data; remap_local(offset); } @@ -164,7 +184,7 @@ READ32_MEMBER (pci9050_device::eromrr_r) WRITE32_MEMBER(pci9050_device::eromrr_w) { - logerror("%06X:PCI9050 ROM range %08x: addr bits 27-11 %08x\n", space.device().safe_pc(), data, data & 0xfffff800); + logerror("%06X:PCI9050 ROM range = %08x: addr bits 27-11 %08x\n", machine().device("maincpu")->safe_pc(), data, data & 0xfffff800); m_eromrr = data; remap_rom(); } @@ -176,7 +196,7 @@ READ32_MEMBER (pci9050_device::lasba_r) WRITE32_MEMBER(pci9050_device::lasba_w) { - logerror("%06X:PCI9050 local bus %d base %08x: enable %d remap %08x\n", space.device().safe_pc(), offset, data, data&1, data & 0x0ffffffe); + logerror("%06X:PCI9050 local bus %d base = %08x: enable %d remap %08x\n", machine().device("maincpu")->safe_pc(), offset, data, data&1, data & 0x0ffffffe); m_lasba[offset] = data; remap_local(offset); } @@ -188,7 +208,7 @@ READ32_MEMBER (pci9050_device::eromba_r) WRITE32_MEMBER(pci9050_device::eromba_w) { - logerror("%06X:PCI9050 ROM base %08x: remap %08x\n", space.device().safe_pc(), data, data & 0x0ffff800); + logerror("%06X:PCI9050 ROM base = %08x: remap %08x\n", machine().device("maincpu")->safe_pc(), data, data & 0x0ffff800); m_eromba = data; remap_rom(); } @@ -200,7 +220,7 @@ READ32_MEMBER (pci9050_device::lasbrd_r) WRITE32_MEMBER(pci9050_device::lasbrd_w) { - logerror("%06X:PCI9050 local bus %d descriptors %08x: burst %d prefetch %d width %d, endian %s, endian mode %d\n", space.device().safe_pc(), offset, data, data&1, (data >> 5) & 1, (data >> 22) & 3, ((data >> 24) & 1) ? "BE" : "LE", (data >> 25) & 1); + logerror("%06X:PCI9050 local bus %d descriptors = %08x: burst %d prefetch %d width %d, endian %s, endian mode %d\n", machine().device("maincpu")->safe_pc(), offset, data, data&1, (data >> 5) & 1, (data >> 22) & 3, ((data >> 24) & 1) ? "BE" : "LE", (data >> 25) & 1); m_lasbrd[offset] = data; remap_local(offset); } @@ -212,7 +232,7 @@ READ32_MEMBER (pci9050_device::erombrd_r) WRITE32_MEMBER(pci9050_device::erombrd_w) { - logerror("%06X:PCI9050 ROM descriptors %08x: burst %d prefetch %d bits %d, endian %s, endian mode %d\n", space.device().safe_pc(), data, data&1, (data >> 5) & 1, (data >> 22) & 3, ((data >> 24) & 1) ? "BE" : "LE", (data >> 25) & 1); + logerror("%06X:PCI9050 ROM descriptors = %08x: burst %d prefetch %d bits %d, endian %s, endian mode %d\n", machine().device("maincpu")->safe_pc(), data, data&1, (data >> 5) & 1, (data >> 22) & 3, ((data >> 24) & 1) ? "BE" : "LE", (data >> 25) & 1); m_erombrd = data; remap_rom(); } @@ -224,31 +244,51 @@ READ32_MEMBER (pci9050_device::csbase_r) WRITE32_MEMBER(pci9050_device::csbase_w) { - logerror("%06X:PCI9050 chip select %d base %08x: enable %d size %08x\n", space.device().safe_pc(), offset, data, data&1, data&0xfffffffe); + logerror("%06X:PCI9050 chip select %d base = %08x: enable %d size %08x\n", machine().device("maincpu")->safe_pc(), offset, data, data&1, data&0xfffffffe); m_csbase[offset] = data; remap_local(offset); } READ32_MEMBER (pci9050_device::intcsr_r) { + logerror("%06X:PCI9050 IRQ CSR read %08x\n", machine().device("maincpu")->safe_pc(), m_intcsr); return m_intcsr; } WRITE32_MEMBER(pci9050_device::intcsr_w) { - logerror("%06X:PCI9050 IRQ control %08x\n", space.device().safe_pc(), data); + logerror("%06X:PCI9050 IRQ CSR write %08x\n", machine().device("maincpu")->safe_pc(), data); m_intcsr = data; remap_rom(); } READ32_MEMBER (pci9050_device::cntrl_r) { + if (!m_user_input_handler.isnull()) + { + int readData = m_user_input_handler(); + for (int userIndex = 0; userIndex < 4; userIndex++) + if ((m_cntrl & (1 << (1 + userIndex * 3)))==0) + m_cntrl = (m_cntrl & ~(1<<(2 + userIndex * 3))) | (((readData>>userIndex)&1) << (2 + userIndex * 3)); + } + if (0) + logerror("%06X:PCI9050 CNTRL read = %08x\n", machine().device("maincpu")->safe_pc(), m_cntrl); return m_cntrl; } WRITE32_MEMBER(pci9050_device::cntrl_w) { - logerror("%06X:PCI9050 IRQ control %08x\n", space.device().safe_pc(), data); + if (0) + logerror("%06X:PCI9050 CNTRL write %08x\n", machine().device("maincpu")->safe_pc(), data); + UINT32 oldData = m_cntrl; m_cntrl = data; remap_rom(); + if ((oldData ^ m_cntrl) & 0x3000) + remap_cb(); + if (!m_user_output_handler.isnull()) { + int userData = 0; + for (int userIndex = 0; userIndex < 4; userIndex++) + userData |= ((m_cntrl >> (2 + userIndex * 3)) & 1) << userIndex; + m_user_output_handler(userData); + } } |