Forum Discussion
Altera_Forum
Honored Contributor
16 years agoAltera TSE driver and example program for lwIP (1.3.2)
After many many requests and complaints about lack of support and/or documentation for support of lwIP for the Altera TSE, I have developed a drop-in TSE driver and example program and made this avai...
Altera_Forum
Honored Contributor
14 years agoYou must force an MAC resolve first, this can be accomplished by sending an UDP or ICMP packet to the address you are trying to resolve. How we are doing this is by sending ping packets to the host we want to resolve.
Here is the peace of code we use to resolve the mac address of the destination: while (mac->mac == 0 && --nRetries)
{
// avoid context switching which could result in ARP entry cleanup and cause invalid data while memcoping
portENTER_CRITICAL();
// if result is positive we found a match
if (etharp_find_addr(netif_default, &ip_req, ð_mac, &ip_ret) >= 0)
memcpy(mac->bytes, eth_mac->addr, MAC_ADDRESS_SIZE);
// enable interrupts back on
portEXIT_CRITICAL();
// only sleep if we don't have a MAC yet
if (mac->mac == 0) {
lwip_ping_target_data(ipaddr, 1, 1, (u8_t*)"hello", (sizeof("hello") - 1));
Sleep(100);
}
}