mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #663 from bikeNomad/master
Ensure that IG (Global) bit is reset in MAC address for K64F and otherspull/686/head
commit
59fa5437e3
|
@ -98,6 +98,7 @@ WEAK void mbed_mac_address(char *mac) {
|
|||
mac[i] = byte;
|
||||
p += 2;
|
||||
}
|
||||
mac[0] &= ~0x01; // reset the IG bit in the address; see IEE 802.3-2002, Section 3.2.3(b)
|
||||
} else { // else return a default MAC
|
||||
#endif
|
||||
mac[0] = 0x00;
|
||||
|
|
|
@ -38,12 +38,12 @@ void mbed_mac_address(char *mac)
|
|||
uint32_t word0 = *(uint32_t *)0x40048060;
|
||||
// Fetch word 1
|
||||
// we only want bottom 16 bits of word1 (MAC bits 32-47)
|
||||
// and bit 9 forced to 1, bit 8 forced to 0
|
||||
// and bit 1 forced to 1, bit 0 forced to 0
|
||||
// Locally administered MAC, reduced conflicts
|
||||
// http://en.wikipedia.org/wiki/MAC_address
|
||||
uint32_t word1 = *(uint32_t *)0x4004805C;
|
||||
word1 |= 0x00000200;
|
||||
word1 &= 0x0000FEFF;
|
||||
word1 |= 0x00000002;
|
||||
word1 &= 0x0000FFFE;
|
||||
|
||||
mac[0] = (word1 & 0x000000ff);
|
||||
mac[1] = (word1 & 0x0000ff00) >> 8;
|
||||
|
|
Loading…
Reference in New Issue