Commit 8604cb0c authored by li hongming's avatar li hongming

Set mac ready signal for tcpip module when receiving the arp.

parent 0b710156
...@@ -103,6 +103,8 @@ void tcpip_set_hisMAC(uint8_t mac_addr[]) ...@@ -103,6 +103,8 @@ void tcpip_set_hisMAC(uint8_t mac_addr[])
{ {
memcpy((uint8_t *)(BASE_TCPIP_CFG + TCPIP_UDP_TX_DST_MAC_HIGH16 + 2), (uint8_t *)mac_addr, 2); memcpy((uint8_t *)(BASE_TCPIP_CFG + TCPIP_UDP_TX_DST_MAC_HIGH16 + 2), (uint8_t *)mac_addr, 2);
memcpy((uint8_t *)(BASE_TCPIP_CFG + TCPIP_UDP_TX_DST_MAC_LOW32), (uint8_t *)mac_addr+2, 4); memcpy((uint8_t *)(BASE_TCPIP_CFG + TCPIP_UDP_TX_DST_MAC_LOW32), (uint8_t *)mac_addr+2, 4);
// Set the mac ready signal
memset((uint8_t *)(BASE_TCPIP_CFG + TCPIP_UDP_TX_DST_MAC_HIGH16), 0xFF, 2);
} }
void tcpip_get_hisMAC(uint8_t mac_addr[]) void tcpip_get_hisMAC(uint8_t mac_addr[])
......
...@@ -84,16 +84,16 @@ static int process_arp(uint8_t * buf, int len) ...@@ -84,16 +84,16 @@ static int process_arp(uint8_t * buf, int len)
return ARP_END; return ARP_END;
} }
} }
} } else if (buf[ARP_OPER + 1] == 2)
tcpip_get_hisIP(hisIP);
if ( ((buf[ARP_OPER + 1] != 2)||memcmp(buf + ARP_SPA, hisIP, 4)) == 0 )
{ {
memcpy(hisMAC, buf + ARP_SHA, 6); tcpip_get_hisIP(hisIP);
tcpip_set_hisMAC(hisMAC); if (memcmp(buf + ARP_SPA, hisIP, 4) == 0)
tcpip_status = TCPIP_OK; {
memcpy(hisMAC, buf + ARP_SHA, 6);
tcpip_set_hisMAC(hisMAC);
tcpip_status = TCPIP_OK;
}
} }
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment