summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/gt64xxx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/gt64xxx.cpp')
-rw-r--r--src/devices/machine/gt64xxx.cpp79
1 files changed, 51 insertions, 28 deletions
diff --git a/src/devices/machine/gt64xxx.cpp b/src/devices/machine/gt64xxx.cpp
index 71f6504817c..58d28133f0d 100644
--- a/src/devices/machine/gt64xxx.cpp
+++ b/src/devices/machine/gt64xxx.cpp
@@ -24,6 +24,9 @@ DEVICE_ADDRESS_MAP_START(cpu_map, 32, gt64xxx_device)
AM_RANGE(0x00000000, 0x00000cff) AM_READWRITE( cpu_if_r, cpu_if_w)
ADDRESS_MAP_END
+DEVICE_ADDRESS_MAP_START(empty, 32, gt64xxx_device)
+ADDRESS_MAP_END
+
gt64xxx_device::gt64xxx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: pci_host_device(mconfig, GT64XXX, "Galileo GT-64XXX System Controller", tag, owner, clock, "gt64xxx", __FILE__),
m_be(0), m_autoconfig(0), m_irq_num(-1),
@@ -32,14 +35,15 @@ gt64xxx_device::gt64xxx_device(const machine_config &mconfig, const char *tag, d
m_romRegion(*this, "rom"),
m_updateRegion(*this, "update")
{
+ for (int csIndex = 0; csIndex < 4; csIndex++) {
+ m_cs_devices[csIndex] = nullptr;
+ }
}
-void gt64xxx_device::set_cs_map(int id, address_map_constructor map, const char *name, device_t *device)
+void gt64xxx_device::set_map(int id, const address_map_delegate &map, device_t *device)
{
- m_cs_map[id].enable = true;
- m_cs_map[id].name = name;
- m_cs_map[id].device = device;
- m_cs_map[id].map = map;
+ m_cs_maps[id] = map;
+ m_cs_devices[id] = device;
}
const address_space_config *gt64xxx_device::memory_space_config(address_spacenum spacenum) const
@@ -68,6 +72,10 @@ void gt64xxx_device::device_start()
// Leave the timer disabled.
m_dma_timer->adjust(attotime::never, 0, DMA_TIMER_PERIOD);
+ // Reserve 8MB RAM
+ m_ram[0].reserve(0x00800000 / 4);
+ m_ram[0].resize(0x00800000 / 4);
+
// ROM
uint32_t romSize = m_romRegion->bytes();
m_cpu_space->install_rom (0x1fc00000, 0x1fc00000 + romSize - 1, m_romRegion->base());
@@ -89,6 +97,31 @@ void gt64xxx_device::device_start()
m_timer[1].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this));
m_timer[2].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this));
m_timer[3].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this));
+
+ // Save states
+ save_item(NAME(m_pci_stall_state));
+ save_item(NAME(m_retry_count));
+ save_item(NAME(m_pci_cpu_stalled));
+ save_item(NAME(m_cpu_stalled_offset));
+ save_item(NAME(m_cpu_stalled_data));
+ save_item(NAME(m_cpu_stalled_mem_mask));
+ save_item(NAME(m_prev_addr));
+ save_item(NAME(m_reg));
+ for (int i = 0; i < ARRAY_LENGTH(m_timer); i++) {
+ save_item(NAME(m_timer[i].active), i);
+ save_item(NAME(m_timer[i].count), i);
+ }
+ save_item(NAME(m_dma_active));
+ // m_ram[4]
+ save_pointer(NAME(m_ram[0].data()), 0x00800000 / 4);
+ save_item(NAME(m_last_dma));
+ machine().save().register_postload(save_prepost_delegate(FUNC(gt64xxx_device::map_cpu_space), this));
+}
+
+void gt64xxx_device::postload()
+{
+ map_cpu_space();
+ remap_cb();
}
void gt64xxx_device::device_reset()
@@ -170,12 +203,14 @@ void gt64xxx_device::map_cpu_space()
logerror("%s: map_cpu_space cpu_reg start: %08X end: %08X\n", tag(), winStart, winEnd);
// RAS[0:3]
+ m_ram[0].resize(0x00800000 / 4);
for (int ramIndex = 0; ramIndex < 4; ++ramIndex)
{
winStart = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex/2)] << 21) | (m_reg[GREG_RAS0_LO + 0x8 / 4 * ramIndex] << 20);
winEnd = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex / 2)] << 21) | (m_reg[GREG_RAS0_HI + 0x8 / 4 * ramIndex] << 20) | 0xfffff;
- m_ram[ramIndex].resize((winEnd + 1 - winStart) / 4);
- m_cpu_space->install_ram(winStart, winEnd, m_ram[ramIndex].data());
+ //m_ram[ramIndex].resize((winEnd + 1 - winStart) / 4);
+ if (m_ram[ramIndex].size()>0)
+ m_cpu_space->install_ram(winStart, winEnd, m_ram[ramIndex].data());
//m_cpu->add_fastram(winStart, m_ram[ramIndex].size() * sizeof(m_ram[ramIndex][0]), false, &m_ram[ramIndex][0]);
//m_cpu->add_fastram(winStart, m_ram[ramIndex].size() * sizeof(uint32_t), false, m_ram[ramIndex].data());
if (LOG_GALILEO)
@@ -183,27 +218,15 @@ void gt64xxx_device::map_cpu_space()
}
// CS[0:3]
- //m_cpu_space->install_device_delegate(0x16000000, 0x17ffffff, machine().root_device(), m_cs_map[3].map);
- typedef void (gt64xxx_device::*tramp_t)(::address_map &);
- static const tramp_t trampolines[4] = {
- &gt64xxx_device::map_trampoline<0>,
- &gt64xxx_device::map_trampoline<1>,
- &gt64xxx_device::map_trampoline<2>,
- &gt64xxx_device::map_trampoline<3>
- };
- for (int ramIndex = 0; ramIndex < 4; ++ramIndex)
+ for (int csIndex = 0; csIndex < 4; ++csIndex)
{
- if (m_cs_map[ramIndex].enable)
- {
- winStart = (m_reg[GREG_CS_2_0_LO + 0x10 / 4 * (ramIndex / 3)] << 21) | (m_reg[GREG_CS0_LO + 0x8 / 4 * ramIndex] << 20);
- winEnd = (m_reg[GREG_CS_2_0_LO + 0x10 / 4 * (ramIndex / 3)] << 21) | (m_reg[GREG_CS0_HI + 0x8 / 4 * ramIndex] << 20) | 0xfffff;
- install_cs_map(winStart, winEnd, trampolines[ramIndex], m_cs_map[ramIndex].name);
- if (LOG_GALILEO)
- logerror("%s: map_cpu_space cs[%i] start: %08X end: %08X\n", tag(), ramIndex, winStart, winEnd);
- }
+ winStart = (m_reg[GREG_CS_2_0_LO + 0x10 / 4 * (csIndex / 3)] << 21) | (m_reg[GREG_CS0_LO + 0x8 / 4 * csIndex] << 20);
+ winEnd = (m_reg[GREG_CS_2_0_LO + 0x10 / 4 * (csIndex / 3)] << 21) | (m_reg[GREG_CS0_HI + 0x8 / 4 * csIndex] << 20) | 0xfffff;
+ m_cpu_space->install_device_delegate(winStart, winEnd, *m_cs_devices[csIndex], m_cs_maps[csIndex]);
+ if (LOG_GALILEO)
+ logerror("%s: map_cpu_space cs[%i] start: %08X end: %08X\n", tag(), csIndex, winStart, winEnd);
}
-
// PCI IO Window
winStart = m_reg[GREG_PCI_IO_LO]<<21;
winEnd = (m_reg[GREG_PCI_IO_LO]<<21) | (m_reg[GREG_PCI_IO_HI]<<21) | 0x1fffff;
@@ -388,7 +411,7 @@ WRITE32_MEMBER (gt64xxx_device::master_mem1_w)
// PCI Master IO
READ32_MEMBER (gt64xxx_device::master_io_r)
{
- uint32_t result = this->space(AS_IO).read_dword((m_reg[GREG_PCI_IO_LO]<<21) | (offset*4), mem_mask);
+ uint32_t result = this->space(AS_IO).read_dword((m_reg[GREG_PCI_IO_LO] << 21) | (offset * 4), mem_mask);
if (LOG_PCI && m_prev_addr != offset) {
m_prev_addr = offset;
logerror("%06X:galileo pci io read from offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_IO_LO] << 21) | (offset * 4), result, mem_mask);
@@ -397,10 +420,10 @@ READ32_MEMBER (gt64xxx_device::master_io_r)
}
WRITE32_MEMBER (gt64xxx_device::master_io_w)
{
- this->space(AS_IO).write_dword((m_reg[GREG_PCI_IO_LO]<<21) | (offset*4), data, mem_mask);
+ this->space(AS_IO).write_dword((m_reg[GREG_PCI_IO_LO] << 21) | (offset * 4), data, mem_mask);
if (LOG_PCI && m_prev_addr != offset) {
m_prev_addr = offset;
- logerror("%06X:galileo pciio write to offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_IO_LO] << 21) | (offset * 4), data, mem_mask);
+ logerror("%06X:galileo pci io write to offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_IO_LO] << 21) | (offset * 4), data, mem_mask);
}
}