Visible to Intel only — GUID: mwh1416946958766
Ixiasoft
Visible to Intel only — GUID: mwh1416946958766
Ixiasoft
11.4.3.4.2. Prototype for get_ip_addr()
int get_ip_addr(alt_iniche_dev* p_dev,
ip_addr* ipaddr,
ip_addr* netmask,
ip_addr* gw,
int* use_dhcp);
get_ip_addr() sets the return parameters as follows:
IP4_ADDR(&ipaddr, IPADDR0,IPADDR1,IPADDR2,IPADDR3);
IP4_ADDR(&gw, GWADDR0,GWADDR1,GWADDR2,GWADDR3);
IP4_ADDR(&netmask, MSKADDR0,MSKADDR1,MSKADDR2,MSKADDR3);
For the dummy variables IP_ADDR0-3, substitute expressions for bytes 0-3 of the IP address. For GWADDR0-3, substitute the bytes of the gateway address. For MSKADDR0-3, substitute the bytes of the network mask. For example, the following statement sets ip_addr to IP address 137.57.136.2:
IP4_ADDR ( ip_addr, 137, 57, 136, 2 );To enable DHCP, include the line:
*use_dhcp = 1;The NicheStack TCP/IP stack attempts to get an IP address from the server. If the server does not provide an IP address within 30 seconds, the stack times out and uses the default settings specified in the IP4_ADDR() function calls.
To assign a static IP address, include the lines:
*use_dhcp = 0;The prototype for get_ip_addr() is in the header file <iniche path>/inc/alt_iniche_dev.h.
INICHE_DEFAULT_IF, defined in system.h, identifies the network interface that you defined at system generation time. You can control INICHE_DEFAULT_IF through the iniche_default_if BSP setting.
DHCP_CLIENT, also defined in system.h, specifies whether to use the DHCP client application to obtain an IP address. You can set or clear this property with the altera_iniche.dhcp_client setting.