mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 21:01:25 +01:00
make generates MAC addr compliant with the IEEE standard by setting the Locally Administered bit and clearing the Group Adress bit
This commit is contained in:
parent
25c2f06574
commit
f2891ee348
@ -81,6 +81,8 @@ INTERRUPT_CALLBACK interruptHandler=0;
|
||||
|
||||
void DCCTimer::getSimulatedMacAddress(byte mac[6]) {
|
||||
memcpy(mac,(void *) &SIGROW.SERNUM0,6); // serial number
|
||||
mac[0] &= 0xFE;
|
||||
mac[0] |= 0x02;
|
||||
}
|
||||
|
||||
#else
|
||||
@ -139,7 +141,12 @@ INTERRUPT_CALLBACK interruptHandler=0;
|
||||
|
||||
#include <avr/boot.h>
|
||||
void DCCTimer::getSimulatedMacAddress(byte mac[6]) {
|
||||
for (byte i=0; i<6; i++) mac[i]=boot_signature_byte_get(0x0E + i);
|
||||
for (byte i=0; i<6; i++) {
|
||||
mac[i]=boot_signature_byte_get(0x0E + i);
|
||||
}
|
||||
mac[0] &= 0xFE;
|
||||
mac[0] |= 0x02;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -54,7 +54,7 @@ EthernetInterface::EthernetInterface()
|
||||
DCCTimer::getSimulatedMacAddress(mac);
|
||||
DIAG(F("\n+++++ Ethernet Setup. Simulatd mac="));
|
||||
for (byte i=0;i<sizeof(mac); i++) {
|
||||
DIAG(F("%x:"),mac[i]);
|
||||
DIAG(F("%s%x:"),mac[i] < 0x10 ? "0" : "", mac[i]);
|
||||
}
|
||||
DIAG(F("\n"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user