summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2020-06-04 13:09:08 -0400
committer AJR <ajrhacker@users.noreply.github.com>2020-06-04 13:17:39 -0400
commit754a13530ce857f609f5fe3dbbad460bd2f6ec29 (patch)
tree461fd4f9afc9caf223fb6d881d75220754091b08
parent8a017c1bc84cf3395fb6c01e4c50ac94cc2b0f70 (diff)
dp8390: Eliminate CS line handler; use separate read and write handlers instead (nw)
-rw-r--r--src/devices/bus/isa/3c503.cpp6
-rw-r--r--src/devices/bus/isa/ne1000.cpp12
-rw-r--r--src/devices/bus/isa/ne2000.cpp16
-rw-r--r--src/devices/bus/nubus/nubus_asntmc3b.cpp13
-rw-r--r--src/devices/bus/x68k/x68k_neptunex.cpp19
-rw-r--r--src/devices/machine/dp8390.cpp73
-rw-r--r--src/devices/machine/dp8390.h8
7 files changed, 60 insertions, 87 deletions
diff --git a/src/devices/bus/isa/3c503.cpp b/src/devices/bus/isa/3c503.cpp
index 71e783c5830..de7363ceb26 100644
--- a/src/devices/bus/isa/3c503.cpp
+++ b/src/devices/bus/isa/3c503.cpp
@@ -110,8 +110,7 @@ void el2_3c503_device::dack_w(int line, uint8_t data) {
uint8_t el2_3c503_device::el2_3c503_loport_r(offs_t offset) {
switch((m_regs.ctrl >> 2) & 3) {
case 0:
- m_dp8390->dp8390_cs(CLEAR_LINE);
- return m_dp8390->dp8390_r(offset);
+ return m_dp8390->cs_read(offset);
case 1:
return m_prom[offset];
case 2:
@@ -125,8 +124,7 @@ uint8_t el2_3c503_device::el2_3c503_loport_r(offs_t offset) {
void el2_3c503_device::el2_3c503_loport_w(offs_t offset, uint8_t data) {
switch((m_regs.ctrl >> 2) & 3) {
case 0:
- m_dp8390->dp8390_cs(CLEAR_LINE);
- return m_dp8390->dp8390_w(offset, data);
+ return m_dp8390->cs_write(offset, data);
case 1:
case 2:
logerror("3c503: invalid attempt to write to prom\n");
diff --git a/src/devices/bus/isa/ne1000.cpp b/src/devices/bus/isa/ne1000.cpp
index 86e0f9b7afe..d2234098c34 100644
--- a/src/devices/bus/isa/ne1000.cpp
+++ b/src/devices/bus/isa/ne1000.cpp
@@ -41,13 +41,11 @@ void ne1000_device::device_reset() {
uint8_t ne1000_device::ne1000_port_r(offs_t offset) {
if(offset < 16) {
- m_dp8390->dp8390_cs(CLEAR_LINE);
- return m_dp8390->dp8390_r(offset);
+ return m_dp8390->cs_read(offset);
}
switch(offset) {
case 16:
- m_dp8390->dp8390_cs(ASSERT_LINE);
- return m_dp8390->dp8390_r(offset);
+ return m_dp8390->remote_read();
case 31:
m_dp8390->dp8390_reset(CLEAR_LINE);
return 0;
@@ -59,14 +57,12 @@ uint8_t ne1000_device::ne1000_port_r(offs_t offset) {
void ne1000_device::ne1000_port_w(offs_t offset, uint8_t data) {
if(offset < 16) {
- m_dp8390->dp8390_cs(CLEAR_LINE);
- m_dp8390->dp8390_w(offset, data);
+ m_dp8390->cs_write(offset, data);
return;
}
switch(offset) {
case 16:
- m_dp8390->dp8390_cs(ASSERT_LINE);
- m_dp8390->dp8390_w(offset, data);
+ m_dp8390->remote_write(data);
return;
case 31:
m_dp8390->dp8390_reset(ASSERT_LINE);
diff --git a/src/devices/bus/isa/ne2000.cpp b/src/devices/bus/isa/ne2000.cpp
index 17c8466ce50..3fc60df6b21 100644
--- a/src/devices/bus/isa/ne2000.cpp
+++ b/src/devices/bus/isa/ne2000.cpp
@@ -42,15 +42,13 @@ void ne2000_device::device_reset() {
READ16_MEMBER(ne2000_device::ne2000_port_r) {
offset <<= 1;
if(offset < 16) {
- m_dp8390->dp8390_cs(CLEAR_LINE);
- return m_dp8390->dp8390_r(offset) |
- m_dp8390->dp8390_r(offset+1) << 8;
+ return m_dp8390->cs_read(offset) |
+ m_dp8390->cs_read(offset+1) << 8;
}
if(mem_mask == 0xff00) offset++;
switch(offset) {
case 16:
- m_dp8390->dp8390_cs(ASSERT_LINE);
- return m_dp8390->dp8390_r(offset);
+ return m_dp8390->remote_read();
case 31:
m_dp8390->dp8390_reset(CLEAR_LINE);
return 0;
@@ -63,20 +61,18 @@ READ16_MEMBER(ne2000_device::ne2000_port_r) {
WRITE16_MEMBER(ne2000_device::ne2000_port_w) {
offset <<= 1;
if(offset < 16) {
- m_dp8390->dp8390_cs(CLEAR_LINE);
if(mem_mask == 0xff00) {
data >>= 8;
offset++;
}
- m_dp8390->dp8390_w(offset, data & 0xff);
- if(mem_mask == 0xffff) m_dp8390->dp8390_w(offset+1, data>>8);
+ m_dp8390->cs_write(offset, data & 0xff);
+ if(mem_mask == 0xffff) m_dp8390->cs_write(offset+1, data>>8);
return;
}
if(mem_mask == 0xff00) offset++;
switch(offset) {
case 16:
- m_dp8390->dp8390_cs(ASSERT_LINE);
- m_dp8390->dp8390_w(offset, data);
+ m_dp8390->remote_write(data);
return;
case 31:
m_dp8390->dp8390_reset(ASSERT_LINE);
diff --git a/src/devices/bus/nubus/nubus_asntmc3b.cpp b/src/devices/bus/nubus/nubus_asntmc3b.cpp
index a96dbcfc655..f68328ef45f 100644
--- a/src/devices/bus/nubus/nubus_asntmc3b.cpp
+++ b/src/devices/bus/nubus/nubus_asntmc3b.cpp
@@ -124,7 +124,6 @@ void nubus_mac8390_device::device_start()
void nubus_mac8390_device::device_reset()
{
m_dp83902->dp8390_reset(0);
- m_dp83902->dp8390_cs(0);
memcpy(m_prom, m_dp83902->get_mac(), 6);
}
@@ -145,13 +144,11 @@ WRITE32_MEMBER( nubus_mac8390_device::en_w )
if (mem_mask == 0xff000000)
{
// printf("%02x to 8390 @ %x\n", data>>24, 0xf-offset);
- m_dp83902->dp8390_w(0xf-offset, data>>24);
+ m_dp83902->cs_write(0xf-offset, data>>24);
}
else if (mem_mask == 0xffff0000)
{
- m_dp83902->dp8390_cs(1);
- m_dp83902->dp8390_w(0xf-offset, data>>16);
- m_dp83902->dp8390_cs(0);
+ m_dp83902->remote_write(data>>16);
}
else
{
@@ -163,13 +160,11 @@ READ32_MEMBER( nubus_mac8390_device::en_r )
{
if (mem_mask == 0xff000000)
{
- return (m_dp83902->dp8390_r(0xf-offset)<<24);
+ return (m_dp83902->cs_read(0xf-offset)<<24);
}
else if (mem_mask == 0xffff0000)
{
- m_dp83902->dp8390_cs(1);
- return (m_dp83902->dp8390_r(0xf-offset)<<16);
- m_dp83902->dp8390_cs(0);
+ return (m_dp83902->remote_read()<<16);
}
else
{
diff --git a/src/devices/bus/x68k/x68k_neptunex.cpp b/src/devices/bus/x68k/x68k_neptunex.cpp
index b1fd9d4542f..608acd4587c 100644
--- a/src/devices/bus/x68k/x68k_neptunex.cpp
+++ b/src/devices/bus/x68k/x68k_neptunex.cpp
@@ -62,17 +62,15 @@ READ16_MEMBER(x68k_neptune_device::x68k_neptune_port_r)
return 0xffff;
if(offset < 0x100+16)
{
- m_dp8390->dp8390_cs(CLEAR_LINE);
- return (m_dp8390->dp8390_r(offset) << 8)|
- m_dp8390->dp8390_r(offset+1);
+ return (m_dp8390->cs_read(offset) << 8)|
+ m_dp8390->cs_read(offset+1);
}
//if(mem_mask == 0x00ff) offset++;
switch(offset)
{
case 0x100+16:
- m_dp8390->dp8390_cs(ASSERT_LINE);
- data = m_dp8390->dp8390_r(offset);
- data = ((data & 0x00ff) << 8) | ((data & 0xff00) >> 8);
+ data = m_dp8390->remote_read();
+ data = swapendian_int16(data);
return data;
case 0x100+31:
m_dp8390->dp8390_reset(CLEAR_LINE);
@@ -89,23 +87,20 @@ WRITE16_MEMBER(x68k_neptune_device::x68k_neptune_port_w)
return;
if(offset < 0x100+16)
{
- m_dp8390->dp8390_cs(CLEAR_LINE);
if(mem_mask == 0x00ff)
{
data <<= 8;
offset++;
}
- m_dp8390->dp8390_w(offset, data>>8);
- if(mem_mask == 0xffff) m_dp8390->dp8390_w(offset+1, data & 0xff);
+ m_dp8390->cs_write(offset, data>>8);
+ if(mem_mask == 0xffff) m_dp8390->cs_write(offset+1, data & 0xff);
return;
}
//if(mem_mask == 0x00ff) offset++;
switch(offset)
{
case 0x100+16:
- m_dp8390->dp8390_cs(ASSERT_LINE);
- data = ((data & 0x00ff) << 8) | ((data & 0xff00) >> 8);
- m_dp8390->dp8390_w(offset, data);
+ m_dp8390->remote_write(swapendian_int16(data));
return;
case 0x100+31:
m_dp8390->dp8390_reset(ASSERT_LINE);
diff --git a/src/devices/machine/dp8390.cpp b/src/devices/machine/dp8390.cpp
index c898332d1f4..c238801122b 100644
--- a/src/devices/machine/dp8390.cpp
+++ b/src/devices/machine/dp8390.cpp
@@ -28,7 +28,6 @@ dp8390_device::dp8390_device(const machine_config &mconfig, device_type type, co
, m_mem_read_cb(*this)
, m_mem_write_cb(*this)
, m_reset(0)
- , m_cs(false)
, m_rdma_active(0)
{
}
@@ -172,33 +171,29 @@ void dp8390_device::recv_cb(uint8_t *buf, int len) {
if(!LOOPBACK) recv(buf, len);
}
-WRITE_LINE_MEMBER(dp8390_device::dp8390_cs) {
- m_cs = state;
-}
-
WRITE_LINE_MEMBER(dp8390_device::dp8390_reset) {
if(!state) device_reset();
}
-uint16_t dp8390_device::dp8390_r(offs_t offset) {
- uint16_t data;
- if(m_cs) {
- uint32_t high16 = (m_regs.dcr & 4)?m_regs.rsar<<16:0;
- if(m_regs.dcr & 1) {
- m_regs.crda &= ~1;
- data = m_mem_read_cb(high16 + m_regs.crda++);
- data |= m_mem_read_cb(high16 + m_regs.crda++) << 8;
- m_regs.rbcr -= (m_regs.rbcr < 2)?m_regs.rbcr:2;
- check_dma_complete();
- return DP8390_BYTE_ORDER(data);
- } else {
- m_regs.rbcr -= (m_regs.rbcr)?1:0;
- data = m_mem_read_cb(high16 + m_regs.crda++);
- check_dma_complete();
- return data;
- }
+uint16_t dp8390_device::remote_read() {
+ uint32_t high16 = (m_regs.dcr & 4)?m_regs.rsar<<16:0;
+ if(m_regs.dcr & 1) {
+ m_regs.crda &= ~1;
+ uint16_t data = m_mem_read_cb(high16 + m_regs.crda++);
+ data |= m_mem_read_cb(high16 + m_regs.crda++) << 8;
+ m_regs.rbcr -= (m_regs.rbcr < 2)?m_regs.rbcr:2;
+ check_dma_complete();
+ return DP8390_BYTE_ORDER(data);
+ } else {
+ m_regs.rbcr -= (m_regs.rbcr)?1:0;
+ uint16_t data = m_mem_read_cb(high16 + m_regs.crda++);
+ check_dma_complete();
+ return data;
}
+}
+uint8_t dp8390_device::cs_read(offs_t offset) {
+ uint8_t data;
switch((offset & 0x0f)|(m_regs.cr & 0xc0)) {
case 0x00:
case 0x40:
@@ -350,26 +345,24 @@ uint16_t dp8390_device::dp8390_r(offs_t offset) {
return data;
}
-void dp8390_device::dp8390_w(offs_t offset, uint16_t data) {
- if(m_cs) {
- uint32_t high16 = (m_regs.dcr & 4)?m_regs.rsar<<16:0;
- if(m_regs.dcr & 1) {
- data = DP8390_BYTE_ORDER(data);
- m_regs.crda &= ~1;
- m_mem_write_cb(high16 + m_regs.crda++, data & 0xff);
- m_mem_write_cb(high16 + m_regs.crda++, data >> 8);
- m_regs.rbcr -= (m_regs.rbcr < 2)?m_regs.rbcr:2;
- check_dma_complete();
- } else {
- data &= 0xff;
- m_mem_write_cb(high16 + m_regs.crda++, data);
- m_regs.rbcr -= (m_regs.rbcr)?1:0;
- check_dma_complete();
- }
- return;
+void dp8390_device::remote_write(uint16_t data) {
+ uint32_t high16 = (m_regs.dcr & 4)?m_regs.rsar<<16:0;
+ if(m_regs.dcr & 1) {
+ data = DP8390_BYTE_ORDER(data);
+ m_regs.crda &= ~1;
+ m_mem_write_cb(high16 + m_regs.crda++, data & 0xff);
+ m_mem_write_cb(high16 + m_regs.crda++, data >> 8);
+ m_regs.rbcr -= (m_regs.rbcr < 2)?m_regs.rbcr:2;
+ check_dma_complete();
+ } else {
+ data &= 0xff;
+ m_mem_write_cb(high16 + m_regs.crda++, data);
+ m_regs.rbcr -= (m_regs.rbcr)?1:0;
+ check_dma_complete();
}
+}
- data &= 0xff;
+void dp8390_device::cs_write(offs_t offset, uint8_t data) {
switch((offset & 0x0f)|(m_regs.cr & 0xc0)) {
case 0x00:
case 0x40:
diff --git a/src/devices/machine/dp8390.h b/src/devices/machine/dp8390.h
index adaed69d529..64bc6436733 100644
--- a/src/devices/machine/dp8390.h
+++ b/src/devices/machine/dp8390.h
@@ -16,9 +16,10 @@ public:
auto mem_read_callback() { return m_mem_read_cb.bind(); }
auto mem_write_callback() { return m_mem_write_cb.bind(); }
- void dp8390_w(offs_t offset, uint16_t data);
- uint16_t dp8390_r(offs_t offset);
- DECLARE_WRITE_LINE_MEMBER( dp8390_cs );
+ void remote_write(uint16_t data);
+ void cs_write(offs_t offset, uint8_t data);
+ uint16_t remote_read();
+ uint8_t cs_read(offs_t offset);
DECLARE_WRITE_LINE_MEMBER( dp8390_reset );
void recv_cb(uint8_t *buf, int len) override;
@@ -52,7 +53,6 @@ private:
void recv(uint8_t *buf, int len);
int m_reset;
- bool m_cs;
int m_rdma_active;
struct {