Nios II Classic Software Developer’s Handbook

ID 683282
Date 5/14/2015
Public
Document Table of Contents

11.4.3.4. get_mac_addr() and get_ip_addr()

The NicheStack TCP/IP Stack system code calls get_mac_addr() and get_ip_addr() during the device initialization process. These functions are necessary for the system code to set the MAC and IP addresses for the network interface, which you select with the altera_iniche.iniche_default_if BSP setting.

Because you write these functions yourself, your system has the flexibility to store the MAC address and IP address in an arbitrary location, rather than a fixed location hard-coded in the device driver. For example, some systems might store the MAC address in flash memory, while others might have the MAC address in on-chip embedded memory.

Both functions take as parameters device structures used internally by the NicheStack TCP/IP Stack. However, you do not need to know the details of the structures. You only need to know enough to fill in the MAC and IP addresses.