Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12455 Discussions

Iniche stack - how found MAC address from IP

Altera_Forum
Honored Contributor II
841 Views

I'm using Nios II system to provide ethernet services (like ICMP, ARP etc. etc.) to an video over IP design. I'm using the uCOS II system with Nichestack.  

My video to IP transmitter (hardware design) needs to known the MAC address of the receiver interface. Since the user didn't specify the MAC address but only the IP address, I need to find the MAC address from the IP.  

I'm a newbie with uCOS and Nichestack. 

How I can implement a function that search for IP in the ARP table and if doesn't exist make and ARP request and send back the MAC address? I can use some existing functions? 

Thanks.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
149 Views

Review the source in et_arp.c You'll need to write your own function to extract the MAC from the ARP table, but functions exist for sending the ARP request. 

 

The ARP table is in 

struct arptabent arp_table;
Altera_Forum
Honored Contributor II
149 Views

Thanks, 

I've implemented a function that parse the ARP table up to find correspondance between my IP and IP contained in ARP table, then I extract the relative MAC address. 

 

//parse arp_table to find matching specified IP <-> IP in ARP table and then readback MAC address 

for (i=0; i<= MAXARPS; i++) 

if (arp_table.t_pro_addr ==invert_addr_byte_order(udp_ip_tx_config[0].ipdestaddress)) 

mac_found = 1; 

mac_addr[0] = arp_table.t_phy_addr[0]; 

MAC_addr[1] = arp_table.t_phy_addr[1]; 

mac_addr[2] = arp_table.t_phy_addr[2]; 

MAC_addr[3] = arp_table.t_phy_addr[3]; 

mac_addr[4] = arp_table.t_phy_addr[4]; 

MAC_addr[5] = arp_table[i].t_phy_addr[5]; 

}
Reply