mirror of https://github.com/ARMmbed/mbed-os.git
Static mac address for ethernet interface
- enables to debug code even with semihosting enabledpull/26/head
parent
0e013cf5c8
commit
4ea25c9ebd
|
@ -69,9 +69,14 @@ static void init_netif(ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_mac_address(void) {
|
static void set_mac_address(void) {
|
||||||
|
#if defined(MBED_MAC_ADDRESS)
|
||||||
|
snprintf(mac_addr, 19, "%12x", "MBED_MAC_ADDRESS");
|
||||||
|
#else
|
||||||
char mac[6];
|
char mac[6];
|
||||||
mbed_mac_address(mac);
|
mbed_mac_address(mac);
|
||||||
snprintf(mac_addr, 19, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
snprintf(mac_addr, 19, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int EthernetInterface::init() {
|
int EthernetInterface::init() {
|
||||||
|
|
|
@ -1021,7 +1021,11 @@ err_t lpc_enetif_init(struct netif *netif)
|
||||||
lpc_enetdata.netif = netif;
|
lpc_enetdata.netif = netif;
|
||||||
|
|
||||||
/* set MAC hardware address */
|
/* set MAC hardware address */
|
||||||
|
#if defined(MBED_MAC_ADDRESS)
|
||||||
|
snprintf((char *)netif->hwaddr, NETIF_MAX_HWADDR_LEN, "%12x", "MBED_MAC_ADDRESS");
|
||||||
|
#else
|
||||||
mbed_mac_address((char *)netif->hwaddr);
|
mbed_mac_address((char *)netif->hwaddr);
|
||||||
|
#endif
|
||||||
netif->hwaddr_len = ETHARP_HWADDR_LEN;
|
netif->hwaddr_len = ETHARP_HWADDR_LEN;
|
||||||
|
|
||||||
/* maximum transfer unit */
|
/* maximum transfer unit */
|
||||||
|
|
Loading…
Reference in New Issue