Forum Discussion
Altera_Forum
Honored Contributor
15 years agoWith "define" I didn't mean# define, but I meant you must provide in your code the two functions. These will be called by iniche upon initialization.
Here are two simple templates:int get_ip_addr(alt_iniche_dev *p_dev,
ip_addr* ipaddr,
ip_addr* netmask,
ip_addr* gw,
int* use_dhcp)
{
IP4_ADDR(*ipaddr, 192, 168, 101, 100);
IP4_ADDR(*gw, 192, 168, 101, 1);
IP4_ADDR(*netmask, 255, 255, 255, 0);
# ifdef DHCP_CLIENT
*use_dhcp = 1;# else /* not DHCP_CLIENT */
*use_dhcp = 0;
printf("TCP/IP port\n");
printf("Static IP Address is %d.%d.%d.%d\n",
ip4_addr1(*ipaddr),
ip4_addr2(*ipaddr),
ip4_addr3(*ipaddr),
ip4_addr4(*ipaddr) );# endif /* not DHCP_CLIENT */
/* Non-standard API: return 1 for success */
return 1;
}
int get_mac_addr(NET net, unsigned char mac_addr)
{
mac_addr = MAC_BYTE1;
mac_addr = MAC_BYTE2;
mac_addr = MAC_BYTE3;
mac_addr = MAC_BYTE4;
mac_addr = MAC_BYTE5;
mac_addr = MAC_BYTE6;
printf("Default Ethernet MAC address is %02x:%02x:%02x:%02x:%02x:%02x\n",
mac_addr,
mac_addr,
mac_addr,
mac_addr,
mac_addr,
mac_addr);
}
get_ip_address() is called by iniche_devices_init(), which is in file alt_iniche_dev.c get_mac_address() is called by your MAC initialization function; if you use TSE is prep_tse_mac() in ins_tse_mac.c file Regards Cris