mirror of
https://github.com/holub/mame
synced 2025-04-25 17:56:43 +03:00
Change parameter type for device_network_interface::set_mac from char * to u8 *
This commit is contained in:
parent
8e838e96c6
commit
f32bb79e85
@ -3,6 +3,8 @@
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "3c503.h"
|
#include "3c503.h"
|
||||||
|
|
||||||
|
#include "multibyte.h"
|
||||||
|
|
||||||
#define SADDR 0xcc000
|
#define SADDR 0xcc000
|
||||||
|
|
||||||
void el2_3c503_device::device_add_mconfig(machine_config &config)
|
void el2_3c503_device::device_add_mconfig(machine_config &config)
|
||||||
@ -24,10 +26,13 @@ el2_3c503_device::el2_3c503_device(const machine_config& mconfig, const char* ta
|
|||||||
}
|
}
|
||||||
|
|
||||||
void el2_3c503_device::device_start() {
|
void el2_3c503_device::device_start() {
|
||||||
char mac[7];
|
uint8_t mac[6];
|
||||||
uint32_t num = machine().rand();
|
uint32_t num = machine().rand();
|
||||||
memset(m_prom, 0x57, 16);
|
memset(m_prom, 0x57, 16);
|
||||||
snprintf(mac, std::size(mac), "\x02\x60\x8c%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
|
mac[0] = 0x02;
|
||||||
|
mac[1] = 0x60;
|
||||||
|
mac[2] = 0x8c;
|
||||||
|
put_u24be(mac+3, num);
|
||||||
memcpy(m_prom, mac, 6);
|
memcpy(m_prom, mac, 6);
|
||||||
memset(m_rom, 0, 8*1024); // empty
|
memset(m_rom, 0, 8*1024); // empty
|
||||||
m_dp8390->set_mac(mac);
|
m_dp8390->set_mac(mac);
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "ne1000.h"
|
#include "ne1000.h"
|
||||||
|
|
||||||
|
#include "multibyte.h"
|
||||||
|
|
||||||
|
|
||||||
DEFINE_DEVICE_TYPE(NE1000, ne1000_device, "ne1000", "NE1000 Network Adapter")
|
DEFINE_DEVICE_TYPE(NE1000, ne1000_device, "ne1000", "NE1000 Network Adapter")
|
||||||
|
|
||||||
@ -23,10 +25,11 @@ ne1000_device::ne1000_device(const machine_config &mconfig, const char *tag, dev
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ne1000_device::device_start() {
|
void ne1000_device::device_start() {
|
||||||
char mac[7];
|
uint8_t mac[6];
|
||||||
uint32_t num = machine().rand();
|
uint32_t num = machine().rand();
|
||||||
memset(m_prom, 0x57, 16);
|
memset(m_prom, 0x57, 16);
|
||||||
sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
|
mac[2] = 0x1b;
|
||||||
|
put_u24be(mac+3, num);
|
||||||
mac[0] = 0; mac[1] = 0; // avoid gcc warning
|
mac[0] = 0; mac[1] = 0; // avoid gcc warning
|
||||||
memcpy(m_prom, mac, 6);
|
memcpy(m_prom, mac, 6);
|
||||||
m_dp8390->set_mac(mac);
|
m_dp8390->set_mac(mac);
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "ne2000.h"
|
#include "ne2000.h"
|
||||||
|
|
||||||
|
#include "multibyte.h"
|
||||||
|
|
||||||
|
|
||||||
DEFINE_DEVICE_TYPE(NE2000, ne2000_device, "ne2000", "NE2000 Network Adapter")
|
DEFINE_DEVICE_TYPE(NE2000, ne2000_device, "ne2000", "NE2000 Network Adapter")
|
||||||
|
|
||||||
@ -23,10 +25,11 @@ ne2000_device::ne2000_device(const machine_config& mconfig, const char* tag, dev
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ne2000_device::device_start() {
|
void ne2000_device::device_start() {
|
||||||
char mac[7];
|
uint8_t mac[6];
|
||||||
uint32_t num = machine().rand();
|
uint32_t num = machine().rand();
|
||||||
memset(m_prom, 0x57, 16);
|
memset(m_prom, 0x57, 16);
|
||||||
sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
|
mac[2] = 0x1b;
|
||||||
|
put_u24be(mac+3, num);
|
||||||
mac[0] = 0; mac[1] = 0; // avoid gcc warning
|
mac[0] = 0; mac[1] = 0; // avoid gcc warning
|
||||||
memcpy(m_prom, mac, 6);
|
memcpy(m_prom, mac, 6);
|
||||||
m_dp8390->set_mac(mac);
|
m_dp8390->set_mac(mac);
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "nubus_asntmc3b.h"
|
#include "nubus_asntmc3b.h"
|
||||||
|
|
||||||
|
#include "multibyte.h"
|
||||||
|
|
||||||
#define MAC8390_ROM_REGION "asntm3b_rom"
|
#define MAC8390_ROM_REGION "asntm3b_rom"
|
||||||
#define MAC8390_839X "dp83902"
|
#define MAC8390_839X "dp83902"
|
||||||
|
|
||||||
@ -95,10 +97,11 @@ nubus_appleenet_device::nubus_appleenet_device(const machine_config &mconfig, co
|
|||||||
void nubus_mac8390_device::device_start()
|
void nubus_mac8390_device::device_start()
|
||||||
{
|
{
|
||||||
uint32_t slotspace;
|
uint32_t slotspace;
|
||||||
char mac[7];
|
uint8_t mac[6];
|
||||||
uint32_t num = machine().rand();
|
uint32_t num = machine().rand();
|
||||||
memset(m_prom, 0x57, 16);
|
memset(m_prom, 0x57, 16);
|
||||||
sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
|
mac[2] = 0x1b;
|
||||||
|
put_u24be(mac+3, num);
|
||||||
mac[0] = mac[1] = 0; // avoid gcc warning
|
mac[0] = mac[1] = 0; // avoid gcc warning
|
||||||
memcpy(m_prom, mac, 6);
|
memcpy(m_prom, mac, 6);
|
||||||
m_dp83902->set_mac(mac);
|
m_dp83902->set_mac(mac);
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#include "machine/dp8390.h"
|
#include "machine/dp8390.h"
|
||||||
|
|
||||||
|
#include "multibyte.h"
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// DEVICE DEFINITIONS
|
// DEVICE DEFINITIONS
|
||||||
@ -39,11 +41,12 @@ x68k_neptune_device::x68k_neptune_device(const machine_config &mconfig, const ch
|
|||||||
|
|
||||||
void x68k_neptune_device::device_start()
|
void x68k_neptune_device::device_start()
|
||||||
{
|
{
|
||||||
char mac[7];
|
uint8_t mac[6];
|
||||||
uint32_t num = machine().rand();
|
uint32_t num = machine().rand();
|
||||||
m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
|
m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
|
||||||
memset(m_prom, 0x57, 16);
|
memset(m_prom, 0x57, 16);
|
||||||
sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
|
mac[2] = 0x1b;
|
||||||
|
put_u24be(mac+3, num);
|
||||||
mac[0] = 0; mac[1] = 0; // avoid gcc warning
|
mac[0] = 0; mac[1] = 0; // avoid gcc warning
|
||||||
memcpy(m_prom, mac, 6);
|
memcpy(m_prom, mac, 6);
|
||||||
m_dp8390->set_mac(mac);
|
m_dp8390->set_mac(mac);
|
||||||
|
@ -694,7 +694,7 @@ void am7990_device_base::initialize()
|
|||||||
put_u16le(&m_physical_addr[0], init_block[1]);
|
put_u16le(&m_physical_addr[0], init_block[1]);
|
||||||
put_u16le(&m_physical_addr[2], init_block[2]);
|
put_u16le(&m_physical_addr[2], init_block[2]);
|
||||||
put_u16le(&m_physical_addr[4], init_block[3]);
|
put_u16le(&m_physical_addr[4], init_block[3]);
|
||||||
set_mac((char *)m_physical_addr);
|
set_mac(m_physical_addr);
|
||||||
|
|
||||||
m_logical_addr_filter = (u64(init_block[7]) << 48) | (u64(init_block[6]) << 32) | (u32(init_block[5]) << 16) | init_block[4];
|
m_logical_addr_filter = (u64(init_block[7]) << 48) | (u64(init_block[6]) << 32) | (u32(init_block[5]) << 16) | init_block[4];
|
||||||
|
|
||||||
|
@ -923,7 +923,7 @@ void cs8900a_device::cs8900_sideeffects_write_pp(u16 ppaddress, int odd_address)
|
|||||||
|
|
||||||
/* the MAC address has been changed */
|
/* the MAC address has been changed */
|
||||||
cs8900_ia_mac[ppaddress - CS8900_PP_ADDR_MAC_ADDR + odd_address] = GET_PP_8(ppaddress + odd_address);
|
cs8900_ia_mac[ppaddress - CS8900_PP_ADDR_MAC_ADDR + odd_address] = GET_PP_8(ppaddress + odd_address);
|
||||||
set_mac((char *)cs8900_ia_mac);
|
set_mac(cs8900_ia_mac);
|
||||||
|
|
||||||
if (odd_address && (ppaddress == CS8900_PP_ADDR_MAC_ADDR + 4))
|
if (odd_address && (ppaddress == CS8900_PP_ADDR_MAC_ADDR + 4))
|
||||||
LOGMASKED(CS8900_DEBUG, "set MAC address: %02x:%02x:%02x:%02x:%02x:%02x",
|
LOGMASKED(CS8900_DEBUG, "set MAC address: %02x:%02x:%02x:%02x:%02x:%02x",
|
||||||
|
@ -422,7 +422,7 @@ void dp8390_device::cs_write(offs_t offset, uint8_t data) {
|
|||||||
case 0x45:
|
case 0x45:
|
||||||
case 0x46:
|
case 0x46:
|
||||||
m_regs.par[(offset & 0x7)-1] = data;
|
m_regs.par[(offset & 0x7)-1] = data;
|
||||||
set_mac((const char *)m_regs.par);
|
set_mac(m_regs.par);
|
||||||
break;
|
break;
|
||||||
case 0x47:
|
case 0x47:
|
||||||
m_regs.curr = data;
|
m_regs.curr = data;
|
||||||
|
@ -838,7 +838,7 @@ bool i82586_device::cu_iasetup()
|
|||||||
put_u32le(&mac[2], data);
|
put_u32le(&mac[2], data);
|
||||||
|
|
||||||
LOG("cu_iasetup individual address %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
LOG("cu_iasetup individual address %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
set_mac((char *)mac);
|
set_mac(mac);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1367,7 +1367,7 @@ bool i82596_device::cu_iasetup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG("cu_iasetup individual address %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
LOG("cu_iasetup individual address %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
set_mac((char *)mac);
|
set_mac(mac);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ void mb8795_device::mac_w(offs_t offset, uint8_t data)
|
|||||||
{
|
{
|
||||||
if(offset < 6) {
|
if(offset < 6) {
|
||||||
mac[offset] = data;
|
mac[offset] = data;
|
||||||
set_mac((const char *)mac);
|
set_mac(mac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "smc91c9x.h"
|
#include "smc91c9x.h"
|
||||||
|
|
||||||
|
#include "multibyte.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
@ -972,7 +974,12 @@ void smc91c9x_device::write(offs_t offset, u16 data, u16 mem_mask)
|
|||||||
if ( ACCESSING_BITS_8_15 )
|
if ( ACCESSING_BITS_8_15 )
|
||||||
{
|
{
|
||||||
set_promisc(m_reg[B0_RCR] & PRMS);
|
set_promisc(m_reg[B0_RCR] & PRMS);
|
||||||
set_mac((char *)&m_reg[B1_IA0_1]);
|
|
||||||
|
u8 mac[6];
|
||||||
|
put_u16le(&mac[0], m_reg[B1_IA0_1]);
|
||||||
|
put_u16le(&mac[2], m_reg[B1_IA2_3]);
|
||||||
|
put_u16le(&mac[4], m_reg[B1_IA4_5]);
|
||||||
|
set_mac(mac);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ device_network_interface::device_network_interface(const machine_config &mconfig
|
|||||||
// Convert to Mibps to Bps
|
// Convert to Mibps to Bps
|
||||||
m_bandwidth = bandwidth << (20 - 3);
|
m_bandwidth = bandwidth << (20 - 3);
|
||||||
m_mtu = mtu;
|
m_mtu = mtu;
|
||||||
set_mac("\0\0\0\0\0\0");
|
memset(m_mac, 0, 6);
|
||||||
m_intf = -1;
|
m_intf = -1;
|
||||||
m_loopback_control = false;
|
m_loopback_control = false;
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ void device_network_interface::set_promisc(bool promisc)
|
|||||||
if(m_dev) m_dev->set_promisc(promisc);
|
if(m_dev) m_dev->set_promisc(promisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void device_network_interface::set_mac(const char *mac)
|
void device_network_interface::set_mac(const u8 *mac)
|
||||||
{
|
{
|
||||||
memcpy(m_mac, mac, 6);
|
memcpy(m_mac, mac, 6);
|
||||||
if(m_dev) m_dev->set_mac(m_mac);
|
if(m_dev) m_dev->set_mac(m_mac);
|
||||||
|
@ -16,7 +16,7 @@ public:
|
|||||||
|
|
||||||
void set_interface(int id);
|
void set_interface(int id);
|
||||||
void set_promisc(bool promisc);
|
void set_promisc(bool promisc);
|
||||||
void set_mac(const char *mac);
|
void set_mac(const u8 *mac);
|
||||||
void set_loopback(bool loopback);
|
void set_loopback(bool loopback);
|
||||||
|
|
||||||
const char *get_mac() const { return m_mac; }
|
const char *get_mac() const { return m_mac; }
|
||||||
|
@ -57,7 +57,7 @@ void network_manager::config_load(config_type cfg_type, config_level cfg_level,
|
|||||||
network.set_interface(interface);
|
network.set_interface(interface);
|
||||||
const char *mac_addr = node->get_attribute_string("mac", nullptr);
|
const char *mac_addr = node->get_attribute_string("mac", nullptr);
|
||||||
if (mac_addr != nullptr && strlen(mac_addr) == 17) {
|
if (mac_addr != nullptr && strlen(mac_addr) == 17) {
|
||||||
char mac[7];
|
uint8_t mac[6];
|
||||||
unsigned int mac_num[6];
|
unsigned int mac_num[6];
|
||||||
sscanf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", &mac_num[0], &mac_num[1], &mac_num[2], &mac_num[3], &mac_num[4], &mac_num[5]);
|
sscanf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", &mac_num[0], &mac_num[1], &mac_num[2], &mac_num[3], &mac_num[4], &mac_num[5]);
|
||||||
for (int i = 0; i<6; i++) mac[i] = mac_num[i];
|
for (int i = 0; i<6; i++) mac[i] = mac_num[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user