From f91404a088222d1ff10db9bcb15f96da5f939139 Mon Sep 17 00:00:00 2001 From: Patrick Mackinlay Date: Mon, 10 Jul 2017 18:11:28 +0700 Subject: i82586: intel 82586/82596 ethernet controllers, skeleton only (nw) (#2456) * i82586: initial commit, skeleton only * oops (nw) * i82586: added databook references * use address space for memory access --- scripts/src/machine.lua | 12 +++++ scripts/target/mame/mess.lua | 1 + src/devices/machine/i82586.cpp | 119 +++++++++++++++++++++++++++++++++++++++++ src/devices/machine/i82586.h | 86 +++++++++++++++++++++++++++++ 4 files changed, 218 insertions(+) create mode 100644 src/devices/machine/i82586.cpp create mode 100644 src/devices/machine/i82586.h diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua index db1feb75e54..7b0356db03b 100644 --- a/scripts/src/machine.lua +++ b/scripts/src/machine.lua @@ -3215,3 +3215,15 @@ if (MACHINES["SMIOC"]~=null) then MAME_DIR .. "src/devices/machine/smioc.h", } end + +--------------------------------------------------- +-- +--@src/devices/machine/i82586.h,MACHINES["I82586"] = true +--------------------------------------------------- + +if (MACHINES["I82586"]~=null) then + files { + MAME_DIR .. "src/devices/machine/i82586.cpp", + MAME_DIR .. "src/devices/machine/i82586.h", + } +end diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index d5842e9d774..6b4b0c9f62d 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -607,6 +607,7 @@ MACHINES["APPLE_FDC"] = true MACHINES["SONY_DRIVE"] = true MACHINES["SCNXX562"] = true MACHINES["FGA002"] = true +MACHINES["I82586"] = true MACHINES["INPUT_MERGER"] = true -- MACHINES["K054321"] = true diff --git a/src/devices/machine/i82586.cpp b/src/devices/machine/i82586.cpp new file mode 100644 index 00000000000..57f260f3984 --- /dev/null +++ b/src/devices/machine/i82586.cpp @@ -0,0 +1,119 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +/* +* An implementation of the Intel 82586 and 82596 Ethernet controller devices. +* +* Hopefully this might eventually support all of the following, but initial focus will be 82586 and 82596DX +* because these are used in the InterPro 2xxx and 6xxx series systems: +* +* - 82586 - 16/24 data/address bus, 6/8/10 MHz +* - 82596SX - 16/32 data/address bus, 16/20 MHz +* - 82596DX - 32/32 data/address bus, 25/33 MHz +* - 82596CA - 32/32 data/address bus, 16/20/25/33 MHz +* +* Some documents covering the above include: +* +* http://bitsavers.org/pdf/intel/_dataBooks/1991_Microcommunications.pdf +* http://bitsavers.org/pdf/intel/_dataBooks/1996_Networking.pdf +* https://www.intel.com/assets/pdf/general/82596ca.pdf +* +* TODO +* - virtually everything +*/ + +#include "emu.h" +#include "i82586.h" + +DEFINE_DEVICE_TYPE(I82586, i82586_device, "i82586", "Intel 82586 IEEE 802.3 Ethernet LAN Coprocessor") +DEFINE_DEVICE_TYPE(I82596SX, i82596sx_device, "i82596sx", "Intel 82596SX High-Performance 32-Bit Local Area Network Coprocessor") +DEFINE_DEVICE_TYPE(I82596DX, i82596dx_device, "i82596dx", "Intel 82596DX High-Performance 32-Bit Local Area Network Coprocessor") + +i82586_base_device::i82586_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u8 datawidth, u8 addrwidth) + : device_t(mconfig, type, tag, owner, clock), + device_memory_interface(mconfig, *this), + device_network_interface(mconfig, *this, 10.0f), + m_space_config("shared", ENDIANNESS_LITTLE, datawidth, addrwidth), + m_out_irq(*this) +{} + +i82586_device::i82586_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : i82586_base_device(mconfig, I82586, tag, owner, clock, 16, 24) +{} + +i82596_base_device::i82596_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u8 datawidth, u8 addrwidth) + : i82586_base_device(mconfig, type, tag, owner, clock, datawidth, addrwidth) +{} + +i82596sx_device::i82596sx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : i82596_base_device(mconfig, I82596SX, tag, owner, clock, 16, 32) +{} + +i82596dx_device::i82596dx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : i82596_base_device(mconfig, I82596DX, tag, owner, clock, 32, 32) +{} + +void i82586_base_device::device_start() +{ + m_space = &space(0); + + m_out_irq.resolve(); +} + +void i82586_base_device::device_reset() +{ +} + +std::vector> i82586_base_device::memory_space_config() const +{ + return std::vector> { + std::make_pair(0, &m_space_config) + }; +} + +WRITE_LINE_MEMBER(i82586_base_device::ca) +{ + logerror("%s: channel attention %s (%s)\n", state ? "asserted" : "deasserted", tag(), machine().describe_context()); +} + +void i82586_device::device_start() +{ + i82586_base_device::device_start(); +} + +void i82586_device::device_reset() +{ + i82586_base_device::device_reset(); +} + +void i82596_base_device::device_start() +{ + i82586_base_device::device_start(); +} + +void i82596_base_device::device_reset() +{ + i82586_base_device::device_reset(); +} + +void i82596_base_device::port(u32 data) +{ + switch (data & 0xf) + { + case 0: + // execute a software reset + break; + + case 1: + // execute a self-test + break; + + case 2: + // write an alterantive system configuration pointer address + break; + + case 3: + // write an alternative dump area pointer and perform dump + break; + } +} diff --git a/src/devices/machine/i82586.h b/src/devices/machine/i82586.h new file mode 100644 index 00000000000..f48f7edd49a --- /dev/null +++ b/src/devices/machine/i82586.h @@ -0,0 +1,86 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#ifndef MAME_MACHINE_I82586_H +#define MAME_MACHINE_I82586_H + +#pragma once + +#define MCFG_I82586_IRQ_CB(_out_irq) \ + devcb = &i82586_base_device::static_set_out_irq_callback(*device, DEVCB_##_out_irq); + +class i82586_base_device : + public device_t, + public device_memory_interface, + public device_network_interface +{ +public: + template static devcb_base &static_set_out_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq.set_callback(object); } + + DECLARE_WRITE_LINE_MEMBER(ca); + +protected: + i82586_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u8 datawidth, u8 addrwidth); + + virtual void device_start() override; + virtual void device_reset() override; + + virtual std::vector> memory_space_config() const override; + + address_space_config m_space_config; + address_space *m_space; + + devcb_write_line m_out_irq; +}; + +class i82586_device : public i82586_base_device +{ +public: + i82586_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + +private: +}; + +class i82596_base_device : public i82586_base_device +{ +public: + void port(u32 data); // cpu access interface + +protected: + i82596_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u8 datawidth, u8 addrwidth); + + virtual void device_start() override; + virtual void device_reset() override; + +private: +}; + +class i82596sx_device : public i82596_base_device +{ +public: + i82596sx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + +private: +}; + +class i82596dx_device : public i82596_base_device +{ +public: + i82596dx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + +private: +}; + +DECLARE_DEVICE_TYPE(I82586, i82586_device) +DECLARE_DEVICE_TYPE(I82596SX, i82596sx_device) +DECLARE_DEVICE_TYPE(I82596DX, i82596dx_device) + +#endif // MAME_MACHINE_I82586_H -- cgit v1.2.3