src/mess/machine/nubus_asntmc3b.c
| r13181 | r13182 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | Asante MC3B NuBus Ethernet card |
| 3 | Asante MC3NB NuBus Ethernet card (DP83902) |
| 4 | Apple NuBus Ethernet Card (DP8390) |
| 4 | 5 | |
| 5 | | Based on National Semiconductor DP83902 "ST-NIC" |
| 6 | Based on National Semiconductor DP8390 family chips |
| 6 | 7 | |
| 7 | | Fs*D0000 - 64k RAM buffer (used as DP83902 DMA target) |
| 8 | | Fs*E0000 - DP83902 registers |
| 8 | FssD0000 - 64k RAM buffer (used as DP83902 DMA target) |
| 9 | FssE0000 - DP83902 registers |
| 9 | 10 | |
| 10 | 11 | ***************************************************************************/ |
| 11 | 12 | |
| 12 | 13 | #include "emu.h" |
| 13 | 14 | #include "machine/nubus_asntmc3b.h" |
| 14 | 15 | |
| 15 | | #define ASNTMC3B_ROM_REGION "asntm3b_rom" |
| 16 | | #define ASNTMC3B_DP83902 "dp83902" |
| 16 | #define MAC8390_ROM_REGION "asntm3b_rom" |
| 17 | #define MAC8390_839X "dp83902" |
| 17 | 18 | |
| 18 | 19 | static const dp8390_interface dp8390_interface = |
| 19 | 20 | { |
| 20 | | DEVCB_LINE_MEMBER(nubus_asntm3b_device, dp_irq_w), |
| 21 | DEVCB_LINE_MEMBER(nubus_mac8390_device, dp_irq_w), |
| 21 | 22 | DEVCB_NULL, |
| 22 | | DEVCB_MEMBER(nubus_asntm3b_device, dp_mem_read), |
| 23 | | DEVCB_MEMBER(nubus_asntm3b_device, dp_mem_write) |
| 23 | DEVCB_MEMBER(nubus_mac8390_device, dp_mem_read), |
| 24 | DEVCB_MEMBER(nubus_mac8390_device, dp_mem_write) |
| 24 | 25 | }; |
| 25 | 26 | |
| 26 | 27 | MACHINE_CONFIG_FRAGMENT( asntm3b ) |
| 27 | | MCFG_DP8390D_ADD(ASNTMC3B_DP83902, dp8390_interface) |
| 28 | MCFG_DP8390D_ADD(MAC8390_839X, dp8390_interface) |
| 28 | 29 | MACHINE_CONFIG_END |
| 29 | 30 | |
| 30 | | ROM_START( asntm3b ) |
| 31 | | ROM_REGION(0x4000, ASNTMC3B_ROM_REGION, 0) |
| 31 | ROM_START( asntm3nb ) |
| 32 | ROM_REGION(0x4000, MAC8390_ROM_REGION, 0) |
| 32 | 33 | ROM_LOAD( "asante_mc3b.bin", 0x000000, 0x004000, CRC(4f86d451) SHA1(d0a41df667e6b51fbc63f9251d593f4fc49104ba) ) |
| 33 | 34 | ROM_END |
| 34 | 35 | |
| 36 | ROM_START( appleenet ) |
| 37 | ROM_REGION(0x4000, MAC8390_ROM_REGION, 0) |
| 38 | ROM_LOAD( "aenet1", 0x000000, 0x004000, CRC(e3ae8c26) SHA1(01ddc15ee84b17128203cb812f29bac6b20fd642) ) |
| 39 | ROM_END |
| 40 | |
| 35 | 41 | //************************************************************************** |
| 36 | 42 | // GLOBAL VARIABLES |
| 37 | 43 | //************************************************************************** |
| 38 | 44 | |
| 39 | | const device_type NUBUS_ASNTMC3B = &device_creator<nubus_asntm3b_device>; |
| 45 | const device_type NUBUS_ASNTMC3NB = &device_creator<nubus_asntmc3nb_device>; |
| 46 | const device_type NUBUS_APPLEENET = &device_creator<nubus_appleenet_device>; |
| 40 | 47 | |
| 41 | 48 | |
| 42 | 49 | //------------------------------------------------- |
| r13181 | r13182 | |
| 44 | 51 | // machine configurations |
| 45 | 52 | //------------------------------------------------- |
| 46 | 53 | |
| 47 | | machine_config_constructor nubus_asntm3b_device::device_mconfig_additions() const |
| 54 | machine_config_constructor nubus_mac8390_device::device_mconfig_additions() const |
| 48 | 55 | { |
| 49 | 56 | return MACHINE_CONFIG_NAME( asntm3b ); |
| 50 | 57 | } |
| r13181 | r13182 | |
| 53 | 60 | // rom_region - device-specific ROM region |
| 54 | 61 | //------------------------------------------------- |
| 55 | 62 | |
| 56 | | const rom_entry *nubus_asntm3b_device::device_rom_region() const |
| 63 | const rom_entry *nubus_mac8390_device::device_rom_region() const |
| 57 | 64 | { |
| 58 | | return ROM_NAME( asntm3b ); |
| 65 | return ROM_NAME( asntm3nb ); |
| 59 | 66 | } |
| 60 | 67 | |
| 68 | const rom_entry *nubus_appleenet_device::device_rom_region() const |
| 69 | { |
| 70 | return ROM_NAME( appleenet ); |
| 71 | } |
| 72 | |
| 61 | 73 | //************************************************************************** |
| 62 | 74 | // LIVE DEVICE |
| 63 | 75 | //************************************************************************** |
| 64 | 76 | |
| 65 | 77 | //------------------------------------------------- |
| 66 | | // nubus_asntm3b_device - constructor |
| 78 | // nubus_mac8390_device - constructor |
| 67 | 79 | //------------------------------------------------- |
| 68 | 80 | |
| 69 | | nubus_asntm3b_device::nubus_asntm3b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 70 | | device_t(mconfig, NUBUS_ASNTMC3B, "Asante MC3B Ethernet card", tag, owner, clock), |
| 81 | nubus_mac8390_device::nubus_mac8390_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| 82 | device_t(mconfig, NUBUS_ASNTMC3NB, name, tag, owner, clock), |
| 71 | 83 | device_nubus_card_interface(mconfig, *this), |
| 72 | | m_dp83902(*this, ASNTMC3B_DP83902) |
| 84 | m_dp83902(*this, MAC8390_839X) |
| 73 | 85 | { |
| 74 | | m_shortname = "nb_amc3b"; |
| 75 | 86 | } |
| 76 | 87 | |
| 77 | | nubus_asntm3b_device::nubus_asntm3b_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| 78 | | device_t(mconfig, type, name, tag, owner, clock), |
| 79 | | device_nubus_card_interface(mconfig, *this), |
| 80 | | m_dp83902(*this, ASNTMC3B_DP83902) |
| 88 | nubus_asntmc3nb_device::nubus_asntmc3nb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 89 | nubus_mac8390_device(mconfig, NUBUS_ASNTMC3NB, "Asante MC3NB Ethernet card", tag, owner, clock) |
| 81 | 90 | { |
| 82 | 91 | m_shortname = "nb_amc3b"; |
| 83 | 92 | } |
| 84 | 93 | |
| 94 | nubus_appleenet_device::nubus_appleenet_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 95 | nubus_mac8390_device(mconfig, NUBUS_APPLEENET, "Apple NuBus Ethernet card", tag, owner, clock) |
| 96 | { |
| 97 | m_shortname = "nb_aenet"; |
| 98 | } |
| 99 | |
| 85 | 100 | //------------------------------------------------- |
| 86 | 101 | // device_start - device-specific startup |
| 87 | 102 | //------------------------------------------------- |
| 88 | 103 | |
| 89 | | void nubus_asntm3b_device::device_start() |
| 104 | void nubus_mac8390_device::device_start() |
| 90 | 105 | { |
| 91 | 106 | UINT32 slotspace; |
| 92 | 107 | char mac[7]; |
| r13181 | r13182 | |
| 99 | 114 | |
| 100 | 115 | // set_nubus_device makes m_slot valid |
| 101 | 116 | set_nubus_device(); |
| 102 | | install_declaration_rom(this, ASNTMC3B_ROM_REGION, true); |
| 117 | install_declaration_rom(this, MAC8390_ROM_REGION, true); |
| 103 | 118 | |
| 104 | 119 | slotspace = get_slotspace(); |
| 105 | 120 | |
| 106 | | // printf("[ASNTMC3B %p] slotspace = %x\n", this, slotspace); |
| 121 | // printf("[ASNTMC3NB %p] slotspace = %x\n", this, slotspace); |
| 107 | 122 | |
| 108 | | m_nubus->install_device(slotspace+0xd0000, slotspace+0xdffff, read8_delegate(FUNC(nubus_asntm3b_device::asntm3b_ram_r), this), write8_delegate(FUNC(nubus_asntm3b_device::asntm3b_ram_w), this)); |
| 109 | | m_nubus->install_device(slotspace+0xbd0000, slotspace+0xbdffff, read8_delegate(FUNC(nubus_asntm3b_device::asntm3b_ram_r), this), write8_delegate(FUNC(nubus_asntm3b_device::asntm3b_ram_w), this)); |
| 110 | | m_nubus->install_device(slotspace+0xe0000, slotspace+0xe003f, read32_delegate(FUNC(nubus_asntm3b_device::en_r), this), write32_delegate(FUNC(nubus_asntm3b_device::en_w), this)); |
| 111 | | m_nubus->install_device(slotspace+0xbe0000, slotspace+0xbe003f, read32_delegate(FUNC(nubus_asntm3b_device::en_r), this), write32_delegate(FUNC(nubus_asntm3b_device::en_w), this)); |
| 123 | // TODO: move 24-bit mirroring down into nubus.c |
| 124 | UINT32 ofs_24bit = m_slot<<20; |
| 125 | m_nubus->install_device(slotspace+0xd0000, slotspace+0xdffff, read8_delegate(FUNC(nubus_mac8390_device::asntm3b_ram_r), this), write8_delegate(FUNC(nubus_mac8390_device::asntm3b_ram_w), this)); |
| 126 | m_nubus->install_device(slotspace+0xe0000, slotspace+0xe003f, read32_delegate(FUNC(nubus_mac8390_device::en_r), this), write32_delegate(FUNC(nubus_mac8390_device::en_w), this)); |
| 127 | m_nubus->install_device(slotspace+0xd0000+ofs_24bit, slotspace+0xdffff+ofs_24bit, read8_delegate(FUNC(nubus_mac8390_device::asntm3b_ram_r), this), write8_delegate(FUNC(nubus_mac8390_device::asntm3b_ram_w), this)); |
| 128 | m_nubus->install_device(slotspace+0xe0000+ofs_24bit, slotspace+0xe003f+ofs_24bit, read32_delegate(FUNC(nubus_mac8390_device::en_r), this), write32_delegate(FUNC(nubus_mac8390_device::en_w), this)); |
| 112 | 129 | } |
| 113 | 130 | |
| 114 | 131 | //------------------------------------------------- |
| 115 | 132 | // device_reset - device-specific reset |
| 116 | 133 | //------------------------------------------------- |
| 117 | 134 | |
| 118 | | void nubus_asntm3b_device::device_reset() |
| 135 | void nubus_mac8390_device::device_reset() |
| 119 | 136 | { |
| 120 | 137 | m_dp83902->dp8390_reset(0); |
| 121 | 138 | m_dp83902->dp8390_cs(0); |
| 122 | 139 | } |
| 123 | 140 | |
| 124 | | WRITE8_MEMBER( nubus_asntm3b_device::asntm3b_ram_w ) |
| 141 | WRITE8_MEMBER( nubus_mac8390_device::asntm3b_ram_w ) |
| 125 | 142 | { |
| 126 | | // printf("MC3B: CPU wrote %02x to RAM @ %x\n", data, offset); |
| 143 | // printf("MC3NB: CPU wrote %02x to RAM @ %x\n", data, offset); |
| 127 | 144 | m_ram[offset] = data; |
| 128 | 145 | } |
| 129 | 146 | |
| 130 | | READ8_MEMBER( nubus_asntm3b_device::asntm3b_ram_r ) |
| 147 | READ8_MEMBER( nubus_mac8390_device::asntm3b_ram_r ) |
| 131 | 148 | { |
| 132 | | // printf("MC3B: CPU read %02x @ RAM %x\n", m_ram[offset], offset); |
| 149 | // printf("MC3NB: CPU read %02x @ RAM %x\n", m_ram[offset], offset); |
| 133 | 150 | return m_ram[offset]; |
| 134 | 151 | } |
| 135 | 152 | |
| 136 | | WRITE32_MEMBER( nubus_asntm3b_device::en_w ) |
| 153 | WRITE32_MEMBER( nubus_mac8390_device::en_w ) |
| 137 | 154 | { |
| 138 | 155 | if (mem_mask == 0xff000000) |
| 139 | 156 | { |
| r13181 | r13182 | |
| 148 | 165 | } |
| 149 | 166 | else |
| 150 | 167 | { |
| 151 | | fatalerror("asntm3b: write %08x to DP83902 @ %x with unhandled mask %08x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device())); |
| 168 | fatalerror("asntmc3nb: write %08x to DP83902 @ %x with unhandled mask %08x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device())); |
| 152 | 169 | } |
| 153 | 170 | } |
| 154 | 171 | |
| 155 | | READ32_MEMBER( nubus_asntm3b_device::en_r ) |
| 172 | READ32_MEMBER( nubus_mac8390_device::en_r ) |
| 156 | 173 | { |
| 157 | 174 | if (mem_mask == 0xff000000) |
| 158 | 175 | { |
| r13181 | r13182 | |
| 166 | 183 | } |
| 167 | 184 | else |
| 168 | 185 | { |
| 169 | | fatalerror("asntm3b: read DP83902 @ %x with unhandled mask %08x (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device())); |
| 186 | fatalerror("asntmc3nb: read DP83902 @ %x with unhandled mask %08x (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device())); |
| 170 | 187 | } |
| 171 | 188 | |
| 172 | 189 | return 0; |
| 173 | 190 | } |
| 174 | 191 | |
| 175 | | WRITE_LINE_MEMBER( nubus_asntm3b_device::dp_irq_w ) |
| 192 | WRITE_LINE_MEMBER( nubus_mac8390_device::dp_irq_w ) |
| 176 | 193 | { |
| 177 | 194 | if (state) |
| 178 | 195 | { |
| r13181 | r13182 | |
| 184 | 201 | } |
| 185 | 202 | } |
| 186 | 203 | |
| 187 | | READ8_MEMBER( nubus_asntm3b_device::dp_mem_read ) |
| 204 | READ8_MEMBER( nubus_mac8390_device::dp_mem_read ) |
| 188 | 205 | { |
| 189 | | // printf("MC3B: 8390 read RAM @ %x = %02x\n", offset, m_ram[offset]); |
| 206 | // printf("MC3NB: 8390 read RAM @ %x = %02x\n", offset, m_ram[offset]); |
| 190 | 207 | return m_ram[offset]; |
| 191 | 208 | } |
| 192 | 209 | |
| 193 | | WRITE8_MEMBER( nubus_asntm3b_device::dp_mem_write ) |
| 210 | WRITE8_MEMBER( nubus_mac8390_device::dp_mem_write ) |
| 194 | 211 | { |
| 195 | | // printf("MC3B: 8390 wrote %02x to RAM @ %x\n", data, offset); |
| 212 | // printf("MC3NB: 8390 wrote %02x to RAM @ %x\n", data, offset); |
| 196 | 213 | m_ram[offset] = data; |
| 197 | 214 | } |