diff options
-rw-r--r-- | scripts/src/machine.lua | 30 | ||||
-rw-r--r-- | src/devices/machine/sis7001_usb.cpp | 50 | ||||
-rw-r--r-- | src/devices/machine/sis7001_usb.h | 7 | ||||
-rw-r--r-- | src/devices/machine/zfmicro_usb.cpp | 98 | ||||
-rw-r--r-- | src/devices/machine/zfmicro_usb.h | 39 | ||||
-rw-r--r-- | src/mame/misc/matrix.cpp | 4 |
6 files changed, 172 insertions, 56 deletions
diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua index e57d938cc00..560a3b10fd4 100644 --- a/scripts/src/machine.lua +++ b/scripts/src/machine.lua @@ -2462,30 +2462,6 @@ end --------------------------------------------------- -- ---@src/devices/machine/mediagx_cs5530_bridge.h,MACHINES["MEDIAGX_CS5530_BRIDGE"] = true ---------------------------------------------------- - -if (MACHINES["MEDIAGX_CS5530_BRIDGE"]~=null) then - files { - MAME_DIR .. "src/devices/machine/mediagx_cs5530_bridge.cpp", - MAME_DIR .. "src/devices/machine/mediagx_cs5530_bridge.h", - } -end - ---------------------------------------------------- --- ---@src/devices/machine/mediagx_host.h,MACHINES["MEDIAGX_HOST"] = true ---------------------------------------------------- - -if (MACHINES["MEDIAGX_HOST"]~=null) then - files { - MAME_DIR .. "src/devices/machine/mediagx_host.cpp", - MAME_DIR .. "src/devices/machine/mediagx_host.h", - } -end - ---------------------------------------------------- --- --@src/devices/machine/meters.h,MACHINES["METERS"] = true --------------------------------------------------- @@ -2913,6 +2889,12 @@ if (MACHINES["PCI"]~=null) then MAME_DIR .. "src/devices/machine/sis85c496.h", MAME_DIR .. "src/devices/machine/vt8231_isa.cpp", MAME_DIR .. "src/devices/machine/vt8231_isa.h", + MAME_DIR .. "src/devices/machine/mediagx_cs5530_bridge.cpp", + MAME_DIR .. "src/devices/machine/mediagx_cs5530_bridge.h", + MAME_DIR .. "src/devices/machine/mediagx_host.cpp", + MAME_DIR .. "src/devices/machine/mediagx_host.h", + MAME_DIR .. "src/devices/machine/zfmicro_usb.cpp", + MAME_DIR .. "src/devices/machine/zfmicro_usb.h", } end diff --git a/src/devices/machine/sis7001_usb.cpp b/src/devices/machine/sis7001_usb.cpp index c54f62d9713..d1a81f205e1 100644 --- a/src/devices/machine/sis7001_usb.cpp +++ b/src/devices/machine/sis7001_usb.cpp @@ -5,7 +5,7 @@ SiS 7001 USB Host controller TODO: - - Stub interface, to be improved; + - Stub interface, to be merged with pci-usb; - PCI values omitted from docs, assumes same as OpenHCI; **************************************************************************************************/ @@ -13,27 +13,15 @@ #include "emu.h" #include "sis7001_usb.h" -#define LOG_IO (1U << 1) // log PCI register accesses -#define LOG_MAP (1U << 2) // log full remaps - -#define VERBOSE (LOG_GENERAL | LOG_IO | LOG_MAP) +#define VERBOSE (LOG_GENERAL) //#define LOG_OUTPUT_FUNC osd_printf_warning #include "logmacro.h" -#define LOGIO(...) LOGMASKED(LOG_IO, __VA_ARGS__) -#define LOGMAP(...) LOGMASKED(LOG_MAP, __VA_ARGS__) - DEFINE_DEVICE_TYPE(SIS7001_USB, sis7001_usb_device, "sis7001_usb", "SiS 7001 USB Host Controller") sis7001_usb_device::sis7001_usb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pci_device(mconfig, SIS7001_USB, tag, owner, clock) - -{ - -} - -void sis7001_usb_device::device_add_mconfig(machine_config &config) { } @@ -41,29 +29,39 @@ void sis7001_usb_device::device_add_mconfig(machine_config &config) void sis7001_usb_device::config_map(address_map &map) { pci_device::config_map(map); + // no vendor regs? } -void sis7001_usb_device::io_map(address_map &map) +void sis7001_usb_device::map(address_map &map) { - // operational mode + // HcRevision: operational mode + // 1 ---- ---- Legacy PS/2 present + // - 0001 0000 OpenHCI v1.0 map(0x000, 0x003).lr32(NAME([]() { return 0x00000110; })); // ... // HcFmInterval (Windows OSes fails if this isn't r/w) map(0x034, 0x037).lrw32( NAME([this]() { return m_HcFmInterval; } ), - NAME([this](offs_t offset, u32 data, u32 mem_mask) { COMBINE_DATA(&m_HcFmInterval); LOG("Write HcFmInterval %08x & %08x\n", data, mem_mask); }) + NAME([this](offs_t offset, u32 data, u32 mem_mask) { + COMBINE_DATA(&m_HcFmInterval); + LOG("Write HcFmInterval %08x & %08x\n", data, mem_mask); + }) ); // ... - // HcRhDescriptorA, writeable except for 0x4ff + // HcRhDescriptorA + // 0000 0001 ---- ---- ---- ---- ---- ---- POTPGT 2 ms + // ---- ---- xxxx xxxx xxxx x-xx ---- ---- (writeable bits by host controller driver) + // ---- ---- ---- ---- ---- -0-- ---- ---- DT DeviceType (0) not a compound device + // ---- ---- ---- ---- ---- ---- xxxx xxxx NDP NumberDownstreamPorts (15 max) map(0x048, 0x04b).lr32(NAME([this]() { return 0x01000000 | m_downstream_ports; })); // ... -// map(0x05c, 0x05c) last item for function 2, missing on function 3 +// map(0x05c, 0x05f) HcRhPortStatus[3] last item for function 2 (3 ports), missing on function 3 (2) // legacy support mode (8-bit each) -// map(0x100, 0x100) control, bit 0 enables emulation mode -// map(0x104, 0x104) input -// map(0x108, 0x108) output -// map(0x10c, 0x10f) status +// map(0x100, 0x100) [Hce]Control, bit 0 enables emulation mode +// map(0x104, 0x104) [Hce]Input +// map(0x108, 0x108) [Hce]Output +// map(0x10c, 0x10f) [Hce]Status } void sis7001_usb_device::map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space, @@ -76,7 +74,8 @@ void sis7001_usb_device::device_start() { pci_device::device_start(); - add_map(512, M_MEM, FUNC(sis7001_usb_device::io_map)); + // Docs don't mention it, should be 4KB + add_map(4096, M_MEM, FUNC(sis7001_usb_device::map)); // INTD# intr_pin = 4; @@ -87,7 +86,8 @@ void sis7001_usb_device::device_reset() { pci_device::device_reset(); + // TODO: unverified command = 0x0000; status = 0x0000; - m_HcFmInterval = 0; + m_HcFmInterval = 0x2edf; } diff --git a/src/devices/machine/sis7001_usb.h b/src/devices/machine/sis7001_usb.h index 1087b06ce30..7dc1b97e123 100644 --- a/src/devices/machine/sis7001_usb.h +++ b/src/devices/machine/sis7001_usb.h @@ -29,7 +29,7 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; - virtual void device_add_mconfig(machine_config &config) override; +// virtual void device_add_mconfig(machine_config &config) override; // virtual void reset_all_mappings() override; @@ -38,14 +38,11 @@ protected: virtual void config_map(address_map &map) override; - void io_map(address_map &map); + void map(address_map &map); private: u8 m_downstream_ports; u32 m_HcFmInterval = 0; - - u8 unmap_log_r(offs_t offset); - void unmap_log_w(offs_t offset, u8 data); }; DECLARE_DEVICE_TYPE(SIS7001_USB, sis7001_usb_device) diff --git a/src/devices/machine/zfmicro_usb.cpp b/src/devices/machine/zfmicro_usb.cpp new file mode 100644 index 00000000000..1465324638e --- /dev/null +++ b/src/devices/machine/zfmicro_usb.cpp @@ -0,0 +1,98 @@ +// license: BSD-3-Clause +// copyright-holders: Angelo Salese +/************************************************************************************************** + + ZFMicro USB Host controller + + TODO: + - Stub interface, to be merged with pci-usb; + - PCI values omitted from docs, assumes same as OpenHCI; + +**************************************************************************************************/ + +#include "emu.h" +#include "zfmicro_usb.h" + +#define VERBOSE (LOG_GENERAL) +//#define LOG_OUTPUT_FUNC osd_printf_warning + +#include "logmacro.h" + +DEFINE_DEVICE_TYPE(ZFMICRO_USB, zfmicro_usb_device, "sis7001_usb", "ZFMicro PCIUSB Host Controller") + +zfmicro_usb_device::zfmicro_usb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : pci_device(mconfig, ZFMICRO_USB, tag, owner, clock) +{ + // Compaq vendor + set_ids(0x0e11a0f8, 0x00, 0x0c0310, 0x00); + // TODO: should really read from a std::list interface + m_downstream_ports = 2; +} + +void zfmicro_usb_device::config_map(address_map &map) +{ + pci_device::config_map(map); +// map(0x40, 0x43) ASIC Test Mode Enable +// map(0x44, 0x44) ASIC Operational Mode Enable +// ---- ---x Data Buffer Region 16 +// ---- ---1 16 bytes data buffer +// ---- ---0 32 bytes +} + +void zfmicro_usb_device::map(address_map &map) +{ + // HcRevision: operational mode + // 1 ---- ---- Legacy PS/2 present + // - 0001 0000 OpenHCI v1.0 + map(0x000, 0x003).lr32(NAME([]() { return 0x00000110; })); + // ... + // HcFmInterval (Windows OSes fails if this isn't r/w) + map(0x034, 0x037).lrw32( + NAME([this]() { return m_HcFmInterval; } ), + NAME([this](offs_t offset, u32 data, u32 mem_mask) { + COMBINE_DATA(&m_HcFmInterval); + LOG("Write HcFmInterval %08x & %08x\n", data, mem_mask); + }) + ); + // ... + // HcRhDescriptorA + // 0000 0001 ---- ---- ---- ---- ---- ---- POTPGT (unknown for this, assume 2 ms) + // ---- ---- xxxx xxxx xxxx x-xx ---- ---- (writeable bits by host controller driver) + // ---- ---- ---- ---- ---- -0-- ---- ---- DT DeviceType (0) not a compound device + // ---- ---- ---- ---- ---- ---- xxxx xxxx NDP NumberDownstreamPorts (15 max) + map(0x048, 0x04b).lr32(NAME([this]() { return 0x01000000 | m_downstream_ports; })); + // ... + + // legacy support mode (8-bit each) +// map(0x100, 0x100) HceControl, bit 0 enables emulation mode +// map(0x104, 0x104) HceInput +// map(0x108, 0x108) HceOutput +// map(0x10c, 0x10f) HceStatus +} + +void zfmicro_usb_device::map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space, + uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space) +{ + // TODO: overrides I/O ports $0060-$0064 (emulation mode) +} + +void zfmicro_usb_device::device_start() +{ + pci_device::device_start(); + + add_map(4096, M_MEM, FUNC(zfmicro_usb_device::map)); + + // INTA# + intr_pin = 1; +} + + +void zfmicro_usb_device::device_reset() +{ + pci_device::device_reset(); + + // TODO: unverified + command = 0x0000; + status = 0x0000; + m_HcFmInterval = 0x2edf; +} diff --git a/src/devices/machine/zfmicro_usb.h b/src/devices/machine/zfmicro_usb.h new file mode 100644 index 00000000000..34d18892c32 --- /dev/null +++ b/src/devices/machine/zfmicro_usb.h @@ -0,0 +1,39 @@ +// license: BSD-3-Clause +// copyright-holders: Angelo Salese + +#ifndef MAME_MACHINE_ZFMICRO_USB_H +#define MAME_MACHINE_ZFMICRO_USB_H + +#pragma once + +#include "pci.h" + +class zfmicro_usb_device : public pci_device +{ +public: + zfmicro_usb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + static constexpr feature_type unemulated_features() { return feature::MEDIA; } + +protected: + virtual void device_start() override; + virtual void device_reset() override; +// virtual void device_add_mconfig(machine_config &config) override; + +// virtual void reset_all_mappings() override; + + virtual void map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space, + uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space) override; + + virtual void config_map(address_map &map) override; + + void map(address_map &map); + +private: + u8 m_downstream_ports; + u32 m_HcFmInterval = 0; +}; + +DECLARE_DEVICE_TYPE(ZFMICRO_USB, zfmicro_usb_device) + +#endif diff --git a/src/mame/misc/matrix.cpp b/src/mame/misc/matrix.cpp index 01cf4d39dbd..c6d09932ce5 100644 --- a/src/mame/misc/matrix.cpp +++ b/src/mame/misc/matrix.cpp @@ -29,7 +29,7 @@ #include "machine/mediagx_cs5530_bridge.h" #include "machine/mediagx_host.h" #include "machine/pci.h" -//#include "machine/sis7001_usb.h" +#include "machine/zfmicro_usb.h" //#include "video/rivatnt.h" #include "screen.h" @@ -100,7 +100,7 @@ void matrix_state::matrix(machine_config &config) // "pci:12.4" XpressVIDEO // "pci:13.0" (different) 0x0e11a0f8 ZF Micro Chipset USB (Compaq OpenHCI) - //SIS7001_USB(config, "pci:13.0", 0, 2); + ZFMICRO_USB(config, "pci:13.0", 0); // 2 PCI slots, 2 ISA slots ISA16_SLOT(config, "isa1", 0, "pci:12.0:isabus", pc_isa16_cards, nullptr, false); |